0
\$\begingroup\$

I'm not that good in electronics, so maybe what I'll write bellow might sound awkward to you. If so, please correct me where needed, or ask me for any other more details.

I'm trying to add a standard wall switch to an ESP8266 module. I've set as input for the switch 3v from the ESP module, and for output I've used: a 10k resistor connected with the - of esp, to clear the residual current; and also connected on an input pin of the ESP module. This seems to be working fine, but from time to time I get some signals like the switch was turned on/off, without anybody using it. Is there another way to achieve this? Thank you!

Edit: I've added the schematic

schematic

simulate this circuit – Schematic created using CircuitLab

asked Jan 2, 2018 at 14:04
\$\endgroup\$
2
  • 1
    \$\begingroup\$ Add a schematic please, edit your question and press Ctrl + M to open the embedded schematic editor. \$\endgroup\$ Commented Jan 2, 2018 at 14:06
  • 2
    \$\begingroup\$ K, will try do create one. Than you. \$\endgroup\$ Commented Jan 2, 2018 at 14:06

1 Answer 1

0
\$\begingroup\$

This will help if the false operation is happening only when the switch is open. Disable the internal pullup/down resistor and don't use one of the GPIO pins that determines bootup.

schematic

simulate this circuit – Schematic created using CircuitLab

The 1K supplies only 3.3mA which is not really sufficient voltage or current for reliable operation of a mains wall switch, I'm afraid, but you may get away with it.

A proper design might use a 12-24V supply, perhaps 20mA, and reduce the voltage down to go into the MCU, with some transient suppression as well.

answered Jan 2, 2018 at 15:20
\$\endgroup\$
7
  • \$\begingroup\$ Thank you for the answer. The mains switch is only used on the esp module, which uses a relay for the 220v lights. I'll add a schematic when I'll get home \$\endgroup\$ Commented Jan 2, 2018 at 15:25
  • \$\begingroup\$ @Piter Yes, that is exactly what I have assumed from your description. Mechanical switches don't like current/voltage that is too high or too low. \$\endgroup\$ Commented Jan 2, 2018 at 15:27
  • \$\begingroup\$ Hi! I've added a schematic, maybe you can check it and see if it makes more sense? \$\endgroup\$ Commented Jan 2, 2018 at 21:59
  • \$\begingroup\$ No change to my answer - it's inverted compared to yours but that's a simple change in your firmware. \$\endgroup\$ Commented Jan 2, 2018 at 22:02
  • \$\begingroup\$ So the issue is with the mains switch, that ... is unreliable at low voltage? And having the 10k resistor is helping, meaning I see the result when the switch is pressed, but sometimes it gets automatically triggered on and off, for a fraction of a second - I was thinking to update the sw on ESP module to "ignore" this case. \$\endgroup\$ Commented Jan 2, 2018 at 22:08

Your Answer

Draft saved
Draft discarded

Sign up or log in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

Post as a guest

Required, but never shown

By clicking "Post Your Answer", you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.