Sanity Check for my Node Red project architecture

I'm trying to figure out if I can create flows in Node Red to be deployed to Arduino Mega which has 16 relays connected.. Then have a remote Wemos D1 Mini send commands to the Mega to invoke individual flows when needed. I'm making the assumption that Node Red allows you to make multiple flows that are deployed together but can be run or triggered independent of each other.

So, am I on track with how Node Red is intended to be used?

Server:

  1. Arduino Mega driving 16 relay board to control valves and motors. Mega will also be connected to ESP8266 which is how it will receive commands wirelessly from the user touch screen.

Client:
2. Wemos D1 Mini and Nextion LCD that will display status information received from the Mega Server and also send commands to the Mega to effect changes to the relays.

Welcome to the forum @abehil

Do you mean you want to run node-red on the Arduino? I do not believe that is possible.

You need a more general computer rather than a microprocessor board for running Node-RED since Node-RED uses node.js which needs an operating system.

However, you might not even need node-red for what you are trying to do. Just get the client to talk direct to the Mega.

Most of us recognise however, that we are not likely to stop with a single client and single controller board and so we implement a server (such as a Raspberry Pi) to run not only Node-RED but also an MQTT broker which makes the communications a lot simpler and more reliable.

NOpe - as the others have said NR will not run on the Mega.

What you can do (which i previously did - but have just finished retiring) is put a very basic sketch on the mega - it just listens to MQTT messages and turns relays on and off based on these messages.

The Nextion/Wemos talks through MQTT to the NR and invokes the processes etc that you require - NR then sends the MQTT commands as appropriate to the Mega to enable/disable relays (and to possibly get the state of relays on a regular basis and send them to the Nextion for display.)

Craig

The server needs to be microprocessor based, as opposed to microcontroller based (like the Arduino). So make the server into a Raspberry Pi (not the Pico which is also a MCU). The client can be the Arduino with the relay board. Then either can have a screen attached if required. Or just use NR dashboard (from the RPi) remotely from any device, then you can do away with the screen.

Another possibility is to use a Raspberry Pi as both client and server together, thus removing the Arduino from the picture altogether.

1 Like

Easiest and most performat way is to run TASMOTA or an Arduino base MQTT on the wemos D1 ... and than send the command from NR server.

NR-Server will not run on wemos D1.

I have a NR server running on old laptop (2ghz, 8gb ram,ssd, Ubuntu with docker) ... and have around 12 independent wemos D1 around the house .. all operating via MQTT

I use an 8 channel relay board from NCD.io which I control via a node in Node-Red. It's very easy. NCD.io makes 16, 24 and 32 channel relay boards too. I connect the NCD.io board to the Raspberry Pi over i2c. NCD.io has an i2c capable node for NodeRED.

Keeping it all in NodeRED allows me to create dashboards for my UI. I've had an 8 channel NCD.io / RaspberryPi / NodeRED project up and running continually (24/7) since Oct/Nov 2020.

1 Like

Thanks to all, especially craigcurtin, for your advice.

Craig, can you point me to some sample code or tutorial showing how to set up to do what you descibed?

Some code bits showing how the Mega listens for or sends MQTT messages as I have no experience with MQTT protocols would probably be enough to get me started.

Obviously for the Mega to send/receive MQTT it needs to be Network aware - so you either need an Ethernet adapter (easiest and best) for it - or a wifi module - i assume you have one of these ?

Do you already have a Mega - if not then an alternate option would be

And indeed that will be cheaper than buying a LAN module and having to run your own sketches etc on the mega - you would just upload Tasmota firmware onto the board and you would be away.

If you want to stick with the Mega - then just do a google search for w5100 MQTT and you will have plenty of Arduino sketches

Craig

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