Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

How is this possible?

Status
Not open for further replies.
Looks to me like only one LED lit at a time is what you're aiming for with this, though you could light up more than one if desired, but wouldn't be able to pick exactly two LEDs and always only get just those 2 to light. But you can always light exactly one specific LED that you desire. examples, LEDs numbered from left to right, control lines numbered from top to bottom:
LED1 : line 1 high, line 2 ground
LED2 : line 1 high, line 3 ground
...
LED5 : line 2 high, line 1 ground
...
LED11 : line 3 high, line 4 ground
etc.
 
Oh, dur...I think I get the original question now...if the other lines are high or grounded, then you'd get a lot of other LED's lighting up undesired...hrm...
 
since microcontrollers can source and sink current on their pins you can connect two leds in anti-parallel and light them both by connecting them to two microcontroller pins and then alternating which pins are sourcing or sinking the the current. only one led will be on at a time but if you switch them fast enough it will appear that both leds are on.

Timing can also be used to light up diferent banks of leds. say you have three leds that are connected to one common anode and three different cathodes. then you have another bank of three leds connected to another common anode but the same three cathodes as the first bank. if you power up the first anode you can light up a led in the first bank, if you shut down that anode and power up the second anode you can light any led in the second bank using the same cathode signals. if you do it fast enough it will appear you are controlling six leds using only five pins.

combining both techniques you can make the circuit you have posted control 20 leds with five pins. the same pin's status relative to the other four pins controls one led for every other pin. five pins total with each pin being relative to four other pins gives you four times five leds to control. 20 Leds
 
According to **broken link removed** you're supposed to set the other pins to be inputs...will this work?
 
I don't think so, they'll be floating and will either be HIGH or LOW
But it don't seems like I can control the just ONE LED i want?
The technique should do it
 
Electronics4you said:
I don't think so, they'll be floating and will either be HIGH or LOW
But it don't seems like I can control the just ONE LED i want?
The technique should do it


You most certainly can control one led with that circuit.

If you also include the technique of setting a pin to input mode, it will no longer sink or source significant current. It will be essentially inert and allow you to drive the leds without interference.
 
Last edited:
I think when the pin is set to be an input, it goes into high impedence thus blocking current from flowing from/to it? If I'm reading the page correctly.
 
Lets go back to our simplified example. This time we'll have three pins, each pin now has four leds, two in anti parallel connected to one pin, and another two in antiparellel connected to another pin. In total we have six leds. (draw yourself a diagram if you have trouble visualizing this).

we now wish to light up one led. pin 1 is set to high, and pin 2 is set to low while pin 3 is set to input. only the led that is forward biased from pin 1 to pin 2 will be lit. the reverse bias led obviously can't light because it is reversed bias. the leds connected to pin 3 can't light because pin 3 acts like a high resistance (usually connected to ground). A meager current might flow but it is far too low to light a led.

the two leds that connect pin 1 to pin 3 and then pin 3 to pin 2 are both forward biased and should light if the voltage is high enough. but if you select the appropriate voltage it will be low enough not to significantly light them both, but high enough to light one led. one forward drop is usually selected.

the current flowing into or out of the "input" pin is too small to affect the circuit.

It can be seen that with the right control firmware you can control all six leds with 3 pins.
 
Status
Not open for further replies.

New Articles From Microcontroller Tips

Back
Top