Go Down

Topic: Looking to hire coder for 75 second neopixel project (Read 1 time) previous topic - next topic

Cmcaron

Hello,
I'm looking for a coder who can write code for led pixels for a custom song I have. My daughter is doing a dance number and her outfit has (or will have) about 100 individually addressable pixels on it, 50 each strand. The music mix is 75 seconds long and I need the lights to flash at different times in the song.  using a small arduino "seeeduino." (That is what is marked on it)

I'd like to think I can do this myself but I have zero experience writing code and not a lot of time to learn a new skill at this time.

Thanks for your help!

PaulS

Quote
I need the lights to flash at different times in the song.
Strictly based on time? If the singer lags behind, or gets ahead, that's OK?
The art of getting good answers lies in asking good questions.

Cmcaron

The song is pre recorded so ideally when the song starts, my kid will hit a button and activate the lighting to match the song. I'm not sure if a better way exists.  The song is about color so matching the lighting to the words of the song as closely as possible would be awesome. I have already gone through and marked a list of the timing for each color. For example at two seconds all lights should be blue, at five seconds all lights should be green.  I assume once she hits the button the program will need a few seconds to boot up as well but I'm not sure on this since I do not know much about this. Once I know the timing of how long it takes for it to boot up I can plan for her to push the button then to allow proper syncing. For example when they hit play on the music I can have a beeping sound put into the very beginning so she knows push it now. Alternatively I have read that there are music controllers or something like that but I'm not sure that would make this any easier.

PaulS

Quote
Once I know the timing of how long it takes for it to boot up I can plan for her to push the button then to allow proper syncing.
The Arduino only takes a couple of seconds to boot. But, it should boot when powered on, and then sit in setup() waiting for a switch to become pressed. When that happens, setup() can end, and loop() will be called (over and over).
The art of getting good answers lies in asking good questions.

PaulMurrayCbr

The coding for this is not difficult, if you are happy for all the LEDs to be the same colour.

If you need something more elaborate, you'll have to explain what you want. Flashy rainbows are do-able. Anything is do-able, really. The main probelm is building something that will allow you to easily enter the sequence that you want. That is - you will get some templates to assemble.


Code: [Select]

Effects song[] = {
  {2, new RGB(0,0,1)}, // 2 seconds green
  {3, new FlashyRainbow()}, // 3 seconds oif flashy rainbow
  {5.5, new RGB(1,0,0)}, // 5.5 seconds red
  //
  // and you will have to fill in the rest of these
};



The other main problem is specifying exacly what you want. If you want the lights to flash from mauve to magenta at a tempo of 120BPM and a 1:3 ratio for 15 seconds, sure. But you have to be able to say what you want. I'd caution you against anything too elaborate. It's easy to get carried away and to forget that it's about your daughter, not the super cool gee-whizzery.


An issue might be the stability of the resonator on the arduino. If you rely on that rather than a RTC (which will make the project quite a bit more complex), it may be the case that temperature will throw it off. You'll have to experiment. Cope with the fact that it won't be super accurate - just verse and chorus length.


http://paulmurraycbr.github.io/ArduinoTheOOWay.html

Cmcaron

Thank you all for your input. I have a song that I need the colors to match. The tempo is not really important, what is, is that they change at the right time. So I assume when writing the code I am supposed to tell it "stay green for 1 second, then red for 1 second" or something like this?

For example, the song says "Red Light, Green Light, Gimmie everything you got. Red Light, Green Light..."

I would like the lights to turn red, when the song says red. Green on green, etc.

All in all it would look like this: (the times listed are where in the song, it would turn the color indicated)

0:00-0:05 (nothing, or maybe 1 pixel on so it knows the program has started)
0:05 Rainbow twinkle pattern (for 12 seconds)
0:17 Red Solid (1 second)
0:18 Green Solid (1 second)
0:19 Purple Solid (1 second)
0:20 Pink Solid (1 second)
0:21 Blue Solid  (1 second)
0:22 Yellow Solid  (3 seconds)
0:25 Rainbow twinkle pattern (6 seconds)
0:32 Red solid (2 seconds)
0:34 Green solid (2 seconds)
0:36 Red solid (1 second)
0:37 Green solid (3 seconds)
0:40 Red solid (1 second)
0:41 Green solid (3 seconds)
0:44 Red solid (1 second)
0:45 Green solid (4 second)
0:49 Yellow Twinkling (11 seconds)
1:00 Yellow with a different twinkling (10 seconds)
1:10 Rainbow Twinkling (10 seconds)

patduino

Hi Cmcaron,

Are you building the outfit? I'm curious about your design and power supply plans.  200 LEDs can draw some serious current (approx 20mA for each color x 3 color components x 200 = 12 Amps! Of course, single colors like RED would only draw 1/3 of that, but 4A is still a lot.

Pat
There are 10 types of people in the world, those who understand binary, and those that don't.

Cmcaron

I actually need to revise the post. I have changed the lighting since my original post.

I am now using these lights here. 2 strands for 100 total lights. http://shopping.coolneon.com/WS2812-Costume-Pixels-WS2812COSTUME
 

My total run time is 75 seconds that I need them lit. The fellow at the light store told me which battery pack would work.

I am also using a "seeeduino" (I guess that is what it is called) to program this.

I am not sure any of this makes sense. I know no lingo that is appropriate.

Cmcaron

@PaulMurryCBR

Like this?
****I need 6 seconds where program has started but lights are not flashing or maybe 1 light is just to indicate that it is working so that I know it will start on time. Not sure how to write a line for that. The lights are individually addressable)

??? When I am writing code, do things like spaces have any significance???


Effects song[] = {

  {10, new FlashyRainbow()}, // 10 seconds of flashy rainbow
  {1, new RGB(0,0,1)}, // 1 seconds red
  {1, new RGB(0,0,1)}, // 1 seconds green
  {1, new RGB(0,0,1)}, // 1 seconds purple
  {1, new RGB(0,0,1)}, // 1 seconds pink
  {1, new RGB(0,0,1)}, // 1 seconds blue
  {3, new RGB(0,0,1)}, // 3 seconds yellow
  {6, new FlashyRainbow()}, // 6 seconds of flashy rainbow
  {2, new RGB(0,0,1)}, // 2 seconds red
  {2, new RGB(0,0,1)}, // 2 seconds green
  {1, new RGB(0,0,1)}, // 1 seconds red
  {3, new RGB(0,0,1)}, // 3 seconds green
  {1, new RGB(0,0,1)}, // 1 seconds red
  {3, new RGB(0,0,1)}, // 3 seconds green
  {1, new RGB(0,0,1)}, // 1 seconds red
  {3, new RGB(0,0,1)}, // 3 seconds green
  {11, new FlashyYellow()}, // 11 seconds of flashy yellow
  {10, new FlashyYellow()}, // 10 seconds of flashy yellow
  {10, new FlashyRainbow()}, // 10 seconds of flashy rainbow
};

for the yellow's at the bottom, I would like it to flash differently. Like maybe twinkle or something.

bobcousins

I put together a simple sketch, I tested with a strip of 48 pixels, it seems to work ok. You will have to adjust it for the number of pixels you have etc.

Code: [Select]
#include <Adafruit_NeoPixel.h>

#define PIN 2

Adafruit_NeoPixel strip = Adafruit_NeoPixel(48, PIN, NEO_GRB + NEO_KHZ800);

#define COLOR(r,g,b) ( (uint32_t)r << 16) | ((uint32_t)g <<  8) | b

uint32_t BLACK = COLOR(0,0,0);
uint32_t WHITE = COLOR(255,255,255);
uint32_t RED = COLOR(255,0,0);
uint32_t GREEN = COLOR(0,255,0);
uint32_t BLUE = COLOR(0,0,255);

uint32_t PURPLE = COLOR(255,0,255);
uint32_t PINK = COLOR(255,20,147);
uint32_t YELLOW = COLOR(255,255,0);


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);
  }
}

class Pattern
{
  public:

  virtual void Init(void)
  {}  

  virtual void Run(long time)
  {}  

  static void SetAll (uint32_t color)
  {
    for (uint16_t i=0; i<strip.numPixels(); i++) {
        strip.setPixelColor(i, color);
    }
    strip.show();
  }

  static void SetSomeLeds (uint32_t color, int numberLeds)
  {
    for (uint16_t i=0; i<numberLeds; i++) {
        strip.setPixelColor(i, color);
    }
    strip.show();
  }

};

class Color : public Pattern
{
  public:
  uint32_t m_color;
    
  Color (uint32_t color)
  {
     m_color = color;
  }

  void Init (void)
  {
    Pattern::SetAll(m_color);
  }
};

class RGB : public Color
{
  public:
    
  RGB (byte red, byte green, byte blue) :
    Color (COLOR (red, green, blue))
  {}
};


class FlashyRainbow : public Pattern
{
  byte base;

  void Run (long elapsed)
  {
    uint16_t j;

    elapsed = elapsed % 400;
    
    if (elapsed < 200)
    {
      for(j=0; j<strip.numPixels(); j++)
      {
        int val = elapsed + j * 256 / strip.numPixels();
        strip.setPixelColor(j, Wheel(val % 256 ));
      }
      strip.show();
    }
    else
    {
      Pattern::SetAll(BLACK);
    }
  }
};

class FlashyYellow: public Pattern
{
  void Init (void)
  {
    Pattern::SetAll(YELLOW);
  }

  void Run (long elapsed)
  {
    elapsed = elapsed % 400;
    
    if (elapsed < 200)
    {
      Pattern::SetAll(YELLOW);
    } else {
      Pattern::SetAll(BLACK);
    }
  }
};


typedef struct {
  int time;
  Pattern *pattern;
} Effect;

Effect effects[] = {

  {10, new FlashyRainbow()}, // 10 seconds of flashy rainbow
  {1, new Color(RED)},      // 1 seconds red
  {1, new Color(GREEN)},    // 1 seconds green
  {1, new Color(PURPLE)},   // 1 seconds purple
  {1, new Color(PINK)},     // 1 seconds pink
  {1, new Color(BLUE)},     // 1 seconds blue
  {3, new Color(YELLOW)},   // 3 seconds yellow
  {6, new FlashyRainbow()}, // 6 seconds of flashy rainbow
  {2, new Color(RED)},      // 2 seconds red
  {2, new Color(GREEN)},    // 2 seconds green
  {1, new Color(RED)},      // 1 seconds red
  {3, new Color(GREEN)},    // 3 seconds green
  {1, new Color(RED)},      // 1 seconds red
  {3, new RGB(0,255,0)},    // 3 seconds green
  {1, new RGB(255,0,0)},    // 1 seconds red
  {3, new Color(GREEN)},    // 3 seconds green
  {11, new FlashyYellow()}, // 11 seconds of flashy yellow
  {10, new FlashyYellow()}, // 10 seconds of flashy yellow
  {10, new FlashyRainbow()}, // 10 seconds of flashy rainbow
  {0, NULL}
};

class EffectController
{
  Effect *m_effects;

  int m_index = 0;
  long m_start;
  
  public:

  EffectController (Effect effects [])
  {
    m_effects = effects;
  }

  void Start (void)
  {
    Serial.print ("start ");
    Serial.println();

    strip.begin();
    strip.show(); // Initialize all pixels to 'off'

    m_index = 0;
  }

  void ShowStatus (void)
  {
      Serial.print ("time ");
      Serial.print ((long)(millis()-m_start));
      Serial.print (" track ");
      Serial.print (m_index);
      Serial.println();
  }
  
  void Run (void)
  {
    long elapsed;
    long this_time = m_effects[m_index].time * 1000;

    if (m_index == 0)
      m_start = millis();
      
    if (this_time > 0)
    {
      ShowStatus();
      long track_start = millis();
      
      m_effects[m_index].pattern->Init();
      do
      {
         elapsed =  millis() - track_start;
         m_effects[m_index].pattern->Run(elapsed);
        
      } while (elapsed < this_time);
      m_index++;

      if (m_effects[m_index].time == 0)
      {
        // finished
        Serial.print ("time ");
        Serial.print ((long)(millis()-m_start));
        Serial.print (" finished");
        Serial.println();
        Pattern::SetAll(COLOR(0,0,0));
      }
    }
  }
  
};

EffectController controller (effects);

void setup() {
  int j;

  Serial.begin(115200);
  
  Pattern::SetSomeLeds (RED, 1);

  for (j=5; j>0; j--)
  {
    Pattern::SetSomeLeds (GREEN, j);
    delay (1000);
  }
  controller.Start();
}

void loop() {
  
  controller.Run();
}
Please ask questions in the forum so everyone can benefit. PM me for paid work.

Cmcaron

@BobCousins THANK YOU!!!! It is perfect. I just have to tweak the timing now.

Thank you everyone. I have learned a tremendous amount this past two weeks from never writing code, never using an Arduino, nothing to being so close to finishing this project! I managed to write some on my own to get basic functions happening and now with this addition, it is so much easier. I will post a pic if I can figure out how :)

I cannot express my gratitude enough.

Cmcaron

Last request everyone.

I bought a new shield today.
http://shopping.coolneon.com/Store-Display-name

There are two switches on it that switch from left to right. I would like to assign one as an on, off switch so that I can activate the code that way.

From my research, the switches are pin 6 and pin 7. I am not particular on which one is the on off.

Thoughts?

Thank you,
Cass

Go Up