Led Pixel

This is a PIC 18F1320 based RGB led controller. The LED is a 5Watt 70 lumen RGB with a common anode configuration, bought from dealextreme for $6.36. A software based PWM controls three Leds, Red Green and Blue to form different colors. each LED has 50 different intensities that can generate up to 125,000 different colors. The software interface is coded in Visual Basic. 3 Sliders enable individual control of the RGB led. a Randomize mode generated random colors whose time period is selectable using the fourth slider.

Serial Protocol: The PIC USART is configured at 19,200bps. it listens to the serial port and accepts commands in the following format: XX YY$

where XX is the color to set (valid values: RD for red, GR for green, BL for blue), YY is the intensity to set(valid from 0-50) and $ is the command terminate symbol. to set the intensity of Red to 30, the following string is sent over the serial port: RD 30$. An application like hyper terminal can also be used to control this setup.

Vb App
test Circuit
Circuit diagram

PIC Code description:

The main program loop waits for a serial data received flag to be set. if a valid command terminating with a $ is received the string is processed and values for RGB are set. Timer two generates an interrupt every 128us. The interrupt code consists of a counter that counts from 0-50. All the led's are switched on initially. if the intensity set matches the counter the individual led is switched off. This is done for all the 3 led's. 128 * 50 = 6400us or 6.4ms for the cycle to complete. or 156.25Hz

if R=10, G=30, and B=5, the waveform will look like:

R = |¯¯¯¯¯¯¯¯¯¯|________________________________________|

G = |¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯¯|____________________|

B = |¯¯¯¯¯|_____________________________________________|

 

 

 

The PIC source code can be downloaded here and the VB application can be downloaded here.

09 Oct 2009