Power Pic RGB with Infrared remote control

Share:

Description

Power Pic RGB with Infrared remote control is a circuit that generates colors using a RGB LED and can be controlled using any infrared remote controller capable compatible with the Sony® Sirc code.

This circuit is the third evolution of Pic RGB project [1] in which the goal was to control a RGB LED and randomly generate colors. This time the goal is to use a remote control to change the colors, either by choosing a specific color or by selecting an automatic color fading mode, in which the software will keep changing colors over the color spectrum!

 

Design and Implementation

Like the second second evolution, (Power Pic RGB), , this project is also designed to be placed inside a white globe and drive a 3W RGB LED. The globe is available at IKEA at a price of 9.90 euros [3].

The microcontroller continues to be one of the usual PIC 12F629 or 12F675, as in the previous Pic RGB projects. To receive the infrared signal a pin with the Interrupt on Change feature is required. The circuit is very  similar to Power PIC RGB with the addition of a TSOP1738 infra red receiver.

The infrared remote controller is a Universal Remote Control Unit model URC11C-9C bought at a chinese store for about 3 euros. It is configured to emit SIRC infrared codes for Sony TV sets. In this remote controller the configuration code is 001, but other remote controllers with SIRC encoding may be used instead. Just check their configuration sheet for Sony codes and try them.

 

Schematic

The schematic is very similar to Power PicRGB with the addition of the infrared receiver.

From left to right we have the power supply based on a 7805 5V 1A regulator, the microcontroller, on the right the three mosfets that will drive the LED and below the TSOP1738 to receive the infrared signals. Click the image to enlarge.

 

Each mosfet can drive a maximum 600mA through its drain but according to Prolight each LED (red, green and blue) can only sustain 300mA which makes this mosfet perfect for the job.

Summing the 3 LED currents we get 900mA not counting the current consumed by the 7805 and the PIC itself which should around  3 or 4 mA. The 7805 is able to supply 1A of current with a proper heatsink.

The TSOP1738 infrared receiver can be replaced with any model like TSOP1238, TSOP31238, SFH5110, etc. as long as the receiving frequency is between 38Khz and 40Khz. Ideally it should be 38Khz. R5 and C4 perform some filtering on the TSOP1738 supply voltage and R4 is a pull-up to maintain GP1 at 5V when no signal is being received.

List of Components

Amount Part Description
1 D1 1N4001 Rectifier diode or similar
1 C1 2200uF/25V capacitor
2 C3,C5 100nF capacitor
1 C2 470uF/10V capacitor
1 C4 4.7uF/10V capacitor
1 IC2 7805 regulator
1 IC1 PIC 12F675
1 IR1 TSOP1738 or similar 38Khz, 3 pin infrared receiver
3 Q1,Q2,Q3 BS170 mosfet
1 R5 100 Ohm resistor
1 R4

10k resistor

1 R6

4k7 resistor

1 R3 5.6 Ohm/1W resistor
2 R1,R2 22 Ohm 1/4W resistor
1 J1 Molex 4 pin male 90 degrees PCB connector
1 J1 cap Molex 4 pin female
1 J2 Power connector for PCB
4 - wires to connect the molex to the LED
1 LED Prolight 3W RGB LED with common anode
1 - Heat sink for the LED or some aluminum piece large enough to remove the heat
1 - TO-220 Heat sink for the 7805 regulator
1 - AC/DC power supply capable of delivering 1A
("wall wart" or similar)
2 - M3 bolts, nuts and some washers
1 - 4K7 or 10K pull-up resistor for MCLR pin. It is missing in the schematic due to a human error. Place it on the tracks side of the PCB

 

PCB

The PCB and Schematic were created using Eagle from Cadsoft. The PCB is circular because it was developed to be placed inside an IKEA white globe [3]. The light bulb holder has to be removed from the inside so the LED and heat sink may be placed in its position.

You can download the schematic and pcb in eagle format at the downloads section.

The 4 pin molex connector is the output to the LED. The pin order is as follows:

The power resistor R3 should be 1W. C1 voltage should be above the input voltage of the circuit and C2 voltage should be greater than 5V (10V or 16V should do). The input diode can be any rectifier capable of driving 1A of current.

The LED requires a heat sink otherwise its life will be significantly reduced. The LM7805 also requires a heat sink.

Here's a picture of the first four prototype PCBs right after etching, two of them still with the toner:

4 pcbs

Some pictures of the PCB after assembly:

 

 

 

Update: Found a problem while testing the first PCB batch.

The MCLR pull-up is missing and the firmware available here doesn't disable the MCLR pin. My solution was to place a 4k7 resistor between pins 1 and 4 of the pic because it was simple to do. The PCB presented in this page and in the downloads section already has this resistor included (R6) and it should be soldered on the bottom layer like in the following picture.

 

Software

The software is written in C and consists of a triple PWM modulator, a SIRC decoder and a HSV to RGB converter.

The PWM modulator and the SIRC decoder are designed as device drivers and are fully interrupt driven. This way the main loop of the program is dedicated to do the remaining task of deciding what to do with the decoded infrared buttons.

hsvInstead of giving the user direct control over the RGB value on the LEDs, the software implements the HSV color space in order to navigate along the full color spectrum. The HSV color space [2] can be perceived as a cone where each component represents the following:

Using the HSV color space gives the user the ability to navigate along the color spectrum just by increasing or decreasing Hue. Adjusting Saturation and Value refines the selected color. This is a lot easier than asking the user to select the Red, Green and Blue components independently. As an example, imagining the user wants a light blue color, he/she should change the Hue until the color is near blue and then decrease saturation a little, until the light blue pleases him/her.

 

Evaluation

The final circuit is built and all four PCBs are working properly. Below are some pictures of the final circuit ready to be placed inside the globe. The LED requires a heat sink otherwise degradation will be accelerated and its life reduced.

 

  

 

This is how it looks like when it is working:

 

Inside the globe

 And a short video (the flickering effect on the video is not visible with a naked eye):

Video Player

 

A final note to anyone wanting to improve the software: the optimum number of colors using 6 bit for PWM is attained with 378 hue values. This number comes from 63 pwm steps * 6 = 378. And 6 is related to the slope of the HSV to RGB function.

 

Downloads

Files available for download:

Firmware includes source code.

References

  1. 1. Pic RGB
  2. 2. Power Pic RGB
  3. 3. HSL and HSV definitions by Wikipedia
  4. 4. Adventures in HSV Space, July 2001, Darrin Cardani (local copy)
  5. 5. IKEA FADO globe

Published on Sunday 2009/05/03, last modified on Sunday 2013/04/28