Look What I Can Do

Fun things that I can or cannot do with phys comp.

Final Project—->The Drunk Box

For my final I created a box that will only unlock itself if one is sufficiently drunk.  This could be used at parties or at bars as a game. The locking mechanism is a servo motor that changes position based on values of the alcohol gas sensor.  The red button locks the box.  

The Drunk box is a very simple concept that can be adapted in various ways.  Aside from being used as the Drunk Box party tool, one could reprogram the box so that it would only unlock is the individual was NOT drunk.  This would mean that an individual could store their car keys or any other valuable in a safe that can only be opened while sober.  

I have posted the code below this text, also in a previous post I have uploaded more pictures.

Here is the code:

#include <Servo.h>      // include the servo library

Servo servoMotor;       // creates an instance of the servo object to control a servo

int servoPin = 2;       // Control pin for servo motor

int x=0;         //

void setup() { 

 pinMode(A5,INPUT);   //this is my button input (My button is broken so I could not use digital read);

  Serial.begin(9600);       // initialize serial communications

  servoMotor.attach(servoPin);  // attaches the servo on pin 2 to the servo object

void loop() 

  int analogValue=analogRead(A0);  //breathalyzer

  int buttonValue = analogRead(A5); // read the analog input 

 if (x=0){   //initial loop

   servoMotor.write(90); 

 }

    if (buttonValue>=1022){

     x=x+1;

    servoMotor.write(160);  

}

  else if(analogValue>=700){

x=0; // variable opens the lock

  servoMotor.write(70); 

  }

  Serial.println(analogValue);      // print it

}

Testing my Final

pressure sensor

simple transistor

light sensor

Transistor/Hbridge

For this lab I used a motor that I salvaged from some junk I found on the street.  I’m not sure how many volts its supposed to use, but I used a 6 volt power supply that I had at home.  It worked great.  First I just did the lab, then I experimented using various sensors to get the motor to change its spin and speed based on various stimuli.  Here is some code I when I used a light sensor to control motion:

  int motor1Pin = 3;    // H-bridge leg 1 (pin 2, 1A)

  int motor2Pin = 4;    // H-bridge leg 2 (pin 7, 2A)

  int enablePin = 9;    

 void setup() {

    pinMode(motor1Pin, OUTPUT); 

    pinMode(motor2Pin, OUTPUT); 

    pinMode(enablePin, OUTPUT);

  digitalWrite(enablePin, HIGH); 

 Serial.begin(9600);

 }

 void loop() {

   int sensorValue = analogRead(A0);

   int outputValue = map(sensorValue, 0, 1023, 355, 850);

    if ((sensorValue >255) && (sensorValue<=600)) {

      analogWrite(motor1Pin, LOW);   

      analogWrite(motor2Pin, outputValue);  

    } 

        else if (sensorValue >= 600) {

      analogWrite(motor1Pin, outputValue);  

      analogWrite(motor2Pin, LOW);   

    }


}
I need to think about a different way to map the speed of the motor to the sensor value because the motor spun faster in one direction (because of the high values needed to change direction).  I’ll just use another variable next time.  

Video will be above this post.  

This Weeks Lab 3/6

I was asked to program an interactive political installation for NYU’s Gallatin school of Individualized Study and my proposal to them was to repurpose a septic pump into an Approval Voting interface to be installed in an NYU building.  The use of refitted technology encourages individuals to question and critique the utility of common objects much in the same way that people should learn to be critical of common election mechanics. Furthermore, given the current political climate, the use of a Septic Pump invites participants to consider what it is they are actually pumping.  

Here is a link to its documentation.  

http://academicsanonymous.weebly.com/repurposed-technology-and-politics.html