Introduction: The Useless Alarmed Coke Can

Hi all!
This is the most useless project in the world! It consist in a Coke can attached to an Arduino trough a coaxial cable and two resistors that make a sound when an hand is near it.

Step 1: Materials and Tools

For make that I've used:

Materials:
-1x Arduino Uno Board (or equivalent)
-1x 270kOhm resistor
-1x 10kOhm resistor
-1x alligator clip (not in the photo)
- a piece of coaxial cable
- a short wire
-1x Piezo speaker
-1x rubber band (optional)
-1x full Coke can (not an empty one!)
-1x beer coaster
-2x A4 sheets of printer paper

Tools:
- scissors
- tape (of any sort, for example I've used insulating tape)
- glue stick
- fibre pen (not in the photo and optional: it' s for making the sign "FREE COKE")
- soldering iron with relative tools (not in the photo)

Step 2: Empty the Can

Take the can and, carefully, make a little hole on the bottom of it with the scissors. Let the gas come out and enlarge the hole. Then make an other one hole and make out the liquid in a glass. This is a VERY long process so be patient.

Step 3: Make the Circuit

How I've seen here, the human body is grounded, so the aluminum of the can and your hands make a sort of capacitor that has more capacitance as your hand is closer to the can.With Arduino we can know the time of charging of the "capacitor" and so the distance between the hand and the can. For make that, as you can see in the picture, we need a 270kOhm and a 10kOhm resistor, a coaxial cable and an alligator clip for connecting the Arduino to the can and a Piezo speaker for making sounds when an human body part is near the can. The making of cable for connecting the can with Arduino will be explained in the next step. For now connect only the positive(+) pin of the speaker to A0 on Arduino an the negative(-) to GND(Ground) (As you will see in next steps, i've added the rubber band for fixing the speaker to Arduino but it's mainly useless: it's an optional)

Step 4: Make the Cable

As first step you must solder one terminal of the 10kOhm resistor to the internal wire of the cable (Picture #1). Then solder the 270kOhm resistor to the internal wire where is soldered the 10kOhm and to the external shield (Picture #2 and #3). Solder to the external shield, where is the 270kOhm, a wire that will be linked to 5V pin on Arduino(Picture #3). On the other side of the coaxial cable solder the alligator clip to the internal cable (be careful to don't connect the external shield to the clip!!). If you want, you can put an heat shrink tubing on resistors and clip as I've done (Picture #4). Picture #5 shows the structure of a coaxial cable.

Step 5: Make the Pedestal of the Can

Now, you can simply connect the coaxial cable to Arduino and the can, but it isn't a nice solution. So, pick up a sheet of printer paper, make, on the longest side, an 1"-1.5" fold and past it's internal side. Continue to fold and paste the sheet until it looks like in picture #2 and #3. So, make an hole in the beer coaster with the scissors (not in the centre) and bond it to the folded sheet with a lot of piece of tape so that there is a big gap between the start and the end of the sheet, as shown in picture #5. After it, connect the free terminal of the 10kOhm resistor in our coaxial cable to Arduino's digital pin #8,  the wire starting from the shield of coaxial cable and 270kOhm resistor to 5V pin and insert the end of the alligator clip in the hole of the coaster (Picture #6). Put the coaster on the Arduino and insert the clip in the holes on the bottom of Coke can (Picture #7). It's done.

Step 6: Programming and Conclusions

This is the final step. Here, we will upload the sketch and hope that all is ok.
The sketch:

#define resolution 8
#define mains 50 // 60: north america, japan; 50: most other places

#define refresh 2 * 1000000 / mains

int minValue;

void setup() {
  //Serial.begin(9600);                          //DEBUG
 
 
  pinMode(8, INPUT);
 
  float temp;
  int i = 0;
  while(1){
    if(i==100)
      break;
    temp = temp + time(8, B00000001);
    //Serial.println(temp);                      //DEBUG
    i++;
  }
 
  minValue = temp / 100;
  //Serial.println(minValue);                    //DEBUG
 
}

int temp;

void loop() {       
  temp = time(8, B00000001);
  //Serial.print(temp);                          //DEBUG
  if(temp > minValue){
    tone(A0, 494);
    digitalWrite(A1,HIGH);
    //Serial.println("    ON");                  //DEBUG
  } else {
    noTone(A0);
    digitalWrite(A1,LOW);
    //Serial.println("    OFF");                 //DEBUG
  }
}

long time(int pin, byte mask) {
  unsigned long count = 0, total = 0;
  while(checkTimer() < refresh) {
    // pinMode is about 6 times slower than assigning
    // DDRB directly, but that pause is important
    pinMode(pin, OUTPUT);
    PORTB = 0;
    pinMode(pin, INPUT);
    while((PINB & mask) == 0)
      count++;
    total++;
  }
  startTimer();
  return (count << resolution) / total;
}

extern volatile unsigned long timer0_overflow_count;

void startTimer() {
  timer0_overflow_count = 0;
  TCNT0 = 0;
}

unsigned long checkTimer() {
  return ((timer0_overflow_count << 8) + TCNT0) << 2;
}


Essentially it's made of two parts: the setup and the loop. In the setup, that  stands for about 10 seconds, Arduino make the mathematical average between the values that receives during this while and set it as a "minimal value" (during those first seconds you must put your hand as near to the can as you want set the point where, after it, the alarm starts). In the loop, instead, Arduino read the current value and sees if it's bigger than the "minimal value": in this case the speaker will make a tone that will stop if only the value becomes smaller than the "minimal value". The "//DEBUG" lines are in case something comes wrong

The instructable is finished. Enjoy it. I'm sorry to all for my bad English: if you have any problems please leave a comment.

Comments

author
giuliom_95 made it! (author)2015-05-19

Ti prego di scrivere in inglese. Questa è una comunità internazionale.

Comunque, potresti essere più specifico dicendomi dove hai incontrato problemi?

author
DeadSorcio made it! (author)DeadSorcio2015-05-20

Punto primo io so italiano e quindi scrivo in italiano e punto secondo non funziona perché lo dice Laforgia.

author
vstout made it! (author)2014-02-04

doesn't work

author
giuliom_95 made it! (author)giuliom_952014-02-04

It doesn't work your replication of my project. Maybe you've did something wrong... If you need I'll help you but, please, don't say that something doesn't work (apparently only to you) before of trying every way to make it work!

author
jasonZak made it! (author)2013-10-13

Why didn't you just make the coaster pressure sensitive?

author
giuliom_95 made it! (author)giuliom_952013-10-14

Because in this way it uses electrodynamics‘ and electrostatics‘ priciples so, at least for me, it is more interesting.

author
rehanpasha made it! (author)2012-11-27

well, its impressive with the model. but when i reach to the programming step i cant find any solution,
After creating this model, how do i implement with the program.

author
giuliom_95 made it! (author)giuliom_952012-11-29

Sincerly, I've not very well understood your question. You simply don't know about upload code to an Arduino board, you get some errors while uploading or what else?

author
tim_n made it! (author)2012-11-26

Looks like beer mats from the Augustiner in Munich to me (having drunk and been drunk in there many times... And returning there next June!

author
giuliom_95 made it! (author)giuliom_952012-11-26

Well, it IS a coaster of the Augustiner beer of Munich!

author
jeterkurtis made it! (author)2012-11-17

this should be one for all of alcoholics.(parents)

author
kretzlord made it! (author)2012-11-14

Diy theremin?

author
giuliom_95 made it! (author)giuliom_952012-11-15

Maybe... If you make some modifies to the sketch it will become a very simple theremin but I don't recommend it because it's too elementary and probably it will not work well

author
firesirt made it! (author)2012-11-14

hook this up to This for some real fun.

author
poofrabbit made it! (author)2012-11-12

Useless? Nah, looks more like a great day of fun! Nice job!

author
giuliom_95 made it! (author)giuliom_952012-11-13

Well, maybe it's not useless before and while making it, because is a beautiful pastime, but once it's done, I don't really find a utility to this thing... However, thanks for your appreciation!

About This Instructable

18,354views

34favorites

Bio: I'm an Italian 19 years old automation engineering student.
More by giuliom_95:Color sensors and Arduino serial communication for beginners A sort of modern kinetic art.The useless alarmed Coke can
Add instructable to: