Using PWM to turn LEDs ON or OFF

Thread Starter

mindless

Joined Feb 27, 2025
16
Hi,

I'm a noob in electronics and I need a schematic to turn LEDs ON or OFF using PWM signal in my RC car. PWM is at 6V, 500 to 2500us @ 16kHz. I would like it to switch the connected LEDs when it's close to 2500us and turn OFF when it's close to 500us (or the other way around). I have input PWM signal, GND and 6V. GND is shared for PWM and load. I have a MOSFET at hand, IRFZ44N . As I understand, it should be fine for this application.
TIA!
 

Thread Starter

mindless

Joined Feb 27, 2025
16
I don't have an oscilloscope so I got the timings from servo motors I use. You're right, that 16kHz is something else I confused with PWM freq. So timings are correct, PWM freq is not. Thanks!
I'm using a servo tester atm for pwm output but RC receivers use same signal for sure.
 

crutschow

Joined Mar 14, 2008
38,325
I would like it to switch the connected LEDs when it's close to 2500us and turn OFF when it's close to 500us
So what do you want to happen in between those two values?

Should it go ON at 2500µS and stay on until it reaches 500µs, and then stay OFF until it goes back to 2500µs?

Or something else?
 

Thread Starter

mindless

Joined Feb 27, 2025
16
Yes, this sounds right!
Should it go ON at 2500µS and stay on until it reaches 500µs, and then stay OFF until it goes back to 2500µs?
 

Tonyr1084

Joined Sep 24, 2015
9,744
What isn't making sense to me is the use of PWM to turn "ON" or "OFF" an LED (or LED's). PWM is best suited for dimming. If you want switching ON and OFF I'd say PWM is not the way to go. Depending on your signal source it's likely you'll want a small MOSFET or BJT (MOSFET = Metal Oxide Silicone Field Effect Transistor & BJT = Bipolar Junction Transistor {or just Transistor})
 

LowQCab

Joined Nov 6, 2012
5,101
That's not really "PWM", per-se,
that's an incorrect use of the term that has somehow stuck, and is still in use, in the RC-World.
When somebody comes into an Electronics-Forum and says PWM it means an exact thing,
so everybody is getting confused because they're are two different languages being spoken.

RC Servo-Motors use a special "Pulse-Length" Signal at a fixed Frequency
to transmit the requested Servo position Signal,
similar to PWM, but not really PWM.
.
.
.
 

BobaMosfet

Joined Jul 1, 2009
2,211
Hi,

I'm a noob in electronics and I need a schematic to turn LEDs ON or OFF using PWM signal in my RC car. PWM is at 6V, 500 to 2500us @ 16kHz. I would like it to switch the connected LEDs when it's close to 2500us and turn OFF when it's close to 500us (or the other way around). I have input PWM signal, GND and 6V. GND is shared for PWM and load. I have a MOSFET at hand, IRFZ44N . As I understand, it should be fine for this application.
TIA!
No, no don't talk in microseconds. Use miliseconds, easier for you to understand. 2500uS = 2.5ms. Which is a bit fast- you'll barely see it as anything but a flicker. Here's a way to keep electronics numbers straight:

X.mmm uuu nnn ppp fff

m = miliseconds
u = microseconds
n = nanoseconds
p = picoseconds
f = femtoseconds

Your IRFZ44N is way, way, way overdriven for this application. Try, instead, using something like a 2N7000. Last time I bought these, they are $0.51per.

General Purpose N-Channel Switching Transistor- Low voltage, low current; Max Vds: 60V; Max Vg: +/-20V; Id(max): 200mA; Max Switch Freq: 100MHz; Vg might require as much as 10V for fully 'ON';
 

AnalogKid

Joined Aug 1, 2013
12,050
I need a schematic to turn LEDs ON or OFF using PWM signal in my RC car. PWM is at 6V, 500 to 2500us @ 16kHz. I would like it to switch the connected LEDs when it's close to 2500us and turn OFF when it's close to 500us (or the other way around). I have input PWM signal, GND and 6V. GND is shared for PWM and load. I have a MOSFET at hand, IRFZ44N . As I understand, it should be fine for this application.
I think the intent is for the PWM signal to be discriminated into one of two steady-state outputs, so the LED is either off, or driven on by DC.

My read of this is two pulse width discriminators plus one flipflop. Disc1 sets the ff when the input pulse width is less than 0.5 ms. Disc2 resets the ff when the input pulse width is greater than 2.5 ms. The LED(s) can be connected to either ff output depending on the desired logic polarity.

The ff is needed because of the large deadband between the two target pulse widths.

ak
 
Last edited:
The 2mA current source charges the C1 (1uF) during pulse high.
So for 500us the C1 is charged to 1V and for 2500us to 5V.
During every pulse this voltage is stored with SampleAndHold to C2.
The schmitt trigger perform the hysteresis.

Note: The schmitt trigger may need to be tuned for precise Vth boundaries you want but the principle stays the same. So rather build it from Lm393 than from off-shelf IC.

IMG_1631.jpeg
 
Last edited:

Tonyr1084

Joined Sep 24, 2015
9,744
The 2mA current source charges the C1 (1uF) during pulse high.
So for 500us the C1 is charged to 1V and for 2500us to 5V.
Charging a capacitor starts with high current and quickly takes a charge. As the charge builds, the current drops, and the rate of charge decreases. For example, 0.5mS charges a capacitor to 1V, (would like to know how you came up with that number) but 5 volts after 2.5mS is not accurate. Tau, a concept related to capacitor charge rate, determines when a capacitor is fully charged.

Capacitor charge rate is not linear but a curve. After 2.5mS, the capacitor won’t be at 5V, depending on the starting voltage and current resistance. And I'm sure I've missed a whole lot of pertinent information.
 

sghioto

Joined Dec 31, 2017
8,633
My suggestion and version using a LM393 comparator.
Initial voltage readings are taken at the junction of C1 and D1 when the RC controller is set at 2.5,1.5 and 0.5ms.
From these voltage readings R3 and R4 can be calculated.
The 2.5ms PWM generated voltage will turn the output from the LM393 High, turning ON Q1 and the LEDs.
At this time the output from the second half of the LM393 pin7 goes Low reducing the voltage at pin2.
This will keep the LEDs ON when the PWM signal changes to 1.5ms but drop out at 0.5ms.
1740698156847.png
 
Charging a capacitor starts with high current and quickly takes a charge. As the charge builds, the current drops, and the rate of charge decreases. For example, 0.5mS charges a capacitor to 1V, (would like to know how you came up with that number) but 5 volts after 2.5mS is not accurate. Tau, a concept related to capacitor charge rate, determines when a capacitor is fully charged.

Capacitor charge rate is not linear but a curve. After 2.5mS, the capacitor won’t be at 5V, depending on the starting voltage and current resistance. And I'm sure I've missed a whole lot of pertinent information.
The C1 is charged linearly performed by Q2 constant current source.
 
Top