adafruit_mcp9600
CircuitPython driver for the MCP9600 thermocouple I2C amplifier
Author(s): Dan Cogliano, Kattni Rembor
Hardware:
Adafruit MCP9600 I2C Thermocouple Amplifier: (Product ID: 4101)
Software and Dependencies:
Adafruit CircuitPython firmware for the supported boards: https://github.com/adafruit/circuitpython/releases
Adafruit’s Bus Device library: https://github.com/adafruit/Adafruit_CircuitPython_BusDevice
Interface to the MCP9600 thermocouple amplifier breakout
Quickstart: Importing and using the MCP9600 temperature sensor
Here is one way of importing the
MCP9600
class so you can use it with the namemcp
. First you will need to import the libraries to use the sensorimport busio import board import adafruit_mcp9600Once this is done you can define your
busio.I2C
object and define your sensor objecti2c = busio.I2C(board.SCL, board.SDA, frequency=100000) mcp = adafruit_mcp9600.MCP9600(i2c)Now you have access to the change in temperature using the
delta_temperature
attribute, the thermocouple or hot junction temperature in degrees Celsius using thetemperature
attribute and the ambient or cold-junction temperature in degrees Celsius using theambient_temperature
attributedelta_temperature = mcp.delta_temperature temperature = mcp.temperature ambient_temperature = mcp.ambient_temperature
Alert 1 status.
Alert 2 status.
Alert 3 status.
Alert 4 status.
Configure a specified alert pin. Alert is enabled by default when alert is configured. To disable an alert pin, use alert_disable()
.
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)
Configuring an alert using alert_config()
enables the specified alert by default. Use alert_disable()
to disable an alert pin.
alert_number (int) – The alert pin number. Must be 1-4.
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
.
Ambient (cold-junction) temperature resolution. Options are AMBIENT_RESOLUTION_0_0625
(0.0625 degrees Celsius) or AMBIENT_RESOLUTION_0_25
(0.25 degrees Celsius).
Cold junction/ambient/room temperature in Celsius
Burst complete.
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 between hot junction (thermocouple probe) and cold junction (ambient/room) temperatures in Celsius
Input range.
Shutdown modes. Options are NORMAL
, SHUTDOWN
, and BURST
.
Hot junction temperature in Celsius
Temperature update.
MCP9600 chip version
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4