bitbitbit
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am

RGB LED strips????

Mon Sep 17, 2012 8:57 am

Hi everybody,

Just want to know if anybody succeeded in using Pi to control a RGB LED strip? :roll:

Not the digital LED strip but the one with analog signals.....
Link:
http://www.ladyada.net/products/rgbledstrip/

the link is for audrino...any tips to transfer it to Pi?? Perhaps using an MCP3008 chip?? :roll:

cTn
Posts: 49
Joined: Sat Aug 11, 2012 4:11 pm
Contact: Website

Re: RGB LED strips????

Mon Sep 17, 2012 5:56 pm

bitbitbit wrote:Hi everybody,

Just want to know if anybody succeeded in using Pi to control a RGB LED strip? :roll:

Not the digital LED strip but the one with analog signals.....
Link:
http://www.ladyada.net/products/rgbledstrip/

the link is for audrino...any tips to transfer it to Pi?? Perhaps using an MCP3008 chip?? :roll:
Hi, i didn't try to drive rgb leds on my pi yet, but i am pretty sure i can point you to the right direction, as you probably already know there are no analog pins on pi, so yes you will need an separate microcontroler, if you have the "tools" to make your own board MCP3008 would do, basically any custom programmable chip that has analog pins and that you could interface with would do, i would recommend using a microcontroller with i2c support (that's what i prefer), AVR, PICAXE, you name it..
If you are looking for an "finished board" that is ready to go, i would pick arduino nano or something similar (you can get it really cheap from ebay for around 13$).

bitbitbit
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am

Re: RGB LED strips????

Wed Sep 19, 2012 4:48 am

cTn wrote:
bitbitbit wrote:Hi everybody,

Just want to know if anybody succeeded in using Pi to control a RGB LED strip? :roll:

Not the digital LED strip but the one with analog signals.....
Link:
http://www.ladyada.net/products/rgbledstrip/

the link is for audrino...any tips to transfer it to Pi?? Perhaps using an MCP3008 chip?? :roll:
Hi, i didn't try to drive rgb leds on my pi yet, but i am pretty sure i can point you to the right direction, as you probably already know there are no analog pins on pi, so yes you will need an separate microcontroler, if you have the "tools" to make your own board MCP3008 would do, basically any custom programmable chip that has analog pins and that you could interface with would do, i would recommend using a microcontroller with i2c support (that's what i prefer), AVR, PICAXE, you name it..
If you are looking for an "finished board" that is ready to go, i would pick arduino nano or something similar (you can get it really cheap from ebay for around 13$).

Thanks! I'll be giving it a try......hope it works....

And I was wondering about another issue as i read through the LED strip tutorial I posted....it says:::

"Because these LED strips are very simple, we can easily use them with any microcontroller. We suggesting using PWM dimming techniques to control the strip. Since each 'LED' pin may end up requiring an Amp or more to sink to ground, power transistors are required! Don't try to connect the pins directly to your everyday microcontroller, they will burn out and/or not work."

Hmmmm, so I guess a transistor will be needed to be connected before the MCP3008?

It says the current rating of the transistor depends on the LED strip (rating + length), but I was wondering....does anybody know at what current max will cause Pi to burn?.... :shock: :shock: :shock:

Ravenous
Posts: 1956
Joined: Fri Feb 24, 2012 1:01 pm
Location: UK

Re: RGB LED strips????

Wed Sep 19, 2012 12:48 pm

bitbitbit wrote:but I was wondering....does anybody know at what current max will cause Pi to burn?.... :shock: :shock: :shock:
Very little. I gather the raspi's GPIO pins are rated to only drive enough milliamps to light a single LED. Don't try it!

User avatar
RaTTuS
Posts: 10085
Joined: Tue Nov 29, 2011 11:12 am
Location: North West UK

Re: RGB LED strips????

Thu Sep 20, 2012 10:07 am

ummm
now that is something I'd like...
a 5m strip or several to make a full wall ....
How To ask Questions :- http://www.catb.org/esr/faqs/smart-questions.html
WARNING - some parts of this post may be erroneous YMMV

1QC43qbL5FySu2Pi51vGqKqxy3UiJgukSX
Covfefe

ChrisEnglish
Posts: 13
Joined: Thu Sep 20, 2012 8:38 am

Re: RGB LED strips????

Fri Sep 21, 2012 1:46 pm

so how can one control 5meters of led strip with pwm using the pi?

mvsopen
Posts: 9
Joined: Sun Aug 26, 2012 10:38 pm

Re: RGB LED strips????

Fri Sep 21, 2012 10:37 pm

The closest thing I've found is an Adafruit tutorial: https://www.adafruit.com/blog/2012/08/1 ... spberry_pi

Her code converts a .png image into a bitmap, and then sends it to the digital RGB strip for use on a moving bike wheel. Close, but not what we're looking for. But at least it shows how to connect the strip to the Pi!

-mvs
Last edited by mvsopen on Fri Sep 21, 2012 11:05 pm, edited 2 times in total.

mvsopen
Posts: 9
Joined: Sun Aug 26, 2012 10:38 pm

Re: RGB LED strips????

Fri Sep 21, 2012 11:04 pm

I think I found something that may work:

https://github.com/trizz/PiLed

bitbitbit
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am

Re: RGB LED strips????

Mon Sep 24, 2012 9:50 am

thanks everybody.....

I succeed to control and dim a white light LED strip by using wiringPi:
https://projects.drogon.net/raspberry-p ... d-install/

and yes, I would really like to control an RGB LED strip also.....
I looked into these two links with MOSI and SCLK pin connected....

http://thegreatgeekery.blogspot.ca/2012 ... s2801.html
http://learn.adafruit.com/light-paintin ... i/software

however, I still failed to control on/off of the RGB LED strip :cry: :cry: :cry:

I see both python scripts uses spidev.write to make the LED strip change color as they wanted....
but I don't really know how to use spidev.write() function.....
I have a super short LED strip, one IC (LPD6803) and 3 LEDs on one strip.......


I tried a very very very simple code as below:::::
import RPi.GPIO as GPIO, Image, time
dev = "/dev/spidev0.0"
spidev = file(dev, "wb")
test = bytearray(12)
spidev.write(test)
......
......


actually all my LEDs are on when I connect them to Pi....
all I want to do is turn them off.....(simple step first, play with RGB later....)
so....anybody have an idea for spidev.write()??????
Thanks!!!! :cry: :cry: :cry:

jfornango
Posts: 113
Joined: Fri Sep 14, 2012 7:46 pm
Location: St. Louis, MO USA
Contact: Yahoo Messenger

Re: RGB LED strips????

Mon Sep 24, 2012 6:44 pm

I took a closer look at the link at the top of the thread.
While they are using an Arduino to control the strip, you will notice that they are using a set of MOSFETS to act as stepper switches. The Arduino sets the power scale, then the MOSFET applies the scale to the full power to the RGB strip.

In theory, you can take the RPi, pipe it into an MCP3008 (maybe a Gertboard?) and use that to drive the controller circuits shown in the diagrams. Not a lot of redevelopment needed here, just a "Fill in the blanks" exercise, really.
I'm only wearing black until they find something darker.


bitbitbit
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am

Re: RGB LED strips????

Tue Sep 25, 2012 2:45 am

mvsopen wrote:A bit on using spidev...

http://www.brianhensley.net/2012/07/get ... ry-pi.html

Thanks....I tried and the SPI is working good...... Dunno what went wrong..... :cry:

ChrisEnglish
Posts: 13
Joined: Thu Sep 20, 2012 8:38 am

Re: RGB LED strips????

Tue Sep 25, 2012 7:25 pm

I think this is what we are all trying to do,
http://www.youtube.com/watch?v=9JNBVRy0cQA
this is using the rgb analog LED's, however i dont have a 16x PWM LED Fader, would someone be able to draw up a circuit similar? ( Bad at electronics )
Cheers

bitbitbit
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am

Re: RGB LED strips????

Wed Sep 26, 2012 7:38 am

For everybody's reference.....

https://projects.drogon.net/software-pw ... pberry-pi/

Gordon's great lib.....

ChrisEnglish
Posts: 13
Joined: Thu Sep 20, 2012 8:38 am

Re: RGB LED strips????

Wed Sep 26, 2012 8:06 am

but how would i power the LED's since the Pi cant? im not 100% on electronics, Not sure how id connect the Power supply to the LED Strip along with a Mosfet?( Never used, tried looking at them on an electronics program... )
Could someone scrub up a quick diagram please,
Cheers,
C

bitbitbit
Posts: 30
Joined: Thu Aug 30, 2012 3:18 am

Re: RGB LED strips????

Wed Sep 26, 2012 9:20 am

ChrisEnglish wrote:but how would i power the LED's since the Pi cant? im not 100% on electronics, Not sure how id connect the Power supply to the LED Strip along with a Mosfet?( Never used, tried looking at them on an electronics program... )
Could someone scrub up a quick diagram please,
Cheers,
C

See::::
http://www.ladyada.net/products/rgbledstrip/

Hope that helps....

ChrisEnglish
Posts: 13
Joined: Thu Sep 20, 2012 8:38 am

Re: RGB LED strips????

Wed Sep 26, 2012 9:43 am

how come i didnt notice this before :o
thanks!

User avatar
piborg
Posts: 11
Joined: Thu May 03, 2012 8:47 am
Contact: Website

Re: RGB LED strips????

Wed Jan 09, 2013 10:52 am

Not a strip, but LedBorg www.piborg.org/ledborg will control a RGB LED. The driver does software based PWM of three I/O lines - you could adapt the software to control a LED strip if you like! (It's all open source)
PiBorg - Control robots from your Raspberry Pi at piborg.org

toxibunny
Posts: 1382
Joined: Thu Aug 18, 2011 9:21 pm

Re: RGB LED strips????

Wed Jan 09, 2013 3:43 pm

I'm doing the same thing, and when it's finally up and running, it'll be Pi>CD4050 level converter>atmega microcontroller(arduino chip)>TLC5940 chip(s)>MOSFET transistors>LED strips.

The pi will do the high-level stuff with easy-to-write python scripts, etc. passing basic control info to the atmel via GPIO serial
**the CD4050 will convert pi's 3.3v to atmel's 5v safely (and more importantly, vice-versa)**
The atmel will take serial input from the pi and use it's rock-solid timing to feed data to the LED controller(s) accurately (the controllers are kindof finicky, apparently)
The TLC5940 led controller(s) will spit out 16 channels of smooth-fading PWM to the MOSFET transistors (up to 5 R,G,B strips each (5x3 < 16)). The controllers have a cool feature in that you can easily daisy-chain them for more outputs.
The MOSFET transistors will amplify the low-power PWM signal from the chips, to make it 12 volts with enough power to drive a decent length of strip each.
The strips, by the way, will ultimately be powered by the 12 volt rail of an old computer PSU. The strips I have need about 20 watts per 3 metres, and I have about 10 metres. If I get an old low-powered PSU, say about 150-200 watts, That's comfortably enough, and a lot cheaper than a dedicated 60+ watt LED power supply.



I'm stuck at the moment though, in that I can't even figure out how to use my atmel programmer, lol. :/
note: I may or may not know what I'm talking about...

danny87
Posts: 1
Joined: Mon Jan 14, 2013 11:23 am
Contact: Website

Re: RGB LED strips????

Mon Jan 14, 2013 11:28 am

piborg wrote:Not a strip, but LedBorg http://www.piborg.org/ledborg will control a RGB LED. The driver does software based PWM of three I/O lines - you could adapt the software to control a LED strip if you like! (It's all open source)
Thanks for that link!

Calavera
Posts: 3
Joined: Tue Jan 15, 2013 6:24 pm

Re: RGB LED strips????

Tue Jan 15, 2013 6:31 pm

I initially though about using three mosfets to drive a similar RGB led-strip (5m, 30 leds/m), but since three power mostfets + a breadboard would have cost me about the same, I ordered an "I²C 3FET" board from bitwizard.nl (it was recommended in a similar thread here on the forums).

Simply connected the 4 I²C pins from the GPIO header to the 3FET board (power and ground, data and clock) and wire the strip to the screw on terminal on the 3FET board. Works like a charm and is really easy to setup. So far I couldn't spend more time on it than a little bit of playing around, but I can set the color with a simple bash script on the pi (RGB values from 0-255).

I'll post some code and pictures online when I finally get around to finishing my setup (an LED sunrise alarm clock using a pi, two halves of the strip mounted on opposing sides of the ceiling above the bed with a custom made frame similar to the one here: http://www.nycresistor.com/2012/09/16/s ... arm-clock/). Final goal is to have an android app controlling the lamp from within the local LAN (I'm more a software than a hardware guy :)).

oceanwanderlust
Posts: 3
Joined: Tue Jan 08, 2013 5:55 pm

Re: RGB LED strips????

Sat Jan 26, 2013 4:39 pm

Calvera is on the right track; SPI or I2C is the way to go. The I2C 3FET looks perfect for one strip. The Gert board looks fun but pricey for this project.

I want to do control multiple strips, so am comparing Bitwizard's SPI w/ 7 channel PWM vs Adafruit's 16 channel i2c board.

http://www.adafruit.com/products/815
http://www.bitwizard.nl/catalog/product ... ucts_id=67

So, what's better for getting multiple channel PWM from PI... I2C or SPI?

Also, I'm using these boards to drive a dozen N-Channel Mosfets from Adafruit's RGB tutorial. The Mosfets were 50c at Element when I ordered my Pi, but they skrewd me on shipping Their wiring is simple, but maybe an opportunity for me to learn board design and try out batchpcb.com

Calavera
Posts: 3
Joined: Tue Jan 15, 2013 6:24 pm

Re: RGB LED strips????

Sat Jan 26, 2013 4:54 pm

The 7FETs board is only rated for 1A max per output (the 3FETs can withstand 5A). Depending on the type and length of strips you want to use this might be handy to know ;) You should be able to use more than one 3FETs board in series (ah, the beauty of bus connections :)) as they include two I2C / SPI connectors. You'd need to reprogram the addresses of course (this is documented in bitwizward's wiki).

If you use one of them, you dont need to wire any other MOSFETs since they are already included on the board. It's really neat and simple to wire up and use pretty much right away (and also very small, I'd estimate one 3FETs board is about one third the size of a pi..).

Timn88
Posts: 2
Joined: Sat Feb 09, 2013 5:15 pm

Re: RGB LED strips????

Sat Feb 09, 2013 5:20 pm

I've tried the same as Calavera:
The 3fet board is connected via i2c with the pi, but the wiki says that the default adress of the 3fet board is 0x8a, but i thought that the adress is only 7 bit long. So "i2cdetect" is not displaying any devices. Am i doing something wrong? Or can anybody help me with that?

Calavera
Posts: 3
Joined: Tue Jan 15, 2013 6:24 pm

Re: RGB LED strips????

Sat Feb 09, 2013 6:40 pm

Did you load the kernel modules?

Code: Select all

$  lsmod | grep i2c
i2c_dev                 5620  0 
i2c_bcm2708             3759  0 
Did you wire the board up correctly? If I position the board in front of me, with the I2C connector on the right edge, the top pin (4) is connected to power, the next one (3) to P1-05 on the pi (bottom row, third pin, I²C clock), number 2 is connected to P1-03 (bottom row, second pin, I²C data) and the last one (1) to GND.

Note: in the following i2c commands, you might need to change the 0 after the -y to a 1, depending on your pi revision. If i2cdetect doesn't show any devices on the first bus (0), but does show them on the second (1), continue using the second bus.

I get the following output:

Code: Select all

$  sudo i2cdetect -y 0
     0  1  2  3  4  5  6  7  8  9  a  b  c  d  e  f
00:          -- -- -- -- -- -- -- -- -- -- -- -- -- 
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
40: -- -- -- -- -- 45 -- -- -- -- -- -- -- -- -- -- 
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- 
70: -- -- -- -- -- -- -- --        
Set the 3fet screw terminal pins to be outputs and enable pwm;)

Code: Select all

$ sudo i2cset -y 0 0x45 0x30 255; sudo i2cset -y 0 0x34 0x5F 255
Setting 0x50,0x51 and 0x52 sets the PWM value for the first, second and third (respectively) output pin of the screw terminal on the 3fet board.

Code: Select all

sudo i2cset -y 0 0x45 0x50 255
should therefor fully turn on the strip/colour connected to the first output.

Edit: Just noticed, 0x45 = 69 = 138 / 2 = 0x8a / 2 ;) I never looked up the supposed address on the wiki, I just used the one i2cdetect reported..

Return to “Automation, sensing and robotics”

Who is online

Users browsing this forum: baetis and 11 guests