1
\$\begingroup\$

I am trying to control a 5V relay with a push button with an indicator LED using GPIOs 0, 1 and 3. I have pulled up the GPIO0 and using it as output, so that when I drive it low, the LED should glow, but its not happening. Is there anything wrong with my schematic?

enter image description here

\$\endgroup\$
16
  • \$\begingroup\$ perhaps you should be asking about the switch led, not about your project ... please add the datasheet for the switch \$\endgroup\$
    – jsotola
    Dec 6, 2021 at 16:22
  • \$\begingroup\$ I will try to find it. The issue I am facing is that when I write the code in Arduino for just blinking the LED and switching the relay on/off at 1 second intervals, nothing happens. \$\endgroup\$
    – Amorphous
    Dec 6, 2021 at 16:24
  • 1
    \$\begingroup\$ GPIO0 sees +5V through LED1 + R6, that will cause trouble later, if not now. \$\endgroup\$
    – jay
    Dec 6, 2021 at 16:37
  • 1
    \$\begingroup\$ I will try without the LED or swap the 5V on the LED with 3.3V source \$\endgroup\$
    – Amorphous
    Dec 6, 2021 at 17:28
  • 1
    \$\begingroup\$ Yes. Swap +5V for the Led with 3.3V. Safer. \$\endgroup\$
    – Antonio51
    Dec 6, 2021 at 17:30

1 Answer 1

2
\$\begingroup\$

Is there anything wrong with my schematic?

If you are using a switch similar to this one: -

enter image description here

Image from here courtesy of RS components.

Then, the switching contacts are between pins 2 and 4 (or 1 and 3). Your schematic shows this: -

enter image description here

So, it looks possible that you may not have wired up the switch correctly. You can confirm this by linking the data sheet. In other words, between pins 1 and 2 is a dead short.

Of course, if you put a feeble switch like this directly across a 100 nF capacitor, when the switch closes, you get an almighty current surge into the switch that may weld the contacts closed. This type of switch has the following current rating: -

enter image description here

50 mA is just not going to cut-the-mustard when shorting out a charged capacitor if this switch is similar to the one used. Data sheet link required.

\$\endgroup\$
5
  • \$\begingroup\$ Infact I did screw up exactly like this earlier but then corrected it in my current prototype PCB. Can confirm that switch is wired correctly \$\endgroup\$
    – Amorphous
    Dec 6, 2021 at 17:13
  • 1
    \$\begingroup\$ I can't confirm that because I only have your schematic and no link to the device. However, I have pointed out another deficiency in your design; you may need a 100 ohm (or thereabouts) resistor in series with your switch to prevent it becoming damaged when you short out the capacitor (C7). \$\endgroup\$
    – Andy aka
    Dec 6, 2021 at 17:20
  • \$\begingroup\$ Thanks a ton. I will add a current limiting resistor in series with the switch..never thought of it..much appreciated PS : Sorry I meant I can confirm that the switch is wired correctly (in the previous comment) \$\endgroup\$
    – Amorphous
    Dec 6, 2021 at 17:27
  • \$\begingroup\$ @Amorphous no problems and good luck (but you still didn't link the switch used because I like to nail these things down instead of leaving a slightly open-ended answer!) \$\endgroup\$
    – Andy aka
    Dec 6, 2021 at 17:32
  • \$\begingroup\$ Its a chinese switch, I will try & dig out the datasheet \$\endgroup\$
    – Amorphous
    Dec 6, 2021 at 17:35

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge that you have read and understand our privacy policy and code of conduct.

Not the answer you're looking for? Browse other questions tagged or ask your own question.