Maker Pro
Maker Pro

normal closed switch interface+status led

sherazi

Mar 8, 2010
91
Joined
Mar 8, 2010
Messages
91
hi

i want to interface some switches to the AVR...

i came out to something like this (the Resistance value is 4.7 k,and VCC=5V,) for a pushbutton, and a normal close switch, all i need is the led should be on if switch is pushed, i can manage with change in the logic at GPIO,

but the normal closed switch circuit would be dissipating lots of energy... can some one give me better circuits...
 

Attachments

  • normal close.jpg
    normal close.jpg
    16.3 KB · Views: 637
  • Push to Make.jpg
    Push to Make.jpg
    20.6 KB · Views: 316

Externet

Aug 24, 2009
891
Joined
Aug 24, 2009
Messages
891
Left schematic:
The led in parallel to the switch as you have it is fine, but,
The switch would not dissipate energy. The resistor would dissipate ~5mW, and the led would barely turn on with 4.7K when the normally closed switch is pushed.
The level at GPIO would not be 5V when the normally closed switch is pushed, it would be about 2V or Vf

=============================================
Right schematic:
The level at GPIO would not be 0V when the normally open switch is pushed, it would be about 2V or Vf

=============================================

Try:
+5V-----------------NOswitch------------A-------------4.7K--------------GPIO
Connect led with its 470 ohm series resistor between node A and gnd.

Will give you 0V at GPIO when not pushed and led off, 5V when pushed at GPIO and led on.
============================================
 
Last edited:

(*steve*)

¡sǝpodᴉʇuɐ ǝɥʇ ɹɐǝɥd
Moderator
Jan 21, 2010
25,510
Joined
Jan 21, 2010
Messages
25,510
You're trying to use the same pin for both input and output, right?

Whilst there's nothing awfully wrong with that, I would consider the case where the pin is driving (at least part of the time) the output high and someone presses the switch.

You might want to consider a resistor in series with the switch (and the LED too) so that you're not relying on the limited drive current available from the AVR to prevent damage.

The 4.7k resistor may cause the LED to be noticeably illuminated in dim lighting.
 
Top