Hacker News new | ask | show | jobs
by kbouck 3858 days ago
I am doing something similar to this. My setup includes multiple temperature sensors in addition to a Raspberry Pi thermostat which controls my heating system. The thermostat also acts as a HomeKit server, and so can be controlled using Siri - which is really just a fun party trick more than anything else.

(I know Nest and Ecobee can probably do all of this out of box -- my reasons for building this were just to tinker and learn)

Here's what I use:

Sensors:

Since these are likely to run on batteries, you'll need to choose a platform with allows for low enough power consumption that you aren't draining the batteries too quickly. This is suitable for the microcontroller-based options (Arduino, ESP8266, NodeMCU, Particle), but not for R-Pi (due to too-high power consumption). In addition to the platform, your code will also need to take advantage of power saving opportunities, like going to sleep and disabling battery-draining radio services like WiFi, waking up periodically to take a measurement, enable WiFi and emit the metric before going back to sleep.

For my temperature sensors, I chose to the $19 Particle Photon [1] for the following features:

  - Built-in WiFi
  - Built-in REST API (goes through Particle's cloud REST API)
  - Add a temperature sensor like TMP36 [2] to it and your sensor hardware is done.
Thermostat:

For this I use a Raspberry Pi (plugged into wall power) + a relay breakout board to interface with my heating system. My thermostat needs to periodically do things like access google calendar, keep a log of temperature data, to run a HomeKit server [3] [4], and to be ever-ready to respond to REST requests from the internet (eg. IFTTT). So, it's more like a real server, for which RPi was much more appropriate.

Data Storage:

Many options here. Take a look at Phant [5] from SparkFun form something quick and simple.

[1] https://store.particle.io/collections/photon

[2] https://www.sparkfun.com/products/10988

[3] https://github.com/KhaosT/HAP-NodeJS

[4] https://github.com/nfarina/homebridge

[5] https://learn.sparkfun.com/tutorials/pushing-data-to-dataspa...