loading

Universal High-Power LED Driver with 3D-printable Case

Featured
Picture of Universal High-Power LED Driver with 3D-printable Case
*** There's a firmware update. Please check out! ***

LEDs are taking over conventional lighting every day. High-power LEDs over 1W are becoming more and more affordable, and I wanted to start using them to replace the lighting fixtures around me. However I realize that finding and configuring the power supply was a bit of a pain, since I wanted to use different LEDs in different configurations depending on what the lighting was for. Power supply needs to regulate the current that goes though the LEDs. With higher current that high-power LEDs require, active constant current circuit is the only practical option. Commercially available buck regulators are easy to use, however, they are usually made for a specific current and voltage range. For me that means having to purchase variety of buck drivers.

Also, most of LED drivers lack dimming function, or have poorly functioning dimmers. I think dimming is essential for modern lighting, and I want smooth control of brightness.
So I decided to develop a universal, dimmerable high-power LED controller. It has taken me four months to develop this controller. Although it's still in development, I think it's quite useful to all DYI'ers with LED lighting projects.

I made this an Open Source project. Both hardware and software are open - please use, and extend this project and share the knowledge. A 3D printable enclosure as well as couple of LED mounting hardware is also available as Open Source, download-able at Thingverse. Together you can really kick start LED conversion of your household lighting!

 
Remove these adsRemove these ads by Signing Up

Step 1: Features

Picture of Features
Here's the list of main features:
  • Inductor "switch mode" controller for high energy efficiency.
  • Wide supply voltage range of 5 to 18V (can go higher, but not tested). Great with batteries as well as AC adapters.
  • Up to 20W maximum output power (can go higher with active cooling). (at supply voltage 12V or above)
  • Constant current (pulsed) - configurable up to 3A peak current.
  • Selectable between buck-boost and boost mode.
  • Analog style dimmer control (smooth, flicker-free continuous adjustment)
  • IR remote receiver - controllable via Sony IR remote control
  • Digitally controlled dimming - via external microcontroller including Arduino.
  • Master/slave gang dimming - connect multiple units together and control the dimming from any one of the units.
  • High frequency pulse drive - 32kHz to 175kHz - no flicker even in video!

Step 2: Technical Overview

This circuit is a relatively straightforward implementation of switch mode voltage converter. An inductor works to convert electric energy into magnetic energy, then it converts back to electric energy. By controlling the charge time you can control the output voltage.
My implementation is a bit different from typical boost or buck-boost circuit in that, instead of rectifying the output voltage, the output voltage drives LEDs directly (pulsed drive). This implementation provides a few advantages:
  • Reduced part count.
  • Higher overall energy efficiency (because rectifier has voltage loss)
  • Better dimming characteristic.

In practice, you can connect 1 to 20 LEDs to the controller. Depending on the supply voltage you can choose between buck-boost or boost mode.

Buck-boost mode can supply output voltage lower and higher than the input voltage. However, efficiency suffers at higher output voltage, so boost mode should be used when you need higher output voltage than input.

Boost mode can only supply output voltage higher than input. As LEDs need minimum voltage (usually about 2V per LED) to start lighting, boost mode is effective when supply voltage is below 2 x (number of LEDs).

More on configuration later...


Peeking into the Output

I think looking at the waveforms will give you the best understanding of how this circuit drives the LEDs. As you can see in the picture, the unit is hooked up to an oscilloscope. Using two inputs, output voltage and the inductor/LED current are shown simultaneously.
The squarish wave is the voltage, and triangular wave is the current.
Notice how at the low power/dimmed level, both the current and the duty rate are low. As you increase the power level, both the current and the duty rate increases. This scheme results in a very wide dimming range with minimum color shift.


Development Notes

Even though I was always fascinated by the way inductors work, designing my own switch mode converter seemed impossible. I somehow managed mostly by trial & error, burning numerous MOSFETs and inductors in the process. I wanted to share what I came up with, so that others can build on top of it, or simply benefit from it.
One important point - if you want to tweak the circuit, you NEED a good oscilloscope. Switching mode circuits like this operate at high frequency, only way to know what's going on is to "see" the waveform. I don't think I could have done this project without one. You don't need a fancy new oscilloscope. Just browse eBay for older models from late 70 - 80's (I paid about $240 for mine). Up till early 80's electronics were built to last. I'd trust equipment from this era more than the latest.

Step 3: Circuit

Picture of Circuit
The heart of this controller is a switch mode voltage converter. L1 converts voltage. Q1 is the switch that control current the goes through L1. The basic principle of switch mode converter is that it controls output voltage or current by controlling the "charge" time of the inductor. Inductor stores the electric energy (current)that comes in, and releases that energy when the incoming current stops. It tries to keep the same current that was flowing when the incoming (or charge) current stopped. So by controlling the charge timing, you can control the output current. (This is a very deep subject and it takes more than this instructable to explain. Please read Wiki for more information on this subject.)

Boost converter on Wiki: http://en.wikipedia.org/wiki/Boost_converter
Buck-boost converter on Wiki: http://en.wikipedia.org/wiki/Buck-boost_converter


As you can see that the diode and a capacitor at the output typical of the switch mode converter is omitted. This is because the load (LEDs) is essentially a diode, and LEDs can perform quite well with pulsed current. By removing the rectifier circuit, the overall power efficiency improves, as well as the dimming range.

This controller supports two different switch modes; buck-boost and boost. Buck-boost mode can output lower or higher voltage than the input supply, while boost mode can only output higher voltage than the input supply. You might ask, so why do we ever need boost mode? Because conversion efficiency improves when input and output voltage are closer. So if you always need higher output voltage than the input, it's best to use boost mode. The mode can be selected by connecting the LEDs to the different output terminals.

Q1 (MOSFET) switches the current flows through the inductor L1. The current then flows through R5, this is the "current sense" resistor which creates voltage that's proportional to the current. This voltage is watched by the microcontroller (via R4) to control the output power that goes into the LEDs. The basic principle is that the comparator inside the microcontroller compares the current sense voltage with the reference voltage. The Q1 is turned off when the current sense voltage is higher than the reference voltage. The microcontroller controls the L1 current by controlling the reference voltage.
(see the Firmware section for details)
For the current sense resistor, I used five 1 ohm resisters in parallel instead of using a single 0.2 ohm resister (five 1 ohm, 0.25W resistors = 0.2 ohm 1.25W resistor). This is usually more economical.

R3 and C5 form a "snubber" to reduce the harmful frequency (ringing) that appears when L1 current is turned off, and protect the MOSFET from it. (http://en.wikipedia.org/wiki/Snubber)

The output voltage is attenuated by R6 and R7 and sent to the microcontroller. This voltage triggers over-voltage shut down, when output voltage goes higher than the MOSFET can withstand (60V). (MOSFETs can easily be destroyed by high voltage.) This situation can happen when the LEDs are disconnected, over-driven, or misconfigured.

Main controller (PIC16F1823) takes the inputs from the driver circuit and control Q1 to achieve desired output. I choose PIC16F1823 as the controller for this project. The key points for choosing this PIC are that it has built in analog comparators, and it runs at 32MHz without needing a crystal.

There's a fuse in the power supply section. In addition to the usual over current (over load) and short circuit protection, this fuse provide reverse voltage protection. If you look at the circuit around MOSFET Q1, reverse voltage will go thorough Q1, as the diode inside the MOSFET is forward biased. The inductor L1 has a very little resistance, so this creates essentially a short circuit condition. Without a fuse, the power supply, MOSFET, or the inductor will be burned. Because of this, the fuse has to be of "fast blow" type.

BOM
5x 1 ohm (R5A-E)
1x 10 ohm (R1)
3x 220 ohm (R8,R9,R10)
4x 1k ohm (R3,R4,R7,R13)
4x 10k ohm (R2,R12,R14,R15)
1x 22k ohm (R6)
1x 47k ohm (R11)
(all resistors are 1/4W carbon film type)
1x 10k ohm Potentiometer (VR1)

1x 2.2nF (2200pF) ceramic capacitor (C5)
6x 0.1uF ceramic capacitor (C2,C3,C4,C6,C7,C9)
1x 10uF/10V electrolytic capacitor (C8)
2x 47-100uF/25V electrolytic capacitor (C1A,C1B)

1x 47-100uH power inductor (L1)

1x 1N4148 diode (D1)
1x LED (D2)

1x MC78L05A or equivalent (IC1)
1x NTD5867NL N-ch MOSFET (Q1)
1x PIC16F1823 microcontroller (PIC1)

1x GP1UX311QS IR receiver (optional) (IC2)

2x Tactile switch (optional) (SW1,SW2)
1x 2A - 3A fuse (fast-blow type recommended)

Step 4: Hardware

Picture of Hardware
TPP_5702.jpg
TPP_5710.jpg
TPP_5751.jpg
TPP_5753.jpg
PCB_03.gif
I plan to use a controller like this again and again in many projects, so naturally I designed a custom PCB.

I designed the circuit and the PCB to be as universal as possible, including all possible options. For one, you can use either DIP (through hole) or SOIC (SMT) versions of PIC microcontroller. MOSFET and inductor can be chosen from a variety of options as well. Potentiometer and tactile switches can be vertical or right angle types. Controls you don't need such as IR remote receiver, potentiometer and button switches can simply be omitted (though you should have at least one of them to use the controller).

You can design your own, or have them fabricated using the Gerber files provided ("Universal-driver-rev2-gb.zip"). I also have the PCBs and kits available for sale.

Construction
Assembling the controller is quite straightforward. All parts except the inductor are through hole type. The inductor that I chose for this controller is technically surface mount, but because of its size, soldering is very easy with regular soldering iron.

Programming the PIC Microcomputer
You need a PICKit 2 or 3, ICD2, ICD3 or other compatible PIC programmer to program the PIC.
Note: PICKit2 does not support PIC16F1823 (Correction - it does)

Step 5: Firmware

The main function of the firmware is to monitor the brightness control (via VR1, serial port, or IR remote) and control the output. At start, the brightness control via the potentiometer is read via A/D(analog-to-digital) converter and used as initial brightness/dimming level.

Main loop
The controller creates reference voltage V-REF (see "Reference Voltage Generator" circuit of the schematic), which connects to one of the built in comparator's positive input. Current sense voltage C-SENSE is compared against this voltage by the comparator. The microcontroller turns on the Q1 for a quick moment, then see if the inductor current was high enough to "trip" the comparator (which means that L1 current reached or exceeded the desired level). If the comparator did not trip, the "on-time" is increased and the cycle is repeated until the comparator trips. If the comparator trips, then the "on-time" is reduced a bit, then the loop continues. This forms a simple feedback-loop controller. Essentialy the output level is set by the reference voltage.

Reference voltage is created by outputting (software) PWM signal of duty cycle proportional to the desired voltage. The PWM output from the microcontroller is voltage clamped by a diode (to the same scale/level as the current sense voltage), then smoothed by R15 and C8 (RC filter). This reference voltage stays between 0 to 0.6V.

A/D converter is not suitable for reading the inductor current because of the (lack of) speed. Inductor gets short bursts of current, in microsecond intervals. Comparator can respond to a peak current like this, while A/D converter requires the input voltage to be stable while sampling.

The "on-time" signal is generated by the hardware PWM module. It is configured to generate PWM frequency between 32kHz to 175kHz (configurable). The frequency changes according to the dimming level. The lower the brightness the lower the frequency. By changing the frequency, the effective duty cycle of the output also changes. Combining the duty cycle change to the current change via the switch mode converter, much better dimming curve is achieved.

Output over voltage protection
When the output is open (i.e. nothing is connected, bad connection or dead LED) or too many LEDs are connected in serial, the output voltage can get too high for the MOSFET to handle. MOSFET used here can handle up to 60V between Drain and Source. Higher voltage can destroy the device (rather quick smoking death as I experienced a few times during development).
The output voltage is attenuated so that the voltage is safe for the microcontroller (below 5V), then fed to the comparator module. Internal reference voltage is set so that the comparator trips at about 59V (configurable in about 3V steps). The comparator is connected internally via hardware to "shutdown" PWM output when trips. So this output over voltage protection works instantaneously as it should. (Another reason I needed comparators built-in) When the protection kicks in (via hardware), the firmware detects it, and stops the operation, then blinks the status LED. Only power cycling can reset this condition.

Supply Voltage Sense
Supply voltage is read by A/D converter and the value is used to compensate for the output level, so that the output power is consistent over a range of supply voltages. Also, supply over voltage protection kicks in at xxV (configurable in firmware).

IR Receiver
IR remote signal is detected by the sensor and generates interrupts. The signal is decoded by the ISR (interrupt service routine).
You can control the brightness/dimming level, output on and off via the IR remote. When the brightness is changed via IR remote, the potentiometer is disabled until it moves again.
Only Sony remote protocol is supported at this time (of course you can always add other protocols).

Buttons
Button switches are polled about every 4 millisecond and debounced in firmware. Brightness up/down function is implemented for now. (but they can do anything you want)
When the brightness is changed via the buttons, the potentiometer is disabled until it is moved again.
You can also connect external buttons via SPI port for quick & easy remote control. (see the schematic)

Bi-directional Serial/SPI Control
SPI style serial can be used to control this controller. Only brightness/dimming change is supported now. The 8 bit brightness data is sent out via the same port when you move the potentiometer. So if you connect two or more of this controllers via SPI port, all of the controller can be controlled by just moving one of the potentiometers (gang dimming). This comes in handy when you have a bunch of controllers to light a large room.
SPI port and the button switches share the same I/O ports, so the firmware determines the source of the signal by the duration of the pulse. Since humans can only push buttons so fast, pulses that are longer than about 47 microseconds are considered button push, and shorter ones are decoded as SPI signal.
The data format is straightforward - just send the brightness level in 8 bit format. That's it for now - maybe expanded to do other things...

Open Source
You can download the source code as well as the HEX file to program the microcontroller. I'd love to see someone extending my code.

Step 6: LED Configuration/Hookup

Picture of LED Configuration/Hookup
The Universal LED Controller can drive high power LEDs up to 20W in total power. (Care needs to be taken when driving more than 10W of power. There will be noticeable amount of heat dissipated from the inductor and MOSFET. Make sure to give good ventilation/cooling so that those parts won't get too hot.)

Please refer to the chart for the configuration of LEDs, supply voltage, and mode selection.

LED configuration chart

Number of LEDs

Supply Voltage

Connection

Mode

Total LED Current (mA)

Parameter (ref_max_duty)

1W LED

3W LED

1W LED

3W LED

1

5

-

Buck-boost

350

700

32

66

2

5 - 10

All Serial

Buck-boost

350

700

32

66

3

5 - 6

All Serial

Boost

350

700

32

66

6 - 15

All Serial

Buck-boost

350

700

32

66

4

5 - 8

All Serial

Boost

350

700

32

66

8 - 18

All Serial

Buck-boost

350

700

32

66

5

6 - 10

All Serial

Boost

350

700

32

66

10 - 18

All Serial

Buck-boost

350

700

32

66

6

5 - 6

3 Serial x2

Boost

700

1400

66

138

6 - 9

3 Serial x2

Buck-boost

700

1400

66

138

9 - 12

All Serial

Boost

350

700

32

66

12 - 18

All Serial

Buck-boost

350

700

32

66

7

9 - 14

All Serial

Boost

350

700

32

66

14 - 18

All Serial

Buck-boost

350

700

32

66

8

5 - 8

4 Serial x2

Boost

700

1400

66

138

8 - 10

4 Serial x2

Buck-boost

700

1400

66

138

10 - 16

All Serial

Boost

350

700

32

66

16 - 18

All Serial

Buck-boost

350

700

32

66

9

12 - 18

All Serial

Boost

350

700

32

66

10

6 - 10

5 Serial x2

Boost

700

1400

66

138

10 - 12

5 Serial x2

Buck-boost

700

1400

66

138

12 - 18

All Serial

Boost

350

700

32

66


For example, if you have 3 LEDs and 12V power supply, you'd use bock-boost mode. In this mode the output voltage can be lower than the input, so the 3 LEDs requiring about 10V as a whole can be driven safely.

If you have 9 LEDs connected in series, and have 12V power supply, you'd use boost mode. This mode boosts the supply voltage, so the 9 LEDs requiring over 29V can be driven.

When you want to connect more than 10 LEDs, you need to combine serial & parallel connection. For example, if you have 12 LEDs, you should connect 6 LEDs in series, then  parallel connect two of the series connected LEDs (strings) with small registers to balance current. These "balancing" resisters are important, and should not be omitted, because each LED has a bit different forward drop voltage, and two strings of 6 LEDs will need slightly different voltage to get the current they need. Without the balancing resister, one of the string will take more current thus overdriven. This condition will lead to premature failure of the LEDs.
You can often "get away" without using balancing resistor. Hook up wires have a bit of resistance to help balance the current. However I still recommend using 5 to 10 ohm resistor in series with each string of LEDs. (The resistor value is a guess at this point, as I can't locate comprehensive formula of calculating the resistance.)

Firmware Parameter

*** There's a firmware update. You can now configure the output current via the two buttons. No need to re-program. ***

*** This step requires a computer and a PIC programmer. I'm in the process of adding "easy setup" to the firmware. Once that's done you won't need to re-program the PIC to change the output current. ***

Once you figure out the LED connections, look up the parameter. Open the source file and look for "ref_max_duty equ xxx". Should be around line 76. This parameter sets the reference voltage that's used to regulate the LED current. The peak output current is about ref_max_duty x11.7 mA. Since this is "peak" not average current, duty rate (ratio between LED on-time and off-time) needs to be taken account. (I'm working on the more comprehensive parameter look up table and/or automated setup. Stay tuned.)

Change this value to the value that you need, reassemble and program the microcontroller.

Your Universal Controller is now ready to drive LEDs.

Step 7: Remote Control

Picture of Remote Control
The best thing about using microcontroller is that you can add extra functions without costing nothing. I added IR remote control receiver to Universal LED Driver just by adding an inexpensive IR receiver chip, and a few lines of code in the firmware.
Sony TV protocol is supported by virtually all "universal/programmable" type remote controllers. In case you DO have a Sony TV, and want to control the LED without controlling your TV, alternate device ID can be chosen in the firmware. (Sony uses ID 0 for TV, 4 for VCR, etc.)

You can change the LED brightness using channel up/down button, and mute button to turn off the LEDs. You can assign different buttons to do different things by editing the source code of course.

Here's the Amazon link for the remote I use: http://amzn.com/B001KC08A4

These should also work: http://amzn.com/B000W8JFPGhttp://amzn.com/B00385XUF6

Step 8: Usage Examples with 3D Printed Parts

Custom Enclosure

I've designed 3D printable custom enclosure for this Universal LED Driver. Prints from my printer are not perfect, but good enough to be practical. You can download the enclosure data and print it if you have a 3D printer.


Magnifier Lamp conversion

Here I used 8 of 1W white LEDs to replace the 22W circular florescent tube in the lamp fixture. 8W total output seems as bright as the original florescent. LEDs are connected in series, and the power supply is 12V.
Dimmer is surprisingly handy.

I designed and 3D printed the clips to attach the LEDs to the lampshade. You can download the clips at Thingverse (http://www.thingiverse.com/thing:15263).


Under the Shelf lighting

Here I designed and 3D printed mini-lamp shades to hold 1W star LEDs. These make great economical under the shelf lighting. You can download the lamp shade at Thingverse (http://www.thingiverse.com/thing:15265).
* Due to the (lack of) heat dissipation, only 1W LEDs should be used with this lamp shade. *
1-40 of 58Next »
embuilt2 months ago

SPEA-1 from Embuilt can be used to check the full THD and harmonic spectrum of any LED driver

mrx23dot9 months ago

Hi,

I have a 1m RGB (3x3W at max) 5050 light strip, and a 12V PSU, the chinese controller had 3x(smd fet and small resistors) in it.
Do you have any practical ideas how to make the driver stage more compact for 3ch?

Do I need V-sense for each channel?
At the bare minimal I can't go under 3 comparators?

it is not recommended to drive light in the 30-40 Khz range, because we use that for IR communication.

Thanks,
Arpad

c14nz9 months ago

Very nice design ! I'm curious if you recommend this pwm led driver for a photo studio light ?

majere11 months ago

Any Chance you still have some one or two if the PCBs? The Shop link returns an 404

prandall11 year ago

Great looking project. It seems you created this a while ago, have there been any alterations? Is this still considered a efficient universal method of driving leds? I have been looking at this and your poormans buck and they are both awesome looking projects, I already have components on order to build the poormans buck. Here is my problem though, there are some Higher Power leds from LEDENGIN that I'd like to use (30W, 10W) that run on 42V and 14.4/15V respectively. In boost mode, will this driver be able to power those? Otherwise I am limited to 3W bulbs which don't seem to emit enough light to replace incandescents around the house. Also, if I don't have a 3D printer, is there a website that will make them, kind of like a OSH Park but for 3D prints?

I forgot to mention, I have a lot of 12V power lying around and anything else above that would be a pain, that's why I'm particularly interested in the boost mode.

I've been sitting here looking at the schematic, and I can't for the life of me figure out how it measures the current in buck/boost mode during the off time of the transistor. The sense resistor is effectively out of circuit.
I was thinking about using a DAC to generate the reference voltage on a laser diode driver I'm working on. The design is based on the PIC12F752. Have you ever tried doing it like that?
I haven't done it, but using the DAC would make the software a bit simpler. But the problem with the DAC contained in 8 bit PIC is that its low resolution. If I remember correctly the DAC only has 5 bit or so. Some PIC24 series have 8 bit DAC and that would be perfect.
Yeah, it is a 5-bit DAC. 31 dimming levels probably aren't enough for fading effects, etc, but it's more than enough for modes in a flashlight or laser pointer. It looks like the PIC16F1704 and 1705 have an 8-bit DAC. The 16F753 has a 9-bit DAC. Getting more bits than that would force us to use packages with more than 14 pins.
lacicor2 years ago
Hi Aki!
Can You help me:
If i use your original firmware the light not absolutely dimming off (the LED does not go to the end(OFF)). Wich parametrs i can change to set dimming to lowest(off-min) and increase brightnes level(set max)?
lacicor2 years ago
Dear Aki!
Thank You for answer.Error is the same. I want sent to You log file. How i can do it?
Thanks!
ledartist (author)  lacicor2 years ago
You can email me the log at aki@theledart.com.

lacicor2 years ago
Dear author!
I make some changes in driver firmware. But if i build your own original or the modified project i get the error message : Build Filed!
I use: MP LAB IDE 8.90
Thank You for answer!
ledartist (author)  lacicor2 years ago
There's an update to the firmware: http://www.instructables.com/id/Universal-High-Power-LED-Driver-Firmware-update/

Please try that version. (Microchip changed the header file a bit around ver 8.70 that created the error, but I fixed that one.)

Aki
mastamuk2 years ago
Wow! Great work and thanks for this instructable!
i wanna order some PCB´s, but first i want to know if i can strobe the PWM Signal without causing any problems.
Means i wanna build a dimmable LED Strobo.
I want a Frequency up to 1kHz with 0-100% brightness.
Thats why i can´t use normal PWM drivers...
Is it possible with your PCB?
I guess with some editing of your code and connecting another potentiometer it should be even possible without an external uC - right?
pr.albert2 years ago
Hi, can it work with led strip, like this for example:
http://www.ebay.com/itm/5M-5630-NON-Waterproof-Cool-White-SMD-Flexible-LED-Strip-Light-300-Leds-12V-/111000486427?pt=US_Car_Lighting&hash=item19d825021b
ledartist (author)  pr.albert2 years ago
Those LED strips are voltage driven (usually 12V or 24V), so you don't need a special driver. If you want to dim those, there are many PWM dimmers available.
lacicor2 years ago
Dear author!
Thank you for great led driver!
Can you provide any information about PCB size. If i use provided ("Universal-driver-rev2-gb.zip") PCB in result i I get such a size 102 mm x x25 mm by default. 102 mm x 25 mm is correct? Seems too small......
Thank You!
ledartist (author)  lacicor2 years ago
That's the correct dimension. It is compact.

Aki
Millchard2 years ago
Thank you for such a quick and teach-full reply.
You have helped me learn, and I appreciate your generosity.
Cheers Aki
Millchard2 years ago
Hi Aki
Awesome work ...I love this design.
Just one question (for a die-hard DIY'er), does the 10k ohm Potentiometer (VR1) need to be linear or logarithmic?
Many thanks friend.

ledartist (author)  Millchard2 years ago
Linear pot. The controller (firmware) does the logarithmic function, so the output brightness appears linear.

Thanks!
Thanks for the great instructable! I have the parts on order with hopes of building this great LED driver. But I do have a question...I'm a beginner hobbyist in electronics so please take that into consideration.

I see on the schematic that there's an ICSP header, and the pins match my Pickit3 so I'm good with that....but in the images of the PCB it looks like the ICSP header is used for connecting GND/+12V/BOOST-/LED+/BUCK-. Is this header also used to program the chip in circuit or is it programmed out of the circuit and put in?

I'm sure that the information is in the instructable somewhere, and I've read it through and through, but my novice eyes just aren't finding it. I just don't understand how the same header could be used for both functions.

Also if the header does indeed serve both functions, then does MCLR match up to GND or BUCK- when connecting the power supply & LED strings?

Thanks!
Charlie
ledartist (author)  charliemyers2 years ago
ICSP is by its own, right under the PIC (around the middle on the PCB). Nothing connects to that port under normal use. It's used only when you upload the firmware. The power in and LED connections are on the right side, and the remote control connector is on the left.

ICSP port on the PCB are just 5 holes. No headers are soldered. I just stick a 5 pin header into those holes and hold it to program the PIC, because it only takes less than 30 seconds to program. Hope this makes sense.

Yep, that makes sense! I also just noticed that on the schematic, "Buck-Boost", "Boost", and "LED+" are shown as individual pins. I assumed that the header pins on the right side of the PCB were ICSP when in fact they represent the individual power & LED pins on the schematic.

I understand it now. Like I said before, the info was there...I just wasn't seeing it.

Thanks again!

Charlie
Never mind! After some more looking at the PCB, it looks like an ICSP header wasn't populated, and I'm guessing that the header pins on the PCB for GND/+12V/BOOST-/LED+/BUCK- aren't technically shown on the schematic (unless I misunderstand something which is quite likely!).

Thanks!
Charlie
mircho2 years ago
Thanks for a great instructable and the inspiring ideas shared. I wanted to ask you why did you decide upon the reference voltage generation circuit instead on a voltage divider? It seems that the reference voltage is to be kept stable throughout the work of the driver and not dependent on other conditions. But I am no expert in PIC ASM and cannot be sure I've read the code and the writeup correctly.
ledartist (author)  mircho2 years ago
Reference voltage needs to be stable against the power supply voltage. Because the purpose of this driver to supply LEDs constant current, and the reference voltage is used to compare against the current sense output.
By controlling the output so that current sense voltage matches the reference voltage, this driver keeps the output current constant.

Using diode (more often zener diode) to create reference voltage is very common practice.

Aki
Thank you for your answer. I am not very good at electronics and I have no formal education in the field.
I intend to start experimenting recreating part of this with an AVR and this is why I am trying to understand some of the logic before starting to prototype.
I just noticed that you use 7805 to provide stable 5v to the microcontroller. This way you already have somewhat stable voltage in your system. Unless the leds draw so much power that the power supply dips drastically and the voltage from the regulator falls, but in that case the current over the leds cannot be increased anyways.

ledartist (author)  mircho2 years ago
Ok, in this particular circuit, I'm trying to create low voltage reference (0 - 0.6V) by clamping the voltage out of the PIC output. This output is a PWM signal, so the PIC can control the reference voltage from 0.6V down to almost 0V.
I wanted to allow 5V operation, and 7805 drops 1V or so - which is ok, but the reference needs to be steady. 

skmdmasud2 years ago
Great driver. Can you provide single side PCB for the circuit for the simple DIY people.
ledartist (author)  skmdmasud2 years ago
Sorry but it's not that easy to turn this PCB into single layer. I always try to make my PCBs to have least number of layers, but this one kind of needs to be two layer to work well.
My "Poorman's Buck" PCB is single layer design. You might want to try that one.

Aki
Hi,
i have seen your Poorman's Buck that one is also great. Thank for you great work. Keep it up.
lmoreira22 years ago
Hello congratulations by Brazilian and design is great to have some doubt that would be very grateful if you can answer me.
I do not think the first component NTD5867NL N-ch MOSFET on my parents would be possible to replace it would have some similar example of this component.
segunto and did not quite understand how it would link several modules together to control pwm from just one.
thank you in advance for the immense contribution in providing the project.
ledartist (author)  lmoreira22 years ago
If you can't find NTD5867NL, you can use many other N-channel MOSFET with following specs.

Drain-Source voltage: 60V or higher
Maximum Drain current: 5A or higher

Other specs are not that important. Form factor should be TO-251AA(I-Pak) or TO-220.

I know those should work;
  • IRLI520NPbF
  • IRLU120NPbF
  • HUF75637P3
Good luck!

sangyue3 years ago
Hi Aki,

Thank your very to share your projects. It really brings a lot of fun to my life. I made your universal High-Power LED Driver and it is working great. I bought a PICKIT3 from Microchip and tried to add some code for the IR remote control function. Now I could use '0-9' button to adjust the brightness to the pre-set value and turning on the light by cliking the 'Power' button.

I am a novice for the PIC micro-controller, I am not quite clear about how the A/D and comparator usage. I want to use 2 or 3 18650 lithium battery to provide the power. I want to add the low voltage shutdown function to prevent battery overdischage. Could help to give some code example about this function? Say I want to shutdown the light when the supply voltage is under 6V(2 18650) or 9V(3 18650).

I saw the 'shutdown_vol2 equ 24' in your code, but I did not figure out how to check the supply voltage and make action to turndown the light when the supply voltage is too high.
ledartist (author)  sangyue3 years ago
Look for a variable named "sp_voltage". This variable holds A/D value of the S-SENSE input. 0xFF (255) corresponds to supply voltage of about 28.5V, so you can scale it to the number you need.
Just check this variable at the end of the main loop (note that it takes some time for the first conversion to be done), and shut down accordingly.

Now the tricky part. A/D conversion uses PIC's supply voltage as a reference. So if it goes under 5V (happens when you give lower than about 6.5V to the circuit, because the 5V regulator needs some voltage) the A/D value changes. For us to know the exact voltage on S-SENSE, we need to have a known voltage supplied to the PIC.
PIC has an internal reference voltage you can use to determine the supply voltage (by calculation). You might want to check into that.
sangyue3 years ago
Hi Aki, Thank your very to share your projects. It really brings a lot of fun to my life. I made your universal High-Power LED Driver and it is working great. I bought a PICKIT3 from Microchip and tried to add some code for the IR remote control function. Now I could use '0-9' button to adjust the brightness to the pre-set value and turning on the light by cliking the 'Power' button.

I am a novice for the PIC micro-controller, I am not quite clear about how the A/D and comparator usage. I want to use 2 or 3 18650 lithium battery to provide the power. I want to add the low voltage shutdown function to prevent battery overdischage. Could help to give some code example about this function? Say I want to shutdown the light when the supply voltage is under 6V(2 18650) or 9V(3 18650).

I saw the 'shutdown_vol2 equ 24' in your code, but I did not figure out how to check the supply voltage and make action to turndown the light when the supply voltage is too high.
Very nice!
1-40 of 58Next »