KEMBAR78
ESP32 Micro Controller | PDF | Electric Motor | Relay
0% found this document useful (0 votes)
111 views36 pages

ESP32 Micro Controller

The document provides an overview of the ESP32 microcontroller, detailing its specifications, pinout, and various functionalities, including its applications in IoT. It also covers the MQ-135 and MQ-2 gas sensors, explaining their features, pin configurations, and how they can be used to detect various gases. The ESP32 is noted for its low-cost, integrated Wi-Fi and Bluetooth capabilities, while the MQ sensors are highlighted for their versatility in gas detection.

Uploaded by

Shivani Ch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
111 views36 pages

ESP32 Micro Controller

The document provides an overview of the ESP32 microcontroller, detailing its specifications, pinout, and various functionalities, including its applications in IoT. It also covers the MQ-135 and MQ-2 gas sensors, explaining their features, pin configurations, and how they can be used to detect various gases. The ESP32 is noted for its low-cost, integrated Wi-Fi and Bluetooth capabilities, while the MQ sensors are highlighted for their versatility in gas detection.

Uploaded by

Shivani Ch
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 36

3.

1 ESP32 MICROCONTOLLER:

3.1.2 Introduction:

SP32 is a low-cost System on Chip (SoC) Microcontroller from Espressif Systems, the
developers of the famous ESP8266 SoC. It is a successor to ESP8266 SoC and comes in both
single-core and dual-core variations of the Tensilica’s 32-bit Xtensa LX6 Microprocessor
with integrated Wi-Fi and Bluetooth.

Fig ESP 32 Microcontroller

The good thing about ESP32, like ESP8266 is its integrated RF components like Power
Amplifier, Low-Noise Receive Amplifier, Antenna Switch, Filters and RF Balun. This makes
designing hardware around ESP32 very easy as you require very few external components.

Fig ESP32 Architecture


Another important thing to know about ESP32 is that it is manufactured using TSMC’s ultra-
low-power 40 nm technology. So, designing battery operated applications like wearables,
audio equipment, baby monitors, smart watches, etc., using ESP32 should be very easy.

3.1.2 Specifications:

 Single or Dual-Core 32-bit LX6 Microprocessor with clock frequency up to 240 MHz

 520 KB of SRAM, 448 KB of ROM and 16 KB of RTC SRAM.

 Supports 802.11 b/g/n Wi-Fi connectivity with speeds up to 150 Mbps.

 Support for both Classic Bluetooth v4.2 and BLE specifications.

 34 Programmable GPIOs.

 Up to 18 channels of 12-bit SAR ADC and 2 channels of 8-bit DAC

 Serial Connectivity include 4 x SPI, 2 x I2C, 2 x I2S, 3 x UART.

 Ethernet MAC for physical LAN Communication (requires external PHY).

 1 Host controller for SD/SDIO/MMC and 1 Slave controller for SDIO/SPI.

 Motor PWM and up to 16-channels of LED PWM.

 Secure Boot and Flash Encryption.

 Cryptographic Hardware Acceleration for AES, Hash (SHA-2), RSA, ECC and RNG.

3.1.3 Pinout of ESP32 Board


Fig ESP32 Microcontroller Pinout

GPIO Input Output Notes

pulled
0 OK outputs PWM signal at boot, must be LOW to enter flashing mode
up

1 TX pin OK debug output at boot

connected to on-board LED, must be left floating or LOW to enter


2 OK OK
flashing mode

3 OK RX pin HIGH at boot

4 OK OK

5 OK OK outputs PWM signal at boot, strapping pin


6 x x connected to the integrated SPI flash

7 x x connected to the integrated SPI flash

8 x x connected to the integrated SPI flash

9 x x connected to the integrated SPI flash

10 x x connected to the integrated SPI flash

11 x x connected to the integrated SPI flash

12 OK OK boot fails if pulled high, strapping pin

13 OK OK

14 OK OK outputs PWM signal at boot

15 OK OK outputs PWM signal at boot, strapping pin

16 OK OK

17 OK OK

18 OK OK

19 OK OK

21 OK OK

22 OK OK
23 OK OK

25 OK OK

26 OK OK

27 OK OK

32 OK OK

33 OK OK

34 OK input only

35 OK input only

36 OK input only

39 OK input only

Tab: ESP32 Pinout

Input only pins

GPIOs 34 to 39 are GPIs – input only pins. These pins don’t have internal pull-up or pull-
down resistors. They can’t be used as outputs, so use these pins only as inputs:

 GPIO 34

 GPIO 35

 GPIO 36

 GPIO 39
GPIO 6 to GPIO 11 are exposed in some ESP32 development boards. However, these pins
are connected to the integrated SPI flash on the ESP-WROOM-32 chip and are not
recommended for other uses. So, don’t use these pins in your projects:

 GPIO 6 (SCK/CLK)

 GPIO 7 (SDO/SD0)

 GPIO 8 (SDI/SD1)

 GPIO 9 (SHD/SD2)

 GPIO 10 (SWP/SD3)

 GPIO 11 (CSC/CMD)

Capacitive touch GPIOs

The ESP32 has 10 internal capacitive touch sensors. These can sense variations in anything
that holds an electrical charge, like the human skin. So, they can detect variations induced
when touching the GPIOs with a finger. These pins can be easily integrated into capacitive
pads and replace mechanical buttons. The capacitive touch pins can also be used to wake up
the ESP32 from deep sleep.

Those internal touch sensors are connected to these GPIOs:

 T0 (GPIO 4)

 T1 (GPIO 0)

 T2 (GPIO 2)

 T3 (GPIO 15)

 T4 (GPIO 13)

 T5 (GPIO 12)

 T6 (GPIO 14)

 T7 (GPIO 27)

 T8 (GPIO 33)
 T9 (GPIO 32)

Analog to Digital Converter (ADC)

The ESP32 has 18 x 12 bits ADC input channels (while the ESP8266 only has 1x 10 bits
ADC). These are the GPIOs that can be used as ADC and respective channels:

 ADC1_CH0 (GPIO 36)

 ADC1_CH1 (GPIO 37)

 ADC1_CH2 (GPIO 38)

 ADC1_CH3 (GPIO 39)

 ADC1_CH4 (GPIO 32)

 ADC1_CH5 (GPIO 33)

 ADC1_CH6 (GPIO 34)

 ADC1_CH7 (GPIO 35)

 ADC2_CH0 (GPIO 4)

 ADC2_CH1 (GPIO 0)

 ADC2_CH2 (GPIO 2)

 ADC2_CH3 (GPIO 15)

 ADC2_CH4 (GPIO 13)

 ADC2_CH5 (GPIO 12)

 ADC2_CH6 (GPIO 14)

 ADC2_CH7 (GPIO 27)

 ADC2_CH8 (GPIO 25)

 ADC2_CH9 (GPIO 26)

Learn how to use the ESP32 ADC pins:


 ESP32 ADC Pins with Arduino IDE

 ESP32 ADC Pins with Micro Python

Note: ADC2 pins cannot be used when Wi-Fi is used. So, if you’re using Wi-Fi and you’re
having trouble getting the value from an ADC2 GPIO, you may consider using an ADC1
GPIO instead. That should solve your problem.

The ADC input channels have a 12-bit resolution. This means that you can get analog
readings ranging from 0 to 4095, in which 0 corresponds to 0V and 4095 to 3.3V. You can
also set the resolution of your channels on the code and the ADC range.

The ESP32 ADC pins don’t have a linear behaviour. You’ll probably won’t be able to
distinguish between 0 and 0.1V, or between 3.2 and 3.3V. You need to keep that in mind when
using the ADC pins.

Digital to Analog Converter (DAC)

There are 2 x 8 bits DAC channels on the ESP32 to convert digital signals into analog voltage
signal outputs. These are the DAC channels:

 DAC1 (GPIO25)

 DAC2 (GPIO26)

RTC GPIOs

There is RTC GPIO support on the ESP32. The GPIOs routed to the RTC low-power
subsystem can be used when the ESP32 is in deep sleep. These RTC GPIOs can be used to
wake up the ESP32 from deep sleep when the Ultra Low Power (ULP) co-processor is
running. The following GPIOs can be used as an external wake up source.

 RTC_GPIO0 (GPIO36)

 RTC_GPIO3 (GPIO39)

 RTC_GPIO4 (GPIO34)

 RTC_GPIO5 (GPIO35)

 RTC_GPIO6 (GPIO25)
 RTC_GPIO7 (GPIO26)

 RTC_GPIO8 (GPIO33)

 RTC_GPIO9 (GPIO32)

 RTC_GPIO10 (GPIO4)

 RTC_GPIO11 (GPIO0)

 RTC_GPIO12 (GPIO2)

 RTC_GPIO13 (GPIO15)

 RTC_GPIO14 (GPIO13)

 RTC_GPIO15 (GPIO12)

 RTC_GPIO16 (GPIO14)

 RTC_GPIO17 (GPIO27)

PWM

The ESP32 LED PWM controller has 16 independent channels that can be configured
to generate PWM signals with different properties. All pins that can act as outputs can be
used as PWM pins (GPIOs 34 to 39 can’t generate PWM).

To set a PWM signal, you need to define these parameters in the code:

 Signal’s frequency;

 Duty cycle;

 PWM channel;

 GPIO where you want to output the signal.

Learn how to use ESP32 PWM with Arduino IDE: ESP32 PWM with Arduino IDE

I2C

The ESP32 has two I2C channels and any pin can be set as SDA or SCL. When using the
ESP32 with the Arduino IDE, the default I2C pins are:
 GPIO 21 (SDA)

 GPIO 22 (SCL)

3.1.4 Functions:

ESP32 has many applications when it comes to IoT. Here are just some of the IoT functions
the chip is used for:

 Networking: The module’s Wi-Fi antenna and dual core enables embedded devices to
connect to routers and transmit data.

 Data processing: Includes processing basic inputs from analog and digital sensors to
far more complex calculations with an RTOS or non-OS software development kit
(SDK). A non-OS SDK refers to one that is designed to run directly on the chip
without a full operating system supporting it.

 P2P connectivity: Creates direct communication between different ESPs and other
devices using IoT P2P connectivity.

 Web server: Provides access to pages written in HTML or development languages.

3.1.4 Applications:

 Smart industrial devices, including programmable logic controllers (PLCs)


 Smart medical devices, including wearable health monitors
 Smart energy devices, including HVAC and thermostats
 Smart security devices, including surveillance cameras and smart locks

3.2 MQ 135 AIR QUALITY SENSOR

3.2.1 Introduction:

When it comes to measuring or detecting a particular Gas, the MQ series Gas


sensors are the most inexpensive and commonly used ones. MQ135 is available as a module
or as just the sensor alone. If you are trying to only detect (not measuring PPM) the presence
of a gas, then you can buy it as a module since it comes with an op-amp comparator and a
digital output pin. But if you planning to measure the PPM of a gas it is recommend buying
the sensor alone without module. The MQ-135 Gas sensors are used in air quality control
equipment and are suitable for detecting or measuring of NH3, NOx, Alcohol, Benzene,
Smoke, CO2. The MQ-135 sensor module comes with a Digital Pin which makes this sensor
to operate even without a microcontroller and that comes in handy when you are only trying
to detect one particular gas. If you need to measure the gases in PPM, the analog pin needs to
be used. The analog pin is TTL driven and works on 5V and so can be used with most
common microcontrollers. If you are looking for a sensor to detect or measure common air
quality gases such as CO2, Smoke, NH3, NOx, Alcohol, Benzene then this sensor might be
the right choice for you.

You can either use the digital pin or the analog pin to do this. Simply power the module with
5V and you should notice the power LED on the module to glow and when no gas it detected
the output LED will remain turned off meaning the digital output pin will be 0V. Remember
that these sensors have to be kept on for pre-heating time (mentioned in features above)
before you can actually work with it. Now, introduce the sensor to the gas you want to detect
and you should see the output LED to go high along with the digital pin, if not use
the potentiometer until the output gets high. Now every time your sensor gets introduced to
this gas at this particular concentration the digital pin will go high (5V) else will remain low
(0V). You can also use the analog pin to achieve the same thing. Read the analog values (0-
5V) using a microcontroller, this value will be directly proportional to the concentration of
the gas to which the sensor detects. You can experiment with these values and check how the
sensor reacts to different concentration of gas and develop your program accordingly.

Fig MQ 135 Air Quality Sensor

3.2.2 Pin Configuration:

Pin Pin Description


No: Name:

For Module

1 Vcc Used to power the sensor, Generally the operating voltage is


+5V.

2 Ground Used to connect the module to system ground.

3 Digital You can also use this sensor to get digital output from this pin,
Out by setting a threshold value using the potentiometer.

4 Analog This pin outputs 0-5V analog voltage based on the intensity of
Out the gas.

Table MQ 135 Sensor Pinout

3.2.3 MQ-135 Sensor Features

 Wide detecting scope

 Fast response and High sensitivity

 Stable and long life

 Operating Voltage is +5V

 Detect/Measure NH3, NOx, alcohol, Benzene, smoke, CO2, etc.

 Analog output voltage: 0V to 5V

 Digital output voltage: 0V or 5V (TTL Logic)

 Preheat duration 20 seconds


 Can be used as a Digital or analog sensor

 The Sensitivity of Digital pin can be varied using the potentiometer

3.3 MQ 2 GAS SENSOR:

3.3.1 Introduction:

The MQ-2 Gas sensor can detect or measure gasses like LPG, Alcohol, Propane,
Hydrogen, CO, and even methane. The module version of this sensor comes with a Digital
Pin which makes this sensor to operate even without a microcontroller and that comes in
handy when you are only trying to detect one particular gas. When it comes to measuring the
gas in ppm the analog pin has to be used, the analog pin also TTL driven and works on 5V
and hence can be used with most common microcontrollers. So if you are looking for a
sensor to detect or measure gasses like LPG, Alcohol, Propane, Hydrogen, CO and even
methane with or without a microcontroller, then this sensor might be the right choice for you.
Using an MQ sensor to detect a gas is very easy. You can either use the digital pin or the
analog pin to accomplish this. Simply power the module with 5V and you should notice the
power LED on the module to glow and when no gas it detected the output LED will remain
turned off meaning the digital output pin will be 0V. Remember that these sensors have to be
kept on for pre-heating time (mentioned in features above) before you can actually work with
it. Now, introduce the sensor to the gas you want to detect and you should see the output LED
to go high along with the digital pin, if not use the potentiometer until the output gets high.
Now every time your sensor gets introduced to this gas at this particular concentration the
digital pin will go high (5V) else will remain low (0V).

You can also use the analog pin to achieve the same thing. Read the analog values (0-
5V) using a microcontroller, this value will be directly proportional to the concentration of
the gas to which the sensor detects. You can experiment with these values and check how the
sensor reacts to different concentration of gas and develop your program accordingly. When it
comes to measuring or detecting a particular Gas, the MQ series Gas sensors are the most
commonly used ones. These sensors can either be purchased as a module or as just the sensor
alone. If you are trying to only detect (not measuring ppm) the presence of a gas then you can
buy it as a module since it comes with an op-amp comparator and a digital out pin. But if you
planning to measure the ppm of a gas, it is recommended to buy the sensor alone (without
module).
Fig MQ2 Smoke Sensor

3.2.2 Pin Configuration:

Pin Pin Description


No: Name:

For Module

1 Vcc This pin powers the module, typically the operating voltage is +5V

2 Ground Used to connect the module to system ground

3 Digital You can also use this sensor to get digital output from this pin, by setting a
Out threshold value using the potentiometer

4 Analog This pin outputs 0-5V analog voltage based on the intensity of the gas
Out

3.3.3 Features:

 Operating Voltage is +5V

 Can be used to Measure or detect LPG, Alcohol, Propane, Hydrogen, CO and even
methane
 Analog output voltage: 0V to 5V

 Digital Output Voltage: 0V or 5V (TTL Logic)

 Preheat duration 20 seconds

 Can be used as a Digital or analog sensor

 The Sensitivity of Digital pin can be varied using the potentiometer

3.4 MQ 7 CO Sensor

3.4.1 Introduction:

The sensitive material of the MQ-7 carbon monoxide gas sensor is tin dioxide (SnO2).
This is a reactive material to carbon monoxide and the basic working of this sensor depends
on the heating process of this sensing element. Carbon monoxide (CO) is not usually present
in fresh air therefore, the sensor does not provide any signal until it senses any leakage or
danger. Just like other MQ sensors, this one also has a sensitive element made of ceramic that
has a layer outside it. This layer consists of tin dioxide (SnO2) and has the feature of
absorbing the target gas. In the case of MQ7, the tin dioxide absorbs the carbon monoxide
and indicates its presence as soon as it comes in contact. The MQ-7 has electrodes that
facilitate electrical contact with the sensitive material. Usually, it is made with the gold for
the best performance. These allow the measurement of the electrical resistance. There is a
coil in the heart of this sensor. This is made of alloy like Ni-Cr and provides heat to the
sensitive layer to enhance its reaction and sensitivity. The censor has a tubular structure of
ceramic material such as alumina (Al2O3) and it provides support and strength to other
components so that they may be at their place. There is a network of double stainless steel
mesh that performs two functions:

1. It allows the gases to pass through it and retains the presence of any unwanted
particles outside the network.

2. It protects the internal structure because that is very reactive and delicate therefore,
with the help of this network, all the internal structure remains in its place.
Fig: MQ 7 CO Sensor

3.4.2 Pinout:

Pin Pin
Description
Number Name

1 Vcc This is the power pin that requires 5V

This pin is used to connect the module to the system’s common


2 Ground
ground

It is a digital output pin that shows the presence or absence of the CO


Digital
3 gas. The threshold value for this pin can be set by using the
Out
potentiometer

Analog It is the analogue output pin. It provides the analogue voltage based
4
Out on the concentration of the gas

Table MQ 7 Pinout

3.4.3. Specifications:

 Operating voltage: DC 5 V.
 The analog output voltage, the higher the concentration the higher the voltage.
 The carbon monoxide detection with better sensitivity.
 With a long service life and reliable stability.
 Rapid response and recovery characteristics.
 Range: 10 to 1000 ppm

3.5 TDS Sensor

3.5.1 Introduction:

Gravity: Analog TDS Sensor/Meter for Arduino is an Arduino-compatible TDS Meter Kit for
measuring TDS value of the water, to reflect the cleanliness of the water. TDS meter can be
applied to domestic water, hydroponic and other fields of water quality testing. You may also
check Liquid Senser Selection Guide to get better familiar with our liquid sensor series.

TDS (Total Dissolved Solids) indicates that how many milligrams of soluble solids dissolved
in one liter of water. In general, the higher the TDS value, the more soluble solids dissolved
in water, and the less clean the water is. Therefore, the TDS value can be used as one of the
references for reflecting the cleanliness of water.

TDS pen is widely used equipment to measure TDS value. The price is affordable,
and it is easy to use, but it is not able to transmit data to the control system for online
monitoring to do some water quality analysis. The professional instrument has high accuracy
and can send data to the control system, but the price is expensive for ordinary people. To this
end, we have launched an analog TDS sensor kit that is compatible with Arduino, plug, and
play, easy to use. Matching with Arduino controller, you can build a TDS detector easily to
measure the TDS value of liquid. This DF-Robot Gravity: Analog TDS Sensor/ Meter for
Arduino supports 3.3 ~ 5.5V wide voltage input, and 0 ~ 2.3V analog voltage output, which
makes it compatible with a 5V or 3.3V control system or board. The excitation source is an
AC signal, which can effectively prevent the probe from polarization and prolong the life of
the probe, meanwhile, increase the stability of the output signal. The TDS probe is
waterproof, it can be immersed in water for a long-time measurement.
Fig TDS Sensor

3.4.2 Pinout:

Table TDS Sensor Pinout

3.4.3 Specifications:

 Operating Voltage: 3.3V to 5.5V

 Output Voltage: 0 to 2.3V

 TDS Measurement Range: 0 to 1000 ppm

 Accuracy: ±10% F.S. (Full Scale)

 Operating Temperature: 0°C to 50°C

3.5 DC Motor
12V 60 RPM DC motor is a type of direct current (DC) motor that operates on a 12-volt
power supply and has a rated speed of 60 revolutions per minute (RPM). Here's an
introduction to it:

Basic Overview:

 Voltage: 12V refers to the operating voltage required to power the motor. It is
commonly used in applications where a 12V DC power source is available, like in
battery-powered systems.

 Speed: 60 RPM means the motor completes 60 full rotations per minute when
powered under ideal conditions. This is considered a relatively slow speed, suitable
for applications where torque (rotational force) is more important than high speed.

Working Principle:

 A DC motor uses an electric current passing through a coil or armature inside a


magnetic field to produce motion.

 The motor has a commutator that reverses the direction of current flow in the coils,
ensuring continuous rotation in one direction.

Applications:

 Robotics: Often used in robotics where low-speed, high-torque movement is needed.

 Electric Vehicles (EVs): Small-scale electric vehicles and scooters use these motors
for low-speed operation.

 Small Appliances: Fans, small conveyor belts, or other devices that need moderate
speed for operation.

 Toys: Frequently found in toys that require controlled, low-speed rotation.

Characteristics:

 Low Speed, High Torque: At 60 RPM, the motor is designed for tasks that require
controlled speed and more torque, rather than speed.
 Efficiency: Generally, the efficiency of DC motors depends on the design, but 12V
motors are common because they can be powered by easily accessible 12V batteries
or power supplies.

 Controlling Speed: The speed of a DC motor can be varied by adjusting the voltage,
or by using pulse-width modulation (PWM) methods.

Advantages:

 Simplicity: DC motors are easy to control, especially for simple tasks like controlling
speed and direction.

 Low Power Consumption: 12V motors generally consume less power compared to
higher voltage motors.

 Compact: These motors are usually smaller in size, making them ideal for compact
and portable applications.

Limitations:

 Limited Speed Range: Compared to higher RPM motors, 60 RPM motors are
relatively slow, making them unsuitable for applications requiring high-speed
rotation.

 Wear and Tear: The brushes and commutators in DC motors can wear out over time,
requiring maintenance.

In summary, a 12V 60 RPM DC motor is a low-speed, high-torque motor commonly


used in applications where you need controlled rotational movement without fast speed. It’s
easy to control and can be powered with standard 12V batteries or power supplies.
Fig 12 Volts 60 RPM DC Motor

3.5.2 Features

 4 stage gearbox for optimum high torque operation, which has breaking torque of 100
kgcm.

 Not recommended to use beyond 75 kg cm for continuous use

 Motor rated Torque is 70 kg cm for continuous use at maximum efficiency.

 Stall torque of motor is higher than 200 kgcm, but not recommedned to exceed
75kgcm.

 Shaft is D type with total lenght of 16 mm and D shape in 12 mm.

 6mm Dia shaft with M3 thread hole for tight mounting.

 Shaft can be coupled using CNC coupling 6 mm or using fixed coupling as per
requirement

 Back shaft length is 9 mm

 Gearbox diameter is 32 mm.

 Motor Diameter 28.5 mm

 Length 81.5 mm without shaft

 300 gm weight

 Supply Voltage: 12 V DC

 No-load current: 800 mA, Load current: upto 7.5 A(Max)

Battery:

Introduction:

A 12V 1.3Ah (amp-hour) lead-acid rechargeable battery is a common type of secondary


(rechargeable) battery typically used in small to medium-sized devices and applications.
Here’s a breakdown of its key features and characteristics:
Battery Type:

 Lead-Acid Battery: This type of battery uses lead plates and sulfuric acid to store and
release electrical energy. It's known for being relatively inexpensive and reliable,
especially in applications where space and weight aren't critical factors.

 Rechargeable: This battery can be recharged multiple times by applying a voltage to


reverse the chemical reaction inside, restoring the battery to its original state.

Voltage (12V):

 The 12V rating indicates the nominal voltage output of the battery when it's fully
charged. This voltage is commonly used in many applications, including automotive,
solar power systems, backup power, and small electronics.

 12V is a standard voltage for many lead-acid batteries, especially those used in
vehicles, RVs, and other systems that need a moderate amount of power.

Capacity (1.3Ah):

 1.3Ah stands for 1.3 amp-hours, which is the battery's capacity. This means that the
battery can supply 1.3 amps of current for one hour, or, for example, 0.65 amps for
two hours, or 2.6 amps for 30 minutes.

 Amp-Hours (Ah) is a unit that measures the amount of charge the battery can deliver
over a specified period. The higher the Ah rating, the longer the battery can power a
device before needing to be recharged.

Common Applications:

 UPS (Uninterruptible Power Supply): Often used as backup power for small
electronics or computers during short power outages.

 Solar Power Systems: Used to store energy in off-grid or backup solar systems.

 Electric Vehicles: Small electric scooters, wheelchairs, or toys may use a 12V 1.3Ah
battery for power.

 Security Systems: These batteries can be used in alarm systems, cameras, and other
low-power devices to provide backup power.
 Lighting Systems: Solar-powered garden lights or emergency lighting.

Fig 12 Volts 1.3Ah Rechargeable battery

Charging and Maintenance:

 Charging: Lead-acid batteries require specific charging methods to maintain their life.
Overcharging or undercharging can damage the battery. Typically, a 12V lead-acid
charger is used to recharge these batteries.

 Float Charging: For prolonged use, the battery may be kept at a full charge using a
low-maintenance float charger that maintains the charge without overcharging it.

 Maintenance: Lead-acid batteries may require occasional maintenance, such as


checking electrolyte levels (if they’re flooded lead-acid batteries), cleaning terminals,
and ensuring the battery is not left in a discharged state for too long.

Advantages:

 Cost-Effective: Lead-acid batteries are relatively inexpensive compared to other


rechargeable battery types (e.g., lithium-ion).

 Reliability: They have been used for many years and are known for their robustness
and reliability in various applications.

 Availability: 12V lead-acid batteries are widely available and used in a variety of
products.
Limitations:

 Weight and Size: Lead-acid batteries are typically heavier and bulkier compared to
newer battery technologies like lithium-ion, which can be a disadvantage in
applications where space or weight is a concern.

 Lifespan: Lead-acid batteries generally have a shorter lifespan compared to newer


battery chemistries. They also lose capacity over time, especially if deeply discharged
frequently.

 Self-Discharge Rate: Lead-acid batteries tend to have a higher self-discharge rate than
lithium-ion batteries, meaning they lose charge more quickly when not in use.

Discharge Characteristics:

 Lead-acid batteries generally discharge at a relatively steady voltage until they are
nearing empty. However, they also suffer from voltage sag when heavily loaded,
which may affect the performance of devices drawing power from the battery.

Safety:

 Ventilation: Lead-acid batteries can produce hydrogen gas during charging, so they
should be used in well-ventilated areas to prevent the risk of an explosion.

 Overheating: Prolonged overcharging can cause excessive heat and even damage the
battery, so using the proper charging method is essential.

3.6.2 Features

 Voltage: 12 Volts (V)

 Capacity: 1.3 Amp-Hours (Ah)

 Type: Lead-Acid (Rechargeable)

 Rechargeable: Can be recharged multiple times

 Charging Voltage: 13.5V to 14.5V (full charge), 13.2V to 13.5V (float charge)

 Discharge Characteristics: Gradual voltage drop, cutoff around 10.5V to 11V

 Depth of Discharge (DoD): Ideally don’t discharge below 50%


 Size and Weight: Compact and relatively heavy compared to lithium batteries

 Self-Discharge Rate: 3% to 5% per month

 Maintenance: Flooded or Sealed (maintenance varies)

 Operating Temperature Range: 0°C to 40°C (32°F to 104°F)

 Storage Temperature Range: 0°C to 25°C (32°F to 77°F)

 Discharge Rate (C-rate): Moderate, suitable for low-to-medium power applications

 Applications: Backup power, solar systems, security systems, electric vehicles, toys

 Durability: Durable, shock/vibration-resistant

 Cost: Inexpensive compared to newer battery technologies

 Safety: Emits hydrogen gas during charging (ventilation required), sealed versions are
maintenance-free

3.3.1 Introduction to Relay:


A relay is usually an electromechanical device that is actuated by an electrical current.
The current flowing in one circuit causes the opening or closing of another circuit. Relays
are like remote control switches and are used in many applications because of their relative
simplicity, long life, and proven high reliability. Relays are used in a wide variety of
applications throughout industry, such as in telephone exchanges, digital computers and
automation systems. Highly sophisticated relays are utilized to protect electric power
systems against trouble and power blackouts as well as to regulate and control the generation
and distribution of power. In the home, relays are used in refrigerators, washing machines
and dishwashers, and heating and air-conditioning controls. Although relays are generally
associated with electrical circuitry, there are many other types, such as pneumatic and
hydraulic. Input may be electrical and output directly mechanical, or vice versa.
Fig 3.4 Relay

3.3.2 Relay Working Procedure:

All relays contain a sensing unit, the electric coil, which is powered by AC or DC
current. When the applied current or voltage exceeds a threshold value, the coil activates the
armature, which operates either to close the open contacts or to open the closed contacts.
When a power is supplied to the coil, it generates a magnetic force that actuates the switch
mechanism. The magnetic force is, in effect, relaying the action from one circuit to another.
The first circuit is called the control circuit; the second is called the load circuit.

Fig 3.5 Internal Construction of Relay

Relays have the exact working of a switch. So, the same concept is also applied. A relay is
said to switch one or more poles. Each pole has contacts that can be thrown in mainly three
ways. They are
 Normally Open Contact (NO) – NO contact is also called a make contact. It closes the
circuit when the relay is activated. It disconnects the circuit when the relay is inactive.
 Normally Closed Contact (NC) – NC contact is also known as break contact. This is
opposite to the NO contact. When the relay is activated, the circuit disconnects. When
the relay is deactivated, the circuit connects.
 Change-over (CO) / Double-throw (DT) Contacts – This type of contacts are used to
control two types of circuits. They are used to control a NO contact and also a NC
contact with a common terminal. According to their type they are called by the
names break before make and make before break contacts.

3.5 LM2596 DC to DC Converter

3.5.1 Introduction to LM2596 DC to DC Converter:

The LM2596 is known for its high current rating of 3A. It is available in many
versions with fixed output voltage like 3.3V, 5V and 12V. But, the most famous one is the
LM2596-ADJ which has variable output voltage. The IC is basically a buck converter that
operates on 150 KHz switching frequency, it takes in an input voltage and uses the internal
switching circuit to regulate a desired output voltage. It has high efficiency and in-built
Thermal shutdown and current limit functionalities. The LM2596 is very easy to use because
it requires very minimum number of components. The unregulated voltage is given to pin 1
(Vin) across a filter capacitor to reduce input noise. The ON/OFF or enable pin (pin 5) should
be connected to ground to enable the IC. If made high the IC will enter shutdown mode and
prevent leakage current. This feature will be useful to save input power when operating via
battery. The feedback pin is the important pin which sets the output voltage. It sense the
output voltage and based on the value of this output voltage the switching frequency of the
internal switch is adjusted to provide the desired output voltage. Finally the output voltage is
obtained through pin 2 through an LC filter. The complete circuit diagram is given below, you
can often find these circuit in the LM2596 DC Converter module.
Fig 3.9 LM2596 DC to DC Converter

3.5.2 LM2596 DC to DC Converter Specifications:

 3A Step Down Voltage Regulator IC


 Available as 3.3V regulator, 5V Regulator, 12V Regulator and Variable regulator
 Input Supply Voltage: 4.5V to 40V
 Minimum Output Voltage: 3.16V
 Continuous Output Current: 3A
 Peak Output Current: 6.9A
 Switching Frequency: 150 KHz

SOFTWARE TOOLS AND APPLICATIONS

4.1 Arduino IDE


4.1.1 Introduction Arduino IDE:
The Arduino Integrated Development Environment (IDE) is a cross-platform
application (for Windows, macOS, Linux) that is written in functions from C and C++. It is
used to write and upload programs to Arduino compatible boards, but also, with the help of
third-party cores, other vendor development boards.

The source code for the IDE is released under the GNU General Public License,
version 2. The Arduino IDE supports the languages C and C++ using special rules of code
structuring. The Arduino IDE supplies a software library from the Wiring project, which
provides many common input and output procedures. User-written code only requires two
basic functions, for starting the sketch and the main program loop, that are compiled and
linked with a program stub main() into an executable cyclic executive program with the
GNU toolchain, also included with the IDE distribution. The Arduino IDE employs the
program avrdude to convert the executable code into a text file in hexadecimal encoding that
is loaded into the Arduino board by a loader program in the board's firmware. By default,
avrdude is used as the uploading tool to flash the user code onto official Arduino boards.

Arduino IDE is a derivative of the Processing IDE,however as of version 2.0, the


Processing IDE will be replaced with the Visual Studio Code-based Eclipse Theia IDE
framework. Arduino is a prototype platform (open-source) based on an easy-to-use hardware
and software. It consists of a circuit board, which can be programed (referred to as a
microcontroller) and ready-made software called Arduino IDE (Integrated Development
Environment), which is used to write and upload the computer code to the physical board.

Arduino provides a standard form factor that breaks the functions of the micro-
controller into a more accessible package. With Arduino, one can get to know the basics of
micro-controllers and sensors very quickly and can start building prototype with very little
investment. After learning about the main parts of the Arduino UNO board, we are ready to
learn how to set up the Arduino IDE. Once we learn this, we will be ready to upload our
program on the Arduino board.

4.1.2 Steps for uploading code with Arduino IDE:

Step 1 − First you must have your Arduino board (you can choose your favorite board) and a
USB cable. In case you use Arduino UNO, Arduino Duemilanove, Nano, Arduino Mega
2560, or Diecimila, you will need a standard USB cable (A plug to B plug), the kind you
would connect to a USB printer as shown in the following image.

Fig 4.1 Arduino Uno USB Cable

Step 2 − Download Arduino IDE Software.


You can get different versions of Arduino IDE from the Download page on the Arduino
Official website. You must select your software, which is compatible with your operating
system (Windows, IOS, or Linux). After your file download is complete, unzip the file.

Fig 4.2 Arduino IDE Software Installation

Step 3 − Power up your board


The Arduino Uno, Mega, Duemilanove and Arduino Nano automatically draw power
from either, the USB connection to the computer or an external power supply. If you are
using an Arduino Diecimila, you have to make sure that the board is configured to draw
power from the USB connection. The power source is selected with a jumper, a small piece
of plastic that fits onto two of the three pins between the USB and power jacks. Check that it
is on the two pins closest to the USB port.

Connect the Arduino board to your computer using the USB cable. The green power LED
(labeled PWR) should glow.

Step 4 − Launch Arduino IDE


After your Arduino IDE software is downloaded, you need to unzip the folder. Inside
the folder, you can find the application icon with an infinity label (application.exe). Double-
click the icon to start the IDE.
Fig 4.3 Arduino IDE Application File

Step 5 − Open your first project


Once the software starts, you have two options −

 Create a new project.

 Open an existing project example.

To create a new project, select File → New.


Fig 4.4 Creating a New file in Arduino IDE

To open an existing project example, select File → Example → Basics → Blink.

Fig 4.5 Opening an Example File in Arduino IDE

Here, we are selecting just one of the examples with the name Blink. It turns the LED on
and off with some time delay. You can select any other example from the list.

Step 6 − Select your Arduino board


To avoid any error while uploading your program to the board, you must select the
correct Arduino board name, which matches with the board connected to your computer.

Go to Tools → Board and select your board.


Fig 4.6 Selecting Required Board in Arduino IDE

Here, we have selected Arduino Uno board according to our tutorial, but you must select the
name matching the board that you are using.

Step 7 − Select your serial port


Select the serial device of the Arduino board. Go to Tools → Serial Port menu. This
is likely to be COM3 or higher (COM1 and COM2 are usually reserved for hardware serial
ports). To find out, you can disconnect your Arduino board and re-open the menu, the entry
that disappears should be of the Arduino board. Reconnect the board and select that serial
port.

Fig 4.7 Selecting Serial Port in Arduino IDE

Step 8 − Upload the program to your board


Before explaining how we can upload our program to the board, we must
demonstrate the function of each symbol appearing in the Arduino IDE toolbar.
Fig 4.8 Options of Arduino IDE

A − Used to check if there is any compilation error.

B − Used to upload a program to the Arduino board.

C − Shortcut used to create a new sketch.

D − Used to directly open one of the example sketch.

E − Used to save your sketch.

F − Serial monitor used to receive serial data from the board and send the serial data to the
board.

Now, simply click the "Upload" button in the environment. Wait a few seconds; you will see
the RX and TX LEDs on the board, flashing. If the upload is successful, the message "Done
uploading" will appear in the status bar.

Note − If you have an Arduino Mini, NG, or other board, you need to press the reset button
physically on the board, immediately before clicking the upload button on the Arduino
Software.

4.2 Blynk Application

4.2.1 Introduction to Blynk Application:


Blynk was designed for the Internet of Things. It can control hardware remotely, it can
display sensor data, it can store data, visualize it and do many other cool things.

There are three major components in the platform:


 Blynk App - allows to you create amazing interfaces for your projects using various
widgets we provide.
 Blynk Server - responsible for all the communications between the smartphone and
hardware. You can use our Blynk Cloud or run your private Blynk server locally. It’s
open-source, could easily handle thousands of devices and can even be launched on a
Raspberry Pi.
 Blynk Libraries - for all the popular hardware platforms - enable communication with the
server and process all the incoming and out coming commands.
Now imagine: every time you press a Button in the Blynk app, the message travels
to space the Blynk Cloud, where it magically finds its way to your hardware. It works the
same in the opposite direction and everything happens in a blynk of an eye.

4.2.2 Features of Blynk Application:


 Similar API & UI for all supported hardware & devices
 Connection to the cloud using:
 WiFi
 Ethernet
 GSM
 Set of easy-to-use Widgets
 Direct pin manipulation with no code writing
 Easy to integrate and add new functionality using virtual pins
 History data monitoring via Super Chart widget
 Device-to-Device communication using Bridge Widget
 Sending emails, tweets, push notifications, etc.

You might also like