Jul 05

Sketch 4

Copy and paste everything below the /****/ into a blank sketch.

/*****************************/
//Sketch_4
/* This program goes with Lab 4 of the OpenTag laser tag tutorial.
It plays a basic game of free for all laser tag. A player is out
if they get tagged 5 times.
*/

#include
//TimerOne will make it easy to pule an infrared LED 38,000 times
//a second

// Variables (nicknames for pins)
int button_pin = 12;
int led_pin = 11;
int ir_led_pin = 10;
int ir_receiver_pin = 9;

//you start with 5 health. This is the first time that we will use
//a variable to keep track of and change a number.
int health = 5;

void setup() {
//first, start up the TimerOne library. We want it to pulse
//38,000 times a second, which is about once every 26 milliseconds
Timer1.initialize(26);

//tell the arduino if a pin is input/output
pinMode( button_pin, INPUT);
pinMode(led_pin, OUTPUT);
pinMode(ir_led_pin, OUTPUT);
pinMode(ir_receiver_pin, INPUT);
}

void loop() {
int button_state = digitalRead( button_pin ); //read button
if (button_state == HIGH) { //if the button is pushed
/* If we are pushing the button, then we are trying to send
a tag. However, we can only tag if we have more than 0 health.
We can use the if statement and a comparative function called
greather than, which uses the > symbol. Greather than will
be true (the code in the if statement will be run) if the
number on the left is greather than the number on the right.
We want to send a tag if health is greater than 0. In code,
that is written as:
*/
if (health > 0){ //if we have health
//so, we know that we are pushing the button and have health
//now we can send a tag.
//first, pulse the infrared LED with the TimerOne code
Timer1.pwm(ir_led_pin, 512); //send pulse
delay(10); //delay for 10 milliseconds
Timer1.disablePwm(ir_led_pin); //turn off Timer One
}
}

//now, we want to see if we are getting tagged
int ir_receiver_state = digitalRead(ir_receiver_pin);
//if the receiver sees something, it will send a LOW or 0 signal
if (ir_receiver_state == 0){
//when we are tagged, we lose 1 health.
/* In order to tell the arduino to subtract 1 health, we
need to tell it what health should now be. To do this, we
will say that the health I should have is equal to the health
that I had minus 1. That line of code is written below.
*/
health = health - 1;
//now that we see something, indicate it by turning the LED
//on for 1 second
digitalWrite(led_pin, HIGH);
delay(1000); //a delay of 1000 is 1 second
digitalWrite(led_pin, LOW); //then turn LED off
}
}

//Tia tia tia!

Jul 05

Lesson 4

Now that we have an arduino that can both send and receive signals using infrared light, we can program it to play a basic game of laser tag.

Basic Laser Tag

We will start with a simple game of elimination. Each player has a tag unit, and the objective is to tag the other players 5 times. If you get tagged 5 times, you are out. The person who is left when everyone else is out is the winner.

So, how do we program the arduino to do this? We are nearly there. We already have code that sends in infrared signal (light pulsed 38,000 times a second) that our infrared receiver can receive. We also have code that checks to see if our receiver is receiving anything. What we need to do is add health. If you are out of health, then you can not send tags. Every time you receive a tag, your health goes down by one. You start with 5 health.

That's all there is to building a simple game of laser tag. From here, we are going to start adding bells and whistles to make the game more fun to play. But after you have completed this lesson and lab, you can play laser tag. Go for it. Write down what you liked and didn't like. If you want to change something, you can do it. This is your game of laser tag, and you can build it to do whatever you want. But first, let's make the code. To the code!

Jul 04

Sketch 3

This is the code for Sketch 3. Copy and paste everything below the /*************/ into a new arduino sketch.

/************************************************/
//Sketch_3
/* This program goes with Lab 3 of the OpenTag laser tag tutorial.
It sends a pulsed IR signal (38,000 times a second) when a button
is pressed and turns on an LED if a signal is seen
*/

/*
first, let's add the TimerOne library. To add a library, you
type #include and then the library name inside <>
*/

#include
//TimerOne will make it easy to pule an infrared LED 38,000 times
//a second

// Variables (nicknames for pins)
int button_pin = 12;
int led_pin = 11;
int ir_led_pin = 10;
int ir_receiver_pin = 9;

void setup() {
//first, start up the TimerOne library. We want it to pulse
//38,000 times a second, which is about once every 26 milliseconds
Timer1.initialize(26);

//tell the arduino if a pin is input/output
pinMode( button_pin, INPUT);
pinMode(led_pin, OUTPUT);
pinMode(ir_led_pin, OUTPUT);
pinMode(ir_receiver_pin, INPUT);
}

void loop() {
int button_state = digitalRead( button_pin ); //read button
if (button_state == HIGH) {
/*so, this is the first change. What we want to do is have
the arduino turn on the infrared LED on and off at 38,000
times a second.
we already know that digitalWrite is the command to tell the
arduino to set a pin to HIGH or LOW voltage. We want to
do that 38,000 times a second. That means we need to
turn the LED off then on about every 0.026 seconds.
(1/38,000 = 0.02632)
We could use digitialWrite to turn the infrared LED on and off,
or, we could use the TimerOne code to turn the infrared LED
on and off at precisely the time we want. We just need to tell
the arduino how long to pulse the LED. For that, we use the
delay function. The delay function tells the arduino to pause
for a set number of microseconds, or 1/1000th's of a second.
For our code, we will have the infrared LED pulse for 10
milliseconds every time we push the button
*/
//first, pulse the infrared LED with the TimerOne code
Timer1.pwm(ir_led_pin, 512); //send pulse
delay(10); //delay for 10 milliseconds
Timer1.disablePwm(ir_led_pin); //turn off Timer One
}
/*we don't need to do anything if the button is low
else {
digitalWrite(led_pin, LOW);
}
*/
//now, we want to see if we are getting tagged
int ir_receiver_state = digitalRead(ir_receiver_pin);
//if the receiver sees something, it will send a LOW or 0 signal
if (ir_receiver_state == 0){
//now that we see something, indicate it by turning the LED
//on for 1 second
digitalWrite(led_pin, HIGH);
delay(1000); //a delay of 1000 is 1 second
digitalWrite(led_pin, LOW); //then turn LED off
}
}
//Mj csy ger xyvr sr er PIH, csy ger hs ercxlmrk!

Jun 23

Lab 3

We are going to add an infrared (IR) LED and an infrared receiver to the arduino. We already know how to add an LED, and we have chosen to put it on pin 10. The new part is the infrared receiver. This outputs whether or not it sees an infrared signal turning on and off 38,000 times a second. We need to give this sensor power, ground, and connect its output wire to our arduino so that our arduino can sense the signal (high or low voltage) that the infrared sensor gives as an output. Below is a circuit diagram of what we need to add.

Figure 1: Picture of connections. (Click on the picture to make it bigger).

Lab3_bb
Note: I couldn't find an IR sensor in the software I use to draw circuits, so my IR sensor doesn't look exaclty like an IR sensor.

So, now that we have a red LED, infrared LED, infrared sensor and button, how do we want to program them? So, for laser tag, we want to push a button and send a signal out of our infrared LED (to send a tag). When we receive a tag on our infrared receiver, we want to indicate that we have been tagged with our red LED. So, we need to modify our code to follow those instructions.

We are going to use other people's code to make building laser tag easier. We call other people's code libraries. It is sort of like checking out a book at the library, only you are checking out other people's code and using it in your own code.

The first library that we are going to use will turn on and off our infrared LED 38,000 times a second. That library is called TimerOne. You can download the library here (note, download the file TimerOne-r11.zip for the latest version) and read about how it works with the TimerOne Tutorial (the tutorial on how it works is very advanced. I can go over it later if you would like. You do not need to know the details on how it works to use it properly).

Once you have the file downloaded, you need to tell the arduino programming software where the library is so that you can use it in your code. The arduino software has a folder where it stores all of the libraries it knows about. To move the library to a place where the arduino software can find it, you can follow the tutorials from either the arduino library installation or the sparkfun library tutorial. Once you have the TimerOne library installed, it's time to modify the code to make a rudimentary laser tag unit. To the code!

Jun 22

Lesson 3

We are going to use infrared light (the same kind TV remote controls use) to communicate between two arduinos so that they can play laser tag. This lesson goes over how to do that.

Now that you can get your arduino to respond to a button press, the next thing to do is make it send a signal using infrared light when you push a button. We need an emitter (an infrared LED to create the light) and a receiver to sense the light. We already know how to light up an LED, and if we use an LED that emits Infrared light, then the emitter is done.

So, if we wanted in infrared receiver, how would we build one? We could make one that turns on when it sees infrared light(remember, the arduino only communicates with voltage. When the receiver sends a signal saying that it sees something, it will do that by changing the voltage on one of its pins). However, there are a lot of sources of infrared light naturally. The sun, your body, fire - anything that gives off heat also emits infrared light. So, how can we make sure that the infrared light that our detector sees is coming from our infrared LED?

Well, the people who made the receiver made it only respond to infrared light that blinks. Really fast. For the receiver we will use, whenever the receiver gets hit with 38,000 pulses of light per second, then the receiver will say that it is seeing our infrared LED (and one of its pins will change from high to low voltage). Since our arduino can make the LED blink really fast (to create an output for the receiver), and our arduino can read high or low voltage from the receiver, our arduino can use the infrared LED and receiver to communicate. So voila! A way to take an infrared signal and make it control the arduino.

So, now that we have an idea of what we want to do, how do we do it? We're going to need to write a piece of code that pulses an LED on and off 38,000 times a second. We will also have to have the arduino check the infrared receiver to see if the infrared receiver is receiving the pulsed infrared light. This is the basics of communicating between arduinos. So let's build it. To the Lab!

Bonus Knowledge

The infrared reciever we will use is active low. That means when it activates [sees a infrared signal pulsing 38,000 times a second], it makes its output pin low. Why does it make the pin low and not high when it senses a signal? That has to do with power consumption, industry standards, etc. We won't go into that. If you really want to know, ask me. I'll be glad to try to answer.

There is a lovely tutorial at adafruit that goes into how to use IR (infrared) sensors, which you can find here if you want more information. For now, it's on to the circuit diagram and the code. (well commented, of course!).

Aug 13

Key Qualities for a school Makerspace and Bareduino

I came across and article on Make about the key qualities that are needed in a makerspace for kids in school. The main point of the article was that people need a few things to make. First, they need the basic skills of what tool to use and how to use it. Then they need to problem solve, to determine the reason that the thing they are making isn't working. Finally, they need the confidence to try something new. To learn something as they go. That confidence is what I want to impart on people. I want to empower them, to make them realize that they can build something complex, like laser tag. To be able to feel like they can do it and that it is within their reach to understand, to build, to create. The original article is here.

In other news, Niek Blankers at NiekProductions posted schematics for a bareduino, an arduino compatible based off of the ATiny45/85 that uses a small circuit board and minimal support components. It may be something that i could use if I wanted to have a separate controller that looked for tags, say on someone's head. His post is here.

Apr 19

Lab 2

In order to send a light signal (which is how the arduino will communicate when playing laser tag), we need to program the arduino to turn on a light when you push a button. In order to do this, you need to learn how to control the arduino's inputs, outputs and the basics of programming in the arduino IDE.

After reading through the example sketch (Sketch 2), you should have an idea of how to write a program to turn on an LED when a button is pressed. The circuit that you need to build to light up an LED when a button is pressed is shown below.

Figure 1: Breadboard of Lab 2 circuit (click on picture to make it bigger)

Lab2_bb
Xohd voccyx, dro grsvo vyyz!

The arduino runs off of five volts, and the LED needs 0.01 amperes (10 mA) of current. The circuit above makes pin 12 high (5V) when the button is pressed, and when the button is not pressed, the resistor pulls the pin to ground. This is called a pull-down resistor, as it makes the pin grounded (it is 0 volts) when the button is not pressed. This keeps static electricity from building up on the pin and causing the arduino to think that the pin is high when it shouldn't be. (in general, any pin that you are using should always be connected to either 5V or 0V [ground], so that static or charge from another source dos not build up on the pin).

The button does not need to have much current running through it, and to save power and use standard components, we choose a current value of 0.0005 Amperes (0.5 mA) through the pull-down resistor. Without the resistor, you will be connecting power (5V) to ground (0V), and create a short. A short will try to pull as much current as it can (it has roughly zero resistance, so the current will be very high), which will cause the batteries to quickly die and the components to heat up (and potentially fry). Remember the pull down resistor.

You now have enough information to calculate the resistance values for the two resistors in the circuit. After building the circuit and testing it with the arduino code that was provided, try adding another LED onto pin 10 and having it turn on when the button is not pressed, and turn off when the button is pressed.

Bonus Knowledge
The pin numbers that we are using were chosen to make the schematic look nice. Any of the digital pins can be used for this sketch.

Apr 18

Lesson 2

In order to tell the arduino how to play laser tag, we need to understand how to give it instructions on what to do. We do this using our computer and a program that allows us to write instructions for the arduino. The purpose of this lesson is to introduce people to the arduino and its integrated development environment (IDE) that is used to program it.

To begin with, you need to tell your computer how to talk to the arduino. To do this, you need to get the correct software running on your computer. Fortunately, there is a tutorial on the arduino website that goes through the steps required to set this up, which you can find here. In addition to the setup, the arduino website has many reference pages and forums that are useful for finding answers to questions and solutions to problems.

So, what can an arduino do? An arduino can interact with the outside world using electricity through its pins (the little pieces of metal sticking out of the microcontroller). It can measure the voltage that is on specific pins and output voltages on other pins. This can be used to read sensors, move a motor, turn on a light, tweet, send an e-mail, or do pretty much anything that you can have done by turning on a switch, or pushing a button. But in order to communicate to the arduino without breaking it, there are some things that we need to be aware of.

First, the arduino can only supply 0.03 Amperes (30 mA) of current from any pin. That means that if whatever circuit is attached to a pin tries to draw more than 0.03 Amperes (30 mA) of current, the arduino will eventually overheat and break. It could break that pin or the entire board. This is why you learned Ohm's law. Every circuit that is turned on by the arduino can not draw more than 0.03 Amperes (30 mA) of current, or it will damage the arduino. In addition, the arduino uses a specific voltage, five volts. We will be using the arduino's digital inputs. Digital, or discreet inputs, are like counting numbers. They can only take on certain values, like 1, 2, 3, 4, etc.
For the arduino, it can only count to one. When it reads a voltage, the voltage is read as either 0 or 1. Since the arduino likes using five volts, we will give it a five volt signal. The arduino will think that any signal that it reads on one of its pins that is five volts is a one (or that the voltage is set to high). If the arduino does not sense five volts, it will think that the pin is a 0 (or that the voltage is set to low).

So, now that we know the basics of electricity, we need to learn the basics of programming the arduino. In the arduino IDE (programming environment), a file is called a sketch, and I wrote an example sketch called first sketch to go over the basics of the arduino IDE. Read it. It goes over basic coding practices and tips for writing code.

After reading the example sketch, which you can find here, you can complete Lab 1.
Now go build something.

Note: The brains of the arduino is a microchip called the ATmega328p. Atmel, the company that produces the ATmega328p has a naming convention for their chips. It starts with AT, which stands for the company Atmel. This chip is part of the mega family, which as 32 or more pins, has 32 kilobytes of program memory (which is why 32 is in the name), it has 8 kilobytes of flash memory (which is why there's an 8 at the end), and it is the low power chip (p). Put all of those features together, and you get the ATmega328p. This naming convention lets you compare chips simply by looking at their names. For more information, the Atmel naming convention for these chips is here.

Apr 18

Sketch for Lesson 2 and Lab 2

Copy and paste everything below the /******/ into a blank sketch file (a blank file that opens up in the arduino software package) in the arduino IDE and read through the file to learn about the basics of writing a program for your arduino to run.

/************************************************************/

// this is a comment. A comment is not code that the arduino will try to run.
// a comment is a note to the programmer.
// a comment that is on one line starts with two slashes: //

/* a comment that spans multiple
lines starts with /* and ends with */

// You should always leave yourself comments that explain what you are doing
// When you don't, you'll forget what the code does and have trouble
// coming back to it later and changing stuff.

/*
When you know what you are doing, then you don't need to leave as detailed
comments, but until that point, good comments are key to good code
*/

/*
Speaking of good comments, notice how much easier this comment is to read
than the last one because there is one space before I started writing.
making your comments easy to read and understand is good and worth the time.
Don't make your comments so long that people have to make the arduino window bigger just so that they can see them because this is annoying for people who don't want to expand their window just so they can read the comment that you put in your code but decided not to press enter any time soon because you just had to write it all on one line
*/

/*
Normally, you would start a file with the following:
Name and Purpose of the file
Whether or not it is in the public domain (useful to know if other people
want to use your code).

For Example:
Sketch_2 is meant to introduce people to the arduino integrative
development environment (IDE) that is used to program the arduino
microcontroller. It goes over comments, intputs/outputs and if/else statements
This code is in the public domain.
*/

/*
The arduino has many pins that can be used to receive information from
the world (it can receive input) or send information out (output).
The arduino's pins can be used for either input or output, so you need to tell
the arduino which function that
you want the pin to perform. For this lesson and lab, we will be re-creating
turning on an LED with a button. To do this, we need to tell the arduino
which pins to use and whether we want those pins to be inputs or outputs.
The arduino's pins are labeled with numbers, but that's not easy to remember.
When programming, you can create nicknames (called variables) to name things
so that they that are easier to remember. For example, if we want to put our LED onto
pin 11 on the arduino board, we may want to create a nickname (variable) for that pin
and call it led_pin, so that we can use the word led_pin in our code instead of
the number 11. That line of code is shown below. It
creates a variable (an int or integer, which will be described later)
called led_pin and sets it equal to 13. the ; tells the arduino code that it is
the end of the line of code.
Note: nicknames (variables) can't have spaces. You can use underscores (_)
though, to separate your words and make them easier to read
*/
int led_pin = 11;

/*
We also want to give a nickname for the pin that we attach to
the button. Why? Because we want to see if the button is pressed and
turn on the LED if the button is pressed, so we need another nickname
to keep track of the pin that the button is attached to.
*/
int button_pin = 12;

/*
Now that we have nicknames that we can remember, we can start coding.
Arduino sketches always have two things:
1. a setup routine
2. a loop routine.
The setup routine is run
every time the processor is turned on or reset. This is where you set
pins to be inputs or outputs or do things that you want to happen every time
you start or reset the arduino. After that comes the loop routine, which
runs whatever code is in the loop over and over and over until the arduino
turns off.
*/

/*
the setup routine runs once when you press reset and when the arduino
turns on for the first time:
it looks like this:
void setup() {
Here are what that means:
1. void means that the routine does not send anything back
after it is done running. You can have the arduino return or send something
after it is done running some code, but this code doesn't require that.
2. setup is the name of the routine. A routine or grouping of code is called a
function, which we will explore more later
3. The two parenthesis () mean that there is no input to setup. Other functions
can have inputs, which you would put between the parenthesis (we don't need
and input for setup, and never will)
4. Finally, the curly bracket, { tells the arduino that all the code
starting here is for the setup function.
*/

void setup() {

/*
So, we want to have our led pin be an output. Fortunately, the arduino IDE
has a lot of built in functions that make it easy to do things. For example,
the pinMode function lets you tell the arduino to change a pin to an input
or output. You can set a pin to an input or ourput by writing the command
pinMode( pin to set, OUTPUT or INPUT);
You'll notice that output is written in all capitals.
That is because OUTPUT has a special meaning in arduino sketches, and when
the code is compiled from code that you can read (for example, the word
pinMode) into code that the arduino actually runs (it only understands 1s
and 0s, voltage high and voltage low), the compiler (the software that
converts human readable code into machine readable code) will replace
all instances of the word OUTPUT with the correct value so that the arduino
knows to make the pin an OUTPUT. This is similar to how we created a
nickname for the pin that we attached our LED and button to.
*/
pinMode(led_pin, OUTPUT);
//now we need to set the button pin to be an input
pinMode( button_pin, INPUT);
// we now have our pins set, so we can write our code.

} //this curly bracket ends the setup routine.
// curly brackets tell the program that all the code you write in between the
// brackets belongs to a specific routine or function.

// the loop routine runs over and over again forever:
void loop() {
/*
Now that we have set everything up, we can tell the arduino what to do.
But first we need to have a clear idea of what we want it to do.
We want the arduino to see whether or not a button is pressed and turn on
an LED only if it is pressed. Written another way, if the button is pressed,
we want to turn the LED on, otherwise we will turn it off.
Fortunately, there is a command called if that checks to see if something
is on or off. Since the arduino only understands voltage, it thinks that
HIGH voltage (5 volts) is on and LOW voltage (0 Volts) is off. Remember
that the arduino can't count to 5. If it sees a HIGH voltage signal, it
will count that as a 1.
*/

/*
Now that we know that we want to use an if statement to check to see if the
button is pressed, we are going to make another variable that keeps track of
the button so that we can see if that variable is high or low (1 or 0).
The circuit is shown in Lesson 1, and the button_pin will be high (1) if
the button is pressed and low (0) if the button is not pressed. We want to
read the voltage of the button pin, and to do that arduino has a command
called digitalRead. This reads in the value of a pin as either high (1) or
low (0). It is called digitalRead because it will read in only a digital
value, which is either 1 or 0. It will only output 1 or 0, nothing in between.
If the voltage value is not 0V or 5V, it will round to 1 or 0 depending on
how close the voltage is to 0 or 5. digitalRead works by writing
digitalRead( pin to read voltage from);
*/
int button_state = digitalRead( button_pin );
/*
Note: In later code, all of our variables that we want to use throughout the
sketch (global variables) will be defined before we call the setup routine.
This is so that every time we run the loop, we don't make another
button_state variable. I'm doing it this way so that you can see what is
going on.
*/

/*
Now we want to see if the button is high or low. To do that, we want to
check to see if the button_state variable is equal to 1 or 0. To compare
two values, we can use two equals signs (==). One equals sign is used to
set a value, for example button_state = 0. Two equals signs tells the
arduino to compare the two values and see if they are equal. If they are,
then the statement is true or 1. If not, the statement is false or 0. This
is how we can use the if statement, by checking to see if a certain condition
is true.
Note: after a function or an if statement, you should indent your code to make
it easier to know where that code fits in the grand scheme of things.
*/
if (button_state == HIGH) {
// turn LED on
digitalWrite(led_pin, HIGH);
}
/*
But what if the button is not pressed? Then we want to execute a different
piece of code. After an if (or series of if statements), you can write an
else statement that will run if the if code did not run. So, we want
to turn the LED off if the button is not pressed. To do that, we use the
else command (which doesn't have a condition to check, and uses curly
brackets to tell the arduino what code to execute.
*/
else {
//turn LED off
digitalWrite(led_pin, LOW);
}

/*
That's it. The arduino will now constantly check the the voltage on the
button pin and turn the LED on or off depending on whether the button is
pressed or not.
*/

} // this curly bracket ends the loop. When the arduino runs the code and gets
// to this point, it will start the loop over.

/*
Here is the complete code without my comments. Does it make sense?
int led_pin = 11;
int button_pin = 12;

void setup() {
pinMode(led_pin, OUTPUT);
pinMode( button_pin, INPUT);
}

void loop() {
int button_state = digitalRead( button_pin );
if (button_state == HIGH) {
digitalWrite(led_pin, HIGH);
}
else {
digitalWrite(led_pin, LOW);
}
*/

// Hmh csy jmkyvi syx xli Giewev gmtliv?

Apr 11

Lab 1

This is the first lab assignment in the laser tag course. This lab covers Ohm's Law, LEDs, buttons, breadboarding and schematics. The purpose of this lab is to help you to understand how voltage, current and resistance are interrelated, how to connect circuit elements on a breadboard and how to read schematic drawings.

Before you can build a circuit, you need to know how to connect the parts together. To do this, we are using a solderless breadboard, which is a prototyping tool that is used to connect parts together without permanently bonding them (not using solder, which is a metal that you melt onto wires to connect them). A solder less breadboard has holes in it where you put the wires in to connect them to each other. A picture of a breadboard is shown below to demonstrate how a breadboard is used to connect components together.

Figure 1: Picture of a Breadboard. Every wire is connected only to wires of the same color. (click on the picture to make it bigger)
Breadboard_bb

In Figure 1 above, the wires are connected to all of the wires that are the same color. There are four rails (holes that are electrically connected) that go down the left and right sides of the breadboard. These rails are connected vertically. For example, on the left most rail, all of the red wires are connected to each other and all of the blue wires are connected to each other, but the blue wires are not connected to the red wires. These are usually where you place battery power, with positive voltage on the side of the rail with the red line (this has the red wires in it) and the negative voltage on the rail next to it (this rail has blue wires in it). The middle part of the breadboard has rails that electrically connect the holes horizontally (as the green and yellow wires show). This part of the breadboard is separated into two sections (the green wires are all connected, and they are not connected to the yellow wires). For a true test of connectivity, see if you can explain why all of the grey wires are connected to each other.

The materials that are required to do this lab are: a 9V battery, 9V battery clip, LED (any color), assorted resistors, solder less breadboard, wire, wire strippers (for cutting different lengths of wire). You need to connect the battery, LED, button and resistor on the breadboard so that electricity can flow from the positive terminal of the battery (red wire), through the button, then the LED (through the positive [longer] leg of the LED) to the resistor, and then to ground (negative voltage, or the black wire in Figure 2 below).

Figure 2: Lab 1 Breadboard Picture (click on the picture to make it bigger)

Lab1_bb

Lab Description:

Build a circuit to turn on an LED using a push button. Calculate the resistor value (how much resistance) that is required to have only 0.02 Amperes (20 mA) go through the LED. The circuit is shown on a breadboard in Figure 2 and the schematic is shown in Figure 3.

Extra Credit:

Find the resistance values you would need for the current consumption to be 5 mA, 10 mA, 15 mA. Build these circuits too and see how the light coming from the LED is effected. Why does this happen?