Introduction: Universal High-Power LED Driver - Firmware Update

Here's the updated firmware for my Universal High-Power LED Driver.

This version has on-board current set up function, so you can change the drive current without re-programming the PIC microcontroller.

You can either download the ZIP file containing the while project, or just the HEX file.

After upgrading your firmware, you can change the drive current of the LEDs connected to the driver by using the buttons on board.
Here are the steps:
  1. Connect the LEDs and power up the unit.
  2. Turn the dimmer knob all the way to the left/counter-clockwise. LEDs will be dim.
  3. Push both buttons and hold for a second, until the status LED starts blinking.
  4. The number of blinks shows the current level: 1=350mA, 2=700mA, 3=1,000mA, 4=1,400mA (apox.).
  5. Push right button to up the current, left button to lower the current. (You can move the dimmer knob to see how the LEDs light up during this process.)
  6. Push both buttons again for a second to get out of the config mode. Status LED will stop blinking.
  7. The setting is now stored in the non-volatile memory (EEPROM).
You can change the current setting as many times as you want.

Hope you like it!


OskarS2 (author)2015-01-18

For those of you out there who like me chose not to include a potentionmeter on there, I'd recommend the following code changes to spare a few headaches:

Comment out rows 1039 and 1040 to stop brightness being changed due to a floating pin or similar.

Comment out rows 1141-1144 (the two_button_push basic block) to be able to enter configuration mode. The light is still turned off when entering configuration, so it doesn't really matter, but you need to be able to enter configuration mode even if you want to run on 350mA, since it will default to the minimum duty cycle (2/256) on the SPWM otherwise.

I got stuck for quite some time on 10-20mA output until I figured out what was wrong. It was really confusing since the difference in PWM frequency still allowed me to do some dimming, even if the SPWM was kept constant. Also, at this point the reference voltage was so low that the RF noise from the inductor was bigger than the ref voltage itself.

Another thing worth to mention is that the current you regulate in the software is the average current through the inductor, not the LEDs. So for example, when I go for the 700mA current setting, in reality I measure an average current of ~400mA across the LEDs. This is worth having in mind.

Anyway, thanks a bunch for this project! Even though it's a bit overkill for what I want to do (at least the IR and potentiometer stuff) I learned a lot while playing around with it! :)

ledartist (author)OskarS22015-01-18

Thanks for the detailed comments! Like you said this is an over engineered solution for a simple need, but I learned a lot from doing this, and glad you did too.

It's correct that the unit can only sense the current going through the inductor, so the LED current is an estimate. Can be done better if you read the supply voltage and calculate the total power. I got lazy in doing that (assembly is not fun for math).

OskarS2 (author)ledartist2015-01-19

Yeah, it's not much of an issue for me at least, since the supply voltage will be very stable. I can just tweak details in the code to fit my needs anyway :)

Seriously though, it's a very neat and beautiful design and the documentation is awesome.

About This Instructable




Bio: I am an electronic artist living in Brooklyn, NY. I work with LEDs and microcontrollers to create beautiful objects.
More by ledartist:T962A SMD Reflow Oven Fix/HackColor Organ Triple Deluxe IIAurora 48 - 48 RGB LED Sequencer
Add instructable to: