Temperature sensor

Last edited time
2024/05/23 21:43
The temperature sensor is obviously not mandatory for a keyboard, but I think it’s a nice feature to have since there’s an integrated screen that can display the current temperature. I’ve chosen the MCP9808 temperature sensor, and I’m using adafruit’s module for prototyping.
Here are the specifications, copied from the adafruit product page:
Simple I2C control
Up to 8 on a single I2C bus with adjustable address pins
0.25°C typical precision over -40°C to 125°C range (0.5°C guaranteed max from -20°C to 100°C)
0.0625°C resolution
2.7V to 5.5V power and logic voltage range
Operating Current: 200 μA (typical)
The precision is really good, making this keyboard the best ambient temperature sensor you’ll have!
In the case of this sensor, there was no driver available in TinyGo. I wrote one that has been integrated into the codebase (dev); reading the datasheet and some light coding was all that was required to make it work. If you’re curious, you can see my PR here. I expect my driver to be in the next release of TinyGo.