MQTT with Arduino Nano + NodeRed

I think the guts is written in C++ or C. I can't actually find the source though.

Maybe the Arduino Nano is not the ideally solution for your Problem.

The ESP (Esp8266 or ESP32) have Build in WLAN and MQTT libraries existing for them. The downside of this is that the ESP has higher power consumption and may less IO Ports. But there are some which has running the ESP8266 on battery's (deep sleep, etc...) and also Port Multiplexers exists.

I'm using Esp8266 for sensors/actors (connected via I2C or other) which are power connected and communicating direct over MQTT a Mosquito Broker to Node-RED.

For battery powered sensors (I2C) I also have Arduino Nano. They have a 868MHz module where they send its data to a client (RaspberryPi with also a 868MHz module), where a software receives the data from the sensors and send it to Node-RED (is running on the same RaspberryPi). This sensors should be working more than a year without the need of battery changing. There exists also other solutions (433MHz, Lora,...).

@Hypnos please read the whole thread. This has been recommended several times already. But @PizzaProgram has the specific requirement that the connection has to be wired and shielded at that.

1 Like

@knolleary
@JGKK
Thank you for both of you about the recommendations! That gave me an idea to search with other keywords, and came up with +2 more possibilities. To summarise:

  1. There is Serial2Mqtt and Mqtt2Serial
  • PRO: easy to give names to the boards (devices) so no error possible to address a wrong one.
  • PRO: Can work with Serial-ETH IP too.
  • CON: the gateway is not auto-searching ports.
  • CON: No failsafe mechanisms. (If serial disconnects, no serial parity etc.)
  • CON: only C++ examples
  1. SerialToTCP
  • PRO: Seems to have better error-handling and fail safety. (CRC32, Timeout, ...)
  • PRO: downloadable .INO example
  • CON: only 1 man developed it, last time 2017
  • CON: not too much documentation
  • CON: not sure how to handle multiple boards with it.
  1. Ardulink has an MQTT gateway too!
  • PRO: Seems to be a well tested "ready-to-use" solution
  • PRO: Works with AtTiny85 boards too
  • PRO: Unique Serialnumber can be added to each board (But no auto-check)
  • CON: Too much JAVA spec, but pure step-by-step real use-case examples. Trying to put infos together how to make it work.
  • CON: serial com has Zero safety protocol.
  • CON: not enough infos yet. (will edit later)
  1. And found an extremely robust 1wire protocol called PJON that can use a Nano board as gateway.
    It has a gRPC subproject, and there is a ready-to-use gRPC Node already.
    I know it's not MQTT, but on this example video it seems to work very well!
  • PRO: the PJON protocol gives a very very stable wiring possibility up to 2000m (See...)
  • PRO: up to 256 devices on 1 wire
  • PRO: gRPC is well tested too
  • PRO: Unique Serialnumber and also worldwide MAC can be added to each board and can be addressed by those !!!
  • PRO: AtTiny85 support
  • CON: only 3KB/sec transfer rate, (but that's fine for IO ports + sensors)
  • CON: Need some Arduino boards to sacrifice to work as gateways only, not as actors. (But they are cheap :smiley: )
  • CON: lot's of infos to learn.

See also: 2 router setup to speed up communication example (link).

This topic was automatically closed 60 days after the last reply. New replies are no longer allowed.