DEV Community

Rafael Levi Costa
Rafael Levi Costa

Posted on

Automation with Arduino — Part 1: Electronics

About the use of electronics with Arduino, focusing on automation

This article will be divided into multiple parts, and the objective of this part 1 is to discuss the use of electronic components with Arduino, with a focus on achieving the automation of residential (smart house) or industrial routines using the Internet of Things (IoT).

  1. Introduction Smart House is a term used to represent technologies integrated into residences. Smart homes are becoming increasingly common in our reality. Embedded systems, the Internet of Things, microcontrollers, sensors, actuators — all these terms represent the meaning and concept of a smart house. In this course, we will explore these concepts and delve into the projects associated with this concept.

Typically, courses only provide a surface-level practice, without addressing the theoretical concepts and scientific foundation necessary to master this field. People are accustomed to accessing information instantly, but I must emphasize that attaining comprehensive and genuine knowledge about this set of technologies requires diligent effort and has no shortcuts.

We will do our best to provide the “path” to understanding, but it will depend on each individual’s willingness to truly comprehend and study the topics recommended in this material. Believe me, mastering all this knowledge takes time, and as you delve deeper into the subject, you will realize how little you actually know.

1.1 What is a Smart System?
In our case, when we refer to a system, we assume it is something complex but not so complex that it becomes nearly impossible to comprehend. Rather, it involves several simpler subsystems. We should view smart projects as puzzle pieces that fit together carefully and thoughtfully at specific moments.

It is not without reason that the term “smart” implies intelligence! From this point forward, we will consider our projects to be complex and intelligent. Therefore, we need to be cautious when designing and declaring a project as complete. We must acknowledge that a Smart System is not created by a single person. However, it can be designed and even executed in a non-optimized manner by an individual with diverse knowledge in electronics, databases, development, front-end, back-end, embedded systems, sensors, and actuators.

1.2 How Does a Smart System Work?
We can consider that the smart system is divided into: Database, System (programming), Electronics, Actuators, and Sensors, as depicted in the figure below:

Image description
2. Electronics from Scratch
2.1 Physics, Electrons, Electrical Energy
It is important to have a basic understanding of physics to comprehend the projects and circuits, along with their respective calculations. When you see a resistor with a specific resistance, you need to know why, rather than simply executing what is requested. In your own projects, you will be responsible for defining the circuit parameters.

To achieve this, let’s study a bit of electrostatics and electromagnetism. What powers our circuits is the electron, or rather, the flow of electrons, also known as electric current. Think of electric voltage as the difference in electron potential between two points, in other words, the difference in concentration of electrons. Regarding resistance, which is inherent to any real material (including a wire), think of it as imperfections in a water pipe that allow droplets to cling to the tube’s edges. Drawing an analogy with a hydrodynamic system, we have:

Image description
The current is being compared to the flow of water, the resistance acts as the valve that controls the amount of water (electron) passing through, and the voltage represents the difference in water levels between two tanks.

2.2 Energy Generation — Hydroelectric
Power Electricity reaches our homes through transmission wires. This energy is generated in hydroelectric power plants, as shown in the diagram below. The generated energy is alternating (AC — alternating current) because we have two magnetized elements that alternate around a coil. However, the electricity used by electronic components must be direct current (DC) since they do not tolerate voltage fluctuations.

So why do we produce alternating current if direct current is ideal for electronic components?

Well, alternating current allows for more efficient transmission due to reduced loss of charge. That’s why we use sources that filter, stabilize, and convert the power from the outlet (alternating current) into direct current.

Image description
2.3 Direct Current / Alternating Current
In direct current, the flow of electrons tends to move in one direction and follows along the conductor, while in alternating current, this flow changes direction, as shown in the graphs below.

Image description
Ohm’s law relates resistance (R), current (i), and voltage (v). It is crucial for dimensioning electronic projects, as it helps us determine if the electronic components can withstand the current and voltage.

Image description
As for the units of measurement, we have Volt (V) for voltage, Ampere (A) for current, and Ohm (Ω) for resistance.

Electronic Components:

Image description0

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description

Image description
Laboratories: Lab 1 — Connecting an LED (Light Emitting Diode) to the breadboard.

Objective: Illuminate an LED.

Materials needed: 1 LED, 1 Arduino UNO, 1 breadboard, jumper wires, 1 resistor of 2200 ohms or a resistor with a similar resistance.

Follow the electronic diagram:0

Image description
Observations: The red wire is connected to the 5V pin on the Arduino, while the black wire is connected to the GND pin on the Arduino.

After the connection, simply connect the Arduino to your computer via USB, and the LED should light up.

Tip: If you don’t have an electronics kit, you can use https://circuits.io/.

Lab 2 — Connecting an LED to the breadboard using a push button.
Objective: Illuminate an LED using a push button.

Materials needed: 1 LED, 1 push button, 1 Arduino UNO, 1 breadboard, jumper wires, 2 resistors of 100 and 150 ohms or resistors with similar resistances.

Follow the electronic diagram:

Image description
Lab 3 — Connecting an LED with a Buzzer to the breadboard.
Objective: Illuminate an LED with a buzzer.

Materials needed: 1 LED, 1 buzzer, 1 Arduino UNO, 1 breadboard, jumper wires.

Follow the electronic diagram:

Image description
Lab 4 — Connecting an LED with an LDR (Light Dependent Resistor).
Objective: Illuminate an LED with an LDR and vary the LED intensity inversely proportional to the light intensity that falls on the LDR.

Materials needed: 1 LED, 1 LDR, 1 Arduino UNO, 1 breadboard, jumper wires.

Follow the electronic diagram:

Image description
Note: Use the flashlight on your phone to alternate the amount of light on the LDR, and you will see the variation in LED intensity.

Conclusion:
In this article, we introduced the concept of smart houses and the use of electronic components with Arduino for automation. We discussed the importance of understanding the underlying physics and electrical principles to comprehend and design projects effectively. The article also highlighted the need for a holistic approach when building smart systems, involving multiple subsystems and diverse knowledge domains.

Mastering the knowledge and skills required for smart house automation takes time and dedication. It is not enough to rely on surface-level understanding or immediate access to information. The article emphasized the importance of studying and delving deeper into the recommended topics to truly comprehend the complexities of this field.

By starting with the basics of electronics, including understanding electricity, voltage, current, and resistance, we set the foundation for more advanced projects. We explored the distinction between alternating current (AC) and direct current (DC) and their relevance in electronic systems.

Furthermore, the article introduced the Arduino platform as a powerful tool for prototyping and developing smart systems. Several practical labs were presented, guiding readers through the process of connecting LEDs, push buttons, buzzers, and light-dependent resistors (LDRs) to the Arduino board.

In conclusion, this article serves as an introduction to the world of electronic components, Arduino, and smart house automation. It provides a starting point for individuals interested in exploring and mastering the field of IoT and building innovative and intelligent systems for residential or industrial applications. While the journey may be challenging, the rewards of understanding and applying these technologies are immense. With dedicated effort and continuous learning, one can unlock the potential of automation and contribute to the advancement of smart living.

Top comments (0)