What is the best wired way to communicate between multiple NodeMCU ESP8266 boards for home automation.

Every room should get at least a light, temp, PIR and xx relay modules to switch things on and off.

To connect all these sensors the GPIOs from one NodeMCU are sometimes not enough.

To reach this goal I planned to install in every room one NodeMCU as gateway and multiple NodeMCU as nodes for my sensors. The gateway will receive and forward information from/to my openHAB center via MQTT messaging.

I thought to use an RS-485 2-Wire connection between my sensor nodes and the room gateway. The gateway from my room will be connected via wifi or wired cable to my network.

I2C seems more to be for communication directly on PCBs or only short wiring.

Do you have any suggestions for me, is my plan possible? Any better ideas?

  • I2C max distance depends on the load of the bus and the speed you run at. In typical applications, the length is a few meters (9-12ft). The length can be increased significantly by running at a lower clock frequency. One particular application - clocked at about 500Hz - had a bus length of about 100m (300ft). If you are careful in routing your PCB's and use proper cabling (twisted pair and/or shielded cable), you can also gain some length. – user31481 Jul 8 '17 at 8:35

If you really wanted wired communication then yes, RS-485 is the way to go.

In any installation where you will be running cables in the vicinity of mains wiring you will have noise. I2C is very bad with noise and not a good choice for any off-board wiring. RS-485, however, owing to the balanced line nature of the signalling, is designed to reject common mode noise such as is induced by mains wiring.

I would ask, though, why use ESP8266 as remote wired nodes? It seems a real waste to use a WiFi module for wired communication - a smaller, simpler, lower powered board (Arduino Micro / Mini maybe [3.3V, 8MHz version for simplicity of interfacing]) would be far more suitable for such a role.

| improve this answer | |
  • Many thx for reply. What is about the speed from RS-485, is it faster or slower than I2C and could I ran into problems if multiple nodes try to submit their values at the same time to the gateway? I'd like to use the ESP8266 because of the more memory and faster cpu. Or do you know similar device without wifi module? During my research the ESP was the fastest and cheapest one...? – Simon Jul 8 '17 at 16:18
  • You shouldn't need much power and memory for simple sensor data acquisition and transfer. To prevent collisions have the ESP8266 request data from the remote nodes rather than have them send blindly. RS-485 can be as fast as your UART will go. 1 Mbps is certainly possible, though as with all comms, the higher your baud rate the shorter your maximum distance. – Majenko Jul 8 '17 at 16:31

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.