0% found this document useful (0 votes)
8 views48 pages

Iot 2

The document discusses various IoT communication models and protocols, including Request-Response, Publisher-Subscriber, and Push-Pull models, along with specific protocols like Bluetooth, ZigBee, and LoRaWAN. It also covers the architecture and programming aspects of IoT devices, detailing how to interface with hardware components like GPIO pins and connect to cloud services. Additionally, it presents a practical IoT project using Arduino and Bluetooth to control an LED through an Android app.

Uploaded by

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

Iot 2

The document discusses various IoT communication models and protocols, including Request-Response, Publisher-Subscriber, and Push-Pull models, along with specific protocols like Bluetooth, ZigBee, and LoRaWAN. It also covers the architecture and programming aspects of IoT devices, detailing how to interface with hardware components like GPIO pins and connect to cloud services. Additionally, it presents a practical IoT project using Arduino and Bluetooth to control an LED through an Android app.

Uploaded by

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

UNIT-2

IoT Communication Models and APIs – IoT Communication Protocols – Bluetooth – WiFi –
ZigBee– GPS – GSM modules – Open Platform (like Raspberry Pi) – Architecture
–Programming – Interfacing – Accessing GPIO Pins – Sending and Receiving Signals Using
GPIO Pins – Connecting to the Cloud

IoT Communication Models and APIs

IoT devices are found everywhere and will enable circulatory intelligence in the
future. For operational perception, it is important and useful to understand how
various IoT devices communicate with each other. Communication models used in
IoT have great value. The IoTs allow people and things to be connected any time,
any space, with anything and anyone, using any network and any service.

Types of Communication Model :

1. Request & Response Model –


This model follows a client-server architecture.
 The client, when required, requests the information from the server. This request
is usually in the encoded format.
 This model is stateless since the data between the requests is not retained and
each request is independently handled.
 The server Categories the request, and fetches the data from the database and its
resource representation. This data is converted to response and is transferred in
an encoded format to the client. The client, in turn, receives the response.
 On the other hand — In Request-Response communication model client sends a
request to the server and the server responds to the request. When the server
receives the request it decides how to respond, fetches the data retrieves
resources, and prepares the response, and sends it to the client.
2. Publisher-Subscriber Model –

This model comprises three entities: Publishers, Brokers, and Consumers.


 Publishers are the source of data. It sends the data to the topic which are
managed by the broker. They are not aware of consumers.
 Consumers subscribe to the topics which are managed by the broker.
 Hence, Brokers responsibility is to accept data from publishers and send it to the
appropriate consumers. The broker only has the information regarding the
consumer to which a particular topic belongs to which the publisher is unaware
of.

3. Push-Pull Model –
The push-pull model constitutes data publishers, data consumers, and data queues.
 Publishers and Consumers are not aware of each other.
 Publishers publish the message/data and push it into the queue. The consumers,
present on the other side, pull the data out of the queue. Thus, the queue acts as
the buffer for the message when the difference occurs in the rate of push or pull
of data on the side of a publisher and consumer.
 Queues help in decoupling the messaging between the producer and consumer.
Queues also act as a buffer which helps in situations where there is a mismatch
between the rate at which the producers push the data and consumers pull the
data.

4. Exclusive Pair –
 Exclusive Pair is the bi-directional model, including full-duplex communication

among client and server. The connection is constant and remains open till the
client sends a request to close the connection.
 The Server has the record of all the connections which has been opened.
 This is a state-full connection model and the server is aware of all open
connections.
 WebSocket based communication API is fully based on this model.
IoT Data Link Communication Protocol
The IoT Data Link communication protocol provides service to the Network Layer. There are
various protocols and standard technologies specified by the different organization for data link
protocols.

Bluetooth
Bluetooth is a short-range wireless communication network over a radio frequency. Bluetooth is
mostly integrated into smartphones and mobile devices. The Bluetooth communication network
works within 2.4 ISM band frequencies with data rate up to 3Mbps.

There are three categories of Bluetooth technology:

1. Bluetooth Classic
2. Bluetooth Low Energy
3. Bluetooth SmartReady

The features of Bluetooth 5.0 version is introduced as Bluetooth 5 which have been developed
entirely for the Internet of Things.

Properties of Bluetooth network


o Standard: Bluetooth 4.2
o Frequency: 2.4GHz
o Range: 50-150m
o Data transfer rates: 3Mbps

Advantages of Bluetooth network

o It is wireless.
o It is cheap.
o It is easy to install.
o It is free to use if the device is installed with it.

Disadvantages of Bluetooth network


o It is a short-range communication network.
o It connects only two devices at a time.

Bluetooth Low Energy


Bluetooth low energy (BLE) is a short-range communication network protocol with PHY (physical
layer) and MAC (Medium Access Control) layer. It is designed for low-power devices which uses
less data. BLE always remain in sleep mode except when the connection between devices is initiated
and data transmission occurs, due to this it conserves power of the device. Bluetooth low energy
follows the master/slave architecture and offers two types of frames that are adverting and data
frames. Slave node sent the advertising frame to discover one or more dedicated advertisement
channels. Master nodes sense this advertisement channels to find slaves and connect them.

Z-Wave
Z-Wave is a wireless communication protocol with the frequency of 900MHz. The ranges of Z-
Wave lies between 30 meters to 100 meters with the data transfer rate of 100kbps so that it is
suitable for small messages in IoT applications for home automation. This communication
protocol operates on mesh network architecture with one and several secondary controllers.

Properties of Z-Wave protocol

o Standard: Z-Wave Alliance ZAD12837 / ITU-T G.9959


o Frequency: 908.42GHz
o Range: 30-100m
o Data transfer rate: 100kbps

Advantages of Z-Wave protocol

o Low power consumption


o Remote or local control
o Simple installation
o Interoperability

Application of Z-Wave protocol

o Smart product and IoT based application


o Energy saving
o Home security
ZigBee Smart Energy
ZigBee is a low power, low data rate wireless personal area network communication protocol. It
is mostly used in home automation and industrial settings. Since ZigBee is a low power
communication protocol, the IoT power devices used with ZigBee technology. The ZigBee
communication protocol is based on the IEEE 802.15.4 standard operating at the 2.4GHz
frequency. The ZigBee protocol supports star, cluster or wireless mesh technology topology.

ZigBee uses the following devices in its network:

o Zigbee Coordinator
o Zigbee End Device
o Zigbee Router

Properties of ZigBee protocol

o Standard: ZigBee 3.0 based on IEEE802.15.4


o Frequency: 2.4GHz
o Range: 10-100m
o Data transfer rate: 250kbps

Advantages of ZigBee protocol

o Wireless
o Mesh networking
o Direct communication
o Low power consumption

Disadvantages of ZigBee protocol

o Costly
o Works with low speed within a small distance

Application of ZigBee protocol

o Commercial and residential control


o Personal and healthcare
o Home networking
o Industrial control and management
o Consumer electronics

LoRaWAN
LoRaWAN refers to Long Rage Wide Area Network which is a wide area network protocol.
It is an optimized low-power consumption protocol design to support large-scale public networks
with millions of low-power devices. A single operator operates the LoRaWAN. The LoRaWAN
network is a bi-directional communication for IoT application with low cost, mobility, and
security.

Properties of LoRaWAN protocol

o Standard: LoRaWAN
o Frequency: Various
o Range: 2-5km (urban environment), 15km (suburban environment)
o Data Rates: 0.3-50 kbps.

IoT Network Layer Protocols


The network layer is divided into two sublayers: routing layer which handles the transfer of
packets from source to destination, and an encapsulation layer that forms the packets.

RPL Protocol
RPL stands for Routing Protocol for Low-Power and Lossy Network. It is a distance-vector
protocol that supports a varity of Data Link Protocols. RPL builds a Destination Oriented
Directed Acyclic Graph (DODAG) which has only one route from each leaf node to the root.
All the traffic in this DODAG is routed through the root. Initially, each node sends a DODAG
Information Object (DIO) announcing them self as a root. This information travels in the
network, and complete DODAG is gradually built. When a new node wants to join the network,
it sends a DODAG Information Solicitation (DIS) request and root responds back with a DAO
Acknowledgment (DAO-ACK) confirming the join.

CORPL Protocol
CORPL protocol is the extension of the RPL protocol, which is termed as cognitive RPL. This
network protocol is designed for cognitive networks and uses DODAG topology. CORPL
protocol makes two new modifications in the RPL protocol. It uses opportunistic forwarding to
forward a packet between the nodes. Each node of CORPL protocol keeps the information of
forwarding set rather than parents only maintaining it. Each node updates its changes to its
neighbor using DIO messages. On the basis of this updated message, each node frequently
updates its neighbor for constant forwarder set.

CARP Protocol

CARP (Channel-Aware Routing Protocol) is a distributed routing protocol. It is designed for


underwater communication. It has lightweight packets so that it can be used for Internet of
Things (IoT). It performs two different functionalities: network initialization and data
forwarding. CARP protocol does not support previously collected data. Hence, it is not beneficial
for those IoT or other application where data is changed frequently. The upgradation of CARP is
done in E-CARP which overcomes the limitation of CARP. The E-CARP allows the sink node to
save previously received sensory data.

6LoWPAN
The 6LoWPAN protocol refers to IPv6 Low Power Personal Area Network which uses a
lightweight IP-based communication to travel over low data rate networks. It has limited
processing ability to transfer information wirelessly using an internet protocol. So, it is mainly
used for home and building automation. The 6LoWPAN protocol operates only within the 2.4
GHz frequency range with 250 kbps transfer rate. It has a maximum length of 128-bit header
packets.

6LowPAN Security Measure


Security is a major issue for 6LowPAN communication Protocol. There are several attacks issues
at the security level of 6LoWPAN which aim is to direct destruction of the network. Since it is
the combination of two systems, so, there is a possibility of attack from two sides that targets all
the layer of the 6LoWPAN stack (Physical layer, Data link layer, Adaptation layer, Network
layer, Transport layer, Application layer).

Properties of 6LowPAN protocol

o Standard: RFC6282
o Frequency: Used over a variety of other networking media including Bluetooth Smart
(2.4GHz) or ZigBee or low-power RF (sub-1GHz)
o Range: NA
o Data Rates: NA

IoT Session Layer Protocols


The session layer protocols review standards and protocols for message passing. Different
standardization organizations introduce the IoT session layer protocols. There are different types
of session layer protocol available with different functionality and range. MQTT and CoAP
provide these needs through small message sizes, message management, and lightweight
message overhead.

MQTT (Message Queue Telemetry Transport)


MQTT (Message Queue Telemetry Transport) is a messaging protocol which was introduced
by IBM in 1999. It was initially built for monitoring sensor node and faraway tracking in IoT. Its
suits are small, cheap, low-memory and low-power devices. MQTT provides embedded
connectivity between applications and middleware in one side and another side it connects
networks and communicators.

MQTT protocol is based on publish/subscribe architecture. The publish/subscribe architecture


consists of three major components: publishers, subscribers, and a broker. According to IoT
point of view, publishers are lightweight sensor devices that send their data to connected broker
and goes back to sleep whenever possible. Subscribers are applications, which are interested in a
certain topic or sensory data, so they are connected to brokers to be informed whenever new data
are received. The broker receives the sensory data and filters them in different topics and sends
them to subscribers according to interest in the topics.

SMQTT (Secure Message Queue Telemetry Transport)

SMQTT (Secure Message Queue Telemetry Transport) is an extension of MQTT protocol


which uses encryption based on lightweight attribute encryption. The main advantage of this
encryption is that it has a broadcast encryption feature. In this features, one message is encrypted
and delivered to multiple other nodes. The process of message transfer and receiving consists of
four major stages:
1. Setup: In this phase, the publishers and subscribers register themselves to the broker and
get a secret master key.
2. Encryption: When the data is published to broker, it is encrypted by broker.
3. Publish: The broker publishes the encrypted message to the subscribers.
4. Decryption: Finally the received message is decrypted by subscribers with the same
master key.

SMQTT is proposed only to enhance MQTT security feature.

CoAP
CoAP (Constrained Application Protocol) is a session layer protocol that provides the
RESTful (HTTP) interface between HTTP client and server. It is designed by IETF Constrained
RESTful Environment (CoRE) working group. It is designed to use devices on the same
constrained network between devices and general nodes on the Internet. CoAP enables low-
power sensors to use RESTful services while meeting their low power constraints. This protocol
is specially built for IoT systems primarily based on HTTP protocols.

This network is used within the limited network or in a constrained environment. The whole
architecture of CoAP consists of CoAP client, CoAP server, REST CoAP proxy, and REST
internet.
The data is sent from CoAP clients (such as smartphones, RFID sensors, etc.) to the CoAP server
and the same message is routed to REST CoAP proxy. The REST CoAP proxy interacts outside
the CoAP environment and uploads the data over REST internet.

DDS
DDS (Data Distribution Service) is a middleware (sometimes called machine-to-machine
(M2M)) communication protocol. It is implemented by the Object Management Group (OMG)
standard for the real-time system with high speed and high-performance, scalable, dependable,
and interoperable data exchange. This communication protocol is based on a publish-subscribe
pattern for sending and receiving data, events, and commands among the nodes.

The DDS protocol has two main layers:

o Data-Centric Publish-Subscribe (DCPS): This layer delivers the information to


subscribers.
o Data-Local Reconstruction Layer (DLRL): This layer provides an interface to DCPS
functionalities, permitting the sharing of distributed data amongst IoT enabled objects.

IOT PROJECT USING ARDUINO AND BLUETOOTH MODULE TO CONTROL LED


THROUGH ANDROID APP
Let's build an IoT project using Arduino (Arduino UNO) and Bluetooth Module HC-05 to
control a LED light. In this project, we will use an Android smartphone to send Bluetooth signal
to the Bluetooth module.

Hardware Requirements

1. Arduino UNO board


2. USB cable for connecter Arduino UNO
3. Bluetooth Module HC-05
4. Jumper wires male to female
5. LED
6. AC 220v/120v home appliances or 9v Hi-Walt Battery

Software requirements

1. Arduino software
2. Android Studio

The Working principle of Arduino-Bluetooth Module


In this project, there are three main components used; an Android Smartphone, Bluetooth
transceiver, and an Arduino.

The Android app is built to send serial data to the Bluetooth Module HC-05 by pressing ON
button. As Bluetooth Module HC-05 works on serial communication. It receives the data from
the app and sends it through TX pin of Bluetooth module to RX pin of Arduino. The uploaded
code inside Arduino checks the data received. If the receive data is 1, the LED turns ON, and if
the received data is 0 the LED turns OFF.

Digital circuit diagram

Bluetooth Module HC-05 Arduino UNO

TX --------------------------------> RX (Pin 0)
RX --------------------------------> TX (Pin 1)
VCC --------------------------------> 5v
GND --------------------------------> GND

LED Pin Arduino UNO


Pin 1 --------------------------------> GND
Pin 2 --------------------------------> Pin 13
For doing the programming for Arduino board, we need to download Arduino software. This can
be done from Arduino official site https://www.arduino.cc/

Download the Arduino software according to your OS compatibility (Windows Installer).


Click Download

After successful download, run the setup and follow the instructions.
When it asks to install the driver software, click to install
After installation, open the software, and if it generates a security alert then allow it.

Write a program for Arduino UNO board, if received data is equal to 1, LED turns on and if data
is equal to 0, LED turns OFF.
1. char data = 0; //Variable for storing received data
2. void setup()
3. {
4. Serial.begin(9600); //Sets the baud for serial data transmission
5. pinMode(13, OUTPUT); //Sets digital pin 13 as output pin
6. }
7. void loop()
8. {
9. if(Serial.available() > 0) // Send data only when you receive data:
10. {
11. data = Serial.read(); //Read the incoming data and store it into variable data
12. Serial.print(data); //Print Value inside data in Serial monitor
13. if(data == '1') // Checks whether value of data is equal to 1
14. digitalWrite(13, HIGH); //If value is 1 then LED turns ON
15. else if(data == '0') // Checks whether value of data is equal to 0
16. digitalWrite(13, LOW); //If value is 0 then LED turns OFF
17. }
18. }
Save your program and compile it.
Connect your Arduino device to your Laptop (or Monitor) via Arduino UNO USB cable.
Remove all the other connections with Arduino UNO device such as Bluetooth Module and LED
while uploading the program in Arduino UNO.

After compiling the code, upload it in Arduino UNO device. Before uploading the code in
Arduino, UNO device makes sure that your Arduino serial port is selected otherwise, it generates
an error message "Serial port not selected".

To select your serial port, open Device Manager > Ports >Arduino Uno, and then upload your
code.
Download the Android app's .apk file and install it on your Android smartphone. Click Here to
Download

Step to connect with Android app with Bluetooth Module


1. Open Bluetooth connecter app and allow turning on Bluetooth of the device.

2. Search for Bluetooth device for making the pair.

3. To pair with Bluetooth HC-05 module, enter a pin 0000 or 1234.


4. Select pair device HC-05 to connect with Android app.

5. Control LED device.


While clicking "ON" button it sends data 1 to Bluetooth module and this data is transmitted from
the Bluetooth module to Arduino device and it turns ON the LED. When clicking "OFF",
Android app sends data 0 to Bluetooth module, and this data is transmitted from the Bluetooth
module to Arduino and it turns OFF the LED.
GPS – Global Positioning System

GPS is a space-based satellite navigation system. It provides location and time information in all
weather conditions, anywhere on or near the Earth. GPS receivers are popularly used for
navigation, positioning, time dissemination, and other research purposes.

The GPS consists of satellites that orbit the earth. These satellites are geosynchronous with an
orbital period that is the same as the Earth’s rotation period. So they maintain exactly the same
position with respect to the earth below them.

All the GPS satellites transmit radio signals, which are then captured by a GPS receiver and used
to calculate their geographical position. A minimum of four satellites may be required to
compute the four dimensions of X, Y, and Z (latitude, longitude, and elevation) and time.

GPS receiver converts the received signals into position and estimates the time and some other
useful information depending on the application and requirements.

GPS determines the distance between a GPS satellite and a GPS receiver by measuring the
amount of time taken by a radio signal (the GPS signal) to travel from the satellite to the
receiver.

To obtain accurate information, the satellites and the receiver use very accurate clocks, which are
synchronized to generate the same code at exactly the same time.

If accuracy is important, you need GPS with a wide-area augmentation system (WAAS)
capability. This is a satellite service providing additional correction information to the GPS
receiver in order to increase its accuracy.

Before purchasing a GPS receiver, it’s good to know the protocols supported by it. Some
popular protocols for GPS receivers are:
GPS Protocols

NMEA 0183

An industry-standard protocol is common to marine applications defined by National Marine


Electronics Association (NMEA), USA. NMEA provides direct compatibility with other NMEA-
capable devices such as chart plotters and radars.

TSIP (Trimble standard interface protocol)

A binary packet protocol that allows the designer to configure and control the GPS receiver for
optimal performance in any number of applications.

TAIP (Trimble ASCII interface protocol)

Designed specifically for vehicle tracking applications. It is a bidirectional protocol using simple
ASCII commands with associated ASCII responses.

GSM Modem

GSM is a standard set developed by the European Telecommunications Standards Institute


(ETSI) to describe technologies for second-generation (2G) digital cellular networks.

A GSM modem is a specialized type of modem that accepts a SIM card and operates over a
subscription to a mobile operator just like a mobile phone.

GSM modems are a cost-effective solution for receiving SMS messages because the sender is
paying for the message delivery. To perform these tasks, a GSM modem must support an
extended AT command set for sending and receiving SMS messages, as defined in the ETSI
GSM 07.05 and 3GPP TS 27.005 specifications.

It should also be noted that not all phones support this modem interface for sending and
receiving SMS messages, particularly most smartphones like the Blackberry, iPhone, and
Windows mobile devices.

Recommended: Complete details about GPS and GSM

Vehicle Tracking System using GPS – Circuit Diagram

The circuit diagram of a GSM and GPS-based vehicle tracking system is displayed in the figure.
It consists of a microcontroller, GPS module, GSM modem, and 9V DC power supply. GPS
module gets the location information from satellites in the form of latitude and longitude.

The microcontroller processes this information and sends it to the GSM modem. The GSM
modem then sends the information to the owner’s mobile phone.

Circuit Diagram for Vehicle Tracking System using GPS


ATmega16 Microcontroller

ATmega16 microcontroller (IC2) is the heart of the project that is used for interfacing
with various hardware peripherals. It is a low-power CMOS 8-bit microcontroller based
on the AVR-enhanced RISC architecture.

Wave GPS moduleSIM300 GSM modem

ATmega16 microcontroller is interfaced serially to a GPS module and GSM modem. The GPS
module outputs many data but in this project, only the NMEA data is read and processed by the
microcontroller. The processed data is sent to the user’s mobile through a GSM modem.
This GPS-based vehicle tracking system implements RS-232 protocol for serial communication
between the microcontroller, GPS, and GSM modem. A serial driver IC MAX232 (IC3) is used
for converting RS-232 voltage levels into TTL voltage levels.

The user’s mobile number should be included in the source code written for the microcontroller.
Thus the user’s mobile number resides in the internal memory of the MCU.

If you are looking for the difference between Microprocessor and Microcontroller, you can read
it here.

iWave GPS Module

In this project, we have used the iWave GPS module. GPS always transmits the data to the
microcontroller. Transmit pin TXD of GPS is connected to the microcontroller via MAX232.
NMEA defined an RS-232 communication standard for devices that include GPS receivers.

The iWave GPS module supports the NMEA-0183 standard which is a subset of the NMEA
protocol. It operates in the L1 frequency (1575.42 MHz) and provides information with an
accuracy of up to 10 meters in the open sky. The antenna should be placed in an open space and
there should be at least 50 percent space visibility.

GSM Modem

This vehicle tracking system using GPS uses a SIM300 GSM modem. GSM modem transmits
and receives the data. Modem SIM300 is a tri-band GSM/GPRS engine that works on
frequencies EGSM 900 MHz, DCS 1800 MHz, and PCS 1900 MHz.

Transmit pin TXD and receive pin RXD of the GSM modem are connected to the
microcontroller (IC2) via MAX232 (IC3). The microcontroller’s port pin PD0 (RXD) and port
pin PD1 (TXD) are connected to pins 12 and 10 of MAX232, respectively.

Power Supply
The circuit is powered by a 9V battery. 7805 regulator (IC1) is used to convert 9V into 5V. The
microcontroller and MAX232 are powered by 5V. LED1 indicates the presence of a power
supply.

GPS-based Vehicle Tracker Circuit – PCB Design


Below you can see the PCB layout and component layout if the project.

An actual-size, single-side PCB for the GSM and GPS-based vehicle tracking circuit

Component layout for the PCB


Download PCB and Component Layout PDFs: click here

Vehicle Tracking System using GPS – Code

The program for the microcontroller is written in ‘C’ language and compiled using AVR Studio.

The user’s mobile number should be included in the source code in order to receive the call from
the SIM card used in the GSM modem. The hex code of the program is burnt into the MCU
using PonyProg2000 software. You can use any other suitable tool for the same.

A GPS module with a 9600 baud rate is used to receive the data from the satellites, which is
defined in the software.

The software is developed to decode the NMEA protocol. This protocol includes a set of
messages that use an ASCII character set and has a defined format that is continuously sent by
the GPS module to the interfacing device.

The GPS module or receiver provides data in the form of ASCII comma-delimited message
strings. Each message starts with a dollar sign ‘$’ (hex 0x24) and ends with (hex 0x0D 0x0A).

Download Source Code: click here

The software output protocol message includes global positioning system fixed data (GGA) and
geographic position latitude/longitude (GLL). In this project, we will use GGA only.

Note that the latitude and longitude information are both represented in the ‘degrees, minutes,
and decimal minutes’ format as ddmm.mmmm.

However, most mapping applications require longitude and latitude to be expressed in decimal,
degrees, in ‘dd.dddddd’ format with a corresponding sign (negative for south latitude and west
longitude). So some kind of conversion is required in the software if you want a particular
format.
The NMEA standard explains how each message string is formed with a dollar sign ($) leading
each new GPS message.

For example, $GPGGA,002153.000, 3342.6618, N, 11751.3858, W where $GPGGA is the GGA


protocol header, 002153.000 is UTC time in hhmmss.ss format, 3342.6618 is the latitude of the
GPS position fixed data in ddmm.mmmm format, 11751.3858 is the longitude of the GPS
position fixed data in ddmm.mmmm format and ‘N’ stands for North and ‘W’ for West.

With this data, you can find out the exact location using a map or you can use freely available
software to check the location.

Construction and Testing

The actual-size, single-sided PCB layout of the GPS and GSM-based vehicle tracking circuit,
along with its component layout, is shown in the figure

Assemble the components on the PCB with IC bases for ATmega16 and MAX232. Burn the
code into the MCU and mount it on the PCB. Insert the SIM card with sufficient balance in the
GSM module. Connect the circuit as shown above.

Testing

1. Connect the circuit to GPS and GSM modem.

2. Switch on the circuit and you will see LED1 glow.

3. Switch on the GPS module and wait for 10-15 minutes for initialization.

4. Switch on the GSM modem.

5. Dial the mobile number in the GSM modem. After two rings, the ringing stops automatically.
Wait for a few seconds. You will get an SMS alert on your mobile.

6. Check your SMS inbox. You will see the latitude and longitude data in the form of SMS text.
7. Open a standard map and locate the point on the map. You can also enter latitude and
longitude values in software such as http://www.latlong.net/Show-Latitude-Longitude.html or
any other suitable software.

Further Applications

This system can also be used where the information is not needed so frequently and the subject
has to be tracked at irregular time periods, such as monitoring of adolescents by parents, in
research to track animals in the jungle, coordinating search and rescue efforts, and mapping trails
and exploring new terrains.

This article is a part of the Top 15+ Microcontroller Projects. If you want to read more projects
based on microcontrollers, you can go through this article.

Architecture of Raspberry Pi



Raspberry Pi is a small single-board computer (SBC). It is a credit card-sized computer that can
be plugged into a monitor. It acts as a minicomputer by connecting the keyboard, mouse, and
display. Raspberry Pi has an ARM processor and 512MB of RAM. The architecture of
Raspberry Pi is discussed in this article.

The following diagram shows the architecture of Raspberry Pi:


The following diagram shows some main blocks of Raspberry Pi:

Raspberry Pi mainly consists of the following blocks:


 Processor: Raspberry Pi uses Broadcom BCM2835 system on chip which is an ARM
processor and Video core Graphics Processing Unit (GPU). It is the heart of the Raspberry Pi
which controls the operations of all the connected devices and handles all the required
computations.
 HDMI: High Definition Multimedia Interface is used for transmitting video or digital audio
data to a computer monitor or to digital TV. This HDMI port helps Raspberry Pi to connect
its signals to any digital device such as a monitor digital TV or display through an HDMI
cable.
 GPIO ports: General Purpose Input Output ports are available on Raspberry Pi which allows
the user to interface various I/P devices.
 Audio output: An audio connector is available for connecting audio output devices such as
headphones and speakers.
 USB ports: This is a common port available for various peripherals such as a mouse,
keyboard, or any other I/P device. With the help of a USB port, the system can be expanded
by connecting more peripherals.
 SD card: The SD card slot is available on Raspberry Pi. An SD card with an operating
system installed is required for booting the device.
 Ethernet: The ethernet connector allows access to the wired network, it is available only on
the model B of Raspberry Pi.
 Power supply: A micro USB power connector is available onto which a 5V power supply
can be connected.
 Camera module: Camera Serial Interface (CSI) connects the Broadcom processor to the Pi
camera.
 Display: Display Serial Interface (DSI) is used for connecting LCD to Raspberry Pi using 15
15-pin ribbon cables. DSI provides a high-resolution display interface that is specifically
used for sending video data.

GSM Modules

GSM (Global System for Mobile Communications) modules are widely used in IoT (Internet of
Things) applications to enable wireless communication over cellular networks. These modules
allow IoT devices to send and receive data via SMS, GPRS (2G), EDGE (2.5G), 3G, 4G
(LTE), and even 5G networks.

What is a GSM Module?


A GSM module is a hardware device that allows IoT systems to communicate over mobile
networks. It can send and receive SMS, voice calls, and data packets via GPRS, 3G, 4G, or
LTE.

Common GSM modules include:

 SIM800, SIM900 (2G)


 SIM7600 (4G LTE)
 Quectel M95, EC25 (4G)
 SARA-U201 (u-blox) (3G/4G)

2. Features of GSM Modules in IoT

✔ Long-range communication – Operates globally via cellular networks.


✔ Supports SMS, voice, and internet – Enables device-to-device communication.
✔ Low-power consumption – Suitable for battery-powered IoT devices.
✔ Remote monitoring & control – Ideal for smart IoT applications.
✔ Works with microcontrollers (Arduino, ESP32, Raspberry Pi, etc.)

3. How GSM Modules Work in IoT

1. The IoT device (e.g., Arduino, ESP32, Raspberry Pi) connects to the GSM module via
UART (serial communication).
2. A SIM card is inserted into the GSM module to access the mobile network.
3. The IoT device sends AT commands to the GSM module to perform tasks like:
o Sending an SMS (AT+CMGS="phone_number")
o Making a call (ATDphone_number;)
o Sending data over GPRS/Internet (AT+HTTPACTION=0 for HTTP GET)
4. The GSM module transmits data via the mobile network, allowing remote
communication.

4. Applications of GSM in IoT


Smart Agriculture

 Remote weather station updates.


 Automatic irrigation control.

Home Automation

 Remote appliance control via SMS.


 Intruder alert notifications.

Industrial Monitoring

 Machine health tracking.


 Fault detection & alerting.

Vehicle Tracking

 GPS tracking with GSM for real-time location updates.


 Fleet management and anti-theft systems.

Healthcare Monitoring

 Remote patient monitoring (IoT health devices).


 Emergency alerts via SMS.

5. Advantages & Disadvantages


Advantages Disadvantages

Works anywhere with GSM coverage. Requires a SIM card and cellular plan.

Low power consumption. Dependent on network signal strength.

Supports SMS, voice, and internet. Not ideal for high-speed data applications.

Cost-effective for simple IoT applications. Newer networks (5G) may phase out 2G/3G support.

6. Alternatives to GSM for IoT

If GSM is not ideal, other wireless IoT communication technologies include:

 LoRaWAN (Low-power, long-range)


 NB-IoT (Narrowband IoT) (Low-power cellular IoT)
 Wi-Fi (Short-range, high-speed)
 BLE (Bluetooth Low Energy) (Short-range, low-power)
 Zigbee & Z-Wave (Smart home applications)
 5G IoT (High-speed, low-latency)

7. GSM vs. Other IoT Communication Protocols


Technology Range Power Data Best For
Consumption Speed

GSM (2G/3G/4G Long


Moderate Medium Remote IoT, tracking
LTE) (Global)

LoRaWAN Very Long Low Low Smart cities, farming

Wi-Fi Short High High Home automation

NB-IoT Long Very Low Medium Industrial IoT

Wearables,
BLE Short Very Low Low
healthcare

OPEN PLATFORMS FOR IOT (LIKE RASPBERRY PI)

Open platforms like Raspberry Pi, Arduino, ESP32, BeagleBone, and Jetson Nano are widely
used in IoT, automation, robotics, and AI applications. These platforms offer flexibility, cost-
effectiveness, and strong community support for hardware and software development.

1. What is an Open Platform?

An open platform is a hardware or software system with open-source specifications, allowing


developers to modify, customize, and extend its capabilities.

✔ Low-cost & accessible

✔ Large developer community

✔ Runs open-source OS & software

✔ Compatible with multiple sensors & modules

2. Popular Open Platforms for IoT & Embedded Systems


Raspberry Pi (Linux-based SBC)

 Best for: Edge computing, AI, IoT gateways, robotics


 OS: Raspberry Pi OS (Linux-based), Ubuntu, Kali Linux
 Processor: ARM-based (Broadcom SoC)
 Connectivity: Wi-Fi, Bluetooth, GPIO, HDMI, USB, Ethernet
 Use Cases: Smart home, automation, ML on edge
Example Project: Smart home system with Python & MQTT

Arduino (Microcontroller Board)

 Best for: Low-power, real-time applications


 OS: No OS (runs firmware on microcontroller)
 Processor: ATmega328, SAMD21, etc.
 Connectivity: UART, SPI, I2C, Wi-Fi (ESP8266, ESP32)
 Use Cases: Sensors, automation, robotics
Example Project: Weather station with DHT11 sensor

ESP32 (Wi-Fi & Bluetooth Microcontroller)

 Best for: IoT & wireless applications


 OS: FreeRTOS, Arduino IDE, Micropython
 Processor: Dual-core Xtensa 32-bit LX6
 Connectivity: Wi-Fi, Bluetooth, SPI, I2C, UART
 Use Cases: Home automation, smart farming, energy monitoring
Example Project: IoT-based smart thermostat

BeagleBone Black (Linux-based SBC)

 Best for: Industrial IoT & real-time applications


 OS: Debian, Ubuntu, Android
 Processor: ARM Cortex-A8
 Connectivity: Ethernet, USB, HDMI, GPIO
 Use Cases: Industrial automation, robotics
Example Project: Real-time machine monitoring

Nvidia Jetson Nano (AI & Edge Computing)

 Best for: AI, computer vision, deep learning


 OS: Ubuntu-based JetPack
 Processor: Quad-core ARM Cortex-A57, 128-core GPU
 Connectivity: Wi-Fi, USB, HDMI, GPIO
 Use Cases: AI-driven robotics, image processing
Example Project: Face recognition with OpenCV & TensorFlow

3. Choosing the Right Open Platform for IoT


Feature Raspberry Pi Arduino ESP32 BeagleBone Jetson Nano

No OS Ubuntu
OS Linux-based FreeRTOS Linux-based
(Firmware) (JetPack)

Wi-Fi,
GPIO, SPI, Wi-Fi, BLE, Wi-Fi, USB,
Connectivity Bluetooth, Ethernet, GPIO
I2C GPIO HDMI
GPIO

Processing Very High


Medium Low Medium High
Power (GPU)

Sensors, AI, ML, deep


Best For IoT, automation IoT, wireless Industrial IoT
robotics learning

Example Weather IoT Machine AI face


Smart home
Project station thermostat monitoring detection
4. Applications of Open Platforms in IoT

Smart Home Automation

 Raspberry Pi as an IoT hub


 ESP32 for Wi-Fi-connected devices

Industrial IoT

 BeagleBone for real-time machine monitoring


 ESP32/Arduino for sensor-based automation

AI & Edge Computing

 Jetson Nano for AI-driven IoT analytics


 Raspberry Pi for computer vision applications

Robotics

 Arduino for motor control


 Raspberry Pi for autonomous navigation

Wearables & Smart Devices

 ESP32 for IoT-based healthcare devices

Architecture of Raspberry Pi


Raspberry Pi is a small single-board computer (SBC). It is a credit card-sized computer that can
be plugged into a monitor. It acts as a minicomputer by connecting the keyboard, mouse, and
display. Raspberry Pi has an ARM processor and 512MB of RAM. The architecture of
Raspberry Pi is discussed in this article.

The following diagram shows the architecture of Raspberry Pi:


The following diagram shows some main blocks of Raspberry Pi:
Raspberry Pi mainly consists of the following blocks:
 Processor: Raspberry Pi uses Broadcom BCM2835 system on chip which is an ARM
processor and Video core Graphics Processing Unit (GPU). It is the heart of the Raspberry Pi
which controls the operations of all the connected devices and handles all the required
computations.
 HDMI: High Definition Multimedia Interface is used for transmitting video or digital audio
data to a computer monitor or to digital TV. This HDMI port helps Raspberry Pi to connect
its signals to any digital device such as a monitor digital TV or display through an HDMI
cable.
 GPIO ports: General Purpose Input Output ports are available on Raspberry Pi which allows
the user to interface various I/P devices.
 Audio output: An audio connector is available for connecting audio output devices such as
headphones and speakers.
 USB ports: This is a common port available for various peripherals such as a mouse,
keyboard, or any other I/P device. With the help of a USB port, the system can be expanded
by connecting more peripherals.
 SD card: The SD card slot is available on Raspberry Pi. An SD card with an operating
system installed is required for booting the device.
 Ethernet: The ethernet connector allows access to the wired network, it is available only on
the model B of Raspberry Pi.
 Power supply: A micro USB power connector is available onto which a 5V power supply
can be connected.
 Camera module: Camera Serial Interface (CSI) connects the Broadcom processor to the Pi
camera.
 Display: Display Serial Interface (DSI) is used for connecting LCD to Raspberry Pi using 15
15-pin ribbon cables. DSI provides a high-resolution display interface that is specifically
used for sending video data.
INTERFACING – ACCESSING GPIO PINS
To access GPIO pins on a Raspberry Pi, you need to use a programming language like Python
and utilize a dedicated library like "RPi.GPIO" which allows you to configure each pin as either
an input or output, enabling you to read data from sensors connected to the pins or control
external devices like LEDs by setting the pin voltage high or low; essentially acting as a physical
interface between the Raspberry Pi and external hardware.

Key points about accessing GPIO pins:

GPIO stands for General-Purpose Input/Output:

These are the physical pins on the Raspberry Pi that can be configured to receive data from
sensors (input) or send signals to control devices (output).

Pinout Diagram:

To understand which pins are which, consult the Raspberry Pi pinout diagram which maps
each pin to its function.

Python Library:
The most common way to access GPIO pins in Python is through the "RPi.GPIO" library,
which provides functions to set pin modes (input/output), read pin values, and write to pins.
Basic steps to access GPIO pins:

Import the library:


Code
import RPi.GPIO as GPIO

Set pin numbering mode:


GPIO.BCM: Uses the Broadcom pin numbering scheme (recommended)

GPIO.BOARD: Uses the physical pin numbering scheme


Code
GPIO.setmode(GPIO.BCM)

Configure a pin as input or output:


Code
GPIO.setup(pin_number, GPIO.IN) # Set pin as input

GPIO.setup(pin_number, GPIO.OUT) # Set pin as output

Read from an input pin:


Code
pin_value = GPIO.input(pin_number)

Write to an output pin:


Code
GPIO.output(pin_number, GPIO.HIGH) # Set pin high (on)

GPIO.output(pin_number, GPIO.LOW) # Set pin low (off)

Important considerations:

Power and Ground:

Always connect your external devices to the proper power and ground pins on the Raspberry
Pi.

Pin limitations:

Check the pinout diagram to see which pins are capable of providing enough current for your
devices.

Cleanup:
When you finish using the GPIO pins, remember to clean up your code by setting the pins back
to their default state using GPIO.cleanup().

SENDING AND RECEIVING SIGNALS USING GPIO PINS

To send and receive signals using GPIO pins, you configure specific pins on a microcontroller or
similar device as either "outputs" to send signals (by setting a high or low voltage) or "inputs" to
receive signals from external devices, allowing for flexible communication with sensors,
actuators, and other components based on the digital signal levels interpreted by the
software; essentially acting as a bridge between the internal circuitry and the external world.

Key points about GPIO pins:

General Purpose:
The "G" in GPIO stands for "General Purpose," meaning each pin can be configured as either
an input or an output depending on the application needs.

Digital Signals:

GPIO pins transmit digital signals, which are represented by discrete voltage levels (high or
low) interpreted as logical 1s and 0s.

Software Control:
The functionality of a GPIO pin (whether it acts as an input or output) is determined by
software settings within the microcontroller.
Example of Sending and Receiving Signals:

Sending a Signal (Output):

Set a GPIO pin as an output.

Write a high logic value to the pin to send a "high" signal (e.g., turn on an LED).

Write a low logic value to send a "low" signal (e.g., turn off an LED).
Receiving a Signal (Input):
Configure a GPIO pin as an input.

Read the voltage level on the pin to determine if a signal is high or low.

Use this information to trigger actions in your program based on the input received (e.g., detect a
button press).
Applications of GPIO Pins:

 Controlling LEDs: Turn LEDs on and off by setting GPIO pins as outputs.

 Reading Sensor Data: Receive analog sensor readings by converting them to digital signals
using an ADC (Analog-to-Digital Converter) and reading the corresponding GPIO pin.

 Interfacing with Switches: Detect button presses by monitoring the state of a GPIO pin
configured as an input.

 Motor Control: Send control signals to motors using GPIO pins set as outputs.
CONNECTING TO THE CLOUD

To connect an IoT device to the cloud, you need to first register the device on the chosen cloud
platform (like AWS IoT Core, Azure IoT Hub, or Google Cloud IoT Core), which generates
unique credentials like keys and certificates, then use a communication protocol (like MQTT,
HTTP, or CoAP) to establish a secure connection between the device and the cloud, sending data
from the device to the cloud platform for storage and analysis; this usually involves utilizing an
IoT SDK provided by the cloud platform to facilitate the connection process on the device side.

Key steps involved:

Device Registration:

Create an account on a cloud platform with IoT capabilities.

Register your IoT device on the platform, providing details like device ID and desired
connectivity options.

The platform will generate unique security credentials (keys and certificates) for your device.

Device Configuration:

Install necessary firmware on the device, including the IoT SDK specific to the chosen cloud
platform.

Configure the device with the cloud platform endpoint, security credentials, and communication
protocol.

Data Transmission:

Use the chosen communication protocol to send data from the device to the cloud.

Most commonly, MQTT is used for its lightweight nature and efficient data delivery.

Cloud Data Processing:

Once data reaches the cloud, the platform can store, process, and analyze it based on your
application needs.

Important considerations:
Connectivity:

Choose the appropriate network technology based on your device's requirements (Wi-Fi, cellular,
LoRaWAN, etc.).

Security:

Implement robust security measures like encryption and authentication to protect data
transmission.

Device Management:

Utilize features provided by the cloud platform to manage device updates, monitoring, and
troubleshooting.

You might also like