Can you use an arduino with a relay board as an outpost?

I am very new to node-red but I am learning.
I have a raspberry pi and 4 relay board with node-red functioning properly now. But I have another spot in the house where I would like to switch some relays. I was wondering how I could send a node-red command to the arduino to switch the relay board connected to it? Like an outpost.

Is that possible? What needs to run on the arduino to make that work?

If it is, I have all kinds of ideas to deploy in the house. With the Rpi as the main hub to control all of them. Maybe I am getting ahead of myself :slight_smile:

Has your Ardunio device got WiFi??
If it has then you could use the MQTT protocol to send commands/data.

A number of people on this Forum use Wemos D1 Minis (ESP8266-based microcontroller) and flash them with ESP-Easy, Tasmota or Arduino-code via Platformio. These devices have WiFi built-in and can support all sorts of external devices (e.g relays, LEDs, OLED panels, keypads, temp/humidity/pressure sensors, etc..). Do a search for Wemos D1 Mini and you should find lots of ideas.

2 Likes

I have just ordered three Wemos D1 Minis in the UK for ÂŁ10 total (from a UK supplier). They can be powered from a standard phone charger. Brilliant little devices. As suggested above you can easily use MQTT over the built in wifi to communicate with node red.
I use the Arduino IDE and DIY code.

2 Likes

Wemos also have a relay shield for the D1!

Yes, also very small and cheap. For example One Channel D1 Mini Relay Shield Module For WeMos Arduino ESP8266 Board ATF | eBay

All examples I see of the Wemos i see are with a single relay. Does this also work with a 4,8 or 16 relay or is it limited to a single relay?

It needs an Output pin for each relay. I am not sure how many output pins it has, you would have to check. Not 16 I am sure, it isn't big enough. Maybe not 8 either.

They also have a tripler base:

https://www.wemos.cc/en/latest/d1_mini_shield/tripler_base.html

The relay board has 7 configurable IO's so this would give you 3 relays.
https://www.wemos.cc/en/latest/d1_mini_shield/relay.html

Here's a link to show the use of the various pins. Scroll down to find the Wemos device.

As you can see, the number of spare/available OUTPUT pins depends on what other devices you are using.

I've not tried to do it, but you might be able to use this I2C module or chip to expander the number of I/O pins. (i.e. You would need to connect each output to the opto-coupler on the relay board.)

This board has 3 select pins and the ability to daisy-chain up to 8 boards together, so theoretically 64 I/O pins could be controlled (by just using 2 pins for the I2C bus).

You could use an esp32 flashed with tasmota if you need more pins, alternatively I use D1 minis with MCP23017 chip connected, this gives and extra16 input or output pins. Easy enough to setup either option with tasmota.