Practical PIC Projects

 

RGB LED PWM Driver for
High Power 350mA LEDs


 


Description

As featured in Electronics Weekly Gadget Freak (20/02/2008)

The main reason I made this version is that I wanted to fit it in to the base of an Ikea Mylonit lamp. This lamp is made entirely from glass and has a small recess in the base with an entry for the power lead.  Since it had nowhere to fit a separate power connector but did have a slot for a power lead to pass in to the base, I needed to make a PCB with a DC power connector in the centre of the board.  At the same time I took the opportunity to tweak the circuit slightly and left out things it didn't need. The changes are detailed below.  Please note that the original version on the main page is still perfectly okay and you may find the single sided PCB easier to make. 

 

Changes for R3

  • This version uses a double sided PCB. Dimensions are approximately the same as the original version.

  • Removed the second push button switch and components for the RS232 serial interface.

  • Added 22K resistor between MCLR input and Vdd.  This eliminates the need for a jumper on the ICSP header in normal operation. (If you use a 12F683 you can omit this resistor as well since it has an internal pull-up)

  • Provision for a surface mount DC power socket.

  • Removed the power-on LED and series resistor.

  • Added 47K pull-up resistors to the transistor drive circuit.  On the original version, when it first powered on the RGB LEDs would flash at 100% brightness very briefly.  This is caused by the PIC I/O lines defaulting to inputs at power-up and until the software starts and sets them as outputs the PWM inputs to the ZXLD1350 are enabled.  This modification prevents this from happening. NOTE: it's purely for aesthetics, not a fix for a design fault.

  • In all other respects the circuit and software is identical to the version 2 design on the main page.

 


Schematic

Version 3 PCB

Construction Notes

You must drill vias and solder links between the ground plane and the top side of the board. These are circled in Yellow.

There are also six vias linking tracks on the top and bottom of the PCB. These are circled in Green

You must ensure you add these or the circuit will not function correctly, if at all.

The pad size for the three inductors is SM2512.  There are such a variety of inductors that could be used here with so many different footprints.  I've left some clear area around the pads to facilitate the use of various inductors but you should make sure that the ones you do use aren't going to touch other areas of copper.  This may require some creative positioning of the inductors.

The RGB LEDs connect with the anode to the inductor and the cathode to the track that disappears under the ZXLD1350's. This should be apparent from the schematic but I'll mention it anyway.

The 5 pin ICSP header needs soldering on the component side of the PCB and the middle pin also needs soldering on the copper side. It can be fitted to either side of the board depending on how you are going to mount the PCB, but you must make sure you solder it so it connects all the PCB tracks. This probably makes more sense if you look at the PCB.

The push button switch can be mounted on either side of the PCB to suit your specific application.

The surface mount DC power socket is a Switchcraft RASM722 2.1mm SMT Power Socket. (Rapid Electronics P/N 20-0896)

0.33 ohm SMD resistors and ZXLD1350 can be sourced from Farnell

The 3 Watt RGB LED can be difficult to source, Rapid Electronics did have one, Farnell only do the Lamina Atlas which isn't suitable for this project.  The only other source seems to be buying from sellers in Hong Kong or China through E-Bay.  I've done this and even with postage it can be cheaper than UK suppliers, although it can take 10-14 days to arrive.  I've used this company http://stores.ebay.co.uk/Sure-Electronics

The LED is fixed to the aluminium disc using Adhesive Thermal Pads. In the UK you can get this from Rapid Electronics and Farnell.

In the photographs below, the PCB is fixed to the aluminium disc using thick (foam backed) double sided tape. The tape is doubled up to give some clearance between the disc and underside of the PCB  and a thin sheet of plastic (from take-away food container) is used to provide insulation between the two.

The depth of the recess in the base of the lamp requires that you make the whole assembly as shallow as possible, otherwise the body of the DC power connecter will be below the bottom of the lamp base. Keep this in mind when assembling it.

A ping pong ball, cut in two makes a good light diffuser.  I've also used opaque tops from aerosol tins to good effect.

Although this specific application makes use of a single package RGB LED, it is equally suited to driving separate red, green and blue LEDs.  It can also drive 3 pairs of series connected LEDs.  However, it cannot be used with RGB LEDs that have a common anode or cathode.

Worth checking out are the Lamina Atlas RGB LEDs which contain 3 pairs of series connected LED dies in one package. These are very bright, just remember to use a heatsink capable of dealing with 6.6W heat dissipation. It works well with the controller described here but the aluminium disc shown with this project can't handle the heat so if you're thinking of using one you'll need to do some redesign work.
(Lamina part # NT-43F0-0424, available from Farnell part # 1225175)

Warning: Do not look directly into high brightness LEDs;  it can damage your eyes.

Construction in pictures


Hi-res image (872Kb)
   

Software

Download:

  • Download Source code (zip file)
  • HEX file for 12F629 (right click and save-as)

NEW  (12/04/2008)
Version 3 firmware for this project is available for download here

This code will assemble (using Microchip's free MPLAB® IDE  ) for use with a 12F629 / 675 or 683.  The .HEX file above was assembled for use with a 12F629.

The colour sequences included are a minimal set for testing. 
They are:

  1. Constant red 100%
  2. Constant green 100%
  3. Constant blue 100%
  4. All off
  5. White 5%
  6. White 50%
  7. White 90%
  8. Red fade up/down; Green fade up/down; Blue fade up/down
  9. Red fade up / blue fade down; Green fade up / red fade down; Blue fade up / green fade down;
  10. Blue 5% blinking

Sequence data information

Since the supplied SequenceData350.inc file contains only basic sequences for testing you will want to modify the SequenceData350.inc file with your own sequences and reassemble the code. 

The format for this file is exactly the same as that used with the other RGB Controllers on this site.  For an explanation of the sequence data format see Standalone RGB controller SequenceData.inc file.

The link below contains the sequence data for a mood lamp I have in my room at home.  To use this one, download it and replace the one in the ZIP file above, then reassemble the code.

Download: