Is MySensors relevant for this project pitch

  • Hello everyone!
    I'm working on an experimental project based on wireless sensors and LEDs. From what I understand of MySensors it seems to be the right choice for this project. I'd just like to have confirmation from people with more experience in it before diving further into it.
    Here are the project setup: there'll be a fleet of nodes, each node containing a motion sensor and a LED. Each sensor triggered will turn ON the LED of an other specific node. The whole node network has to be somehow autonomous.
    I think I need a controller to get the sensors inputs and to tell the right node to turn its LED on.
    But do I need a gateway, as I dont really need to monitor anything?
    Also, this project might often be disassembled and reassembled elsewhere, and is meant to grow as I manage to build more nodes.
    Does it make sense to use MySensors for this project?
    I'd appeeciate any advice. Thank you!

  • Hardware Contributor

    I see no reason why it could not be done with mysensors. The gateway is needed as a bridge between the controller (something like a raspberry pi) and the actual network. If you need a controller you also need a gateway.

  • Thank you for your answer. I think I wrote "controler" instead of "gateway". I indeed need some central device to coordinate all the nodes, but I'd prefer not to use raspberry. The reason is I'll have to use batteries to power everything up, to allow a very portative setup (I wish to install it in very remote places). But I think it's ok to use just an MCU like an arduino micro pro, to coordinate everything, isn't it?

  • Hardware Contributor

    I don't know if someone ever used an arduino as a controller (not just as a gateway) but in theory it should be possible. Mysensors uses a relatively simple textbased API that you could use to control your devices. Maybe something like an ESP8266 on some kind of development board would be a good fit for you. They can already be used as a gateway and should be strong enough to already do some simple controller work I guess.

  • Thank you LastSamurai, I'll dig into the ESP8266.
    But for my needs, does it make sense to wish for a software solution that would merge the gateway and the controller into a single board, as it might save some power and some technical complexity? Or am I missing something?

  • Hardware Contributor


    I don't think it would save "technical complexity" to implement controller logic inside a gateway.
    If you want to skip the controller, you can but you need to set parent id and node id in your nodes.
    You can later use node to node communication, so that you do not need to program anything in the gateway node (but it's still mandatory else you will have problems when nodes will check their network status). For that you have 2 choices :

    • hard code it in the nodes: possible as you know their ids but leaving no flexibility
    • use a custom message so that you can program the "target" node id (the one on which you light the led) when your nodes are in place. Of course you save them in eeprom so it will still be here after restarting. For this I would use a controller temporarily connected to the gateway, program the target node ids and then you can remove the controller and your network can still run

    You could even use 8 jumpers to "program" the node id in binary form on the node, and in the "before()" method overwrite the MySensors node id with the value you read. You can also do that for both node ID and target node ID if you use 2 shift registers, that way each node could be configured completely in hardware using jumpers.

  • @od1
    Can this scenario be practical for ALL battery powered devices?

    I haven't seen battery powered controllers or gateways discussed here. I think the scenario described presents some challenges in addition to build/coding issues discussed.

    Sensors normally independently send data any time they want, so sensors can be built to be low power by being asleep (using little power) most of the time.
    Gateways and controllers on the other hand must be listening all the time so they cannot sleep, and would have shorter battery life.

    If you are also requiring all sensor nodes to be listening for a command to turn on a LED, the sensor node will not be able to sleep.

    Is it OK if the nodes can only run for a matter of days or weeks on its batteries?

  • @Nca78 Yes, I was actually thinking using DIP switch (or even more easy to read thumbwheel switch) to give a unique ID to each node! As soon as I receive the extra radio modules I ordered, I'll test that.
    @Grubstake I'm afraid you're right! But it's ok to have just a few days of battery life. As I wrote, it might be often disassembled and reassembled.

Suggested Topics