Pages: [1]   Go Down
Author Topic: New Strand of ws2801 leds  (Read 1155 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I am probably trying to learn to many things at once. I have an Arduino UNO board  that I am trying to use to control a strip of ws2801 leds. I downloaded the Adafruit ws2801 library and was hoping that I would be able to get the small LEDstrandtest app to work. No such luck.

I  edited the code to point to the lines I wanted to use; 13 for clock and 11 for data. Specified the number of LEDs as 2.  upload hte code and nothing. If I understand everthing, the 2 LEDs should ahve cycled per the small program in the loop subroutine.

Unfortunately one of the LED turns blue (2nd led) and the other (first led) never turns on.

AWold anyone have any thoughts on what I could be doing wrong? Apprecaite any help
Logged

Offline Offline
Sr. Member
****
Karma: 12
Posts: 380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It's a bit hard without you posting your code.
Logged

Do not IM me. I will not respond. Ask questions in the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yes. that certainly would help.
 
Here is my latest attempt using the fastSPI library

Code:
#define FORCE_SOFTWARE_SPI
#define FORCE_SOFTWARE_PINS
#include "FastSPI_LED2.h"

///////////////////////////////////////////////////////////////////////////////////////////
//
// Move a white dot along the strip of leds.  This program simply shows how to configure the leds,
// and then how to turn a single pixel white and then off, moving down the line of pixels.
//

// How many leds are in the strip?
#define NUM_LEDS 2

// Data pin that led data will be written out over
#define DATA_PIN 6

// Clock pin only needed for SPI based chipsets when not using hardware SPI
#define CLOCK_PIN 13

// This is an array of leds.  One item for each led in your strip.
CRGB leds[NUM_LEDS];

// This function sets up the ledsand tells the controller about them
void setup() {
// sanity check delay - allows reprogramming if accidently blowing power w/leds
    delay(2000);

      // Uncomment one of the following lines for your leds arrangement.
      // FastLED.addLeds<TM1803, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1804, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<TM1809, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastSPI_LED2.addLeds<WS2811, DATA_PIN, GRB>(leds+18, NUM_LEDS/3);
      // FastLED.addLeds<WS2811, 8, RGB>(leds + 225, NUM_LEDS/4);
      // FastLED.addLeds<WS2812, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2812B, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<NEOPIXEL, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<WS2811_400, DATA_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<UCS1903, DATA_PIN, RGB>(leds, NUM_LEDS);

      // FastLED.addLeds<WS2801, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, RGB>(leds, NUM_LEDS);
      //FastLED.addLeds<LPD8806, RGB>(leds, NUM_LEDS);

      FastLED.addLeds<WS2801, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<SM16716, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
      // FastLED.addLeds<LPD8806, DATA_PIN, CLOCK_PIN, RGB>(leds, NUM_LEDS);
}

// This function runs over and over, and is where you do the magic to light
// your leds.
void loop() {
   // Move a single white led
   for(int whiteLed = 0; whiteLed < NUM_LEDS; whiteLed = whiteLed + 1) {
      // Turn our current led on to white, then show the leds
      leds[whiteLed] = CRGB::White;

      // Show the leds (only one of which is set to white, from above)
      FastLED.show();

      // Wait a little bit
      delay(1000);

      // Turn our current led back to black for the next loop around
      leds[whiteLed] = CRGB::Black;
   }
}
Logged

Offline Offline
Sr. Member
****
Karma: 12
Posts: 380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I haven't tried this strip or this library, but I note this in the library instructions:

"Note for people using sparkfun's ws2801 led strips - you need to call FastSPI_LED.setDataRate(1) before calling init/start. The library defaults to a data rate of 0 for ws2801 strips, which is valid for the chips on the 12v strips, but not on the 5v strips (or, at least, the 12v strips that I have here) - it's too fast and you get weird random flashing occuring. "

So you might want to try adding that call in your setup() method.

BTW, in your description above you say data is on PIN 11, but your code has it on PIN 6. One of these is incorrect.
« Last Edit: December 11, 2013, 09:44:49 pm by arduinodlb » Logged

Do not IM me. I will not respond. Ask questions in the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Yeap. Copy & paste error. It is on pin 11.

I tried adding a call to FastSPI_LED.setDataRate(1) but that is undefined. A search of the header indicated there was nothing similar. Perhaps a difference between FastSPI_LED2 and  FastSPI_LED?

I have run a couple of checks on the Arduino Uno and other programs that don't use the LED strip seem to work as expected. Just can't control the LED strip.

I tried a couple of other ws2801 libraries (adafruit version) and have the same behavior. The best I can get is one LED to light up usually in blue.

Ian
Logged

Offline Offline
Sr. Member
****
Karma: 12
Posts: 380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I tried adding a call to FastSPI_LED.setDataRate(1) but that is undefined. A search of the header indicated there was nothing similar. Perhaps a difference between FastSPI_LED2 and  FastSPI_LED?

Ahhh. Right you are. Sorry, wrong library.
Logged

Do not IM me. I will not respond. Ask questions in the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

No problem.> Appreciate you taking the time to postulate.

Anyway I figured our the problem. As expected stupid mistake. I didn't realie the strips were directional .I was connecting to the wrong end of the strip.

Take Care.
Logged

Offline Offline
Sr. Member
****
Karma: 12
Posts: 380
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Ahhh. Nice one. Glad you got it working,
Logged

Do not IM me. I will not respond. Ask questions in the forum.

Offline Offline
Newbie
*
Karma: 0
Posts: 11
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

It is funny. When I first hooked it up, I was wondering how the LED strip would figure out which LED to light. Now that I have hooked it up correctly, it is obvious how it does it.

Ian
Logged

Pages: [1]   Go Up
Jump to: