Introduction
Red, green and blue, in short form RGB is the additive colors of the world. All of the other colors are produced by combining these three additive colors. To produce all the other colors, these red, green and blue are added together in various ways and with various intensities.
Some RGB inputs devices are color TV, Video cameras and digital cameras etc. Some RGB output devices are TV sets of various technologies, (CRT, LED and Plasma etc.) computer, mobile phones and LED displays. This project also based on the LED bulbs.
When consider about RGB light beams, to form the other colors they should be superimposed. Each of the three beams can have arbitrary intensities from strongest intensity to weakest intensity on in the mixture. Zero intensity of the each beam or off LEDs gives the darkest color, which means black. Strongest intensity of each gives white, the quality of this white depends on the intensity of the primary light source. When consider about the subtractive colors those are produce by combining the two of additive colors with equal intensities. Those are Cyan (Green+ blue), Magenta (red + blue) and yellow (red + green).
This project is about the showing RGB (primary) colors and their combinations by using LEDs. Showing White and Black is special task of this project. To show these several of colors have to change intensities of LEDs as mentioned above. The target colors can be achieved by varying the brightness output of each LED as to allow gradual change of each color. The brightness of each LED is controlled by configuring pulse width modulation and analog to digital conversation using 16F877A microcontroller.
Objectives
Objectives of this project are get experiences and good knowledge about the microcontroller and its applications (How the PIC is program, how it connect to the other electric devices.). Can improve skills of making circuit and get the experience about the PCB design.
Methods
Pulse Width Modulation
To change brightness of LEDs automatically used the pulse width modulation as discussed above. Before discussed about the PWM (pulse width modulation), should discuss about the duty cycles. The duty cycle is a square waves modulated to encode a specific analog signal levels. They are as below.
According to the above signal half of signal is fully on the other half is fully off. The ratio between fully on and the fully off is 1:1. If the value of supply voltage is 15 V then the average value of the above signal is 7.5V. PWM Configuration has been used to generate frequency. To configure PWM have been used TRISC, PR2, CCP1CON, CCP2CON, CCPR1L, CCPR2L and T2CON registers specifically. There are two PWM channels on the PIC16F877. These modules are coined CCP1 and CCP2. These modules are implemented on pins 16 and 17 of the PIC16F877. The TRISC register must be initialized so those have been identified RC2 as output ports (bits 1of TRISC must be set to 0).
In this project only blue color LED brightness was changed and the red and green color LEDs brightness kept in constant. Therefore the red and green LEDs connect to the Vcc port of microcontroller and blue LEDs connect to the RC2 pin.
This is the way, how the PWM change the brightness of LEDs.
Start
Initialized the PWM
Keep the period of red and green to 255
Red=255; green=255;
Keep the period of Blue to vary
Blue=i
Increase the duty cycle of blue 1-255
Analog to Digital Conversion.
To change the brightness of LEDs manually used this method. As it named ADC (analog to digital conversion) analog voltage signals convert to digital and using potentiometer divide this digital voltage to different voltages.
In this microcontroller port A used to convert analog signals to the digital signals. There are ten bits in the microcontroller used in ADC. Therefore there are 1204 values and analog signal can divided to 1024 part and supply voltage to the RA0 is 5 V and one part is 4.8 mV. That means RA0 can recognize 4.8 mV voltage differences.
To configure ADC have been used ADCON1, ADCON0, ADRESH and ADRESL registers.
In here also change the brightness of blue color as done in PWM. Therefore the RA0 pin used as the input and the RC2 pin used as the output pin.
Hardware
Orcad 9.2 software was used to design the all the hardware parts of this project. First of the complete schematic diagrams of the hardware was drawn. Then components were supplied and they were checked using the bread board and power supply.After checking LEDs with regulators, 15 V power supply were used. After checking all the components suitable components were chosen. Then the hardware was separated to a suitable way to construct. The PCB layouts were designed also using the Orcad software. This project is basically consisting of four hardware parts.
1. Mother board.
2. The part consists of regulators, resistors and transistors.
3. The part consists of LEDs.
4. Potentiometer.
Mother board
Below images are the PCB layout and the circuit of mother board
The part consist of regulators, resistors and transistors
The below images are the PCB layout and the circuit for the part consist of regulators, resistors and transistors. They are in same order. In the above of the PCB layout and the circuit consist four regulators and below part consist transistors.
The part consists of LEDs
The below images are the PCB layout and the circuit for the part consist of LEDs.
potentiometer
Below image is the potentiometer and it has connect to the mother board and power supply.
Final result
The 15 LEDs are on and blue LEDs only vary its brightness. The below image is the image of final result.
Discussion and conclusion
Different colors LED require different voltages to switch on, and blue LED required more than the other LED. Therefore when the same power supply, supply power to the circuit blue LED cannot connect serial way. Therefore they were connected to the circuit parallel way. If there were used more than fifteen LEDs it would be better than now. But to do that high value voltage supply have to use and it is difficult. It is better to have some different ideas other than focusing the light beam, as an example diffraction pattern is a better way to show color different ways.
Here is a video of color demonstration kit using 15 LEDs
YouTube Video
References
http://en.wikipedia.org/wiki/Light-emitting_diode
http://en.wikipedia.org/wiki/Potentiometer
http://www.best-microcontroller-projects.com/pic-projects.html
http://kz-picsinhalese.blogspot.com/2009/04/vidusara-articles-of-pic-programming.html
http://en.wikipedia.org/wiki/RGB_color_model
Components used
Component | Description | Quantity |
16F877A microcontroller | 1 | |
Capacitors | polar 220 μF | 3 |
ceramic cap 0.1 μF | 5 | |
ceramic cap 22 pF | 2 | |
polar 10 μF | 4 | |
connecters | D-SUB 9 female serial | 1 |
1 pin | 14 | |
2 pin | 3 | |
3 pin | 1 | |
4 pin | 1 | |
6 pin | 2 | |
8 pin | 3 | |
12 pin | 1 | |
MAX232 | 1 | |
Resistors | 10 kΩ | 1 |
470 Ω | 2 | |
680 Ω | 4 | |
100 Ω | 2 | |
180 Ω | 1 | |
150 Ω | 1 | |
regulator | 7805 | 1 |
LM317 | 4 | |
LED | 3 mm red | 6 |
3 mm green | 6 | |
3 mm blue | 5 | |
push button | 6 mm | 1 |
crystal oscillator | 4 MHz | 1 |
Transistors | BC547 NPN | 4 |