Challenge Three v.1

Goal: Build a night time alarm to sound when night falls

Materials: Arduino Microcontroller, Piezo buzzer, photoresistor, 150k resistor, jumper wires,
(To learn more visit http://www.zombiebothq.com/components)

Overview: This challenge adds some braaaains to our electronics, in the form of an Arduino microcontroller. A microcontroller receives input from the environment around it (from light sensors, temperature sensors, switches etc.) then perform actions based on these inputs. Using this combination of input & output we can do just about anything we like.

Instructions:

  1. From this challenge onwards, we’ll be using the website to provide detailed instructions for each challenge. Visit http://bit.ly/ZOMBIE-3 (All upper case) for pictures, videos and tips. (Or visit http://www.zombiebothq.com and click ‘The Challenges’. )
  2. Download, install and set up the www.arduino.cc software. 
    Stage One: Make the Light Blink
  3. Set up your breadboard like this.
  4. An Arduino program is called a sketch. Helpfully the Arduino software comes with a lot of sketches already written for us. Today, we’re going to use one of the pre-written examples called ‘Blink’. Open the Arduino software, then go File > Examples > 01. Basics > Blink. Now send it to the Arduino by going File > Upload (make sure the USB cable is connected). Your L.E.D. should start flashing. If you want to get adventurous, see if you can speed the blinking up, but changing the code. Find where the program turns the L.E.D. on for 1000 milliseconds, then turns it off for 1000 milliseconds. Have a play around with these numbers and re-upload your sketch to see if you can speed up the blinking.
    Stage Two: Create a Night-time Alarm:
  5. Time to get serious! Let’s build a light sensor like the one below. Twist the 150k resistor (the one with the short legs you received in pack #3) around one leg of the photoresistor, then carefully push on the three M/F jumpers (matching the colours to the photograph below). Once you have successfully done this, you may like to prevent short-circuits but putting tape around the legs of the photoresistor and normal resistor
    light-sensor-1200

    Fig. 2

    Also make a piezo buzzer from the buzzer and one green and one black M/F jumper. (Fig. 3). It doesn’t matter which pin you attach the green and the black jumpers to; it’ll work either way.

    Fig. 3

    Fig. 3

  6. Now let’s put it all together and build a light sensor that detects how much light there is in the room and adjusts the noise made by the piezo buzzer. First things first: set up your breadboard like this. We’ve written a couple of sketches that we can use with your light sensor. Download and unzip this file: Zombiebot_Challenge_Three. Once you have unzipped the two sketches, open the one called ‘Zombiebot Night Time Alarm v1‘ and open it with the Arduino software. If you have put all of the wires in the right place and set your breadboard up properly, the light sensor should change the pitch of the noise coming out of the piezo buzzer depending on how much light there is in the room. Cover it with your finger to see what happens.
  7. Extra fun: if you have successfully built your night time alarm, open the second sketch (‘Zombiebots Play A Tune‘ and upload it to your Arduino. Can you recognise the tune?

You will use these skills later by: We will eventually use two photoresistors for our robot. They will act like eyes so that when the robot senses it is heading into a corner, it will see the light dropping and adjust direction.

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s