Raspberry Pi Ethernet Gateway with local sensors

  • Hi I’m new to MySensors and have some questions about a setup I want to make. I already have Domocticz running on a raspberry pi for the control of my lights and gas/power usage monitoring. Now I want to a MySensor that is monitoring the water level in our water tank. There is already a nice MySensors project done to measure this.


    Only the setup usage a wireless connection to send the node information as are most of the projects. I want to use an old raspberry that I have and use it as gateway to connect to Domoticz which is gone be the controller. As sensor I use a Arduino nano and ultrasonic dept sensor, that I got working. But I want to connect de sensor/Arduino to the raspberry pi gateway by cable, let say a serial connection on the gpio.
    I found some topics that are saying you can add sensors directly to the gateway with MySensors library 2.0 but no further explanation are examples.
    What do I have so far:

    • Domoticz controller that is looking for a MySensors Gateway with Lan interface on IP bases.
    • Raspberry Pi with MySensors software probably not configured right.
    • Arduino Sensor with the wrong connection parameters.

    I want to now how to start the MySensors configuration on the raspberry pi gateway. I used:
    ./configure --my-gateway=ethernet --my-controller-ip-address=

    I think i’m missing something.

    Then there is the sensor. In the project the connection is through MY_RADIO_RF24 and I want to use a serial connection how can I modify the Arduino code so it connects with the gateway?

    Maybe It’s all very simple but I’m not getting there. Who can help me to get in the right direction.

  • @jvdk I don't use a raspberry pi, but searching on this forum I found this topic : https://forum.mysensors.org/topic/11315/raspberry-pi-zero-gateway-with-local-sensor
    (important : read the comment to use wait() and NOT delay())
    You could get in touch with the author if you have questions.

  • @evb Thanks for the fast reply!

    I read the other topic and I think that I know what I'm doing wrong. I want to connect a sensor to the gateway but stil want the Arduino in between because of the nice script I found.

    So my question should be is it possible to connect a Arduino with sensor to a raspberry gateway by wired connection?

    I a sketch of what I mean.


  • @jvdk What you want to do is possible, but requires a certain amount of electronics hardware knowledge and programming skills.
    I think this setup is not a standard within the mysensors library.

    Perhaps you should first ask yourself why you want to communicate with the gateway by wire?

    The sketch you have found to work with the ultrasonic sensor, normally sends its data via the radio module.
    This can be replaced by a serial protocol transport to the gateway, but you will have to write that yourself on both sides, both on the arduino and on the gateway.
    There are plenty of examples of code where arduino's talk to each other via the serial ports. On the Pi side you will also have to implement the same serial protocol.
    On the hardware side, you must take into account that the distance between the arduino and the Pi, is limited. The arduino and the Pi use a serial signal based on 5V. Be careful with arduino's that run on 3.3V, you will need to put a converter in between. If you want to bridge long distances, you will have to go to an RS485 implementation and not a serial RS232 implementation.

    Probably you want a wired solution because of the water tank.
    I've read already topics about it, I even think on this forum, about people who did build something equivalent.
    You can maybe search first other topics about this to get ideas of building this type of sensor.

  • @jvdk I agree with the point made by @evb , why would you want to wire connect the ultrasonic node rather than the usual radio connection ? You are adding levels of complexity and power demands for what reason ?

    My ultrasonic water tank node (pro-mini+rfm69) is now 2 years on the same 2xAA batteries sending in levels every hour (RTC), the only problem encountered - condensation forming a drip on the face of the ultrasonic head during very low temperatures.

Suggested Topics