Updates from November, 2011 Toggle Comment Threads | Keyboard Shortcuts

  • mayaweinstein 10:06 pm on November 4, 2011 Permalink | Reply  

    Mr Pumpkin Head 

    Mr Pumpkin Head is an interactive jack-o-lantern who gets angry if you wake him. When he is ‘sleeping’ his eyes fade in and out and his mouth is still. If you remove his top the motion sensor is triggered and he wakes up, his eyes stop flashing and his nostrils flare. If you shake his top he gets angry and his teeth flash red.


    int pirPin = 12; //digital 2
    int brightness = 0;
    int fadeAmount = 5;
    int ledEyes = 11;
    int ledNose = 10;
    const int tiltSensorPin = 8;
    const int ledTeeth = 7;
    const int ledMouth = 4;

    void setup(){
    Serial.begin(9600);
    pinMode(pirPin, INPUT);
    pinMode(ledNose, OUTPUT);
    pinMode(ledEyes, OUTPUT);
    pinMode(tiltSensorPin, INPUT);
    digitalWrite(tiltSensorPin, HIGH);
    pinMode(ledTeeth, OUTPUT);
    pinMode(ledMouth, OUTPUT);
    }

    void loop(){
    if(digitalRead(tiltSensorPin)){
    digitalWrite(ledTeeth, HIGH);
    digitalWrite(ledMouth, LOW);
    }else{
    digitalWrite(ledTeeth,LOW);
    digitalWrite(ledMouth, HIGH);
    }

    analogWrite(ledEyes, brightness);
    brightness = brightness + fadeAmount;
    if(brightness == 0 || brightness == 255) {
    fadeAmount =-fadeAmount;
    }
    delay(30);

    int pirVal = digitalRead(pirPin);
    analogWrite(ledNose, LOW);

    //pinMode(pirPin, INPUT);
    //digitalWrite(pirPin, HIGH);

    if(pirVal == LOW){ //was motion detected
    Serial.println(“Motion Detected”);
    analogWrite(ledNose, HIGH);
    delay(2000);
    }
    if(pirVal == HIGH) {
    analogWrite(ledNose, LOW);
    }

    }

     
  • danSelden 3:49 pm on November 4, 2011 Permalink | Reply  

    protoPumpkin… 

    Well… the protoPumpkin was off to a great start despite being fairly different than it’s original concept.  Instead of moving panels, I used one servo motor inside to spin a disk which held the various LEDs.  An IR sensor on front would “agitate” the pumpkin, sending the pumpkin from a state of rest (breathing red LEDs) to a state of agitation, a swatch array of LEDs spiraling around its center. After a few loops it would return to its resting state. In addition, the stem acts as a potentiometer, spinning the disk and creating an even more dynamic effect on the front.  See pictures and videos.

    Unfortunately construction was far from perfect and I ran into some major obstacles. Some of which were not completely apparent until final assembly.  The code worked perfectly… but due to the size of the disk, a bizarre servo, and a poorly constructed internal structure (due mainly to the challenges of working inside a pumpkin), the disk and soldered wires kept snagging on each other, eventually tangling, destroying crucial pieces of the pumpkin. Without a functioning IR sensor or the breathing lights… protoPumpkin has unfortunately been reduced to an array of colorful LEDs and a finicky servo motor. For now I’m content to consider it a prototype.

    [update] after poking around during class, I discovered a questionable soldering connection for the sensor. Excited, since for some reason the red lights only work if the sensor works, I figured if the connection was made everything would be back up and running… and sure enough after clipping the ground cable to the sensor and resetting its contact with the ground wafer, everything came back online.  Still had obvious issues with the spinning disk and sure enough after a few demonstrations, two more wires were torn from their solder (once again killing the sensor and an additional LED). It was a great first run though and a great learning experience in terms of building within a decaying fruit.






    and my code:

    /*Proto-Pumpkin
      pComp*/
    
    #include <Servo.h>
    
    Servo myservo; 
    
    int potPin = A1;   //analog pin used to connect the potentiometer
    int val;  //variable to read the value from the analog pin
    
    int timer = 500;
    int sensorPin = A0;
    int sensorValue = 0;
    int ledPin = 11;
    
    int brightness = 0;    // how bright the LED is
    int fadeAmount = 3;    // how many points to fade the LED by
    
    boolean arraySwitch = false;
    
    int pinArray[] = { //array of pins for colorful lights
      10,9,8,7,6,5,4,2
    };
    int counter=0;
    int count=0;
    
    void setup () {
      Serial.begin (9600);
      pinMode(ledPin, OUTPUT);
      pinMode(sensorPin, INPUT);
      myservo.attach(3);  //attaches the servo on pin 3
    
      for(int count=0; count<8; count++){
        pinMode(pinArray[count], OUTPUT);
      }
      delay (2000); // it takes the sensor 2 seconds to scan the area around it before it can detect presence.
    }
    
    void loop (){
    
      Serial.println (sensorValue);
    
      val = analogRead(potPin);  //reads value of potentiometer
      val = map(val, 0, 1023, 0, 179);  //scale it to use with servo
      myservo.write(val);
    
      sensorValue = analogRead(sensorPin);
      if(sensorValue > 160){
        arraySwitch = true;
      }
      if(arraySwitch == true){
        lightFade();
        counter++;
        if(counter >= 5){   //control how long agitation lasts
          arraySwitch = false;   //turn led array off
          counter = 0;   //reset counter
          brightness = 0;   //reset brightness
         fadeAmount = 5;    //reset fadeamount 
        }
      }
      else {
        lightGlow();
      }
    
    }
    
    //CIRCULAR LED ARRAY
    void lightFade(){
      int counter = 0;
      for(int i=0; i<10; i++){
        digitalWrite(pinArray[i],HIGH);
        digitalWrite(pinArray[i-2],LOW);
        delay(80);
      }
    }
    
    //BREATHING RED LIGHTS
    void lightGlow(){
     analogWrite(ledPin, brightness);
      brightness = brightness + fadeAmount;
      if (brightness == 0 || brightness == 255) {
        fadeAmount = -fadeAmount ;
      }
      // wait for 30 milliseconds to see the dimming effect
      delay(30);
    }
     
  • mónica arias. 12:02 pm on November 4, 2011 Permalink | Reply  

    the mac-o-lantern is alive! 

    The mac-o-lantern thinks it has a little Pentium heart <3. So to light up your pumpkin you need to treat it just like a computer. When you’re not using it, it’s in sleep mode, fading in and out (breathing). To wake it up  you need to push its right patch, and a white light will turn on (simulating when it’s on). Then it has a little mouse. When you move it over the switch, it will connect to the internet (dial-up connection tones). Then, you need to click the button on its left patch, and it will download the Halloween software. A beeping sound indicates when the download is done. When it finishes downloading… you can now turn off the lights and the pumpkin will light on, and it will be ready to light up the night!

    This slideshow requires JavaScript.

    The connections:

    And here’s my baby code:

    
    // DECLARE BREATHE
     int ledBreathe = 6;
     int buttonPin = 3; // the number of the pushbutton pin
     int buttonState = 0; // variable for reading the pushbutton status
     int brightness = 0; // how bright the LED is
     int fadeAmount = 5; // how many points to fade the LED by
    
    // DECLARE REED + SPEAKER SWITCH
     int reedPin = 2; // the number of the reed switch pin
     int reedState = 0; // variable for reading the reed status
     int speaker = 8;
    
    // DECLARE BUTTON CLICK
     int buttonStateD = 0; // variable for reading the pushbutton status
     int buttonPinD = 13; // the number of the pushbutton pin
     int ledGreen1 = 4; // the number of the LED pin
     int ledGreen2 = 5; // the number of the LED pin
     int ledGreen3 = 12; // the number of the LED pin
     int ledGreen4 = 7; // the number of the LED pin
    
    // DECLARE LIGHT SENSOR
     int analogPin = 0;
     int ledFire1 = 10;
     int ledFire2 = 9;
     int ledFire3 = 11;
     int val = 0;
    
    // -------------------------------------------------------------
     // -------------------------------------------------------------
    
    void setup(){
     Serial.begin(9600);
     // BREATHE
     pinMode(ledBreathe, OUTPUT);
     pinMode(buttonPin, INPUT);
    
    // REED SWITCH
     pinMode(speaker, OUTPUT);
     pinMode(reedPin, INPUT);
    
    // BUTTON CLICK
     pinMode(ledGreen1, OUTPUT);
     pinMode(ledGreen2, OUTPUT);
     pinMode(ledGreen3, OUTPUT);
     pinMode(ledGreen4, OUTPUT);
     // initialize the pushbutton pin as an input:
     pinMode(buttonPinD, INPUT);
    
    // LIGHT SENSOR
     pinMode(ledFire1, OUTPUT);
     pinMode(ledFire2, OUTPUT);
     pinMode(ledFire3, OUTPUT);
    
    }
    
    // -------------------------------------------------------------
     // -------------------------------------------------------------
    
    void loop(){
    
    // LIGHT SENSOR
     val = analogRead(analogPin); // Read the value (amount of light) from photocell
     Serial.println(val);
     click();
     breathe();
     sound();
    
    if(val
    
    digitalWrite(ledGreen1, LOW);
     digitalWrite(ledGreen2, LOW);
     digitalWrite(ledGreen3, LOW);
     digitalWrite(ledGreen4, LOW);
     analogWrite(ledFire1, random(120)+135);
     analogWrite(ledFire2, random(120)+135);
     analogWrite(ledFire3, random(120)+135);
     delay(random(100));
     Serial.println("high");
     }
    
    else{
    
    analogWrite(ledFire1, LOW);
     analogWrite(ledFire2, LOW);
     analogWrite(ledFire3, LOW);
     Serial.println("low");
     }
    
    }
    
    /* -------------------------------------------------------------
     ALL THE MAC-O-LANTERN FUNCTIONS
     ------------------------------------------------------------- */
    
    // BREATHE FUNCTION
     void breathe(){
     buttonState = digitalRead(buttonPin);
    
    if (buttonState == LOW){
     analogWrite(ledBreathe, brightness);
     brightness = brightness + fadeAmount;
     if (brightness == 0 || brightness == 255) {
     fadeAmount = -fadeAmount ;
     }
     delay(30);
     }
    
    if (buttonState == HIGH) {
     digitalWrite(ledBreathe, HIGH);
     delay(5000);
    
    }
     }
    
    // -------------------------------------------------------------
    
    // CLICK FUNCTION
     void click(){
    
    buttonStateD = digitalRead(buttonPinD);
    
    if (buttonStateD == HIGH) {
    
    digitalWrite(ledGreen1, HIGH);
     delay(1000);
     digitalWrite(ledGreen2, HIGH);
     delay(2000);
     digitalWrite(ledGreen3, HIGH);
     delay(3000);
     digitalWrite(ledGreen4, HIGH);
     delay(1000);
     digitalWrite(ledGreen1, LOW);
     digitalWrite(ledGreen2, LOW);
     digitalWrite(ledGreen3, LOW);
     digitalWrite(ledGreen4, LOW);
     delay(500);
     digitalWrite(ledGreen1, HIGH);
     digitalWrite(ledGreen2, HIGH);
     digitalWrite(ledGreen3, HIGH);
     digitalWrite(ledGreen4, HIGH);
     delay(500);
     digitalWrite(ledGreen1, LOW);
     digitalWrite(ledGreen2, LOW);
     digitalWrite(ledGreen3, LOW);
     digitalWrite(ledGreen4, LOW);
     delay(500);
     digitalWrite(ledGreen1, HIGH);
     digitalWrite(ledGreen2, HIGH);
     digitalWrite(ledGreen3, HIGH);
     digitalWrite(ledGreen4, HIGH);
     delay(500);
     digitalWrite(ledGreen1, LOW);
     digitalWrite(ledGreen2, LOW);
     digitalWrite(ledGreen3, LOW);
     digitalWrite(ledGreen4, LOW);
     delay(500);
     digitalWrite(ledGreen1, HIGH);
     digitalWrite(ledGreen2, HIGH);
     digitalWrite(ledGreen3, HIGH);
     digitalWrite(ledGreen4, HIGH);
    
    tone(speaker, 2000);
     delay(100);
     noTone(speaker);
     delay(100);
     tone(speaker, 3000);
     delay(100);
     noTone(speaker);
     delay(100);
    
    }
     else{
    
    noTone(speaker);
     }
     }
    
    // -------------------------------------------------------------
    
    // REED PLUS SPEAKER FUNCTION
    
    void sound(){
     reedState = digitalRead(reedPin);
     if (reedState == HIGH) {
     tone(speaker, 200);
     delay(2000);
     tone(speaker, 500);
     delay(2000);
     tone(speaker, 800);
     delay(2000);
     tone(speaker, 1100);
     delay(4000);
     tone(speaker, 1600);
     delay(500);
    
    }
     else{
    
    noTone(speaker);
     }
     }
    
    // -------------------------------------------------------------
    
    
     
  • strawberrymillefuille 6:37 am on November 4, 2011 Permalink | Reply  

    midterm pumpkin 

    Initial sketches:

    initial sketches

    Initial ideas were a pumpkin with leds embedded on the rind to create an ‘inverted’ lit up face and a disney-esque magical castle pumpkin where if you walked past it it would light up to form a shooting star (starting from the star, and then spreading outwards like the barograph example)

    After thinking a long time, I decide to come up with a pumpkin pie idea:

    pumpkin pie and slice

    It works like this: inside the pie slice would be pin13 led and the pir motion sensor to ‘lure’ unsuspecting people to the pie-slice….. once the motion is triggered, the larger pie-face would light up farther away. I decided to make it out of felt and aluminium foil, to keep to the handmade look

    pir motion sensor

    The good part about having a seperate slice and also stuffing was that it helped hide the sensor and decrease sensitivity. Here is the shield I made for the sensor, underneath the orange felt is a thin layer of aluminium foil.

    Initial tests:

    pie slice lure test

    The giant red leds from mad scientist kit lit up really brilliantly and well

    serial monitor checking

    I used the pull-up switch method for the pir motion sensor which was always on ‘high’

    full test setup

    Full test setup with both the pie slice and pie face – I had a lot of problems with the pie face because the leds weren’t bright enough to see through the fabric!!!! I should’ve gotten the larger leds like that red one instead of the smaller leds which didn’t really show up as well. In the final video I lifted the covering a little so you could see the leds underneath.

    Final video:

    http://vimeo.com/31586631

    Final code:

    http://www.mediafire.com/?btjqyta3wyqorpb (zipped)

     

     

     
c
Compose new post
j
Next post/Next comment
k
Previous post/Previous comment
r
Reply
e
Edit
o
Show/Hide comments
t
Go to top
l
Go to login
h
Show/Hide help
shift + esc
Cancel