Notes on MySensors

MySensors is a great project for building IoT devices but it tries to do many things — define a general serial communications protocol (similar to ModBus, CAN), provide a software library for many hardware devices on top of the Arduino abstraction layer, firmware updates and many other things. I first tried it in 2018 when building wireless sensor nodes using the RFM69 radios.

The last stable release of the library was in late 2019 and the project appears to have been abandoned by the original maintainers as the pull requests are left unmerged and issues unresolved. Having worked on large open source projects I know that this can happen as the priorities change for the original contributors. It would be great if new contributors could be added to the project to keep it going.

Era node using ESP8266 (Wemos D1 mini) connected to Raspberry Pi over RS485
Era node using ESP8266 (Wemos D1 mini) connected to Raspberry Pi over RS485.

Here are my notes on the state of things as I attempt to use the MySensors protocol for wired (!) nodes over the RS485 physical layer to create switches and sensor nodes for my home automation system:

General Notes

General Issues

  • The version 3 of Arduino core for ESP8266 isn’t compatible with how MySensors tries to inject itself into the setup() and loop() calls, as reported here. There is a pull request to fix this.

RS485 Transport Layer Issues

Alternatives to MySensors

MySensors serial implementation is great because it allows nodes to talk to the network while most of the other protocols require that the communication is initiated by the controller which isn’t very suitable for scenarios such as switching lights and other real-time events.

Here are some alternative protocols for building “multi-master” bus networks using RS485:

  • PJON ThroughSerial defines the communication but doesn’t define the message types for standard automation events so you need to define your own layer for this.
  • UARTBus which is influenced by KNX but appears to be relatively new.

Do you know of any other protocols that would support this?

2 Comments

  1. B.Geiger says:

    Thx for your quick overview.
    Well I planed a mysensors + FHEM network 5-6 years ago. but focus changed and other projects became more popular.

    Now I’m working with HA + ESPHome with great success.

    But ESPHome doesn’t support a simple wired network like RS485 or longe range Wireless communication.

    Searching for a easy solution for some garden sprinkler and RS485 remote nodes, I found mySensors (again).

    Just grabed a bunch RFM69 (already laying around) + ESP8266 for a gateway and ATMega Mini Pro’s for the nodes. And WOW using the Homeassistant Integration. It makes really fun.

    It’s a pitty it’s not maintained any more

Leave a Reply