electricidad-basica-arduino

Basic Electronics for Arduino

  • 5 min

We said that to handle Arduino you need to know programming and electronics. The two go hand in hand.

We’ve seen a programming review, and now it’s time to start with the electricity and electronics part.

I know what you’re thinking.

Luis, I came here to play with my Arduino, not for you to lecture me on electromagnetism

Don’t worry! To work with Arduino you don’t need a master’s in electronics. But you do need to understand the rules of the game of electricity (mostly so you don’t spark something 💥).

So let’s do a quick electronics review, and get to know the three main actors and the two basic rules that govern their behavior.

Quantities

Every circuit is based on the interaction of three concepts. If you understand this, you understand 90% of what happens on your Arduino board.

Voltage

Technically it’s the “potential difference”, it’s what makes electrons move (without voltage, they’d stay still in the wire and do nothing).

It is the energy that causes electrons to move from one point to another.

  • Measured in: Volts (V).
  • In Arduino: We will almost always work with 5V or 3.3V.
  • The mental trick: Imagine a waterfall. Voltage is the height. The higher it is, the harder the water falls.

Current

It is the magnitude that measures the actual traffic of electrons. It’s what makes things work (the LED shine or the motor turn).

It is the amount of electrical charge that is actually traveling through the wire at a given moment.

  • Measured in: Amperes (A), although in Arduino we use small amounts: milliamperes (mA).
  • The mental trick: It’s the water flow rate. The number of liters passing per second.

Resistance

Any component we put in a circuit makes it a bit harder for electrons to pass.

It is the opposition to the passage of current presented by an element.

  • Measured in: Ohms ().
  • The mental trick: It’s like narrowing the pipe. If the pipe is very thin (high resistance), little water passes through.

The Rules of the Game (Painlessly)

Now that we know the actors, let’s see how they interact. Here come two 19th-century German gentlemen: Ohm and Kirchhoff.

Ohm’s Law

Georg Ohm discovered that these three elements are tied together. You can’t change one without affecting the others. The basic rule is:

  1. If there is 🔺more Voltage (more push)There will be 🔺more Current.
  2. If there is 🔺more Resistance (more brake)There will be 🔻less Current.

Kirchhoff’s Laws

Gustav Kirchhoff left us some rules about how energy is distributed. It sounds complex, but it boils down to two logical principles:

  1. What goes in, comes out: Electricity doesn’t disappear. If 5 amperes enter a wire junction, 5 amperes must leave.
  2. Energy is spent: If you take the same path through two parts of the circuit that start at the same point and end at the same point, the voltage will be the same at the beginning and the end.

They seem very obvious, but they have quite a bit to them. They are the basis of circuit analysis.

The Concept of GND

Electricity always needs a closed circuit. The electrons have to leave the power source, do their work, and go back home.

  • 5V / VCC: This is the starting point, where there is a lot of energy (high pressure).
  • GND (Ground): This is the return point, the zero level (the drain).

The Concept of Short Circuit

We already know that electrons want to go from 5V to GND. Normally, we put something in between (an LED, a motor, a resistor) so that energy does something useful along the way.

But, what happens if you connect a wire directly from 5V to GND with nothing in between?

The electrons find a free path, with no resistance, “an empty highway” and go “off I go”. The board heats up, smells burnt, and you’ve created a Short Circuit.

I suppose it doesn’t even need to be said that you should avoid short circuits if you want to

  • Not break your electronics
  • Not burn your house down
  • Not get a shock