← Previous Invention

Noise Bomb

Next Invention →

Press the Button 5000 Times

Project #9

Electronic Cricket

In this project, you’ll build one of our favourite projects – the electronic cricket. This invention is perfect for the unsuspecting brother, sister, grandparent or librarian, and great for creating a distraction!

The Kit

The Amazing Annoyatron

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

What you’ll need

Brain Board

Buzzer

Step 1

Let’s build this!

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.

Connections

Buzzer

The +LEG is the longer leg.

+ LEG11
- LEGGND

Step 2

Code some chaos!

Don’t forget to select your port, like ususal

Copy and paste the sample code

int buzzer = 11;

int chirpTone = 5;
int chirpDelay = 20;

void setup() {
  // put your setup code here, to run once:
  pinMode(buzzer, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  chrip(5);
  delay(300);
}

void chrip(int chirps) {
  for(int i = 0; i < chirps; i++) {
    tone(buzzer, chirpTone * 1000, 30);
    delay(chirpDelay);
    tone(buzzer, chirpTone * 10000, 10);
    delay(chirpDelay);
  }
}

Upload the code and test it out

Step 3

Modify the Madness!

Change the sound of the chirping

While the chirping sound in this project is already, admittedly, very annoying, we can make a few tweaks to our code to try and make it even more so. Changing the sound of the chirp is one of best ways to do this, and allows us to make each chirp either higher or lower in pitch. Take a look at line 3 where the chirp tone is set:

int chirpTone = 5;

At the moment, this is set to 5. If we increase or decrease this, we will get a different sound out of our chirps. Play around with different numbers and find out which one’s most annoying – by testing them on your family members, of course!

Change the chirpiness (if that’s even a thing)

Another thing we can change in our program is something we call the ‘chirpiness’. To be honest, that’s just a random name we gave to a cool control in our program. This is set on line 4 and controls the short break in-between each chirp.

int chirpDelay = 20;

This is one of the most interesting things to play around with in this project, as different values give completely different sounds. Some good numbers to try are 5, 10, 30, 75, and 200.