I have the WS8201 RBG and it has four
Red -Dc 5v
Blue- Clock
Green- data
Black - ground
There is an example code for ws8201 in the particle ide
But I don’t know where to connect the Clock and Data ?
It’s not explaining the pins connection in the sketch .
I did search but no one useing the ws2801 they all useing the regular one RBG that has G R B G 12 vdc
Any help I would appreciate that thanks
From the example code for WS2801 library:
// SPARK CORE SPI PINOUTS
// http://docs.spark.io/#/firmware/communication-spi
// A5 (MOSI) Yellow wire on Adafruit Pixels
// A3 (SCK) Green wire on Adafruit Pixels
So in your case it should be A3 to Clock (blue) and A5 to data
Thank u very much
One more q
If I wanna use 1 m strip or 5 m can I use the Moudle drive to boosts the amp
You’d want to power your strip separately since it will draw a lot of current. You might also want to power it in 2-3 places depending on the voltage drop. Whatever you do, don’t run the strip power through your Photon, unless you intend on damaging it.
But in this case I won’t be able to use the mix color in the app if I use separate power and relay
So if I have separate bolster for the strip and the data and clock wires to the photon it will work right ?
Yes, you can. You power the strip separately, and make sure to connect the ground to the photon. Just don’t power the strip through the Vin pin if you’re using a USB supply to power the Photon. You don’t want to pull that much power through the on-board regulator.
Response to PM, sending it public so others can profit too
Circuit I am using is very bare bone. Just a Photon, ws2801 LED string connected to A5 and A3. Mine has Clock green (A3) and Data white (A5). Strip has 3-pin connector with Data, Clock and GND. There are also 2 bare wires for power. Photon is connected to USB, LED string is powered from VIN and GND pins. GND from connector is also connected to GND on Photon.
I slightly modified example code. Lowered number of LEDs to 2 (was 25) - USB might not supply enough to power all 25 LEDs, but it is enough for couple. Also I added line to setup to light up some LEDs without need to call cloud method (it simulates what Cloud call would be). After flashing, 2 first LEDs light up pinkish color. Also sending Cloud commands works flawlessly.
Command to set color (replace XXXX with your device ID and YYYY with your access token):
curl https://api.particle.io/v1/devices/XXXX/color -d access_token=YYYY -d "args=[255,000,000]"
You get Device ID on Particle Build device selection tab and Access Token on Settings tab.
Modified example:
#include "application.h"
#include "WS2801/WS2801.h"
// ========================== CHANGED TO 2 BELOW
const int numPixel = 2;
Adafruit_WS2801 strip = Adafruit_WS2801(numPixel);
void setup() {
Spark.function("color", color);
strip.begin();
// ======================= ADDED LINE BELOW
color("[128,000,255]");
}
void loop() {
}
int color(String command) {
int red = command.substring(1,4).toInt();
int green = command.substring(5,8).toInt();
int blue = command.substring(9,12).toInt();
int i;
for (i=0; i < strip.numPixels(); i++) {
strip.setPixelColor(i, red, green, blue);
strip.show();
delay(50);
}
}