Awesome
PiicoDev® TMP117 MicroPython Module
This is the firmware repo for the Core Electronics PiicoDev® Precision Temperature Sensor TMP117
This module depends on the PiicoDev Unified Library.
See the Quickstart Guides for:
Usage
Example
main.py is a simple example to get started.
# PiicoDev TMP117 minimal example code
# This program reads the temperature from the PiicoDev TMP117 precision temperature sensor
# and displays the result in Degrees Celsius, Farenheit and Kelvin
from PiicoDev_TMP117 import PiicoDev_TMP117
from PiicoDev_Unified import sleep_ms # cross-platform compatible sleep function
tempSensor = PiicoDev_TMP117() # initialise the sensor
while True:
# Read and print the temperature in various units
tempC = tempSensor.readTempC() # Celsius
tempF = tempSensor.readTempF() # Farenheit
tempK = tempSensor.readTempK() # Kelvin
# Convert temperature into a string and print the data
print(str(tempC) + " °C")
sleep_ms(1000) # delay 1 second
Details
PiicoDev_TMP117(bus=, freq=, sda=, scl=, addr=0x48)
Parameter | Type | Range | Default | Description |
---|---|---|---|---|
bus | int | 0,1 | Raspberry Pi Pico: 0, Raspberry Pi: 1 | I2C Bus. Ignored on Micro:bit |
freq | int | 100-1000000 | Device dependent | I2C Bus frequency (Hz). Ignored on Raspberry Pi |
sda | Pin | Device Dependent | Device Dependent | I2C SDA Pin. Implemented on Raspberry Pi Pico only |
scl | Pin | Device Dependent | Device Dependent | I2C SCL Pin. Implemented on Raspberry Pi Pico only |
addr | int | 0x48, 0x49, 0x4A, 0x4B | 0x48 | This address needs to match the PiicoDev Precision Temperature Sensor TMP117 hardware address configured by the jumper |
PiicoDev_TMP117.readTempC()
Parameter | Type | Unit | Description |
---|---|---|---|
returned | float | degC | Temperature in degrees Celsius |
PiicoDev_TMP117.readTempF()
Parameter | Type | Unit | Description |
---|---|---|---|
returned | float | degF | Temperature in degrees Fahrenheit |
PiicoDev_TMP117.readTempK()
Parameter | Type | Unit | Description |
---|---|---|---|
returned | float | K | Temperature in Kelvin |
License
This project is open source - please review the LICENSE.md file for further licensing information.
If you have any technical questions, or concerns about licensing, please contact technical support on the Core Electronics forums.
"PiicoDev" and the PiicoDev logo are trademarks of Core Electronics Pty Ltd.