adafruit_mcp9600

CircuitPython driver for the MCP9600 thermocouple I2C amplifier

  • Author(s): Dan Cogliano, Kattni Rembor

Implementation Notes

Hardware:

Software and Dependencies:

class adafruit_mcp9600.MCP9600(i2c, address=103, tctype='K', tcfilter=0)

Interface to the MCP9600 thermocouple amplifier breakout

alert_1

Alert 1 status.

alert_2

Alert 2 status.

alert_3

Alert 3 status.

alert_4

Alert 4 status.

alert_config(*, alert_number, alert_temp_source, alert_temp_limit, alert_hysteresis, alert_temp_direction, alert_mode, alert_state)

Configure a specified alert pin. Alert is enabled by default when alert is configured. To disable an alert pin, use alert_disable.

Parameters:
  • alert_number (int) – The alert pin number. Must be 1-4.
  • alert_temp_source – The temperature source to monitor for the alert. Options are: THERMOCOUPLE (hot-junction) or AMBIENT (cold-junction). Temperatures are in Celsius.
  • alert_temp_limit (float) – The temperature in degrees Celsius at which the alert should trigger. For rising temperatures, the alert will trigger when the temperature rises above this limit. For falling temperatures, the alert will trigger when the temperature falls below this limit.
  • alert_hysteresis (float) – The alert hysteresis range. Must be 0-255 degrees Celsius. For rising temperatures, the hysteresis is below alert limit. For falling temperatures, the hysteresis is above alert limit. See data-sheet for further information.
  • alert_temp_direction – The direction the temperature must change to trigger the alert. Options are RISING (heating up) or FALLING (cooling down).
  • alert_mode – The alert mode. Options are COMPARATOR or INTERRUPT. In comparator mode, the pin will follow the alert, so if the temperature drops, for example, the alert pin will go back low. In interrupt mode, by comparison, once the alert goes off, you must manually clear it. If setting mode to INTERRUPT, use alert_interrupt_clear to clear the interrupt flag.
  • alert_state – Alert pin output state. Options are ACTIVE_HIGH or ACTIVE_LOW.

For example, to configure alert 1:

import board
import busio
import digitalio
import adafruit_mcp9600

i2c = busio.I2C(board.SCL, board.SDA, frequency=100000)
mcp = adafruit_mcp9600.MCP9600(i2c)
alert_1 = digitalio.DigitalInOut(board.D5)
alert_1.switch_to_input()

mcp.alert_config(alert_number=1, alert_temp_source=mcp.THERMOCOUPLE,
                 alert_temp_limit=25, alert_hysteresis=0,
                 alert_temp_direction=mcp.RISING, alert_mode=mcp.COMPARATOR,
                 alert_state=mcp.ACTIVE_LOW)
alert_disable(alert_number)

Configuring an alert using alert_config() enables the specified alert by default. Use alert_disable to disable an alert pin.

Parameters:alert_number (int) – The alert pin number. Must be 1-4.
alert_interrupt_clear(alert_number, interrupt_clear=True)

Turns off the alert flag in the MCP9600, and clears the pin state (not used if the alert is in comparator mode). Required when alert_mode is INTERRUPT.

Parameters:
  • alert_number (int) – The alert pin number. Must be 1-4.
  • interrupt_clear (bool) – The bit to write the interrupt state flag
ambient_resolution

Ambient (cold-junction) temperature resolution. Options are AMBIENT_RESOLUTION_0_0625 (0.0625 degrees Celsius) or AMBIENT_RESOLUTION_0_25 (0.25 degrees Celsius).

ambient_temperature

Cold junction/ambient/room temperature in Celsius

burst_complete

Burst complete.

burst_mode_samples

The number of samples taken during a burst in burst mode. Options are BURST_SAMPLES_1, BURST_SAMPLES_2, BURST_SAMPLES_4, BURST_SAMPLES_8, BURST_SAMPLES_16, BURST_SAMPLES_32, BURST_SAMPLES_64, BURST_SAMPLES_128.

delta_temperature

Delta temperature in Celsius

input_range

Input range.

shutdown_mode

Shutdown modes. Options are NORMAL, SHUTDOWN, and BURST.

temperature

Hot junction temperature in Celsius

temperature_update

Temperature update.

version

MCP9600 chip version