https://github.com/joeshaw/thermistor
Using a Raspberry Pi and ADS1015 I2C ADC to read temperatures from thermistors and report them to HomeKit and Prometheus
https://github.com/joeshaw/thermistor
ads1x15 gobot golang homecontrol homekit prometheus-exporter raspberry-pi thermistor
Last synced: 3 months ago
JSON representation
Using a Raspberry Pi and ADS1015 I2C ADC to read temperatures from thermistors and report them to HomeKit and Prometheus
- Host: GitHub
- URL: https://github.com/joeshaw/thermistor
- Owner: joeshaw
- License: mit
- Created: 2018-04-02T00:06:07.000Z (about 7 years ago)
- Default Branch: master
- Last Pushed: 2023-02-15T02:06:41.000Z (over 2 years ago)
- Last Synced: 2025-01-28T15:29:56.103Z (5 months ago)
- Topics: ads1x15, gobot, golang, homecontrol, homekit, prometheus-exporter, raspberry-pi, thermistor
- Language: Go
- Homepage:
- Size: 210 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
This is the code for a fun home electronics project I did with my son.
Two [thermistors](https://en.wikipedia.org/wiki/Thermistor) are
embedded in a radiant floor heating system. The thermistors are meant
to be used with the thermostat included in the system, but I decided
to install a Nest thermostat instead, which can't use these.We took a Raspberry Pi and an [ADS1015 I2C 12-bit analog-to-digital
converter](https://www.adafruit.com/product/1083) and connected the
two thermistors to it. We do a little math and report the detected
temperatures as a temperature sensor accessory with two services to
Apple HomeKit, and expose the values as a Prometheus exporter. The
code is in Go, uses [Gobot](https://gobot.io) for interfacing with
the ADS1015 over the I2C bus and implements the HomeKit Accessory
Protocol with [HomeControl](https://github.com/brutella/hc).

This code is specific to our implementation and probably not very
useful, but can be a decent example of how to use Gobot, HomeControl,
Prometheus, the ADS1015 ADC, and calculating temperatures from
thermistors in general.### Build
Cross-compile for the Raspberry Pi
$ GOARCH=arm GOOS=linux go build
Then `scp` it to `/usr/local/bin` on the Pi.
A `systemd` unit file (`thermistor.service`) is included. Copy the
unit file to `/etc/systemd/system` and then run:$ sudo systemctl daemon-reload
$ sudo systemctl enable thermistor
$ sudo systemctl start thermistor### License
The code is licensed under the MIT license. See the
[LICENSE](LICENSE) file for details.