I’m trying to connect an ESP32 to a board from a remote control, so I can press the buttons from HA. This is my first ESP project, so I’m still learning. I first set this up with a breadboard and LEDs to test it, and it worked great.
Now I’m soldering the ESP32 to the board, but I’m running into an issue where the LED on the board stays on, indicating that the button is being “held down”. I’m not sure if it’s an issue with my code or has something to do with how I’m making the connections. Any help would be appreciated!
That looks like a keyboard matrix which is detecting connections from one pin to another, you won’t be able to just apply voltage to a particular button and get the desired result. The MCU there is scanning the rows/columns of the matrix and looking for a connection, and providing power to each row or column as it performs the scan. Injecting voltage into it will create press signals to multiple buttons and undesired presses.
Your best bet is a relay to connect to the button you want to press as it will function identically to the switch that is in the circuit currently.
If the signal is Infrared from the remote, it would be much cleaner to connect an IR receiver to your ESP32, capture the code and then attach an IR LED to the ESP32 and replay the captured command.
The remote is RF and uses 2.4g, which is why I’m going this route since it won’t work with a Bond Bridge. I think I have the wiring figured out that I need to do. Does this look correct?
No it doesn’t.
You mix 5V and 3.3V if your wiring is like on your image.
You should remove the jumper, power the relay at 5V on the JD-pin(and GND) and connect the other header to 3.3V, Gnd and Gpio.
Also, the remote button is probably switching GND and you could do it just with Esp without relay (to verify with multimeter).
It’s not readable. It’s correct if the jumper is removed and 5V is wired to JD pin and VCC pin next to it is not connected to anything.
Since you are supplying remote button board from Esp32 and applying GND to the button pad (through relay) why don’t you connect the button directly to Esp32 Gpio-pin? And set the pin OUTPUT_OPEN_DRAIN.
Edit:
Also, if the button pad is triggered with GND, the turn_on/off_action on your post#1 is wrong, you need to invert the logic.
Setting the pins to OUTPUT_OPEN_DRAIN and inverted = True did the trick! I was able to wire the ESP directly to the buttons and leave out the relay. Thank you so much for your help!
+1 to @Hellis81’s suggestion to use optocouplers when dealing with something as small as a remote.
Was working on a similar project and these ready-made boards are perfect for the job - smaller than a relay module, come in 2/4/8 channel versions, and quite cheap.