Build the circuit step by step
In order to build the basic circuit described in this chapter, you’ll need the following parts.
You’ll need these parts:
- 2 red LEDs
- 1 220 ohm resistor (red, red, brown, gold)
- Jumper wires
- Arduino Uno
- USB A-B cable
- Computer with Arduino IDE
This circuit is quite similar to the circuit that we built in Chapter 3. The one difference is that we are not powering the LED from a pin on the Arduino, but from the 5 Volt power bus on the breadboard.
Build the basic circuit
As we said, there is one major difference in this circuit from the one we built in Chapter 3: we are not connecting it to a digital pin on the Arduino. We are instead going to get power from the power bus on the breadboard. Remember, the power bus is connected by a red jumper to the pin marked 5V (for 5 volts) on the Arduino.
Before we start building, let’s take a look at the block of power and ground pins, There is a pin marked 5V, and also one marked 3.3V, as well as pins marked GND for ground.
While we have been building our circuits using 5V, you can also use 3.3V to build some circuits with components that require less voltage. The 3.3V port works the same as the 5V except it puts out a lower amount of voltage.
Here are the steps to build the circuit:
- Attach one end of a jumper to the 5V pin on the Arduino, and the other end of the jumper to the power bus on your breadboard (that’s the column marked with a red +)
- Grab another jumper and attach one end to the GND pin on the Arduino, and the other end to the ground bus on your breadboard (that’s the column marked with the green -).
- Connect a jumper from the power bus to a row of tie points.
- Connect one lead of a 220 ohm resistor to the same row of tie points.
- Connect the anode (long leg) of the LED to the other lead of the resistor.
- Attach a jumper from the cathode (short leg) of the LED to the ground bus.
When you have the circuit built, use the USB cable to attach your Arduino to your computer. We aren’t going to write a sketch; you’re just using your computer as a power source for the Arduino.
Debugging the circuit
If your LED lights up when you attach the USB cable to your computer, you can skip to the next page. If not, let’s troubleshoot, or “debug” the circuit.
We learned about debugging in the earlier chapters. It is the process by which you methodically check your project to eliminate any issues that might be causing problems. By eliminating each issue one by one, you can be sure that the circuit should work as described.
Check that power and ground are connected to the breadboard busses and the correct ports on the Arduino.
Check that the LED is oriented correctly (anode connected to resistor that is connected to power, cathode attached to jumper that is attached to ground). Here’s what it should look like:
Check the continuity; the leads of the components that are supposed to be connected need to be in the same row of tie points.
Now that we have our circuit fully functional, let’s discuss how electricity is flowing through the circuit.