Controlling LED drivers with a PWM using a PIC MCU

Thread Starter

sidd342

Joined Oct 9, 2023
32
In one of the circuits I'm working on, there are three LED's connected to every LED driver output (I have a space and cost constraint because of which I need to use this). The high side of each LED is connected to a fixed high voltage and I provide the ground using the LED driver to switch on and off the LED's.
The three LED's have different switching on voltages using which I want to switch on each LED one after another. Is it possible to provide a PWM signal to the LED driver such that I can have the output as 3,2 and 1 Volt respectively?
 

BobTPH

Joined Jun 5, 2013
11,480
1. You do not drive LEDs with a voltage.
2. PWM does not vary a voltage, it varies a duty cycle. You cannot give an LED that requires 3V max 6V via a PWM at 50% and expect then to survive.
3. What is this LED driver you are connecting 3 LEDs to?
4. Are the connected in series or parallel?
5. If all 3 are connected to one driver, how is it possible to control them individually?
6. Please provide a schematic. We have no idea what you are trying to do.
 

Thread Starter

sidd342

Joined Oct 9, 2023
32
1. You do not drive LEDs with a voltage.
2. PWM does not vary a voltage, it varies a duty cycle. You cannot give an LED that requires 3V max 6V via a PWM at 50% and expect then to survive.
3. What is this LED driver you are connecting 3 LEDs to?
4. Are the connected in series or parallel?
5. If all 3 are connected to one driver, how is it possible to control them individually?
6. Please provide a schematic. We have no idea what you are trying to do.
This is the part of the schematic that I'm working with. As in the schematic, LED's H20, H12 and H4 have different switching on voltages. Vcc1, Vcc2 and Vcc3 have the same voltage as measured through a multimeter. I want the three LED's to switch on one after the other in succession. I do have a physical device which is working with this configuration.
 

Attachments

BobTPH

Joined Jun 5, 2013
11,480
Do you have an English language datasheet for the driver chip? I can only find Chinese, so I cannot help you. I suspect it is a constant current LED driver. Whether it can be programmed for different currents, I cannot tell.

I presume you are activating the 3 voltages separately. I have never heard if an LED with a forward voltage of 1V.

In any case, you do not want to set a voltage for an LED, you want to set a current.
 

Thread Starter

sidd342

Joined Oct 9, 2023
32
Do you have an English language datasheet for the driver chip? I can only find Chinese, so I cannot help you. I suspect it is a constant current LED driver. Whether it can be programmed for different currents, I cannot tell.

I presume you are activating the 3 voltages separately. I have never heard if an LED with a forward voltage of 1V.

In any case, you do not want to set a voltage for an LED, you want to set a current.
Based on the data sheet, the driver can provide varying current outputs between 3mA to 32mA.

Also I do understand that logically we set currents in a constant current LED driver but when we are controlling an LED driver with an MCU, based on my understanding, we provide a high or a low as an output to the driver which is how we set the voltage. In this case, how do we program the LED driver to give a constant current?
 

BobTPH

Joined Jun 5, 2013
11,480
Please find attached the data sheet. And yes it is a constant current LED driver.
Thank you. The current is set by a single resistor for all outputs. The voltage is irrelevant, the chip adjusts the voltage to what the LED needs. So your attempt to provide different voltages is not useful.

In fact, I don’t think your circuit is correct at all. Though they do not state it explicitly, it sounds like the outputs source current from Vdd, and the LED would connect from the out pin to ground. Have you verified that your circuit works at all?

I cannot believe there is no sample application circuit in the datasheet. That would have clarified the current direction.
 

Thread Starter

sidd342

Joined Oct 9, 2023
32
Thank you. The current is set by a single resistor for all outputs. The voltage is irrelevant, the chip adjusts the voltage to what the LED needs. So your attempt to provide different voltages is not useful.

In fact, I don’t think your circuit is correct at all. Though they do not state it explicitly, it sounds like the outputs source current from Vdd, and the LED would connect from the out pin to ground. Have you verified that your circuit works at all?

I cannot believe there is no sample application circuit in the datasheet. That would have clarified the current direction.
Yes, I'm using this circuit in one application and it does work with these schematics. Furthermore it does seem like the LED drivers are just being used to provide the ground to the LED's. Basically the sole purpose of the driver here becomes SIPO, and not current driving for the LED.
Do you think it is possible that we're using a PWM to set the low side voltage in the driver based on the forward voltages of the LED?
 

BobTPH

Joined Jun 5, 2013
11,480
Okay, I looked again and see that the outputs have a MOSFET between the pin and ground, so they are sinking current. That is sure not obvious from the text and arrows in the diagrams.

I suppose you could PMM the voltage driving each LED, but that would subvert the chips constant current mechanism and there is no telling what it might do.

It sounds like what you really want is a port expander. Then you can use the LEDs with resistors to set the max current, and PWM to dim.
 

Thread Starter

sidd342

Joined Oct 9, 2023
32
T
Okay, I looked again and see that the outputs have a MOSFET between the pin and ground, so they are sinking current. That is sure not obvious from the text and arrows in the diagrams.

I suppose you could PMM the voltage driving each LED, but that would subvert the chips constant current mechanism and there is no telling what it might do.

It sounds like what you really want is a port expander. Then you can use the LEDs with resistors to set the max current, and PWM to dim.
That does make sense. I will try the PWM method first and if that fail I'll use the port expander. Thank you for all the help again.

Just another query, since I'm gonna be using this in conjunction with the speedometer (which you helped me find the distance for), would I need to have two separate timers if I'm using the PWM bit? Additionally, do you think it would interfere with the working of other processes (like headlight, parking indicator and so on) if we use the PWM?
 

BobTPH

Joined Jun 5, 2013
11,480
If you don’t need to vary the brightness, you just need the 3 LEDs to have different brightness always, you could use a parallel resistor to suck off some of the current.
 
Top