ASSIGNMENT #1 - KINETIC ENERGY

Part 1 -

David, Tim & I met to over possible ideas and work on the first exercise, which was to light up an LED using kinetic energy.

Part 2 -

Our final group consisted of Tim, Rashida and I - it was really awesome working with them! After considering many possible ideas (i.e. a hoola hoop with LED’s going around it), Tim brought up how the functionality of a clock, in particular how the handles could serve to generate a response, could work to our advantage. With this in mind, we decided to create a “Chore Wheel” for the ITP kitchen.

43a957bf-b793-4438-b3be-6778912bea96.JPG

Fabrication:

We bought a clock from K-mart and started deconstructing it. We took the numbers off and handles off and discussed how we could use this existing product to our advantage. We measured the clock and ordered the parts. Initially were going to work with a stepper motor but, after talking to David Rios, decided a geared DC motor would be best.

We designed our clock face on Illustrator, then laser cut & etched it.

e506fe01-9d8c-4901-9269-27e4072ecd43.JPG

Circuit:

As for the circuit, we started by making sure we could generate enough energy to light up 6 LED’s, using the rectification circuit from class. Because of our desired functionality for this product, it was important for us to control the behavior of the LED’s but we didn’t want to overcomplicate the circuit. Rashida suggested we used an ATTiny 85 as she had some experience using them before. Referencing her previous documentation (it’s very useful and complete), we added a “blinking” code to one LED. Then we moved to a neo pixel strip.

The final circuit consisted of:

  • Rectifying circuit

  • Capacitor

  • LM7805 voltage regulator

  • NeoPixel strip

Code:

Tim worked on the code below.

* In order to properly randomize our function needed to include randomSeed(analogRead(2)); to our setup().

#include <Adafruit_NeoPixel.h>

#define NUM_LEDS 51
#define STRIP_PIN 3 // change that

unsigned int timeStamp = 0; // milliseconds
int timePeriod = 200; // milliseconds
byte LEDPosition = 0;
byte nextNum = 0;
byte chance = 2; // 2%
bool active = true;

Adafruit_NeoPixel pixels = Adafruit_NeoPixel(NUM_LEDS, STRIP_PIN, NEO_GRB + NEO_KHZ800);

void setup() {
  pixels.begin();
  delay(10);

  randomSeed(analogRead(2));
  delay(2); 
  timePeriod = random(30,150);

}

void loop() {
  if (millis() - timeStamp >= timePeriod && active){
    pixels.clear();
    delay(10);
    if (LEDPosition >= 0 && LEDPosition <= NUM_LEDS-5) {
      pixels.setPixelColor(LEDPosition, pixels.Color(255,255,255));
      pixels.setPixelColor(LEDPosition+1, pixels.Color(255,255,255)); 
      pixels.setPixelColor(LEDPosition+2, pixels.Color(255,255,255)); 
      pixels.setPixelColor(LEDPosition+3, pixels.Color(255,255,255));
      pixels.setPixelColor(LEDPosition+4, pixels.Color(255,255,255));
      pixels.setPixelColor(LEDPosition+5, pixels.Color(255,255,255));
    } else {
      pixels.setPixelColor(LEDPosition, pixels.Color(255,255,255));
      for(int i=1; i<=5; i++){
        nextNum = LEDPosition+i;
        
        if (nextNum > NUM_LEDS){
          nextNum-=NUM_LEDS+1;
        }

        pixels.setPixelColor(nextNum, pixels.Color(255,255,255));
      }
    }
    pixels.show();
    LEDPosition++;
    if (LEDPosition == NUM_LEDS+1) {
      LEDPosition = 0;
    }
    if (random(0,100) <= chance){
      active = false;
    }
    timeStamp = millis();
  }
}