Iot Lab
Iot Lab
Date:
Apparatus:
Hardware Procedure:
Software Procedure:
2. Click on file
3. Click on New
5. Click on Save
6. Click on Verify
7. Click on Upload the code into Arduino Uno by using USB cable.
1
Program:
const int led = 2;
void setup() {
pinMode(led, OUTPUT);
}
void loop()
{
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
digitalWrite(led, HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
Precautions:
RESULT:
2
Exp : 02
Date :
Apparatus:
Hardware Procedure:
LED pin is Connected to Arduino Uno pin of 11 & 12.
POT pin is connected to the Arduino pin A1.
IR Sensor Pin is connected to the Arduino Pin 4.
Power jack is connected to the Arduino.
USB connector is connected to Arduino Uno to monitor.
Connect the 12V power supply to development board.
Check the output from the development board.
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3. Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6. Click on Verify
7. Click on Upload the code into Arduino Uno by using USB cable.
3
Program:
#define LED_PIN 11
#define POTENTIOMETER_PIN A1
void setup() {
// put your setup code here, to run once:
pinMode(4,INPUT);
pinMode(12,OUTPUT);//LED
pinMode(LED_PIN, OUTPUT);
}
void loop() {
// put your main code here, to run repeatedly:potentiometer loop
int potentiometerValue = analogRead(POTENTIOMETER_PIN);
int brightness = potentiometerValue / 4;
analogWrite(LED_PIN, brightness);
//ir loop
if(digitalRead(4)==LOW){
digitalWrite(12,HIGH);
}
else {
digitalWrite(12,LOW);
}
}
Precautions:
RESULT:
Both Analog and Digital Sensors data are successfully measured by Arduino.
4
Exp : 03
Date:
Apparatus:
Software Procedure:
void setup()
{
Serial.begin(9600); //Sets the baud for serial data transmission
digitalWrite(12,LOW);
}
}
}
6
Precautions:
RESULT:
Two Actuators are controlled by smart phone using Bluetooth module.
7
Exp :04
Date:
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3.Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6.Click on Verify
7.Click on Upload the code into Arduino Uno by using USB cable.
8
THINGS SPEAK ACCOUNT CREATION PROCEDURE:
1. First, open ThingsSpeak.com website, and then create an account.
2. And then click on verify on gmail.
3. Login to things speak website and create channel and save it.
4. Go to the API key and then copy “write API key”.
5. And paste that API key in Arduino code
6. After successful code uploading and circuit connections.
7. Open Things Speak account private view, Sensor data will be shown in graph.
Program:
#include <dht.h>
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
dht DHT;
#define DHT11_PIN 10
void setup(){
lcd.begin(16, 2);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, 0);
project_Name();
Serial.begin(9600);
Serial.println("AT");
delay(1000);
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CNMI=2,2,0,0,0");
delay(1000);
lcd.setCursor(0,0);
lcd.print("WiFi module ");
lcd.setCursor(0,1);
lcd.print("Initilizing.... ");
9
wifi.begin(115200);
wifi.println("AT+RST");
delay(4000);
wifi.println("AT+CWMODE=3");
delay(4000);
wifi.print("AT+CWJAP=");
wifi.write('"');
wifi.print("STTMANI");
wifi.write('"');
wifi.write(',');
wifi.write('"');
wifi.print("hailucky123,./");
wifi.write('"');
wifi.println();
delay(1000);
lcd.setCursor(0,0);
lcd.print("WiFi module ");
lcd.setCursor(0,1);
lcd.print("Initilized ..... ");
delay(1000);
lcd.clear();
}
void loop()
{
int chk = DHT.read11(DHT11_PIN);
//SendWiFi_Data();
//delay(1000);
lcd.setCursor(0,0);
lcd.print("Temperature: ");
lcd.setCursor(0,1);
lcd.print("Humidity: ");
lcd.setCursor(12,0);
lcd.print(DHT.temperature);
lcd.setCursor(9,1);
lcd.print(DHT.humidity);
delay(500);
/* Tempurature Data Process*/
if(DHT.temperature > 45)
{
buzzer_sound();
}
/* Humidity Data Process*/
if(DHT.humidity < 30)
{
buzzer_sound();
}
lcd.setCursor(15,1);
lcd.write(0x20);
SendWiFi_Data();
10
delay(1000);
}
void SendWiFi_Data(){
String cmd = "AT+CIPSTART=\"TCP\",\"";
cmd += "184.106.153.149"; // api.thingspeak.com
cmd += "\",80";
wifi.println(cmd);
delay(1500);
getStr += "\r\n\r\n";
void buzzer_sound()
{
digitalWrite(buzzer, HIGH);
delay(600);
digitalWrite(buzzer, LOW);
delay(400);
digitalWrite(buzzer, HIGH);
delay(600);
digitalWrite(buzzer, LOW);
delay(400);
}
void project_Name(){
lcd.setCursor(0,0);
lcd.print(" ESP8266 ");
lcd.setCursor(0,1);
lcd.print(" Interfacing ");
delay(3000);
lcd.clear();
11
Precautions:
RESULT:
Things Speak account will be successfully created. DHT11 Sensor data will be
uploaded to cloud.
12
Exp : 05
Date:
Hardware Procedure:
Relay1 pin is connected to the 12 pin of Arduino board.
Relay2 pin is connected to the 13 pin of Arduino board.
Wifi module pins RX & TX are connected to 8 and 9 pin of Arduino ( RX = 8, TX = 9).
USB connector is connected to Arduino Uno to monitor.
Place Wifi Module in IOT development Board.
Connect the 12V power supply to development board.
Power jack is connected to the Arduino Uno.
Check the output from the development board.
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3. Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6. Login to ThingsSpeak account and then go to apps and create talkback.
7. Copy those Talkback id and Read API key and paste it on the Arduino Code
8. Give commands from cloud which was given in the code.
10. Click on save & Click on Verify.
11. Click on Upload code into Arduino Uno by using USB cable.
12. Relays are turned on and turned off while giving the commands.
13
Program:
#include <SoftwareSerial.h>
#include <stdlib.h>
int ch,ch1,mode=1;
void setup(){
wifi.begin(115200);
Serial.begin(115200);
pinMode(relay1,OUTPUT);
pinMode(relay2,OUTPUT);
digitalWrite(relay1,LOW);
digitalWrite(relay2,LOW);
delay(100);
14
Serial.println("WiFi Module initilizing..... ");
wifi.println("AT+RST");
delay(4000);
wifi.println("AT+CWMODE=3");//AT+CWJAP="SSID","PASWD"
delay(4000);
wifi.print("AT+CWJAP=");
wifi.write('"');
wifi.print("STTMANI2");
wifi.write('"');
wifi.write(',');
wifi.write('"');
wifi.print("hailucky123,./");
wifi.write('"');
wifi.println();
delay(2000);
}
void loop(){
String
15
getStr ="GET
/talkbacks/47047/commands/execute?api_key=5G9L2SELAH60VR3F\r\n\r\n";
wifi.end();
delay(1000);
wifi.begin(115200);
delay(1500);
wifi.println(getStr);
for(i=0;i<=1000;i++)
{
if(wifi.available())
{
ch=wifi.read();
Serial.write(ch);
}
}
delay(1200);
for(i=0;i<=1000;i++)
{
if(wifi.available())
{
ch=wifi.read();
if(ch==':')
16
gotoxx;
ch1=ch;
Serial.write(ch);
}
}
xx: ch1=wifi.read();
if(mode==1)
{
if(ch1=='1')
{
digitalWrite(relay1,HIGH);
Serial.println("relay1 ON");
}
if(ch1=='2')
{
digitalWrite(relay1,LOW);
Serial.println("relay1 OFF");
}
if(ch1=='3')
{
digitalWrite(relay2,HIGH);
Serial.println("relay2 ON");
}
if(ch1=='4')
{
digitalWrite(relay2,LOW);
Serial.println("relay2 OFF");
}
17
}
Precautions:
RESULT:
Two relays are controlled from cloud by giving the commands.
18
Exp :06
Date:
Aim: To Interface DHT11 Using Arduino Uno board and upload sensor data to Cloud.
.
Apparatus:
Hardware Procedure:
LCD pins connected to Arduino Uno pin 2,3, 4, 5, 6, and 7.
DHT11 pin connected to the 10 pin of Arduino board.
Wifi module pins RX & TX are connected to 8 and 9 pin of Arduino ( RX = 8, TX = 9).
USB connector is connected to Arduino Uno to monitor.
Place Wifi Module in IOT development Board.
Connect the 12V power supply to development board.
Power jack is connected to the Arduino Uno.
Check the output from the development board.
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3. Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6. Create an Account in Things Speak, then create a channel.
7. Go to API keys in that Channel and then copy “Write API key”.
19
8. Go to Arduino code and paste Write API key.
9. Give your mobile hotspot name and password in Arduino code.
10. Click on save & Click on Verify.
11. Click on Upload the code into Arduino Uno by using USB cable.
12. After that open things Speak account and click on private view
13. DHT11 Sensor data will be uploaded and it will be shown as graph in Private view on Things
Speak account.
20
Program:
#include <dht.h>
#include <LiquidCrystal.h>
#include <SoftwareSerial.h>
LiquidCrystallcd(2,3, 4, 5, 6, 7);
SoftwareSerialwifi(8, 9); // TX, RX
dhtDHT;
#define DHT11_PIN 10
void setup(){
lcd.begin(16, 2);
pinMode(buzzer, OUTPUT);
digitalWrite(buzzer, 0);
project_Name();
Serial.begin(9600);
Serial.println("AT");
delay(1000);
Serial.println("AT+CMGF=1");
delay(1000);
Serial.println("AT+CNMI=2,2,0,0,0");
delay(1000);
lcd.setCursor(0,0);
lcd.print("WiFi module ");
lcd.setCursor(0,1);
lcd.print("Initilizing.... ");
wifi.begin(115200);
wifi.println("AT+RST");
delay(4000)
wifi.write(',');
wifi.write('"');
wifi.print("hailucky123,./");
wifi.write('"');
wifi.println();
delay(1000);
lcd.setCursor(0,0);
lcd.print("WiFi module ");
lcd.setCursor(0,1);
lcd.print("Initilized ..... ");
delay(1000);
lcd.clear();
}
21
void loop()
{
int chk = DHT.read11(DHT11_PIN);
//SendWiFi_Data();
//delay(1000);
lcd.setCursor(0,0);
lcd.print("Temperature: ");
lcd.setCursor(0,1);
lcd.print("Humidity: ");
lcd.setCursor(12,0);
lcd.print(DHT.temperature);
lcd.setCursor(9,1);
lcd.print(DHT.humidity);
delay(500);
/* Tempurature Data Process*/
if(DHT.temperature> 45)
{
buzzer_sound();
}
/* Humidity Data Process*/
if(DHT.humidity< 30)
{
buzzer_sound();
}
lcd.setCursor(15,1);
lcd.write(0x20);
SendWiFi_Data();
delay(1000);
}
String getStr ="GET /update?api_key=";
getStr += apiKey;
getStr +="&field1=";
getStr += String(DHT.temperature);
getStr +="&field2=";
getStr += String(DHT.humidity);
getStr += "\r\n\r\n";
22
void buzzer_sound()
{
digitalWrite(buzzer, HIGH);
delay(600);
digitalWrite(buzzer, LOW);
delay(400);
digitalWrite(buzzer, HIGH);
delay(600);
digitalWrite(buzzer, LOW);
delay(400);
}
void project_Name(){
lcd.setCursor(0,0);
lcd.print(" ESP8266 ");
lcd.setCursor(0,1);
lcd.print(" Interfacing ");
delay(3000);
lcd.clear();
}
Precautions:
RESULT:
23
Exp :07
Date:
Aim: To Interface MQ-7and MQ-135 Sensor Using ArduinoUno boardto measure Carbon
monoxide and Ammonia gas.
Apparatus:
Hardware Procedure:
LCD connected to Arduino Uno pin 2, 3, 4, 5, 6&7.
MQ - 7 sensor pin is connected to Arduino pin A0.
MQ – 135 sensor pin is connected to Arduino pin A1.
Power jack is connected to the Arduino Uno.
USB connector is connected to Arduino Uno to monitor.
Connect the 12V power supply to development board.
Check the output from the development board.
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3.Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6.Click on Verify
7.Click on Upload the code into Arduino Uno by using USB cable.
24
Program:
#include<LiquidCrystal.h>
LiquidCrystallcd(2, 3, 4, 5, 6, 7);
void setup()
{
lcd.begin(16, 2);
project_Name();
}
void loop()
{
int mq7_gas_sensor_data = analogRead(A0);
int mq135_gas_sensor_data = analogRead(A1);
lcd.setCursor(0,0);
lcd.print("MQ7 Data: ");
lcd.setCursor(9,0);
lcd.print(mq7_gas_sensor_data);
lcd.setCursor(0,1);
lcd.print("MQ135 Data: ");
lcd.setCursor(12,1);
lcd.print(mq135_gas_sensor_data);
delay(1000);
}
void project_Name(){
lcd.setCursor(0,0);
lcd.print(" AIR POLLUTION ");
lcd.setCursor(0,1);
lcd.print("CONTROL SYSTEM");
delay(3000);
lcd.clear();
}
Precautions:
RESULT:
MQ – 7 gas sensor detects the Carbon Monoxide gas. And MQ – 135 gas sensor detects
Ammonia gas. Whenever the gas value exceeds the threshold value, buzzer starts sounding. And MQ-7
and MQ-135 sensors data also uploaded to cloud successfully.
25
Exp : 08
Date:
Apparatus:
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3. Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6. Click on Verify
7. Click on Upload the code into Arduino Uno by using USB cable.
26
Program:
#include<LiquidCrystal.h>
int relay = 8;
const int TDS_sensor = 9;
void setup()
{
lcd.begin(16, 2);
pinMode(relay, OUTPUT);
digitalWrite(relay, LOW);
project_Name();
}
void loop()
{
int TDS_sensor_data = analogRead(A0);
lcd.setCursor(0,0);
lcd.print("TDS Data: ");
lcd.setCursor(0,1);
lcd.print(" ");
lcd.setCursor(9,0);
lcd.print(TDS_sensor_data);
if(TDS_sensor_data >150)
digitalWrite(relay, HIGH);
else
digitalWrite(relay, LOW);
delay(500);
void project_Name(){
lcd.setCursor(0,0);
lcd.print("TDS SENSOR ");
lcd.setCursor(0,1);
lcd.print("INTERFACING ");
delay(3000);
lcd.clear();
}
27
Precautions:
RESULT:
TDS Sensor data was successfully measuredwith Arduino.
28
Exp : 09
Date:
Apparatus:
Hardware Procedure:
Actuator pin is connected to Arduino Uno pin 9.
Power jack is connected to the Arduino.
Insert Bluetooth Module in Bluetooth Jack.
USB connector is connected to Arduino Uno to monitor.
Connect the 12V power supply to development board.
Check the output from the development board.
Software Procedure:
1. Click on Arduino IDE
2. Click on file
3.Click on New
4. Write a Program as per circuit Pin connections
5. Click on Save
6.Click on Verify
7.Click on Upload the code into Arduino Uno by using USB cable.
29
Program:
const int Actuator = 9;
void setup() {
Serial.begin(9600);
pinMode(Actuator, OUTPUT);
}
void loop() {
byte brightness;
if (Serial.available()) {
brightness = Serial.read();
Serial.println(brightness);
}
if(brightness == 'a')
digitalWrite(Actuator, HIGH);
else if(brightness == 'b')
digitalWrite(Actuator
, LOW);
}
Precautions:
RESULT:
30