2

As per title I'm, looking a way to detect the press of a button powered at 220v ac through a gpio pin of the ESP32.

The simplest solution found seems to be an octocoupler, but are there devices that support such a high voltage difference? What could be a connection scheme?

anonymous2
  • 4,872
  • 3
  • 20
  • 48
Stefano
  • 23
  • 4
  • why don't you do some research? ... you are not the first to solve this – jsotola Jan 01 '22 at 21:43
  • what could be a connection scheme? ... connection to what? ... your post has no information – jsotola Jan 01 '22 at 21:44
  • How is a “button powered at 220V”? A button does not use any power (or an extremely small amount). A button just opens or closes a circuit, which in the simplest case would be between your local reference voltage (usually 3.3V or 5V) or ground and a GPIO pin (details vary depending on the type of button). If there’s 220V somewhere around, there’s more than just a button… please provide a schematic of the circuit which includes this button. – jcaron Jan 02 '22 at 23:55

1 Answers1

1

I would recommending just getting a small normally open (NO) relay with 230V AC coil and then run your ESP32 Vcc (3.3V) to one relay contact and back from the other contact to a GPIO pin.

Alternatively check out AC main detector module for schematics on how to do it with an optocoupler.

Bence Kaulics
  • 7,783
  • 8
  • 41
  • 90
vaizki
  • 126
  • 1
  • Thanks, the link was just what I was looking for, I already knew about the relay, but this wasn't a viable solution for costs and space. Anyway at the end i used the solution attached to the first post – Stefano Jan 09 '22 at 14:53
  • Very thanks for the info. But I'm really new and I can't understand how to use a relay to get the input form a button. I know if I send a signal to relay this will open the circuit of 220v. But I need, when the circuit of 220v is closed (now my button is 24v I think is the same with different relay), send a signal to esp32 (I use esphome to compile the esp32 device) The "AC main detector module" maybe is good, but I can't find a DC 24v version The thing I need is: when the 24v circuit is closed send a signal to esp32. Very thanks Niks – Niks InOfTh Sep 12 '22 at 06:43