UNIT III
IOT AND ARDUINO PROGRAMMING
Introduction to the Concept of IoT Devices – IoT Devices Versus
Computers – IoT Configurations – Basic Components – Introduction to
Arduino – Types of Arduino– Arduino Toolchain – Arduino Programming
Structure – Sketches – Pins – Input/Output From Pins Using Sketches –
Introduction to Arduino Shields – Integration of Sensors and Actuators
with Arduino.
Introduction to the Concept of IoT Devices
• IoT is a system of interrelated things, computing devices, mechanical and
digital machines, objects, animals, or people that are provided with
unique identifiers.
• The ability to transfer the data over a network requiring human-to human
IOT is a system of interrelated things, computing devices, mechanical and
digital machines, objects, animals, or people that are provided with
unique identifiers.
Four Key Components of IOT
• Device or sensor
• Connectivity
• Data processing
• Interface
IoT Devices Versus Computers
• Internet of Things (IoT): The Internet of Things (IoT) is the network of
physical objects/devices like vehicles, buildings, cars, and other items
embedded with electronics, software, sensors, and network connectivity
that enables these objects to collect and exchange data. IoT devices have
made human life easier. The IoT devices like smart homes, smart cars have
made the life of humans very comfortable. IoT devices are now being a
part of our day-to-day life.
• Computers: A computer is a hardware device embedded with software in
it. The computer does most of the work like calculations, gaming, web
browsers, word processors, e-mails, etc. The main function of a computer
is to compute the functions, to run the programs. It takes input from the
computer and then computes/processes it and generates the output.
Overview of IoT Vs Computers:
• One big difference between IoT devices and computers is that the
main function of IoT devices is not to compute(not to be a computer)
and the main function of a computer is to compute functions and to
run programs.
• But on IoT devices that is not its main point, it has some other
function besides that. As an example like in cars, the function of IoT
devices are not to compute anti-lock breaking or to do fuel injection,
their main function from the point of view of a user is to be driven
and to move you from place to place and the computer is just to help
that function
• when the software is embedded in it , then the software can be able
for fuel limit detection.
IoT Devices Versus Computers
Main Components of IoT
• Low-power embedded systems: Less battery consumption, high
performance are the inverse factors that play a significant role during
the design of electronic systems.
• Sensors: Sensors are the major part of any IoT application. It is a
physical device that measures and detects certain physical quantities
and converts it into signal which can be provided as an input to
processing or control unit for analysis purpose.
IoT Configurations:
• Configure Device This helps to ensure your devices behave as intended
within your IoT environment. It is needed to connect the sensors in need
of calibrating and networking. If it is more than one, need to account for
that with group configurations.
• Diagnose Device Running routine diagnostics on your IoT devices can
help detect potential problems before they happen and cause downtime.
Usually, devices come with diagnostic software from the manufacturer. The
manufacturer has guidelines tell how often it should be run the
diagnostics.
IoT Configurations:
Apply Maintenance For optimal performance, maintaining your devices is
key. The diagnostic software will give insights into what you might need to
update, replace, or fix. To avoid breakdowns causing downtime. Devices
have a lifetime, need to enhance features, update firmware, etc. every now
and then. The device manufacturer will also have suggestions on regular
maintenance intervals.
Ensure Proper Authentication need to enable trust within your IoT
environment. To make configuration changes, need an admin with the
proper credentials. To protect device access with the proper authentication
measures.
.Monitor IoT device and provide real-time data. It’s crucial then for the
proper monitoring software in place. That way you can follow all the
important data points. Monitoring also helps you detect breaches, prevent
failures, and fix problems cause any harm
IoT Basic components:
• There are the following components used in IoT:
• Devices and sensors • Cloud Computing • User interface •
Networking connection • Gateway
Devices and sensors
• Devices and sensors are the components of the connectivity layer.
These smart sensors continuously collect data from the environment
and transmit it to the next layer. For example, our phone is a device
with multiple sensors such as GPS, camera, motion, etc.
• The latest techniques in semiconductor technology enable intelligent
micro-sensors to be produced for various applications.
• There are some common sensors are as follows: • Temperature and
thermostats sensors • Pressure sensors • Humidity / Moisture level •
Light intensity detectors • Moisture sensors • Proximity detection
Cloud Computing
• IoT systems send huge data from devices, and these data must be
managed efficiently to generate meaningful results. IoT technology
uses the cloud to store a large amount of data. It provides tools for
collecting, processing, and storing data.
• The data is easily available and accessible remotely through the
internet. It also provides a platform for analysis.
• The IoT cloud is an advanced network of high-performance servers for
high-speed processing of large amounts of data.
User interface
• User interfaces are the physical and visible part of the IoT system
accessible to users. User interface design is more important in today's
competitive market, as it often allows the user to choose a particular
device or appliance. Users will be interested in buying new smart
devices if it is effortless to use and compatible with current wireless
standards.
• Modern technology offers a lot of interactive design to facilitate
complex tasks in simple touch screen controls. Multi-colored touch
screens have replaced the hardware switches on our devices, and the
trend is on the rise for almost all smart home devices.
Networking connection
• Internet connectivity is required for communication. Internet
connectivity provides an IP address to each device.
• Although fewer addresses are depending on the IP address. But this
IP address is no longer sufficient due to a large number of uses in
devices.
• As a result, researchers find an alternative to the IP address system to
represent each physical device.
Gateway
• IoT Gateway manages bi-directional data traffic between different
networks and protocols. Another function of the gateway is to
translate different network protocols and to ensure the
interoperability of connected devices and sensors.
• The IoT gateway provides a certain level of security for the network
and data transmitted with higher-order encryption techniques. It acts
as a middle layer between the devices and the cloud that protects the
system from malicious attacks and unauthorized access.
• Gateways can be configured to pre-process collected data locally
from thousands of sensors before forwarding them to the next step.
• In some cases, is necessary with compatibility of the TCP / IP protocol.
Working of IoT
Characteristics of IoT
• Massively scalable and efficient
• IP-based addressing will no longer be suitable in the upcoming future.
• An abundance of physical objects is present that do not use IP, so IoT is
made possible.
• Devices typically consume less power. When not in use, they should be
automatically programmed to sleep.
• A device that is connected to another device right now may not be
connected in another instant of time.
• Intermittent connectivity – IoT devices aren’t always connected. In order
to save bandwidth and battery consumption, devices will be powered off
periodically when not in use. Otherwise, connections might turn unreliable
and thus prove to be inefficient.
Working with IoT Devices
• Collect and Transmit Data : For this purpose sensors are widely used
they are used as per requirements in different application areas.
• Actuate device based on triggers produced by sensors or processing
devices: If certain conditions are satisfied or according to user’s
requirements if certain trigger is activated then which action to
perform that is shown by Actuator devices.
• Receive Information: From network devices, users or devices can take
certain information also for their analysis and processing purposes.
• Communication Assistance: Communication assistance is the
phenomenon of communication between 2 networks or
communication between 2 or more IoT devices of same or different
networks. This can be achieved by different communication protocols
like: MQTT, Constrained Application Protocol, ZigBee, FTP, HTTP etc.
Desired Quality of any IoT Application
• Interconnectivity It is the basic first requirement in any IoT infrastructure.
Connectivity should be guaranteed from any devices on any network then
only devices in a network can communicate with each other.
• Heterogeneity There can be diversity in IoT enabled devices like different
hardware and software configuration or different network topologies or
connections, but they should connect and interact with each other despite
so much heterogeneity.
• Dynamic in Nature IoT devices should dynamically adapt themselves to the
changing surroundings like different situations and different prefaces.
• Self-adapting and self configuring technology For example, surveillance
camera. It should be flexible to work in different weather conditions and
different light situations (morning, afternoon, or night).
Desired Quality of any IoT Application
• Intelligence Just data collection is not enough in IoT, extraction of knowledge from the
generated data is very important. For example, sensors generate data, but that data will
only be useful if it is interpreted properly. So intelligence is one of the key characteristics
in IoT. Because data interpretation is the major part in any IoT application because
without data processing we can’t make any insights from data. Hence, big data is also
one of the most enabling technologies in IoT field.
• Scalability The number of elements (devices) connected to IoT zones is increasing day by
day. Therefore, an IoT setup should be capable of handling the expansion. It can be
either expand capability in terms of processing power, storage, etc. as vertical scaling or
horizontal scaling by multiplying with easy cloning.
• Identity Each IoT device has a unique identity (e.g., an IP address). This identity is helpful
in communication, tracking and to know status of the things. If there is no identification
then it will directly affect security and safety of any system because without
discrimination we can’t identify with whom one network is connected or with whom we
have to communicate. So there should be clear and appropriate discrimination
technology available between IoT networks and devices.
Desired Quality of any IoT Application
• Safety Sensitive personal details of a user might be compromised
when the devices are connected to the Internet. So data security is a
major challenge. This could cause a loss to the user. Equipment in the
huge IoT network may also be at risk. Therefore, equipment safety is
also critical.
• Architecture It should be hybrid, supporting different manufacturer’s
products to function in the IoT network. As a quick note, IoT
incorporates trillions of sensors, billions of smart systems, and
millions of applications.
Advantages of IoT
• Improved efficiency and automation of tasks.
• Increased convenience and accessibility of information.
• Better monitoring and control of devices and systems.
• Greater ability to gather and analyze data. Improved decision-
making.
• Cost savings.
Disadvantages of IoT
• Security concerns and potential for hacking or data breaches.
• Privacy issues related to the collection and use of personal data.
Dependence on technology and potential for system failures.
• Limited standardization and interoperability among devices.
• Complexity and increased maintenance requirements.
• High initial investment costs.
• Limited battery life on some devices. Concerns about job
displacement due to automation.
• Limited regulation and legal framework for IoT, which can lead to
confusion and uncertainty
Introduction to Arduino
• Arduino is a open-source hardware, and software platform used to
design and build electronic devices. It designs and manufactures
microcontroller kits and single-board interfaces for building
electronics projects.
• The designs of Arduino boards use a variety of controllers and
microprocessors. The Arduino board consists of sets of analog and
digital I/O (Input / Output) pins, which are further interfaced to
breadboard, expansion boards, and other circuits.
• Arduino boards feature the model, Universal Serial Bus (USB), and
serial communication interfaces, which are used for loading programs
from the computers.
Introduction to Arduino
• It also provides an IDE (Integrated Development Environment)
project, which is based on the Processing Language to upload the
code to the physical board.
• The projects are authorized under the GPL and LGPL. The GPL is
named as GNU General Public License. The licensed LGPL is named as
GNU Lesser General Public License. It allows the use of Arduino
boards
Introduction to Arduino
• The Arduino IDE is used to control the functions of boards. It further
sends the set of specifications to the microcontroller.
• Arduino does not need an extra board or piece to load new code.
• Arduino can read analog and digital input signals.
• The hardware and software platform is easy to use and implement.
Arduino Uno Board
1. USB: can be used for both power and communication with the IDE
2. Barrel Jack: used for power supply
3. Voltage Regulator: regulates and stabilizes the input and output
voltages
4. Crystal Oscillator: keeps track of time and regulates processor
frequency
5. Reset Pin: can be used to reset the Arduino Uno
6. 3.3V pin: can be used as a 3.3V output
7. 5V pin: can be used as a 5V output
8. GND pin: can be used to ground the circuit
9. Vin pin: can be used to supply power to the board
10. Analog pins(A0-A5): can be used to read analog signals to the board
Arduino Uno Board
11. Microcontroller(ATMega328): the processing and logical unit of the board
12. ICSP pin: a programming header on the board also called SPI
13. Power indicator LED: indicates the power status of the board
14. RX and TX LEDs: receive(RX) and transmit(TX) LEDs, blink when sending
or receiving serial data respectively
15. Digital I/O pins: 14 pins capable of reading and outputting digital signals;
6 of these pins are also capable of PWM
16. AREF pins: can be used to set an external reference voltage as the upper
limit for the analog pins 17. Reset button: can be used to reset the board
The Arduino IDE
• . The Arduino IDE is the best in programming Arduino Uno.
• Arduino IDE can be installed on PC
Types of Arduino Boards
• Arduino board is an open-source platform used to make electronics
projects.
• It consists of both a microcontroller and a part of the software or
Integrated Development Environment (IDE) that runs on PC, used to
write & upload computer code to the physical board.
• The platform of an Arduino has become very famous with designers
with electronics, and for an excellent cause.
Types of Arduino Boards
• Arduino Uno (R3)
• Arduino Nano
• Arduino Micro
• Arduino Due
• LilyPad Arduino Board
• Arduino Bluetooth
• Arduino Diecimila
• RedBoard Arduino Board
• Arduino Mega (R3) Board
• Arduino Leonardo Board
• Arduino Robot
• Arduino Esplora
• Arduino Pro Mic
• Arduino Ethernet
Features of Different Types of Arduino Boards
Arduino Toolchain
• A toolchain is a set of programming tools that is used to perform a
complex set of operations.
• In the Arduino Software (IDE) the toolchain is hidden from the user,
but it is used to compile and upload the user Sketch.
• It includes compiler, assembler, linker and Standard C & math
libraries
Arduino Toolchain
Arduino Toolchain
• Sketch code press upload button.
• The Arduino toolchain is run to perform the uploading of the code
• Arduino sketches held the file in .ino extension in a folder with same
name.
• Arduino IDE starts to perform the following tasks
• Arduino IDE preprocessor assembles the files on the sketch. 1 file is
found in the folder.
• As there are many boards with different pins layout, there is a folder
/hardware/arduino/variant folder that kept all other type of Arduino
pin setup.
• Combining all the files, GCC compiler (which is open source C++
compiler) bundled part of Arduino distribution.
Arduino Toolchain
• Preprocessor interprets all the #if and #define commands and determines what
actually goes into the build.
• Next, the code is compiled and linked into a single executable file for type of
processor used by board.
• After compiler finished, another piece open source called AVRDude actually
sends the executable code saved as hexadecimal binary to the board over USB
serial interface.
• There is a program called bootloader on Arduino board runs every briefly when
Arduino is reset.
• When serial communication starts, the hardware serial link forces a reset to give
the bootloader chance to check for any incoming sketches.
• If sketch exist, Arduino programs will unpack the hexadecimal into binary.
• It stores the sketch in the flash memory.
Arduino Programming Structure
• The Arduino software is open-source. The source code for the Java
environment is released under the GPL and the C/C++ microcontroller
libraries are under the LGPL.
Sketch
• The first new terminology is the Arduino program called “sketch”.
• Structure Arduino programs can be divided in three main parts: Structure,
Values (variables and constants), and Functions.
Software structure consist of two main functions
• Setup( ) function
• Loop( ) function
Arduino Programming Structure
Arduino Programming Structure
Void setup ( )
{}
PURPOSE
The setup() function is called when a sketch starts.
Use it to initialize the variables, pin modes, start using libraries, etc. The setup function
will only run once, after each power up or reset of the Arduino board.
• INPUT − - • OUTPUT − - • RETURN − -
Void Loop ( )
{}
• PURPOSE − After creating a setup() function, which initializes and sets the initial values,
the loop() function does precisely what its name suggests, and loops consecutively,
allowing your program to change and respond.
Use it to actively control the Arduino board. • INPUT − - • OUTPUT − - • RETURN − -
Sketches:
• Start the Arduino IDE application. Open the Blink example sketch:
Select File → Examples → 01.Basics → Blink on the top Arduino IDE
menu.
The Blink sketch
• The Blink sketch contains a big comment block at the top. Scroll down to find the
code that blinks the on-board LED.
• Comments are shown in a gray color between the /* and */ characters.
• Text typed between an opening forward slash and asterisk /* and closing asterisk
forward slash */ is ignored by the software tools that run when the sketch is
uploaded to an Arduino board.
• Place any comments or notes that you want between these characters.
• This type of comment can span multiple lines. The sketch name and description
are contained in the top comment block of the Blink sketch.
• A second type of comment starts with double forward slashes //. In this case,
everything after the // is part of the comment.
• This is a single-line comment that turns everything after the // on the same line
into a comment.
Arduino Blink Sketch Code
• When a sketch is loaded to an Arduino board, it is first built by
software tools that automatically run.
• The build process consists of preprocess, compile and link stages. This
converts the code from human readable text to something that runs
on the Arduino board.
Arduino Blink Sketch Code
Arduino Sketch Syntax Highlighting
• Arduino Sketch Syntax Highlighting Colored words in the sketch are a result
of the Arduino IDE using syntax highlighting.
• Syntax highlighting is the highlighting of Arduino language keywords,
definitions and functions.
• Modify the Arduino Blink Sketch Change the rate that the on-board LED
blinks at in the Blink sketch, as follows.
• Change 1000 to 200 in both instances it is found in the code.
• The following image shows the modified Arduino Blink sketch. Red dots in
the image mark the modified lines of code.
• Notice that the comments at the right of each modified line of code are
updated to reflect the changes made in the code.
Modified Blink Sketch Code
Modified Blink Sketch Code
• Modified Blink Sketch Code Click the Upload button in the Arduino
IDE. This uploads the modified sketch to the target Arduino board.
Notice that the on-board L LED blinks faster.
• As a result of the modified code, the LED is now on for 0.2 seconds
and off for 0.2 seconds. The on and off times were originally 1000
milliseconds, also written 1000ms, which is one second (1s). This is
because there are 1000ms in 1s.
• When 1000 is changed to 200 in the sketch, the LED on and off times
change from 1000ms to 200ms. 200ms is 0.2s
Save the Modified Sketch
• When an example sketch is modified and saved, it must be saved to a new
location.
• Three ways of saving a sketch in the Arduino IDE are firstly, click the Save
toolbar icon (the arrow pointing down).
• Mover the mouse cursor over any toolbar icon and its name is shown at
the right of the icons.
• Secondly, save the file using the keyboard shortcut Ctrl + S (hold down the
Ctrl key and then press the s key).
• Thirdly, select File → Save on the top Arduino IDE menu bar. Because the
file is read-only, the IDE prompts to save the file to a different location. •
• Use the dialog box that opens to save the Blink sketch to your Arduino
folder. Change the name to something like Blink Fast before for saving.
Arduino Pins:
ATmega328P Vs Atmega168P
Digital pins
• Digital pins on an Arduino board can be used for general purpose
input and output via the pinMode(), digitalRead(), and digitalWrite()
commands.
• Each pin has an internal pull-up resistor which can be turned on and
off using digitalWrite() (w/ a value of HIGH or LOW, respectively)
when the pin is configured as an input.
• The maximum current per pin is 40 mA.
Serial Pins
• Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL
serial data.
• On the Arduino Diecimila, these pins are connected to the
corresponding pins of the FTDI USB-to-TTL Serial chip. On the Arduino
BT, they are connected to the corresponding pins of the WT11
Bluetooth® module.
• On the Arduino Mini and LilyPad Arduino, they are intended for use
with an external TTL serial module (e.g. the Mini-USB Adapter).
Interrupt pins
• External Interrupts: 2 and 3. These pins can be configured to trigger
an interrupt on a low value, a rising or falling edge, or a change in
value.
PWM,RESET ,SPI, LED –Digital Pins
• PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the
analogWrite() function. On boards with an ATmega8, PWM output is
available only on pins 9, 10, and 11.
• BT Reset: 7. (Arduino BT-only) Connected to the reset line of the
Bluetooth® module.
• SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI
communication, which, although provided by the underlying hardware, is
not currently included in the Arduino language.
• LED: 13. On the Diecimila and LilyPad, there is a built-in LED connected to
digital pin 13. When the pin is HIGH value, the LED is on, when the pin is
LOW, it's off.
Analog Pins
• the analog input pins support 10-bit analog to-digital conversion
(ADC) using the analogRead() function.
• Most of the analog inputs can also be used as digital pins:
• analog input 0 as digital pin 14 through analog input 5 as digital pin
19.
• Analog inputs 6 and 7 (present on the Mini and BT) cannot be used as
digital pins.
• • I2C: 4 (SDA) and 5 (SCL). Support I2C (TWI) communication
Power Pins
• VIN (sometimes labelled "9V"). The input voltage to the Arduino board
when it's using an external power source (as opposed to 5 volts from the
USB connection or other regulated power source).
• Supply voltage through this pin, or, if supplying voltage via the power jack,
access it through this pin. Note that different boards accept different input
voltages ranges,
• Also note that the LilyPad has no VIN pin and accepts only a regulated
input.
• 5V. The regulated power supply used to power the microcontroller and
other components on the board. This can come either from VIN via an on-
board regulator, or be supplied by USB or another regulated 5V supply.
• 3.3.V (Diecimila-only) A 3.3 volt supply generated by the on-board FTDI
chip.
• GND. Ground pins.
Other Pins
•AREF. Reference voltage for the analog inputs. Used with
analogReference().
•Reset. (Diecimila-only) Bring this line LOW to reset the
microcontroller.
Typically used to add a reset button to shields which block the one on
the board.
Input/Output From Pins Using Sketches:
pinMode(), digitalWrite(), and delay()
pinMode()
• The pinMode() function configures a pin as either an input or an output.
• To use it, you pass it the number of the pin to configure and the constant
INPUT or OUTPUT.
• When configured as an input, a pin can detect the state of a sensor like a
pushbutton; As an output, it can drive an actuator like an LED.
digitalWrite(),
• The digitalWrite() functions outputs a value on a pin.
• For example, the line:
digitalWrite(ledPin, HIGH);
• set the ledPin (pin 13) to HIGH, or 5 volts.
• Writing a LOW to pin connects it to ground, or 0 volts()
delay()
• The delay() causes the Arduino to wait for the specified number of
milliseconds before continuing on to the next line.
• There are 1000 milliseconds in a second, so the line: delay(1000);
creates a delay of one second
Arduino Shields
• Arduino shields are the boards, which are plugged over the Arduino
board to expand its functionalities.
• There are different varieties of shields used for various tasks, such as
Arduino motor shields, Arduino communication shields, etc.
• Shield is defined as the hardware device that can be mounted over
the board to increase the capabilities of the projects.
• It also makes our work easy.
• For example, Ethernet shields are used to connect the Arduino board
to the Internet.
• The pin position of the shields is similar to the Arduino boards. We
can also connect the modules and sensors to the shields with the help
of the connection cable.
• Arduino motor shields help us to control the motors with the Arduino
board
• The advantages of using Arduino shields are listed below:
• It adds new functionalities to the Arduino projects.
• The shields can be attached and detached easily from the Arduino
board. It does not require any complex wiring.
• It is easy to connect the shields by mounting them over the Arduino
board.
• The hardware components on the shields can be easily implemented.
The popular Arduino shields
• Ethernet shield
• Xbee Shield
• Proto shield
• Relay shield
• Motor shield
• LCD shield
• Bluetooth shield
• Capacitive Touchpad Shield
Ethernet shield
• The Ethernet shields are used to connect the Arduino board to the
Internet.
• The USB port will play the usual role to upload sketches on the
board.
• The latest version of Ethernet shields consists of a micro SD card slot.
• The micro SD card slot can be interfaced with the help of the SD card
library.
Xbee Shield
• We can communicate wirelessly with the Arduino board by using the
Xbee Shield with Zigbee.
• It reduces the hassle of the cable, which makes Xbee a wireless
communication model.
• The Xbee wireless module allows us to communicate outdoor upto
300 feet and indoor upto 100 feet.
•
Proto shield
• Proto shields are designed for custom circuits.
• We can solder electronic circuits directly on the shield.
• The shield consists of two LED pads, two power lines, and SPI signal
pads.
• The IOREF (Input Output voltage Reference) and GND (Ground) are
the two power lines on the board.
• We can also solder the SMD (Surface Mount Device) ICs on the
prototyping area. A maximum of 24 pins can be integrated onto the
SMD area.
Relay shield
• The Arduino digital I/O pins cannot bear the high current due to its
voltage and current limits.
• The relay shield is used to overcome such situation.
• It provides a solution for controlling the devices carrying high current
and voltage.
• The shield consists of four relays and four LED indicators. o It also
provides NO/NC interfaces and a shield form factor for the simple
connection to the Arduino board.
• The LED indicators depicts the ON/OFF condition of each relay. o The
relay used in the structure is of high quality.
Relay shield
• The NO (Normally Open), NC (Normally Closed), and COM pins are
present on each relay.
• The relay shield is shown below:
• The applications of the Relay shield include remote control, etc.
•
Motor shield
The motor shield helps us to control the motor using the Arduino
board. The applications of the motor shield are intelligent vehicles,
micro-robots, etc.
It controls the direction and working speed of the motor. We can
power the motor shield either by the external power supply through
the input terminal or directly by the Arduino.
We can also measure the absorption current of each motor with the
help of the motor shield.
The motor shield is based on the L298 chip that can drive a step
motor or two DC motors. L298 chip is a full bridge IC.
It also consists of the heat sinker, which increases the performance of
the motor shield.
It can drive inductive loads, such as solenoids, etc.
The operating voltage is from 5V to 12V
LCD shield
• LCD shield o The keypad of LCD (Liquid Crystal Display) shield includes five
buttons called as up, down, left, right, and select.
• There are 6 push buttons present on the shield that can be used as a
custom menu control panel.
• It consists of the 1602 white characters, which are displayed on the blue
backlight LCD.
• The LED present on the board indicates the power ON.
• The five keys present on the board helps us to make the selection on
menus and from board to our project. The LCD shield is popularly
designed for the classic boards such as Duemilanove, UNO, etc.
Bluetooth shield
• The Bluetooth shield can be used as a wireless module for transparent
serial communication.
• It includes a serial Bluetooth module. D0 and D1 are the serial hardware
ports in the Bluetooth shield, which can be used to communicate with the
two serial ports (from D0 to D7) of the Arduino board.
• The communication distance of the Bluetooth shield is upto 10m at home
without any obstacle in between.
• We can install Groves through the two serial ports of the Bluetooth shield
called a Grove connector. One Grove connector is digital, while the other
is analog. The Bluetooth shield is shown below:
Capacitive Touchpad shield
• It has a touchpad interface that allows to integrate the Arduino board
with the touch shield.
• The Capacitive touchpad shield consists of 12 sensitive touch
buttons, which includes 3 electrode connections and 9 capacitive
touch pads.
• The capacitive shield is shown below:
• The board can work with the logic level of 3.3V or 5V.
• We can establish a connection to the Arduino project by touching the
shield
Integration of Sensors and Actuators with Arduino
Sensors
• Basic electronic Device • Convert a physical quantity/ measurements
into electrical signals • Can be analog or digital Types of Sensors
Some commonly used sensors :
• Temperature • Humidity • Compass • Light • Sound •Accelerometer
• Sensor Interface with Arduino:
• Digital Humidity and Temperature Sensor (DHT) PIN 1,2,3,4 (from left to
right)
• PIN 1-3.3V-5V Power supply
• PIN 2- Data • PIN 3-Null • PIN 4- Ground
DHT Sensor Library
• Arduino supports a special library for the DHT11 and DHT22 sensors •
Provides function to read the temperature and humidity values from
the data pin
• dht.readHumidity()
• dht.readTemperature()
Arduino and DHT22 Connection
• Connect pin 1 of the DHT to the 3.3 V supply pin in the board
• Data pin (pin 2) can be connected to any digital pin, here 12 •
Connect pin 4 to the ground (GND) pin of the board
Sketch: DHT22 Sensor
• DHT_Sensor Install the DHT Sensor Library • Go to sketch -> Include
Library -> Manage Library
• Search for DHT Sensor • Select the "DHT sensor library" and install it
• Connect the board to the PC
• Set the port and board type
• Verify and upload the code
The readings are printed at a delay of 2 seconds as specified by the
delay() function
Sketch: Integration of DHT22 Sensor
Integration of DHT22 Sensor- Output