Stupid question - How best to momentarily ground a signal wire in ESPHome

I could connect a Normally Open relay to momentarily close a contact from the signal wire to ground, but as I have two signals to ground, this solution is rather bulky. I’m wondering, if I connect the signal wire to a GPIO pin, can I programmatically ground that pin momentarily?

Could I write some C++ code for a Lambda in an ESPHome service? Would it just be pinMode(pinId, INPUT_PULLDOWN); to switch that pin to GROUND for a few seconds, then pinMode(pinId, INPUT); ?

Well, it appears on the ESP8266, the only GPIO pin with any kind of pulldown capability is GPIO16. (On the D1 Mini, this is pin D0). Since I have two signals to ground, looks like I should use an ESP32 instead. Or, purchase a ready-made ESP8266 with two mechanical relays and avoid the lambda and C++ coding.

Hey, I told you it was a stupid question, right from the very start. :crazy_face:

To approximately ground something all you have to do is output a logic low (0). This might be up to 0.4v though (VOL for 3.3V logic):

A better way to do it would be with any general purpose transistor connected as an “open collector”:

The signal you are shorting had better be current limited though. Or smoke will come out.

1 Like

It’s the two signal lines for LED and beeper control from an RFID reader. They both sit at just about 4.8VDC from the reader. If you ground either of them (Most reader documentation states to ground these pins to activate the signals. I have grounded them, using a short segment of solid-core wire. No magic smoke appears.) then the LED changes colors from red to green or the beeper sounds.