← Previous Invention

The Ticking Clock

Next Invention →

Broken Night Light

The alarm and flashing light is sure to cause a frenzy of chaos amongst your friends and family!

Project #2

Alarm & Flashing Light

Who doesn't love a good alarm sound? Annoy practically everyone with this classic invention. We'll even include a flashing light for extra effect.

Play Video

Start by watching this video

The Kit

The Amazing Annoyatron

Build this invention, and many more, with The Amazing Annoyatron!

What you’ll need

svg+xml;charset=utf

Computer

svg+xml;charset=utf

Brain Board

svg+xml;charset=utf

USB Cable

svg+xml;charset=utf

Buzzer

svg+xml;charset=utf

3 x Coloured wires

svg+xml;charset=utf

Colour LED

Step 1

Let’s build this!

Alarm & Flashing Light
This is the positive leg of the buzzer. It will have a ‘+’ sign on top of it and will also be longer than the other leg.
Don’t forget to plug the board into your computer with the included USB cable.
Apart from the ‘negative’ pin which has a black wire attached, you can tell the difference between all the other pins by the colour of wire attached.
The longest leg of the LED is the ‘negative’ pin and needs to be connected to GND.

Connections

Buzzer

The +LEG is the longer leg.

+ LEG11
- LEGGND

RGB LED

Use wires to join these.

The -LEG is the LONGEST.

-LEGGND
BLUE~5
RED~3

Step 2

Code some chaos!

Don’t forget to select your port!

Open the ‘Tools’ menu and select the option that says ‘Arduino/Genuino Uno’.

Always select your Arduino board before uploading a program

Copy and paste the sample code

int buzzer = 11;
int redPin = 3;
int bluePin = 5;

int beepLength = 500;

void setup() {
  pinMode(buzzer, OUTPUT);
  pinMode(redPin, OUTPUT);
  pinMode(bluePin, OUTPUT);
} // close setup

void loop() {
  analogWrite(buzzer, 255);
  analogWrite(redPin, 50);
  analogWrite(bluePin, 0);
  delay(beepLength);
  analogWrite(buzzer, 0);
  analogWrite(bluePin, 50);
  analogWrite(redPin, 0);
  delay(beepLength);
}

Upload the code and test it out

Step 3

Modify the Madness!

Change the volume level of the alarm

For once, this change isn’t all that exciting. Since the volume of the alarm is already maxed out, the only way the volume can be changed is by bringing it down. But still, if the beeping is a little too loud, then this might be helpful. Line 14 is where the buzzer’s volume is set. Let’s take a look.

analogWrite(buzzer, 255);

The volume here is set with a value anywhere between 0 and 255, where 0 is completely off and 255 is maximum volume. Try a few different values to see what they do to the program.

Change how long each beep goes for

In line 5, you can see that we have set ‘beepLength’ to equal ‘500’. This is what’s called a variable, but more on that later. Changing this number will alter the length and space between each beep.

int beepLength = 500;

The beepLength is used in the program to control the amount of time that the beep stays on for and also the time that it is off for. This is done with a delay on lines 17 and 21 of the code.

delay(beepLength);

You always have to use a number for a delay to work properly, but because beepLength was given a number (500) earlier on in the code, that is how many milliseconds the delay will go for.

What is cool is that when we change beepLength in line 5 of the code to something else, like 750, the delay time on lines 17 and 21 will change to 750 milliseconds with it.

How do I make this invention stop?

svg+xml;charset=utf
1

Create a new document in Arduino

Open the Arduino software and select File > New in the menu or use the keyboard shortcut Ctrl + N to create a new document.
2

Upload the program to your board

Make sure that the correct board is selected in the tools menu and then click the upload button to send the 'blank' program to the board, overwriting the current one.