SparkFun Qwiic Thermocouple Hookup Guide

Pages
Contributors: Alex the Giant, Ell C
Favorited Favorite 3

Software Setup and Programming

Note: This code/library has been written and tested on Arduino IDE version 1.8.10. Otherwise, make sure you are using the latest stable version of the Arduino IDE on your desktop.

If this is your first time using Arduino, please review our tutorial on installing the Arduino IDE. If you have not previously installed an Arduino library, please check out our installation guide.

SparkFun has written a library to work with the Qwiic Thermocouple. You can obtain this library through the Arduino Library Manager by searching for MCP9600. Find the one written by SparkFun Electronics and install the latest version. If you prefer downloading libraries manually, you can grab them from the GitHub Repository.

MCP9600 Library Overview

Device Status

  • bool begin( uint8_t address = DEV_ADDR, TwoWire &wirePort = Wire ) - Sets device I2C address to a user-specified address, over whatever port the user specifies. If left blank, the default address 0x60 is used on the Wire bus.
  • bool available( void ) - Also referred to as the data ready bit, returns true if the thermocouple (hot) junction temperature has been updated since last checked.
  • bool isConnected( void ) - Returns true if the thermocouple will acknowledge over I2C, and false otherwise.
  • uint16_t deviceID( void ) - Returns the contents of the device ID register. The upper 8 bits are constant, but the lower contain revision data.
  • bool checkDeviceID( void ) - Returns true if the constant upper 8 bits in the device ID register are what they should be according to the datasheet.
  • bool resetToDefaults( void ) - Resets all device parameters to their default values. Returns 1 if there was an error, 0 otherwise.

Sensor measurements

  • float getThermocoupleTemp( bool units = true ) - Returns the thermocouple temperature, and clears the data ready bit. Set units to true for Celcius (default), or false for freedom units (Fahrenheit).
  • float getAmbientTemp( bool units = true ) - Returns the ambient (IC die) temperature. Set units to true for Celcius (default), or false for freedom units (Fahrenheit).
  • float getTempDelta( bool units = true ) - Returns the difference in temperature between the thermocouple and ambient junctions. Set units to true for Celcius (default), or false for freedom units (Fahrenheit).
  • signed long getRawADC( void ) - Returns the raw contents of the ADC register.
  • bool isInputRangeExceeded( void ) - Returns true if the MCP9600's EMF range has been exceeded, and false otherwise.

Measurement configuration

  • bool setAmbientResolution( Ambient_Resolution res ) - Changes the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. Lower resolution reduces conversion time.
  • Ambient_Resolution getAmbientResolution( void ) - Returns the resolution on the cold (ambient) junction, for either 0.0625 or 0.25 degree C resolution. Lower resolution reduces conversion time.
  • bool setThermocoupleResolution( Thermocouple_Resolution res ) - Changes the resolution on the hot (thermocouple) junction, for either 12, 14, 16, or 18-bit resolution. Lower resolution reduces conversion time.
  • Thermocouple_Resolution getThermocoupleResolution( void ) - Returns the resolution on the hot (thermocouple) junction, for either 12, 14, 16, or 18-bit resolution. Lower resolution reduces conversion time.
  • uint8_t setThermocoupleType( Thermocouple_Type type ) - Changes the type of thermocouple connected to the MCP9600. Supported types are K, J, T, N, S, E, B, R.
  • Thermocouple_Type getThermocoupleType( void ) - Returns the type of thermocouple connected to the MCP9600 as found in its configuration register. Supported types are K, J, T, N, S, E, B, R.
  • uint8_t setFilterCoefficient( uint8_t coefficient ) - Changes the weight of the on-chip exponential moving average filter. Set this to 0 for no filter, 1 for minimum filter, and 7 for maximum filter.
  • uint8_t getFilterCoefficient( void ) - Returns the weight of the on-chip exponential moving average filter.
  • bool setBurstSamples( Burst_Sample samples ) - Changes the amount of samples to take in burst mode. Returns 0 if set sucessfully, 1 otherwise.
  • Burst_Sample getBurstSamples( void ) - Returns the amount of samples to take in burst mode, according to the device's configuration register.
  • bool burstAvailable( void ) - Returns true if all the burst samples have been taken and the results are ready. Returns false otherwise.
  • bool startBurst( void ) - Initiates a burst on the MCP9600.
  • bool setShutdownMode( Shutdown_Mode mode ) - Changes the shutdown "operating" mode of the MCP9600. Configurable to Normal, Shutdown, and Burst. Returns 0 if properly set, 1 otherwise.
  • Shutdown_Mode getShutdownMode( void ) - Returns the shutdown "operating" mode of the MCP9600. Configurable to Normal, Shutdown, and Burst.

Temperature Alerts

  • bool configAlertTemp( uint8_t number, float temp ) - Configures the temperature at which to trigger the alert for a given alert number.
  • bool configAlertJunction( uint8_t number, bool junction ) - Configures the junction to monitor the temperature of to trigger the alert. Set to zero for the thermocouple (hot) junction, or one for the ambient (cold) junction.
  • bool configAlertHysteresis( uint8_t number, uint8_t hysteresis ) - Configures the hysteresis to use around the temperature set point, in degrees Celcius.
  • bool configAlertEdge( uint8_t number, bool edge ) - Configures whether to trigger the alert on the rising (cold -> hot) or falling (hot -> cold) edge of the temperature change. Set to 1 for rising, 0 for falling.
  • bool configAlertLogicLevel( uint8_t number, bool level ) - Configures whether the hardware alert pin is active-high or active-low. Set to 1 for active-high, 0 for active-low.
  • bool configAlertMode( uint8_t number, bool mode ) - Configures whether the MCP9600 treats the alert like a comparator or an interrrupt. Set to 1 for interrupt, 0 for comparator. More information is on pg. 34 of the datasheet.
  • bool configAlertEnable( uint8_t number, bool enable ) - Configures whether or not the interrupt is enabled or not. Set to 1 to enable, or 0 to disable.
  • bool clearAlertPin( uint8_t number ) - Clears the interrupt on the specified alert channel, resetting the value of the pin.
  • bool isTempGreaterThanLimit( uint8_t number ) - Returns true if the interrupt has been triggered, false otherwise