Finnian's blog

Software Engineer based in New Zealand

2-Minute Read

For my ongoing heating project I needed to be able to communicate with different nodes around the house. Wirelessly.

To accomplish this objective, I decided to use some NRF24LO1+ modules. These are great because they have an onboard chip so that you don’t have to encode/decode the data yourself. The range on them is pretty good - ‘proper’ testing this w/e! - I got two without antennae and one with one - this is going to be the hub on a RPi so the range needed to be further (apparently someone got the to work over a distance of 1km!).

First, the Raspberry Pi side. I hooked up the RF module and wrote this script: https://github.com/xavbabe/heating/blob/master/monitor.py What it does is to:

  1. Setup MySQL database connection
  2. Setup Google Spreadsheet connection
  3. Setup the radio
  4. Get the external temperature
  5. Ask the Arduino for the temperature and checks that back against last saved temperature
  6. Tells the Arduino what to do based on the data
  7. Dump all results into MySQL database and Google Spreadsheet
Arduino!

I wired up the RF module to it and wrote and uploaded this:

https://github.com/xavbabe/heating/blob/master/arduino/arduino.ino

What this one does is to:

  1. Wait for the RPi to ask for the temperature
  2. Send the temperature back to the RPi for processing
  3. Wait for instructions
  4. Turn on/off the heating based on what instructions it received
Please feel free to use/edit/fork/share the code but make sure you say where you got it from! ---UPDATE--- After range testing, I am quite disappointed with the results - I could only get about 5m max with an antennae-non-antennae... Maybe antennae-antennae would work better?

Recent Posts