Location via proxy:   [ UP ]  
[Report a bug]   [Manage cookies]                

Iot Lab Answers - Deleted

Download as pdf or txt
Download as pdf or txt
You are on page 1of 37

J.N.T.U.

College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

1. Select any one development board (Eg., Arduino or Raspberry Pi) and control LED using the
board.

Aim: To devlop an Ardino or Raspberry Pi and control LED using the board.

Components Required:
S.NO COMPONENTS QUANTITY
1. ARDUINO BOARD 1
2. LED LIGHT 1
3. SWITCH 1
4. CONNECTING WIRES 10
5. PC 1
6. BREADBOARD 1

Arduino UNO:
The Arduino UNO is a standard
board of Arduino. Here UNO means
'one' in Italian. It wasnamed as UNO to
label the first release of Arduino
Software. It was also the first USB
boardreleased by Arduino. It is
considered as the powerful board
used in various projects.Arduino.cc
developed the Arduino UNO board.

Arduino UNO is based on an


ATmega328P microcontroller. It is easy
to use compared toother boards, such as
the Arduino Mega board, etc. The board
consists of digital and
analogInput/Output pins (I/O), shields,
and other circuits

The Arduino UNO includes 6 analog pin inputs, 14 digital pins, a USB connector, a powerjack,
and an ICSP (In-Circuit Serial Programming) header. It is programmed based on IDE,which stands for
Integrated Development Environment. It can run on both online and offlineplatforms.

Let's discuss each component in detail.


1. ATmega328 Microcontroller- It is a single chip Microcontroller of the ATmel family.
Theprocessor code inside it is of 8-bit.
It combines Memory (SRAM, EEPROM, and Flash),Analog to Digital Converter, SPI serial ports, I/O
lines, registers, timer, external andinternal interrupts, and oscillator.
2. ICSP pin - The In-Circuit Serial Programming pin allows the user to program using thefirmware
of the Arduino board.
3. Power LED Indicator- The ON status of LED shows the power is activated. When thepower is
OFF, the LED will not light up.
4. Digital I/O pins- The digital pins have the value HIGH or LOW. The pins numbered fromD0 to
D13 are digital pins.
5. TX and RX LED's- The successful flow of data is represented by the lighting of theseLED's.
6. AREF- The Analog Reference (AREF) pin is used to feed a reference voltage to
theArduino UNO board from the external power supply.
Page No.:1
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

7. Reset button- It is used to add a Reset button to the connection.


8. USB- It allows the board to connect to the computer. It is essential for the programming ofthe
Arduino UNO board.
9. Crystal Oscillator- The Crystal oscillator has a frequency of 16MHz, which makes theArduino
UNO a powerful board.
10. Voltage Regulator- The voltage regulator converts the input voltage to 5V.
11. GND- Ground pins. The ground pin acts as a pin with zero voltage.
12. Vin- It is the input voltage.
13. Analog Pins- The pins numbered from A0 to A5 are analog pins. The function of Analogpins is
to read the analog sensor used in the connection. It can also act as GPIO (GeneralPurpose Input
Output) pins.

Light Emitting Diode:


LED’s are kind of semi conductors
with the light sources in which both P-
type(holes) and N-type(electrons)
semiconductors will combine. By giving
some certain forward voltage
thiscombination of holes and electrons
occurs, releasing the form of which is
light. The wastageof electricity is very less
in LED’s and it directly converts electrical
energy into light energy,Figure shows a
view of LED.

Push Buttons:
A push-button is a easy transfer mechanism to govern some
issue of a system. while the pushbutton is open (unpressed) there is no
connection between the 2 legs of the push button, sothe pin is hooked up
to floor (thru the pull-down resistor) and we study a LOW. whilst
thebutton is closed (pressed), it makes a connection among its legs,
connecting the pin to 5 volts,so that we study a excessive. Figure shows
a view of push button

Resistors:
A resistor is a
passive two-terminal
device that implements
electric resistance as
acircuit. Resistors are
used to resist the flow
of current and have a
stated cost of
Resistance.Many kinds
of resistors are used
having extraordinary
makes use of and construction. Themost common types have a hard and fast value of resistance so are
often referred to as fixedresistors, Figure shows a view of resistors.

Page No.:2
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Theory :
LED (Light emitting diode) works with very little power. The digital pin 13 is built in the
Arduino board for the LED. LED’s have polarity will work only the legs are oriented in the proper way.
The two legs of the LED, one leg goes for the positive and other leg is for the ground. The LED has flat
edge on one side of the bulb. To protect the LED we should use resistors in series to protect it from
burning.

Circuit Diagram :
As shown in Figure resistors are used to safe guard the Light emitting diodes from the higher
voltage and prevent them from burning.

Procedure:
1. Make connections as per circuit diagram.
2. Connect the Arduino to pc and configure Arduino IDE.
3. Copy and verify the code in Arduino IDE.
4. Upload the code to Arduino.
5. Now we can see the L.E.D lights up.

Page No.:3
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

2. Using the same board as in (1), read data from a sensor. Experiment with both analog and digital
sensors.

Aim: To read data from a sensor Using the development board. Experiment with digital sensor.

Components Required:
Name Quantity component
U1 1 Arduino UNO R3
D1 1 Red LED
R1 1 220 Ohm Resistor
PIR1 1 -3.598290659201581,-294.29818133729066,-194.67798997574994 PIR
Sensor

Procedure:

PIR Motion Sensor (Digital Input)

Let's learn to sense movement in a room with a PIR motion sensor and Arduino. We'll connect up
a circuit using a breadboard and use some simple Arduino code to control three LEDs. So far you've
already learned to read a push button with Arduino's digital input, so we'll build on those skills in this
lesson. Although the motion sensor may seem complex with its dedicated circuit board, it is configured to
send a HIGH or LOW signal in much the same way a pushbutton would. PIR stands for Passive Infra

Red, which describes the technology inside—it passively detects infrared light levels (unlike an
infrared camera that may also emit infrared light in order to capture its reflection). The white dome is a
lens that expands the IR detector's field of vision. The sensor reports a LOW signal by default, reads the
amount of ambient infrared light coming in, and then triggers a HIGH signal for a certain period of time
when the light levels change, indicating movement. It can tell you whether or not there is movement in a
scene, but cannot detect distance— for that you might consider a type of analog input sensor called an
ultrasonic rangefinder.

PIR Motion Sensor Setup:


1. Identify the row of three headers on the circuit board. They will be towards the center of one
edge and are labeled GND, OUT, and +5v (or something similar).
2. Plug in the included wired connector to the three header pins, with the black wire lined up with
GND.
3. Double check the connector is firmly seated.
4. Alternatively, you can connect three individual female-to-male prototyping wires to the header
pins.
5. continue to the next step.

Circuit:

Page No.:4
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

OUTPUT:

Page No.:5
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Aim: To read data from a sensor Using the development board. Experiment with analog sensor.

Components Required:
Name Quantity Component
U1 1 Ardunio Uno R3
U2 1 Temparature Sensor(TMP36)
D1 3 Red LED
D2
D3
R1 3 220 Ohm Resistor
R2
R3

Procedure:

In this project, you will turn the Arduino into a thermometer! Use a temperature sensor to
measure your skin temperature, and register the output with three LEDs. Even though the Arduino is a
digital tool, it can interpret signals from an analog input, like the temperature sensor, using the built in
Analog-to-Digital (ADC) converter, accessed through the analog pins, which you may have learned about
in a previous lesson about analog input.

1. Explore the sample circuit here in the work plane by starting the simulation, clicking on the
sensor, then dragging its temperature slider to adjust the simulated input and observe the
resulting LED patterns.
2. In this lesson, you'll build this simulated circuit yourself along side the sample. To optionally
build the physical circuit, gather up your Arduino Uno board, USB cable, solder less breadboard,
three LEDs, three alike resistors (any value from 100-1K, 220 ohms preferred), a TMP36
temperature sensor, and breadboard wires.
3. Can you identify all these components in the breadboard circuit pictured?

Circuit:

Page No.:6
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Page No.:7
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

3. Control any two actuators connected to the development board using Bluetooth.

AIM: To Control any two actuators connected to the development board using Bluetooth.

Components Required:
• Arduino UNO board
• USB cable for connecter Arduino UNO
• Bluetooth Module HC-05
• Jumper wires male to female
• 2 LED’s

PROCEDURE:

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.

1. 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/
2. After installation, open the software, and if it generates a security alert then allow it.
3. 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.Save your program and compile it.
4. 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.
5. 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".
6. 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.
7. Step to connect with Android app with Bluetooth Module
8. Open Bluetooth connecter app and allow turning on Bluetooth of the device.
9. Search for Bluetooth device for making the pair. To pair with Bluetooth HC-05 module, enter a
pin 0000 or 1234.
Select pair device HC-05 to connect with Android app.

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.

Page No.:8
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

CIRCUIT DIAGRAM:

Program:
// Define variable to store received data
char receivedData = 0;

void setup() {
// Start serial communication
Serial.begin(9600);

// Set pin 13 as an output


pinMode(13, OUTPUT);
}

void loop() {
// Check if data is available to read
if (Serial.available() > 0) {
// Read the incoming data
receivedData = Serial.read();

// Print the received data to the Serial Monitor


Serial.print(receivedData);

// Check the value of the received data


if (receivedData == '1') {
// Turn on the LED (pin 13)
digitalWrite(13, HIGH);
} else if (receivedData == '0') {
// Turn off the LED (pin 13)
digitalWrite(13, LOW);
}
}
}

Page No.:9
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

4 .Read data from sensor should and send it to a requesting client by using socket communication.

Aim:
To read data from sensor should and send it to a requesting client by using socket communication.
Components:
▪ Arduino UNO – read Best Arduino Starter Kits
▪ SIM900 GSM Shield
▪ 5V 2A Power Adaptor
▪ FTDI programmer (optional)
▪ SIM Card
▪ DHT11 or DHT22 Temperature and Humidity Sensor
▪ 10 kOhm resistor
▪ Breadboard
▪ Jumper Wires
Procedure:
• In this project we’re going to show you how to request sensor data via SMS with the Arduino. As
an example we’re going to request the temperature and humidity from a DHT11 sensor. To send
and receive SMS with the Arduino we’re going to use the SIM900 GSM shield.
• The shield uses the original SIM card size, not micro or nano. If you have micro or nano you may
consider getting a SIM card size adapter.
Turn off the PIN lock :
In my case, I need to go through: Settings > Advanced Settings > Security > SIM lock and turn off the
lock sim card with pin.
Getting the right power supply:

To power up the shield, it is advisable to use a 5V power supply that can provide 2A as the one shown
below.
You can find the right power adapter for this shield here. Make sure you select the model with 5V and
2A.

Setting up the SIM900 GSM Shield:


The following steps show you how to set up the SIM900 GSM shield.

Page No.:10
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

1) Insert the SIM card into the SIM card holder. You need a SIM card with the standard size. The shield
is not compatible with micro or nano SIM cards. If you need, you may get a sim card size adapter. Also,
it is advisable to use a SIM card with a prepaid plan or unlimited SMS.
2) Confirm the antenna is well connected.
3) On the serial port select, make sure the jumper cap is connected as shown in figure below to use
software serial.
4) Power the shield using an external 5V power supply. Double-check that you have the external power
source selected as we’ve mentioned earlier.
5) To power up/down the shield press the power key for about 2 seconds.
6) Then, the Status LED will light up and the NetLight LED will blink every 800 ms until it finds the
network. When it finds the network the NetLight LED will start blinking every three seconds.
7) You can test if the shield is working properly by sending AT commands from the Arduino IDE using
an FTDI programmer.

Circuit Diagram:
You have to connect the SIM900 GSM shield and the DHT11 temperature and humidity sensor to the
Arduino as shown in the figure below.

Source Code:
The following code reads the temperature and humidity from the DHT sensor and sends them via
SMS when you send an SMS to the Arduino with the message “STATE”.
You need to modify the code provided with the phone number your Arduino should reply the
readings to.
The code is well commented for you to understand the purpose of each line of code. Don’t
upload the code now. Scroll down and read the explanation below the code.

#include "DHT.h"
#include <Adafruit_Sensor.h>
#include <SoftwareSerial.h>

Page No.:11
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

#define DHTPIN 2
#define DHTTYPE DHT11

DHT dht(DHTPIN, DHTTYPE);

float t;
float f;
float h;

SoftwareSerial SIM900(7, 8);

char incomingChar;

void setup() {
dht.begin();

Serial.begin(19200);
SIM900.begin(19200);
delay(20000);
Serial.print("SIM900 ready...");
SIM900.print("AT+CMGF=1\r");
delay(100);
SIM900.print("AT+CNMI=2,2,0,0,0\r");
delay(100);
}

void loop() {
if (SMSRequest()) {
if (readData()) {
delay(10);
SIM900.println("AT + CMGS = \"+XXXXXXXXXX\"");
delay(100);
String dataMessage = ("Temperature: " + String(t) + "*C " + " Humidity: " + String(h) + "%");
SIM900.print(dataMessage);
delay(100);
SIM900.println((char)26);
delay(100);
SIM900.println();
delay(5000);
}
}
delay(10);
}

Page No.:12
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

}
}
}
}
}
return false;
}

Page No.:14
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

5. Create any cloud platform account, explore IoT services and register a thing on the platform.

AIM: To create cloud platform account and explore iot services

Procedure:
The first thing we are going to do is create a project. If you have already worked with Google
Cloud Platform and have at least one project, you will be taken to the first project in the list or you will be
taken to the Getting started page.
As of the time of writing this book, Google Cloud Platform has a free trial for 12 months with $300 if the
offer is still available when you are reading this chapter, I would highly recommend signing up:
Once you have signed up, let’s get started by creating a new project. From the top menu bar,
select the Select a Project dropdown and click on the plus icon to create a new project. You can fill in the
details as illustrated in the following screenshot:

1. Go to google cloud IoT core page in the GCP console.


2. Click on Create a registry option.
3. Enter the registry id and select the cloud region.
4. In the protocol section MQTT protocol.
5. Create a telemetry topic from the drop down list and then click on create a topic option.
6. Some fields like Device state topic and Certificate value fields are optional so that we can leave them
as blank.
7. After that click on Create Cloud IoT Core page.

Add a Device to Registry


• On the registry device page, click on the add device option and enter the device id.
• Select allow for the Device Communication and the information for the public key.
• The device metadata field is an option, so we can leave it blank.
• After that click on add button to add a device.

Running a Node.js Sample to Connect to a Virtual Device


• Get the Cloud IoT Core Node.js samples and store in the directory.
• Copy the private key to the current directory.
• Install node.js dependencies by command npm install.
• Create the subscription to the registry’s pub/subtopic.
• Now connect a virtual device to cloud IoT core with the help of MQTT bridge.

Page No.:15
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

The best part of using Google Cloud Platform is that it provides unique offerings for Big Data and
Artificial Intelligence and IoT services. Also while building a project, scalability is the major part of the
concern, so due to its serverless architecture, GCP met the requirements of the project. Some of the
components for IoT solution with Google Cloud Platform are as follows -

BigQuery
It is a cloud-based IaaS model designed by Google which is used for storing and processing enormous
datasets with the help of several SQL queries. It can be said that BigQuery is a type of database which is
different from the transactional databases like MySQL and MongoDB.

Cloud IoT Core


It is a completely managed service which allows us to securely and easily connect, manage and ingest the
data from the devices connected to the internet. Apart from this, it also allows other Google Cloud
Platform services to collect, process, manage and visualize the IoT data in real time. Pub/Sub - It is a type
of asynchronous service to service communication which is used in the serverless and microservices kind
of architecture. In this type of model, any service which is published to a topic is immediately be received
by all the subscribers of that particular topic. It can be used to enable any event-driven architecture.

Hardware
Google offers a version of Android for IoT devices which is known as Android Things. Android Things
helps the developers to configure and push the software updates to the operating system.

Cloud Functions
For routing the data after entering into the Pub/Sub, cloud functions are used. A cloud function is nothing
but a java script code which been triggered when an event takes place. And the code will run without any
need of infrastructure management because its all taken care by Google itself.

Page No.:16
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

6. Push Sensor data to cloud.

Aim: To Push Sensor data to cloud.

Components Required:
• Esp8266
• DHT 11 Sensor
• Arduino UNO
• Bread Board
• Wires
• Resistor 10k
• PC

Procedure:
Step 1:
Hardware Configuaration:
First Connect VCC pin of DHT 11 Sensor to Arduino 5V pin .Connect Data pin of DHT 11
Sensor to Arduino 11 pin.Connect GND pin of DHT 11 Sensor to Arduino GND pin. Connect then
connect Esp8266 RX pin to -3 pin of Arduino.Connect Tx pin of ESP8266 to 2 pin of Arduino.Connect
VCC pin of ESP8266 to Ardunio 3V3 pin.CH-PW pin of ESP8266 to Arduino 3V3 pin . Connect GND
pin of ESP8266 to GND of the Ardunio .
Step 2:
After setting of the hardware connection, the next thing is to configure the cloud environment for
that we use thinkspeak.com .
Step 3:
If you dont have account in thinkspeak.com ,then we will create account .create new channel in
thinkspeak and provide name of the channel as Tempurature and Humidity project and create Field1 as
Tempurature Field2 as Humidity and then click save Channel
Step 4:
Click on APIKeys write API key is used for sending sensor data to thinkspeak cloud
Step 5:
To use DHT11 sensor ,we must include one library in Aruidno. To include that Librabry we follow
the below steps
• Open the Arudino IDE
• Select Sketch ,under the Sketch select Include Library.
• Selcet add Zip library.
Step 6:
After we need to write Arudino code in Arudino IDE and then connect Arudino Board to pc and
then upload the code.

Source code:
DHT11 Library:-
#include "DHT.h"
DHT dht;
void setup() {
Serial.begin(9600);
dht.setup(2); // data pin 2
}

Page No.:17
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Serial.println(temperature);
return String(temperature);
}

String getHumidityValue() {
float humidity = dhtObject.getHumidity();
Serial.print(" Humidity in %= ");
Serial.println(humidity);
return String(humidity);
}

void sendCommand(String command, int maxTime, char readReplay[]) {


Serial.print(countTrueCommand);
Serial.print(". at command => ");
Serial.print(command);
Serial.print(" ");
while (countTimeCommand < (maxTime * 1)) {
esp8266.println(command);
if (esp8266.find(readReplay)) {
found = true;
break;
}
countTimeCommand++;
}
if (found == true) {
Serial.println("OYI");
countTrueCommand++;
countTimeCommand = 0;
}
if (found == false) {
Serial.println("Fail");
countTrueCommand = 0;
countTimeCommand = 0;
}
found = false;
}
Circuit:

Page No.:19
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

OUTPUT:

Page No.:20
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

7. Control an actuator through cloud

AIM: To control an actuator through cloud

Introduction:
In this tutorial, we will go through the steps necessary to set up an ESP32 / ESP8266 development
board with the Arduino Cloud IoT. To test it out, we will send random values from the board to the
cloud, and set up a switch that can enable the built-in LED on the board.

Goal:
The goals of this project are:
• Send data to the cloud from the board.
• Turn ON/OFF an LED on the board through the cloud.

Components required
• ESP32 / ESP8266 development board.
• Arduino Cloud IoT.
We will also need the following components for the circuit:
• LED
• 220 ohm resistor
• Breadboard
• Jumper Wires

Setting up the Arduino Cloud IoT:


To start, we will need to head over to the Arduino Cloud IoT. This is also accessible through the
menu at the top right.

Navigate to the cloud:

Step 1:- Setting up the device


1. Once in the cloud, click on the "Devices" tab. Then, click on the "Add device" button.Adding a
device.
2. Then, click on "Set up a 3rd party device".
3. Setting up a third party device.
4. Now we need to select what board we are using. Select either ESP32 or ESP8266, and then
choose the board from the drop-down menu.
5. Select the board.
6. Now the board needs a name. We choose My_ESP32, but you can have a lot more imagination
than that!
7. Naming the board.
8. You will now receive your Device ID and Secret key. Please note that the secret key cannot be
recovered, so make sure you note it down. You can also download a PDF with the information.
9. When you have saved it, tick the box at the bottom, and click on "Continue".
10. Credentials of your board.
11. Congratulations! You have now configured your ESP32 board with the Arduino Cloud IoT. Your
device will now appear in the list of devices.
Step 2: Creating a Thing
1. The next step is to create a Thing. This is done by navigating to the "Things" tab.
2. Go to the Thing tab.
Page No.:21
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

3. Then, we need to create a new Thing, by clicking on the "Create Thing" button. We can then
rename our Thing something appropriate to what we are doing, in this case we simply
chose ESP32 Project.
4. Creating a Thing.
5. Now, we need to link our device with our Thing. This is done by clicking on the button in
the "Device" section. This will open a window, where your ESP32 / ESP8266 should be
available to select.
6. Select ESP32 / ESP8266 device.
7. Once the device is linked, we need to create two variables: random_value and led_switch
8. Click on "Add variable" button. This will open a window where you need to fill in variable
information. Let's create the random_value first.
9. The data type is int, permission is read only and update policy is on change.
10. Once done, click on the "Add variable" button.
11. Adding the random_value variable.
12. Now, let's also add the led_switch variable.
13. The data type for this variable is boolean, the permission is read & write, and update policy
is on change.
14. Once done, click on the "Add variable" button.
15. Adding the led_switch variable.
Step 3:- Adding credentials
1. Now, we need to enter the credentials for our network, plus the secret key generated during the
device configuration.
2. First, click on the button in the "Network Section".
3. Open the credentials tab.
4. Then, enter the credentials (network name, network password and secret key).
5. Click "Save" when finished.
6. Entering the credentials.Programming the board
7. The next step is to program the board. To do so, we need to go to the "Sketch" tab.
8. Navigate to the sketch tab.
9. The code for this tutorial can be found in the snippet below. Upload it to the board by clicking on
the "Upload" button at the top left corner.
10. Creating a dashboard
11. Now that the sketch is running on the ESP32 / ESP8266 board, we can move on to the final step,
which is creating a dashboard.
12. First, navigate to the "Dashboards" tab.
13. Navigating to the dashboards tab.
14. Then, click on the "Build dashboard" button.
15. Click on the "Build dashboard" button.
16. To edit the dashboard, click on the pencil icon at the top left icon, select "Things" and search for
your Thing. Select it, and click on "Add widgets" as shown in the image below.
17. Adding widgets.
18. We should now have two widgets that are linked to your ESP32 / ESP8266 board.
random_value - whenever the random_value updates on the board, it also updates here.
led_switch - when we activate this switch, we turn ON the LED connected to the board
(pin 13).
19. Complete dashboard.

Page No.:22
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Circuit:

Conclusion:
In this tutorial, we went through the basics of setting up an ESP32 / ESP8266 microcontroller to
communicate with the Arduino Cloud IoT. We tested this out by sending a random value from the board
to the cloud, and by creating a switch that controls an LED from the cloud.

Page No.:23
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

8. Access the data pushed from sensor to cloud and apply any data analytics or visualization
services.

Aim: To Access the data pushed from sensor to cloud and apply any data analytics or visualization
services.

Sensor data analytics is an analytics platform built to analyse the data streamed or collected from
sensors and IoT devices. The data is analysed to give insight into the current status of this device using
different metrics (these metrics are set based on the organisation’s needs).

Typical applications:

You can use this breakout to monitor every aspect of your indoor environment. Its gas resistance
readings will react to changes in volatile organic compounds and can be combined with humidity
readings to give a measure of indoor air quality. Here is the list of typical applications:
– Indoor air quality
– Home automation and control
– Internet of things
– Weather forecast
– GPS enhancement (e.g. time-to-first-fix improvement, dead reckoning, slope detection)
– Indoor navigation (change of floor detection, elevator detection)
– Outdoor navigation, leisure and sports applications
– Vertical velocity indication (rise/sink speed)

Features:
• Measuring temperature, pressure, humidity, air quality sensor
• I2C interface, with address select via ADDR solder bridge (0x76 or 0x77)
• 3.3V or 5V compatible
• Reverse polarity protection
• Raspberry Pi-compatible pinout (pins 1, 3, 5, 7, 9)
• Compatible with all models of Raspberry Pi, and Arduino
• Python library
• Datasheet
• ESP32
Let us see how to fetch sensor data from BME680 on the NVIDIA Jetson Nano board and send it to
the Cloud Platform.

Hardware requirements:
• Jetson Nano: 2GB Model ($59)
• A 5V 4Amp charger
• 128GB SD card
• BME680 sensors

Software requirements:
• Jetson SD card image from NVIDIA
• Etcher software installed on your system
You can run RedisTimeSeries directly over an IoT Edge device. Follow the below steps to build
RedisTimeSeries Docker Image over Jetson Nano:

Page No.:24
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Verifying Docker version:

SSH to your Jetson Nano board equipped with BME680 sensor and install Docker
• pico@pico1:~$ docker version
• Client: Docker Engine – Community
• Version: 20.10.3
• API version: 1.41
• Go version: go1.13.15
• Git commit: 48d30b5
• Built: Fri Jan 29 14:33:34 2021
• OS/Arch: linux/arm64
• Context: default
• Experimental: true
• Server: Docker Engine – Community
Engine:
• Version: 20.10.6
• API version: 1.41 (minimum version 1.12)
• Go version: go1.13.15
• Git commit: 8728dd2
• Built: Fri Apr 9 22:43:42 2021
• OS/Arch: linux/arm64
• Experimental: false
• containerd: Version: 1.4.3
• GitCommit: 269548fa27e0089a8b8278fc4fc781d7f65a939b
nvidia:
• Version: 1.0.0-rc92
• GitCommit: ff819c7e9184c13b7c2607fe6c30ae19403a7aff
docker-init:
• Version: 0.19.0
• GitCommit: de40ad0

Verifying if Sensor is detected


i2cdetect -r -y 1
0 1 2 34 56 78 9 ab cd ef
00: -- -- -- -- -- -- -- -- -- -- -- -- --
10: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
20: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
30: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
40: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
50: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
60: -- -- -- -- -- -- -- -- -- -- -- -- -- -- -- --
70: -- -- -- -- -- --

Building Docker Image for RedisTimeSeries for Jetson Nano


git clone --recursive https://github.com/RedisTimeSeries/RedisTimeSeries.git
cd RedisTimeSeries.git
docker build -t ajeetraina/redistimeseries-jetson . -f Dockerfile.jetson.edge

Page No.:25
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Running RedisTimeSeries
docker run -dit -p 6379:6379 ajeetraina/redistimeseries-jetson

Verifying if RedisTimeSeries Module is loaded


redis-cli
127.0.0.1:6379> info modules
# Modules
module:name=timeseries,ver=999999,api=1,filters=0,usedby=[],using=[],options=[]
127.0.0.1:6379>

Clone the repository


$ git clone https://github.com/redis-developer/redis-datasets
$ cd redis-datasets/redistimeseries/realtime-sensor-jetson

Running Sensorload Script


sudo python3 sensorloader2.py --host localhost --port 6379

Running Grafana on Jetson Nano


docker run -d -e "GF_INSTALL_PLUGINS=redis-app" -p 3000:3000 grafana/grafana
There you go..
Point your browser to https://:3000. Use “admin” as username and password to log in to the Grafana
dashboard.

Click the Data Sources option on the left side of the Grafana dashboard to add a data source.

Page No.:26
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Type Temperature and choose Gauge under Visualization.

Click Apply and you should be able to see the temperature dashboard as shown here

Follow the same process for pressure (ts:pressure) and humidity (ts:humidity), and add them to the
dashboard. You should be able to see the complete dashboard readings for temperature, humidity, and
pressure. Looks amazing. Isn’t it?

Page No.:31
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

9. Create a Mobile App to control an Actuator.

Aim: To create a Mobile App to control the moment of the door using Actuator connecting through
Bluetooth.

Components Required:
Hardware:
• Arduino Uno (OR any Arduino Board of your choice)
• HC05 Bluetooth Module
• Micro Servo Motor with Accessories
• Male-to-Male Jumper Cable
• Male-to-Female Jumper Cable.
Software:
• Dabble
• PictoBlox

Connecting Bluetooth Module and Servo Motor to Uno:

Let’s connect the Bluetooth module(HC05) to Uno. It will help us pair our Smartphone with the board via
Bluetooth.
• Connect the VCC pin to Uno’s 5V pin
• Connect the GND pin to Uno’s GND pin
• Connect the Transmit pin (Tx) to Uno’s Digital pin 2
• Connect the Receive pin to Uno’s PWM pin 3
Now, let’s connect the servo to Uno.
• Connect the servo’s brown wire to Uno’s GND pin
• Connect the red wire to Uno’s VIN pin
• Connect the orange wire to Uno’s PWM pin 5

Interfacing Arduino Uno to PictoBlox:


• First, open PictoBlox.
• Then, connect Uno to your computer via a USB cable.
• Next, click on the Board button in the toolbar and select Arduino Uno from the drop-down menu.
• Then, click on the Connect button and select the appropriate port.

Controlling Servo Motor With a Smartphone Via Dabble:


Here, we are going to use the terminal module of Dabble. Let's write the script in PictoBlox.

Page No.:32
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

We are going to use the is data from terminal block to into the if condition to check whether the
command given is close or open:

• Use the set servo block and set the angle to zero degrees.
• Now, to open the door, we must send the command ‘open’. Duplicate the entire set of blocks and
stack the two. and write open in the white space of the second is data from terminal block and
change the servo angle to 45 degrees.
• Use the forever block to run the script forever. Add a set bluetooth baud rate to block to set
Bluetooth's baudrate. And write drop the hat to execute the script.

Pairing Dabble With UNO

Page No.:33
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

• Install Dabble from Play Store and open it in your Smartphone.


• Next, click on the connect icon.
• A dialogue box will appear on the screen asking for permission to turn on Bluetooth. Click on
‘Allow’.Once you do so, a list of nearby devices will appear. Select your device’s name.
In case you don’t see it on the list, go to the Bluetooth settings of your Smartphone and search for it
there.If your Smartphone asks for a password to pair it with the device, enter the default password.
For HC-05 and HC-06, it is 0000 or 1234. For HM-10 it is 000000 or 123456.
• A notification will appear in the drop-down menu of the phone once the connection is made.
• Now, open the Terminal module and you’re ready to go!

Final Output:

As soon as you type 'open' the servo angle will change to 45 degrees and when the command is close, set
the servo angle to 0 degrees.

Opening and Closing the Door Using Smartphone:

Page No.:34
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

10. Design an IoT Based Air Pollution Control System the air pollution by measuring carbon
monoxide, ammonia, etc and gives alarm or sends message when the pollution level is more than
permitted range.
In this project we are going to make an IoT Based Air Pollution Monitoring System in which we
will monitor the Air Quality over a webserver using internet and will trigger a alarm when the air quality
goes down beyond a certain level, means when there are sufficient amount of harmful gases are present in
the air like CO2, smoke, alcohol, benzene and NH3. It will show the air quality in PPM on the LCD and
as well as on webpage so that we can monitor it very easily.

Previously we have built the LPG detector using MQ6 sensor, Smoke detector using MQ2
sensor, and Air Quality Analyser but this time we have used MQ135 sensor as the air quality sensor
which is the best choice for monitoring Air Quality as it can detects most harmful gases and can measure
their amount accurately. In this IOT project, you can monitor the pollution level from anywhere using
your computer or mobile. We can install this system anywhere and can also trigger some device when
pollution goes beyond some level, like we can switch on the Exhaust fan or can send alert SMS/mail to
the user.

Required Components:
• MQ135 Gas sensor
• Arduino Uno
• Wi-Fi module ESP8266
• 16X2 LCD
• Breadboard
• 10K potentiometer
• 1K ohm resistors
• 220 ohm resistor
• Buzze

Circuit Diagram and Explanation:


First of all we will connect the ESP8266 with the Arduino. ESP8266 runs on 3.3V and if you will
give it 5V from the Arduino then it won’t work properly and it may get damage. Connect the VCC and
the CH_PD to the 3.3V pin of Arduino. The RX pin of ESP8266 works on 3.3V and it will not
communicate with the Arduino when we will connect it directly to the Arduino. So, we will have to make
a voltage divider for it which will convert the 5V into 3.3V. This can be done by connecting three
resistors in series like we did in the circuit. Connect the TX pin of the ESP8266 to the pin 10 of the
Arduino and the RX pin of the esp8266 to the pin 9 of Arduino through the resistors.
ESP8266 Wi-Fi module gives your projects access to Wi-Fi or internet. It is a very cheap device
and make your projects very powerful. It can communicate with any microcontroller and it is the most
leading devices in the IOT platform. Learn more about using ESP8266 with Arduino here.
Then we will connect the MQ135 sensor with the Arduino. Connect the VCC and the ground pin
of the sensor to the 5V and ground of the Arduino and the Analog pin of sensor to the A0 of the Arduino.
• Connect a buzzer to the pin 8 of the Arduino which will start to beep when the condition
becomes true.
In last, we will connect LCD with the Arduino. The connections of the LCD are as follows
• Connect pin 1 (VEE) to the ground.
• Connect pin 2 (VDD or VCC) to the 5V.
• Connect pin 3 (V0) to the middle pin of the 10K potentiometer and connect the other two ends of
the potentiometer to the VCC and the GND. The potentiometer is used to control the screen
contrast of the LCD. Potentiometer of values other than 10K will work too.

Page No.:35
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

• Connect pin 4 (RS) to the pin 12 of the Arduino.


• Connect pin 5 (Read/Write) to the ground of Arduino. This pin is not often used so we will
connect it to the ground.
• Connect pin 6 (E) to the pin 11 of the Arduino. The RS and E pin are the control pins which are
used to send data and characters.
The following four pins are data pins which are used to communicate with the Arduino.
• Connect pin 11 (D4) to pin 5 of Arduino.
• Connect pin 12 (D5) to pin 4 of Arduino.
• Connect pin 13 (D6) to pin 3 of Arduino.
• Connect pin 14 (D7) to pin 2 of Arduino.
• Connect pin 15 to the VCC through the 220 ohm resistor. The resistor will be used to set the back
light brightness. Larger values will make the back light much more darker.
• Connect pin 16 to the Ground.

Working Explanation:
The MQ135 sensor can sense NH3, NOx, alcohol, Benzene, smoke, CO2 and some other gases,
so it is perfect gas sensor for our Air Quality Monitoring Project. When we will connect it to Arduino
then it will sense the gases, and we will get the Pollution level in PPM (parts per million). MQ135 gas
sensor gives the output in form of voltage levels and we need to convert it into PPM. So for converting
the output in PPM, here we have used a library for MQ135 sensor, it is explained in detail in “Code
Explanation” section below.
Sensor was giving us value of 90 when there was no gas near it and the safe level of air quality is
350 PPM and it should not exceed 1000 PPM. When it exceeds the limit of 1000 PPM, then it starts cause
Headaches, sleepiness and stagnant, stale, stuffy air and if exceeds beyond 2000 PPM then it can cause
increased heart rate and many other diseases.
When the value will be less than 1000 PPM, then the LCD and webpage will display “Fresh
Air”. Whenever the value will increase 1000 PPM, then the buzzer will start beeping and the LCD and
webpage will display “Poor Air, Open Windows”. If it will increase 2000 then the buzzer will keep
beeping and the LCD and webpage will display “Danger! Move to fresh Air”.

Page No.:36
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

11. Design an iot based system which measures the physical and chemical properties of the water
and displays the measured values.

Aim: measuring the physical and chemical properties of water and displays the measured values.
Components:
• Temperature sensor
• Ph sensor
• Flow sensor
• Turbidity sensor
• Arduino board
• Wifi module
• Bread board
• Display
• Connecting wires
• Physical properties of water:
• Appearance
• Density
• Viscosity
• Boiling Poin
• Freezing Point
Chemical properties of water:
• Amphoteric nature
• Redox reactions
• Hydrolysis reaction

Temperature sensor:
Water Temperature indicates how water is hot or cold. The
range of DS18B20 temperature sensor is -55 to +125 °C. This
temperature sensor is digital type which gives accurate reading.

Flow sensor:
Flow sensor is used to measure the flow of water through the flow
sensor. This sensor basically consists of a plastic valve body, a rotor and a
Hall Effect sensor. The pinwheel rotor rotates when water / liquid flows
through the valve and its speed will be directly proportional to the flow rate.
The Hall Effect sensor will provide an electrical pulse with every revolution
of the pinwheel rotor.

Arduino Uno:
Arduino is a microcontroller board based on the ATmega328P. It has
14 digital input/output pins (of which 6 can be used as PWM outputs), 6
analog inputs, a 16 MHz quartz crystal, a USB connection, a power jack, an
ICSP header and a reset button. It contains everything needed to support the
microcontroller. Arduino Software (IDE) were the reference versions of
Arduino, now evolved to newer releases. The Uno board is the first in a
series of USB Arduino boards, and the reference model for the Arduino
platform; for an extensive list of current, past or outdated boards see the
Arduino index of boards.

Page No.:37
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Wifi module:
The ESP8266 WiFi Module is a self contained SOC with
integrated TCP/IP protocol stack that can give any microcontroller
access to your WiFi network. The ESP8266 is capable of either hosting
an application or offloading all Wi-Fi networking functions from
another application processor. Each ESP8266 module comes pre-
programmed with an AT command set firmware. The ESP8266 module
is an extremely cost effective board with a huge, and ever growing,
community.

Block diagram of water monitoring system:

Schematic circuit with its working:

Page No.:38
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Procedure:
Four sensors (Temperature, Turbidity, pH ,Moisture) are connected to Raspberry Pi as shown in
the Figure 9. The digital temperature sensor DS18B20, which is a one wire digital device . So, it is
directly connected to Raspberry Pi along with a 4.7k Ohm resistor which is required as a pull up from the
DATA to VCC line when using the sensor. The turbidity sensor SEN-0189 is an analog sensor which
senses the clarity of the water.
Raspberry Pi supports only digital sensors and it will take only digital values. Therefore in this
approach, an analog to digital converter is used (ADC- MCP3008) to convert analog signals into digital
signals. Sensor is connected to channel 1 of the ADC to convert the analog value to digital. Later, digital
value input to Raspberry Pi. Similarly, pH electrode BNCE201 is also an analog sensor, therefore this
sensor is connected to channel 2 of ADC .and also Moisture sensor is connected to channel 3 of ADC to .
Here, turbidity sensor , pH electrode and Moisture sensor are connected to ADC. ADC is
connected to Raspberry Pi . The Ethernet cable is connected to Raspberry Pi to send the information
control centre. The breadboard is used for the connections. Figure 9:Connection of Sensors to Pi The
Temperature, pH and Turbidity values of the water is displayed along with its measuring units in the
Terminal (Command Prompt) of the Raspberry Pi.
It also shows the SMS notification sent to the registered user when there is a variation in the
water quality and in moisture

SYSTEM DESIGN OF MODEL:

Page No.:39
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

12. Identify a problem in your local area or college which can be solved by integrating the things
you learned and create a prototype to solve it.

AIM: Identify a problem in your local area or college which can be solved
integrating the things you learned and create a prototype to solve it.

COMPONENTS:
• LED
• Battery clipper
• Battery
• LDR sensor
• Transistor Bc547
• Resistor

PROCEDURE:
Step 1: Take all components
Step 2 : Pins of Bc547 Transistor As pin-1 is Collector of this transistor,Pin-2 is Base and Pin-3 is
Emmiter of this transistor.
Step 3: Connect LED Connect LED to the transistor. Connect -ve pin of LED to collector pin of the
transistor
Step 4: Solder LDR Solder LDR to Base pin and emmiter pin of the transistor
Step 5: Connect 20K Resistor Next solder 20K resistor to base pin of transistor and in the +ve pin of
LED
Step 6: Solder Battery Clipper Wire Now we have to solder battery clipper wire to the circuit.
Solder +ve wire of battery clipper to +ve pin of LED and-ve wire of battery clipper to emmiter pin the
transistor
Step 7: How to Use This Automatic Street Light Connect battery to the battery clipper and observe that
when light is on L sensor then LED is not glowing and when light is not on the LDR then LED glowing.

CIRCUIT:
Without using Arduino:

Working:
When sunlight falls on LDR .(LDR works on the property on Photo conductivity where it gives
less resistance in high light intensity and high resistance in low light intensity.)
it gives high resistance at night and low resistance in day. LDRs are made from semiconductor materials
like cadmium sulphide, which help the lights to have their light sensitive properties. When light falls on
the surface of LDR, the conductance of the element increases or the resistance of the LDR in the control
Page No.:40
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

circuit falls. When it becomes dark, the resistance of the LDR increases and switches the light on.

With using Arduino:


When sunlight is high

When Sunlight is low

Page No.:41
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

13.Design a business model canvas for a digital display.

Aim: To Design a business model canvas for a digital display.

Components Required:

Hardware Specifications:
• Power Supply
• Rectifier
• Regulator
• LCD
• wifi module
• Atmega Microcontroller
• Wifi Module
• 4 Rf Transmitters
• 2 Rf Receivers
• Resistors
• Capacitors
• Diodes

Software Specifications:
• Python compiler
• Programming Language: Python
• IOTGecko

Theory:

The GPS systems are todays most well known location tracking systems. Well these systems are
not capable of pinpointing exact locations or locations of an entity within a building or on a particular
floor or room. So here we propose a smart asset tracking system that allows to track location of objects,
goods, personnel within a building or any facility.

Our proposed system makes use of rf technology along with IOT to achieve this system. The
system has the capability to pinpoint the location of any entity to exact room it is currently located in.
The system uses mini rf circuits to be used as tracking devices. We use tracking microcontroller based
circuits to track those rf circuits.

The tracker circuits are battery powered circuits to be mounted on objects/entities. The
monitoring circuits are to be placed in individual rooms. Now as soon as any tracker objects enter any
room the tracker circuits come in 2-3 meters range of the monitoring circuit for that room.

The monitoring system now transmits the location of that tracker circuit to the online system. We
here use IOTGecko to handle the IOT tracking part. The transmitted data is now displayed by IOTGecko
to pinpoint which room a particular object/entity is located in.

Page No.:42
J.N.T.U. College of Enginerring
Anantapur. Date: ………………………
____________________________________________________________________________________

Circuit Diagram:

Page No.:43

You might also like