Summary of Easy Arduino Audio Annoyatron
This article describes a simple Arduino-based prank device called the "Annoyatron." It plays a random tune between 5 and 30 seconds when room lights go off. The project is ideal for beginners in audio electronics, requiring minimal materials that can often be scavenged from household items. The guide covers necessary hardware, wiring connections, and provides specific Arduino code to detect light levels and trigger the melody.
Parts used in the Annoyatron:
- A small speaker
- An LED
- A 9V battery
- A 9V battery to Arduino cable
- An Arduino board
- An Arduino to USB cord
- Wires or breadboard wires
- Soldering iron
- Solder
- A computer with Arduino software installed
This simple device simple plays a small tune at a random interval, between 5 and 30 seconds when the lights in a room go off. It can be cleverly disguised inside a tissue box, or inside or under any number of household objects. This is a vary simple project (my first audio project) and requires vary few materials, most of which can be easily scavenged. If you are just starting with arduino or audio electronics and have the need/or want to prank someone, I would Recommend this project.
Step 1: Materials
For this you will need:
a small speaker (can be scavenged from most devices that make noise)
an led (can be scavenged from most electronic things that light up)
A 9v battery
a 9v battery to Arduino cable (link to make one yourself)
An arduino (most electronics stores will supply these, they are a bit costly, but you can build pretty much anything with it. If you don’t know what it is, imagine being able to program reality and you will know sort of what it does)
Arduino to usb cord (same as a basic printer to usb cable)
Wires(small solid core) or breadboard wires
soldering iron
solder
Third hand (recommended not necessary)
A computer with the arduino software installed
Access to the interwebs (I imagine your using that right now though)
A small amount of time and the willingness to learn a bit of code.
Know how to do basic soldering (if you don’t know this site has plenty of how-tos on the subject)
I would also recommend checking some basic arduino tutorials.
Step 2: Programming
The program I used was a variant of this one. Follow the steps on the arduino site so you can get the pitches.h library. Then paste this into the arduino software.
// annoyatron connect speaker to pin 8 and gnd
// led connected to anolag pin 0 and gnd
// makes noise when lights are off
#include “pitches.h”
int LED = 0;
int light = 0;
int melody[] = {
NOTE_C4, NOTE_G3, NOTE_G3, NOTE_A3, NOTE_G3,0, NOTE_B3, NOTE_C4};
int noteDurations[] = {
4, 8, 8,4,4,4,4,4};
void setup(){
pinMode(8,OUTPUT);
pinMode (LED, INPUT);
}
void loop() {
int light = analogRead(LED);
if (light <= 60){
int wait = random (5000,30000);
delay(wait);
for (int thisNote = 0; thisNote < 8; thisNote ++) {
int noteDuration = 1000/noteDurations[thisNote];
tone (8, melody[thisNote],noteDuration);
int pauseBetweenNotes = noteDuration * 1.30;
delay (pauseBetweenNotes);
noTone(8);
}
} else {
noTone(8);
}
}
Then upload to your arduino board. If you have any questions about the code feel free to ask in the comments. In the if(light<= 60){
section the 60 may needed to be changed to a different number depending on how dark your room is. If it is not turning on when the lights are off increase sixty, if it is turning on all the time decrease sixty.
an led
A 9v battery
a 9v battery to Arduino cable
An arduino
For more detail: Easy Arduino Audio Annoyatron
- How do I adjust the sensitivity of the light sensor?
You may need to change the number 60 in the code section if(light<=60) depending on how dark your room is; increase it if the device does not turn on when lights are off, or decrease it if it turns on all the time. - Can I build this project without buying new parts?
Yes, most materials like the small speaker and LED can be scavenged from other devices that make noise or light up. - What library is required for the programming step?
You must follow steps on the Arduino site to get the pitches.h library before pasting the provided code into the software. - Does the device play music continuously?
No, it plays a small tune at a random interval between 5 and 30 seconds only when the lights in the room go off. - Is soldering experience mandatory for this project?
No, while basic soldering is recommended, the text states you should know how to do basic soldering but implies the project is very simple for beginners. - Where should the LED be connected in the circuit?
The code comments indicate the LED should be connected to analog pin 0 and ground. - What happens if the light level is above 60?
If the light level is above 60, the noTone(8) function runs, ensuring the speaker remains silent. - Can I disguise this device inside a tissue box?
Yes, the article suggests the device can be cleverly disguised inside a tissue box or under any number of household objects.


