»
«


This weekend Barry and I found ourselves in a Dollar Tree store– one of the greatest places known to man.

We picked ourselves up some toys to play with, all for a dollar:

That plush guy had the face of a beagle, but the body of a centipede, perfect for segmented lighting! You can also see our prototype, and the weird kaleidoscope plastic things we used in his back.

We named that friendly fellow the Beaglepede, after the obvious portmanteau, and decided to actualize his inner nature: warm and glowing. So we took those weird disco lanterns and a few LEDs  and made the little guy shine.

The code we used can be found down below. Basically it reads from a button, which changes the state between off and glowing each LED in sequence. The circuit is similarly simple, the diagram also can be found below.

What I think is particularly cool about this project, is that the most expensive parts(barring the maple), were the LEDs, and the most eye-catching parts were essentially found. It’s also a fairly simple and quick project (an evening for two people) that pretty much anyone can make, but it’s still fun and exciting to finish.
So, onward to dollar stores and thrift stores alike! Deconstruct and reconstruct your own Shellyesque army of franken-hacks! Godspeed and good luck!

Continue for code and schematic…

Here’s the code:

//Code for Mr. Blinkie, AKA the psychedelic beaglepede
//July 17 2010
//Written by Hadley Piper

int state = 0;     // we declare these here so they can be accessed globally, 
int button = 0;    // meaning in different functions.

void wave(){        // this is the function that controlls the light
  int i;
  int j;            // counter variables
          //we put the LED's sequentially in pins 5-9 for looping convenience
  for (i = 5; i< 10; i++){ // i counts the LED pin
    if (digitalRead(button) == HIGH){  //check for button press
      state = 0;
      break;
    }
   if (state == 0) break; //check if button was pressed during inner loop
     for (j = 0; j<=50050; j+=350){ //loop to fade each LED on
     analogWrite(i,j); //set pin i to pwm duty cycle j
      delay(1); //small aesthetic delay
      if (digitalRead(button) == HIGH){ //another check for button press
        state = 0;
        break;
      }
    }
    delay(100); //let the light stay on for a bit
    for (j = 50050; j>=0; j-=350){ //loop to fade each LED off
      analogWrite(i,j); //set pin i to pwm duty cycle j
      delay(1); //small aesthetic delay, again
      if (digitalRead(button) == HIGH){ //last check for button press
        state = 0;
        break;
      }
    }
    delay(100); //third aesthetic delay
  }
}

void setup(){
  pinMode(5, PWM);  //set the LED pins to PWM
  pinMode(6, PWM);
  pinMode(7, PWM);
  pinMode(8, PWM);
  pinMode(9, PWM);
  pinMode(button, INPUT); //set button pin to input
}

void loop(){
  if (state == 0 ){       //turn all LED's off in resting state
    analogWrite(5, 000);
    analogWrite(6, 000);
    analogWrite(7, 000);
    analogWrite(8, 000);
    analogWrite(9, 000);
    if (digitalRead(button) == HIGH){ //check to see if button was pressed
      state = 1;
      delay(500);
      SerialUSB.println("I am the Great BEAGLEPEDE!!"); //a sign of things to come
    }
  }
  if (state == 1){ //if the button is in state 1, call the wave function
    wave();
    if (digitalRead(button) == HIGH){ //check for button press and reset to state 0
      state = 0;
      delay(500);
    }
  }
}

And here’s the schematic:

Ignore the letters on the right… they’re not related to the diagram.

I’m excited to have the beaglepede around because I think he’s going to be a cool visualizer…there’s lots of things you can do with a row of LEDs!

Bye bye, Beaglepede.


»
«
This entry was posted by hadley on Sunday, July 18th, 2010 at 8:58 pm. You can follow any responses to this entry through the RSS 2.0 feed. Both comments and pings are currently closed.

3 Responses


  1. Written by David R
    on July 19, 2010 at 1:02 am
    Permalink

    Cute…but don’t you think a 72MHz ARM is a bit overkill to read a button and flash some LEDs ;)

  2. Written by x893
    on July 19, 2010 at 1:38 am
    Permalink

    It’s a cool. may be use small form factor board based on Atom Intel and more complex algoritm for leds ?

  3. Written by hadley
    on July 19, 2010 at 2:05 am
    Permalink

    To David, yeah totally, but that’s all I had!

    I’m going to get a small mic and make a spectrum analyzer [partitioning the space into the 5 LEDs], and then make some more interesting patterns from there. Actually there are about a million things I want the beaglepede to signal, but that’s where I’m starting. =]



Contact webmaster@leaflabs.com with website issues

Powered by WordPress, nginx, Linux, and coffee.

This site intended to be valid HTML 4.01 Strict. Best viewed with any standards-compliant browser.

Copyright LeafLabs, LLC, ©2009-2011.
Unless otherwise noted, all content on this website is released under the Creative Commons Attribution Licence 3.0

Hello Anonymous! Login?