Brain Powered
Mini Project Controlling the LED
In past projects, you used a physical switch to control a circuit. In this project, you will be able to control the LED by running a program on the Arduino that controls the signal to the LED.
Find the following components in your kit:
- Arduino Uno
- Arduino Software
- USB A-to-B cord
- Computer with USB port
- Multimeter
- Wire Stripper
- Header Pin Crimper
- 22 AWG Wire
- LED
- Male and Female Header Crimps
- Header pin housings or shells
Using the USB A-to-B USB cord, connect the Arduino Uno to your computer.
If you haven’t done so yet, go to the Arduino site to download the latest version of the Arduino IDE programming software. This will be used to "program" your Arduino microcontroller to make an LED blink.
Take the 22 AWG 5 pin wire and separate the wires so that you only have the red and the black wire.
Create your wires so that both the red and black wires have 1 male header on one end and 1 female header on the other.
Use the following steps to refresh yourself on attaching male header pins to wires.
To begin attaching and crimping spade connectors, you will need the following:
- 22 AWG Wire
- Wire Cutter/Stripper
- Header Pin Crimper
- Male or Female Header Crimps
- Header pin housings or shells
- Needle nose pliers or Wire Cutter / Stripper
You may want to have extra crimps and wires. These crimps are small, require a special crimping tool, precise techniques and practice to create a proper crimp.
Header pin crimps are made up of three distinct portions: The mating pin zone is the portion of the crimp that interfaces with the component that you are connecting to. The other two portions interface with the wire. There is the conductor crimp zone which is the portion of the cimp that forms around the conductor and makes the electrical connection. The final part is the insulation crimp zone, where this part of the crimp forms around the wire’s insulation. This further securies the wire and creates a strain release. Both male and female header pins are crimped using the same process.
Cut a piece of the wire to the needed length and separate the number of wire you need from the .
Strip the ends of the wire so that 0.10 in or 2.5 mm of wire is exposed. It may be easier to strip the wires longer and trim the exposed wires to 0.10 in or 2.5 mm.
Cut off the male or female pin off of their connector strips. Keep the metal tab connected to the crimp, it will be used to align the crimp into the header pin crimper.
Place the wire into the crimp. Make sure the exposed wire is not in the mating pin zone.
To give your crimp a better chance to be successful use your wire cutters or needle nose pliers to start to fold over the tabs on the insulation crimp zone.
The recommended crimper has 2 different crimping areas the larger anvil crimps the insulation zone while the smaller anvil crimps the conductor zone. Make sure to line up the zones correctly or the crimp will not crimp properly.
Use the crimping tool to crimp the conductor crimp zone and the insulation crimp zone. Make sure the Mating pin zone is extended completely out of the crimping tool. If you crimp this part it will deform and will not function
After crimping, if you inspect the connection and see that the crimped parts are not fully compressed onto the wire you may want to crimp the connection a second time.
Once the crimp is successfully attached to the wire you can remove the metal carrier strip by bending or cutting it off. After removing that, the crimp is ready to be placed into the plastic housing.
The plastic housing, or shields as they are sometimes called, add structure and support to make the crimp more durable. The plastic housings come in various sizes that can hold multiple connections in one block. Some projects will have all the connections next to each other which make the multi-connection block very convenient to use. Using single pin housing is easier to learn on and creates wires that have more flexibility in how they can be connected.
Both the male and female header pins have a small square or rectangle of metal in the pin mating zone. This metal “tab” will lock itself into the square opening or “slot” in the housing. Make sure the tab and the slot are facing the same direction and push the crimp into the larger opening in the housing. If done successfully the crimp will lock itself in the housing.
Perform a pull test to confirm that the crimp will not slip out of the housing. If the housing does not easly slip off you have successfully made a crimp!
Plug the Male Header Pins of the two wires into the Arduino. The black wire should go into a GND port, and the red wire should go into port 13.
Plug the positive leg of the LED into the red wire and the negative end into the black wire.
Open up the Arduino software, and go to the Tools menu and select Board < "Arduino/Genuino Uno". This lets the Arduino software know which Arduino board you are using (there are several types!).
On the menu bar, select “Open”, and in “01. Basic”, select “Blink”.
Click on the Upload button to upload the “Blink” program to the Arduino Uno.
What happens?
The LED should blink on and off every second! The Arduino Uno is sending a signal every second to either turn on the LED, or to turn it off.
Explanation
To explain what’s happening, let’s take a look at the program that you uploaded to the Arduino Uno:
The text that is "gray" are called Comments. The Arduino just ignores this text, but they’re really useful for times when you need to go back into a program to remember what different parts of the program do.
If you look further down, you will see “void setup()”. Inside of this, you will see something that says “pinMode”. This command lets the Arduino know that you’re setting the port to be an “Output” as opposed to an “Input”. So the Arduino is expecting that port to send signals OUT (output), not IN (input).
Inside of the “void loop()” is where the on and off commands happen. You’ll see “digitalWrite(LED_BUILTIN), HIGH)”. This line tells the Arduino to “turn on” the port called “LED_BUILTIN”, which is a built-in LED on the board and it happens to also be connected to Port 13.
The next line says “delay(1000);”, which tells the Arduino to just “wait” for 1000 milliseconds, or 1 second.
The next two lines tells the Arduino to set Port 13 to “LOW”, or off, and then wait again.
Since it is in a “loop”, it will do these things forever! This results in the light blinking on and off every second.