Driver library for Texas Instrument TMP117 using mbedOS. The devices uses an I2C communication interface
For quick prototyping the following hardware is recommended:
- NUCLEO-L476RG - a simple STM32 development board
- Sparkfun-TMP117 - a high precision temperature sensor breakout board
The library works with any board supported by mbedOS
- Full support of every device functionality
- Easy to use API - write easily readable code within minutes (see examples)
- Fully documented functions
- Examples for each functionality
- External or internal pull-up/pull-down resistor can be set on alert pin line to MCU. Note that the device has an internal pull-push mechanism which "overrules" any pull-up. So low/high mode on alert pin will work in any case. When using an external resistor use
PinMode::PullNone
inset_output_pin_interrupt(...)
.
The registers of the tmp117 device are 16bit wide
It is worth noting that programming certain functions of the TMP117 (e.g. alert mode/ therm mode) can be quite slow (up to 7ms). Therefore, we have to wait until the device returns the "not busy" flag which signals that data is successfully written to the EEPROM.
Note: See Figure 20 on datasheet p.18 for details on how to program the EEPROM.
The reset sequence soft_reset
takes around 1.5ms and restores the default parameters. Note that the EEPROM is locked by default so call unlock_registers()
before writing to the registers. See section 7.5 for further info
read_temperature()
: Note that we have to use theshort
data type to also cover negative temperature values (do not useunsigned short
akauint16_t
)- The maximum possible value is 0b0111 1111 1111 1111 (255.9912F); the minimum possible value is -256.0f
- If possible use the one-shot mode to minimize self-heating of the device
- Therefore, in continuous mode it is recommended to use >1 second conversion cycle time and only 8 samples to calculate the average (see table in
tmp116.hpp
) - Use the minimal acceptable power supply voltage (1.8V)
- Use the hightest available communication speed (400kHz)
TODO
Basic integration test for each function; does not include larger tests with temperature read-outs yet
To run an example, include the respective header file into your main program and call the Run()
method from there
Modify the mbed_lib.json file for the correct pins the device is connected to
This example shows how to use of the one-shot mode
- Configure the the pins in the
- comment out/enable #define TMP117_CALLBACK to switch between callback (recommended!) and polling TODO: alert mode and therm mode examples
This example shows how to use the continuous mode
- Averaging mode is stopped
TODO
- The I2C reset via 0x00 address pointer does not properly work (test fails)