RGB Light

pcfixit

New Member
Hi Guys.

I am currently working on a lighting project and I am in need of assistance.
I am trying to build an RGB Lighting Unit to be used for color-washing a section of wall.
http://cachepe.samedaymusic.com/media/quality,85/brand,sameday/LED-TechnoStrobeRGB-Fixture-3bbf42df223e52007792ca40365a224b.jpg - This is along the lines of what I want to build, just a bit smaller.

I am hoping to include 33 LED's(11 of each color) in groups of 3, each group spaced about 4.5cm apart.
Code:
     R                                      R

  G     B  <----------4.5cm---------->   G      B
The LED's are 5mm high brightness LED's from Rapid Electronics

LED 5MM RED 20000MCD (RC) 55-2476 £0.18 x 11 = £1.80
LED 5MM GREEN 30000MCD (RC) 55-2480 £0.26 x 11 = £2.60
LED 5MM BLUE 12000MCD (RC) 55-2482 £0.26 x 11 = £2.60
_______
GRAND TOTAL(for LED's): £7.00
_______

My current budget for this project is around £15.
I was wondering if it would be possible to use PWM to control these LEDS by connecting all the leds of the same colour together. I am planning on using an 08M to control the LEDs, using pins 0,1 and 2 to as seperate PWM "channels" to control each LED color, 0 for red, 1 for green and 2 for blue.I am also planning on using pin 4 as an input for serial data from a computer or another PICAXE to set the colour data.Any feedback, suggestions or comments will be much appriciated.

Thanks
Alex
 
Last edited:

hippy

Technical Support
Staff member
It should be possible to control the individual brightness of three separate red, green and blue LED's from a single PICAXE ( use Forum Search for previous discussions ) but your biggest problem will be in providing a suitable voltage and/or current to drive that many LED's and controlling that supply. It is not possible to simply connect that many LED's directly to PICAXE output pins.

It can be done, but isn't in my field of knowledge. A Forum Search may again help in that respect.
 

pcfixit

New Member
Thanks for the feedback Hippy. This might not be possible, but would it be possible to connect the LEDs to a high current LED power supply(availible from Rapid) and connect a MOSFET (or otherwise) to the output and PWM that, therefore controlling all of the LED's by using 1 MOSFET(or otherwise) for each LED colour. My electronics knowledge is relatively limited, so please forgive me if I am asking a stupid question.
Thanks
Alex
 
Last edited:

pcfixit

New Member
Thanks for the schematic Stelios, this is perfect for my project, I can probrably adapt the circuit shown in the schematic to fit the purpose of my project. If this doesnt work, do you think it would be possible to control 9 Piranah RGB LED's(to replace the 9 RGB groups) from a single PICAXE using PWM and maybe a transistor?
By the way, just as a sideline question. is it possible to control a high power(1W Luxeon Star RGB) LED by using a MOSFET or otherwise to control the output power of a high current LED PSU and using PWM to control the MOSFET(or otherwise)?

Thanks
Alex
 
Last edited:

steliosm

Senior Member
Alex the schematic should work just fine, but I can't remember if 08M can give you 3 Background PWM outputs. This is what you need to be able to create most of the colors.
You could use PWM to drive a fast transistor if you need more current or more LEDs. You can even use a darlington pair IC to get more current.
Check out this page, it might give you some more information on the subject: http://www.kpsec.freeuk.com/trancirc.htm
 

Tom2000

Senior Member
I was playing with RGB LED drive using an 08M a while back.

My strategy was to send an appropriate PWM value to the LED's common, then switch the individual leads for the red, green, and blue diodes. For each diode, I'd set the appropriate brightness value on the PWM output.

In other words, I was using one PWM output, but time division multiplexing the diodes.

The method has some limitations. I'm posting one of my examples below. You can use it as a jumping off point for your own experiments. Or as an example of how *not* to do it, perhaps.

Good luck!

Tom


Code:
#rem

   16Mcolorsw.bas
   
     Cycles an RGB LED's colors through all values
   
   Common cathode RGB LED hookup:
   
     Cathode to pin2
     Red to pin0
     Green to pin1
     Blue to pin4

#endrem


  symbol redpin = 0
  symbol grnpin = 1
  symbol blupin = 4

  symbol redptr = b4
  symbol grnptr = b5
  symbol bluptr = b6
  symbol redval = b7
  symbol grnval = b8
  symbol bluval = b9
  symbol ctr    = b10
  
  symbol dly    = 1
  
  symbol redinc = 3
  symbol grninc = 1
  symbol bluinc = 2
  
#rem  
  '128 byte sin table (addr 0->127, vals 0->254)
  
  symbol tblsize = 127
  
  eeprom 0,(127,133,139,146,152,158,164,170)
  eeprom 8,(176,181,187,192,198,203,208,212)
  eeprom 16,(217,221,225,229,233,236,239,242)
  eeprom 24,(244,247,249,250,252,253,253,254)
  eeprom 32,(254,254,253,253,252,250,249,247)
  eeprom 40,(244,242,239,236,233,229,225,221)
  eeprom 48,(217,212,208,203,198,192,187,181)
  eeprom 56,(176,170,164,158,152,146,139,133)
  eeprom 64,(127,121,115,108,102,96,90,84)
  eeprom 72,(78,73,67,62,56,51,46,42)
  eeprom 80,(37,33,29,25,21,18,15,12)
  eeprom 88,(10,7,5,4,2,1,1,0)
  eeprom 96,(0,0,1,1,2,4,5,7)
  eeprom 104,(10,12,15,18,21,25,29,33)
  eeprom 112,(37,42,46,51,56,62,67,73)
  eeprom 120,(78,84,90,96,102,108,115,121)
#endrem  
  

Main:

  setfreq m8
  
  dirs = %00010111
  
  high redpin
  high grnpin
  high blupin
  
  redptr = 0
  read redptr,redval
  grnptr = 0
  read grnptr,grnval
  bluptr = 0
  read bluptr,bluval
  ctr = dly
  
  
  do
    
    for redval = 0 to 254
      for grnval = 0 to 254
        for bluval = 0 to 254
    
          pwmout 2,62,redval   'at 8 MHz, 31.5 kHz.  254 = 100%
          low redpin
		    pause 1
		    high redpin
		    
		    pwmout 2,62,grnval
		    low grnpin
		    pause 1
		    high grnpin
		    
		    pwmout 2,62,bluval
		    low blupin
		    pause 1
		    high blupin
		    
		  next bluval
		next grnval
    next redval

  loop
  
end
 

pcfixit

New Member
Thanks to Stelios and Tom for your input and suggestions.I'll try both the circuits when I can get hold of the LEDs,a new chip and a new USB-RS232 cable(my old one broke) :( )
Just a small question, would a BC548 be classed as a fast switching transistor?

Thanks
Alex
 
Last edited:
Top