Hi all.
First post here and I tried searching for this first, so apologies if this has already been answered.
I have a project where I would like to use an ESP32/8266 to control a relay briefly. I want to be able to remotely activate a momentary push button to turn on a device.
I’ve been working off of this instructable: https://tinyurl.com/yckzz7y9
I was going to edit the code to replace the on/off to just a single button that actives the relay for half a second.
I’m still investigating this route, but the user interface isn’t the cleanest
I don’t have the hardware available to me at the moment to mess around with it, but i’d like to essentially use WLED to address this relay and have two functions.
1- tap to activate this relay momentarily (when it closes the relay, its a power button press and the system its connected to fires up)
2- another function to activate the relay for 10-ish seconds (would probably need to be configurable). this will force shutdown the system.
This relay will be put in parallel with the existing power button. I want remote control to turn on the system from the other side of the room.
WLED will do the job, but is more complex than you need.
Ther are many examples available for controlling a device from a web page, with different styles of user interface. The code is relatively simple, and modifying an example for on/off or momentary operation would require only a few changes. The example you have found is the simplest and easiest to modify, but clunky. Note that you can set each command as a separate shortcut, with an icon, so you can select the different functions by selecting that icon, without worrying about the format of the command.
Thanks for the tips guys.
A little more info for you:
I need this to control (whether through a web page or phone app) to be accessible for the other members of my team. Even though WLED is probably far too much power and complex, it is free. I’m trying to put this all together with parts we already have lying around the electronics lab.
Coding is not my strong suit, but I can fumble around and edit stuff that has already been written.
I may explore the WLED a little bit more.
The example I linked sets the ESP up as a webserver on your local WiFi network. Anyone who can access the local LAN with a browser can get to the server and select the options on the page to operate the relay. This includes desktops, laptops and phones, with any OS. No special software is required for the user - it is all managed as a web page served up by the ESP that works with any browser. All that’s required is access to the local LAN. The coding change you need to make for that example is to change the ‘On’ and ‘Off’ commands from a single switching of the output pin to code that turns it on, loops until 10s (or whatever) has elapsed, and turns it off. It’s just a few lines.
Hey Jeff,
I was getting hung up on how they were creating the buttons and using the functions in that example you provided. At the bottom of that post there was an example for a momentary button press that works exactly how i want it. the button click mimics a finger press 100%
Thanks for all your help guys.