This code is for a simple RGB LED controller for 1 LED using a PIC16F628 that has PWM control for the LED. It is controlled by sending 2 bytes to the PIC’s internal USART for the intensities of the red, green, and blue color channels. The operation is very simple and so is the wiring. The PIC loops and turns on the respective colors if they are less than or equal to theCount. Because of persistence of vision, the eye sees the LEDs as all being on at the same time. The 4-bit code below has 15 linear values of PWM. The 8-bit code has 255 linear values of PWM. The 4-bit exponential PWM code has 15 values fit to an exponential curve. This allows for more “even” color levels because the human eye does not readily perceive linear changes in light intensity. For LED applications, the 4-bit exponential code is recommended.
Category: PIC Projects
RS-232 Level Converter
This is a basic RS-232 transmit/receive circuit that is necessary for PIC microcontrollers to reliably communicate with a PC serial port. Why is it necessary? Well, the RS-232 specification requires that the signal levels be ±3-15 Volts and unfortunately the PIC microcontroller operates at TTL levels (0-5 Volts). The MAX233 is a nice IC that allows you to convert microcontroller voltages to RS-232 compatible levels with no required external components. Read More
PIC16F628 Serial 8 RGB LED PWM Controller
This code is for a simple RGB LED controller for 8 LEDs using a PIC16F628 that has PWM control for the LEDs. It is controlled by sending 12 bytes to the PIC’s internal USART for the intensities of the red, green, and blue color channels. The operation is very simple and so is the wiring. The PIC selects each LED and turns on the respective colors if they are less than or equal to theCount then goes to the next LED. Because of persistence of vision, the eye sees the LEDs as all being on at the same time. However, because this is running off the internal OSC (4MHz) and the code is not optimized, there is some flickering evident when moving one’s head from side to side.
PIC12F675 Single RGB LED Controller
This code is for a simple RGB LED controller for 1 RGB LED using a PIC12F675 (or PIC12F629). The pattern is determined by the data in the EEPROM. When the PIC needs a new target for the PWM, it loads it from EEPROM. Pin 4 (GP3) is pulled high because it is used to switch between displays. Please see the source code for more information; the structure and design is commented. The operation of the controller is very simple and so is the wiring. Read More
PIC18LF2550 2.4GHz Serial Link
I wanted to make a wireless serial link that would allow me to send and receive data between Microchip PIC microcontrollers and a computer. I found some very useful information and some helpful code for utilizing a Laipac TRW-24G 2.4GHz wireless transceiver with a PIC16F88 as a wireless serial link. The PIC16F88 is a nice little chip that provides a number of useful features (including an onboard USART and the ability to use a bootloader). I am a fan of the PIC16F88; however, I believe that the PIC18 series are much more robust, so I created a circuit that would allow much more flexibility in design and deployment. This project is a relatively simple circuit that utilizes a PIC18LF2550 microcontroller and the Laipac TRW-24G 2.4GHz transceiver to create a wireless serial link. Read More