Sound it UP!

Burglar alarm: Stage 1

You will need

find these bits to begin
burglar alarm speaker

1) The first step is to ensure the Arduino software has been installed on your computer. This is something for the teacher/demonstrator to do. Check with them that it has been done.

Step 2 Image

2) Look at the pins on the speaker and notice which one is shorter, this is the negative pin. Plug the speaker into the breadboard connecting the two pins in the same column but different rows. Remember the number of the pin you've used.

Step 3 Image

3) Plug the black cable into the same row as negative (short pin) of the speaker alarm on the breadboard. Connect the other end of black cable to the GND (ground) pin on the Arduino Board.

Step 4 Image

4) Plug the red cable in the same row as the other end of the speaker alarm on breadboard. Connect the other end of the red cable any pin numbered between 2-13 on the Arduino Board.

5) Open the Arduino Software. Ask your demonstrator if you cannot find it. Open a new file and delete the text in the window. Copy and paste the following text (code) into the window (Need help? Ask your demonstrator):


int BUZZ_Pin = 12; //change to the pin your speaker is connected into

void setup() {
    pinMode(BUZZ_Pin, OUTPUT);
}
void loop() {
    digitalWrite(BUZZ_Pin, HIGH); //turns speaker on
    delay(50);
    digitalWrite(BUZZ_Pin, LOW); //turns speaker off
    delay(50);
}








6) Change BUZZ_Pin = __ to show the correct number of the pin you plugged your red (live) cable from the speaker into on the Arduino board (ie. change the ‘12’ to the correct value for your Arduino board). Using the Arduino software, go Sketch > Verify/Compile to ‘compile your code’ and go File > Save and save it as “burglaralarm.ino”. Next go Sketch > Upload to send it to your Arduino board. Once this has been completed, and program should return “Done uploading” and your alarm should should start making lots of loud beep beep beeps!


Not Working? Try This!

Please follow these steps to find out why:

  1. Take the speaker out, turn it round, and plug it back in. Does the alarm work now?
  2. Check your code.
    1. Does it compile? If not check the brackets, extra letters etc that are out of place.
    2. Is it identifying the correct BUZZ_Pin number? Check that “int BUZZ_Pin = “ has the correct number that the red cable is plugged into on the Arduino board.
  3. Check the connections on the breadboard.
    1. Check your breadboard looks like the picture at the end of step 4. If it does and your light is still not working, check that:
      1. All the pins are pushed in.
      2. Try using a different speaker.
      3. Try using different cables.
      4. If none of that gets your light working, ask your teacher/demonstrator for assistance.

Next stage