LED: white, red, green, blue
5V power supply/battery/arduino board
22 gauge solid core jumper wire - It's a good idea to get many colors of wire (esp black and red) so that you can keep your breadboard organized.
Step 1: The Basics
Breadboards are usually divided into four sections, two outer sections and two inner sections. Each row of five sockets in the inner sections are electrically connected to each other (see the green lines in figure 3). The two outer sections of the breadboard are usually used exclusively for power. On many breadboards these sockets will be labeled with colors denoting positive voltage (usually red) and ground (black or blue). It is important to note that on many breadboards the power lines only run half the length of the board (as indicated in figure 3). You will need to run a wire between these two sections to send power to from one end to the other. There is nothing special about the outer sections of the breadboard that makes particularly suitable for power other than that they run most of the length of the board, but if you choose to use these rows for other things you may confuse others or even yourself, so it is good practice to use these for power only.
Step 2: Getting Started
Power supplies come in many shapes and sizes, you may have to dial in the voltage or your power supply may only let you chose from one or a few types voltage levels. For this tutorial (and for many of your future projects) we will be using 5V DC power. This means that you will make two connections to your power supply, +5 and ground.
Alternative power supplies:
-use the +5 volt and GND (ground) pins of an arduino (you must plug the arduino into a computer or wall socket via usb first)
-battery- will require an attachment to connect to your breadboard
Connect ground and +V to one side of your breadboard as shown in figure 2. Remember, many breadboards separate each of the two power rows into two sections (electricity cannot flow across the center of the board), so you'll need to connect these groups with jumper cables to ensure that power is being sent across the length of the board (see figures 5 and 6). Figure 6 shows a breadboard with power on across its entire length and on both sides.
Now the breadboard is powered. Convince yourself by using a multimeter to measure the voltage of any of the sockets in the power lines of the board.
Step 3: Hello World!
The resistor is there to prevent too much current from going through the LED; we call it a "current-limiting resistor." If you connect an LED to your 5V power supply directly it will most likely burn out, this may be accompanied by a cracking sound, a smell, smoke, or even a small explosion, so be careful!
I'm using a 1/4 watt 220ohm resistor for my current limiting resistor, if you know the specs of your LED you can find the best resistor value for your circuit using an online LED calculator. Using too much resistance in this circuit will never damage the LED, it will just glow slightly dimmer, but anything between 200 and 1000ohms should be fine.
Electric current always runs from high voltage to ground in a circuit. Some components only work when current flows through them in one direction (and they may even be damaged by wiring them backwards). As the first images indicate, LEDs must be wired so that current flows from the anode (the longer lead) to the cathode (the shorter lead). Resistors do not have directionality, this mean that you can flip a resistor around in a circuit and it will behave exactly the same.
While you are putting components into your breadboard it is a good idea to turn off the power to the board; this prevents accidental short circuits which may burn out parts.
-connect the anode of the LED to +5V and the cathode to a row of pins in the middle section of the breadboard (figure 5)
-connect one resistor lead to ground and the other lead to a pin in the same row as the LED cathode (figure 6)
-connect power to the board- the LED should light up
As you can see, connecting the LED and the resistor to the same row of sockets on the breadboard created an electrical connection between these two components.
Step 4: 7 Segment Display on a Breadboard: Part 1
7 segment display (common cathode)
4511 decoder chip
A 7 segment display is a component that contains 7 rectangular LEDs (we'll ignore the DP LED for now) arranged so that they can display the numbers 0-9 (see figure 2). Each of the LEDs in the display are connected to a common cathode. By looking at the diagram at the bottom of figure 2, we can see that pins 1, 2, 4, 6, 7, 9, and 10 each connect to an anode of one of the seven LEDs and pins 3 and 8 both connect to the common cathode (see the bottom diagram in figure 2).
As in the last circuit, we need to use current limiting resistors to prevent damaging the LEDs in the display. In this step we will wire 7 current limiting resistors and individually control the 7 LEDs.
The first step is to calculate the resistance we need for the current limiting resistors.
From the 7 segment display datasheet: each LED has a forward voltage of 2.2V at 25mA of current. If there is 2.2V across the resistor, then there will be 5V-2.2V, or 2.8V across the resistor.
Using Ohm's Law (V=IR) we can calculate our current limiting resistance as follows:
(5V-2.2V) = 0.025 A * R
R = 112ohms
to be safe we won't run the LEDs at their maximum power ratings, so we'll use 150ohm resistors.
-again, disconnect power to your breadboard to avoid damaging your components
-press the 7 segment display into breadboard so the it straddles the center section of the board (figure 1)
-connect one of the common cathode pins of the display (pins 3 or 8) to ground (figure 3)
-connect power across to the other side of the board (figure 4)
-insert 7 current limiting resistors onto breadboard so that they connect pins 1, 2, 4, 6, 7, 9, and 10 to 5V (figure 5)
-turn on power (figure 6)
Your 7 segment display should light up to display the number "8." Experiment with disconnecting some of the jumper wires between the current limiting resistors and the display to make other numbers/letters; I made the letter "E" in the last image by disconnecting pins 4 and 6 on the display.
Step 5: 7 Segment Display on a Breadboard: Part 2
The pin configuration of the 4511 is given in the datasheet, and I've copied it in figure 2. Notice how pin numbering starts at 1 at the top left of the chip (indicated with a semicircle or sometimes a dot) and wraps around the outside of the chip until ending at 16 in the top right.
-disconnect power to the board
-put the 4511 on the breadboard so that it straddles the middle section of the board (figure 4)
-disconnect the 5V connections of the 150ohm resistors and connect to 4511 pins Qa-Qg. You will probably need to use jumper wires to extend these connections (green wires in figures 5, 6, and 7). Pin numbering/letters are given in the diagram at the bottom of figure 3 for the display and in figure 2 for the 4511.
-use four 10kOhm resistors to create a connection between the 4511 input pins (1, 2, 6, and 7) and four spare rows on the breadboard (figure 8)
-connect 5v to 4511 pins 3, 4, and 16 (red wires in figure 9)
-connect ground to 4511 pins 5 and 8 (black wires in figure 10)
-connect the free ends of the 10kohm resistors to ground (red wires in figure 11)
-power on, you should see the number 0 (figures 12 and 13)
Try connecting the 4511 input pins (red wires connected to 10kOhm resistors to 5V to make different numbers. Here is a table that shows you how to convert from binary to decimal:
D0(pin 7) D1(pin 1) D2(pin 2) D3(pin 6) decimal
0 0 0 0 0
1 0 0 0 1
0 1 0 0 2
1 1 0 0 3
0 0 1 0 4
1 0 1 0 5
0 1 1 0 6
1 1 1 0 7
0 0 0 1 8
1 0 0 1 9
So if you connect D0 to 5V and D1-3 to ground you should see a 1(figure 14)
D0 and D1 to 5V and D2 and D3 to ground gives a 2 (figure 15)
Since there are so many connections, it is easy to make a small mistake that causes the whole project to malfunction. If the display is not lighting up at all: check to see if all your components are powered and are connected in the correct orientation. If it is on but displaying nonsense: carefully check the schematic and make sure your connections between pins a-g are correct.
I've also attached a fritzing document for this circuit for your reference, find it below.