Close
0%
0%

Arduino MakerFaire MakerBar Candy Box

Swipe for Candy, False Bottom Box

Similar projects worth following
Swipe for Candy, False Bottom Box

Last (last-last) minute build for the MakerBar booth at NYC MakerFaire. Swipe for candy, the closer your hand, the angrier the box becomes (vibration) then proceeds to open, revealing an unexpected robot arm (false-bottom) that presents you a with piece of candy. All materials were constructed from MDF by way of CNC.

Notation

Limited time did not permit me to complete the build. A reloading system was to be applied to the under side; it was alternatively reloaded by hand as the effect was slow regardless.

Featuring "Lois' Lament" by Suzy Sellout (Kathrine Becker)

  • 2 × Servo
  • 2 × Arduino Uno
  • 1 × MDF Connectors and Accessories / DIN Connectors
  • 1 × Stepper Motor
  • 1 × Ultrasonic Sensor

View all 12 components

  • Arduino Words n' Things

    Vije Miller10/02/2016 at 12:31 0 comments

    // False Bottom Arduino Candy Box
    // TVMiller
    
    #include <Stepper.h>
    
    // Stepper
    const int stepsPerRevolution = 200;
    Stepper myStepper(stepsPerRevolution, 8, 9, 10, 11);
    
    // Stepper Limits
    const int  topstop = 6;
    int topstate = 0;
    const int  botstop = 5;
    int botstate = 0;
    
    // Stepper State
    int posstate = 0;
    
    // Sensor Pins
    const int trigPin = 4;
    const int echoPin = 3;
    
    // Vibration
    int motorPin = 12;
    int vibration = 0;
    
    void setup() {
      // Stepper Speed - Ugh
      myStepper.setSpeed(210);
    
      // Stepper Limiters
      pinMode(topstop, INPUT);
      pinMode(botstop, INPUT);
    
      // Vibration Motor
      pinMode(motorPin, OUTPUT);
    
      Serial.begin(9600);
    }
    
    void loop() {
      // Sensor Polling
      long duration;
      pinMode(trigPin, OUTPUT);
      digitalWrite(trigPin, LOW);
      delayMicroseconds(2);
      digitalWrite(trigPin, HIGH);
      delayMicroseconds(10);
      digitalWrite(trigPin, LOW);
      pinMode(echoPin, INPUT);
      duration = pulseIn(echoPin, HIGH);
      Serial.println(duration);
    
      // Vibration Motor Map
      vibration = map(duration, 300, 800, 255, 0);
      analogWrite(motorPin, vibration);
    
      // Trigger Candy
      if (duration < 300) {
        if (posstate == 1) {
          up();
        }
      }
      delay(100);
    }
    
    // Stepper To Limit
    // IF button is LOW then run
    // IF button is HIGH then stop
    void up() {
      while (botstate == LOW) {
        botstate = digitalRead(botstop);
        myStepper.step(-1);
        posstate = 0;
      }
      // Delay then Return
      delay(2000);
      down();
    }
    
    void down() {
      while (topstate == LOW) {
        topstate = digitalRead(topstop);
        myStepper.step(1);
        posstate = 1;
      }
    }

  • Change of Plans

    Vije Miller09/28/2016 at 03:26 0 comments

  • Madness

    Vije Miller09/24/2016 at 14:47 0 comments

    About to smash this damn thing as it came to pass that I clearly took a misstep in design. Will set aside briefly as the dead line approaches...but g d m f. No one ever authors articles about how to handle the maker rage.

  • Shenanigans

    Vije Miller09/23/2016 at 20:22 0 comments

  • Unadulterated Hand Precision

    Vije Miller09/22/2016 at 01:30 0 comments

View all 5 project logs

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates