Introduction: Arduino "Annoy-a-tron!"

About: A Bay Area native interested in electronics, mechanics, and robotics, and automobiles. Formerly the electronics captain of Team 100 in the FIRST Robotics Competition, I now study Mechanical Engineering at UC …
I've been admiring the Annoy-a-tron over at ThinkGeek for a while now, but I never really wanted to buy something that I knew I could challenge myself with building.  Although this is nowhere near as tiny and discreet as the real Annoy-a-tron, it functions very similarly and is still small enough to hide in a plethora of places.  My Arduino-powered Annoy-a-tron features random intervals of silence and high-frequency sound to confuse your victim more-so than a constant sound or a consistent interval.

Remember to comment, rate, and VOTE!

Step 1: The Extensive Supplies List

Here's what you'll need in terms of physical objects in order to start annoying the heck out of people:
- an Arduino (or really any microcontroller that can use the Arduino IDE's language)
- a piezo element or speaker capable of high frequencies in the 14-20kHz range

You'll also need a computer running Arduino IDE 18, a cable to interface between the computer and microcontroller (USB in many cases), and an external power source for the microcontroller (I use a 9V battery).  Inconspicuous enclosure optional.

Step 2: Can We Build It?

 Yes we can!

Alright, so at this point we need to plug the speaker into one of the Arduino's digital I/O pins and ground.  In my code, I have selected pin 13 for the (+) lead, but if you have something against that number (superstitious?), then go ahead and plug it in somewhere else.  Actually, plug it in elsewhere if you want the sound to be louder, because pin 13 has a 1k-ohm resistor built in.  After plugging in to the digital pin, plug the (-) lead of the speaker into one of the GND pins on your board.

Hooray, you've succeeded at winning the mission!
Wait, not so fast. We still need to upload code...

(Props to Fritzing for the sweet diagram below)

Step 3: Code Time!

 The code I wrote is rather self-explanatory because of the notes I put next to each line, but essentially what it is doing in its current state is playing an 18kHz tone for somewhere between 0.5 and 3 seconds (decided "randomly"), then waiting between 10 and 30 seconds (also "randomly") before starting over.  I'm not a code master by any means, so if somebody would like to share how to improve the code, that would be great.

Please note: The "Tone" feature is a new addition to Arduino 18, so if you don't have it, you'll need to download it from, or work your way around this issue.

The code is as follows, and you should be able to copy and paste it straight into the Arduino IDE...

long randNumber; //establishes randNumber
long randNumber1; //establishes randNumber1

void setup ()

void loop ()
  randNumber = random(500, 3000); //randNumber is between .5 and 3 seconds
  tone(13, 18000); //plays a 18kHz tone on digital I/O pin 13
  delay(randNumber); //continues to play tone to the time of randNumber
  noTone(13); //stops playing tone on pin 13
  randNumber1 = random(10000, 30000); //randNumber1 is between 10 and 30 seconds
  delay(randNumber1); //continues silence to the time of randNumber1

Step 4: Let Madness Ensue!

After uploading code to your Arduino, you'll need to unplug it from your computer's power and instead use a more portable source of energy.  I prefer the classic 9-volt battery, but I suppose there are other methods of power...

Next it's time to find a comfy and secret place for your creation.  Consider your surroundings.  Be aware that this will probably not work anywhere where it is loud because nobody will be paying attention anyway.  No matter where you are, under a desk is always a pretty good bet, but if anybody looks under the desk, don't expect them to ignore the circuit board with blinking lights and a speaker.  Hiding it in something "analog" (i.e. not a digital electronic) is probably better because, well, it's unexpected.
April Fools Day Project: Prank Contest

Participated in the
April Fools Day Project: Prank Contest