Adafruit Neopixel Library [PORTED]

Used A5 as suggested above.

Yes, used the library. Powers the first 20 or so, but not the rest (yes defined 90 leds in code) - The power supply is 5V/10A and like i said, this all worked great with the UNO.

Can you share your code here with this syntax? The connection is right since itā€™s lighting up the 1st 20! :smiley:

 ```cpp

paste code here

Using the example from the library:

    /*
 * This is a minimal example, see extra-examples.cpp for a version
 * with more explantory documentation, example routines, how to 
 * hook up your pixels and all of the pixel types that are supported.
 *
 */

#include "application.h"
//#include "spark_disable_wlan.h" // For faster local debugging only
#include "neopixel/neopixel.h"

// IMPORTANT: Set pixel COUNT, PIN and TYPE
#define PIXEL_PIN A5
#define PIXEL_COUNT 90
#define PIXEL_TYPE WS2812B

Adafruit_NeoPixel strip = Adafruit_NeoPixel(PIXEL_COUNT, PIXEL_PIN, PIXEL_TYPE);

void setup() 
{
  strip.begin();
  strip.show(); // Initialize all pixels to 'off'
}
void loop() 
{
  rainbow(20);
}

void rainbow(uint8_t wait) {
  uint16_t i, j;

  for(j=0; j<256; j++) {
    for(i=0; i<strip.numPixels(); i++) {
      strip.setPixelColor(i, Wheel((i+j) & 255));
    }
    strip.show();
    delay(wait);
  }
}

// Input a value 0 to 255 to get a color value.
// The colours are a transition r - g - b - back to r.
uint32_t Wheel(byte WheelPos) {
  if(WheelPos < 85) {
   return strip.Color(WheelPos * 3, 255 - WheelPos * 3, 0);
  } else if(WheelPos < 170) {
   WheelPos -= 85;
   return strip.Color(255 - WheelPos * 3, 0, WheelPos * 3);
  } else {
   WheelPos -= 170;
   return strip.Color(0, WheelPos * 3, 255 - WheelPos * 3);
  }
}

Is it not because the signal is 3.3V?
Should i be using a logic level shifter instead?

Opps sorry but the PR was incorrect as pointed out by @BDub.

We need to figure out why only 20 leds lighted up!

Doh! Will try - why on earth the example doesnt pass in variable ! ? hehe

Thanks, would help if i read code. Will give it a bash tonight

1 Like

Made the update with this commit: https://github.com/technobly/SparkCore-NeoPixel/pull/6

1 Like

Iā€™ll look into this just as soon as I canā€¦ it might be tomorrow though :wink: Iā€™ll report back then.

Been testing the v0.0.5 version of the NeoPixel library and I haven't had any problem driving up to 54 pixels. I didn't try beyond that but perhaps there is a bad trace on your pixel strip, or other type of wiring issue? Do you have a different strip to try?

The thread doesnt flow because kennethlincp has edited his posts.

The reason why only 20 were working is because the ledcount was not being passed through. I updated and its now lighting up more LEDs.

Lights up over 100 but getting erratic behaviour. Will do some more testing and report back

Oh, just read through the commit.

p.s. The other change ive made is using Shield Shield which is 5V i understand. Maybe thats why things are working ever so slightly better, but not perfect.

Once the data goes through the first pixel wouldnā€™t it be at the right level between the pixels?

Maybe try loading the message torch code and setting it to lamp mode and see if you get the glitches? that eliminates the hardware at leastā€¦

I drive 720 pixels off the A5 pin directly without level shiftingā€¦ and there are many spark people that do it successfully tooā€¦

1 Like

Thanks. So assume you use Spark without level shifting or Shield Shield. A5 and Ground connected to LEDs, then LEDs powered through separate power supply?

my setup is exactly like your picture above, except i also use the 5v to power the core through the vin pin. but that shouldnā€™t make any difference.

sounds like it could be a timing issueā€¦

try the code from here, its very well tested and would be a good test for your LED stripā€¦

Any advice on what best way is to extend various cables between powersupply/SparkCore and first pixel?

Hereā€™s my recommended wiring for neopixels:

There are many level shifters you can use for neopixels, but I donā€™t recommend the Shield Shield for the simple reason that you will likely add several inches of wire between the Shield Shield and the neopixels input and with the TI bi-directional drivers on the Shield Shieldā€¦ they are known to oscillate if you donā€™t keep your connections short.

4 Likes

Is there a way to modify your example above to use the external power supply to power both the Neopixels and the Spark Core? I tried connecting my 5V, 2A external power supply to VIN and disconnected the USB, but it caused a lot of flickering. Any clue as to why that is happening? It works fine when I use the USB with the external power to power my 60 LED Neopixel strip as you have in your example.

Try adding a capacitor near the core across Vin and Gnd to see if thatā€™s better.

The power supply might not be that ā€œcleanā€ or the strips are drawing close to 2A in addition to 300mA by the core, causing some flickering :slight_smile:

1 Like

@hohoho are you using a level shifter as pictured above? If not that is likely the cause of your flickering. If you are, then as Kenneth suggests you might need more capacitance on the input. I suggest 1000uF.

You can power the Core from the same external 5V supply that is hooked to pin 14 of the level shifter. Just hook that 5V to VIN on the Core. If you have to reprogram your Core via USB, I would suggest disconnecting the 5V from VIN first.

1 Like

Thanks for your help! It works as expected now.

Somehow, replacing the jumper wires with normal wires fixed the issue, which doesnā€™t quite make sense to meā€¦ To clarify, by ā€œflickeringā€ I meant that I was seeing something similar to what carldanley (above) was seeing. https://vine.co/v/h3T0jqMUJgK

I already had a level shifter and a capacitor wired in. My working setup below: