This “Product How-To” article focuses how to use a certain product in an embedded system and is written by a company representative.
Light-emitting diodes (LEDs) have emerged in recent years as viablesources of light and are no longer used solely as status-lightindicators for electronic equipment. Advances in technology haveprovided LEDs that are typically three times more efficient thanincandescent bulbs. LEDs are also extremely durable and have lifetimesexceeding tens of thousands of hours.
Power LEDs for lighting applications are designed to be driven witha constant current source. It is common to see standard current drivelevels of 350mA and 700mA among different LED manufacturers.
The forward voltage across the LED can, however, vary depending onthe type and number of junctions connected in series. Manymanufacturers of power LEDs will provide multiple junctions, integratedinto a single module.
One simple method that can be used to drive an LED is to install aresistor, in series, to limit the current. A linear voltage regulatoror operational-amplifier (op-amp) circuit can also be connected in aconstant-current configuration. However, these linear methods will nothave enough efficiency at the required power levels.
A Switch-Mode Power Supply (SMPS) provides a much more efficientsolution for driving the LED. An SMPS can buck or boost the inputvoltage to the correct level, to provide the desired LED current. Thesystem input-voltage range and the required LED forward voltage willdetermine the SMPS topology that is selected.
|Figure1: Buck-boost converter topology|
The buck-boost converter topology is used when the supply voltage maybe above or below the required output voltage and is especially usefulfor battery applications. This topology is also known as a fly-back orinverting regulator. A buck-boost converter can be implemented as shownin Figure 1 above.
This implementation has the advantage that a simple, low-side MOSFETdriver circuit can be used. The topology shown in Figure 1 willgenerate a positive voltage, referenced to the input-voltage rail. Thedownside of this buck- boost implementation is that the load is notreferenced to the circuit ground.
A simplified circuit design for an LED driver is shown in Figure 2 below , using a mixedsignal, high voltage 8bit microcontroller, such as MicrochipTechnology's PIC16HV785. The output of the circuit is referenced to thebattery voltage, not to ground. The output of the inverter is connectedto the LED anode and produces a voltage that is greater than the inputvoltage.
|Figure2: Simplified LED-driver circuit using a PIC16HV785 microcontroller.|
The PIC16HV785 mixed signal microcontroller combines an 8bitmicrocontroller core with several on-chip analogue peripherals. Theseinclude a high speed, two-phase PWM circuit, ideal for current-modecontrol of switch-mode power supplies, and two on-chip op-amps that canbe used to amplify the voltage across the current-sensing resistors.
This allows the use of very small sensing resistors, which reducescircuit losses and increases overall efficiency. The on-chip highvoltage shunt regulator eliminates the need for an external 5Vregulator when operating from higher supply voltages.
The PIC16HV785 also integrates a digital Capture, Compare and PWM(CCP) module, two analogue comparators, a 10bit A/D converter, an 8MHzinternal clock circuit, internal precision voltage reference, and aprogrammable Brown-Out Reset (BOR) circuit. All of the pins of the opamps and comparators are externally accessible, so that any circuitconfiguration can be implemented.
The current-sensing op amp is connected as a differential amplifier,to obtain an accurate measurement of the voltage across the current-sense resistor. The current is measured in the return of the powersource, to simplify the requirements of the circuit. R1, R2 and C1 forma low-pass filter to reduce any switching noise that may be present.The cut-off frequency of this filter must be chosen above the converterswitching frequency, to avoid limiting the control loop response.
Analogue Style Module
The two-phase PWM module, an internal comparator and a voltagereference form the circuit that regulates the amount of LED current.The two-phase PWM is an analogue-style module that works on theset/reset principle.
First, a clock signal, derived from the system clock, is used toperiodically turn on the PWM output. The PWM clock signal sets thefundamental PWM frequency. Then, a reset signal from one of the on-chipcomparators turns off the PWM output, when a specified reference levelhas been reached.
The amplified current signal is internally routed to the positiveinput of Comparator 1 on the PIC16HV785. The Capture-Compare Peripheral(CCP1) on the PIC16HV785 is used in the PWM mode to generate thevoltage reference for the comparator. Using the PWM allows fine controlof the comparator reference voltage. The PWM signal is filtered with anRC filter to produce an analogue voltage and is connected to thenegative comparator input pin.
The software for this application is very simple, since the LEDcurrent-control function is accomplished in the analogue domain. Afterall peripherals have been enabled and a current-reference level hasbeen set, the LED will continue to illuminate without softwareintervention.
However, the application code can use the on-chip 10bit A/Dconverter to measure the supply voltage, which then drives the LED in aconstant-power mode. As the battery input voltage changes, a newvoltage-reference value is produced by the D/A circuit (implementedwith the CCP peripheral) to provide the required compensation.
Setting LED brightness
Since the microcontroller core is only spending a small portion of timein the power-regulation process, more time can be dedicated to the userinterface and to provide additional features, such as battery statusmonitoring and bright- ness level control. There are two ways that theLED light level can be adjusted using this circuit and software.
The first technique relies on the principle that the brightness ofthe LED will change with the drive current. In fact, an approximatelinear control of the LED brightness can be accomplished using thismethod. However, variable current dimming is not the most efficient wayto set the LED brightness level. The LED achieves its best efficiencyat the maximum drive-current level specified by the manufacturer.
A low-frequency PWM signal of between 60Hz and 1kHz can be used tomodulate the LED drive current. Instead of reducing the current drivelevel, the LED is always driven at maximum current during the on-time.The duty cycle of the PWM signal sets the average amount of time thatthe LED is energised.
The chosen PWM frequency should be sufficiently high so that the LEDcurrent is turned on and off at a rate that will not cause the humaneye to detect flickering. The PWM frequency must also be low enough sothat the current-regulation circuit has enough time to stabilise duringthe PWM on-time. If these conditions are met, the human eye willaverage the light output from the LED over time.
The PIC16HV785 contains all the required components to implement anefficient high power LED drive circuit. It can be easily configured forboost operation or buck-boost operation, depending on the input voltagerange.
The application uses only a small portion of the microcontroller'sRAM and Flash memory, leaving plenty of room for additional applicationcode. With enough unused peripherals on the PIC16HV785 microcontroller,a second LED driver, battery charger, or other switch-mode circuit canalso be implemented.
Steve Bowling is ApplicationSegments Manager and Lucio Di Jasio is product marketing manager forthe Advanced Microcontroller Architectures Division in the ApplicationSegments Group at MicrochipTechnology Inc.