RGB LED PCB Schematic Issue...

Thread Starter

ponas.jonas

Joined Feb 28, 2023
31
Hello everyone,

It is my first time creating a PCB using Easy EDA, and I would like to add two RGB LEDs to my PCB. I am a little bit confused as to how to wire it. This is what I have now:

1695303382963.png

I understand that to control the color of the LED, I need to send a different PWM duty cycle to each of the R,G, and B pins. I am struggling to understand where I can connect the 3 pins to the LED... Could you please help me :)

Edit:
LED datasheet: LINK
I will be using the NUCLEO FF46RE, which has an STM32. Datasheet: LINK

PCB Update #1
1695384528565.png
 
Last edited:

seanstevens

Joined Sep 22, 2009
231
Hi, It depends on the power/current involved. If your LEDs are very low current say 10-15ma then they can be PWMed directly say via Arduino I/O or such MCU. However, if they are high-current LEDs above what I mentioned, then you need to use a transistor, generally a MOSFET between GND and the resistors connecting to GND.

Do some Googling for PWM LED circuits, there are many tutorials available, a sample attached.

ORPgd.png
 

AnalogKid

Joined Aug 1, 2013
10,792
I understand that to control the color of the LED, I need to send a different PWM duty cycle to each of the R,G, and B pins.
What device is generating the three PWM signals? If it is a microcontroller (uC), check the datasheet to see what the max allowed output current is. It might be that the uC can drive the LEDs (and their current limiting resistors) directly, without the need for driver transistors.

Also, post a link to the device datasheet so we can review it.

ak
 

dl324

Joined Mar 30, 2015
16,168
It is my first time creating a PCB using Easy EDA, and I would like to add two RGB LEDs to my PCB.
Since you're a newbie, we prefer for the flow in schematics to be primarily left-to-right and top-to-bottom and for them to be monochromatic.

If your microcontroller can sink sufficient current:
1695311490310.png
If not, as is most likely, you need to add transistors and invert the polarity of the microcontroller outputs.

Sequencing for the resistors is off. Editor thinks there's an R4 somewhere and I didn't feel like fixing it...
 

seanstevens

Joined Sep 22, 2009
231
Sean - current limiting?

ak
Sorry. Yes, of course, my bad, it was a quick sample circuit with the software being responsible for the current limiting which is not the best thing to do. A current limiting resistor should be placed from each transistor emitter to the ground to limit the max current.
 

Thread Starter

ponas.jonas

Joined Feb 28, 2023
31
What device is generating the three PWM signals? If it is a microcontroller (uC), check the datasheet to see what the max allowed output current is. It might be that the uC can drive the LEDs (and their current limiting resistors) directly, without the need for driver transistors.

Also, post a link to the device datasheet so we can review it.

ak
I added all the relevant datasheets :) I am currently trying to find if the I/O pins that I will use for the PWM signal generation are 5V or not, and am a little bit confused.

Since I do not have the Nucleo FF6RE, for now I took another NUCLEO board - F446ZE and have connected a USB oscilloscope to check what the PWM pin outputs. From the datasheets it says that this pin - PD12 (TIM_4_CH1) is FT, which is 5V tolerant I/O pin, but on the picoscope, it is 3.3V. Which voltage should I use in my PCB? And also the LED needs 20mA, not sure of the STM32 can supply that...
1695377456798.png1695377498555.png1695377466640.png1695377480237.png
 
Last edited:

AnalogKid

Joined Aug 1, 2013
10,792
A current limiting resistor should be placed from each transistor emitter to the ground to limit the max current.
That assumes that the uC output voltage, which is less than Vcc when under load, is greater that of the transistor Vbe plus the LED Vf, For a Blue LED, that might not be true. Also, the transistors now are emitter followers, and do not need base resistors.

Better to put the current limit resistors in the collectors along with the LEDs, and operate the transistors as saturated switches. This puts the most, and the most consistent, operating voltage across the LEDs.

ak
 

AnalogKid

Joined Aug 1, 2013
10,792
I have updated the current PCB I have in the original question, and I would appreciate some more feedback.
The max Vf for the green and blue LED segments is 3.4 V, which will not work if the LEDs are powered by 3.3 V. The original sch has them powered by 5 V. Why the change?

I disagree with sean about resistors in series with the FET gates. Those are needed in high frequency switching circuits where the gate capacitance and wiring inductance form an L-C tank circuit that can ring at hundreds of MHz, causing radiated and conducted noise problems. While that is possible in your circuit, the energy levels involved are literally 100,000 times less, and can be ignored. In fact, the gate structure of a small signal FET such as a 2N7000 is so small that stray capacitance of the PC board assembly might swamp the resonant circuit and prevent it from ringing altogether.

I agree about the base resistors to GND. They are not needed to assure FET turnoff because the uC will drive the gates low. However, they are important to protect the FET gates from transient voltages when the board is not connected. You never want FET gates to be floating. Depending on the output characteristics of the uC, I would decrease the gate resistors to at most 10K.

ak
 

Thread Starter

ponas.jonas

Joined Feb 28, 2023
31
The max Vf for the green and blue LED segments is 3.4 V, which will not work if the LEDs are powered by 3.3 V. The original sch has them powered by 5 V. Why the change?

I disagree with sean about resistors in series with the FET gates. Those are needed in high frequency switching circuits where the gate capacitance and wiring inductance form an L-C tank circuit that can ring at hundreds of MHz, causing radiated and conducted noise problems. While that is possible in your circuit, the energy levels involved are literally 100,000 times less, and can be ignored. In fact, the gate structure of a small signal FET such as a 2N7000 is so small that stray capacitance of the PC board assembly might swamp the resonant circuit and prevent it from ringing altogether.

I agree about the base resistors to GND. They are not needed to assure FET turnoff because the uC will drive the gates low. However, they are important to protect the FET gates from transient voltages when the board is not connected. You never want FET gates to be floating. Depending on the output characteristics of the uC, I would decrease the gate resistors to at most 10K.

ak
The change from 5V to 3.3V was that I measured the PWM output pins, and saw that they reach 3.3V

Would you suggest getting rid of the FET transistors then? I understood they are used to protect the pin from any current damaging them.
 

seanstevens

Joined Sep 22, 2009
231
I guess the gate resistor helps reduce gate ringing, overshoot, inrush and EMI on MOSFETs with high capacitance and current. An old habit of mine. But I agree with AK in this circuit.
 

dl324

Joined Mar 30, 2015
16,168
The change from 5V to 3.3V was that I measured the PWM output pins, and saw that they reach 3.3V
Since the maximum supply voltage is 4V, you couldn't possibly have gotten 5V at the outputs.

You still haven't provided drive strength for the outputs.

If you're still planning to use 5V for the LEDs, you can't drive them directly from the outputs because the MCU might not be able to turn them off completely.
Would you suggest getting rid of the FET transistors then?
Don't see where anyone suggested getting rid of MOSFETs. Only the resistors on the gates that aren't required in your case. The MCU outputs were designed to drive capacitive loads because they themselves are MOSFETs.
 

AnalogKid

Joined Aug 1, 2013
10,792
Would you suggest getting rid of the FET transistors then?
No. I recommend keeping the FETs in place, and increasing the voltage source for the LEDs to at least 5 V. 9 V or 12 V would be better. The greater the difference between the source voltage and an LED's Vf, the less the LED's brightness will change with variations in its Vf, such as from one LED batch to another, with changes in ambient temperature, with aging, etc.

ak
 

AnalogKid

Joined Aug 1, 2013
10,792
I guess the gate resistor helps reduce gate ringing, overshoot, inrush and EMI on MOSFETs with high capacitance and current. An old habit of mine.
I don't know your age, but this is an increasingly common thing with young designers. Unlike you, they see an external gate resistor as something that came down from the mountain written on the back of the stone tablets, with no idea why it is "required".

Kids.

ak
 

Thread Starter

ponas.jonas

Joined Feb 28, 2023
31
Since the maximum supply voltage is 4V, you couldn't possibly have gotten 5V at the outputs.

You still haven't provided drive strength for the outputs.

If you're still planning to use 5V for the LEDs, you can't drive them directly from the outputs because the MCU might not be able to turn them off completely.
Don't see where anyone suggested getting rid of MOSFETs. Only the resistors on the gates that aren't required in your case. The MCU outputs were designed to drive capacitive loads because they themselves are MOSFETs.
Thank you all for the replies and for helping :)

But if the pins can only output 3.3V, how could I supply more voltage to it? I mean since the 3 pins are controlling the LED using PWM, arent my hands tied for the voltage I can select ?
 

dl324

Joined Mar 30, 2015
16,168
But if the pins can only output 3.3V, how could I supply more voltage to it? I mean since the 3 pins are controlling the LED using PWM, arent my hands tied for the voltage I can select ?
You just add transistors and invert the polarity of the PWM signal. In the original circuit, the OFF time would have turned the LEDs on. With the transistors, the ON time would turn the LEDs on.
1695658225604.png
AO3400 are logic level (Vgs(th) = 1.45V max) MOSFETs in SOT-23. I thought about using 2N7000, but the threshold voltage can be up to 3V.

I omitted pull-down resistors on the gates that you might want to include.
 

Attachments

Last edited:

BobTPH

Joined Jun 5, 2013
8,120
No, the transistors allow you to connect the anode to 5V or an other voltage.

If using MOSFETs, make sure they are on at 3.3V. Standard MOSFETs require 10V. You need a logic level MOSFET.
 
Top