I think it is important that Bas on Tech can be used by everyone free of charge.

Help me ensure the future of Bas on Tech. Your donation will be used for hosting, videos and maintenance, among other things.

Thank you in advance!

# #2 · Blinking LED on breadboard

## Tutorial goals

• Knowing how a breadboard works
• Knowing how a resistor works with a LED
• Knowing how a LED works

## Components needed

• 1× Arduino
• 1× LED
• 2× Jumper wire (male-male)
• 1× 470 Ohm (gold-brown-violet-yellow) resistor

## Introduction

In the previous lesson, you blinked the built-in LED on the Arduino . Now it is time to start using a LED on a breadboard. We are going to use a resistor , LED , breadboard and two jumper wires . This might seem boring (it is a little bit ðŸ˜‰), but it forms the basis of all the other lessons we are going to do. For example, do you know why we have to put a resistor in front of an LED? No? Then read on quickly! ðŸ¤“

## Course material

At the bottom of this page you'll find the course material button. This button allows you to download the code, circuit diagram and other files relevant to this Arduino tutorial.

## What is a breadboard?

A breadboard is being used for building temporary circuits. You can use it for proof of concept circuits which can later be designed as a printed circuit board or soldered. This way you avoid having to solder and desolder components many times.

You can easily prick and remove all your components in the breadboard. The holes are pre-connected in a special way. This is useful because you don't need wires to create these connections.

For example, the breadboard in this photo connects all the top row holes marked with the plus sign together (marked with the red line). The same goes for the minus holes (the blue line). The others are connected from top to bottom towards the center. This interruption ensures that the top and bottom halves are not connected to each other.

Some breadboards have their holes labeled with letters and numbers. In the picture below `a30` is connected with `e30`, but not with `f30` because of the little gap in the center. `a7` is not conencted with `a8`, because they are each in a seperate row.

## LED (Light Emitting Diode)

LEDs come in lots of sizes and colours. Sometimes a translucent LED could for example lit in blue or red.

If you look around, you probably see LEDs here and there: your phone, computer, battery charger, tv etc. One of the advantage of an LED is that is does not use a lot of power and is a lot more efficient over a traditional lightbulb.

The name LED contains the word diode. A diode only conducts current in one direction. So make sure you plug an LED into your breadboard correctly. A tip is, if an LED does not turn on, to check whether you have connected it in the right way.

If you look closely at the photo above, you can see that the legs of an LED are not the same length. These legs are called the Anode and Cathode. There is a mnemonic for this: don't PANiC, Positive Anode, Negative Cathode.

## Resistors

In this circuit we use a resistor. This part ensures that electricity can flow less easily. You also have different types and sizes of resistors. Every resistor has a value: the resistance value. Often times we just say resistance. This value is the number of Ohm.

To know how many Ohms a resistor is, they invented colored rings. Each color combination represents a value. You can calculate this yourself, but there is also a handy resistance calculator available online. With this calculator you can convert from color code to Ohm, or vice versa.

ðŸŽ“ Can you find out what the value of this resistor is?

## Measure resistance with a multimeter

You can of course also use a multimeter to determine the value of a resistor. Set your multimeter to the & # 8486; position and hold one pin against the left and the other pin against the right side of the resistor.

## Abbreviated resistance notation

For large resistance values it can be annoying to write down all the numbers every time. An abbreviation has been devised for this. 20,000 is then written as '20K' and 4,700 as '4K7'. The 'K' stands for Kilo or 1000.

ðŸŽ“ What resistance value is `5K6` the abbreviation of?

## The circuit

In this circuit we see that the anode of the LED is connected via a resistor to 'pin 11' on the Arduino. Then the cathode of the LED is connected to the ground (GND) on the Arduino

## Why do we place a resistor in front of an LED?

An LED has very little resistance. Suppose you use a red 2.2V LED with the 3V of your Arduino, then the LED breaks. Simply put, we use the resistor to prevent too much current from passing through the LED. The formulas to calculate exactly how big your resistance should be can be found on Stack Exchange .

## Arduino Code

The code is almost the same as in the previous lesson. The only difference is that on line 4, instead of `LED_BUILTIN` we now use` pin 11`.

``````1 // the setup function runs once when you press reset
2 // or power the board
3 void setup() {
4     // initialize digital pin 11 as an output.
5     pinMode(11, OUTPUT);
6 }
7
8 // the loop function runs over and over again forever
9 void loop() {
10     digitalWrite(11, HIGH);   // turn the LED on (HIGH is the voltage level)
11     delay(1000);              // wait for a second
12     digitalWrite(11, LOW);    // turn the LED off by making the voltage LOW
13     delay(1000);              // wait for a second
14 }
``````

Now our program is ready to upload to the Arduino. First we have to connect our Arduino to the computer with the USB cable. Make sure you've selected the correct board in the IDE:

Tools â–¸ Board â–¸ Arduino/Genuino UNO

and the correct port:

Tools â–¸ Port

If you are not sure which port to use, try them all until you can successfully upload your code.

The top left shows a round button with a checkmark. By pressing this button you tell the IDE to verify your code for possible errors. The IDE only checks if it can read your code. It does not check if you have written correct code for what you are trying to program.

If everything works the IDE shows the `Compiling completed` message. You can now upload your code by pressing the round button with the arrow to the right. The uploading is complete when the `Avrdude done. Thank you.` messages appears. Your program will immediately start after uploading. As a result you should now see your Arduino LED blink with 1000ms intervals.

## Challenge ðŸš€

You have completed another lesson, well done! Here's your challenge for lesson 2:

ðŸŽ“ Write a program where the LED blinks the SOS signal pattern.

Good luck!

## About Bas on Tech

My name is Bas van Dijk, entrepreneur, software developer and maker. With Bas on Tech I share video tutorials with a wide variety of tech subjects i.e. Arduino and 3D printing.

Years ago, I bought my first Arduino with one goal: show text on an LCD as soon as possible. It took me many Google searches and digging through various resources, but I finally managed to make it work. I was over the moon by something as simple as an LCD with some text.

With Bas on Tech I want to share my knowledge so others can experience this happiness as well. I've chosen to make short, yet powerful YouTube videos with a the same structure and one subject per video. Each video is accompanied by the source code and a shopping list.