Making Images With Addressable LED Strips

The Project:
I have a strip of 104 individually addressable LED's. When a simple pushbutton is pressed, I'd like to use these LED's to create a series of images (mildly animated) to create an image of a big coin with a logo on the face, then have it 'funnel' out the bottom of the image, then stop (go blank) until the button is hit again.

I've attached a simple circuit schematic, as well as the image I'm trying to make it display.

I've fiddled around with the FastLED library and Neopixel but can't quite get it working. I've found plenty of examples of running light sequentially or groups of sequential lights, but not much on working with non-sequential groups.

I've broken the image into a series of arrays: (I'll need to add one more which is the top of the design as it starts to funnel)

int PXL1[] = {1,2,3,4,5,12,13,22,23,33,34,45,46,58,59,70,71,81,82,91,92,99,100,101,102,103}; // array controlling the Outer Ring of LEDs. Please notice the "LED 0" is the first one, not "LED 1"
int PXL2[] = {15,16,17,18,19,20,21,25,31,37,42,50,55,61,68,69,72,80,83,84,85,86,87,88}; //array controlling the Hat Outline
int PXL3[] = {27,28,29,38,40,41,51,52,53}; //array controlling the Letter B
int PXL4[] = {23,24,25,26,27,28,29,30,31,32,33,35,36,37,38,39,40,41,42,43,44}; //array controlling the top of the funnel
int PXL5[] = {48,49,50,51,52,53,54,55,56,61,62,63,64,65,66,67,68}; //array controlling the middle top of the funnel
int PXL6[] = {73,74,75,76,77,78,79,84,85,86,87,88,89}; //array controlling the Middle Bottom of the Funnel
int PXL7[] = {94,95,96,97,101,102}; //array controlling the Bottom of the Funnel


It's not clear what you are asking the forum for help with. Please read the forum guide, this might help you understand what the forum needs in order to be able to help you.

Looking at you wiring diagram, I can see several errors such as the way the button is wired, the LEDs are wired and the way the LEDs are powered. I suggest you begin with some basic tutorials such as how to use a push button and how to use ws2812 LEDs strips (Adafruit have a good one).

Ok, hopefully this is a better description of what I've got going on.

I have a long LED strip, laid out as shown in the image above (roughly a circle). I'm trying to display certain pre-defined arrays on the LED strip to create images within that circular shape.

I have tested the LED Strip and I can illuminate all the LEDs on a test from the Arduino with the supplemental power supply as shown in the wiring diagram.

circuit (5)|473x500

NOTE: For troubleshooting, I've removed the switch from the circuit and the code until I get the animation working, but I'll be adding it back into the final product.!

When I run the code, the first array correctly illuminates (a red ring around the outside), but it doesn't move on to the second set (PXL2).

Any help would be appreciated.

#include <FastLED.h>

#define LED_PIN     7
#define NUM_LEDS    104

CRGB leds[NUM_LEDS];
int PXL1[] = {1,2,3,4,5,12,13,22,23,33,34,45,46,58,59,70,71,81,82,91,92,99,100,101,102,103}; // array controlling the Outer Ring of LEDs. Please notice the "LED 0" is the first one, not "LED 1"
int PXL2[] = {15,16,17,18,19,20,21,25,31,37,42,50,55,61,68,69,72,80,83,84,85,86,87,88}; //array  controlling the Hat Outline
int PXL3[] = {27,28,29,38,40,41,51,52,53}; //array controlling the Letter B
int delayval = 50; // Here we set a delaytime

int i;  // counting variable

int z = 26; //Number of LEDs in PXL1
int y = 24; //Number of LEDs in PXL2
int x = 9; //Number of LEDs in PXL3

void setup() {

  FastLED.addLeds<WS2812, LED_PIN, GRB>(leds, NUM_LEDS);
  FastLED.setDither( 0 ); // helps with dimming jitters

}

void loop() {

for (i = 0; i < z; i++)
  {
  leds[PXL1[i]] = CRGB(255, 0, 0);
  FastLED.show();
  delay(100);  
  }
  for (j = 0; j > y; j++)
  {
  leds[PXL2[i]] = CRGB(0, 255, 0);
  FastLED.show();
  delay(100);
  }
  for (k = 0; k > x; k++)
  {
  leds[PXL3[i]] = CRGB(0, 0, 255);
  FastLED.show();
  delay(100);
}
}

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.