BiColor LED = both colors light up with current wiring

Thread Starter

chipnod2020

Joined Jan 6, 2021
4
Here is a video example on what I'm trying to replicate. The board in the video below is not an arduino, but a vendor in the modeling realm that sells light and sound effects boards. I'm still working on sound on mine, so please disregard.

https://drive.google.com/file/d/1zL7UC3TW6K288FIcT6GeJQ_JAqz_On09/view?usp=sharing

So what it amounts to is 3 steps using pwm and analogwrite of the Arduino nano. Step 1 - Build up the color red from 0 to a setting that isn't fully on for a duration of time via analogwrite on a pin. Step 2 - turn off the red LED and turn on the white LED for a duration of time at full brightness. Step 3 - Turn off the White LED, turn the red LED back at the level it was at the end of Step 1, and slowly dim to 0. This all has to be powered by the external power supply and not the arduino itself, and using 2 bicolor LEDs with a common cathode.

If I use separate LEDs for the colors, it works perfectly. Please note, the time has been extended hence why it's slow.

https://drive.google.com/file/d/1Lknv_ripjVziDopjy3Z4LCtX-39KRkvz/view?usp=sharing

When I rewire it up to use the bi-color LED, this is the effect. Both LEDs come on. For this example, it's a blue/amber 5mm bicolor LED. Kinda the same but different.

https://drive.google.com/file/d/1nuxUaUS6J3lxUS_jM_xr6Tf-Dw7c-a2g/view?usp=sharing

This is the LED I am using. https://www.unique-leds.com/leds/bi-color-led/5mm-bi-color-red-white-led-common-cathode/

As you can see, both colors are on at the same time or so it appears. Here is the circuit diagram on what I'm trying to accomplish. Be gentle, I'm a bit new at designing and putting together my own circuits.

Image 28.png

I'm positive it's the common cathode on the drain side of either mosfet that it causing this. I just don't know how to wire up the mosfet drain side so that either of them act independently and don't power both anodes of the same LED at the same time.
 

djsfantasi

Joined Apr 11, 2010
9,156
So if I may... how would you solve the single cathode led with 2 separate power paths? Relay? Diode?
Neither. You would wire the cathodes of both LEDs to ground directly. Then, switch the anodes with a P channel MOSFET. Tie the anodes of the white LEDs together and to the drain of the p channel mosfet. Do the same for red.

You might need a mosfet driver which could be as simple as a BJT or an N channel MOSFET (such as a 2N7000) to drive the gate of the P channel from the Arduino.
 

Thread Starter

chipnod2020

Joined Jan 6, 2021
4
Neither. You would wire the cathodes of both LEDs to ground directly. Then, switch the anodes with a P channel MOSFET. Tie the anodes of the white LEDs together and to the drain of the p channel mosfet. Do the same for red.

You might need a mosfet driver which could be as simple as a BJT or an N channel MOSFET (such as a 2N7000) to drive the gate of the P channel from the Arduino.
Would a common anode bi color led fix this issue?
 

eetech00

Joined Jun 8, 2013
3,858
Neither. You would wire the cathodes of both LEDs to ground directly. Then, switch the anodes with a P channel MOSFET. Tie the anodes of the white LEDs together and to the drain of the p channel mosfet. Do the same for red.

You might need a mosfet driver which could be as simple as a BJT or an N channel MOSFET (such as a 2N7000) to drive the gate of the P channel from the Arduino.
Why not drive the LEDs directly from the gpio port? Each is only 20ma.
 

DanSohan

Joined Jan 6, 2021
18
They'll tell me off, but I've but dozens of led projects with nanos, and I omit the resistors and MOSFETs altogether.

The outputs only provide 40mA at 3.3V, its not really enough to burn an LED out. The port should easily power two LEDS also. If you connect the cathodes of the LEDs to ground and anodes to arduino pin, youll get the 40mA.. If you connect the anodes of the LEDs to 5V or 12V and the cathodes to the arduino (using digitalWrite_LOW) to turn them on, the arduino can sink more than 40mA.. Therefore the calculated current resistor is needed.

only problem you might have is if the LEDs have higher than 3 or so volt forward drop voltage. This is seen on their datasheet. (as the voltage provided needs to be higher than the rated forward voltage).

For example. A Red LED with 1.9v forward voltage and recommended current draw of 10mA.

It is supplied by 5VDC - it drops 1.9v from 5V (5V-1.9V =3.1V).... This 3.1V needs to be dropped across the resistor, and 10mA needs to flow through it. Ohms law V over I time R is used. 3.1V / 0.010A = 310ohms or closest available value.

Look into neopixels if you have time to work on the arduino code (the libraries examples work well). You can set them to any colour and brightness, and connect as many as you like with only 3 wires as they have a serial in and out pin. Used them on my Voyager to great effect!
 

djsfantasi

Joined Apr 11, 2010
9,156
Doesn't the nano only support 400 MA?

I am a little spooked at running it all through the nano.
Current limits on an Arduino is a complicated subject. It varies by which rail is being used, which Arduino model you have and different limits for power supplied by the Arduino, the Arduino’s power source, the current available on the pins or the total current. This article might make sense of all of this.

I don’t know where you got the 400mA limit... it’s closer to 100mA on the 3.3V rail (maximum of 150mA; typical design of 100mA)And you have to subtract the current required by the microprocessor itself before you have a budget for your peripherals.

Each pin has an absolute maximum current allowed 40mA. Absolute maximum values are not expected to be designed for. 20mA is a typical Arduino design current.

His push button and four LEDs are going to draw 100mA, at the safe limit of the 3.3V rail BEFORE accounting for the current needs of the Arduino Nano itself. It might work; it might not. I wouldn’t design to these specs.

It’s entirely possible to make this work. Run the LEDs at a lower current. Connect the push button to the 5V rail with a current limiting resistor. Drive the LEDs with n channel MOSFETs driving p channel MOSFETs. And other considerations.
 
Top