[ ----------- 100% ------------ ]
Status: Completed
Talking bottle openers are fun, but how often is it that it plays exactly the tune you want? Luckily, just as they look from the outside, they are not very complicated on the inside. Crack one open and you’ll see just a few components, so it is easy enough to recreate one with a small microcontroller that fits inside the case.
I used a PIC12F683 for several important reasons (namely, I already had a few samples for free), and just needed to reuse the three cell battery holders from the original PCB. Throw in a proto board, some jumper wires, a resistor, a capacitor, solder, and a 12 pin dip socket (for ease of inserting/removing the microcontroller after reprogramming), and then it’s onto the software!
The only pins we need aside from power and ground are one GPIO to trigger an interrupt when the pin’s state changes (signifying that the bottle contacts completed the circuit), and one of the Timer outputs to generate the sound.
By connecting one side of the bottle contacts to Vcc and the other side directly to a GPIO pin configured as input with internal pulldown, the pin will get a high signal whenever the circuit is closed. This event is what we want to use as an interrupt to wake the microcontroller so that we can put the microcontroller to sleep after the song is played.
Looking back at my handy work makes me appreciate the tool upgrades I’ve had since then..
On the Timer side of things, I ended up having to manually figure out the notes and timing of Chariots of Fire due to an underwhelming abundance of its sheet music online. I transposed the song into an array of notes and delays, and after much trial and error (which my roommates were not terribly thrilled about..), the bottle opener breathed new life.