Getting started with MySensors

For a long time I have been following the website/project I’ve been thinking about building a temperature and humidity sensor-network in my house for a long time and this project seems to have figured out all the hard stuff (radio communication, low-power battery sensors, network gateway and even controllers).

The Getting Started guide on is a really great starting point to read about the MySensors project and see what it can do.

For my first project I used the following hardware:

  1. ESP8266 NodeMcu v0.9
  2. Arduino Pro Mini 3.3v (ATMEGA328 at 8 MHz)
  3. NRF24L01+ (2 pieces)
  4. AM2302/DHT22
  5. FTDI USB 3.3v programmer

I setup the ESP8266 as an WiFi gateway, the only thing I added was an extra 22Β΅F capacitor between the ground and the power of the NRF24L01 as described here under Connecting a Decoupling-Capacitor.

With the Arduino Pro Mini I created a temperature and humidity sensing node. When I started building this node, the MySensors-website contained an old version of the code that was not compatible with the latest (2.0) version of the MySensors-library. So I ended up changing the code and fixing a couple of problems. I was planning on writing down all the steps that I took, until I discovered that Henrik Ekblad created a new version of the code with the exact same fixes. So if you go to Air Humidity Sensor page right now, you will have a working node in minutes (mine took an evening of tinkering).MySensors humidity node

After creating the gateway and the humidity-node, I needed a (what MySensors calls) Controller. Since I’m doing all my work on a Windows machine and my day-job is a .NET Developer, I went for MyNodes.NET. After starting the software (with localhost.cmd run as administrator) and opened a browser to http://localhost:1312, all I needed to do was add the ip-address of the gateway in the configuration-section and when it was connected, the temperature&humidity node appeared!

MyNodes.NET humidity node

This was just my first step at creating a sensor network for my house. It only proves that the MySensors library is a very good fit for the sensors I’m planning on creating. The next step will be to convert the gateway to a MQTT gateway and use a different controller that supports more hardware and has a larger (more active) community (most likely it’s going to be Domoticz).

4 thoughts to “Getting started with MySensors”

  1. Nice! Too bad that hardware is so expensive! … NOT! πŸ˜›

    Did you know that NRF24L01 can connect with 6 (or was it 5?) other NRF24L01’s? Is that how you are going to link up extra temp/humid nodes?


    1. I did know the NRF24L01+ has support for multiple pipes (on the same channel). The MySensors-library I’m using abstracts this away for me. Currently the library is using 2 pipes (as of release 2.0) for listening, one for broadcasts and one for direct communication.
      The MySensors library supports 254 nodes on a single channel, as long as the sensors aren’t all transmitting at the same time. Since room temperature and humidity is a slow changing process, transmitting once every 5 to 10 minutes should be enough. And when 2 nodes still want to transmit at the same time, they have the ability to ask for an acknowledgment from the controller, so they know when they need to retransmit their data.
      This is exactly why I’m currently using this library, someone has actually thought of and solved these problems!

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.