Learning Activity #2

advertisement
Unit 2- Learning Activity #2
Creating a Circuit with a Breadboard
Description
In this activity, students will learn how to use a breadboard to connect electronic components to
the Arduino. Students will add multiple LEDs to the circuit and modify the Blink program to make
the LEDs blink in different patterns
Suggested Duration
2 periods
Step-by-step instructions
➞
➞
1. Interface of the Arduino (RedBoard)
● Anatomy of the Arduino and Pins Diagram
We are using the RedBoard from SparkFun but the RedBoard and Arduino are essentially the
same boards.
Look at the numbered sections of the board with their descriptions in the list below.
1.​Power In​ (Barrel Jack) - Can be used with either a 9V or 12V wall-wart or battery.
2. ​Power In​ (USB Port) - Provides power and communicates with your board when plugged into
your computer via USB.
3. ​RX: Receiving (LED)​ - This light indicates that the computer is receiving data from the
microcontroller.
​
4 .​TX: Transmitting (LED)​ - This light indicates that the computer is transmitting data to the
microcontroller.
5. ​Pin 13: Built in LED​ - This LED blinks at Arduino boot time and when a sketch is uploaded. It can
also be programmed to turn on and off like in the “Blink” sketch.
​6. ​Pins (ARef, Ground, Digital, Rx, Tx)​ - These various pins can be used for inputs, outputs, power,
and ground.
​7.​LED (Indicates RedBoard is ON)​ - This is a simple power indicator LED.
​8. ​Reset Button​ - This is a way to manually reset your RedBoard, which restarts your code.
​9. ​ICSP Pins​ (Uploading Code without Bootloader) - This is for "in-circuit serial programming”, we
won’t be using these pins in our lessons.
​
10. ​Pins (AnalogIn, PowerIn, Ground, PowerOut, Reset) ​-These various pins can be used for inputs,
outputs, power, and ground.
2. Primary Electronic Components
● Solderless Breadboard
○ Solderless Breadboards are one of the most fundamental pieces when learning how
to build circuits. They are used to easily prototype electronic ideas without having to
permanently solder the wires and components together. Check out the SparkFun
Tutorial on​ ​How To Use A Breadboard​.
● Resistors (see also Resistors-Characteristics.pdf in the resources folder)
❏ Resistors are used to resist the flow of electricity
(otherwise known as current). That's why they're
called resistors. By resisting current they control
where and how fast it flows.
❏ Resistance is measured in ohms, often written as
the symbol Ω. Resistors come in varying degrees
of "resistance", and the coloured bands on the
resistors indicate the resistor’s amount of
resistance in ohms.
❏ There are a number of resistor band calculators
online (here is one of them: Resistor Calculator--)
It is important to select the correct one for your
project so that the components do not burn out
because there is too much current.
● LEDs​ (see also LEDs-Characteristics.pdf in resources folder)
❏ LED stands for Light Emitting Diode. Current in a
diode can only flow from the positive side to the
negative side.
❏ The longest leg of an LED is the positive leg
(​anode​) and the shorter leg is the negative leg
(​cathode​).
❏ LEDs should be used with a resistor when hooking
up an LED to a current. An LED can burn out if too
much voltage is allowed to pass through. A
resistor will limit the voltage to prevent damage.
What resistor should you use for an LED?
○ The formula to calculate resistance in a circuit is:
■ R = V / I​ (Ohm’s Law)
■ Resistance = (Source Volts -​ LED Volts) / (Current / 1000)
■ Source Voltage:​ how many volts are you putting into the LED? - Ex. battery size
■ LED Current​: info found on the LED package. Ex. Green LED is 20mA
■ LED Voltage​: info found on the LED package. Ex. Red LED is 2V
○ Online calculator: “​The LED Center​” (For single LEDs)
● Diodes (see also Diodes-Characteristics.pdf in the resources folder)
❏ A diode is an example of a semi​conductor component.
The function of a diode is to control the direction of
electricity.
❏ Diodes act like a valve, where they only allow the
electrons to flow in one direction through them. Think of a
diode as a one ​way street for electricity. Every diode has
two terminals (ends) that are polarized. One is positive,
one is negative.
❏ The positive end of a diode is called the anode, and the
negative end is called the cathode.
❏ There are several kinds of diodes and an LED is an
example of a diode.
Exercise #1: Wiring components to the Arduino and a breadboard
● Materials:
○ Arduino
○ Computer with the Arduino IDE/ USB cable
○
○
○
○
Solderless Breadboard (Breadboard)
LED
330Ω resistor
Jumper wires
1.
Ask the students to wire all the components like a diagram below
2. Ask the students to launch the Arduino IDE and open the Blink sketch that they used
in Learning Activity #2: File → Examples → SIK Guide Code → Circuit_01
3. Run the sketch
■ Is the sketch compiling properly? Did it upload correctly?
■
■
■
■
Are the LEDs in the right way?
Are the resistors in the right sockets?
Are the LEDs connected to ground on the other side?
Is the breadboard wired up right? Check your connections.
3. Parallel and Series Circuits
● Series Circuit:
A closed circuit in which the current follows
one path. In a series circuit, the current
through each load is the same and the total
voltage across the circuit is the sum of the
voltages across each load. Going back to
the analogy where the current is the
amount of water and the voltage is the
pressure, if the pipe gets narrower in two
locations, the same amount of water will
still be flowing through both narrow
sections (the loads), but the pressure will
reduce as the water moves through the
narrow parts of the pipe. The brightness of
the LED depends on the current. Since the
same current runs through all LED’s they
will have the same brightness, but each
LED will use up some Voltage so you need
to use a power source with enough voltage
to power the sum of the LED’s.Since the
current is following on one path, if LED1
stops working, all consecutive LED’s will
stop working as well.
● Parallel Circuit:
A parallel circuit is a closed circuit in which
the current divides into two or more paths
before recombining to complete the circuit.
Each load connected in a separate path
receives the full circuit voltage, and the
total circuit current is equal to the sum of
the individual branch currents. If one pipe
branches off into two, the water pressure
will remain the same in both pipes, but the
amount of water will be divided. If it takes 4
volts to power an LED, you can run two
LED’s in parallel, provide it with 4V and both
will light up (in series you would need 8V)
but the current will be divided, so the LED’s
won’t be as bright. Since the currents run
along separate paths, if one LED stops
working the other will still light up.
● Let’s summarize a comparison of the two example circuits.
○ LED 1 & 2 in series circuit will be brighter than LED 3 & 4 because LED 1 & 2 are
getting full current whereas the LED 3 & 4 are divided.
○ LED 1 & 2 both need to function in order for the circuit to work, but LED 3 can light
even if LED 4 is broken and vice versa.
○ LED 1 & 2 need a power source that is the sum of the necessary voltage to light each
LED and LED 3 & 4 need a power source with the voltage needed to light only one
LED.
4. Blinking Challenges (Blink-Assessment-Challenges.pdf)
● Demonstrate your understanding of the basics of digitalWrite(), delay(), and wiring using a
solderless breadboard by completing as many of the following challenges as possible. As
you work on the challenges, in your Design Journal, show
○ Pseudo-code of your concept
○ A drawing or sketch of your circuit
○ A working circuit to your teacher
● Challenges
A. Wire up an LED to pin 10 to blink with a 0.5 second period.
B. Wire up an LED to pin 12 to blink 5 times every 10 seconds.
C. Wire up 3 LEDs to Blink in an alternating pattern.
D. Design and Create a light chasing pattern display with at least 4 LEDs.
E. Create a Railroad Crossing light pattern.
F. Design and Create an LED ring where the LEDs alternate between chasing in a
clockwise pattern and then in a counterclockwise pattern.
G. Create a Twinkling light pattern with at least 4 LEDs.
5. Reflection Questions
Resources
●
●
●
●
Can you describe what the Blink code does?
Which pin the LED is connected to? An input or an output?
Can you identify the ground and the power wires and how they connect to the breadboard?
Why are resistors used with LEDs?
●
●
●
●
●
●
How To Use A Breadboard
Resistors-Characteristics.pdf
LEDs-Characteristics.pdf
The LED Center
Diodes-Characteristics.pdf
Blink-Assessment-Challenges.pdf
Download