Pages: [1]   Go Down
Author Topic: Digital LED strips - Patterns  (Read 1843 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 3
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi everyone, I am new to Arduino and am starting to figure out how it all works by doing some of the basic tutorials that come with the UNO.

What I would like to do is control the digital LED strips that I have, I have 5m of 36 LEDs/m strip and 5m of 48 LEDs/m strip. I have connected a strip and have loaded the strand test and that works nicely, but what else now?

I want to be able to create different patterns of colors to send to the strip, and build a circuit with a button that can scroll between the different patterns. My first issue is HOW to create the patterns easily???

Is there a program that can do this or help me to write the code? I have seen a thing on http://blinkiverse.com/software/patternpaint/ where you can run processing and pattern paint to draw patterns or load images to be turned into patterns, so that you can export them. I wondered weather I could use this for making patterns to send to the strip, and did not get it to work, I followed all the steps but maybe because the hardware is not a blinkyverse thing it didnt do much when I sent it to the LED strip. There was some random LEDs lit up and no movement.

What I want as an end result is to be able to build a small circuit with a couple of buttons on it, that can turn on, and scroll through different patterns on the LED strip. I'll be using an Arduino Nano for the finished result. My biggest issue right now is how to make the color patterns to put onto the strip. In the future I want to do POV patterns like with the blinkiverse site as well as normal colors and chasers etc. Is there a website or program or software that can be used to help right the code for making the different color sequences which I can load onto the arduino?

I am finding it frustrating because I have the LEDs, I have the arduino, I can load a file onto the arduino, but thats where it stops smiley-sad

Any suggestions and ideas would be very greatly appreciated

Logged

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I write my own.  These change automatically every 30 seconds, but it's easy to make it a button function:

https://www.youtube.com/watch?v=aPkuTA6Jexo
Logged

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

I like those patterns smiley
Is there a program or software that can help to design these patterns?

I know its a long shot, but is it possible for you or someone else out there to help me write a script for the strip that has say 3 patterns in it, that can change on a button press? If I see how you have written the sequences then I am hoping with 3 different types I should be able to get an good idea of what I am supposed to be doing and how they work. I could then just add more colors and patterns to the existing script right?

I have the strand test pattern for one, maybe I can modify that script to add another pattern to it with a button press?
Logged

Colorado
Offline Offline
Edison Member
*
Karma: 47
Posts: 1562
Reviving dead brain cells with Arduinos.
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I like those patterns smiley
Is there a program or software that can help to design these patterns?

Not that I'm aware of.

I know its a long shot, but is it possible for you or someone else out there to help me write a script for the strip that has say 3 patterns in it, that can change on a button press? If I see how you have written the sequences then I am hoping with 3 different types I should be able to get an good idea of what I am supposed to be doing and how they work. I could then just add more colors and patterns to the existing script right?

I have the strand test pattern for one, maybe I can modify that script to add another pattern to it with a button press?

Check out the Button example in the playground, and start playing around with it.  Figure out how to turn one LED on or off with it.  Then figure out how to add a third state, OFF.  And go on from there.

My code defines all the different patterns as individual code blocks, or functions.  The main loop for that specific display does two things:
- listens for an RF signal that tells it which pattern to display next
- continuously call that pattern

If it receives a signal, it increases a counter.  That counter represents a pattern which it then constantly calls.  The pattern itself is responsible for all the hard work.
Code:
// pseudo code
void loop() {
  if (RF signal) {   // this can be a check for a button press, an I2C signal, a sensor reacting to its environment, anything.
    // increase counter
    // remember to reset the counter back to 0 when you reach your MAX amount of patterns
  }
  displayPattern(counter);
}
This runs constantly which means the 'displayPattern' function is running constantly as well:
Code:
// pseudo code
void displayPattern(int pattern) {
  switch (pattern) {
    case 0: rainDrops(); break;
    case 1: bounceUp(); break;
    case 2: blinkies(); break;
  }
}
Each one of rainDrops(), bounceUp(), and blinkies() is a light pattern.  Each one keeps track of their own specific variables for what the string is doing.  And each one has appropriate timers in them so they're only called when they need to be updated.  The same way the BlinkWithoutDelay example does it.  So if I want the blinkies() pattern to update every 50ms, then at the top of it I add a test:
Code:
// pseudo code
void blinkies() {
  if (millis() - lastRun > 50) {
    // run pattern
    lastRun = millis();
  }
}
Now the pattern only updates every 50ms, even though it's being called with every cycle.  The majority of the cycles it's just idling.

Cheers.
Logged

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

Hi again, thanks for that information, i'll get to work starting with the basics first smiley
I am so frustrated trying to get things going, but once I get started using your code and also looking at other code like the strand test, hopefully i'll begin to get to grips with it.
If all goes well i'll put up my code and youtube the results
Logged

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

Hey, all!

Nice work on the patterns!  I, too, am beginning some programming of my own, devising my own patterns.

When I bought my strip, I started by downloading the Arduino library for the LPD8806 light strip.  In that package are a fe examples for an 'LED Belt'.  I studied how that program functions.  Once I had a handle on that I extracted the essential stuff our of it to make a single patch of my own, a modified version of the 'rainbow' patch, which cycles through the HSV circle (broken into 1560 individual color units I believe).  My second patch produces random 'stars' that will fade in from whatever background is currently running.

I would be interested to swap code, see what other people are doing.  I've made a few interesting mods to the essential functions from the example.

I'll post a video of the final running program when it's done.  I'm doing it as a light installation for a friends party.

Take care,

-g
Logged

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

Hi again, thanks for that information, i'll get to work starting with the basics first smiley
I am so frustrated trying to get things going, but once I get started using your code and also looking at other code like the strand test, hopefully i'll begin to get to grips with it.
If all goes well i'll put up my code and youtube the results

Take a look at https://github.com/philihp/Jubilee 

He includes the patterns from strandtest, etc in a sketch that allows for the control of patterns and colors using a switch/buttons.  One of the functions is for POV, although I can't figure out how to modify the POV image to fit a longer LED strip
Logged

Pages: [1]   Go Up
Jump to: