Iot Lab Manual 2
Iot Lab Manual 2
Iot Lab Manual 2
Date:
1. Controlling actuators through Serial Monitor. Creating different led patterns and controlling them
AIM: Controlling actuators through Serial Monitor. Creating different led patterns and controlling them
Description:
An LDR or light dependent resistor is also known as photo resistor, photocell, photoconductor. It is a
one type of resistor whose resistance varies depending on the amount of light falling on its surface.
When the light falls on the surface, then the resistance changes. When the LDR is in darkness, then it
can be used to turn ON a light or to turn OFF a light.
list of components:
Sno Component Description Port Names Board
procedure:
a. Connect the micro-USB cable to the Arduino Nano in the Acenaar kit, and UPLOAD the
written C++ code using Arduino IDE.
b. Connection of the peripherals: Connect the LDR module (L) to Control unit (4) using the 4
pinJST connector .
c. Check the Analog Sensor LDR values in Serial Monitor of Arduino IDE.
Sample Code:
1
Experiment number:
Date:
voidsetup() {
Serial.begin(9600);
}
voidloop() {
sensorValue=analogRead(sensorPin);
Serial.print(sensorValue); //printsthevaluescomingfromthesensor onthescreen
else
Serial.println(" High Light Intensity");
delay(1000);
}
2
Experiment number:
Date:
OUTPUT:
Result:
3
Experiment number:
Date:
2. Calculate the distance to an object with the help of an ultrasonic sensor and display it on an LCD
Aim: Calculate the distance to an object with the help of an ultrasonic sensor and display it on an LCD
Description: The IR Sensor Module or infrared (IR) sensor is a basic and most popular sensor in
electronics. It is used in wireless technology like remote controlling functions and detection of
surrounding objects/ obstacles. IR sensors mainly consist of an Infrared(IR) LED and a Photodiode, this
pair is generally called IR pair. An IR LED is a special purpose LED, it emits infrared rays ranging from
700 nm to 1 mm wavelength. These types of rays are invisible to our eyes. In contrast, a photodiode or
IR Receiver LED detects the infrared rays. Example is shown below.
list of components
Date:
procedure:
Connect the micro-USB cable to the Arduino Nano. And UPLOAD the C++ code using
Arduino IDE.
Connection of the peripherals.: Connect the IR sensor module(F) to the control unit (6) using the4
pin JST connecting wires.
Check the Digital Sensor of IR sensor values in Serial Monitor of Arduino IDE
Sample Code
int IRPin=10;
int hasObstacle=LOW; //LOWMEANSNOOBSTACLE
voidsetup() {
pinMode(IRPin,INPUT);
Serial.begin(9600);
}
voidloop() {
hasObstacle=digitalRead(IRPin);
if(hasObstacle==HIGH)
Serial.println("Object Not Detected");
else{
Serial.println("Object Detected");
}
delay(200);
}
5
Experiment number:
Date:
OUTPUT:
Result:
6
Experiment number:
Date:
.
03 Controlling relay state based on ambient light levels using LDR sensor.
AIM : Controlling relay state based on ambient light levels using LDR sensor.
An audio signalling device like a beeper or buzzer may be electromechanical or piezoelectric type. The main
function of this is to convert the electrical signal to sound. Generally, it is powered through DC voltage and
used in timers, alarm devices, printers, computers, etc.
The pin configuration of the buzzer is shown above. It includes two pins namely positive and
negative.The positive terminal of this is represented with the ‘+’ symbol or a longer terminal. This
terminal is powered through 6Volts whereas the negative terminal is represented with the ‘-‘symbol or
short terminal and it is connected to the GND terminal.
List of components:
Date:
Procedure:
Connect the micro-USB cable to the Arduino Nano in the kit, and UPLOAD the written C++ code using Arduino
IDE. (Note: ENSURE Connector – 11 is removed on Control unit while uploadingthe code. Instal HC-05
module libraries.)
• Connection of the peripherals: Connect the Buzzer module (C) to control unit (7).
• Connect the HC-05 module(E) to control unit (06).
#include<SoftwareSerial.h>
int bluetoothTx =10; // bluetoothtx to10 pin
int bluetoothRx =11; // bluetoothrx to11 pin
int Buzzer=8;
int value=0;
SoftwareSerialbluetooth(bluetoothTx,bluetoothRx);
voidsetup()
{
Serial.begin(9600); // set thebaudrateto9600, sameshouldbeof your Serial Monitor
bluetooth.begin(9600);
pinMode(Buzzer,OUTPUT);
delay(100);
}
voidloop()
{
8
Experiment number:
Date:
if (value==0) // LOWvaluecommunicatedby bluetoothmodule
{
digitalWrite(Buzzer, LOW); //BuzzerisswitchedOFF
Serial.print(" Buzzer OFFstate");
}elseif (value==1) //HIGHvaluecommunicatedby bluetoothmodule
{
digitalWrite(Buzzer,HIGH); // Buzzer isturned ON
Serial.print(" Buzzer ONstate");
}
delay(100);
}
OUTPUT:
Input: When we enter the ‘0’ value in bluetooth terminal app then we get the result as
9
Experiment number:
Date:
OUTPUT:
Result:
10
Experiment number:
Date:
B . Basic Burglar alarm security system with the help of PIR sensor and buzzer.
Based on the width of the pulse, the position of the servo motor varies. There are several ways in which
we can generate the PWM Signal to control a Servo Motor. The traditional way is to use fully analog
circuits like the 555 Timer IC and using a potentiometer to control the width of the pulse. But with the
help of microcontrollers like Arduino (ATmega328 to be precise), you can generate PWM
Signals without any external components.
The main concept of the Bluetooth Controlled Servo Motor using Arduino project is very simple. Control
the Servo Motor using PWM Signals generated by Arduino. The inputs to the Arduino are given from an
Android Smart Phone over Bluetooth Communication in terms of angles for servo motor.
List of components:
11
Experiment number:
Date:
procedure:
connect the micro-USB cable to the Arduino Nano in the kit, UPLOAD the written C++ code using
Arduino IDE. (Note: ENSURE to Remove connection on Connector – 11 in Control unitwhile
uploading the code.), also make sure you already installed the respected libraries.
• Connection of the peripherals: Connect the Servo motor pin to pins as following format.
S.No Colour Pins
• Connect the HC-05 module(E) to control unit (6) and servo motor –(A) to control unit (10).
Sample code:
#include <SoftwareSerial.h>
include <Servo.h>
Servo myservo;
SoftwareSerial Bluetooth(10, 11);
void setup()
{
myservo.attach(3);
Bluetooth.begin(9600);
Serial.begin(9600);
Serial.print(" Welcome To\n");
Serial.print("AcenAArTechnology\n");
delay(5000);
}
void loop() {
if(Bluetooth.available())
{
char Angle = Bluetooth.read();
Serial.println(Angle);
Angle=Angle-48;
if(Angle==1)
{
myservo.write(0);
Serial.print(" 0 degree ");
12
Experiment number:
Date:
}
else if(Angle==2)
{
myservo.write(45);
Serial.print(" 45 degree ");
}
else if(Angle==3)
{
myservo.write(90);
Serial.print(" 90 degree ");
}
else if(Angle==4)
{
myservo.write(135);
Serial.print(" 135 degree ");
}
else if(Angle==5)
{
myservo.write(180);
Serial.print(" 180 degree ");
}
}
}
13
Experiment number:
Date:
OUTPUT:
Result:
14
Experiment number:
Date:
c. Displaying humidity and temperature values on LCD
List of components:
Procedure:
• Connect the micro-USB cable to the Arduino Nano in the kit, and UPLOAD the written C++
codeusing Arduino IDE. (Note: ENSURE Connector – 11 is Remove on Connector – 11
while uploading the code.)
• Connection of the peripherals: Connect the ultrasonic module (H) to control unit (8).
• Connect the Wi-Fi module(D) to control unit (11).
15
Experiment number:
Date:
Sample code:
include<WiFiEsp.h>
include<WiFiEspUdp.h>
include<NewPing.h>
Date:
unsignedlongstartMs=millis();
while(!Udp.available() &&(millis() -startMs) <UDP_TIMEOUT)
{} int packetSize=Udp.parsePacket();
Serial.println(packetSize); if
(packetSize) {
Serial.print("Receivedpacket of size");
Serial.println(packetSize);
Serial.print("From");
IPAddressremoteIp=Udp.remoteIP();
Serial.print(remoteIp);
Serial.print(", port ");
Serial.println(Udp.remotePort());
int len=Udp.read(packetBuffer, 255); if
(len>0) {
packetBuffer[len] =0;
}
Serial.println("Contents:");
Serial.println(packetBuffer);
Udp.beginPacket(Udp.remoteIP(),Udp.remotePort());
Udp.write(ReplyBuffer);
Udp.endPacket();
}
//Udp.write("HellofromAcenAArBoard");delay(500);
}
voidsendToServer(char*ntpSrv){memset(packetBuffer,
0, NTP_PACKET_SIZE);
sprintf(packetBuffer, "Distanceincm:%d", sonar.ping_cm());
//strcpy(packetBuffer,"HellofromAcenAArUDPClient");
Udp.beginPacket(ntpSrv, 9001);
Udp.write(packetBuffer,strlen(packetBuffer)+1);
Udp.endPacket();
}
17
Experiment number:
Date:
output:
Result:
Date:
Aim: Controlling relay state based on input from IR sensors
• ThingSpeak is IoT Cloud platform where you can send sensor data to the cloud. You can also
analyze and visualize your data with MATLAB or other software, including making your own
applications.
• The ThingSpeak service is operated by MathWorks. In order to sign up for ThingSpeak, you must
create a new MathWorks Account or log in to your existing MathWorks Account.
• ThingSpeak is free for small non-commercial projects.
• ThingSpeak includes a Web Service (REST API) that lets you collect and store sensor data in the
cloud and develop Internet of Things applications. It works with Arduino, Raspberry Pi and
MATLAB (premade libraries and APIs exists) But it should work with all kind of Programming
Languages, since it uses a REST API and HTTP.
URL : https://thingspeak.com/
If you do not have a ThingSpeak account create one. Once you have a ThingSpeak account
login to your account.
19
Experiment number:
Date:
Step 2 : Create a new Account if you don’t have any, by clicking on the button “create one” as shown in below
image.
Create MathWorks Account by entering the below details and select the time zone.
20
Experiment number:
Date:
Step 3: Link your Matlab account to your thinkspeak if don’t have create one.
After entering your Email ID account, login in your EMAIL and click on “submit”.
Step 4: Create a new channel by clicking on the button as shown in below image - A channel is the
space for your data. Where you can store and retrieve data. A channel can have maximum 8 fields. It
means you can store 8 different data to a channel.
21
Experiment number:
Date:
Step 5: Enter basic details of the channel, here we are creating channel to store data from one sensor
so we need only one field.
22
Experiment number:
Date:
And click on the “save channel” as shown in the below image.
Channel Id is the identity of your channel. Note down this ID, this ID used in the code for data
communication.
23
Experiment number:
Date:
Step 6: API Keys API ( Application Programming Interface ) keys are the keys to access to your
channel. In simple language you can understand that these are password to access your channel.
You can access your channel in two ways
1. To update channel / data logging: API Write Key will be used to access in this mode.
2. To retrieve data: API Read Key will be used to access in this mode. Click on the API tab to know your
keys.
24
Experiment number:
Date:
procedure:
Here we measure the light intensity values using LDR sensor that is available on the Acenaar
IOT trainer kit and push this values into the cloud (think speak cloud).
We display the light intensity values using the fields of Thinkspeak cloud, light intensity values are
represented in a graph format and we will use the lamp widget to show status.
• Connect the micro-USB cable to the Arduino Nano in the Acenaar kit, and UPLOAD the
written C++ code using Arduino IDE. (Note: ENSURE Connector – 11 is removed on
Control unit whileuploading the code.)
• Connection of the peripherals: Connect the LDR module (L) to the control unit (4) using the 4
pin JST connecting wires.
• Connect the ESP module(D) to the control unit (8) using the 4 pin jst connecting wires in the
Acenaar IOT kit.
Sample Code:
include"WiFiEsp.h"
include"secrets.h"
include "ThingSpeak.h" // alwaysincludethingspeak header file
after other header filesand custommacros
Date:
defineESP_BAUDRATE115200
endif
unsignedlongmyChannelNumber=SECRET_CH_ID;const
char *myWriteAPIKey =SECRET_WRITE_APIKEY;
voidsetup() {
Serial.begin(115200); //Initializeserial
while(!Serial){
; // wait for serial port toconnect. Neededfor LeonardonativeUSBport only
}
while(!Serial) {
; // wait for serial port toconnect. Neededfor LeonardonativeUSBport only
}
Serial.print("Searchingfor ESP8266...");
// initializeESPmodule
WiFi.init(&Serial1);
ThingSpeak.begin(client); // InitializeThingSpeak
}
voidloop() {
Date:
Serial.println("\nConnected.");
}
int ldrValue=analogRead(ldrPin);
Serial.print("SettingESP8266 baudrateto");
Serial.print(baudrate);
Serial.println("...");
Serial1.begin(baudrate);
}
Secrets-
// Usethisfiletostoreall of theprivatecredentials
// andconnectiondetails
27
Experiment number:
Date:
OUTPUT:
28
Experiment number:
Date:
off state lamp for 501 value.
Result:
29
Experiment number:
Date:
C. Advanced burglar alarm security system with the help of PIR sensor
The ESP 01 ESP8266 Serial WIFI Wireless Transceiver Module is a self-contained SOC with
integrated TCP/IP protocol stack that can give any microcontroller access to your Wi-Fi network. Each
ESP8266 module comes pre- programmed with an AT command set firmware. This module has a
powerful enough on-board processing and storage capability that allows it to be integrated with the
sensors and other application-specific devices through its GPIOs with minimal development up-front
and minimal loading during runtime.
List of components:
Sno Component Description Port Names Board
Procedure:
30
Experiment number:
Date:
Step 1:
Connect the micro-USB cable to the Arduino Nano in the kit, and UPLOAD the written C++
codeusing Arduino IDE. (Note: ENSURE Connector – 11 is REMOVED on Control unit
while uploading the code.)
also make sure you already installed the ESP-01 libraries.
Connection of the peripherals: Connect the buzzer (C) to the control unit (7)
Connect the ESP-01 module(D) to control unit (8) in the Acenaar IOT kit.
Step 2:
Ensure first, both Arduino nano board and Personal Computer should be
connected to same local network.
Create account in ThingSpeak and create new channel ( ignore if done in
previous experiment, use same account and create new channel for controlling)
Note API READ and WRITE keys , which has to be place/change in code.
Copy write channel feed URL link as shown in below figure
For controlling actuator OPEN any Browser and enter your URL link
For example :
https://api.thingspeak.com/update?api_key=MXY9OS6AQ9ILM5I0&field1=
0
For controlling ON and OFF we need to change last character to ”0” and “1”
31
Experiment number:
Date:
Step 3: code
include"WiFiEsp.h"
include"secrets.h"
//custommacros
WiFiEspClientclient;
else
defineESP_BAUDRATE115200
endif
// Weatherstationchannel details
unsignedlongmyChannelNumber=SECRET_CH_ID;
intBuzzer_status;const int
buzzerPin=8;
voidsetup()
Serial.begin(115200); Serial1.begin(19200);
Serial.print(F("SearchingforESP8266..."));
WiFi.init(&Serial1);
32
Experiment number:
Date:
// checkfor thepresenceof theshield if
(WiFi.status()==WL_NO_SHIELD){
Serial.println(F("ESP8266not present"));
//don'tcontinuewhile(true);
Serial.println("foundit!");
ThingSpeak.begin(client); // InitializeThingSpeak
pinMode(buzzerPin,OUTPUT);
voidloop()
if (WiFi.status() !=WL_CONNECTED)
Serial.print(F("AttemptingtoconnecttoSSID:"));
Serial.println(ssid);
while(WiFi.status()!=WL_CONNECTED)
WiFi.begin(ssid,pass);
Serial.print(".");
delay(5000);
Serial.println(F("\nConnected"));
//readfromchannel
statusCode=ThingSpeak.getLastReadStatus();
Serial.println(statusCode);
33
Experiment number:
Date:
if (statusCode==200)
else
Serial.println(F("Problemreadingchannel"));
if(Buzzer_status==1)
{Serial.print("Buzzeron");
digitalWrite(buzzerPin,HIGH);
elseif(Buzzer_status==0)
{Serial.print("Buzzeroff");digitalWrite(buzzerPin,LOW);
delay(15000); // Noneedtoreadthecountertoooften.
Secrets-
// Usethisfiletostoreall of theprivatecredentials
// andconnectiondetails
34
Experiment number:
Date:
OUTPUT:
Result:
35
Experiment number:
Date:
05. Upload humidity & temperature data to Thing Speak, periodically logging ambient light level to
Thing Speak
Aim: Upload humidity & temperature data to Thing Speak, periodically logging ambient light level to
Thing Speak
List of components:
procedure:
Here we measure the Temperature and the Humidity using DHT-11sensor. We PUSH values to
the cloud (ThingSpeak cloud) and represent the values using the FIELDS in the Thinkspeak, in
graphical format, here we use two fields one for Temperature and one for Humidity.
• Connect the micro-USB cable to the Arduino Nano . and UPLOAD the written C++ code using
Arduino IDE.
36
Experiment number:
Date:
• Connection of the peripherals: Connect the DHT-11 module (I) to the control unit (5) using the4
pin JST connector.
• Connect the ESP module(D) to the control unit (8) using the 4 pin JST connector.
Sample code-
include"WiFiEsp.h"
include"secrets.h"
include"ThingSpeak.h" // alwaysincludethingspeak headerfileafter otherheaderfilesandcustommacros
include<DHT.h>
defineDHTPIN12 // DHTdatapinconnectedtoArduinopin5
defineDHTTYPEDHT11 // DHT11
(DHTSensorType)
DHTdht(DHTPIN, DHTTYPE); // InitializetheDHTsensor
unsignedlongmyChannelNumber=SECRET_CH_ID;const
char*myWriteAPIKey =SECRET_WRITE_APIKEY;
// Initializeourvaluesfloat t;
float h;
voidsetup() {
//Initializeserial andwait forport toopen
Serial.begin(115200); // Initializeserial while(!Serial){
; // wait forserial port toconnect. NeededforLeonardonativeUSBport only
}
// initializeserial forESPmodule
setEspBaudRate(ESP_BAUDRATE);
while(!Serial) {
; // wait forserial port toconnect. NeededforLeonardonativeUSBport only
}
37
Experiment number:
Date:
Serial.print("SearchingforESP8266...");
// initializeESPmodule
WiFi.init(&Serial1);
// checkforthepresenceof theshield if
(WiFi.status() ==WL_NO_SHIELD) {
Serial.println("WiFi shieldnot present");
// don't continue
//while(true);
}
Serial.println("foundit!");
ThingSpeak.begin(client); // InitializeThingSpeak
dht.begin();
}
voidloop() {
Date:
Serial.print(F("°C"));
// set thefieldswiththevalues
ThingSpeak.setField(1,h);
ThingSpeak.setField(2, t);
// set thestatus
// ThingSpeak.setStatus(myStatus);
// writetotheThingSpeak channel
intx=ThingSpeak.writeFields(myChannelNumber,myWriteAPIKey);
if(x==200){
Serial.println("Channel updatesuccessful.");
}
else{
Serial.println("Problemupdatingchannel. HTTPerrorcode" +String(x));
}
Serial.print("SettingESP8266baudrateto");
Serial.print(baudrate);
Serial.println("...");
for(int i =0; i <6; i++){
Serial1.begin(rates[i]);
delay(100);
Serial1.print("AT+UART_DEF=
");Serial1.print(baudrate);
Serial1.print(",8,1,0,0\r\n");
delay(100);
}
Serial1.begin(baudrate);
}
Secrets-
// Usethisfiletostoreall of theprivatecredentials
// andconnectiondetails
39
Experiment number:
Date:
OUTPUT:
40
Experiment number:
Date:
RESULT:
41
Experiment number:
Date:
List Of Components:
42
Experiment number:
Date:
Procedure:
43
Experiment number:
Date:
44
Experiment number:
Date:
45
Experiment number:
Date:
46
Experiment number:
Date:
Design Block
• Connect the micro-USB cable to the Arduino Nano in the kit, UPLOAD the written C++ code
using Arduino IDE. (Note: ENSURE to REMOVE connection on Connector – 11 in
Control unit while uploading the code.), also make sure you already installed the respected
47
Experiment number:
Date:
libraries.
• Connection of the peripherals: Connect the Servo motor pin to pins as followingformat.
S.No Colour Pins
• Connect the HC-05 module(E) to control unit (6) and servo motor –(A) to controlunit (10).
Sample Code
Step3:ArduinoCode
SoftwareSerialbluetooth(bluetoothTx,bluetoothRx);voidsetup()
{
//SetupBluetoothserial connectiontoandroid
bluetooth.begin(9600);
}
voidloop()
{
//Readfrombluetoothandwritetousbserial
if(bluetooth.available()>0 ) // receivenumber frombluetooth
{
int servopos=bluetooth.read(); // savethereceivednumber toservopos
48
Experiment number:
Date:
Serial.println(servopos); // serial print servoposcurrent number receivedfrombluetooth
myservo.write(servopos); // roatetheservotheanglereceivedfromtheandroidapp
Serial.print("ServoPosition");
}
}
49
Experiment number:
Date:
OUTPUT:
Result:
50
Experiment number:
Date:
Exp No:7. Introduction to HTTP, hosting basics from various actuators
The MQ-135 Gas sensor can detect gases like Ammonia (NH3), sulfur (S), Benzene (C6H6), CO2, and
other harmful gases and smoke. Similar to other MQ series gas sensor, this sensor also has a digital and
analog output pin. When the level of these gases go beyond a threshold limit in the air the digital pin goes
high. This threshold value can be set by using the on-board potentiometer. The analog output pin, outputs
an analog voltage which can be used to approximate the level of these gases in the atmosphere.
The MQ135 air quality sensor module operates at 5V and consumes around 150mA. It requires some
pre-heating before it could actually give accurate results.
Note : That all MQ sensors have to be powered up for a pre-heat duration for the sensor to
warm up before it can start working. This pre-heat time is normally between 30 seconds to a
couple of minutes. When you power up the module the power LED will turn on, leave the module in
this statetill the pre-heat duration is completed.
The digital output pin of the sensor can be used to detect harmful gases in the environment. The
sensitivity of the digital pin can be controlled by using the 10k potentiometer. If the gas is detected the
indicator LED D0 will turn on and the digital pin will go from logic high to logic low (0V). The
LM393 Op-Amp Comparator IC is used to compare the actual gas value with the value set using the
potentiometer. If the actual gas value increases than the set value then the digital output pin gets low.
Because of the onboard LM393 comparator IC the MQ135 Gas sensor module can also be used without
the need of an external microcontroller. Simply power up the module and set the sensitivity of the
digital pin using the potentiometer, then when the module detects the gas the digital pin will golow.
This digital pin can directly be used to drive a buzzer or LED with the help of simple transistors.
51
Experiment number:
Date:
Measure PPM Value using Analog Pin:
The Analog output pin of the sensor can be used to measure the PPM value of the required gas. To do
this we need to use an external microcontroller like Arduino. The microcontroller will measure the value
of analog voltage and perform some calculations to find the value of Rs/Ro where Rs is the sensor
resistance when gas is present and Ro is sensor resistance at clean air. Once we find this ratio of Rs/Ro
we can use it to calculate the PPM value of required gas using the graph below which is taken from the
datasheet of MQ135 Sensor.
Technical Specifications of MQ135 Gas Sensor
The concentration of pollutants in the air is measured in parts per million (ppm). The Analog Output pin
of the sensor is connected to the analog channel of the MCU. The analog output from the MQ135 can
be assumed directly proportional to the concentration (in ppm) of gas in the industrial area. The
digitized value (Vout) is related to the load resistance to find the resistance output value from the sensor
(Rs).
52
Experiment number:
Date:
RL is load resistance and Rs is the sensor resistance (between 30Kohm and 200Kohm),Vc=5.
It is possible to obtain values of CO2, CO and NH4 levels in the air of the monitored environment
usingthe following equations
The ppm of CO2 gas in the environment varies from 4.6x100 ppm to 5.7x100 ppm which is shown in
below figure. The safe upper limit for CO2 is no more than 450 ppm. The increasing CO2
concentration would lead to traps heat on the environment that can have a very significant effect on
health. In order to stabilize CO2 concentrations less than 450 ppm, the microcontroller will turn on the
exhaust fan.
About PPM and PM:
Measuring Units
53
Experiment number:
Date:
Changes in temperature and pressure do not change the ratio of the volume of pollutant gas to the
volume of air that contains it
What is PPM
Parts per million (PPM) is a unit of measurement used for expressing a very dilute concentration level of
pollutants in the air, water and other fluids or one item in a million of anything of the same size.
Converting air pollutant concentration
1. Converting Micro grams per cubic meter to PPM
What is PM level
Particulate matter (PM) in the atmospheric air or in any other gas cannot be expressed in terms of
ppmv, volume percent or mole percent. PM is most expressed as mg/m^3 of air or other gas at a
specified temperature and pressure.
Note:- One volume percent = 10, 000 ppmv (parts per million by volume) with a million being
defined as 10^6.
Care must be taken with the concentrations expressed as parts per billion by volume (ppbv) to
differentiate between the British billion which is 10^12 and the USA billion which is 10^9.
Particulate matter is the sum of all solid and liquid particles suspended in air many of which are
54
Experiment number:
Date:
hazardous. This complex mixture includes both organic and inorganic particles.
1. Coarse particles (PM 10-2.5) such as those found near roadways and dusty industries range in
diameter from 2.5 to 10 micrometers (or microns). The existing coarse particle standard (known as PM
10) includes all particles less than 10 microns in size.
2. "Fine particles" (or PM 2.5) are those found in smoke and haze have diameters less than 2.5 microns.
PM 2.5 is referred to as "primary" if it is directly emitted into the air as solid or liquid particles, and is
called "secondary" if it is formed by chemical reactions of gases in the atmosphere.
An air quality index (AQI) is a number which is used by the government authorities to communicate the
public about the current level of air pollution on a daily basis. It is a measure of air quality impacts their
health. An increase in the AQI value tells that an increase in level of air pollution and the greater the
severe adverse health effects. The concept of AQI is widely used in many countries in different point
scales to report air quality
The AQI provides an indication of the quality of the air and its health effects. The index value for
pollutant can be calculated as
where,
55
Experiment number:
Date:
OUTPUT:
Air quality-
Result:
56
Experiment number:
Date:
Exp No:8. Displaying various sensor readings on a simple web page
List of components:
Procedure:
57
Experiment number:
Date:
• Connect the micro-USB cable to the Arduino Nano in the kit, and UPLOAD the written C++ code using
Arduino IDE. (Note: ENSURE Connector – 11 is removed on Connector unit while uploading the
code.)
• Connection of the peripherals: Connect the MQ135 Sensor connector at bottom side “Air” to Control Unit
(4) and Connect ESP module(D) to the control Unit (11).
Sample Code:
include"WiFiEsp.h"
include"secrets.h"
include "ThingSpeak.h" // alwaysincludethingspeak header fileafter other header filesandcustommacros
unsignedlongmyChannelNumber=SECRET_CH_ID;const
char *myWriteAPIKey =SECRET_WRITE_APIKEY;
voidsetup() {
Serial.begin(115200); //Initializeserial
while(!Serial){
; // wait for serial port toconnect. Neededfor LeonardonativeUSBport only
}
while(!Serial) {
; // wait for serial port toconnect. Neededfor LeonardonativeUSBport only
}
Serial.print("Searchingfor ESP8266...");
// initializeESPmodule
WiFi.init(&Serial1);
58
Experiment number:
Date:
if(air_quality>1000){
Serial.print(" FreshAir");
elseif( air_quality<1000)
{
Serial.print(" Poor Air");
}
Date:
else{
Serial.println("Problemupdatingchannel. HTTPerror code" +String(x));
}
Secrets-
// Usethisfiletostoreall of theprivatecredentials
// andconnectiondetails
OUTPUT:
60
Experiment number:
Date:
Result:
61
Experiment number:
Date:
1. TDS (Total Dissolved Solids) indicates that how many milligrams of soluble solids dissolved in
oneliter of water. In general, the higher the TDS value, the more soluble solids dissolved in water,
andthe less clean the water is. Therefore, the TDS value can be used as one of the references for
reflecting the cleanliness of water.
2. As the number of dissolved solids in the water increases, the conductivity of the water increases,
and that allow us to calculate the total dissolved solids in ppm (mg/L).
3. note that it does not measure contaminants in the water.
4. A TDS meter can be useful to monitor water quality in many applications like pools, aquariums,
fish tanks, hydroponics, water purifiers, etc.
5. This product supports 3.3 ~ 5.5V wide voltage input, and 0 ~ 2.3V analog voltage output, which
makes it compatible with 5V or 3.3V control systems or boards. The excitation source is AC
signal,which can effectively prevent the probe from polarization and prolong the life of the probe,
meanwhile can help increase the stability of the output signal. The TDS probe is waterproof, it can
be immersed in water for long time measurement.
Working of TDS meter
A TDS meter is basically an electrical charge (EC) meter where by two electrodes equally
spaced apart are inserted into water and used to measure charge. The result is interpreted by the TDS
meter and converted into a ppm figure.
62
Experiment number:
Date:
According to EPA, the limit for (TDS) Total Dissolved Solids for Drinking Water in the US is 200
ppm (Parts Per Million) but normal acceptable Levels range between 50-300 ppm. TDS Listed by
EPA as Secondary Contaminants, that may affect how water tastes, and in some cases, cause
disease.
List of components:
63
Experiment number:
Date:
JST connecting
wires
procedure:
• Connect the micro-USB cable to the Arduino Nano in the kit, to dump the written C++code using
Arduino IDE. (Note: ENSURE Connector-11 is removed on Connector unit while
uploading the code.) also make sure you installed the TDS respected libraries.
• Connection of the peripherals: Connect the TDS sensor JST connector to control unit
(4) , and Connect the ESP module(D) to control unit (11) .
Sample Code
include"WiFiEsp.h"
include"secrets.h"
include "ThingSpeak.h" // alwaysincludethingspeak header fileafter other header filesandcustommacrosinclude
<EEPROM.h>
include "GravityTDS.h"
GravityTDSgravityTds;
unsignedlongmyChannelNumber=SECRET_CH_ID;const
char *myWriteAPIKey =SECRET_WRITE_APIKEY;
64
Experiment number:
Date:
float temperature=25;// set temperaturevalue int
tdsValue=0;
voidsetup() {
Serial.begin(115200); //Initializeserial
while(!Serial){
; // wait for serial port toconnect. Neededfor LeonardonativeUSBport only
}
while(!Serial) {
; // wait for serial port toconnect. Neededfor LeonardonativeUSBport only
}
Serial.print("Searchingfor ESP8266...");
// initializeESPmodule
WiFi.init(&Serial1);
gravityTds.setPin(TdsSensorPin);
gravityTds.setAref(5.0); //refewebpage+="Danger! MovetoFreshAir";
}rencevoltageonADC, default 5.0VonArduinoUNO gravityTds.setAdcRange(1024);
//1024for 10bit ADC;4096 for 12bit ADCgravityTds.begin();
//initialization
ThingSpeak.begin(client); // InitializeThingSpeak
}
voidloop() {
Date:
delay(5000);
}
Serial.println("\nConnected.");
}
Date:
Serial1.begin(rates[i]);
delay(100);
Serial1.print("AT+UART_DEF=
");Serial1.print(baudrate);
Serial1.print(",8,1,0,0\r\n");
delay(100);
}
Serial1.begin(baudrate);
}
Secrets-
// Usethisfiletostoreall of theprivatecredentials
// andconnectiondetails
67
Experiment number:
Date:
OUTPUT:
ThingSpeak site
68
Experiment number:
Date:
Tabular column:
Conduct Experiment with your own water and fill the table
Result:
69
Experiment number:
Date:
10. Displaying humidity and temperature data on a web-based application
Aim: Displaying humidity and temperature data on a web-based application
List of components:
70
Experiment number:
Date:
procedure:
Here, we designed an Ambient light intensity based power saving system for Street lights.
Connect the micro-USB cable to the Arduino Nano in the Acenaar kit, and UPLOAD the
written C++ code using Arduino IDE.
Connection of the peripherals: Connect the LDR module (L) to the control unit (4) using the 4
pin JST connecting wires in AcenAAr IOT trainer kit.
Sample Code
int sensorPin=A0;
const int LEDPins[8] ={10,11,12,13,A2,A3,A4,A5};
int i =0;
voidsetup()
{
Serial.begin(9600);
pinMode(sensorPin,INPUT);for
(i=0;i<9;i++){
pinMode(LEDPins[i],
OUTPUT);
}
}
voidloop()
{
int x=analogRead(sensorPin);
Serial.println(x);
if( x<=100 ) // Changethevalueasper your requirement
{
for(i =0; i <9; i++)
digitalWrite(LEDPins[i],LOW);
}
else
{for(i =0; i <9; i++)
digitalWrite(LEDPins[i],HIGH);
}
if(x>101,x<200)
{
for(i =0; i <8; i++)
digitalWrite(LEDPins[i],LOW);
}
else{
for(i =0; i <8; i++)
digitalWrite(LEDPins[i],HIGH);
}
if(x>201,x<300)
{
71
Experiment number:
Date:
for (i=0;i<7;i++)
digitalWrite(LEDPins[i],LOW);
}
else{
for(i =0; i <7; i++)
digitalWrite(LEDPins[i],HIGH);
}
if(x>301,x<400)
{
for (i=0;i<6;i++)
digitalWrite(LEDPins[i],LOW);
}
else{
for(i =0; i <6; i++)
digitalWrite(LEDPins[i],HIGH);
}
if(x>401,x<500)
{
for (i=0;i<5;i++)
digitalWrite(LEDPins[i],LOW);
}
else{
for(i =0; i <5; i++)
digitalWrite(LEDPins[i],HIGH);
}
if(x>501,x<600)
{
for (i=0;i<4;i++)
digitalWrite(LEDPins[i],LOW);
}
else{
for(i =0; i <4; i++)
digitalWrite(LEDPins[i],HIGH);}
if(x>601,x<700)
{
for (i=0;i<3;i++)
digitalWrite(LEDPins[i],LOW);
}
else{
for(i =0; i <3; i++)
digitalWrite(LEDPins[i],HIGH);
}
72
Experiment number:
Date:
if(x>701,x<800){
for(i =0; i <2; i++)
digitalWrite(LEDPins[i],LOW);
}
else
{
for (i=0;i<2;i++)
digitalWrite(LEDPins[i],HIGH);
}
delay(200);
}
73
Experiment number:
Date:
OUTPUT:
Result:
74
Experiment number:
Date:
11. Demonstration of UAV elements, Flight Controller Mission Planner flight planning
design
Aim: Demonstration of UAV elements, Flight Controller Mission Planner flight planning design
Before digging into the best examples of Business Model Canvas around the world, let’s find out how the
Generally speaking, the Business Model Canvas is a summary that tells how the key drivers of a
business fit together. It means showing the strategic details necessary to help a business get success
within the market.
One important thing is that this summary's length is within one sheet of paper. Imagine when you
include all this down in a document, and it turns into many pages to capture all information. This will
make you hard to remember as well as waste time opening pages over pages
Value proposition: What are your strengths to make customers buy from your business?
Channels: Which channels do you use to deliver your products or services to the market?
Customer relationships: What are your strategies to get, keep, and build up the relationships with your
customers?
75
Experiment number:
Date:
Revenue streams: How will you make money?
Key resources: What are the special strategic resources that you own as well as a need?
Key activities: What will your business do to deliver your value proposition?
Key Partnerships: What are the non-key activities that you do to help your company focus more on
your key activities?
Cost structures: What are the biggest costs that your business earns?
The Arduino Nano is a small Arduino board based on ATmega328P or ATmega628 Microcontroller.
Theconnectivity is the same as the Arduino Uno Board.
The Nano board is defined as a sustainable, small, consistent, and flexible Microcontroller board. It is small
in size compared to the UNO board. The Arduino Nano is organized using the Arduino (IDE), which can run
on various platforms. Here, IDE stands for Integrated Development Environment.
The devices required to start our projects using the Arduino Nano board are Arduino IDE and mini-USB. The
Arduino IDE software must be installed on our respected laptop or desktop. The mini-USB transfers the code
from the computer to the Arduino Nano board.
76
Experiment number:
Date:
MICROCONTROLLER ATmega328
ARCHITECTURE AVR
OPERATING VOLTAGE 5V
FLASH MEMORY 32 KB of which 2 KB used by bootloader
SRAM 2 KB
CLOCK SPEED 16 MHz
ANALOG IN PINS 8
EEPROM 1 KB
DC CURRENT PER I/O PINS 40 mA (I/O Pins)
INPUT VOLTAGE 7-12V
DIGITAL I/O PINS 22 (6 of which are PWM)
PWM OUTPUT 6
POWER CONSUMPTION 19 mA
PCB SIZE 18 x 45 mm
WEIGHT 7g
PRODUCT CODE A000005
77
Experiment number:
Date:
Power
The Arduino Nano can be powered via the Mini-B USB connection, 6-20V unregulated external power
supply (pin 30), or 5V regulated external power supply (pin 27). The power source is automatically
selected to the highest voltage source.
Memory
The ATmega328 has 32 KB, (also with 2 KB used for the bootloader. The ATmega328 has 2 KB of
SRAM and 1 KB of EEPROM.
Each of the 14 digital pins on the Nano can be used as an input or output, using pinMode(),
digitalWrite(), and digitalRead() functions. They operate at 5 volts. Each pin can provide or receive a
maximum of 40 mA and has an internal pull-up resistor (disconnected by default) of 20-50 kOhms. In
addition, some pins have specialized functions:
Serial: 0 (RX) and 1 (TX). Used to receive (RX) and transmit (TX) TTL serial data. These pins
are connected to the corresponding pins of the FTDI USB-to-TTL Serial chip.
External Interrupts: 2 and 3. These pins can be configured to trigger an interrupt on a low
value, a rising or falling edge, or a change in value. See the attachInterrupt() function for details.
PWM: 3, 5, 6, 9, 10, and 11. Provide 8-bit PWM output with the analogWrite() function.
SPI: 10 (SS), 11 (MOSI), 12 (MISO), 13 (SCK). These pins support SPI communication, which,
although provided by the underlying hardware, is not currently included in the Arduino
language.
LED: 13. There is a built-in LED connected to digital pin 13. When the pin is HIGH value, the
LED is on, when the pin is LOW, it's off.
The Nano has 8 analog inputs, each of which provide 10 bits of resolution (i.e. 1024 different values).
By default they measure from ground to 5 volts, though is it possible to change the upper end of their
range using the analogReference() function. Analog pins 6 and 7 cannot be used as digital pins.
Additionally, some pins have specialized functionality:
I2C: A4 (SDA) and A5 (SCL). Support I2C (TWI) communication using the Wire library
(documentation on the Wiring website).
78
Experiment number:
Date:
AREF. Reference voltage for the analog inputs. Used with analogReference().
Reset. Bring this line LOW to reset the microcontroller. Typically used to add a reset button to
shields which block the one on the board.
Communication
The Arduino Nano has a number of facilities for communicating with a computer, another Arduino, or
other microcontrollers. The ATmega328 provide UART TTL (5V) serial communication, which is
available on digital pins 0 (RX) and 1 (TX). An FTDI FT232RL on the board channels this serial
communication over USB and the FTDI drivers (included with the Arduino software) provide a virtual
com port to software on the computer. The Arduino software includes a serial monitor which allows
simple textual data to be sent to and from the Arduino board. The RX and TX LEDs on the board will
flash when data is being transmitted via the FTDI chip and USB connection to the computer (but not for
serial communication on pins 0 and 1). A SoftwareSerial library allows for serial communication on
any of the Nano's digital pins. The ATmega328 also support I2C (TWI) and SPI communication. The
Arduino software includes a Wire library to simplify use of the I2C bus. To use the SPI communication,
please see ATmega328 datasheet.
Programming
The Arduino Nano can be programmed with the Arduino software (download). Select "Arduino
Duemilanove or Nano w/ ATmega328" from the Tools > Board menu (according to the microcontroller
on your board). The ATmega328 on the Arduino Nano comes preburned with a bootloader that allows
you to upload new code to it without the use of an external hardware programmer. It communicates
using the original STK500 protocol. You can also bypass the bootloader and program the
microcontroller through the ICSP (In-Circuit Serial Programming) header using Arduino ISP or similar.
Rather then requiring a physical press of the reset button before an upload, the Arduino Nano is
designed in a way that allows it to be reset by software running on a connected computer. One of the
hardware flow control lines (DTR) of the FT232RL is connected to the reset line of the ATmega328 via
a 100 nanofarad capacitor. When this line is asserted (taken low), the reset line drops long enough to
reset the chip. The Arduino software uses this capability to allow you to upload code by simply
pressing the upload button in the Arduino environment. This means that the bootloader can have a
shorter timeout, as the lowering of DTR can be well-coordinated with the start of the upload. This
setup has other implications. When the Nano is connected to either a computer running Mac OS X or
Linux, it resets each time a connection is made to it from software (via USB). For the following half-
second or so, the bootloader is running on the Nano. While it is programmed to ignore malformed data
(i.e. anything besides an upload of new code), it will intercept the first few bytes of data sent to the
board after a connection is opened. If a sketch running on the board receives one-time configuration or
79
Experiment number:
Date:
Result:
80
IOT LAB