Reader small image

You're reading from  Arduino Development Cookbook

Product typeBook
Published inApr 2015
Publisher
ISBN-139781783982943
Edition1st Edition
Tools
Concepts
Right arrow
Author (1)
Cornel M Amariei
Cornel M Amariei
author image
Cornel M Amariei

Cornel Amariei is a Romanian inventor and entrepreneur in the fields of Robotics and 3D printing. He has been working with the Arduino platform since its early days in 2007. His past experience involves large cargo gamma ray scanning robotics, ATM security systems, and blind assisting devices. In his spare time, he is a performing musician playing multiple instruments—predominately the guitar. He is also a swimmer, water polo player, and photographer. Over the years, he has built hundreds of Arduino projects, ranging from flying Quadcopters to levitating magnets and underwater robots. Currently, he splits his time between doing his undergraduate studies in electric engineering and computer science at Jacobs University in Bremen, Germany, and his start-ups and research and development job.
Read more about Cornel M Amariei

Right arrow

Appendix A. Electronics – the Basics

The Arduino is an electronic platform. In order to use it properly, we need to know at least some basics about electronics, such as:

  • Working of electric current

  • Ohm's law

  • Diodes and LEDs

  • Working with breadboards

Working of electric current


Here, we will explore how electric current works. Electric current represents the flow of electrical charge in a conductor and it's measured in amperes, symbolized by A. Voltage represents the difference in electrical potential between two points of a circuit. It is measured in volts, symbolized by V. Let's think of a battery. Each battery can be considered a voltage source, and it has two terminals, a positive (+) and a negative (-). Following is one of the standardized symbols for voltage sources:

In the diagram, we see a voltage source that produces 9 volts. This means that the positive terminal has a 9 V difference over the negative terminal. The negative terminal is usually referred to as ground, GND for short. An important convention when dealing with current is the direction of current flow—from higher potential (voltage) to lower. The following diagram shows how the current flows from the positive terminal, through a resistor, back to the negative terminal:

Resistance is the measure of the property of a material to oppose current flow. It's measured in ohms, symbolized by the Greek letter Ω. The resistor is the component that uses its internal resistance to restrict current flow. This is the schematic symbol, and next to it, a normal resistor:

In the following section, we will see how resistors function in a circuit.

Ohm's law


Electronics is all related to Ohm's law. This provides the relation between voltage, current, and resistance in a circuit. The law states that the current passing through a resistor is directly proportional to the applied voltage across it. In mathematical forms, it looks like this:

A simple way to remember and apply it according to either of the variables is the following triangle:

If we want to find the current, we cover I and we get V divided by R. The same goes for R: we cover it and we obtain V divided by I. Lastly, V will equal I multiplied with R. Let's now apply this knowledge to the following circuit:

Here, we have one 5-volt voltage source in series with one resistor R1 with a resistance of 100 Ω. Because we have only one resistor, the total voltage across it will be equal to the voltage of the source, 5 V. We can now apply Ohm's law to find the current in the circuit:

Remember that 1 ampere equals 1,000 milliamperes, represented by the unit mA.

Resistor configurations

If we have more than one resistor in series, we can use the rule of series resistance. It states that any number of resistors in series can be replaced by only one, with the resistance equal to the sum of all replaced resistances. Mathematically, it is depicted as seen here:

The following diagram shows the two resistors on the left in series R1 and R2. On the right, it shows the same circuit, but now with an equivalent resistor R3, which equals R1 + R2.

There is also the parallel resistor configuration. When we mount two or more resistors in parallel, the current is split among them. This results in a lower overall resistance. For two resistors, the formula looks like this:

The following diagram proves just that. On the left we have the normal circuit with two resistors in parallel, and on the right we have the equivalent resistor value:

We can buy resistors with a variety of internal resistances. To easily determine what resistance a resistor has, a color code has been created. We can find the color stripes on every resistor. This is a helper diagram, which shows how to read the resistor color code:

You can find an online equivalent resistance calculator at http://calculator.tutorvista.com/equivalent-resistance-calculator.html.

Diodes and LEDs


There are two more components we should discuss: diodes and LEDs.

Diodes

A diode is a component that only allows current to pass in one direction. The arrow in the circuit symbol indicates this direction:

Next to the circuit symbol on the left, we have a real diode. The stripe represents the stripe in the circuit symbol, and the direction where the current goes out of the diode.

If we look at the following circuits, the one on the left will conduct current while the one on the right will not:

However, even when a diode allows current to pass, it drops the voltage. For a typical value, it drops the voltage by 0.7 V. Let's try and apply Ohm's law to the left circuit again. If the diode drops the voltage by 0.7 V, it means we have 4.3 V across the resistor. This will result in:

LEDs

There is a variation of the normal diode, called Light Emitting Diode or LED. It's basically a very small and efficient light bulb. We can find LEDs in everything these days: displays, phones, computers, toys, and so on. They have the same function as a diode, except that they also emit light when current passes through them. The electrical symbol is almost the same, but it looks completely different in real life:

They come in a variety of colors and power ratings. A typical 3-mm green LED will consume around 20 mA and will cause a 1.9 V drop across it. A diode doesn't restrict the amount of current through it, so we should always connect a resistor in series with a diode or LED. In the following schematic, we have a 20 mA LED that causes a 1.9 V drop. Let's try to calculate the perfect resistance for it:

Due to the 1.9-volt drop across the LED, we only have 3.1 V across the resistor. Now we can apply Ohm's law to find the resistance:

You can find an online LED resistance calculator at http://www.hebeiltd.com.cn/?p=zz.led.resistor.calculator.

Working with breadboards


When we need to test a schematic, we can quickly assemble electronic components on a breadboard. It is a simple and very powerful invention that makes electronics prototyping easy.

Look at the breadboard and correlate with the following diagram. Breadboards differ in size, shape, and color but they all share the same principle:

On the left we have a simple breadboard; on the right, we have the same breadboard with the internal connections shown. At the bottom and the top of the board we can see letters. If we follow, we can see that, on each row, the letters A, B, C, D, and E are interconnected, as shown by the yellow wire.

This means that, if we plug a pin in A, we will have a connection to B, C, D and E on the same row. Rows are not interconnected. As seen in the diagram, each row is individual. Also, on the same row, A, B, C, D, and E are not connected in any way to F, G, H, I, and J.

Some breadboards also have long power connectors on the sides. We can see them in this example by the red and black cable. These long strips are very useful for supplying power and GND to different parts of the board easily.

lock icon
The rest of the chapter is locked
You have been reading a chapter from
Arduino Development Cookbook
Published in: Apr 2015Publisher: ISBN-13: 9781783982943
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
undefined
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime

Author (1)

author image
Cornel M Amariei

Cornel Amariei is a Romanian inventor and entrepreneur in the fields of Robotics and 3D printing. He has been working with the Arduino platform since its early days in 2007. His past experience involves large cargo gamma ray scanning robotics, ATM security systems, and blind assisting devices. In his spare time, he is a performing musician playing multiple instruments—predominately the guitar. He is also a swimmer, water polo player, and photographer. Over the years, he has built hundreds of Arduino projects, ranging from flying Quadcopters to levitating magnets and underwater robots. Currently, he splits his time between doing his undergraduate studies in electric engineering and computer science at Jacobs University in Bremen, Germany, and his start-ups and research and development job.
Read more about Cornel M Amariei