Hacker News new | ask | show | jobs
by bonzini 2228 days ago
Or an ESP8266, using MQTT to "press" buttons on a standard garage door remote control through a relay module. I uploaded mine here: https://imgur.com/a/l2wt40w (green and blue are ground and 5V, gray and white are the pulses to the relays).
1 comments

This is great. Question - why did you use the relays and not just the GPIO pins on the ESP to short circuit the contact on the remote for a brief moment?
You can't use GPIO pins to short 2 contacts together.

The best you can do is apply voltage to the contacts (which might be workable, depending on how the remote is designed).

To short the contacts you need either a relay or a transistor.

Assuming one of the contacts is connected to either ground or Vcc, one thing you can do is connect a GPIO pin to the other contact. Then when the GPIO is made an input the switch is "open", to close it you first write the value the other contact was connected to, and then you make the GPIO an output. Whether this works depends on the current that is sinked by the remote. This was my plan initially but then I went with the relays.
Ah yes, of course. Perhaps a transistor could work as well for low voltage?
Yes but I wasn't too comfortable with hacking the remote control because I wasn't sure if the button shorted the two contacts towards Vcc or ground (so if I needed an NMOS or PMOS). My knowledge of electronics is super minimal, I can read schematics, design simple circuits, size resistors, etc. but reverse engineering is beyond my level.

Also I used this remote control only because one of the switches was broken, I didn't have a spare one so I couldn't afford breaking it.

An optocoupler would be better but I figured maybe one day I will repurpose the relay shields for something else, or unsolder the relays. Actually my next project involves both optocouplers (for efficient 12V->3.3V conversion) and relays to drive AC but I will probably have a PCB manufactured for that one!

Yes, though you will need to determine whether it should be pull up or pull down, and to what voltage level. And make sure not to provide it with too high a load (too low resistance), or too high a voltage, which may damage the circuit. Since the voltage levels might be different from your microcontroller, so I would probably recommend an optocoupler to simplify the interfacing. Gives the isolation of a relay but without the mechanical operation and size of one.
Yep, should work fine since you only need current flow in one direction!