loading
Picture of 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.
 
Remove these adsRemove these ads by Signing Up

Step 1: Materials and Tools

Picture of 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

Picture of Empty the can
DSC_0008.JPG
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

Picture of 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

Picture of Make the cable
FN10BTJFIWH3S95.LARGE.jpg
FBN7X52FIWH3S94.LARGE.jpg
DSC_0004.JPG
0-RG6.jpg
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

Picture of 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.
vstout1 year ago

doesn't work

giuliom_95 (author)  vstout1 year ago

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!

jasonZak1 year ago
Why didn't you just make the coaster pressure sensitive?
giuliom_95 (author)  jasonZak1 year ago
Because in this way it uses electrodynamics‘ and electrostatics‘ priciples so, at least for me, it is more interesting.
rehanpasha2 years ago
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.
giuliom_95 (author)  rehanpasha2 years ago
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?
tim_n2 years ago
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!
giuliom_95 (author)  tim_n2 years ago
Well, it IS a coaster of the Augustiner beer of Munich!
jeterkurtis2 years ago
this should be one for all of alcoholics.(parents)
kretzlord2 years ago
Diy theremin?
giuliom_95 (author)  kretzlord2 years ago
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
firesirt2 years ago
hook this up to This for some real fun.
poofrabbit2 years ago
Useless? Nah, looks more like a great day of fun! Nice job!
giuliom_95 (author)  poofrabbit2 years ago
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!