Driving LEDs with a PIC Microcontroller Application Note

Similar documents
Color Stabilization of RGB LEDs in an LED Backlighting Example Application Note

LED Driving Technology for Long Term Flexibility Application Note

Driving the Advanced Power TOPLED Application Note

Comparison of LED Circuits Application Note

Reliability of the DRAGON Product Family Application Note

Reliability of the OSLON Product Family Application Note

Measuring of the Temperature Profile during the Reflow Solder Process Application Note

Color Stabilization of RGB LEDs in an LED Backlighting Example Application Note

Comparison of LED Circuits Application Note

Atmel ATA6629/ Atmel ATA6631 Development Board V2.2. Application Note. Atmel ATA6629/ATA6631 Development Board V

Handling and Processing Details for Ceramic LEDs Application Note

AN2141 Application note

APPLICATION NOTE. Atmel AVR127: Understanding ADC Parameters. Atmel 8-bit Microcontroller. Features. Introduction

OM29110 NFC's SBC Interface Boards User Manual. Rev May

R_ Driving LPC1500 with EPSON Crystals. Rev October Document information. Keywords Abstract

AN2129 APPLICATION NOTE

4 Maintaining Accuracy of External Diode Connections

TED-Kit 2, Release Notes

AN12232 QN908x ADC Application Note

APPLICATION NOTE. ATA6629/ATA6631 Development Board V2.2 ATA6629/ATA6631. Introduction

Using a Pulse Width Modulated Output with Semiconductor Pressure Sensors

AN3134 Application note

Application Note. Brushless DC Motor Control AN-1114

AVR122: Calibration of the AVR's internal temperature reference. 8-bit Microcontrollers. Application Note. Features.

PN7120 NFC Controller SBC Kit User Manual

Driving the Golden DRAGON LED Application Note

Atmel U6032B. Automotive Toggle Switch IC DATASHEET. Features. Description

FLEXRAY SK-91F467-FLEXRAY USING SPI ON SK-91F467- FLEXRAY 32-BIT MICROCONTROLLER APPLICATION NOTE. Fujitsu Microelectronics Europe Application Note

APPLICATION NOTE. AT11009: Migration from ATxmega64D3/128D3/192D3/256D3 Revision E to Revision I. Introduction. Features.

AN TEA1892 GreenChip synchronous rectifier controller. Document information

AN Energy Harvesting with the NTAG I²C and NTAG I²C plus. Application note COMPANY PUBLIC. Rev February Document information

Part numbers Order codes Packages Temperature range. LM137 LM137K TO-3-55 C to 150 C LM337 LM337K TO-3 0 C to 125 C LM337 LM337SP TO C to 125 C

AN2979 Application note

PTN5100 PCB layout guidelines

Application Note. Low Power DC/DC Converter AN-CM-232

AN NFC, PN533, demo board. Application note COMPANY PUBLIC. Rev July Document information

Supply Voltage Supervisor TL77xx Series. Author: Eilhard Haseloff

DC-Coupled, Fully-Differential Amplifier Reference Design

AN Maximum RF Input Power BGU6101. Document information. Keywords Abstract

High Power Emitters for Illumination Applications Application Note

EVAL-RHF310V1. EVAL-RHF310V1 evaluation board. Features. Description

Application Note. Smart LED Dimmer Controlled via Bluetooth AN-CM-225

AN1756 Application note

AN Low Noise Fast Turn ON-OFF GHz WiFi LNA with BFU730F. Document information

AN4439 Application note

UM Description of the TDA8029 I2C Demo Board. Document information

AN2679 Application note

AN4379 Application note

Opto-mechanical Orientation Sensor SFH 7710 Application Note

OSRAM OSTAR SMT General Information Application Note

AP1506. Description. Pin Assignments. Features. Applications. 150kHz, 3A PWM BUCK DC/DC CONVERTER AP SD 4 FB 3 GND 2 Output

ZKit-51-RD2, 8051 Development Kit

Proximity Sensor SFH 7741 Application note

E Typical Application and Component Selection AN 0179 Jan 25, 2017

STEVAL-ISA005V1. 1.8W buck topology power supply evaluation board with VIPer12AS. Features. Description. ST Components

AN1441 Application note

Application Note. Servo Overload Protection AN-CM-247

AN Replacing HMC625 by NXP BGA7204. Document information

AN4112 Application note

F²MC-8L/8FX/16LX/FR FAMILY

Obsolete Product(s) - Obsolete Product(s)

AN11994 QN908x BLE Antenna Design Guide

8-bit Microcontroller with 2K Bytes In-System Programmable Flash. ATtiny261A. Appendix A. Appendix A ATtiny261A Specification at 105 C

4. Absolute Maximum Ratings (Note) (Unless otherwise specified, T a = 25 ) Symbol V RRM I F(DC) I FP. I 2 t. T j T stg TOR

AN3332 Application note

UIO Digital I/Os & DAQ Board User Manual

DATASHEET 4D SYSTEMS. Arduino Display Module Pack TURNING TECHNOLOGY INTO ART. Featuring a 2.4 Display Module ulcd-24-ptu-ar

AN Programming the PCA200x family of watch ICs. Document information

PI3C3305/PI3C3306. Features. Description. Applications. PI3C3306 Block Diagram. PI3C3305 Block Diagram. PI3C Pin Configuration

ZXCT1030EV2 Evaluation Board User Guide

UM DALI getting started guide. Document information

AN2581 Application note

UM DALI getting started guide. Document information

SSM3K357R SSM3K357R. 1. Applications. 2. Features. 3. Packaging and Pin Assignment Rev.2.0. Silicon N-Channel MOS.

AN NTAG21xF, Field detection and sleep mode feature. Rev July Application note COMPANY PUBLIC. Document information

High-Voltage, Non-Isolated Buck-Boost Converter for ISDN Digital Phones

AVR1606: XMEGA Internal RC Oscillator Calibration. 8-bit Microcontrollers. Application Note. Features. 1 Introduction

ST619LBDR. DC-DC converter regulated 5 V charge pump. Features. Description

PN7120 NFC Controller SBC Kit User Manual

Improving feedback current accuracy when using H-Bridges for closed loop motor control

BGU8007/BGU7005 Matching Options for Improved LTE Jammer Immunity

Features. Micrel Inc Fortune Drive San Jose, CA USA tel +1 (408) fax + 1 (408)

TN LPC1800, LPC4300, MxMEMMAP, memory map. Document information

SSM6J507NU SSM6J507NU. 1. Applications. 2. Features. 3. Packaging and Pin Assignment Rev Toshiba Corporation

AN12165 QN908x RF Evaluation Test Guide

AN MIFARE Plus Card Coil Design. Application note COMPANY PUBLIC. Rev April Document information

AN UBA2015/UBA2017 saturating inductor support during ignition. Document information

AN NHS3xxx Temperature sensor calibration. Document information

Advanced Regulating Pulse Width Modulators

TPW1R005PL TPW1R005PL. 1. Applications. 2. Features. 3. Packaging and Internal Circuit Rev Toshiba Corporation

AN PR533 USB stick - Evaluation board. Application note COMPANY PUBLIC. Rev May Document information

(Note 1), (Note 2) (Note 1) (Note 1) (Silicon limit) (T c = 25 ) (t = 1 ms) (t = 10 s) (t = 10 s) (Note 3) (Note 4) (Note 5)

Applications. Tape and Reel Device Qualification Packaging AL5802LP4 Commercial X2-DFN ,000/Tape & Reel -7

EDE1204 Bi-Polar Stepper Motor IC

Comparing the Benefits of Using an Integrated Power Module versus a Discrete Regulator

TOSHIBA Transistor Silicon NPN Epitaxial Type (PCT process) 2SC2240

In data sheets and application notes which still contain NXP or Philips Semiconductors references, use the references to Nexperia, as shown below.

ZXCT1050 Precision wide input range current monitor

TDCG1050M, TDCG1060M, TDCR1050M, TDCR1060M Clock Display

BD241A BD241C. NPN power transistors. Features. Applications. Description. NPN transistors. Audio, general purpose switching and amplifier transistors

Transcription:

Driving LEDs with a PIC Microcontroller Application Note Introduction Nowadays, applications increasingly make use of LEDs as a replacement for traditional light bulbs. For example, LEDs are frequently used in the design of automobile tail lights, signal lights, traffic signals, and variable message signs. LEDs provide several advantages over traditional light bulbs, such as smaller size and longer life. In many applications, the LEDs must be driven with intelligent control circuitry. According to the task at hand, this control circuitry must be able to fulfill various functions and tasks. In the following pages, solutions are provided for various application areas. These solutions are principal suggestions, not a concept ready for series production. One possible task for control circuitry is regulation of intensity, in case the LED brightness must be set to various levels. A solution is described in the section "Dimming". In addition, the specified brightness should be maintained at a constant level. Fluctuations in the supply voltage, for example, could lead to significant variations in current. In this case, one must insure that the current through the LEDs and thus the brightness is maintained at a constant level. This problem is covered in more detail in the section "Current Regulation". Another task for control circuitry is failure recognition. Modules consist of individual LEDs which can be tested for total failure. Additional information can be found in the section "Failure Recognition". A particular characteristic of LEDs is their strong temperature dependency. Since LED brightness is strongly dependent on temperature, the driver circuitry can carry out temperature compensation. Two possible approaches are described in the section "Temperature Compensation". Furthermore, it may be necessary to adapt the driver for LEDs in different brightness groups by means of hardware selection. This is described in the section "Adjusting for Different Brightness Groups". In the following applications, a PIC microcontroller is used as a controlling unit. The PIC Microcontroller PIC stands for "Programmable Interrupt Controller". The controller described below has been developed by the company Microchip (www.microchip.com). The PIC comes in various sizes and functionality. For development purposes, rewritable devices are available, which can be erased electrically or by UV light. For production, OTP (One Time Programmable) devices are available, which may only be programmed once, but are correspondingly less expensive. PICs may also be obtained in SMD packaging. Although there are some disadvantages (less memory, limited instruction set, limited debugging facilities), the PIC has several advantages over other microcontrollers. It is inexpensive and all of the required hardware is available on one chip. It can be driven at clock rates of up to MHz and has exceptionally low power requirements. In addition, the PIC operates within a wide temperature range. Figure shows the block diagram of a typical PIC microcontroller: December, Page of Application Note Number: AN44

Figure : Block diagram of a PIC microcontroller For the following tasks, several integrated modules of the PIC are used: Software Some of the pins of the microcontroller can be configured as analog inputs. The analog voltages can be converted to digital values by means of an A/D module. The signal to be converted is chosen by software, and forwarded to the A/D module. This module requires a constant reference voltage. The voltage can either be applied externally at an input pin, or internally via a so-called voltage reference module. In the latter case, the supply voltage to the PIC must be kept constant by means of a voltage regulator. Programming the PIC Hardware Extensive hardware is not required to program the controller, and is available from several manufacturers. Simple programming devices can also be built from scratch (examples at: www.ic-prog.com). December, Page of Software for creating Assembler programs which are downloaded and executed in the controller is available at no charge. The use of a C compiler for the PIC is recommended, however. This allows the program to be easily managed and permits changes to be readily made. These C compilers only offer a subset of the language, however. LED Layout When using driver circuitry, the layout of the LED array must be taken into account. In principle, there are three possibilities: a matrix connection with a resistor for the entire circuit, a series connection or a matrix connection with a resistor for each LED. Additional information can be found in the application note "Comparison of different LED circuits". The following applications use a matrix connection with a resistor for each LED (Fig. ). Application Note Number: AN44

VCC D D D D4 5.mA 5.mA 5.mA 5.mA R R R R4 D5 D6 D7 D8 5.mA 5.mA 5.mA 5.mA R5 R6 R7 R8 D9 D D D 5.mA 5.mA 5.mA 5.mA R9 R R R Figure : LED array in a matrix connection with one resistor per LED Each LED possesses its own series resistor. These resistors can be used as reference resistors for adjusting the current in the diode. If one LED fails, the remaining LEDs continue to function; this is not the case in the series connection, for example. A failure leads to more current in the parallelconnected diodes, however, since the total current would then be distributed among the remaining three paths. An uneven distribution of brightness would arise, although the loss in brightness would primarily be compensated by an increase in current flowing through the remaining LEDs in the same path. Solutions The following sections describe the possible functions of the driver circuitry: Dimming The first function is the creation of different brightness levels by dimming the LEDs. A simple solution is to use PWM (pulse width modulation). This signal can be easily set and controlled using the built-in PWM module within the microcontroller. This is simply a matter of periodically switching a DC voltage on and off. December, Page of Application Note Number: AN44

Figure : Representation of a PWM signal If the period remains constant, the brightness can be regulated by the width of the duty cycle. An advantage of using a PWM signal is that the peak current level remains constant, thus preventing negative effects (such as wavelength shift in InGaN devices) from arising. Current Regulation The brightness of the LED should be held constant by the driver circuitry. In order to guarantee that the brightness remains constant, the current through the LED must remain constant. This requires that the current be determined for the individual LEDs. To measure the current passing through the diodes, the series resistor for each diode is utilized. By measuring the voltage across the resistor, the current through the resistor, and thus the current through the diode can be determined. The voltage measurement is carried out by the A/D module of the PIC, in which voltages up to 5V can be compared to a constant reference voltage. The A/D module should not be directly connected across the series resistor, however. For one thing, the voltage levels may be considerably higher than 5V. In addition, the PWM signal must first be converted to a DC signal. After measurements and the subsequent subtraction, a doubled measurement error arises. These problems are eliminated with the following circuit shown in Figure 4. The positive Input voltage is connected to U, the negative to U. The RC components convert the signal to a DC signal. These DC-signals are connected to the operational amplifiers. With various resistors, these two amplifiers are configured as a subtractor. With this circuit, the DC-Voltage of U is subtracted from U. This difference is now measured by the A/D module. This allows the controller to react to fluctuations in current. Since the operational amplifiers have very high input impedance, the system is not influenced by the measurement circuitry. R R4 U U R R5 R6 C - 4 V V- VCC R - 4 V V- VCC Output C Figure 4: Current measurement circuitry December, Page 4 of Application Note Number: AN44

Temperature Measurement Even when the current remains constant, the brightness can vary, however, due to the influence of temperature. The following figure shows this dependency for a Power TOPLED (LA E67B): The first option is to place a temperaturedependent resistor in series with a temperature-independent resistor. By measuring the voltage with the A/D module, the temperature can be determined, and the controller can respond accordingly. The disadvantage of this method is that the response curve of the resistor must be saved as a table of values in the PIC memory. via a watchdog timer With this method, a drawback of the so called watchdog module of the PIC can be used. This module consists of an 8-bit timer which is regulated by an internal RC oscillator. Normally, this timer runs in the background, and is reset by the microcontroller on a regular basis. This allows the controller to return to a defined state if the controller gets stuck due to an error, or in an infinite loop. The RC oscillator used is temperature dependent, however. If one uses an external temperature-compensated clock generator, the temperature can be determined by comparing the two clock generators. Additional information can be obtained from the manufacturer: http://www.microchip.com/download/appnote /pic6/7c.pdf. Figure 5: Brightness vs. temperature In order to maintain a constant brightness over an extreme temperature range, temperature compensation must be employed. The measurement of ambient temperature should be as inexpensive as possible, though. For diodes, this compensation does not require a high degree of accuracy. A tolerance of 5 C is sufficient. The following presents possibilities for temperature measurement: via temperature-dependent resistor This method does not require external components, but the temperature dependency of the watchdog timer is not guaranteed by the manufacturer. Failure Recognition Of course, brightness regulation is of no use when an LED no longer functions. The following describes a method for testing individual LEDs within an array for total failure. For failure recognition, the previously used circuit for measuring current is employed. The total failure of an LED leads to a break in the path, and therefore also causes no current to flow through the series resistor. Naturally, one cannot add current measuring circuitry at every diode, due to the high component cost and real estate involved. The solution here is to use a multiplexer. This allows each diode to be selected and connected to the measurement circuitry. December, Page 5 of Application Note Number: AN44

VCC D Multiplexer R D R U Test Circuit D U R Figure 6: Failure recognition circuitry Controller The Figure 6 illustrates the technique for a circuit containing three diodes: The multiplexer can be digitally controlled by the microcontroller. Each LED is assigned an address which allows it to be selected by the PIC, in order to determine the current passing through the diode for current regulation or to assist in failure recognition. all numbers. For example, with input pins, ^=8 brightness groups can be differentiated. Then, according to the configuration of the input pins (high or low), the number can be specified at the controller input, the corresponding brightness group is selected and the brightness can be adjusted. In the following example, eight different brightness groups can be used. VCC Adjusting for Different Brightness Groups R R R An additional option for the driver circuitry consists of an adjustment for different brightness groups. With LEDs, it must be noted that diodes of the same type are divided into various brightness groups. The usage of different brightness groups leads to a different brightness of the LEDs at the same current. With the PWM-Signal the brightness can be adjusted. The programmable input/output pins provide the means for adjustment without requiring the controller to be reprogrammed. The individual brightness groups are designated by a number. Enough input pins must be available to be able to differentiate between December, Page 6 of RX RX RX Input Input Input Microcontroller Figure 7: Layout for adjustment of brightness groups Depending on the value of the resistors RX to RX, a high signal (>4V) or low signal (<V) is applied to the inputs, and the corresponding brightness group is selected. Application Note Number: AN44

Circuit Diagram In the following figure, the principle construction of the driver circuitry with the previously described applications is described. The LED array consists of nine diodes connected together. Note: The PWM signal created by the controller is amplified by a transistor prior to being applied to the array. The amplitude of 5V is too low to drive the array directly. If the array size is increased, additional paths must be connected to the multiplexer and additional transistors may possibly be required for amplification. VCC Multiplexer D D D Test- Circuit Current - Test- Circuit Temperature - 4 Out Out Controll 5 Controll 4 5 6 7 8 9 R D4 R4 R D5 R5 R D6 R6 PIC-Microcontroller D7 D8 D9 X A/D (Temperature) A/D (Current) CLKIN Controll Controll 5 6 R7 R8 R9 externer Taktgenerator 4 CLK PWM 7 R 6 In In In In4 In5 In6 In7 In8 In9 In In In Input Input Input J 8 9 LED-Type Figure 8: Possible driver circuitry December, Page 7 of Application Note Number: AN44

Further Configuration Options The solutions described for this relatively complex application can also be implemented individually. For example, extensive circuitry can be eliminated if it is not necessary to test every LED for failure. Figure 9 shows a simpler configuration without failure recognition and temperature compensation for LEDs connected in series. The current through each path can be determined. A further possibility is a matrix connection with one series resistor for the entire array (Fig ). The transistors can also be eliminated when an amplitude of 5V is sufficient. Many PICs have up to three independent PWM modules. The total current through the resistor can be determined without complicated circuitry. Multiplexer VCC Test- Circuit Current - - 5 6 Out Out Controll Controll In In In In4 4 R D R D R D D4 D5 D6 X A/D (Current) CLKIN Controll Controll 4 5 D7 D8 externer Taktgenerator CLK Input Input Input PWM 6 J 7 8 9 7 8 PIC-Microcontroller D9 R LED-Type Figure 9: Circuit example with serial connection December, Page 8 of Application Note Number: AN44

PIC-Microcontroller D D D PWM A/D (Current) D4 D5 D6 D7 D8 D9 R Figure : Circuit example with matrix connection Conclusion The applications shown here are not restricted to a particular type of LED. The appropriate resistor values must be selected and the temperature characteristics must be entered into a lookup table in memory. Additional options are available when using a controller. Many controllers provide serial communications capabilities (USART, SPI, USB, CAN, etc.), which permit connections to other devices. The applications described here allow driver circuitry to be created which can be individually tailored to address the tasks at hand. Authors: Wolfgang Aberle, Markus Hofmann December, Page 9 of Application Note Number: AN44

AB OSRAM OPTO SEMICONDUCTORS OSRAM, Munich, Germany is one of the two leading light manufacturers in the world. Its subsidiary, OSRAM Opto Semiconductors GmbH in Regensburg (Germany), offers its customers solutions based on semiconductor technology for lighting, sensor and visualization applications. Osram Opto Semiconductors has production sites in Regensburg (Germany), Penang (Malaysia) and Wuxi (China). Its headquarters for North America is in Sunnyvale (USA), and for Asia in Hong Kong. Osram Opto Semiconductors also has sales offices throughout the world. For more information go to www.osram-os.com. DISCLAIMER PLEASE CAREFULLY READ THE BELOW TERMS AND CONDITIONS BEFORE USING THE INFORMATION SHOWN HEREIN. IF YOU DO NOT AGREE WITH ANY OF THESE TERMS AND CONDITIONS, DO NOT USE THE INFORMATION. The information shown in this document is provided by OSRAM Opto Semiconductors GmbH on an as is basis and without OSRAM Opto Semiconductors GmbH assuming, express or implied, any warranty or liability whatsoever, including, but not limited to the warranties of correctness, completeness, merchantability, fitness for a particular purpose, title or non-infringement of rights. In no event shall OSRAM Opto Semiconductors GmbH be liable - regardless of the legal theory - for any direct, indirect, special, incidental, exemplary, consequential, or punitive damages related to the use of the information. This limitation shall apply even if OSRAM Opto Semiconductors GmbH has been advised of possible damages. As some jurisdictions do not allow the exclusion of certain warranties or limitations of liability, the above limitations or exclusions might not apply. The liability of OSRAM Opto Semiconductors GmbH would in such case be limited to the greatest extent permitted by law. OSRAM Opto Semiconductors GmbH may change the information shown herein at anytime without notice to users and is not obligated to provide any maintenance (including updates or notifications upon changes) or support related to the information. Any rights not expressly granted herein are reserved. Except for the right to use the information shown herein, no other rights are granted nor shall any obligation be implied requiring the grant of further rights. Any and all rights or licenses for or regarding patents or patent applications are expressly excluded. December, Page of Application Note Number: AN44