Home

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)

ParameterTypeRangeDefaultDescription
busint0,1Raspberry Pi Pico: 0, Raspberry Pi: 1I2C Bus. Ignored on Micro:bit
freqint100-1000000Device dependentI2C Bus frequency (Hz). Ignored on Raspberry Pi
sdaPinDevice DependentDevice DependentI2C SDA Pin. Implemented on Raspberry Pi Pico only
sclPinDevice DependentDevice DependentI2C SCL Pin. Implemented on Raspberry Pi Pico only
addrint0x48, 0x49, 0x4A, 0x4B0x48This address needs to match the PiicoDev Precision Temperature Sensor TMP117 hardware address configured by the jumper

PiicoDev_TMP117.readTempC()

ParameterTypeUnitDescription
returnedfloatdegCTemperature in degrees Celsius

PiicoDev_TMP117.readTempF()

ParameterTypeUnitDescription
returnedfloatdegFTemperature in degrees Fahrenheit

PiicoDev_TMP117.readTempK()

ParameterTypeUnitDescription
returnedfloatKTemperature 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.