PIC10 Constant current LED driver

To ensure LEDs have a long life span, the brightness and power dissipation can be controlled by a constant current source. Dedicated ICs are available for this task though having already designed a buck converter with the PIC10, I thought I’d have a go at extending this to controlling the current through an LED. The implementation of this was really easy and merely consisted of changing the original hardware wiring, along with the addition of a current sense resistor.

schem
Schematic for a constant current LED buck converter

I’m using a 3W lumiled LED though only running it at ~0.3W (100mA reference forward current). The feedback for the buck converter comes from the voltage across the 1 ohm current sense resistor. Due to the low resolution of the ADC, the reference voltage will be converted to a small ADC value. For a current of 100mA through a 1 ohm resistor, the voltage developed across the resistor should be 100mV. With a 5V ADC voltage reference, this equates to a digital converted value of 5.1 (0.1*255/5). Obviously, this is a really small value and will have to be truncated to 5. This truncation ends up as an actual reference volatge of ~98mV, which translates (excluding tolerances) to 98mA, close enough to my 100mA original choice!

P1010934
The real implementation, pretty close to the 98mA reference!

By merely changing where the voltage is measured and including a couple more components, a simple buck converter can be changed into a constant current regulated LED driver!

LEDIWithPWM
The LED current (voltage across current sense resistor) and PWM waveform to the MOSFET

The code isn’t much different to the previous post so I’ll leave it up to you to make the adjutments.

 

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s