HW3: The breadboard

As mentioned in the previous article, in this one we will learn what is a breadboard and how to use it.

The integrated circuits, such as Arduino UNO itself, have the various components soldered on a board.

For educational purpose we have to often move the components around and most of all we want to be able to easily reuse our components once we have finished with a project and we want to start a new one.

For that reason we will use a breadboard.

A breadboard is nothing more than a plastic box full of holes connected together according to a schema that I’m going to explain, but first let’s see how a breadboard looks like


The breadboards exist in various sizes, the one in the image is an “half breadboard”, other are bigger, but the usage is the same.

This breadbord is divided into two main sectors, one on the left (+ – a b c d e) and one on the right (f g h i j + -), each of the two sectors is independent from the other. I will talk about the left one, but the same considerations are true for the right side as well.

All the holes on the + column are connected together, that means that if we plug a wire connected to a power source to any hole in that column, we would find the same current in any other hole in the column.

Also the holes belonging to the – column are connected together, but + and – column are independent from eachother. As the labels suggest, the + column is used to plug a wire connected to a power source, – is used to plug wires connected to the ground. Nothing forbids you to invert their use, but that wouldn’t make sense, you would only get confused.

The holes in the section to the right of the – column instead are connected by rows, that means that a1, b1, c1, d1, e1 are connected together, a2, b2, c2, d2, e2 are connected together and so on, but each row is isolated from the others.

That’s it, there’s nothing else to say about the breadboar.

Now let’s see how to use the breadboard in practice to build an easy project. We will do the same as we did in the previous article, but this time we will not use the L LED, we will use an LED plugged to the breadboard.

To show the schema I will not post real pictures because it could be difficult to understand where the wires are connected. Instead I will post images taken using a software called Fritzing. Fritzing is a powerful software able to create the schema of an integrated circuit starting from a project assembled on the breadboard. This use is still far from our knowledge, so I will limit to use it to create images for our projects.

What we need for this project:

  • Arduino UNO (or compatible)
  • USB cable
  • Breadboard
  • 2x jumper wires
  • 1x 5mm red LED
  • 1x 220Ω resistor

The following image shows how to connect the components on the breadboard

single led circuit

Before to post the code I’ll comment a bit this circuit, there are a few things to say.

The LEDs have 2 leads, if you notice, one is longer than the other. The longest lead is the positive, the shortest is the negative. Don’t worry if you by mistake invert the polarities connecting an LED, it simply will not emit light. If you don’t see your LED to turn on, before to consider it broken, check if it is connected correctly.

For this project I’m using a red 5mm LED.

Why is it important to say the color and size? It is important because depending on this two parameters, the LED has different specifications. If you have the datasheets for your LEDs it’s better to read them to be sure how to use them, if you haven’t we will do some considerations to be sure enough to be safe.

We need to know the forward voltage of our LED that is the difference of voltage between the positive and negative lead.

Usually for 5mm red, yellow, green and orange LEDs the forward voltage can be assumed equal to 2.2V (in most cases 2.5V, but we want to be safe), for blue LEDs instead it should usually be about 3.4V.

Another thing to know is that a 5mm LED is usually safe to work with a current of 20mA, also a bit more, like 28mA should be safe, but let’s not overdo as first time.

What will we use these parameters for? We need them to decide which resistor to use for our project.

Why do we need a resistor? Because Arduino supplies about 40mA of current which would kill the LED, so we need to limit the current.

Now some math:

according to the Kirchhoff’s Voltage Law (KVL) we have that Arduino supplies 5V, the LED absorbs 2.2V, so the remaining 5-2.2=2.8V must be absorbed by the resistor. Brutally said: for each loop in the circuit, the voltage supplied to the loop must be absorbed by the rest of the components in the loop. We have only one loop in our circuit so the math is very easy.

We are almost at the solution.

To decide which resitor to use, now we need the Ohm’s Law which says that V=RxI where V is the Voltage, R is the resistor’s value and I is the Intensity of the current, we have all we need to solve for the R, R=V/I

In our case V=2.8V (the voltage on the resistor), I=20mA=0.02A (the current we want to have), so R = 2.8/0.02 = 140Ω.

Now we know that any resitor with a value higher than 140Ω is good for us. I’ve used a 220Ω resitor because it is the closest to 140Ω in my kit and because the values declared for each component could differ a bit from the real values.

The resistor’s value directly affects the LED’s brightness. If we use a 1KΩ resistor our circuit will still work, it will be even safer, but the light emitted by the LED will be dimmer.

If you want to learn more about LEDs you may want to read this article, it is a really good one.

We are ready to build the circuit.

First of all we plug the LED on the breadboard with each lead on a different row, so that they are not connected together. Then we put the 220Ω resistor with one end on the same row of the LED’s negative lead and the other on a free row.

Now we have to connect Arduino to the breadboard to close the circuit.

Because there is only one component which requires power and we supply the power through a digital pin (which sends and stops a signal) and not throught the 5V pin (which always gives power), we don’t use the + column, but we connect the digital pin 9 straight to the row where the LED’s positive lead is plugged.

Lastly we connect a wire from the lonely end of the resistor to a GND pin on the Arduino board.

We have completed the circuit and we are ready for the code.

With this LED we will do the same thing as we did in the previous article, then the code will be essentially the same. I’ve changed a few things to introduce something new, but you could use the exact same code as before, only changing the 13 with 9.

In this example I’ve decided to use the digital pin 9, that was not a random choice, I’ve chosen the pin 9 because it is a PWM pin.

For our purpose it is really not important which digital pin we choose and I did want to show you exactly that. PWM pins can be used in a special way, but they are basically regular digital pins and like those we can use them.

In the next article we will learn how to connect more LEDs to Arduino using the breadboard and of course I’ll write a sketch to do something with them.

I’ve tested the circuit and the code posted in this article on my equipment and it works properly, anyway I do not assume any responsibility for any damage which your components could suffer.