Introduction: Prank Vibrating Mint Tin - Code It Yourself!

About: I'm a maker and student at Harvard studying electrical engineering.

In this instructable we build an extremely amusing prank mint box that vibrates and makes tons of noise when either opened or just picked up. It is pretty easy to do, and chances are you have most of the parts already lying around your house if you're into electronics. Let's get started, shall we?

Step 1: Components for This Circuit

This won't be a very long list of items.

- ATTiny85 - this should not be the surface mount variety. You can find these all over the place.

- 8-Pin Socket - This is what we'll use to hold our ATTiny. This specifically is what I used: Sockets

- 1200 MAh Lithium Ion Polymer Battery - I use these batteries in almost all of my projects as they are small and capable of putting out a lot of current which should really get our vibration motors buzzing. Here is the one I used: Battery

- 2x Vibration Motors - What will make our tin buzz. Here's a link: Vibration Motors

- Vibration Switch/Sensor - How we will detect when the tin is being handled. Get the "fast" variety so it is very sensitive. Here's a link to the one I used: Fast Vibration Switch

- JST Connector - This is how we will connect the battery to our circuit. Link or other Link

- Mint Tin of your Choosing

- 10 uF Capacitor - This isn't needed for the actual circuit, but rather for programming the ATTiny.

- Arduino Uno or Similar - Same thing as the capacitor, used to program the ATTiny85.

- Optional: Very Small Proto Board - You can solder all the components to this like I did or free wire it. Either works well.

- To Make the Circuit: Soldering Iron + Solder, Hot Glue Gun, Soldering Helper (metal clasps on arms)

Step 2: Wiring the Circuit

123d Circuits Link The above diagram is pretty simple, but in case you need some explanation I'll detail what is going on.

Let's start with the vibration motors. I love dealing with these lipo batteries because rather than dealing with diodes, motor controllers, etc, we can just connect the vibration motors straight to the power of the battery and they buzz at the perfect strength. So, to control them, we connect the voltage wires of the motors to the battery power, and the grounds to the emitter of a transistor which in this sense is just acting like a relay. The collector on the transistor is connected to ground, and the base is connected to Pin 1 on the ATTiny.

The only other part of this circuit is the vibration switch. One end is connected to Pin 0 on the ATTiny, and the other is connected to Pin 2. In the code one of these pins is set to a low state as a ground and the other is simply used to detect if the spring on the inside of the switch makes contact with the header, which should set the pin state to HIGH, telling us to vibrate the motors by turning the transistor's control to HIGH.

Now for some helpful hints. On the vibration switch, I would recommend insulating the small wire with hot glue to stop it from accidentally making contact with the header, and to stop it from breaking. I couldn't find a part on 123d Circuits for it, so I just put in a random part. What you need to do is connect the header to either Pin 0 or Pin 2, and the small wire to the remaining pin. These things aren't polarized so orientation doesn't matter.

Step 3: Programming the ATTiny85

There are a plethora of tutorials online telling you how to upload the code below to your ATTiny85, so I'll get you started with some links. If you have any questions just ask in the comments. Sometimes I've had problems due to the clock speed, so if you upload the code and it doesn't work try switching to the remaining speed (1MHz<->8MHz). Now for some good links:

If these links don't work out then just Google "program attiny85 with arduino uno" for more. If the below code is not working properly, then try changing the 1 in the logic statement to 0, and make sure to double check your pin order. I recommend that you try and write this code for yourself, but if you don't want to then here's mine:

const int vibPin = 2;

const int groundPin = 0;

const int motorPin = 0;

void setup() {

pinMode(vibPin, INPUT);

pinMode(motorPin, OUTPUT);

pinMode(groundPin, OUTPUT);

digitalWrite(groundPin, LOW);

}

void loop() {

int state = digitalRead(vibPin);

if (state != 1) {

digitalWrite(motorPin, HIGH);

delay(7000);

digitalWrite(motorPin, LOW);

}

}

Step 4: Assembly

You'll want to start by connecting the battery and your circuit. Next, slide the battery into your desired mint tin. There are a variety of ways to customize this, starting with the vibration motors. You can try firmly affixing one to the tin to make it vibrate, and leave the other one loose to rattle around and make lots of noise. What I did was leave them both loose as I wanted as much noise as possible inside.

Step 5: Going Further

That 1200 MAh battery should last you quite some time, so don't worry about leaving the box on. To make it last longer, as a challenge you can try setting up my code to work with interrupts and wake the ATTiny from sleep as done in this tutorial.

Also not added to mine was a slide switch, but if you want you could make a small hole in the tin and poke one through. Clip the red battery lead and attach the broken end closer to the battery to the center pin on the switch, and attach one of the pins on the side of the switch to the other cut end of the lead.

If you want to make a lot of these and hand these out as party favors or something you can duplicate my 123d circuits design and make a PCB design. Thanks for reading!