thedude33
Posts: 11
Joined: Wed Jun 19, 2013 3:41 pm

DIY RGB LED Controller *Help*

Thu Aug 01, 2013 4:59 am

So I am trying to do this project without buying much anything. I want to set up a system where I can define a certain hex code/rgb code and have the led array make that colour. I figure with GPIO it shouldn't be that hard to code, but I just can't figure out how to get this working.

I want to just have a red led, blue led, and green led; each separately controlled. I would dial "intensity" up or down for each based on rgb code.

Is this feasible without buying some expensive expansion board or a big breadboard?
All help is appreciated.

DaveTheWalker
Posts: 36
Joined: Wed Jul 04, 2012 9:06 pm

Re: DIY RGB LED Controller *Help*

Tue Aug 06, 2013 8:03 am

It looks like what you need is three PWM channels.

Software-controlled PWM (Pulse-Width Modulation) would probably be fine for your application.

Have a look through the forums and see if anyone's got three independent PWM channels running on a Pi already. If so, then all you'll need are three driver transistors (N-channel MOSFETs like the 2N7000 for example) and some resistors to limit the current.

The hex input would then give you a PWM output that corresponds to the required brightness. 100% pulse-width = xFF, and 0% = x00. 50% = x7F

Have a read around on google to seee how it works (I'm pretty sure this is a solved problem) and let us know how you get on.

Good luck!
Dave

PiGraham
Posts: 3577
Joined: Fri Jun 07, 2013 12:37 pm
Location: Waterlooville

Re: DIY RGB LED Controller *Help*

Tue Aug 06, 2013 8:29 am

PIGPIO allows you to use an GPIO as a PWM output.
For low power LEDs you could connect them direct to GPIO ouputs with just current limiting resistors (e.g. 330 ohm).
That should be enough to allow you to mix colours on LEDs with minimal hardware.
If you want to drive bright LEDs you will need something to handle higher currents (transistor/FET/driver chip).

PIGPIO

thedude33
Posts: 11
Joined: Wed Jun 19, 2013 3:41 pm

Re: DIY RGB LED Controller *Help*

Tue Aug 06, 2013 3:50 pm

Alright! Thank you for your help!

Return to “Other projects”