Is my project possible with MySensors?



  • Sorry for the generic title 😊 .

    I wanted to hear your opinions about the feasibility of the project I have in mind.

    Based of the stuff I read in the documentation I did a quick mockup of the network layout:
    0_1485876024771_network_layout.PNG

    I need a way to control multiple (2-5) wireless stations (battery powered), which have a 8 channel relay board attached, from a central interface with a smartphone/tablet to trigger the relays.

    Now I'm thinking to build every station with the relay module and a nrf24l01+ pa lna connected to an Arduino nano. Since I have already have a Raspberry Pi 2, I could use that one as a gateway with another NRF24 chip.
    The Raspberry would be configured as access point and run a websocket and webserver so I can connect to it with my phone and open a webpage (e.g. a simple grid of buttons representing each relay) or build a native app to send commands and display small amounts of sensor data like battery voltage .

    Things to note:

    • I need pretty low latency (<100ms from "tapping a button" to the relay actually getting triggered)
    • If a package is lost on the way to the wireless station, it needs to be resend by the gateway as fast as possible
    • Distance between gateway and stations needs to be at least 50m (shouldn't be an issue in the open field)
    • Battery runtime isn't that much of a concern since the whole only needs to run a few hours at a time

    Now my questions:

    • Can send and receive messages without a controller? How would I go about that?
    • How secure is the NRF24 connection? To be clear, I don't mind anybody reading what's being sent, but I don't want someone sending commands to my stations and thus triggering the relays (it's very unlikely, but you never know 😉 )
    • Is there a way to report signal strength between the gateway and the wireless station?
    • Any other tips you can give me?

    Thanks for reading



  • Hi,

    I think it is possible. However, in your special case I would rather implement something from the scratch since you do not really need MySensors here (except maybe for signing messages and the WebGUI but you said no controller so..).

    There are nrf24 libraries floating around in the web, probably also some signing functionality I would suppose.

    For sending messages to your network, I'd just put another arduino to the RPi and use the serial port.

    So answering your questions:

    • Implement yourself, for MySensors I don't know
    • See above. MySensors has some signing capabilties afaik
    • Datasheet p24 describes the "received power detector (RPD)" which in the end is a register that can be read out.

    Hope that helps



  • @frazzle said:

    Now my questions:

    • Can send and receive messages without a controller? How would I go about that?
    • How secure is the NRF24 connection? To be clear, I don't mind anybody reading what's being sent, but I don't want someone sending commands to my stations and thus triggering the relays (it's very unlikely, but you never know 😉 )
    • Is there a way to report signal strength between the gateway and the wireless station?
    • Any other tips you can give me?

    Thanks for reading

    1. Yes you can. Take a look at serial api documentation. You need to implement "controller" software by yourself.
    2. Use signing. You can find more information from here
    3. Not really. nRF24 library support only check if signal => -64dBm or not.. see this
    4. It might be easier to use arduino as gw. See ACK functionality from documentation for resending the lost packages.

  • Hardware Contributor

    @pjr what comes to my mind might be hard is using batteries to run nodes with relays. The nodes needs to be awake all the time not to miss any message on/off for the relay and that consumes power.



  • Thanks for the answers!

    @pansen said in Is my project possible with MySensors?:

    Hi,

    I think it is possible. However, in your special case I would rather implement something from the scratch since you do not really need MySensors here (except maybe for signing messages and the WebGUI but you said no controller so..).

    There are nrf24 libraries floating around in the web, probably also some signing functionality I would suppose.

    For sending messages to your network, I'd just put another arduino to the RPi and use the serial port.

    So answering your questions:

    • Implement yourself, for MySensors I don't know
    • See above. MySensors has some signing capabilties afaik
    • Datasheet p24 describes the "received power detector (RPD)" which in the end is a register that can be read out.

    Hope that helps

    At the moment I don't really want to start something from scratch.

    @pjr said in Is my project possible with MySensors?:

    1. Yes you can. Take a look at serial api documentation. You need to implement "controller" software by yourself.
    2. Use signing. You can find more information from here
    3. Not really. nRF24 library support only check if signal => -64dBm or not.. see this
    4. It might be easier to use arduino as gw. See ACK functionality from documentation for resending the lost packages.
    1. Thanks, I'll have a look at that. Any other information about "writing your own controller"?
    2. Well that feature isn't that important, so guess I'm fine dropping it.
    3. Why would arduino be better as a gateway?

    @sundberg84 said in Is my project possible with MySensors?:

    @pjr what comes to my mind might be hard is using batteries to run nodes with relays. The nodes needs to be awake all the time not to miss any message on/off for the relay and that consumes power.

    Power consumption shouldn't be an issue as I'll use a big 12v battery and the wireless nodes are only used for short periods (propably not longer than 5 hours)



  • @frazzle said in Is my project possible with MySensors?:

    Why would arduino be better as a gateway?

    If you connect the nrf24 via SPI it will be emulated as an ethernet gateway, and I assume it is more complicated than using a serial gateway (i.e. Arduino) which you directly send commands to, via ttyUSBx. No experience in that though, maybe it is worth to dig a bit more.


  • Mod

    Using an Arduino as gateway is much easier than compiling the gateway in the rpi especially for troubleshooting if you are not expert


  • Admin

    @frazzle

    If it's essential for your project to read out RSSI, then I suggest to use rfm69(h)w for radio, as they have an RSSI register that you can read.

    For the security, if you implement signing it will add a bit of latency in the loop, as the nodes has to exchange nonces before sending the actual data.

    RFM69 has a hardware encryption engine, so it can encrypt things on the fly (this is not the same as signing though, and can be subjectable to record / playback of transmissions)

    If you want to go with a "no hazzle" hardware solution with an external gateway, there is also the sensebender gateway.



  • @tbowmo said in Is my project possible with MySensors?:

    @frazzle

    If it's essential for your project to read out RSSI, then I suggest to use rfm69(h)w for radio, as they have an RSSI register that you can read.

    For the security, if you implement signing it will add a bit of latency in the loop, as the nodes has to exchange nonces before sending the actual data.

    RFM69 has a hardware encryption engine, so it can encrypt things on the fly (this is not the same as signing though, and can be subjectable to record / playback of transmissions)

    If you want to go with a "no hazzle" hardware solution with an external gateway, there is also the sensebender gateway.

    It would be more of a gimmick than really needed (signal strength within 50m and line of sight should be no issue I think). But it's nice to know that the RFM69 offers that.

    Any information/statistics on how much signing affects RDT?

    Encryption is definitely not needed, but preventing replay attacks is. Doesn't need to be the most sophisticated thing in the world, but it should offer a reasonable amount of protection.


  • Admin

    @frazzle

    Not using signing actively myself (yet), so can't help with any numbers there.. Someone else has to kick in with their experience..


  • Contest Winner

    Message exchange with and without signing would look something like this:

    Scenario: No one require signing:
    Sending from node to GW:
    node->gw (message)

    Sending from GW to node:
    gw->node (message)

    Scenario: GW does not require signed messages, node does:
    Sending from node to GW:
    node->gw (message)

    Sending from GW to node:
    gw->node (nonce request)
    node->gw (nonce)
    gw->node (signed message)

    Scenario: GW require signed messages, node does as well:
    Sending from node to GW:
    node->gw (nonce request)
    gw->node (nonce)
    node->gw (signed message)

    Sending from GW to node:
    gw->node (nonce request)
    node->gw (nonce)
    gw->node (signed message)

    So, not counting calculation latencies, from a pure transmission point of view, a signed messages takes three times longer than a non signed message does due to handshaking.



  • @Anticimex
    Have you measured or know someone who has or can you estimate how much the communication takes time with one "relay on" command for example?
    1ms, 10ms or 100ms?


  • Contest Winner

    @pjr
    No. It depend on your HW and what frequency you execute with. So it will be quite specific to the setup, and that vary a lot between users.



  • I'm rethinking my network layout right now and I was thinking if I could use an ESP8266 in AP mdoe (running a websocket server like: https://github.com/Links2004/arduinoWebSockets) as a serial gateway?
    The description of the example code on the "Building a serial gateway" page says:

    * DESCRIPTION
    * The ArduinoGateway prints data received from sensors on the serial link.
    * The gateway accepts input on seral which will be sent out on radio network.
    

    So could I just use Serial.write() to push my commands the esp8266 received from my smartphone on the websocket connection to serial, which will then be sent out to the nodes via radio?
    In the other direction I would need to read data from the serial and push it to the smartphone via the websocket connection.

    I was also thinking to just connect my phone to the gateway via usb and then make an app that sends commands to the gateway over serial, but a wireless connection would be so much nicer.

    I'm probably gonna order some nrf24 module and some more arduinos on the weekend so I can tinker a bit with them as I'm new to radio stuff.


Log in to reply
 

Suggested Topics

1
Online

11.2k
Users

11.1k
Topics

112.5k
Posts