Basic Electronics for IoT Boards

banner_basic_electronics.jpg

Basic knowledge of electronics is crucial to design your IoT solutions, but more importantly, it keeps yourself and your users safe from electric shock or unpredictable hazards. Before diving into individual electronic components, let’s learn about how electricity works and how to use the ground to keep us safe.

The electric energy is traveled in a specific direction from negative to positive since electrons are the carriers of the electric energy and they are negative charged particles. At the atomic level, the extra electrons are those that pass the energy from one atom to another atom. If an atom does not have extra electrons in their most outer orbit or shell, it is said that collectively, they are not a good conductor for electricity. Imagine a closed circuit with a battery and a light bulb, the electric energy is traveled from the anode point of the battery to the light bulb and back to the cathode end of the battery.  The electric flow is always the same direction where electrons travel, but the charges (+/-) are not necessarily fixed with the cathode and anode ends since these electrodes’ polarity varies depending on how the battery or cell works. For examples, the galvanic cell and electrolysis cells are very distinct in their polarity on the cathode and anode ends.  Although the extra electrons are physically traveled from one end to another end in a circuit, they move slower than a snail. If electrons move that slow, how can a switch turn on a light bulb instantaneously? 

Electrons... move slower than a snail

Let’s pretend that dropping the ball into a bucket means to do the work of turning on the light. Imagine 100 people are sitting in a row and each person has a ball in hand. The ball is like the charge in the circuit. The first person begins to give his or her ball to the next person, and the next person needs to do the same. Eventually, the last person is the one who drops the ball to the bucket.  In reality, the electron did travel in a small distance, but the closest electrons to the light bulb actually did the action of turning on the light when they pass their charges to the light filament. The speed at which electrons move through a wire is called the “drift speed” since electrons do not move in an orderly fashion, instead, they move in a random zig-zag motion inside the conductor or the wire.  The action of passing the ball sends a wave or a frequency from one end to another end that looks instantaneous.  It looks like doing a wave in the stadium. If more than 50 or 100 rows are doing the wave, you can feel the enormous power that people generated, and that kind of power is like voltage or current in the electricity world.

When we look at the water pipe, the voltage is like the water pressure and the current is like the amount of water flow. In this way, you have a directly proportional relationship between the voltage and the current.  However, there is always an opposite force doing the balance in nature like the Ying and Yang. The opposite force of the current is resistance. If you look at the water pipe, there is a resistance force that is dragging or slowing down the water flow, such as the viscosity of water and the surface of pipe can contribute the resistance to the flow.  In short, voltage equals the current multiplies the resistance or V = IR as stated in Ohm’s law. Please note that in Classical Physics, the notation of + sign and – sign shows the current is from + to -, which is opposite as mentioned before because, at that time, the physicists did not know there is a physical object, electron, that existed as a negatively charged particle, and thought that there is a positively charged particle doing the traveling in the circuit. As a result, they thought that “negative” is a deficiency of charge. Nevertheless, by the time the actual direction of electron flow was discovered, the nomenclature of positive and negative had already been written in so many textbooks and papers. As a result, two notations were created. The Electron Flow notation is the one we mentioned earlier, and the Conventional Flow notation represents the old style.

Electronic Components

Safety

Before we get into more exciting electronic components in details, let’s understand why there is a need for the ground. In the light bulb example, everything works just fine without the ground.  However, the reason we need the ground is that of the safety issue, and electronic components can be damaged easily by the extra unwanted energy on the circuit. The ground is not a specific component or a place.  The ground is like a buffer that can accept extra electrons or negative charges.  If you are working on a low voltage device, the ground can be the big metal table since it can accept some extra electrons without giving off charges or discharging to other things.  If you are working on a high voltage device, the best ground is the soil under a few feet below. However, if the ground contains more sand than soil, it is not a good buffer since it does not conduct electricity well.  As a result, the ground acts like a buffer that neutralizes extra negative charges. The circuit board does not like extra charges running around, and it can cause significant damages to the electronic components easily.

Because we humans could also conduct electricity, when your electronic devices do have the proper ground wiring, the extra charges can be dissipated by the ground wire quickly before flowing to your body. You may still get the electric shock if the voltage is high, but because it has some place to go quickly, the contact time is minimized, so it did not hurt you.  Just in case you are curious about where your ground wiring leads to in your house does, it could be just the copper cold-water pipe or a ground rod that is 4 to 8 feet installed underground. It varies from places to places. Some require at least two ground rods.

Powering Electronics

Light-Emitting Diode (LED)

Light-Emitting Diode (LED)

Now let’s go through some of the major electronic components.  We have learned that the electric circuit is directional and the electric energy flows from one end to another. Some electric components are sensitive with the direction of how the voltage flow through them and some do not care.  For example, a resistor can limit the branch current and does not care which side it connects. The diode is like our heart valve, bicuspid, that permits only one-way flow and prevent backward flow. The light-emitting diode (LED) light is a type of diode which can turn electric energy into light energy. However, make sure you align the LED correctly where the long leg at the end goes to the positive side, and the short leg goes to the negative end on the power source. You should also add a resistor in the circuit since LED has a specific limit on how much current it can take as it dissipates the energy it receives, and if it’s overloading, it will burn off and kill the LED. If it’s almost overloading, it will shorten its life because of the heat it generates.  In the adequate energy range, the current can vary its brightness. 

resistor_no_polarity.jpg

The position of the resistor in the cathode or anode side of the LED does not matter since the flow speed is the same on either side on this simple example. But you should place the resistor on the anode side or the power supply side before reaching the power consumed component.

LED_resistor.jpg

We know that the resistor provides the resistance in the circuit. There are other components do the opposite of resistors, and they can increase the energy instead of decreasing it.  A capacitor can store the electric energy by using two different opposite charge plates and hold the energy temporarily until it discharges. An inductor can store the energy in the form of a magnetic field. However, a capacitor does have a limit of load it can carry, and its output voltage is always limited as well. Moreover, there is a time delay to store the energy to its full capacity (although it never reaches its theoretical 100% fully charge) and its discharge can be controlled. For inductors, there are different inductors for DC and AC circuits because of the nature of how AC/DC work. 

Now we know that voltage plays a vital role in the circuit, but what if we need a steady and reliable voltage.  There are the voltage regulators where they can take an input voltage and turn it to a fixed voltage as the output. There are three types: Linear Regulator, Switching Regulators and the Zener Diodes.  The linear regulators are small and cheap, and the switching regulators are more efficient than linear but more expensive. The LM7805 linear voltage regulator is a popular one used on IoT boards which gives out a steady 5V with at least a 7V input is required.  However, it gives out a great deal of heat.

As you may have already learned that the IoT board is a low-voltage circuit, and it is impossible to have enough energy to power household appliances at 120 V or 220 V, but how do we use IoT board to control the high voltage devices. This is where Relays come into play since they are special types of switch turned on and off at high-voltage devices and controlled with small and low voltage wiring switches.

Let’s bring the same idea we learned about the relay and apply to the understanding of transistor.  To drive the DC motor from the IoT board, we need a secondary power supply to do that because DC motors can create harmful voltage spikes that harm the delicate electronic components.  In this case, a transistor is used to act as a switch between these two power supplies and the transistor allows the board to switch the motor on and off safely and also controls the direction and speed of rotation by using the pulse-width modulation (PWM) techniques.

Electronics is always an exciting field of discovery and innovation.  We cannot cover them in detail as they are an enormous subject. However, we hope that you have a good overview of what small electronic component can do and how it relates to the design of your IoT solutions and learn some basics on the wonder of what electric power can do.