I recently purchased a pi and a string of individually addressable rgb led lights from shenhzen kapata (actually amazon, but they're the ones who sell it) and I'm trying to control it with my raspberry pi.
First a bit about my setup:
I have node compiled and installed and am using the pi-spi module to send a buffer through the spi. Documentation for that can be found at https://www.npmjs.com/package/pi-spi. My pi model is the B+ and I've connected the Data In (DI)
lead from the lights to pin 19 (GPIO10 SPI0_MOSI)
and the clock in (CI)
to pin 23 (GPIO11 SPI0_SCLK)
using alligator clips. I have spi enabled, and I know the node spi module is working, because connecting pin 19 (SPI0_MOSI)
to pin 21 (SPI0_MISO)
, and sending a buffer of "hello world!" returns the same buffer back to me. I'm using another helper module called raspberrypixels which takes values for rgb, and the number of pixels in your strand * 3 (for rgb) and creates a hex buffer to send to the lights. My lights are 5 meters long and have 150 rgb led clusters, so 450 leds in total. The IC chip is LPD6803 which I believe is SPI compatible. A link to the lights here
My Problem
My issue is that I can't get the lights to behave in any predictable way. For instance, sending a buffer of
<Buffer ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ff ff 00 ...>
450 elements long I would expect to turn every light in the strand yellow
ff (255) red, ff (255) green and 00 blue
but it has no effect. However sending a random string of data will turn some of the lights different colors. I have no way of predicting what works and what doesn't.
Does anyone have any experience with this kinda thing? I know I could use the pi-blaster module, but my lights don't have specific r,g,b leads, just data and clock. Also I want to control these via a web interface, hence Node.
This is the actualy code I'm using to test
var SPI = require('pi-spi');
var spi = SPI.initialize("/dev/spidev0.0"),
Pixel = require('raspberrypixels'),
test = Buffer("Hello, World!");
// console.log(Pixel);
var PIXEL = new Pixel.PixelBuffer(150);
PIXEL.fillRGB(255,255,0);
test = PIXEL.get();
console.log(test);
console.log(test.length);
// reads and writes simultaneously
spi.transfer(test, test.length, function (e,d) {
if (e) console.error(e);
else console.log("Got \""+d.toString()+"\" back.");