0% found this document useful (0 votes)
14 views104 pages

Unit 4 Shared

The document provides an overview of Arduino, highlighting its differences from traditional microcontrollers, its architecture, and various types of Arduino boards. It explains the capabilities of Arduino in terms of sensors and actuators, as well as its programming structure, including data types and essential functions. Additionally, it details specific Arduino models like the Uno, Nano, and Mega, along with their features and applications.

Uploaded by

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

Unit 4 Shared

The document provides an overview of Arduino, highlighting its differences from traditional microcontrollers, its architecture, and various types of Arduino boards. It explains the capabilities of Arduino in terms of sensors and actuators, as well as its programming structure, including data types and essential functions. Additionally, it details specific Arduino models like the Uno, Nano, and Mega, along with their features and applications.

Uploaded by

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

Arduino and

Programming-Unit 4
Microcontroller vs. Arduino
• The difference between an Arduino development board and a microcontroller chip is
that the development board contains almost every essential part needed to start a
project on the board itself.
• It has a microcontroller chip and ports for connection or extension.
• On the other hand, for a single microcontroller chip (such as Atmega328
microcontroller), you need a lot of things. First, you need to buy a separate
programmer board to program the chip. For building a project or experimentation
with the chip, you need a breadboard for circuit wiring/connections with other
components, a DC power supply, jumper wires, etc. You also need to search for
program examples from various sources, books, and the Internet.
What is Arduino?
• A microcontroller board, contains on-board power supply, USB port to
communicate with PC, and an Atmel microcontroller chip.

• It simplify the process of creating any control system by providing the standard board
that can be programmed and connected to the system without the need to any
sophisticated PCB design and implementation.

• It is an open source hardware, any one can get the details of its design & modify it
or make his own one himself.
What Arduino Can Do?
• Sensors ( to sense stuff )
– Push buttons, touch pads, tilt switches.
– Variable resistors (e.g. volume knob / sliders)
– Photoresistors (sensing light levels)
– Thermistors (temperature)
– Ultrasound (proximity range finder)
•Actuators ( to do stuff )
– Lights, LED’s
– Motors
– Speakers
– Displays (LCD)
Why Arduino?
• It is Open Source, both in terms of Hardware and Software.
• It is cheap(1300र), the hardware can be built from components or a prefab board
can be purchased for approx. 900र.
• It can communicate with a computer via serial connection over USB.
• It can be powered from USB or standalone DC power.
• It can run standalone from a computer (chip is programmable) and it has memory
(a small amount).
• It can work with both Digital and Analog electronic signals. Sensors and
Actuators.
• You can make cool stuff! Some people are even making simple robots.
Arduino Architecture
• Arduino’s processor basically uses the
Harvard architecture where the program
code and program data have separate
memory.
• It consists of two memories- Program
memory and the data memory.
• The code is stored in the flash program
memory, whereas the data is stored in the
data memory.
• The Atmega328 has 32 KB of flash
memory for storing code (of which 0.5
KB is used for the bootloader), 2 KB of
SRAM and 1 KB of EEPROM and
operates with a clock speed of 16MHz.
Arduino Uno Board Description (Pin Diagram)
Arduino Uno Board Description (Pin Diagram)
Arduino Uno Board Description (Pin Diagram)

ICSP is basically "in circuit serial programming" which allows you to upload software to your MCU without having to pull it out every time.
Arduino Uno Board Description (Pin Diagram)
Arduino Uno Board Description
NOTE: Do NOT use a power supply greater
than 20 Volts as you will overpower (and
thereby destroy) your Arduino. The
recommended voltage for most Arduino
models is between 6 and 12 Volts
Types of Arduino
1. Arduino UNO
2. Arduino Nano
3. Arduino Mega
4. Arduino Micro
5. Arduino Leonardo
6. Arduino Due
7. Arduino Lilypad
8. Arduino Bluetooth
9. Arduino Robot
10. Arduino Ethernet
11. Arduino Zero
12. Arduino Esplora
13. Arduino Pro Micro
Classic Arduino Family

In the Classic Family, you will find


boards such as the legendary
Arduino UNO and other classics
such as the Leonardo & Micro.
These boards are considered the
backbone of the Arduino project,
and have been a success for many
years (and more to come).
Classic Arduino Shields
Arduino Nano Family

The Nano Family is a set of boards


with a tiny footprint, packed with
features. It ranges from the
inexpensive, basic Nano Every, to the
more feature-packed Nano 33 BLE
Sense / Nano RP2040 Connect that
has Bluetooth® / Wi-Fi® radio
modules. These boards also have a
set of embedded sensors, such as
temperature/humidity, pressure,
gesture, microphone and more.
They can also be programmed with
MicroPython and supports Machine
Learning.
Arduino Nano Family
Arduino Mega Family

In the Mega family, you will find the boards


for the projects that demand lots of
computing power and GPIO pins.
Arduino MKR Family

The MKR Family is a series of boards,


shields & carriers that can be combined to
create amazing projects without any
additional circuitry. Each board is
equipped with a radio module (except
MKR Zero), that enables Wi-Fi®,
Bluetooth®, LoRa®, Sigfox®, NB-IoT
communication. All boards in the family
are based on the Arm® Cortex®-M0 32-
bit SAMD21 low power processor, and
are equipped with a crypto chip for
secure communication.

The MKR Family shields & carriers are


designed to extend the functions of the
board: such as environmental sensors,
GPS, Ethernet, motor control and RGB
matrix.
Arduino UNO
• Arduino UNO is based on an ATmega328P
microcontroller.
• It is easy to use compared to other boards, such
as the Arduino Mega board, etc.
• The Arduino UNO includes 6 analog pin
inputs, 14 digital pins, a USB connector, a
power jack, and an ICSP (In-Circuit Serial
Programming) header.
• It is the most used and of standard form from
the list of all available Arduino Boards.
• It is also recommended for beginners as it is
easy to use.
Arduino Nano
• The Arduino Nano is a small Arduino board based
on ATmega328P or ATmega628 Microcontroller.
The connectivity is the same as the Arduino UNO
board.
• The Nano board is defined as a sustainable, small,
consistent, and flexible microcontroller board. It is
small in size compared to the UNO board. The
devices required to start our projects using the
Arduino Nano board are Arduino IDE and mini
USB.
• The Arduino Nano includes an I/O pin set of 14
digital pins and 8 analog pins. It also includes 6
Power pins and 2 Reset pins.
Arduino Mega
• The Arduino Mega is based on ATmega2560
Microcontroller. The ATmega2560 is an 8-bit
microcontroller.
• We need a simple USB cable to connect to the computer
and the AC to DC adapter or battery to get started with it.
• It has the advantage of working with more memory
space.
• The Arduino Mega includes 54 I/O digital pins and 16
Analog Input/Output (I/O), ICSP header, a reset button, 4
UART (Universal Asynchronous Reciever/Transmitter)
ports, USB connection, and a power jack.
• Arduino Mega board are Used in IOT Applications, 3D
Printers, temperature sensing, monitoring of real-time
applications.
Arduino Micro
• The Arduino Micro is based on the ATmega32U4
Microcontroller. It consists of 20 sets of pins. The 7 pins
from the set are PWM (Pulse Width Modulation) pins,
while 12 pins are analog input pins.
• The other components on board are reset button, 16MHz
crystal oscillator, ICSP header, and a micro USB
connection.

• The USB is inbuilt in the Arduino Micro board.

• The Arduino Micro is also called as the shrunk


version of Arduino Leonardo.
Arduino Leonardo
• The basic specification of the Arduino Leonardo is
the same as the Arduino Micro.

• It is also based on ATmega32U4 Microcontroller.

• The components present on the board are 20 analog


and digital pins, reset button, 16MHz crystal
oscillator, ICSP header, and a micro USB
connection.
Arduino Due
• The Arduino Due is based on the 32- bit ARM core.

• It is the first Arduino board that has developed based


on the ARM Microcontroller.

• It consists of 54 Digital Input/Output pins and 12


Analog pins.

• The Microcontroller present on the board is the


Atmel SAM3X8E ARM Cortex-M3 CPU.

ARM stands for Advanced RISC Machine


RISC: Reduced Instruction Set Computer
Arduino Lilypad
• The Arduino LilyPad was initially created for wearable
projects and e-textiles.

• It is based on the ATmega168 Microcontroller.

• The functionality of Lilypad is the same as other Arduino


Boards.

• It is a round, light-weight board with a minimal number of


components to keep the size of board small.

• It has 9 digital I/O pins.


Arduino BT
• The Arduino Bluetooth board is based on ATmega168
Microcontroller.

• It is also named as Arduino BT board.

• The components present on the board are 16 digital pins,


6 analog pins, reset button, 16MHz crystal oscillator,
ICSP header, and screw terminals.

• The screw terminals are used for power.

• The Arduino Bluetooth Microcontroller board can be


programmed over the Bluetooth as a wireless connection.
Arduino Robot
• The Arduino Robot is called as the tiny computer.

• It is widely used in robotics. The board comprises of the


• Speaker
• five-button
• color screen
• two motors
• an SD card reader
• a digital compass
• two potentiometers
• and five floor sensors.

• The Robot Library can be used to control the actuators


and the sensors.
Arduino Ethernet
• The Arduino Ethernet is based on the ATmega328
Microcontroller.

• The board consists of 6 analog pins, 14 digital I/O


pins, crystal oscillator, reset button, ICSP header, a
power jack, and an RJ45 connection.

• With the help of the Ethernet shield, we can connect


our Arduino board to the internet.
Arduino Zero
• The Arduino Zero is generally called as the 32-bit
extension of the Arduino UNO.

• It is based on ATmel's SAM21 MCU.

• The board consists of 6 analog pin inputs, 14 digital


Input/Output pins, a USB connector, a power jack, and
an ICSP (In-Circuit Serial Programming) header, UART
port pins, a power header, and AREF button.

• The Embedded debugger of Atmel is also supported by


the Arduino Zero. The function of Debugger is to
provide a full debug interface, which does not require
additional hardware.
Arduino Esplora
• The Arduino Esplora boards allow easy
interfacing of sensors and actuators.

• The outputs and inputs connected on the


Esplora board make it unique from other types
of Arduino boards.

• The board includes outputs, inputs, a small


microcontroller, a microphone, a sensor, a
joystick, an accelerometer, a temperature sensor,
four buttons, and a slider.
Arduino Pro Micro
• The structure of Arduino Pro Micro is similar to
the Arduino Mini board, except the
Microcontroller ATmega32U4.

• The board consists of 12 digital Input/output


pins, 5 PWM (Pulse Width Modulation) pins,
Tx and Rx serial connections, and 10-bit ADC
(Analog to Digital Converter).
Arduino Program Structure
Sketch − The Arduino program is called “sketch”.

Arduino programs can be divided in three main parts:

• Structure

• Values (variables and constants)

• Functions.
Arduino Program Structure
Structure: Software structure consist of two main functions −

• Setup( ) function

• Loop( ) function
Arduino Program Structure
Setup()

• The setup() function is called when a


sketch starts. void setup()
{
• Use it to initialize the variables, pin
modes, start using libraries, etc. // runs once
}
• The setup function will only run once,
after each power up or reset of the Arduino
board.
Arduino Program Structure
loop()

• The loop() function does precisely what its name void loop()
suggests, and loops consecutively, allowing your
program to change and respond.
{
// repeats
• Use it to actively control the Arduino board. }
Bare Minimum Code
• Bare minimum of code you need for a
sketch to compile properly on Arduino
Software (IDE):

• The setup() method and the loop() method.


Data Types
• Data types in C refers to an extensive system used for declaring variables
or functions of different types.

• The type of a variable determines how much space it occupies in the


storage and how the bit pattern stored is interpreted.
Data Types

void
• The void keyword is used only in
function declarations.

• It indicates that the function is


expected to return no information
to the function from which it was
called.
Data Types
Boolean

• A Boolean holds one of two values, true or false.

• Each Boolean variable occupies one byte of memory.

• e.g.
Data Types
Char
• A data type that takes up one byte of memory that stores a character value. Range
from -128 to 127.

• Character literals are written in single quotes like this: 'A' and for multiple characters,
strings use double quotes: "ABC".

• e.g.

• However, characters are stored as numbers. You can see the specific encoding in the
ASCII chart.

• This means that it is possible to do arithmetic operations on characters, in which


the ASCII value of the character is used. For example, 'A' + 1 has the value 66, since
the ASCII value of the capital letter A is 65.
Data Types
unsigned char

• Unsigned char is an unsigned data type that occupies one byte of memory.

• The unsigned char data type encodes numbers from 0 to 255.

• e.g.
Data Types
byte

A byte stores an 8-bit unsigned number, from 0 to 255.

e.g.
Data Types
int
• Integers are the primary data-type for number storage. int stores a 16-bit (2-
byte) value.

• This yields a range of -32,768 to 32,767 (minimum value of -2^15 and a


maximum value of (2^15) - 1).

• The int size varies from board to board. On the Arduino Due, for example, an
int stores a 32-bit (4-byte) value. This yields a range of -2,147,483,648 to
2,147,483,647 (minimum value of -2^31 and a maximum value of (2^31) - 1).

• e.g.
Data Types
Unsigned int

• Unsigned int (unsigned integers) are the same as int in the way that they store a
2 byte value.
• Instead of storing negative numbers, however, they only store positive values,
yielding a useful range of 0 to 65,535 (2^16) - 1).

• The Due stores a 4 byte (32-bit) value, ranging from 0 to 4,294,967,295 (2^32
- 1).

• e.g.
Data Types
Word

• On the Uno and other ATMEGA based boards, a word stores a 16-bit
unsigned number. WORD is an unsigned 16-bit value (0 to +65535
range).

• On the Due and Zero, it stores a 32-bit unsigned number.

• e.g.
Data Types
Long

• Long variables are extended size variables for number storage, and
store 32 bits (4 bytes), from -2,147,483,648 to 2,147,483,647.

• e.g.
Data Types
unsigned long

• Unsigned long variables are extended size variables for number


storage and store 32 bits (4 bytes).

• Unlike standard longs, unsigned longs will not store negative


numbers, making their range from 0 to 4,294,967,295 (2^32 - 1).

• e.g.
Data Types
short

• A short is a 16-bit data-type.

• On all Arduinos (ATMega and ARM based), a short stores a 16-bit (2-
byte) value.

• This yields a range of -32,768 to 32,767 (minimum value of -2^15


and a maximum value of (2^15) - 1).

• e.g.
Data Types
float

• Data type for floating-point number is a number that has a decimal point.

• Floating-point numbers are often used to approximate the analog and


continuous values because they have greater resolution than integers.

• Floating-point numbers can be as large as 3.4028235E+38 and as low as -


3.4028235E+38. They are stored as 32 bits (4 bytes) of information.

• e.g.
Data Types
double

• On the Uno and other ATMEGA based boards, Double precision floating-
point number occupies four bytes.

• That is, the double implementation is exactly the same as the float, with
no gain in precision.

• On the Arduino Due, doubles have 8-byte (64 bit) precision.

• e.g.
Variables
Local Variables

• Variables that are declared inside a


function or block are local variables.

• They can be used only by the


statements that are inside that
function or block of code.

• Local variables are not known to


function outside their own. Following
is the example using local variables.
Variables
Global Variables

• Global variables are defined outside of all


the functions, usually at the top of the
program.

• The global variables will hold their value


throughout the life-time of your program.

• A global variable can be accessed by any


function. That is, a global variable is
available for use throughout your entire
program after its declaration.
Operators
 An operator is a symbol that tells the compiler to perform specific
mathematical or logical functions.

 C language is rich in built-in operators and provides the following types of


operators
• Arithmetic Operators
• Comparison Operators
• Boolean Operators
• Bitwise Operators
• Compound Operators
Arithmetic Operators
Assume variable A holds 10 and variable B holds 20 then
Comparison Operators
Assume variable A holds 10 and variable B holds 20 then
Boolean Operators
Assume variable A holds 10 and variable B holds 20 then
Bitwise Operators
Assume variable A holds 10 and variable B holds 20 then
Compound Operators
Assume variable A holds 10 and variable B holds 20 then
Control Statement
Different forms of if statement
Control Statement
if … else Statement Syntax
Control Statement
if … else if …else Statements Syntax
Control Statement
Switch Case Statement
loops
while loop Syntax
loops
do…while loop
loops
for loop
Serial Monitor
The Serial Monitor is an essential
tool when creating projects with
Arduino. It can be used as a
debugging tool, testing out
concepts or to communicate
directly with the Arduino board.

set a baud rate, which is done by


writing Serial.begin(9600); Here, the
9600 represents the baud rate, which
is the maximum bits per seconds that
can be transferred.
Serial Monitor
The Serial Monitor is an essential
tool when creating projects with
Arduino. It can be used as a
debugging tool, testing out
concepts or to communicate
directly with the Arduino board.

set a baud rate, which is done by


writing Serial.begin(9600); Here, the
9600 represents the baud rate, which
is the maximum bits per seconds that
can be transferred.
Arduino Digital I/O
pinMode(pin, mode);
Sets pin to either INPUT or OUTPUT

Eg1. pinMode(13, OUTPUT);

digitalRead(pin);
Reads HIGH or LOW from a pin

Eg3. digitalRead(2);

digitalWrite(pin, value);
Writes HIGH or LOW to a pin
Arduino Analogl I/O
analogRead(pin);
Reads between 0 and 1023 if 10 bit A/D is used

Eg3. analogRead(A3);

analogWrite(pin, value);
Writes an analog value (PWM wave) to a pin. Can be used to
light a LED at varying brightnesses or drive a motor at various
speeds. Value: the duty cycle: between 0 (always off) and 255
(always on)
Eg2. analogWrite(3, 127);
IR (Infrared) Sensor
• IR sensor is a simple electronic device which emits and detects IR radiation in
order to find out certain objects/obstacles in its range.
– Some of its features are heat and motion sensing.
• IR sensors use infrared radiation of wavelength between 0.75 to 1000µm which
falls between in-visible and microwave regions of electromagnetic spectrum.
• IR region is not visible to human eyes. Infrared spectrum is categorized into three
regions based on its wavelength i.e. Near Infrared, Mid Infrared, Far Infrared.
– Wavelength Regions of Infrared Spectrum
• Near IR – 0.75µm to 3 µm
• Mid IR – 3 µm to 6 µm
• Far IR – > 6 µm
IR (Infrared) Sensor
An Infrared Sensor works in the following sequence:
• IR source (transmitter) is used to emit radiation of required wavelength.
• This radiation reaches the object and is reflected back.
• The reflected radiation is detected by the IR receiver.

• The IR Receiver detected radiation, is then further processed based on its


intensity. Generally, IR Receiver output is small and amplifiers are used to
amplify the detected signal.
Applications:
IR (Infrared) Sensor
• Can be used for wireless communication and sensing IR remote signals
• Can be used for obstacle sensing/detection, line sensing, etc
• Item counter, Proximity sensor

Specifications:
• Operating Voltage (Volts): 3.6 - 5 (DC)
• Distance Measuring Range (CM): 2 – 30 (can be varied with on-board pot)
• Average Current Consumption (mA): 0.06
• Comes with an easy-to-use digital output
Ultrasonic Sensor
• An Ultrasonic sensor is a device that can measure the distance to an object by using sound
waves.

• It measures distance by sending out a sound wave at a specific frequency and listening for
that sound wave to bounce back.

• By recording the elapsed time between the sound wave being generated and the sound wave
bouncing back, it is possible to calculate the distance between the sonar sensor and the object.
Ultrasonic Sensor
• Since it is known that sound travels through air at about 343 m/s (1129 ft/s), you can take the
time for the sound wave to return and multiply it by 343 meters (or 1129 feet) to find the total
round-trip distance of the sound wave.

• Round-trip means that the sound wave traveled 2 times the distance to the object before it was
detected by the sensor; it includes the 'trip' from the sonar sensor to the object AND the 'trip'
from the object to the Ultrasonic sensor (after the sound wave bounced off the object).

• To find the distance to the object, simply divide the round-trip distance in half.
Ultrasonic Sensor
Working principle
The Trig pin will be used to send the signal and the Echo pin will be used to listen for returning
signal;.
(1) Using IO trigger for at least 10us high level signal, Trig -> Pin-9 (o/p) of Arduino
(2) The Module automatically sends eight 40 kHz and detect whether there is a pulse signal back.
(3) IF the signal back, through high level , time of high output duration is the time from sending
ultrasonic to returning.
DHT11 Sensor Interfacing with Arduino UNO
• DHT11 sensor measures and provides humidity and temperature values serially over
a single wire.
• It can measure relative humidity in percentage (20 to 90% RH) and temperature in
degree Celsius in the range of 0 to 50°C.
• It has 4 pins; one of which is used for data communication in serial form.
• DHT11 sensor uses resistive humidity measurement component, and temperature
measurement component.
DHT11 Specifications
• Ultra-low cost
• 3 to 5V power and I/O
• 2.5mA max current use during conversion (while requesting data)
• Good for 20-80% humidity readings with 5% accuracy
• Good for 0-50°C temperature readings ±2°C accuracy
DHT22 Specifications

• Low cost
• 3 to 5V power and I/O
• 2.5mA max current use during conversion (while requesting data)
• Good for 0-100% humidity readings with 2-5% accuracy
• Good for -40 to 125°C temperature readings ±0.5°C accuracy
Circuit connections of 3-pin sensor:
Circuit connections of 4-pin sensor:
Light Dependent Resistor (LDR)
• LDR is an acronym for Light Dependent Resistor.
• LDRs are tiny light-sensing devices also known
as photoresistors.
• An LDR is a resistor whose resistance changes
as the amount of light falling on it changes.
• The resistance of the LDR decreases with an
increase in light intensity, and vice-versa.
Light Dependent Resistor (LDR)
• Light Dependent Resistor – LM393
LDR’s resistance is very high in the
darkness, almost as high as 1MΩ but
when there is light that falls on the LDR,
the resistance falls down to a few KΩ
depending on the model.
Interface Pin :
1. VCC: +ve power supply (Operating voltage 3.3V-
5V).
2. GND: Ground.
3. D0: Digital output signal.
4. A0: Analog Output Signal.
Light Dependent Resistor (LDR)
The LDR module produces an output voltage according
to the resistance of the LDR and is made available at
Analog Output (AO) pin.
The same signal is fed to an LM393 High Precision
Comparator to digitize it and is made available at a Digital
Output (DO) pin.
The module has a built-in potentiometer for sensitivity
adjustment of the digital output (DO).
You can set a threshold by using a potentiometer; So that
when the incident light level on the LDR exceeds the
threshold value, the module will output LOW otherwise
HIGH.
Apart from this, the module has two LEDs. The Power Strong light, LED light, output low level;
LED will light up when the module is powered. The Status Weak light, LED off, output high level;
LED will light up when the digital output goes LOW. Sensitivity is adjustable.
Working of LDR
• First of all, we need to connect the LDR sensor module to a 5v power supply. Then set the
threshold voltage at the Non-Inverting input of the IC according to the present light
intensity by rotating the preset knob for setting the sensor sensitivity.

• When light intensity increase on the surface of the LDR then the resistance of the LDR
decreases. So, a Low amount of voltage from the LDR is given to the Inverting input of the
IC. Then the Comparator IC compares this voltage with the threshold voltage. In this
condition, this input voltage is less than the threshold voltage, so the sensor output goes
LOW.

• In contrast, when light intensity decrease (low/dark) on the surface of the LDR then the
resistance of the LDR increases. Then the maximum amount of voltage will be allocated
across the LDR. So, a High amount of voltage from the LDR is given to the Inverting input of
the IC. Then the Comparator IC compares this voltage with the threshold voltage. In this
condition, this input voltage is greater than the threshold voltage, so the sensor output goes
high.

MQ2 Sensor-Gas and Smoke Detection
Gas sensor is a device which detects the concentration
level of the gases present in the atmosphere.

• There are numerous types of sensors available to measure


environmental characteristics like light, noise, smoke, etc.
• One such sensor used in safety systems to detect harmful
gases is the MQ2 Gas sensor.

• If you want to make an indoor air quality monitoring


system, breath checker, or early fire detection system,
the MQ2 sensor is a suitable choice.

• The MQ2 sensor is a powerful sensor in order to measure


different types of gases like Butane, Methane, LPG,
Smoke, Alcohol, Propane, Hydrogen concentrations in
the air.
MQ2 Sensor-Gas and Smoke Detection
• In this sensor, the sensing material is a stainless steel mesh. This
mesh contains Aluminium-oxide-based ceramic, coated with tin
dioxide (SnO2).

• When reducing gases are present on the sensor, oxygen atoms try to
interact with reducing gases and reduce the absorbed surface
density of the oxygen atom. Hence current can flow through the
sensor to generate an analog output signal.

• This output signal generates the voltage values by which we will


get an idea about the concentration of gases. When the
concentration of gas is high voltage will be high.

• The digital pin will go high only when the concentration of the gas is
above the threshold value. The sensor will work in analog mode to
detect the concentration of the gas.
How to Adjust the Sensitivity of Gas Sensor
• In order to adjust the sensitivity of this sensor for the particular type of
gas, you need to keep this sensor in the particular gas type you want to
detect. Now we have to rotate the potentiometer on the sensor.

• Rotate it till the Red LED on the sensor gets ON. If we have to increase
the sensitivity, rotate it clockwise, and if we have to decrease the
sensitivity we have to rotate it anticlockwise.

• When we are rotating this potentiometer basically we are adjusting the


threshold value of the sensor. The comparator on this board is
constantly checking the threshold value.

• Once this threshold gets crossed the digital pin goes high and the LED
will turn on.
Interfacing of MQ2 Sensor with Arduino
Connect your MQ2 sensor with the Arduino as
shown in the above diagram.

• Connect the VCC pin of the sensor to the 5V of


the Arduino.
• Connect the GND of the sensor to the GND of
the Arduino.
• Connect the digital pin of the sensor D0 to the
digital pin number 8 of the Arduino
• Connect the analog pin of the sensor to the
analog pin A0 of the Arduino.
Servo motor
Standard servo motors are actuators that allow for
precise control of position (angle).

A typical characteristic is that the angle of the motor is


0 - 180 degrees.

With other words, it can make one half of a rotation.


Servo motor
A standard servo motor, just as other motors,
are essentially just a DC motor, but with some
extra features:
• Control circuit for controlling the motor,
e.g. setting the angle.
• Gears that transform speed into torque,
which makes it capable of doing "heavy
lifting" at a slower speed, as opposed to a
regular DC motor that just spins very fast!
• Potentiometer that keeps track of its
angle. This makes it possible for the servo to
"know where it is".
Servo motor
Almost all servos come with a set of 3 wires. These are

PWR, GND and Signal. For a very simple circuit, all that is

needed is to connect each of these two pins on the Arduino:

PWR (RED) - connects to 5V on the Arduino.

GND (BLACK) - connects to GND on the Arduino.

Signal (WHITE) - connects to a digital pin on the Arduino .


Interfacing Servo motor
Almost all servos come with a set of 3 wires. These

are PWR, GND and Signal. For a very simple circuit,

all that is needed is to connect each of these two pins

on the Arduino:

PWR (RED) - connects to 5V on the Arduino.

GND (BLACK) - connects to GND on the Arduino.

Signal (WHITE) - connects to a digital pin on the


DC Motor
• A DC motor (Direct Current motor) is the most
common type of motor.
• DC motors normally have just two leads, one
positive and one negative.
• If you connect these two leads directly to a battery,
the motor will rotate.
• If you switch the leads, the motor will rotate in the
opposite direction.
Interfacing DC Motor
Warning − Do not drive the motor directly from Arduino board pins. This may damage
the board. Use a driver Circuit or an IC.

Components Required

1x Arduino UNO board


1x PN2222 Transistor
1x Small 6V DC Motor
1x 1N4001 diode
1x 270 Ω Resistor
LCD
• LCD stands for Liquid Crystal Display. LCD is a
flat-paneled display.
• It uses liquid crystals combined with polarized
material to display the content.
• LCD uses the light modulation property of LCD. LCD
is available both in Monochrome and Multicolor.
• It cannot emit light directly without a backlight. In
some LCDs, It displays the content only with the
help of a backlight in a dark place.
LCD Pin Diagram
I2C communication
• I2C or IIC stands for Inter-Integrated Communication.
• I2C is a serial communication interface to communicate with
other I2C devices.
• I2C uses multi-master / multi slave method. I2C uses 2 lines
named SCL and SDA for transmission/reception and another 2
lines for power supply and ground.
• Each and every I2C device has I2C address to identify. I2C
addresses of multiple devices may have the same address.
• The address is in the format of “0x20” (Example address).
• The serial Clock (SCL) pin is to synchronize the transmitter
and receiver.
• Serial Data (SDA) pin is to transfer data.
I2C LCD Interfacing
I2C LCD:

• I2C LCD uses I2C communication interface to transfer the information required to display the
content.

• I2C LCD requires only 2 lines (SDA and SCL) for transferring the data. So, the complexity of the
circuit is reduced.

Interfacing I2C LCD to the Arduino:

• I2C LCD can be connected to the Arduino directly with SDA pin to SDA pin and SCL pin to SCL
pin as per the below circuit diagram.

• I2C LCD requires additional library to be installed (install the “LiquidCrystal I2C” library
in the Arduino IDE).
Case Studies of Smart Home
Verisure
Background
Verisure is Europe’s leading provider of professionally
monitored alarms and connected services for homes and
small businesses. The company serves millions of
customers in numerous countries, and is fast expanding
and growing.

Results
For Verisure, the IoT solution has enabled them to expand
its business into adjacent areas of expertise, stretch the
brand to become a trustworthy provider of not only home
alarms but to smart homes.
Case Studies of Smart Cities
Anticimex
Background
Pest control has traditionally relied on traps filled with
toxins to exterminate pests. Anticimex developed an
intelligent system of connected traps.

Results
For Anticimex, connecting its traps has created benefits
for end users, businesses and the environment.
Case Studies of Smart Cities
Kamstrup
Background
Kamstrup A/S is a leading solution provider within smart
metering. The company develops and sells monitoring
meters for water, district heating, and electricity globally.

Results
Kamstrup provided with ongoing real-time diagnostics and
can supervise its meters remotely.
Case Studies of Smart HealthCare
8 West
Background
8 West Consulting is an enterprise software development
company based in Ireland that has created one of the
world’s leading maritime search and rescue applications,
SafeTrx. SafeTrx is a remote monitoring and alerting
system that provides automatic real-time alerting for
sports enthusiasts, isolated or at-risk workers and
vulnerable older people. The device enables location
alerts to be sent, and requests for emergency help or
assistance to be communicated, so everyone from surfers
to lone workers and people in a healthcare setting can be
tracked and monitored
Results
SafeTrx incorporates wind, weather and wave alerts, and
is in active use by surfers across Europe.
Case Studies of Smart Wearable Devices
Amber
Background
Amber’s COVID-19 Pandemic Management Solution is a
comprehensive, interactive website and mobile application
(JamCovid19 App) for Android and iOS that can be paired
with a wearable GPS tracker wristband.

Results
The solution enables governments to centrally develop,
manage and disseminate crucial information related to the
COVID-19 pandemic and includes provisions to efficiently
enable travel authorization, airport screening,
tracking/tracing management and support quarantine
measures.

You might also like