Tag Archives: pwm

PWM Based LED Driver

** Updated code for better performance and stability [26 Feb 2015, rev.3]

It has been quite some time since my last post – as often happens, life intervenes and this time just a bit too much hospital time both for myself and one of my kids. Things are good now and normal can resume…

Black-Decker-FSL18FL-Firestorm-18-volt-FlashlightFor years I have had this Black&Decker FireStorm FSL18 flashlight, but hardly ever used it due to its anemic light quality. The fixture is powered with an 18v battery pack and uses a KPR18v0.3A bulb putting out 7 candlepower when running at 18 volts. 1 candlepower = 1 lumen. Compared with the brightness of the 12v power LEDs I have been working with lately, the brightness from this incandescent bulb is not much better than a glassed candle.

The trigger for upgrading this flashlight came one day when the wife complained an LED lightbulb had failed in her workshop. I replaced the bulb, but rather than throw it away, I took it down to my workshop to disassemble and identify what had broken. Continue reading

Never Trust a Schematic Blindly

Last week I posted a long winded video on using an oscilloscope to evaluate the performance of two different transistors. The 2n2222 transistor was behaving oddly at the top end, and the MPS A42 transistor had a rather significant turn-on delay.

After discussing my findings with someone who knows much more about these things than I, I was advised to take another look at the circuit. The A42’s performance did not seem correct. (Turns out before being used as a video driver transistor, it’s 300V capability was used to switch tubes). Below is the circuit I used as a template in my testing. I used an FET I had on hand and initially replaced the 2n3903 with a 2n2222 and later with an MPS A42.

Simple PWM FET driver circuit

On a hunch I decided to replace R1 with a 10k trimmer. Bringing R1 down to about 300 ohms fixed the delay issues for the A42 and for both of the transistors and significantly squared up the corners for both.

Moral of the story… don’t blindly trust someone else’s schematic to work for you. Test. Measure. Evaluate. Fix and re-test. For my needs, replacing Q2 with a 2n2222 and R1 with a 330 Ohm resistor generates the perfect PWM driver. YMMV.

Nice Square Waves

Using an Oscilloscope to Select a Transistor for a PWM Project

Recently saw some discussion online (I think hackaday.com) regarding the merits of an oscilloscope in the modern hacker’s lab.
As I was working on an DC motor control driver using Pulse Width Modulation (PWM), I was getting odd behavior from the circuit when approaching full power output. In the attached video, I discuss the role an oscilloscope played in helping select an appropriate transistor for the PWM circuit. Specifically, I show how two different transistors behave in the same circuit.