Close
0%
0%

ATTiny Low Power Prank

A pranking device to annoy your friends... or perhaps an entire college campus.

Similar projects worth following
This is a small device that plays a short 8-bit tune (never gonna give you up) every 30-40 minutes. It takes advantage of the ATTiny85’s watchdog sleep/interrupt function to greatly reduce power consumption. If the device were to play a 5-second tune every 30-40 minutes, its battery could theoretically last for a year or more.

When pranking, it can be hard to find a good balance between humor, price, and not pissing people off too badly. How do you create something that will draw people’s attention while at the same time not causing a significant disruption? I decided I wanted to create a device to accomplish such a task.

The first iteration of prototyping for this device began about a year ago with me gutting out the insides of a USB flash drive and soldering in an ATTiny and a very small piezo element. When it was plugged into a computer, it would play a tune. It was miserably quiet though.

My second iteration involved using a ‘differential drive’ for the piezo (using two io pins and alternating between high and low on each to double the amplitude). This made the USB device considerably louder.

After all this, I left this project behind for a few months until one day I read about low power sleep modes on the ATTiny. I realized if I used a coin cell battery I could make my device self-contained.

In my project's final phase, I use a larger piezo (a 30mm piezo from Adafruit).  I then hot glued the ATTiny and coin cell snugly onto the back and soldered all the connections together. This resulted in a small, easily concealable, and cheap ($2) pranking device. I then proceeded to make about 15 of these and hid them around my university's campus in various lounges and public spaces

Even though it looks like (and is) a mess of solder, flux, and hot glue. It gets the job done for cheap!

SleepMusicPiezo.ino

Arduino file for the ATTiny85. Note: some of the example music I include is a little off key, my ear is admittedly not the best.

ino - 6.70 kB - 12/23/2017 at 04:42

Download

  • 1 × ATTiny85 Microprocessors, Microcontrollers, DSPs / ARM, RISC-Based Microcontrollers
  • 1 × 30mm Piezo Speaker
  • 1 × CR 2032 Coin Cell Batteries and Battery Accessories / Batteries
  • 1 × Soldering Flux
  • 1 × Hot Glue & Solder

  • 1
    Programming the ATTiny85

    Use some method to load the sketch onto the ATTiny85 (I used arduino as ISP)

    ATTiny85 Arduino as ISP tutorial

    Here is my setup using an Arduino Nano:

  • 2
    Coin Cell

    Hot glue the coin cell to the back of the piezo:

  • 3
    ATTiny Pins

    Since we will only be using 5V, GND, 1, and 0 pins on the ATTiny, you can cut off the pins that we won't be using:

View all 6 instructions

Enjoy this project?

Share

Discussions

Sam wrote 02/20/2020 at 05:54 point

Would it be possible to create a solid beep like you would get with an active piezo buzzer using a piezo speaker instead? I'd like to use your 'differential drive’ technique to keep the higher volume. I played around with creating a new tone that was just a long note, but I wasn't able to get the sound I'm after. 

  Are you sure? yes | no

Sam wrote 02/01/2020 at 21:08 point

I am having an issue with battery drain. I traced it back to the rickroll song leaving power flowing to the buzzer after the song ends. 

It doesn't make any noise when connected to a passive piezo speaker, but when I connected it to a piezo buzzer, I hear a high pitched tone. I think that this means that there is power being sent to the buzzer, whether it makes noise or not, causing the drain. 

I haven't been able to find what caused this so far. I have attempted to add in a R note at the end of the song to see if that made a difference with no luck. I was wondering if you have run into this issue before.

EDIT: I managed to solve this by adding 

    digitalWrite(piezoPin1, LOW);
    digitalWrite(piezoPin2, LOW);

after the "for(int i = 0; i < (sizeof(melodyR)/sizeof(int)); i++){...} " section.

  Are you sure? yes | no

cheeky.miss.07 wrote 08/09/2019 at 01:45 point

I added a melody: ‘here comes the bride’. Got my friends on their wedding night in the hotel room! Fantastic project, and the first I learnt to assemble off by heart :)

  Are you sure? yes | no

Jonas wrote 09/27/2018 at 04:50 point

Nice. I like that you used a low memory use tune.

I pulled a similar thing on my girlfriend a few years ago. Unlike your elegant solution, I recorded a short phrase "hungry" and played that back when she walked by the fishtank. Same deal, sleep timer ATTiny85, mini JST battery but in a mini altoids tin with a PIR sticking out the side. There's just enough memory to play a short terribly digitized phrase hex encoded on the ATTiny85.. 

PIR sensor triggered the sound if it was awake at the right time. It would sleep a while but wake up quite often to try to catch someone walking by. The random bit was that it wouldn't trigger every time you walked by because it might not be awake at that moment, but every so often. Yours is definitely smaller and more consealable. I think I got several weeks of use before having to recharge. Always a hit, at least to the prankster. 

Good resource for ATTiny85 audio here: http://www.technoblogy.com/show?QBB

  Are you sure? yes | no

ActualDragon wrote 04/17/2018 at 14:00 point

what a savage, i love it

  Are you sure? yes | no

Dr. Cockroach wrote 04/17/2018 at 13:53 point

I love it. Gotta try this out some time :-)

  Are you sure? yes | no

Lolucoca wrote 01/05/2018 at 09:24 point

Oh, I'm so gonna make a couple of these and hide them in the IT department! 

  Are you sure? yes | no

Jarrett wrote 12/25/2017 at 01:46 point

Hah, that was you? Awesome.

It can be kinda risky to get caught planting electronic devices with power sources all around these days.

For rev 2, there's nothing wrong with getting a couple hundred manufactured and leaving them in a basket somewhere public with a sign that says "Free! Take one!"

  Are you sure? yes | no

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates