Seizure-inducing Dotstar

EL Wire/Tape/Panels, LEDs, pixels and strips, LCDs and TFTs, etc products from Adafruit

Moderators: adafruit_support_bill, adafruit

Please be positive and constructive with your questions and comments.
Locked
User avatar
Peevester
 
Posts: 21
Joined: Sat Mar 07, 2015 5:08 pm

Seizure-inducing Dotstar

Post by Peevester »

I bought a full reel (4 meters, 240 lights) of dotstar LEDs. I just got around to playing around with them, and I'm having trouble getting strandtest to work right. I haven't cut up the strip yet (eventually, I'm going to make 7 pieces out of it for a display idea I have), I'm just making sure the strip behaves.

I first used the "any pin" setup (using an uno), and the whole strip just flashed like crazy without any pattern at all. So, I tried the SPI setup instead (with clock on 13 and data on 11), and I had a bit more luck. The set of lights runs the length of the strip, changing color like it should with each run, but the other lights on the strip, that shouldn't be on at all, are flashing on and off seemingly at random.

Code below. Trippy video here (Alternate video source). Any idea what's going wrong?

Code: Select all

// Simple strand test for Adafruit Dot Star RGB LED strip.
// This is a basic diagnostic tool, NOT a graphics demo...helps confirm
// correct wiring and tests each pixel's ability to display red, green
// and blue and to forward data down the line.  By limiting the number
// and color of LEDs, it's reasonably safe to power a couple meters off
// the Arduino's 5V pin.  DON'T try that with other code!

#include <Adafruit_DotStar.h>
// Because conditional #includes don't work w/Arduino sketches...
#include <SPI.h>         // COMMENT OUT THIS LINE FOR GEMMA OR TRINKET
//#include <avr/power.h> // ENABLE THIS LINE FOR GEMMA OR TRINKET

#define NUMPIXELS 240 // Number of LEDs in strip

// Here's how to control the LEDs from any two pins:
#define DATAPIN    5
#define CLOCKPIN   4
//Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS, DATAPIN, CLOCKPIN);

// Hardware SPI is a little faster, but must be wired to specific pins
// (Arduino Uno = pin 11 for data, 13 for clock, other boards are different).
Adafruit_DotStar strip = Adafruit_DotStar(NUMPIXELS);

void setup() {

#if defined(__AVR_ATtiny85__) && (F_CPU == 16000000L)
  clock_prescale_set(clock_div_1); // Enable 16 MHz on Trinket
#endif

  strip.begin(); // Initialize pins for output
  strip.show();  // Turn all LEDs off ASAP
}

// Runs 10 LEDs at a time along strip, cycling through red, green and blue.
// This requires about 200 mA for all the 'on' pixels + 1 mA per 'off' pixel.

int      head  = 0, tail = -10; // Index of first 'on' and 'off' pixels
uint32_t color = 0xFF0000;      // 'On' color (starts red)

void loop() {

  strip.setPixelColor(head, color); // 'On' pixel at head
  strip.setPixelColor(tail, 0);     // 'Off' pixel at tail
  strip.show();                     // Refresh strip
  delay(10);                        // Pause 20 milliseconds (~50 FPS)

  if (++head >= NUMPIXELS) {        // Increment head index.  Off end of strip?
    head = 0;                       //  Yes, reset head index to start
    if ((color >>= 8) == 0)         //  Next color (R->G->B) ... past blue now?
      color = 0xFF0000;             //   Yes, reset to red
  }
  if (++tail >= NUMPIXELS) tail = 0; // Increment, reset tail index
}

User avatar
Franklin97355
 
Posts: 23912
Joined: Mon Apr 21, 2008 2:33 pm

Re: Seizure-inducing Dotstar

Post by Franklin97355 »

I don't see a ground between the Uno and the strip. Do you have one?

User avatar
Peevester
 
Posts: 21
Joined: Sat Mar 07, 2015 5:08 pm

Re: Seizure-inducing Dotstar

Post by Peevester »

franklin97355 wrote:I don't see a ground between the Uno and the strip. Do you have one?
That was the most useful one-sentence response I've ever received as tech support. When I was testing the strip, I had the arduino hooked to my computer and getting power from USB, with the strip getting powered from a separate 10amp power supply. They have no ground in common when I do that, so I'm guessing the signal pin floats when it's set to low and sends random signals to the strip. Doh!

When I power the arduino and the strip both from the power supply (connecting to gnd and +5v on the uno), the strip works beautifully. When I'm programming the Uno, I just need to make sure the ground is connected to the uno, right? I don't want to feed the uno +5v on the pin from the power supply when it's connected to the computer, that makes me a little nervous.

Locked
Please be positive and constructive with your questions and comments.

Return to “Glowy things (LCD, LED, TFT, EL) purchased at Adafruit”