Arduino - Advanced Methods and Strategies of Using Arduino
Arduino - Advanced Methods and Strategies of Using Arduino
File: here, you can create new projects (New), save it (Save, Save As), open
(Open, Open Recent), and view examples of ready-made programs (Examples).
Edit : edit menu, allowing you to copy and paste text, and other methods modify
it.
Sketch (Draft) : menu, allowing you to compile your code, or to translate it into
a language understandable to the computer and upload it to the Arduino.
Tools: menu of tools, among others, we can choose the type of Arduino board
that we have, and a USB port to which the plate is connected to your computer.
Help: Help menu.
Below we see the following menu buttons:
First: Verify (Verify) allows you to verify the correctness of the code. The
Arduino check if the code that we wrote is correct, that is, whether it can be
compiled (translated into computer language).
If you select the menu command: File> Examples> 01.Basic> Blink (File>
Examples> 01.Basics> Blink) and you click this button, the black box at the
bottom of the window should display various information written in white font.
This shows that the program can be compiled and sent to the Arduino board.
Second: Upload (Upload) works similarly to the Verify, with the difference that
after the successful compilation immediately sends the code to the Arduino
board when it is properly connected to your computer.
Third: New (New) opens a new empty project.
Fourth: Open (Open) opens a previously saved project.
Fifth: Save (Save) saves the project.
Sixth: located at the end on the right side opens the Serial Monitor (Serial Port
Monitor). This is the window in which we can see what information signals and
sends the Arduino board to your computer and allows us to send signals and
information to the plate. To be able to send and receive signals, we need to plate
in the first program.
Below is the window of our program. Arduino programs are called "sketches."
On the left side is our only tab. In this case, it is a sketch loaded earlier,
Examples, from the menu called Blink (blinking LED module built into the
Arduino).
On the right side is a drop-down icon that allows you to navigate through the
tabs.
Below is the code - the text of our sketch and, below, the window in which the
program Arduino communicates with us, showing errors at compile-time, or
indicate success.
Usually, in the beginning, the window is as follows:
The system is very similar to that used in the scenario of LED, but it is worth
noting that here is the output pin to pin 9 (of course, you can freely select one of
the six PWM pins).
The LED has two legs of different lengths. The longer is the anode, and the
resistor attaches to it.
Then run a program called Fading (File> Examples> 03.Analog> Fading).
We compile and load both sketch programs for the Arduino. We ask you how the
LED behaves. Is this the behavior of a digital or analog? (The correct answer is
analog because the LED brightens smoothly on and off). We explain to you the
LED action in this case, and we can refer to the example scenario of LED, where
he steered digitally.
Install the System with LED
Loop "for"
In this section, we analyze the activities with how the fading program works.
We discuss, in turn, all the elements of the code. We pay attention to the loop
"for" and analogWrite function () contained within this loop. We explain how to
operate loops - here, and we introduce the concept of the "for" loop. It is worth
noting that in the main loop Arduino, there are two loops "for" succession: the
first is responsible for brighter LEDs, and the way her darker. For more
information about the "for" loop can be found in the supplementary materials.
Loop "for" works in this way that the operations contained within the loop, the
program performs a specific number of times for us. In this case, we have three
parameters. The first parameter is a variable fadeValue, which is initialized to 0,
as we begin to clear LED 0. The second parameter is the condition that
determines when the loop will work. In this case, we break the loop when we
reach the maximum value of 255.
The third parameter is the number by which raise or lower the value of the
variable fadeValue with subsequent cycles "for" loop. Here it is expressed with +
=, which represents an increase of 5 each time through the loop (i. Successively:
0, 5, 10, 15, 20, etc.). Symbol - = (second "for" loop) represents a decrease of 5
(ie. The following order: 255, 250, 245, 240, etc.).
Then we give you a task: you need to modify two parameters "for" loop and see
how it affects the behavior of the LEDs. Here is a hint, which parameters can be
changed and what is affected by:
for (int fadeValue = 0 ; fadeValue <= 255; fadeValue += 5)
Mount Arrangement with Buzzer
When you know the action of PWM connectors and tested their effect on the
LED, it is now down to you check to see how they will operate in this mode, the
other actuators (output devices). Together with you, we assemble the following
simple arrangement on the contact plate using a buzzer (beep).
Once again, load a program from the previous point and check how the buzzer
behaves. Ask yourself the question, do you see a difference in the behavior of
the buzzer and LEDs. Or maybe there is no such difference? The buzzer should
behave the same way, or - alternately - quieter and louder sound.
As in the previous part of the chapter, we gave you a moment to independently
manipulate the parameters "for" loop testing and how it affects the behavior of
the buzzer.
The Signal Light
Hardware and Software Required
Connecting Arduino IDE to run the program and guide the basic
information
Warning! For information on how to connect the Arduino, run the Arduino IDE
and Scratch for Arduino, as well as basic information needed to get started with
Arduino, contain scenarios 1 and 2. This part of the book should be repeated
every time you need it until the basic material is fixed.
Getting to Know the RGB LED
In this part, you will learn the RGB LED that can glow in any color, as it
operates in accordance with the RGB system ®, allows for mixing and matching
different colors.
This kind of LED RGB LED consisting of three smaller LEDs:
You know what types of displays and/or screens? Where are they
used? In what devices?
How does the display?
What is a pixel?
What happens when you mix different colors, for example. Poster
paints?
We collect and summarize all the answers. We introduce the concept of an "RGB
color palette." We order the knowledge of the formation of colors and color
mixing. We explain that almost every screen (TV, monitor, smartphone, etc.) It
contains a miniature pixel. Each of these pixels can glow in three colors (red,
green, blue), and by mixing these colors, we can get any color. For more
information, refer to the additional materials.
In this section together to connect RGB LED Arduino according to the following
scheme:
Note: for each leg, a diode corresponding to a given color of a resistor connected
in series (maybe 330 ohms). As previously mentioned, LED RGB is constructed
from three smaller diodes and each of which controls independently. However,
this LED RGB is a common cathode and thus needs only one connected to the
wire in our Arduino minus (GND pin). It should help you with pinning because
there may be problems with the distribution of feet RGB LEDs and plugging the
holes in the contact plate.
After checking all the connections on the Arduino or to load the following
program (https://create.arduino.cc/projecthub/MisterBotBreak/how-to-use-an-
rgb-led-89bcae)
const byte COLOR_BLACK = 0b000;
const byte COLOR_RED = 0b100;
const byte COLOR_GREEN = 0b010;
const byte COLOR_BLUE = 0b001;
const byte COLOR_MAGENTA = 0b101;
const byte COLOR_CYAN = 0b011;
const byte COLOR_YELLOW = 0b110;
const byte COLOR_WHITE = 0b111;
void setup() {
pinMode(PIN_LED_R, OUTPUT);
pinMode(PIN_LED_G, OUTPUT);
pinMode(PIN_LED_B, OUTPUT);
displayColor(COLOR_BLACK);
}
void loop() {
displayColor(COLOR_RED);
delay(1000);
displayColor(COLOR_GREEN);
delay(1000);
displayColor(COLOR_BLUE);
delay(1000);
displayColor(COLOR_MAGENTA);
delay(1000);
displayColor(COLOR_CYAN);
delay(1000);
displayColor(COLOR_YELLOW);
delay(1000);
displayColor(COLOR_WHITE);
delay(1000);
displayColor(COLOR_BLACK);
delay(1000);
}
Now we need to enter the code manually or prepare it in advance and distribute
it on our computers. After downloading the program, we observe how light
behaves. Then, we analyze the program code. We explain that each pin is
responsible for a different color. We show, at which point, where to turn on and
turn off the individual channels (where it is excessively high or low). We give
you the task to decode and place the code that is responsible for a particular
color displayed by the RGB LED. This makes it much easier to understand the
operation code and the entire system.
Recovery of the Diode RGB
We begin with a brief reminder of the material from the previous section
activities and play system constructed in the previous classes. You are
connecting RGB LEDs and reload the program.
LED Control Using PWM Connector
In this part, we will control the RGB LED using analogWrite (), on which more
information can be found in the scenario dedicated PWM connectors (Scenario
3: "Siren"). Just as in that case, here we can also assign a value between 0-255,
and thus simulate analog output. It is noteworthy that the corresponding hook
wires to the output pins Arduino. All the time, do not change the system and
leave a diode wired to pins 9, 10, 11 (terminals PWM).
Now we need to write a new program that allows simple adjust the brightness of
each channel. It is worth noting that the command digitalWrite () to change the
analogWrite ()because otherwise, we will not be able to assign analog values in
the range 0-255. Below is a sample program :
(https://www.programmingelectronics.com/tutorial-10-fade-an-led-with-pulse-
width-modulation-using-analogwrite/)
/*
Fade
The Figure above shows the robotic arm assembled with the four servos to
control its joints. The figure just below shows the set of parts that make up the
kit. The parts must be carefully assembled for the arm to work properly.
int val; // variable to read the value from the analog pin
void setup ()
{
// Associates each object with a myswebase
pwm pin . attach (3);
myservoClaw. attach (5);
myservoHeight. attach (9);
myservo Depth. attach (11);
}
void loop ()
{
delay (100);
}
In the void loop function, we will always update the values read from the
potentiometers and use them as a reference to set the position of each servo.
Thus, any control mode on the knob of one of the four potentiometers will be
converted into a change of position on one of the four servos. In this way, we can
separately control the base of the arm, as well as the joints (height and depth of
the arm) and the opening and closing of the claw.
Notice how we read each analog pin directly into the map () function, passing
the result of the reading as an argument to the map () function.
With the MDF Robotic Arm kit and four TowerPro SG90 micro servos, you can
implement a robotic arm of your own. A practical aspect of the assembly is the
noise that the assembly on the protoboard and possible badly attached contacts
can cause. Leave all connections firmly and check that all components are well
referenced to the GND.
A practical tip when assembling the arm following the manufacturer's manual:
None of the screws should be tightened too much. As it is a set of moving parts,
you must use the screws only to join the parts, applying the minimum amount of
force necessary. The same goes for the screws used to secure the servo motor
“horns.” When these screws are too tight, it can happen that the servo's rotation
may even stop. Therefore, on all screws, use as little force as possible, just
enough to keep the parts fixed.
In this second and final part of the chapter, we are going to learn how to write
data and read information using a Micro SD card with Arduino. Several SD card
shields are available on the market to connect these handy memory cards to the
Arduino. In this section, we will use the Micro SD Card Adapter connected to an
Arduino Uno.
The micro SD card with Arduino allows the development of data loggers.
Devices that store data collected from sensors and other information for analysis
and graphing.
Recording of Micro SD Card with Arduino - Make your Datalogger!
SD and micro SD cards differ only in size, as the name suggests. Both are cards
with integrated Flash memories. The memory size varies a lot, and today you
can find cards with tens of GB.
The figure below shows the SD card adapter that we are going to use in our
project. There are also specific datalogger shields integrated with RTC (Real
Time Clock) for telemetry and sensor monitoring applications.
The module is efficient and compact. In addition to being practical to use and
integrate with hardware and control systems, it was developed to optimize the
work of designers, students, and hobbyists in the construction of data logger and
data storage systems.
Basically, the module has an entry for Micro SD cards with all six interface pins
available for communication with Arduino. Through the SPI pins
(communication protocol used to read and write data in the card's Flash
memory), we can turn on the Arduino and send information to be stored. It is
also possible to perform reading procedures to present the data recorded on
displays as displays or on the serial interface.
The SPI interface that allows you to read and write data to Flash memory is
based on six channels:
Pin description Other names
CS Slave Select SS, nCS, nSS
SCK System Clock SCLK, CLK
MOSI Master Our Slave In SDO, DO, SO
MISO Master In Slave Out SDI, DI, SI
VCC Positive food
GND Earth
The module specifications are as follows:
SPI Communication;
Reads and Writes in FAT32;
Supply Voltage: 4.5V to 5V;
Dimensions (LxWxH): 42x24x3,5mm;
Because the SD card can be removed and inserted whenever necessary to
transfer files to the computer and plot graphics for analysis, the module is ideal
for developing data loggers.
Applications
The applications of dataloggers are diverse. Any system in which it is necessary
to store data for future analysis are candidates to have received the integration of
a datalogger. Among the applications, we can mention:
Protoboard;
Ultrasonic Sensor HC-SR04 ;
Arduino UNO;
PIR motion and presence sensor ;
3 3K3 resistors;
3 2k2 resistors;
Jumpers for connection;
The important point is that although 5V powers the adapter module, the MISO,
MOSI, and SCK signals are 3.3V. In other words, it is necessary to use a CI to
convert the logic levels or use three voltage dividers to lower the Arduino's 5V
signals to 3.3V on the SD card side. The solution with voltage dividers, as it is
simpler and more practical, will be the one adopted in our project.
Having said that and having all the components, we can assemble the circuit as
shown in the figure below:
If you still do not know the operation and implementation of projects with
ultrasonic sensors, visit this exclusive post and learn all about the HC-SR04
sensor and how to do projects with it.
Software Aspects
Let's understand the software developed that makes the recording on the card.
See the code below:
#include < SPI .h>
#include < SD .h>
#include <stdlib.h>
void setup ()
{
void loop ()
{
float val;
delay (2000);
}
SPI.h
SD.h
STDLIB.h
The first two are to record the SD card. The last one is so that we can use the
dtostr () function, which converts a float to a string. To record the card, we
declare an array of characters and an object of type FILE, which we call
myArchive.
The other variables are related to the ultrasonic sensor and the IO settings. To
know the functions and how the part of the software related to the ultrasonic
sensor works, access this article . (https://lastminuteengineers.com/arduino-
sr04-ultrasonic-sensor-tutorial/)
In the void Setup () function, we initialize the serial port and the SD card using
the SD.begin (CS) function, where CS is the pin on which the ChipSelect signal
of the card is connected.
Void Loop () function
In the void loop () function, the procedure consists of monitoring the output of
the HC-SR04 sensor, reading its values and saving them on the SD card in a .txt
file with the name log.txt. After reading the sensor, we convert the value to a
character set using the dtostr () function, and right after that, we open the log.txt
file with the SD. Open () function and write the string to the file using the
myArchive function. .println (). After the writing procedure, we close the file
with the SD.close () function.
Putting it to Work!
See how the final result should look like:
Complete Assembly 2
Complete Assembly 1:
Log.txt file:
Serial output:
In this example, we made a simple data logger to monitor the signals from an
ultrasonic sensor. All sensor readings, which were taken at a rate of 2 seconds,
are recorded on the micro SD card using the SPI protocol. The adapter can be
easily integrated into any electronic system. The micro SD card can be easily
removed and taken anywhere else so that the data can be used to plot graphs and
build tables.
Chapter Four: Home Automation: Presence Sensor &
Automation of Irrigation System with Arduino
In the first section of this chapter, we will assemble a typical home automation
system. We will use a PIR presence sensor to turn a lamp on and off. The sensor
is connected to an Arduino and triggers a signal indicating the presence of
someone within a certain radius. Reading the signal from the sensor, we will
know if someone is nearby and turn on a lamp by activating a relay module.
Home Automation: Presence Sensor with Arduino
The PIR motion sensor we are going to use is model dyp-me003, manufactured
by elecfreaks. This sensor is capable of detecting movement of objects within a
radius of up to 7 meters, a great distance to be able to turn on lights and activate
other automation devices on site.
The operation of the sensor is extremely simple. If an object enters the detection
range, an output is activated at a high level, and if there is no movement detected
within the range, the output is at a low level. In the summer, the detection range
may be slightly less due to the higher temperatures. The datasheet provides this
and some other additional information. We strongly recommend that you know
the component's datasheet.
Operation of PIR Presence Sensors
PIR is short for passive infrared. The main component is a pyroelectric sensor.
This type of sensor has the property of detecting variations in the infrared
radiation it receives and producing an electrical signal as an output. In general,
the sensor is encapsulated next to a transistor to amplify the electrical signal
generated when variations in radiation occur in the environment.
The pyroelectric sensor captures infrared radiation through a fresnel lens, which
divides the sensitive area of the sensor into sectors with lenses of different
characteristics. The PIR sensors are stimulated only by some energy sources,
such as human and animal heat, for example. A passive sensor is said because it
does not emit any signal; it only receives the radiation and is stimulated by it.
Dyp-me003 Specifications
The elecfreak model dyp-me003 is simple and small. It is very easy to use and
very flexible for prototyping projects and residential assemblies. The sensor
module has a small yellow potentiometer to adjust the waiting time for
stabilization and also to adjust its sensitivity. Stabilization can vary between 5 to
200 seconds.
The basic specifications of the sensor are:
The image below shows the main sensor element. Generally, the module is
covered with a protective film, as in the highlighted image of this post. In the
image below, the film was removed to expose the pyroelectric element.
Applications
The PIR sensor is ideal for home, commercial, and security automation projects.
It is widely used in:
Security products;
Devices with presence detection;
Automatic lighting;
Automatic activation of buzzers, lamps, and home and commercial
automation circuits;
Automation and industrial control;
Project Description
In our project, we are going to use the ElecFreak PIR sensor to drive a lamp
through a relay module. To learn more about the relay module, you can access
all other resources of the references in this book. The project consists of the
following:
“Read a PIR (Passive Infrared) sensor to detect movement within a radius of up
to 7 meters and activate a lamp if the movement is detected. After a certain time
after the last detection, turn off the lamp.”
Hardware Aspects
To assemble this project, we will need the following components:
Sensor DYP-ME003;
Relay module 4 channels and 5V;
Protoboard;
Lamp and holder;
Arduino Uno;
The assembly below shows how the circuit should be made. The relay module
does not require the use of transistors to amplify the Arduino signal to activate
the lamp. The relay module must be connected with the common pin on one of
the socket terminals, and the NA pin on one of the lamp terminals. The other
terminal of the lamp must be connected to the other terminal of the socket.
Software Aspects
The software consists of constant monitoring of the PIR sensor to find out if the
sensor has identified any infrared variation (movement of people or animations).
We declare the variables to determine the reading pins (PIR sensor output) and
output pins (activates the Relay module), and in the void loop () function we
read the PIR sensor output signal, which is digital, that is is, or is it high level or
low level.
#define Relaymodule 7
#define ThesensorPIR 8
int ReadingSensor;
void setup ()
{
pinMode ( trigger it , OUTPUT );
pinMode (LesensorPIR, INPUT );
Serial . begin (9600);
}
void loop ()
{
//
Read the presence sensor ReadingSensor = digitalRead (LesensorPIR);
// No
if motion detection (ReadingSensor == LOW )
{
digitalWrite (trigger, LOW );
}
// There is movement detected - turn on lamp
else
{
digitalWrite (trigger it, HIGH );
}
delay (2000);
}
We use a delay in the loop function and depending on the setting time you use it
will be necessary to change this time
Putting it to Work!
Let's see how the assembly is ready! The figure below shows the entire circuit
connected and assembled to light the lamp.
Mounting with focus on the PIR sensor:
Complete assembly:
With this section, you now know how PIR presence sensors work and how to
integrate them into any home automation project or any other application you
want. The sensor is simple to use and is sold in the United States.
Now in this second and final section of this chapter, we are going to talk about a
subject that interests a lot of people: Irrigation systems. From small gardens to
larger sites and areas, knowing how to automate your own irrigation system
gives you flexibility and allows you to make customized solutions for your
needs. For these systems, it is necessary to measure mainly soil moisture and
temperature. As an actuator to release water to the pivots, a valve is required.
And, of course, a microprocessor system to read the sensors and control the
valve according to the soil moisture and temperature levels
Automation of Irrigation System: Humidity Sensor and Solenoid Valve
The two main components that we will use in this project are:
GND;
VCC;
A0: Analog output;
D0: Digital output;
The analog output ranges from 300 mV to 700 mV on wet soil and from 700 mV
to 950 mV on soaked soil or pure water. On dry or slightly humid soil, it varies
from 0 to 300 mV. We connected the two outputs of the sensor module on the
Arduino to perform the readings. Based on them, we act on the solenoid valve.
We strongly recommend reading the sensor datasheet.
Solenoid Valve
The Solenoid valve is used to control the flow of water. When powered with 12V
DC, it opens and allows water to flow. When de-energized, it closes and cuts off
the flow. Its operation is based on a coil (solenoid), which, when energized,
generates an electromagnetic field responsible for moving the valve plunger.
Specifications:
Software Aspects
Let's see how the software works to monitor the sensor and activate the solenoid
valve.
We define the pins that we will use for reading and activate the relay with three
directives at the beginning of the code. In the void setup function, we only
initialize the serial port so that we can communicate and configure the inputs and
outputs. The main part is in the void loop () function. Here we are going to read
the two outputs from the humidity sensor. The analog output is read with the
analogRead function (Analog pin), and the digital output of the sensor is read
with the digitalRead function (Digital pin).
We present the reading data on the screen and then make the comparison to see if
we should close or open the valve. If the humidity sensor is at a high level, it
means that the soil is dry, so we have to activate the relay to open the valve. The
relay is then activated by sending a GND signal. If the sensor output signal is
low, it means that the soil is moist enough, and we don't need to open the valve
anymore. So, we send a high-level signal to the relay to turn the relay off and de-
energize the valve.
#define pinDigital 13
#define pinAnalog 0
#define pinRelay 7
float AnalogOutput = 0;
float voltage = 0;
int ReadingSensor = 0;
if (ReadingSensor == HIGH )
digitalWrite (pinRelay, LOW );
else
digitalWrite (pinRelay, HIGH );
delay (2000);
}
Note that we connect the relay to the valve using the COMMON and NA pins,
that is, we use the normally open contacts. If you use normally closed contacts,
your logic will be slightly different. To rectify how to use the relay module,
check our post where we explain this component better.
Putting it to Work!
Complete Assembly:
Note that at the output of the serial interface above, we are reading a value of 5
mV, which means that the soil is dry, with virtually no moisture. Because of this,
the digital output is at a high level, as shown on the same interface.
With this simple assembly, you can assemble an automated irrigation system
with your own hands. You can adapt the wire sizes to make a better system for
your plants or gardens. You can also use more than one soil sensor to be able to
take readings from various points, obtaining a more accurate map of humidity
over a larger area.
Chapter Five: Flammable Gas Sensor & RFID Kit
with Arduino
In this first part, we will learn how to use a sensor to assemble a system to
identify fire spots and flammable gases. For this, we will use an MQ 2 sensor,
which identifies gases such as methane, natural gas, hydrogen, smoke, among
others. We can use this sensor to validate air monitoring systems, as well as
prototype systems for checking air quality and the presence of hazardous gases.
Although easy and practical, it is a sensor indicated for experimental and
validation purposes (use in bench and laboratory). The author and the publisher
are not responsible for any damage related to its misuse in real systems.
The MQ-2 Sensor
The main component of this assembly is the MQ 2 sensor, shown in the figure
below:
VDC: 5V;
GND: Land/Reference;
D0: Digital output;
A0: Analog Output;
We strongly recommend reading the MQ 2 datasheet .
(https://www.pololu.com/file/download/MQ2.pdf?file_id=0J309)
Applications
According to the datasheet, the MQ 2 sensor can be used in the following
applications:
Software Aspects
With the assembly ready, we can load the software below. If you follow the work
here on with the books of this series, then nothing in the program will be new to
you. The LCD we present and talk about its technology in this post. The MQ-2
sensor follows a scheme very similar to several other sensors used with Arduino,
such as the humidity sensor and the various other models of the MQ family.
Basically, the firmware does the following: It declares the directives are
associating strings to the pins that will be used. Configures I/Os, LCD, and serial
port. In the void loop () function, the two outputs of the MQ-2 sensor are
constantly read to assess whether any gas has been detected.
The main observation is in relation to the sensor calibration. A small trimpot
allows you to adjust the sensitivity of the sensor (the level at which the D0
output goes to 5V). Here in our tests, in a normal environment, without the
presence of gases, the analog output varies between 130 and 150. We use a stove
lighter to pollute the sensor's surroundings with natural gas. The response of the
sensor was extremely fast, going from 150 to over 700. This dynamic depends
on the density of gases in the environment, and to have an adequate adjustment,
some real tests are needed at the installation site (remember that this sensor is
turned for bench testing and validation, not for real applications)
We declare a SensorLevel variable to be used as a limit to activate the Buzzer
and send the alert message on the LCD. This value must be calibrated according
to your bacalhau tests. Interestingly, you vary this parameter to study the
dynamics of the sensor.
#include < LiquidCrystal .h>
// Hardware Links
#define Buzzer 10
#define MQ2_Analog 0
#define MQ2_Digital 2
#define SensorLevel 500
#define LCD_RS 9
#define LCD_E 8
#define LCD_D4 3
#define LCD_D5 4
#define LCD_D6 5
#define LCD_D7 6
int digital_read = 0;
int analog_read = 0;
void setup ()
{
// Configure the
pinMode IOs (MQ2_Digital, INPUT );
pinMode (Buzzer, OUTPUT );
// Initializes the serial
Serial . begin (9600);
// Initializes the LCD
lcd. begin (16, 2);
}
void loop ()
{
// Read the data from the MQ2 sensor
digital_read = digitalRead (MQ2_Digital);
analog_read = analogRead (MQ2_Analog);
if (analog_read> SensorLevel)
{
// Displays the data on the LCD
lcd. clear ();
lcd. setCursor (0,0);
lcd. print ( "Contaminated air!" );
// Activate the
digitalWrite Buzzer (Buzzer, HIGH );
}
else
{
// Displays the data on the LCD
lcd. clear ();
lcd. setCursor (0,0);
lcd. print ( "Normal air" );
// Turn off the buzzer and the red
digitalWrite led (Buzzer, LOW );
}
delay (2000);
}
For real applications, with more robust commercial sensors, there are standards
such as NBR IEC 60079-29-2 - Detection of gases in explosive atmospheres and
NR33 - Labor standard that regulates work in confined spaces, which establish
usage and calibration criteria that are very important. NR33, for example,
establishes several criteria for calibrating gas detectors in confined
environments.
Remember that gas detection is a serious matter, if you are developing a
commercial application, stick to the rules and legal standards and keep in mind
that benchwork (like the one presented here) should not be used in real
situations.
Putting it to Work!
Most of the wires used for the connection are for the LCD. The interface with
the sensor and the Buzzer take only a few wires. See how the system looks!
MQ-2 sensor with Arduino and LCD and Buzzer:
We hope that you will now be able to incorporate not only the MQ-2 but any
other sensor in the MQ family. These sensors can detect a wide variety of gases
and are easy and practical to be introduced in projects with Arduino and small
microprocessor systems.
Now, in this final and second part of this chapter, we will see how to build an
access control system using an RFID Kit with Arduino!
RFID cards are used in many applications in everyday life, from credit cards to
automatic identification cards for access control.
These cards have a magnetic stripe that stores digital data and can be read and
written using radio waves.
RFID stands for Radio Frequency Identification. It is a technology that belongs
to an area called Automatic Identification and Data Capture (AIDC).
AIDC methods automatically identify objects and people, collect data about
them, and enter that data directly into the software with little or no human
intervention.
In this section, I will teach you how to build an access control system using an
RFID Kit with Arduino. So, Check out next!
RFID Kit with Arduino: Access Control System
The RFID reader module based on the MFRC522 chip is used for wireless
communication at a frequency of 13.56 MHz. The company that developed the
module is NXP, one of the giants in the semiconductor sector.
It is a chip with extremely low consumption and small dimensions. Its main
application is the reading of cards that use the Mifare standard.
With the kit, it is possible to develop and validate designs of access control
systems, security systems, and other variations.
RFID tags can be used to read various information about the cardholder,
allowing their automatic identification to validate or not access.
MFRC522 Specifications
SDA -> 9
MOSI -> 11
SCK -> 13
RST -> 8
MISO -> 12
Remember to connect the RFID-RC522 Vcc to the 3.3V! The RFID circuit
works with the 3.3V voltage, not the Arduino traditional 5V.
Hence the need to use the bidirectional level shifter between one and the other.
Some channels are unidirectional, but since you are already going to use a level
shifter circuit, we recommend that you buy a fully bidirectional one, as indicated
in the component list.
Assembly RFID Card + LCD Display:
The LCD connections are well explained in the code below. Each pin on the
LCD is associated with a macro through which we define the connection pin
with the Arduino.
Software Aspects
The software to load on the Arduino is as the below one:
#include <SPI. h>
#include <LiquidCrystal. h>
#include <MFRC522. h>
#define LCD_RS 7
#define LCD_E 6
#define LCD_D4 2
#define LCD_D5 3
#define LCD_D6 4
#define LCD_D7 5
#define SDA_PIN 9
#define RST_PIN 8
#define CardReleased "C9 22 10 0A"
#define TriggerBuzzer 10
#define BeepsReleased 2
# define BeepsNegate 4
char st [20];
void initial message ();
String UID = "";
letter byte;
void setup ()
{
pinMode (TriggerBuzzer, OUTPUT);
Serial. begin (9600);
SPI. begin ();
mfrc522. PCD_Init ();
lcd. begin (16, 2);
StandardMessage ();
}
void loop ()
{
delay (1000);
}
void StandardMessage ()
{
lcd. clear ();
lcd. setCursor (0, 0);
lcd. print ("Ready for");
lcd. setCursor (0, 1);
lcd. print ("Reading!");
}
void getUID ()
{
Serial. print ("UID Tag:");
for (byte i = 0; i <mfrc522. uid. size; i ++)
{
LCD;
Serial port;
mfrc522;
Input and output pins;
In addition, we have already called the StandardMessage () function to display a
standard message on the LCD.
In the Void Loop () function, we have two if's that are present in all examples of
programs in the MFRC522 .h library .
(https://www.arduinolibraries.info/libraries/mfrc522)
In these two if's, specific library functions are called to search for a card in the
vicinity of the reader, and select/read that card if present.
After this first step, we call the getUID () function, in which we separate the
identification bytes of the card reader into a string named UID. In addition, we
present this UID on the serial port.
If you still do not know the UID of your card, the first time you run the program,
whenever you bring the card close to the reader, the access denied message will
appear, because the UID that is in the program (22 C9 0A 10) is from the card
we used to prepare the post.
Just open the serial terminal and bring the card closer to the reader, so the UID
of your card will be displayed on the serial terminal, and you can replace the flag
CardReleased in the program with your UID.
After loading the program with the updated flag, the message displayed for your
card will be “Access Cleared.”
With the UID of the card read, we do an if-else to find out if this UID is the same
as the one saved in the program (in the flag CardReleased).
If it is the same, the program displays the message “Access cleared” and triggers
two beeps with the buzzer. If it is any other card, the message “Access Denied”
is shown, and we trigger four beeps with the Buzzer.
Auxiliary Functions
We have three auxiliary functions, they are;
The assembly may be a little fuller than normal, due to the wires to connect the
RF522 to the level shifters and theirs to the Arduino.
We hope you will see something like the one shown below:
Before closing this chapter, we recommend reading the examples available in the
MFRC522 .h library.
When you download the file and extract it to your computer, a folder called
“examples” can be accessed. In it are several examples of programs with RFID
applications with Arduino.
Using the sample codes, you can create your own applications and learn much
more about this technology.
Chapter Six: Current + Energy Meter & Audio
Module WTV020-SD with Arduino
In the first section of this chapter, we will assemble an AC power meter
(alternating current) using the Arduino UNO. Energy meters are part of the daily
life of any residence, building, or business. Several models of traditional
companies such as Clamper and EDMI are available on the market with varying
price ranges.
The key components of the meter are the current and voltage sensors, and the
technology/measurement specifications will dictate the final project price; we
will use a 100A non-invasive AC sensor SCT-013.
Current and Energy Meter with Arduino: Current Sensor
The energy meter basically consists of a current and voltage sensor connected to
a microprocessor circuit, which in this case, is the Arduino UNO. We read the
two basic electrical variables and from them, we determine the instantaneous
electrical power and the energy consumed in a given time interval, which is
given by the instantaneous power integrated in the measurement time period.
If the electrical power is constant, just multiply the power by the consumption
time. Thus, a 100W lamp on for 2 hours will consume 200 Wh (watt-hour). If a
function gives the electrical power, say p (t), the energy is calculated by making
the integral of p (t) in the measurement period.
In the case we are going to see, we will measure the instantaneous power from
the current sensor. The energy will be calculated using a summation (which in
practice is what an integral does). So, let's consider a 1-second integration step.
For each step, we will measure the electrical power and find the energy
corresponding to that interval and add all these values into a variable, which
will be shown on the LCD.
We will present in an LCD the values of current and energy calculated from the
moment the Arduino is powered.
Current Sensor 100A SCT-013
The SCT-013-000 current sensor is capable of measuring AC currents
(alternating current) up to 100A RMS. It is a non-invasive sensor; that is, it is not
electrically connected to the measured circuit. In practice, it is a current
transformer with a ratio of 100 to 0.05 (in the case of the sensor used in this
example, check the spin ratio of your own specimen), that is, a current in the
primary of 100 A appears in the secondary as a current of 50 mA. This sensor is
not for DC direct current measurement, only for AC.
Always remembering that when we talk about current, we are talking about the
RMS values, that is, the peak current measured by the sensor is higher, around
142 A, which corresponds to the RMS value multiplied by 1.4142 (square root
of two). Consult your AC circuit book to review these concepts, if necessary.
The sensor has an opening through which the wire with the current to be
measured must be passed (in a house, it would be either the phase or the neutral).
This wire acts as the primary of the transformer, generating a proportional
current in the secondary, according to the transformation rate of the circuit.
An important difference is that this sensor has a current output signal and not a
voltage signal. Thus, an additional circuit is needed at the output to convert the
output current into a voltage that can be read by the Arduino (we'll talk more
about that below).
Specifications
The SCT-030 100A sensors come with the built-in Burden resistor. I
measured the value of 38 ohms. Measure the value of your sensor as
well. If you already have the Burden resistor, it is not necessary to
insert the 33-ohm resistor into the circuit. But in this way, the
calibration factor (I_calibration) must be changed to the value of 30.
The reference voltage of the Arduino ADC converter must be 5V.
Always use the external source to power your Arduino. On my
Arduino Uno, the AREF voltage = 4.98V. If you use USB to power
your Arduino, the AREF voltage should be well below 5V (4.7 to
4.8V), and therefore all voltage measurements will be incorrect.
This circuit is very sensitive to electrical interference. Keep your
hands off the circuit. If possible, use shielded cables to connect the
circuit to the Arduino.
The SCT-013 sensors were developed to measure currents up to 100
A. If you need to measure smaller currents, you can wind the AC
circuit wire more than one turn over the core. In this way, the current
value will be multiplied by the number of turns. Test and adjust the
calibration factor.
List of Components
The necessary components for the project are:
Arduino Uno;
Current sensor 100A SCT-013;
33R resistor and at least 1/4 W;
2 100K resistors;
1 capacitor of 10uF;
Circuit
An additional component that could be added to the circuit is a voltage amplifier
between the voltage divider and the load resistor. When using high-value
resistors, the load effect decreases, but ideally, to decouple the two circuits
(voltage divider and load resistor), it is recommended to use an op-amp in the
voltage follower configuration or an additional optocoupler.
Having made these reservations, the circuit is as follows:
Software Aspects
We will use the library developed by energymonitor.
#include "EmonLib.h"
#include < LiquidCrystal .h>
#define Vrede 129 // defines the network RMS voltage (value read
with multimeter)
#define InputSCT 2 // defines the analog channel for the SCT signal =
pin A2
void setup ()
{
lcd. begin (16, 2); // configure LCD 16 columns x 2 lines
lcd. clear (); // clean LCD screen
void loop ()
{
Irms = EnerMonitor.calcIrms (1480); // RMS current calculation
lcd. setCursor (9.0); // select column 9, row 0
lcd. print (Irms); // shows current value
lcd. setCursor (9.1); // select column 9, row 1
lcd. print (Irms * Vrede * (Tempo/3600)); // calculation of Watt/hour
Time ++; // increase Time
delay (1000); // 1 second delay
}
Car alarms;
Voice messages;
Music player;
Parking Sensor;
Smart home and medical instruments.
Any project where the incorporation of audio elements is important is a strong
candidate for the WTV020-SD module.
Project Description
The example project consists of the following:
Prepare and save two files on the SD card of the WTV020-SD module, one in
WAV format, and the other in Ad4 display a menu on the serial interface to
choose which file to play and for how long.
Hardware Aspects
The list of components for this project is as follows:
WTV020-SD module;
Arduino UNO;
Protoboard;
Speaker for Arduino;
A very lean list with components available on the market.
The pinout of the WTV020-SD module can be seen in the table below, taken
from the original datasheet. For this project, we will use the power pins (3.3V
and GND) and four other communication pins.
Pinout wtv020-SD. Source: Datasheet:
In the assembly, we will see the following connection:
Pin Module WTV020-SD Arduino UNO pin
RST (pin 1) Digital 2
P06 (pin 15/BUSY) Digital 5
P04 (pin 7/Clock) Digital 3
P05 (pin 10/Din) Digital 4
#include <Wtv020sd16p.h>
/*
Create an instance of the Wtv020sd16p class.
1st parameter: Reset pin number.
2nd parameter: Clock pin number.
3rd parameter: Data pin number.
4th parameter: Busy pin number.
*/
Wtv020sd16p wtv020sd16p(resetPin,clockPin,dataPin,busyPin);
void setup() {
//Initializes the module.
wtv020sd16p.reset();
}
void loop() {
//Plays synchronously an audio file. Busy pin is used for this method.
wtv020sd16p.playVoice(0);
//Plays asynchronously an audio file.
wtv020sd16p.asyncPlayVoice(1);
//Plays audio file number 1 during 2 seconds.
delay(5000);
//Pauses audio file number 1 during 2 seconds.
wtv020sd16p.pauseVoice();
delay(5000);
//Resumes audio file number 1 during 2 seconds.
wtv020sd16p.pauseVoice();
delay(5000);
//Stops current audio file playing.
wtv020sd16p.stopVoice();
//Plays synchronously an audio file. Busy pin is used for this method.
wtv020sd16p.asyncPlayVoice(2);
delay(2000);
//Mutes audio file number 2 during 2 seconds.
wtv020sd16p.mute();
delay(2000);
//Unmutes audio file number 2 during 2 seconds.
wtv020sd16p.unmute();
delay(2000);
//Stops current audio file playing.
wtv020sd16p.stopVoice();
}
Basically, we have a loop in which we give the option for the user to choose one
of the two ad4 files to play. We created the TocaAudio function that executes the
commands to play the selected audio for 5 seconds. Two important observations
we have are as follows:
In several forums and project sites, there are a lot of reports of
problems due to the SD card. Even with the assembly and the correct
program, some people can only put it to work with some specific SD
cards. Most of the success stories involved cards of 512MB, 1GB,
and 2GB. We recommend taking extra care to verify that the card has
been formatted correctly and that the audios have been converted
correctly to ad4. In some reports, it was noted that some files
converted with certain programs did not work, while conversions
with other programs did;
Another issue is the nomenclature of audios. The datasheet specifies
very clearly that the files must be named according to a logic
0001.ad4, 0002.ad4, 0003.ad4 and so on;
It is recommended to use a signal amplifier to be able to hear the
audio more clearly. In our example, as the output power of the
WTV020-SD is very low, you must be in a quiet environment to hear
the speaker play;
Finally, a small hardware detail. The module has three solder points,
located at the top and with two markings, one written 5V, and the
other 3.3V. Some modules already come with these soldered points,
but you may have to solder them, connecting the middle point to the
3.3V point, as in the figure below:
We will close the chapter with the saying that we believe strongly now you are
ready to use the WTV020-SD in your electronic projects.
Chapter Seven: KY039 Heart Rate Meter & Audio
Recording and Playback with Arduino
In this first section, we will learn how to use the heart rate sensor and set up a
circuit with a datalogger to store historical heart rate series. The datalogger was
the subject of this post, and in the following text, we will focus on the sensor and
heart rate measurement.
The KY-039 sensor is not the most accurate and stable on the market. It can be
challenging to mount a meter with it that is reliable. In this section, we show
how it works and an example of how to interface it with Arduino and a
datalogger. Other sensors can be used in place of the KY-039 to save data to the
datalogger with minor changes to the code.
Attention: This project is for teaching purposes only. For real applications, an
approved and certified meter must be used. This post aims to explain the
operation and show an example of how this type of sensor can be interfaced with
the Arduino, but this is not a project for real applications.
KY039 Heart Rate Meter with Datalogger
The heart rate sensor is based on an infrared emitter and receiver. The working
principle is as follows: When the heartbeats, blood pressure, and, consequently,
the volume of blood in the veins, momentarily increases. With each beat, it is as
if a small variation in volume and pressure happens. The sensor works by
emitting an infrared beam that passes through the user's finger. When the blood
pressure increases, the amount of infrared light that reaches the receiver
(phototransistor) through the finger is different from when the blood
pressure/volume is lower. This difference is translated into variations in the
phototransistor output signal.
The sensor is shown in the figure below:
Specifications
We draw your attention to the three voltage dividers that are needed to connect
the SD card pins with the Arduino (a logic level converter can also be used).
The Ky039 sensor connections are very simple. The power pins can be
connected to the Arduino 5V and GND. Pin S must be connected to A0, which
will be used in our program to take readings.
The List of Materials Needed
Arduino UNO ;
KY039 heart rate sensor ;
SD card;
Micro SD Card module ;
3 3K3 resistors;
3 2k2 resistors ;
An important tip. For effective operation, the infrared beam must be well aligned
with the receiver, as shown in the figure below:
Software Aspects
The software will be as follows:
#include < SPI . h >
#include < SD . h >
#include < stdlib . h >
int HeartRate_perSecond = 0 ;
int HeartRate_perMinute = 0 ;
int count = 0 ;
int countBeat = 0 ;
const int Calibration_Value = 10 ;
float oldValue = 0 ;
float rawValue = 0 ;
File myArchive ;
void setup ( )
{
pinMode ( CS , OUTPUT ) ;
Serial . begin ( 9600 ) ;
delay ( 100 ) ;
void loop ( )
{
rawValue = analogRead ( sensorPin ) ;
oldValue = rawValue ;
delay ( period ) ;
}
VCC: 3.3V;
GND: Feed reference;
REC: It is an active-high input for recording signals. The module
starts recording whenever this input is activated. It is important to
note that the pin must remain at a high level throughout the recording
time. That is, it is not worth just sending a pulse, thinking that the
recording will start and end. The REC pin takes precedence over the
other two (PLAL and PLAYE), so if you gave a command with
PLAYL and then with REC, the command with REC is executed;
PLAYE: Positive pulse playback command. When this pin is
activated (low level to high-level transition identified), the module
starts playing the recording until the memory ends or an End-of-
Message is found in the recording;
PLAYL: Playback command controlled by logic level. When this
pin goes from low to high, a playback cycle starts and plays as long
as the pin remains activated;
SP + and SP-: These are the outputs for the speaker. Can be
connected to speakers with impedances of up to 8 ohms;
MIC: It is the microphone input, whose signal is applied to the on-
chip preamplifier;
FT - Feed-Through: Activating this mode, the microphone activates
the speakers directly;
PE: Mode in which recordings are played successively;
It is worth mentioning the module's supply voltage, which is 3.3V, not 5V.
Therefore, be careful not to supply the module with a voltage greater than 3.3V,
at risk of damaging it.
The recording/manual playback procedure consists of 2 steps:
1. Press/Activate the REC button (note the LED that will light up) and
keep it at a high level until the end of the recording;
2. Select the Playback mode.
a. PlAYE: requires activation only once and will play the entire
recording;
b. PLAYL starts playback and to finish it is necessary to disable
it;
c. PE: When this jumper is on, the recording is played repeatedly
until the jumper is turned off;
d. FT: When this jumper is on, everything the microphone picks
up will be played directly on the speaker;
Project Description
Now here we are going to implement an example to control the module through
the Arduino. The project will be as follows:
Whenever a TCRT5000 presence sensor detects an object, we will reproduce a
previously recorded voice command.
Thus, our test consists of two steps: Press the REC button via Arduino to record
the desired voice command, and then enter an object identification mode, in
which whenever the sensor identifies the presence of an object, the ISD module
1820 will play the recording.
Hardware Aspects
In the module, you will see a pin bar with 12 pins, six on the right and six on the
left. The default setting is to leave the two jumpers interconnecting all four
middle pins on the inside. The meaning of each pin and configuration is shown
in the image below:
int readingSensor = 0;
void setup ()
{
pinMode (outputSensor, INPUT);
pinMode (activePlayL, OUTPUT);
pinMode (activeREC, OUTPUT);
pinMode (led, OUTPUT); // Pin to activate the
pinMode led (sensor output, INPUT); // Pin to read the signal on the
collector of the
Serial phototransistor. begin (9600); // initializes the serial port with a
baud rate of 9600
MainMenu ();
}
void loop ()
{
readingSensor = digitalRead (outputSensor);
if (lSensor == 0)
{
digitalWrite (led, HIGH);
digitalWrite (activePlayL, HIGH);
delay (playtime);
digitalWrite (activePlayL, LOW);
}
else
digitalWrite (led, LOW);
delay (10);
}
void MainMenu ()
{
int controlLoop = true;
char byteRead;
Serial. println ("Type a to record or b to run the playback");
while (controlLoop)
{
if (Serial. available ()) // checks if data is available for reading
{
byteRead = Serial. read (); // readbyte latest in the serial buffer
Serial. write (byteRead); // send the received data to the computer
}
if (byteRead == 'a')
{
Serial. println ("Recording starts at 3");
counter (3);
digitalWrite (activeREC, HIGH);
Serial. println ("Recording for 10 seconds!");
counter (10);
digitalWrite (activeREC, LOW);
Serial. print ("Done!");
Serial. println ("Type b to start playback");
byteRead = '';
}
if (byteRead == 'b')
{
controlLoop = false;
byteRead = '';
}
}
}
}
In the program, two auxiliary functions were created:
MainMenu (): This function is a quick menu so that the user can
make recordings before the system enters the void loop () function;
counter (): A simple function just to show the audio recording
duration on the serial terminal;
When energizing the Arduino and with the serial terminal open, you will see
messages asking you to record new audio or proceed to playback. If you choose
to record, you can record new audio for 10 seconds (standard time). If you
choose to proceed with the reproductions, the firmware will go to the void Loop
() function. In this function, the TCRT5000 sensor is read constantly. Whenever
an object enters the reading range, the sensor output changes state, and the
PLAYL pin of the ISD 1820 module is activated for 10 seconds.
Depending on your application, you can make small adjustments to the code to
play the audio for a shorter time or use other features of the ISD 1820 module.
Chapter Eight: Digital Scale with Arduino and Strain
Gauge Cell
In this chapter, we are going to talk about a very useful and practical sensor to be
integrated with applications with Arduino. Load cells based on Strain Gauges are
the sensor elements used in digital scales of various types. The model cell that
we are going to use is capable of measuring up to 50Kg. For scales with greater
capacity, a larger number of sensors can be used. Here we will also explain what
Strain Gauges sensors are, and we will use a load cell to measure the weight of
objects up to 50Kg and present the result on an LCD.
The load sensor we are going to use is a strain gauge, one of several types of
sensors that can be used to measure weight. Multiple load sensors can be used
simultaneously to increase capacity. Our load cell is a half-bridge sensor, that is,
it uses a Wheatstone half-bridge with a reference resistance and a sensor element
whose resistance varies according to the pressure applied. See the image below.
In general, at least two load cells are used, one to measure compression and the
other to measure tension (forces applied in different directions). With two load
cells, you have a complete Wheatstone bridge. To use only one load cell, it is
necessary to complete the bridge with two other resistors.
How a Strain Gauge Sensor Works
The principle of operation of a Strain Gauge is the change in the electrical
resistance of the sensor proportional to a certain pressure or force applied to it
(hence the name “Strain”). The most common Strain Gauge sensor is made with
very small wires organized in a certain pattern (usually in the form of a
resistance bridge) so that when a force is applied in a certain direction, causing
deformation in the disposition of the wires, the resistance varies proportionately.
The sensitivity of each sensor and model is quite different and is usually
expressed by the so-called Gauge Factor (GF). This is defined as the ratio of a
change in electrical resistance to a change in length (physical dimensions)
caused by an external force.
The great difficulty with these sensors is that the deformations caused by the
application of an external force or pressure are very small, causing variations in
the scale of tenths of ohms. Due to these very small order variations, it is
necessary to use a second component, which is a signal amplifier. There are
specific business models for working with Strain Gauges. For this project, we
will use the HX711 amplifier (more information in the next section).
In addition to sensors based on strain Gauges, there are also pneumatic and
hydraulic load sensors. To work with Arduino and small electronic projects, the
Strain Gauge sensor, which is based on the variation of electrical resistance, is
the most suitable. For a quick video introduction, visit this link .
(https://www.youtube.com/watch?v=fPzUtzFJFus&feature=youtu.be)
The load cell we are going to use has the following specifications:
Dimensions (mm): 28 * 28 * 8;
Capacity (Kg): 50;
Margin of error: 0.2%;
Excitation voltage (V): 5 ~ 10;
It is an active sensor, that is, it is fed with an external excitation signal. The
sensor output is in Volts. As you can imagine, due to the small variation in the
resistance of the sensor element, the variation in the output voltage is also very
small. This output voltage signal is what we are going to connect to the HX711
amplifier.
HX711 Converter
The HX711 24-bit converter and amplifier module is used to amplify the signal
from devices such as load cells, making the interconnection between these cells
and the microcontroller. We recommend reading the datasheet .
(https://cdn.sparkfun.com/datasheets/Sensors/ForceFlex/hx711_english.pdf)
Specifications:
Digital scales;
Identification of load limits;
Weighing of objects;
Any application for which load measurement is required;
Project Description
Our example project will be as follows:
Use two load cells to weigh objects and show them on the serial port.
Hardware Aspects
It is important to highlight the color pattern used in this cell. As shown in the
image, the red wire, which is usually used for VCC, is actually the output signal
(connected to pin A- of the HX711). And the wire to which the VCC must be
connected is the white wire. We recommend that you measure the resistance
between the cell wires to know which is which. The wires that give a reading of
2K are the ones that must be connected to E + and E- (generally, the white (E +)
and black (E-) wire). The wire on which you get 1K readings is the one to be
connected to A + (usually the red wire). Thus, pin A + d HX711 will be
connected to the common point between the two 1K resistors.
Load cells are generally used in groups of four, where each cell is placed on the
part of the scale. They can be used in groups of two as well, where each cell is
one of the “arms” of the Wheatstone bridge (this is the case in question). There
are also examples where one of the cells is replaced by two 1k resistors (in this
case, it has to be precision resistors). Another option for making measurements
with just one load cell is to complete the Wheatstone bridge with a 1K resistor
plus a trimpot. The resistors must be as close as possible, so traditional resistors
with a 5% tolerance are not a good idea. Using a multi-turn trimpot or 1%
tolerance metafilm resistors is more appropriate.
In the references at the end of the book, we leave some of these assemblies as an
indication.
The assembly is clearer in the assembly below:
In the image above, we see a complete resistance bridge. On each side, we will
use a load cell. Each cell has active resistance (sensor element). It is worth
noting that, for practical purposes, it is enough to connect the black wire of one
cell to the white wire of the other, and each red wire remains the signals A + and
A-.
To facilitate mounting on the Protoboard, pins can be welded to the ends of the
load cell wires. Note that the point of support of the scale surface must be on the
black arrow (upper part of the cell). The bottom of the cell must be on a flat
base as well.
The bottom of the cell must be suspended; otherwise, the pins that hold the
transducer will prevent the sensor from flexing. In this case, we used cut-out
Velcro adhesive to attach to the bottom.
The connection with the HX711 and the Arduino is shown below:
We recommend that you mainly use the circuit diagram as a reference, as it
explains the internal resistances of the cells and is a cleaner design.
Software Aspects
For our Sketches, we will use the library HX711.h, which can be downloaded for
free from Github.
The first step is the calibration of the load cells. Using the assembly with the two
50 kg cells, run the calibration program below. In my assembly, the calibration
factor was 42130 (for weighing in kilograms). Therefore, this value was inserted
into the program. After calibration, make a note of the calibration factor to be
inserted in your Balance programs with the HX711.
Calibration Steps:
void setup ()
{
Serial.begin (9600); // 9600 Bps serial monitor
balance.begin (DOUT, CLK); // initializes the scale
Serial.println (); // skips a line
Serial.println ("HX711 - Balance Calibration"); // prints on the serial
monitor
Serial.println ("Remove the weight from the scale");
Serial.println ("After the readings begin, place a known weight on the
Scale");
Serial.println ("Press a, s, d, f to increase the Calibration Factor by
10,100,1000,10000 respectively");
Serial.println ("Press z, x, c, v to decrease the Calibration Factor by
10,100,1000,10000 respectively");
Serial.println ("After reading the weight correctly, press t for TARA
(reset)");
void zeroBalance ()
{
Serial.println (); // skips a line
balance.tare (); // zero the Scale
Serial.println ("Zero Balance");
}
void loop ()
{
balance.set_scale (calibration_factor); // adjust calibration factor
Serial.print ("Weight:"); // prints on the serial monitor
Serial.print (balance.get_units (), 3); // prints scale weight to 3 decimal
places
Serial.print ("kg");
Serial.print ("Calibration Factor:"); // prints on the serial monitor
Serial.println (calibration_factor); // prints calibration factor
delay (500); // 0.5 second delay
* /
void setup ()
{
Serial.begin (9600);
balance.begin (DOUT, CLK); // initializes the scale
Serial.println ("Scale with HX711 - 50 Kg load cell");
Serial.println ("Press t for Tare"); // prints on the serial monitor
balance.set_scale (calibration_factor); // adjust calibration factor
balance.tare (); // zero the Scale
}
void loop ()
{
Serial.print ("Weight:"); // prints on the serial monitor
Serial.print (balance.get_units (), 3); // prints weight on the scale to 3
decimal places
Serial.println ("kg"); // prints on the serial monitor
delay (500); // 0.5 second delay
if (Serial.available ()) // if the serial is available
{
char temp = Serial.read (); // le character of the serial
if (temp == 't' || temp == 'T') // if you press t or T
{
balance.tare (); // zero the scale
Serial.println ("Balance reset"); // prints on the serial monitor
}
}
}
Arduino IDE serial monitor window, with the HX711 Scale program (weight =
1,250 Kg) will look like:
Our final recommendation is that you use at least two load cells and complete
the Wheatstone bridge. Many examples found using only one load cell have had
many difficulties until getting readings that make sense.
Chapter Nine: IoT with Esp8266 WiFi Module &
Updating ESP-01 Firmware
In this first part of the chapter, we will explore the ESP8266 ESP-01 WiFi
module. It is a component that has become popular in recent years because it
makes the integration of WiFi networks and TCP/IP connections in electronic
projects easy and practical. We will cover the basic aspects of operation and
programming. In the next part of the chapter, an advanced application is
developed to control residential cargo over the internet.
The Esp8266 WiFi Module
The ESP8266 is a low-cost WiFi module compatible with Arduino and with an
integrated TCP/IP stack. One of the most interesting points of the module is that
the board is integrated with an MCU, which gives the possibility to embed codes
on the board to control its pins and operation without the need for an external
MCU.
Thus, in general, the Arduino interface is used only in the programming step.
But in real operation, ESP does not need to be connected to the Arduino or any
other control board. You can also use Arduino to expand your project's
capabilities and have more flexibility.
For this introductory section, we are going to use ESP-01. This module talks to
the microcontroller via the serial interface. It also has 2 GPIO pins that allow the
module to be programmed directly. The figure below shows the module and its
pinout:
The pins are as follows:
AT
As an answer, you should receive an "Ok." This means that ESP-01 understood
the command and that it is all right to continue to command it. The module has
three basic operating modes:
AT + CWMODE = X
Where X corresponds to the operating mode: STA = 1, AP = 2, Both = 3. For
example, let's set the module to operate as STA, so we must send the command:
AT + CWMODE = 1
To check which mode of operation the module is configured in, the command is:
AT + CWMODE?
See in the image below how your serial terminal should look:
AT + CIFSR
If an IP address was displayed, it is because the module is connected to that
station. In fact, this is the module's IP address. If there is no IP (all reset), you
can connect to a network with the command:
AT + CIPSTATUS
It shows the status of the connection. In the image below, the answer to this
command was 5, which means that it is not connected, as we expected.
In the image below, we connect to the “Example” network, which in this case
has no password (open network, without WPS security)
AT + CIPMUX = X
Where X is 0 for only one connection, and 1 for multiple connections. Then, we
configure the port with the following command:
AT + CIPSERVER = 1.80
The number 1 means that we want the module as Open Server Mode. If it were
0, we would be setting it to Close Server Mode. The number 80 is the default
number of the HTTP protocol port. If you open a browser and enter the IP
address of your ESP module, a screen similar to the one shown below will
appear on the serial terminal:
AT + CIPSEND = 0.9
The 0 indicates the channel that will be used to send the data. 5 is the number of
characters that will be sent. In our case, we will send the message “Hello
World.” After sending the command, a “>” symbol will appear. This means that
you can enter the characters you want to send.
If you receive the message “SEND OK,” the transmission was successful. For
the message to be displayed, the communication channel must first be closed.
Use the command:
AT + CIPCLOSE = 0
When sending this command, the message “Hello world” will be displayed in
the browser.
Receiving Data Sent by Cell Phone
To send data to ESP, we will use the Mobile Telnet application for Android.
Download and install the application. On the home screen, go to "Telnet
Settings" and enter the IP of your ESP01 and the port you used to configure it as
a server.
To connect to the ESP-01, enter the data as in the image below.
Click Ok after filling in the data and then open the menu tab (three dots in the
upper right corner) and select “Connect.” The screen below will be shown, and
you can now send information that appeared on the Serial monitor to which the
ESP is connected.
On the serial screen, you will receive all the messages sent.
Nice, right! It is highly recommended that you read the AT Examples from
Espressif Systems.
(https://www.espressif.com/en/support/download/documents)
In the next part of this chapter, we will make an application in home automation.
We will use the ESP-01 to control cargo over the internet. Now that you know
the module and know how the main AT commands work, everything will be
easier. For some advanced applications, there are already some developed
libraries, and we will also use them to increase the projects.
Now we will show you how to update the ESP-01 firmware. There will be two
approaches. The first will be to show how to restore the default firmware for
module AT commands. The second will be to present how to record new
firmware written by you or ready-made examples from the Arduino IDE.
The ESP-01 Firmware
First of all, this is a section for those who already have their hands on ESP 01.
The motivation to write this section came from a need for the chapter itself to
update the module's firmware to one of the original versions.
There are several examples and posts on the internet, but an impressive number
of them run into a very complicated problem from the didactic point of view:
They explain the step by step very well but do not explain what is behind each
step. This happened mainly to record the original firmware for use with AT
commands. Most guides assume that the reader knows exactly how to configure
Espressif Systems tools and how to identify the memory addresses associated
with each binary file that must be written.
Despite being a basic aspect of all research in the electronics area, users do not
always remember to read the readme files or to seek instructions from the
manufacturers of the models and sensors themselves, preferring to go straight to
tutorials that, in theory, would better explain how to put an application to run.
In the case of recording the original firmware to use the ESP-01 with AT
commands, the main recommendations to be taken into account are:
These files indicate the corresponding address for each binary file, for each type
of ESP-01 (which varies the size of the flash memory). This file is often omitted
in tutorials, but it is the main source for knowing how to use the manufacturer's
binary files correctly.
Knowing the addresses is essential as the ESP-01's official firmware update tool
saves more than one binary file at the same time, making it necessary to specify
exactly which memory address from which each file should be saved.
The other possibility of updating is to record software written by you or
someone else. In this case, there is no need to worry about the manufacturer's
binary files, and the most practical way is to use the Arduino IDE itself, as we
will show below.
Hardware Aspects
In view of what was said in the introduction, we will use the following assembly
to load the software (both the original for AT commands and other firmware you
want to record).
The assembly was done using the FTDI232 serial converter. It is a very useful
board on many projects, and it is recommended to have one when needed. The
most important points of the assembly are the following:
The FTDI232 card works with 5V or 3.3V. In this case, since the
ESP-01 works with 3.3V, you must use an external 3.3V source to
power the protoboard and select the FTDI232 jumper to the 3.3V
position. See the highlighted jumper in the image below, and it is
essential to put it in the correct position.
Two buttons are used, one connected to the ESP reset pin and the
other to the GPIO0 pin. These two keys are used to put the module
into recording mode.
As the entire circuit is powered by 3.3V and the FTDI232 has the
jumper selected for 3.3V, it is not necessary to convert the logic
levels between the two boards. But it is common in projects with ESP
that you have to use a logic level converter or voltage dividers.
Recording tool ;
Binary files ;
The recording tool has the face below. Note that there are several fields to fill
with a memory address and load different binary files. As we mentioned at the
beginning of the post, you should check the readme file, which comes with the
binaries you downloaded, which is the memory address associated with each
binary.
To find out the size of your module's memory, you can do a simple test. When
running the ESP Flash Download Tool, two windows are opened: the main
screen of the program and a black screen used for logging.
Having completed the steps described above, you are ready to load the AT
command firmware. Open the folder you downloaded with the binary files and
open the readme file. identify which set of addresses and binary files to use,
according to the version of your module, and load them in the sequence shown
in the readme.
Just upload the corresponding files and fill in the address on the right, as shown
below. Then check the SPIautoSet option above the DETECTED INFO box.
Also, select the size of your module's Flash memory. Once everything is
checked, select and START and wait for the download to finish.
In the end, your module will be loaded with the firmware for AT commands. To
test if everything went well, open a serial terminal, and do a test by typing AT. If
you get an "OK," then everything went well!
Procedure 2 - Recording New Firmware with Arduino IDE
If your goal is to use the Arduino IDE to load the firmware, you wrote yourself,
and the procedure is not much different. First, you need to install the ESP8266
libraries on the Arduino IDE. In the most current version of IDE (1.8.5), the
ESP8266 package is already installed, but if you use another version or need to
install it, you can do it manually.
After adding the URL, you can install the ESP package as per step 2, as shown
below:
After doing all the steps and with your ESP module already selected for the IDE,
you can now do the firmware update. With the circuit assembled and properly
tested, go to the Arduino IDE and download the ESP8266 Blink example. With
the example open and the circuit energized, keep the button connected to GPIO0
pressed and press the reset button. You will see the blue LED flash, which means
that the module is in recording mode.
Now, in the IDE, just upload the firmware and wait for the recording to finish. In
the end, the Blink program will be loaded on your ESP. The same procedure can
be repeated for other modules.
Now that you know how to load and update the ESP-01 firmware, you can start
making your applications and writing your own programs.
Chapter Ten: RTC - Real Time Clock DS1302, 1307
And 3231
This is the last chapter of this book, and here we will talk about real-time clocks,
or as they are known, RTCs - Real-Time Clocks. We will explain the three main
models used in applications with Arduino: RTC DS1302, RTC DS1307, and
RTC3231. A project will be implemented, in which we will use the RTC DS1307
to send date and time information to an LCD, that is, we will make a digital
clock.
RTCs are small electronic devices used to incorporate date and time data into
electronic devices. RTCs use quartz crystals and assisted circuits integrated into
a chip to measure time. Virtually all devices that require precise time control
have some type of RTC.
Three models widely used with Arduino are:
1. RTC DS13002.
2. RTC DS1307.
3. RTC DS3231.
All have prices that do not exceed 20 reais and can be easily incorporated into
electronic projects. All three models are manufactured by Maxim Integrated.
Let's see a little of each one and its main differences.
RTC DS3231
The DS3231 is a high-precision, low-power RTC. The module has a factory
temperature sensor and also an oscillator to further improve its accuracy.
It works in both 12-hour and 24-hour format, and information for months less
than 30/31 days and leap years are automatically corrected by the module.
A battery is included with the module to prevent data loss if the circuit is de-
energized. An important aspect that sets it apart from other models is the
communication protocol used. In the case of DS3231, the I2C protocol is used.
Thus, there are two communication channels (pins): SCL (Clock) and SDA
(data).
The specifications are:
Chip: DS1302.
31-Bytes of RAM for data storage.
Voltage: 2.0V ~ 5.5V.
Current: less than 300nA at 2V and up to 1.2mA at 5V.
Programmable output signal in the square wave.
Consumes less than 300nA in oscillator mode.
The datasheet, directly from the manufacturer's website, can be accessed here .
(https://datasheets.maximintegrated.com/en/ds/DS1302.pdf)
RTC 1307
This Real Time Clock (RTC) is a real-time clock with a complete calendar and
more than 56 bytes of SRAM non-volatile memory. Like the other RTCs, it
provides information for seconds, minutes, days, dates, months, and years. On its
board, there is a circuit that detects power failures and activates the built-in
battery to avoid data loss.
It uses I2C protocol and automatically handles cases of months with less than 31
days and leap years.
Specifications:
Chip: DS1307.
Computes seconds, minutes, hours, days of the week, days of the
month, months, and years (from 2000 to 2099).
56 bytes of SRAM.
Voltage: 4.5 ~ 5.5V.
Power failure detection circuit.
Consumes less than 500nA in battery mode with an oscillator in
operation.
Temperature range: -40 ° C to + 85 ° C.
Dimensions: 2.9 × 2.6cm.
The DS1307 datasheet can be accessed here .
(https://datasheets.maximintegrated.com/en/ds/DS1307.pdf)
Differences between Modules
The main differences between the modules concern the protocol used, size and
type of internal memory, dimensions, and power consumption. The DS1307 and
DS3231 modules use the I2C protocol, while the DS1302 uses a serial protocol.
The I2C protocol uses two pins: the SDA (data) and the SCL (synchronism
clock). The DS1302 uses three pins: SCLK (Clock synchronism), CE (Chip
Enable - to enable data transmission) and I/O (data).
The big difference is that the I2C signals the start and end of the data
transmission using changes in the logical state on the SCL and SDA pins.
Basically, if SCL is at a high level, and there is a transition from high to low in
the SDA, the DS1307/3231 recognizes it as the START of communication. Now,
if SCL is at a high level and there is a low to high transition in the SDA, the
DS1307/3231 recognizes it as the END of communication.
In the DS1302, the role played by these logic combinations is played by the CE
pin. If it is at a high level, communication starts, if it is at a low level, the data
transfer ends. That is, whenever a reading or writing procedure is performed
with the DS1302, the CE pin must be placed at a high level.
Here is important information. In the DS1302 datasheet itself, Maxim informs
that in the old datasheets, the CE pin was erroneously called Reset (RST). But
the functionality was the same; that is, it was a technical error in the writing of
the datasheet.
The supply voltages are also important differences, with the DS1302 operating at
a minimum of 2V, while the DS1307 operates at a minimum of 4.5V.
Hardware Aspects
To illustrate how to use RTC in your projects, let's do the following assembly:
Notice that the RTC DS1307 was connected directly to the Arduino. This is
possible because both works with the same voltage levels. In addition to the
RTC, we also connect an LCD to show the date and time data. If you have any
questions regarding the LCD, read this post, and learn more details.
#define InterfaceLCD 1
RTC_DS1307 rtc;
char daysOfTheWeek [7] [12] = {"Sunday", "Monday", "Tuesday",
"Wednesday", "Thursday", "Friday", "Saturday"};
LiquidCrystal lcd (9, 8, 4, 5, 6, 7); // RS E D4 D5 D6 D7
void setup ()
{
Serial.begin (57600);
if (! rtc.begin ())
{
Serial.println ("Couldn't find RTC");
while (1);
}
if (! rtc.isrunning ())
{
Serial.println ("RTC is NOT running!");
// set for compilation date and time
rtc.adjust (DateTime (F (__ DATE__), F (__ TIME__)));
// Set to a date you set
//rtc.adjust(DateTime(2017, 12, 27, 11, 14, 0));
}
lcd.begin (16, 2);
delay (2000);
}
void loop ()
{
if (InterfaceLCD == 1)
showLCD ();
else
showSerial ();
Serial.println ();
delay (3000);
}
void showLCD ()
{
DateTime now = rtc.now ();
// year = now.year ();
lcd.clear ();
// shows the date
lcd.print (now.year ());
lcd.write ('/');
lcd.print (now.month ());
lcd.write ('/');
lcd.print (now.day ());
// Shows the time
lcd.setCursor (1, 2);
lcd.print (now.hour ());
lcd.write ('/');
lcd.print (now.minute ());
lcd.write ('/');
lcd.print (now.second ());
}
void showSerial ()
{
DateTime now = rtc.now ();
Serial.print (now.year (), DEC);
Serial.print ('/');
Serial.print (now.month (), DEC);
Serial.print ('/');
Serial.print (now.day (), DEC);
Serial.print ("(");
Serial.print (daysOfTheWeek [now.dayOfTheWeek ()]);
Serial.print (")");
Serial.print (now.hour (), DEC);
Serial.print (':');
Serial.print (now.minute (), DEC);
Serial.print (':');
Serial.print (now.second (), DEC);
Serial.println ();
}
Note that in the software, we use two functions to display the date and time data.
The showLCD function shows the data on the LCD, and the showSerial function
shows it on the serial interface. To select which one to use, just change the
InterfaceLCD flag.
The important points to be understood in the program are:
The first time the software runs, the message RTC is not running! will be
displayed. After that, the function rtc.adjust () will be called, and the RTC will
start counting the time normally.
With everything set up, you should receive messages like the ones shown on the
screen above. Detail: To change the display, such as changing from
“Wednesday” to “Wednesday” or showing the time first, just adjust the order of
the Serial.println and lcd.print functions within the showSerial and ShowLCD
functions. This adjustment is for homework, so you can train.
To use the LCD, just do the assembly, as shown in the "Hardware Aspects"
section. If you have any questions about the LCD or want to know more
information about it, read this specific post about that component. Remember to
adjust the contrast by the potentiometer until the letters can be seen clearly.
What's more, you can now incorporate date and time information into your
projects; the same library used in this project also has support for the RTC
DS3231. For the RTC DS1302, good library options and examples can be found
in the references at the end of this book.
Conclusion
Arduino is an open-source platform for electronics prototyping based on flexible
and easy to use hardware and software. It is targeted at artists, designers,
amateurs, and anyone interested in creating interactive objects or environments.
Arduino is capable of detecting environmental conditions by receiving signals
from sensors and interacting with the environment, controlling lights, motors and
other actuators. The PCB microcontroller is programmed using the Arduino
cable-based programming language and the Arduino environment based on the
processing environment. Projects developed using the Arduino can be self-
contained or can interact with a computer to complete a task using special
software (e.g., Flash, Processing, MaxMSP).
The technology created in 2005 by the Italian Massimo Banzi, along with other
collaborators, was born to be a facilitator in the teaching of electronics for
students of design and artists.
The platform was born to be low cost because students needed to be able to
develop their prototypes while spending as little as possible. You know how it is,
right?
Another interesting point of the project was the proposal to create an open-
source platform available to the community, which helped a lot in its
development.
What are the Possibilities?
If we connect input devices, some hardware, motors, sensors, displays, antennas,
or something to the Arduino, the possibilities can be endless.
Its applications are the most diverse, from fun to art, home automation, and even
helping other people. For example, the Arduino has already been used to create a
beer cooler controlled by an iPad where it was possible to follow the flow of the
drink and obtain information about the different types of beer. In addition, the
plate also served to inform the temperature and find out who drank more.
Another team created a touch-sensitive glove that helps blind people to “see”
obstacles along the way. In the same vein, another user created a jacket using the
LilyPad version (designed to build wearable designs) of the Arduino that
informs when a cyclist will change lanes through LEDs placed on the back of the
jacket.
In this book, we listed some incredible projects that used Arduino, proving that
this is a tool that helps a lot of those who have creativity.
You can make LED cubes that generate three-dimensional images, secret knock
detectors, after all, security is never too much, sneakers that tie the shoelace for
you, like “Back to the future 2”, in fact, the prototype rolled so well that it
became a product and it was opened for commercialization ...
Accessible Technology >> Movement Maker
Having an Arduino board, the second step to start working with it is to download
the development environment on the computer and connect it to the board via a
USB cable.
Affordable technology, Arduino, as well as 3D printing, is already important not
only for testing and 'homemade creations.'
A lot of people know that the creators of Pebble - that watch that hit 10 million
dollars in their crowdfunding campaign - did not get a 2nd round of financing, so
they turned to the community (Kickstarter) to get investment. What few know is
that they used Arduino to make their prototype.
Reference and Resources
https://create.arduino.cc/projecthub/MisterBotBreak/how-to-use-an-rgb-led-89bcae
https://www.programmingelectronics.com/tutorial-10-fade-an-led-with-pulse-width-modulation-using-
analogwrite/
https://www.arduino.cc/en/reference/servo
https://forum.arduino.cc/index.php?topic=478360.0
https://www.arduino.cc/en/Guide/ArduinoEsploraExamples
https://www.pololu.com/file/download/MQ2.pdf?file_id=0J309
https://en.wikipedia.org/wiki/MIFARE
https://www.arduinolibraries.info/libraries/mfrc522
https://github.com/RuiSantosdotme/Random-Nerd-Tutorials/blob/master/
Projects/MFRC522_RFID_Reader_with_Arduino.ino
https://stackoverflow.com/questions/58863735/ trying-to-stop-multiple-activations
https://create.arduino.cc/projecthub/Elaf07
https://stackoverflow.com/questions/59362306/ i-keep-getting-a-compilation-error-on-arduino-ide-using-
mfrc522-rfid-saying-that
https://learn.openenergymonitor.org/
https://github.com/openenergymonitor/EmonLib
https://www.filedesc.com/en/file/ad4
https://www.robotshop.com/community/forum/c/letsmakerobots
https://forum.arduino.cc/index.php?topic=117009.0
https://gist.github.com/buildcircuit/5132328
https://www.buildcircuit.com/how-to-convert-mp3-and-wav-files-to-ad4-format-wtv020sd-tutorial/
https://www.instructables.com/id/How-to-use-WTV020SD-16P-with-Arduino/
https://www.buildcircuit.com/example-1-using-wtv020sd-16p-music-module-with-arduino/
https://forum.arduino.cc/index.php?topic=117009.0
http://www.electronoobs.com/eng_arduino_tut8.php
https://makezine.com/projects/ir-pulse-sensor/
https://www.instructables.com/id/Heart-Rate-Monitor-1/
https://microcontrollerslab.com/heart-beat-sensor-arduino/
https://tkkrlab.nl/wiki/Arduino_KY-039_Detect_the_heartbeat_module
http://www.utteducation.com/past-projects/ky-039-finger-measuring-heartbeat-sensor-module/
https://forum.arduino.cc/index.php?topic=368013.0
https://www.instructables.com/id/HOW-TO-USE-ISD1820-VOICE-RECORDER-AND-PLAYER/
https://www.allelectronics.com/mas_assets/media/allelectronics2018/spec/ME-63.pdf
https://www.elecfreaks.com/store/blog/voice-record-module-isd1820.html/
https://learn.sparkfun.com/tutorials/getting-started-with-load-cells
https://cdn.sparkfun.com/datasheets/Sensors/ForceFlex/hx711_english.pdf
https://github.com/bogde/HX711
https://www.hackster.io/MOHAN_CHANDALURU/hx711-load-cell-amplifier-interface-with-arduino-
fa47f3
https://electronics.stackexchange.com/questions/199487/connect-hx711-to-a-three-wire-load-cell
https://learn.sparkfun.com/tutorials/load-cell-amplifier-hx711-breakout-hookup-guide
https://electronics.stackexchange.com/questions/102164/3-wire-load-cells-and-wheatstone-bridges-from-a-
bathroom-scale
https://www.geekstips.com/esp8266-arduino-tutorial-iot-code-example/
https://maker.pro/esp8266/tutorial
https://www.instructables.com/id/ESP8266-Wi-fi-module-explain-and-connection/
https://maker.pro/esp8266/tutorial/how-to-program-esp8266s-onboard-gpio-pins
https://datasheets.maximintegrated.com/en/ds/DS3231.pdf
https://datasheets.maximintegrated.com/en/ds/DS1302.pdf
https://datasheets.maximintegrated.com/en/ds/DS1307.pdf
https://github.com/adafruit/RTClib
https://github.com/msparks/arduino-ds1302
https://github.com/iot-playground/Arduino/tree/master/external_libraries/DS1302RTC
https://learn.adafruit.com/ds1307-real-time-clock-breakout-board-kit/overview
https://www.instructables.com/id/Arduino-Real-Time-Clock-DS1307/
https://www.arduino.cc/en/Reference/RTC