Best input device for open close

Hello All,

I need a device that I can input an open/close state of a relay. Could anyone please recommend one that is easy to use? Can be ethernet or wifi.

Hope everyone is having a great day!

ESP devices can do that easily and they are cheap. Soldering skills may be necessary

1 Like

Cheers, soldering no problem. Will check them out now.

As @krambriw said, ESP devices are inexpensive and can do a lot of things.

The ESP32-S2 Mini is very inexpensive and has lots of I/O pins, analog as well as PWM.
Oh and yes - it is WiFi enabled. Recently I've been programming my devices using MictoPython.

1 Like

Cheers DynamicDave. After looking at the ESP32 I realised I have a raspberry pi sitting here doing nothing and looks like I could use that to send the message to node-red on my PC?

Run node red on the pi as well and get the data to the pc using mqtt.
Or even do everything on the pi and just run the browser on the pc.

1 Like

Well two things to consider...
(1) Make sure your inputs to the RPi are within 0V to+3V3
Put some resistors in there to limit the current/voltage.
(2) ESP32s or ESP8266 can be deployed at various places around your home to sense and report conditions.
They are much cheaper than a RPi - so if you destroy one, you won't get upset.
Whereas, if you destroy a Pi you will be heart-broken (ha, ha, ha).

PS: The ESP32 and ESP8266 will support MQTT (so very easy to transfer data around).

Here's a link to a tutorial I wrote for my IoT students about using "buttons".
http://resources-area.co.uk/node-red-flows/having_fun_with_buttons.pdf

2 Likes

To put the Tasmota firmware inside the espxxxx you can use this easy way via an web page
https://tasmota.github.io/install/

Or if you want to use the Esphome firmware, here is the link
https://web.esphome.io/

Both firmware can report gpio status via mqtt

There is also Esplink

1 Like

That is correct.
@btbr, you indicated that you have a relay contacts input, so presumably there are no volts on it. Connect one of the relay contacts to 0V on the Pi, and the other to a GPIO Input, with something like a 4k7 pullup resistor from the GPIO to the Pi 3.3V. You will probably have to use some debounce on the input so you don't get multiple events each time it closes. If I remember correctly the GPIO node can be configured to debounce it.

1 Like

There is also node-red-mcu if you want to run Node-RED flows on such devices...

1 Like

Very clear instructions on it. Good to know. Thanks Bart

2 Likes

As @Colin mentioned above, it is normal practice to use some resistors to protect the input pins on your microcontroller. Here are examples of "Active-High" and "Active-Low" configurations.

Active-High

Further information is on my website Share_My_Projects - Remotely Controlled Station and check-out Appendix-E where there is a detailed description on connecting buttons/switches to a microcontroller.

2 Likes

Slightly strange terminology (for me),"Active HIGH Pull-Up circuit".

Input is Active HIGH,but with pull down resistor.

GPI(O)s are pull up/down with opposite activation.

1 Like

Thank you very much for all your replies.

Got it working on a pi4 (nearly) using the GPIO node in node red. What a great node that is. I’ve got some 4.7k resisters here somewhere so will try that configuration as gpio juts going to ground at the mo.

Just need to set the mqtt output node (pi) and the mqtt input node (pc) correctly and it should all work.

I’ve set the node server addresses as the ip of the pi and pc respectively. Not working yet but think it might be a password issue. Looks like I can test with MQTT explorer on the pc. Will give it a try later.

Thanks again for all your help.

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