Go Down

### Topic: LED dilema (Read 1 time)previous topic - next topic

#### pranoy

##### Dec 14, 2012, 01:43 pm
guys need ur help

I am doing a project based on LED
I have 2 pins left. I need to control 3 LEDs.

The idea i have is to connect 2 LEDs parallel with opposite polarity to these pins and also from these pins take inputs of an AND gate and connect the 3rd LED across the AND gate output and ground.

THIS IS HOW I THINK THE ABOVE IDEA WILL WORK::::  for the first 2 LEDs output 01 or 10 to the pins and if i give 11 as output the 3rd will light up

WILL THIS IDEA WORK?

IF NOT CAN U HELP ME WITH UR IDEA??

#### HazardsMind

#1
##### Dec 14, 2012, 01:58 pm
That will work
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### pranoy

#2
##### Dec 14, 2012, 02:00 pm
thanks but where will i connect the resistor??

#### HazardsMind

#3
##### Dec 14, 2012, 02:17 pm
you can do this
----|<|--------
(pin) ---x---|                  |---www--x--(pin)
|    -----|>|-------              |
|                                      |
|                                      |
(AND)                               (AND)
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### pranoy

#4
##### Dec 14, 2012, 02:26 pm
K

So what resistance shoul i use?

Shd i connect a resistor for the 3rd LED from and gate o/p

#### HazardsMind

#5
##### Dec 14, 2012, 02:33 pm
220 - 330 ohms should be enough, and yes you should have a resistor (330 Ohms) for the 3rd LED. Assuming these are standard LEDs, that should be enough resistance.

Do you know what the LEDs drop voltages and the current rating (mA) are? I can give you a better answer with that information.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### ash901226

#6
##### Dec 14, 2012, 02:41 pm
you know what, you remind me of multiplexing. i love that topic and you know that using charliplexing could also help.

#### pranoy

#7
##### Dec 14, 2012, 02:43 pm
I dont know about its rating .

Its ordinary 3MM LEDs

#### pranoy

#8
##### Dec 14, 2012, 02:46 pm
@ ash

I have read about charlie plexing. But it will not work here. Just charlieplexing with 2 pins will work.

I am planning to control traffic light with 3 LEDs(red,green,Yellow). ON each side of a four way junction.

#### HazardsMind

#9
##### Dec 14, 2012, 02:49 pm
Ok here is what I found.

Quote
There are three main categories of miniature single die LEDs:
Low-current -- typically rated for 2 mA at around 2 V (approximately 4 mW consumption).
Standard -- 20 mA LEDs at around 2 V (approximately 40 mW) for red, orange, yellow, and green, and 20 mA at 4-5 V (approximately 100 mW) for blue, violet, and white.
Ultra-high-output -- 20 mA at approximately 2 V or 4-5 V, designed for viewing in direct sunlight.

Five- and twelve-volt LEDs are ordinary miniature LEDs that incorporate a suitable series resistor for direct connection to a 5 V or 12 V supply.

So using this and an LED calculator, the resistance should be about 100-150 ohms, @ 5 volts.
Those resistor values should work fine. the 3rd led you can bring down a little, depending on how bright you want it.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### ash901226

#10
##### Dec 14, 2012, 02:56 pm
yes, 2 pin only could drive 2 led with charliplexing. Anyway you could control 4 led with 2 pin with multiplexing,
A B LED1 LED2 LED3 LED4
0 0   0      0       0       1
0 1   0      0       1       0
1 0   0      1       0       0
1 1   1      0       0       0

#### HazardsMind

#11
##### Dec 14, 2012, 02:59 pm
@ash901226
That is a good suggestion, and he could probably free up some other pins too.
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### pranoy

#12
##### Dec 14, 2012, 03:03 pm
@ash

How shd i connect the 4 LEDs across the pins???

#### HazardsMind

#13
##### Dec 14, 2012, 03:06 pm
With a multiplexer. The two MUX input pins are connected to the two available on the arduino. supply the voltage to the MUX and connect the LEDs with resistors to gnd.

2 pins => 4 leds
My GitHub:
https://github.com/AndrewMascolo?tab=repositories

#### pranoy

#14
##### Dec 14, 2012, 03:10 pm
ARE u telling about a DEMUX???

Go Up

Please enter a valid email to subscribe

To complete the subscription, please click the link in the email we just sent you.

Thank you for subscribing!

Arduino
via Egeo 16
Torino, 10131
Italy