white light from rgb led using pic 18f4550
TRANSCRIPT
Abstract
LED lighting is an emerging lighting technique which is predicted to completely replace the
present lighting techniques. There are several approaches to white light generation. One
approach is to use a blue or UV LED to excite one or more phosphors to give white light.
This method is not efficient. This project attempts to make white light from the basic colours
Red, Green and Blue. The method followed is high frequency switching of these three
colours to give a mixing effect. Conventional RGB LEDs available in the market is used for
the same. The high frequency switching pulses for Red, Green and Blue LEDs are generated
using PIC18F4550. This is used to drive an optocoupler that works as a relay to switch the
corresponding colours giving a mixing effect.
1
Chapter 1
Introduction
White light is composed of all spectral contents in the visible region. The rapid development
of light-emitting diodes (LEDs) over the last few years has opened up new opportunities in
the general illumination market. The efficacy of white light from LEDs is now over 20 lm/W,
which already exceeds that of incandescent lamps. It is forecast that LED efficacy will reach
50 lm/W in near future, which approaches that of compact fluorescent lamps. In addition,
higher power packages are becoming available that enable compact lighting systems with
LEDs. However, additional challenges remain. The general illumination market has strict
requirements on the quality of white light—lamps of the same type must all appear to have
the same colour point.
There are several approaches using LEDs to achieve white light. One approach is to use a
blue or UV LED to excite one or more phosphors to give white light. The focus here is on the
use of red, green, and blue LEDs (RGB-LEDs) to produce white light. The advantages of
RGB-LEDs are that they provide a light source that can have a variable color point, and
theoretically can provide the highest efficiency LED-based white light. The ability to change
the color point of the lamp provides a new feature to general illumination that has the
potential to generate new applications and hence new market opportunities.
A key challenge for RGB-LEDs is to maintain the desired white point within acceptable
tolerances. This arises from the significant spread in lumen output and wavelength of
manufactured LEDs, and the changes in LED characteristics that occur with temperature and
time. Maintaining the desired white point can only be achieved with feedback schemes to
control the relative contributions of red, green, and blue to the white light.
2
Chapter 2
White light requirements
A key requirement of illumination relates to the spectral properties of the white light source.
Our perceived color of objects depends upon the spectrum of incident light upon them.
A red object illuminated with light that is drastically deficient in red will appear black. The
lighting industry uses a standard color rendering index (Ra) to determine the color rendition
properties of a light source. It is based on the components of eight standard spectra in the
white light source as compared to a black-body radiator with the same color temperature as
the light source. Thus, an incandescent lamp has an value Ra of 100. Typical fluorescent
lamps used in offices have an Ra of 80. The required value depends upon the application.
The illumination of goods in a retail store is typically the most demanding application for
color rendering index. The precise requirements depend upon the goods being displayed. As
the goods on display are changed, different color points may be desired. With conventional
light sources, this means that the lamp has to be changed. RGB-LEDs will allow the desired
color point to be achieved simply by adjusting the ratio of RGB illumination. Typical indoor
living space is illuminated with sources that have an Ra of 80. General outdoor illumination
such as street lighting puts the lowest demands on color rendering with Ra of 40 or less being
common.
The Ra that can be achieved with LEDs depends on the white spectrum. The white spectrum
is made up of the individual LED spectra, and thus, depends on the wavelengths selected, and
the number of different wavelength LEDs used to make white light.
RGB-LEDs can achieve the required Ra values provided that the correct LEDwavelengths are
selected. Most applications can be addressed by the selection of three different wavelengths.
3
Chapter 3
Colour Stability of RGB LEDs
Conventional light sources (fluorescent, incandescent, etc) can be manufactured very
reproducibly such that the lumen output and color points are highly consistent.
As a result, the general illumination market has grown to expect this level of consistency. The
manufacturing process for LEDs, on the other hand, does not provide this level of
consistency. Nominally identical LEDs can vary in light output by over a factor of two, and
the wavelength can vary by many nanometers. Lumen output and wavelength also change
with temperature and lumen output changes over time in a way that cannot be accurately
predicted. These factors all influence the color point that is obtained by mixing the light from
a combination of different wavelength LEDs. We now discuss the quantitative effect of these
LED characteristics based on white light from RGB-LEDs.
The largest impact on color point of RGB-LEDs comes from changes in light output of the
individual LEDs. This can be as a result of aging, or from the initial spread in the
performance of the LEDs used in the lamp. Change in temperature of the LED pn junction
leads to changes in light output, wavelength and spectral width. These all influence the
resulting color point of the RGB-LED. The red LEDs (or any AlInGaP-based LED), typically
reduces its light output by 10–15% for every 10 C increase in temperature. If it were possible
to reduce the temperature sensitivity of the red LEDs, the stability of white light from RGB-
LEDs with temperature could be significantly improved.
In addition to the effects already discussed, the peak wavelength of an LED also shifts with
current. Thus, as the intensity of RGB-LEDs is adjusted by changing the amplitude of the
drive current to each of the LEDs, the color point of the combination will change. While this
effect limits the accuracy of the color point, it is typically less critical
4
Changes in light output and peak wavelength with temperature, and changes in light output
over time mean that factory calibrations will not be sufficient to produce a stable white light
RGB-LED product. The large variability in the performance parameters of LEDs makes
compensation schemes based on temperature measurement and time inadequate.
3.1 Super Flux RGB LED
The RGB LED used in this project is the PIRANHA Super Flux RGB LED. It is a
7.6mmX7.6mm square LED.
The materials used is
1. AlGaInP for Red colour
2. InGaN for Green
3. InGaN for Blue
Some of the main features of this LED are
1. High Luminous output
2. Common anode
3. Superior weather resistance
4. Water clear lens
5. 5mm lens
6. Ultra brightness
7. Wide viewing angles
8. RoHs compliance
9. Ideal for backlight and Indicator purposes
5
The rating and optical characteristics of Superflux RGB LED is give below.
Table 3.1 Absolute maximum rating
Table 3.2 Electrical and Optical Characteristics
6
Chapter 4
Circuit Design
The main intention here is to design a circuit that gives an appearance of white light,
composed of red, green and blue components. One strategy is to switch on and off the red
green and blue LEDs at a high frequency, more than what our eye can perceive. The
combined effect as perceived by the eye will be a white light.
There are two parts in the circuit designed, an LED array, and a switching circuit.
4.1 LED array
An LED array is made of nine LEDs in a series-parallel manner. Three LEDs are connected
in series and three such series connections are connected in parallel. In each of the LEDs, the
corresponding pins for red, green and blue are shorted. The common anodes are shorted to
and are connected to +5V supply.
4.2 Switching Circuit
7
In order to switch the three colour LEDs on and off at a high frequency, it is required to get
pulses that can drive the LEDs. These pulses are generated here with the help of
PIC18F4550.
4.2.1 PIC18F4550
It is a 40 pin IC with high endurance and enchanced flash programming features. It has an on
chip 10 bit ADC incorporating programmable acquisition time allowing for a channel to be
selected and a conversion to be initiated without waiting for a sampling period and thus
reducing code overhead. The flash program memory is of size 32 Kbytes. ADC is of 13
channels, and has five bidirectional ports. It also has a streaming parallel port. There is an
internal oscillator block which generates two different clock signals, either as the
microcontroller’s clock source and may eliminate need for external oscillator circuit on the
OSC1 and/or OSC2 pins. The other clock source is the internal RC oscillator which provides
a nominal 31kHz output.
In this circuit, no external oscillator is used. The PIC is operated using the oscillator within
the chip. The operating voltage of PIC18F4550 is 4.2V to 5V DC. PIC 18F4550 uses the
standard set of 75 PIC18 core instructions, as well as an extended set of eight new
instructions for the optimization of code that is recursive or that utilizes a software stack. Most
of the standard instructions are a single program memory word (16 bits) but there are four
instructions that require two program memory locations. Each single-word instruction is a 16-
bit word divided into an opcode, which specifies the instruction type and one or more
operands, which further specify the operation of the instruction.
Fig 4.1 shows the detailed pin diagram of pic18F4550 used in this project.
8
Fig 4.1 PIC18F4550 pin diagram
A 5V supply is connected across VDD and VSS pin number 11 and 12 respectively and also
to pin number 1 through a resistor.
PIC18F4550 supports a total of 16384 instructions. It also has high current source/sink
capability of 25mA.
4.2.2 MCT2E optocoupler
The PIC produces a series of pulses for each of the three colours red, green and blue. Since
the LEDs are common anode type, we need a switching circuit to convert the pulses to
switching commands for the three LEDs. Here we are using an optocoupler MCT2E for this
purpose. The optocoupler figure is given below.
9
Fig 4.2 Optocoupler MCT2E
These are Standard Single Channel Phototransistor Couplers. The MCT2/ MCTE family is an
Industry Standard Single Channel Phototransistor. Each optocoupler consists of gallium
arsenide infrared LED and a silicon NPN phototransistor.
This isolation performance is accomplished through double molding isolation manufacturing
process. These isolation processes and the quality program results in the highest isolation
performance available for a commercial plastic phototransistor optocoupler.
Some of the characteristics of MCT2E optocoupler is given in the following tables.
Table 4.1 Absolute Maximum Input Ratings
Parameter Test condition Value Unit
Reverse voltage 6 V
Forward current 60 mA
Surge current T <= 10 microsec 2.5 A
Power dissipation 100 mW
Table 4.2 Absolute Maximum Input Ratings
Parameter Test condition Value Unit
Collector-emitter
breakdown70 V
10
Emitter-base breakdown
voltage7 V
Collector current T <= 10 ms 100 mA
Power dissipation 150 mW
4.3 Circuit
Fig 4.3 Circuit Diagram
The above figure shows the circuit diagram for this project. The LED switching pulses are
generated at high frequency using a PIC18F4550. Port D of PIC18F4550 is configured as an
output port first. Then, the pins 19, 20 and 21 corresponding to Port D RD0, RD1 and RD2
are programmed to output the pulse. Since we are using common anode type RGB LED,
these pulses cannot be used to drive the LED array directly. For this , an optocoupler MCT2E
is required. The pulses from the Port D pin RD0, RD1 and RD2 corresponding to red, green
and blue are given to one input of the optocoupler each (pin number 1). Pin number 2 of all
three optocouplers are shorted and grounded.
In the LED array, all the common anodes are shorted and connected to +5V supply. The
anodes corresponding to red, green and blue from the array are given to pin number 5 of each 11
of the 3 optocouplers. The pin 4 of all these are shorted and connected to ground through a
pot.
4.4 Working
When the program is run on the PIC (Refer Appendix for the program), it generates pulses of
7 milliseconds each. Each of these pulses are separated by 3 millisecond gap, before
switching on the next. In this way it is assured that one set of colours is turned off before the
next set is turned on. A total of 10 millisecond (7 ms for on and 3ms for off) is required for
each of the three colours. This gives a total of 30 milliseconds duration for switching all three
colours. This high frequency switching results in high speed on and off of red, green and blue
LEDs giving an appearance of white light when viewed from a distance. This is because of
the persistence of vision, or the retention of an image in the eye for 1/16 th of a second. Since
all the three colours switch within this time, it appears to be a mixture of these colours. As is
obvious, the mixing of these three basic colours result in white light.
Chapter 5
12
Result and Conclusion
5.1 Switching pulses
Figure 5.1 shows the switching pulses of red green and blue LEDs respectively. These pulses
are the output of the pin numbers 19, 20 and 21 of the PIC18F4550. Refer Appendix for the
program. It is these pulses that are given to optocoupler.
Fig 5.1 Switching pulses
13
It is observed from the above figure that pulses are 5V pulses of duration 7 milliseconds,
followed by a gap of 3 milliseconds, resulting in a total of 30 milliseconds duration for
switching all 3 LEDs.
White light was successfully obtained from RGB LEDs using a high frequency switching
circuit using PIC18F4550. For better results, all LEDs have to be tested for luminous
intensity of red green and blue colours and the LEDs with nearly the same output has to be
selected to make the LED array. If there is a large variation in the colour output, the result
will have a particular colour domination in the output.
The following figure shows the output obtained.
Fig 5.2 White light obtained from RGB LED
14
The Program
LIST P=18F4550, F=INHX32 ;directive to define processor
#include <P18F4550.INC> ;processor specific variable definitions
CONFIG WDT=OFF; disable watchdog timer
CONFIG MCLRE = ON; MCLEAR Pin on
CONFIG DEBUG = ON; Enable Debug Mode
CONFIG LVP = OFF;
CONFIG FOSC = INTOSCIO_EC
;Reset vector
; This code will start executing when a reset occurs.
RESET_VECTOR CODE0x0000
goto Main ;go to start of main code
;Start of main program
Main:
15
CLRF PORTD
MOVLW 0x00
MOVWF TRISD,0
L1 MOVLW B'00000001'
MOVWF PORTD,0
CALL DELAY1
MOVLW B'00000000'
MOVWF PORTD,0
CALL DELAY2
MOVLW B'00000010'
MOVWF PORTD,0
CALL DELAY1
MOVLW B'00000000'
MOVWF PORTD,0
CALL DELAY2
MOVLW B'00000100'
MOVWF PORTD,0
CALL DELAY1
MOVLW B'00000000'
16
MOVWF PORTD,0
CALL DELAY2
GOTO L1
DELAY1
MOVLW 0X8F
L2 DECFSZ WREG
GOTO L2
RETURN
DELAY2
MOVLW 0X0F
L3 DECFSZ WREG
GOTO L3
RETURN
;End of program
END
17
References
[1] “Red, green, and blue LED based white light generation: issues and control”, IEEE
Journal 2002 Muthu, S. Schuurmans, F.J. Pashley, M.D. Philips Res., Briarcliff Manor
[2] MCT2/MCT2E Datasheet, Vishal Semiconductors
[3] PIC18F2455/2550/4455/4550 Data Sheet, Microchip
[4] “Programming and customizing the PIC microcontroller” Michael Predko, Mike Predko
Balu Raveendran,
National Institute of Technology Calicut,
Kozhikode, Kerala
Email:[email protected]
18