Yahoo Groups archive

AVR-Chat

Index last updated: 2026-04-28 22:41 UTC

Message

Re: How switches work

2008-09-11 by Graham Davies

--- In AVR-Chat@yahoogroups.com, Jim Wagner <wagnerj@...> wrote:

> 1) The common arrangement is to
> use an internal pull-up with a
> switch to ground. When the switch
> is pushed, you read a ZERO ...

This is more-or-less the situation in the Traffic Lights Project that 
Jeremy is working with.  But, so as not to rely on internal pull-ups 
(the project is not specific to AVR microcontrollers), there is a 3.3 
kohm pullup resistor at the switch.  In addition, there is a 2 kohm 
resistor in series from the switch to the port pin to avoid damage 
should the pin br programmed to drive high (the project is suitable 
for beginners).

> 2) One common arrangement for LEDs
> is to have the diode connected ...

The Traffic Lights Project uses a transitor to drive the LEDs in the 
more usual common-emitter configuration.  It has a 10 kohm base 
resistor.  So, when the port pin is driven high (to a ONE), current 
flows into the base, turning the transistor on and the LEDs light.  
This is done to reduce the load on the port pin.  For the advanced 
use of the project, you need to multiplex a couple of port pins 
between driving LEDs and reading the "Pedestrian" and "Emergency 
Vehicle" switches, and the transistor buffer makes this possible.

As I think I've mentioned before, the Traffic Lights Project has not 
turned out to be as popular as I thought it would.  As a result, I 
have not been able to justify the effort of fully documenting all the 
different steps you can take towards a highly functional traffic 
intersection simulation.

Graham.
www.ecrostech.com

Attachments

Move to quarantaine

This moves the raw source file on disk only. The archive index is not changed automatically, so you still need to run a manual refresh afterward.