- Notifications
You must be signed in to change notification settings - Fork0
Using a Raspberry Pi and ADS1015 I2C ADC to read temperatures from thermistors and report them to HomeKit and Prometheus
License
joeshaw/thermistor
Folders and files
Name | Name | Last commit message | Last commit date | |
---|---|---|---|---|
Repository files navigation
This is the code for a fun home electronics project I did with my son.
Twothermistors areembedded in a radiant floor heating system. The thermistors are meantto be used with the thermostat included in the system, but I decidedto install a Nest thermostat instead, which can't use these.
We took a Raspberry Pi and anADS1015 I2C 12-bit analog-to-digitalconverter and connected thetwo thermistors to it. We do a little math and report the detectedtemperatures as a temperature sensor accessory with two services toApple HomeKit, and expose the values as a Prometheus exporter. Thecode is in Go, usesGobot for interfacing withthe ADS1015 over the I2C bus and implements the HomeKit AccessoryProtocol withHomeControl.
This code is specific to our implementation and probably not veryuseful, but can be a decent example of how to use Gobot, HomeControl,Prometheus, the ADS1015 ADC, and calculating temperatures fromthermistors in general.
Cross-compile for the Raspberry Pi
$ GOARCH=arm GOOS=linux go build
Thenscp
it to/usr/local/bin
on the Pi.
Asystemd
unit file (thermistor.service
) is included. Copy theunit file to/etc/systemd/system
and then run:
$ sudo systemctl daemon-reload$ sudo systemctl enable thermistor$ sudo systemctl start thermistor
The code is licensed under the MIT license. See theLICENSE file for details.