Intern Iot
Intern Iot
diode
• LED is a
semiconductor
light source that
emits light when
current flows
through it
• Resistor is used in
series with led to
reduce the current
flow through the
LED
GPIO programming
• GPIO :general purpose input/ output is an
uncommitted digital signal pin on an
integrated circuit whose behaviour - including
whether it acts as input or output-is
controllable by the user at the run time
• GPIOs have no predefined purpose and are
unused by the default
Program for blinking LED
int led = 9; //9th pin is attached to led
void setup() //to program the pin as i/p or o/p
{
pinMode(led,OUTPUT); //assigning as output
}
Void loop()
{
digitalWrite(led,HIGH); // Turning on LED
delay(1000);
digitalWrite(led,LOW); //Turning off LED
Delay(1000);
}
LED BLINKING
GPIO Program
int led =9;
Void setup()
{
pinMode(led, Output);
Void loop()
{
digitalWrite(led,HIGH);
delay(1000);
digitalWrite(led, LOW);
delay(1000);
}
MULTIPLE GPIO PROGRAM
int led =9;
int led1=4;
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);
}
MULTIPLE GPIO PROGRAM
IR SENSOR
• An infrared sensor is
an electronic device
that emits in order to
sense some aspects
of the surroundings
IR sensor interfaced with Arduino uno
atmega328
IR SENSOR PROGRAM
define ledPin 5
define switchPin 8
int val=0;
void setup()
{
pinMode(ledPin, OUTPUT);
pinMode(switchPin, INPUT);
}
void loop()
{
val = digitalRead(switchPin);
if(vaL == LOW)
{
digitalWrite(ledPin, LOW);
}
digitalWrite(ledPin, HIGH);
}
}
IR sensor interfaced with Arduino uno
LCD
• LCD :- liquid crystal display
• LCD is an electronic display module used to
display the alphanumeric charecters
• A 16*2 LCD display is very basic module and is
very commonly used in various devices and
circuits
• A 16*2 LCD means it has 16 coloums and 2
rows, so that it can display 16 characters per
line and there are 2 such lines
16*2 LCD DISPLAY
PIN description of 16*2 LCD Display
LCD CODE
#include <LiquidCrystal.h> // initialize library
LiquidCrystal lcd(8,9,10,11,12,13);
void setup()
{
lcd.begin(16,2); // selecting both rows and 16 columns
}
void loop()
{
lcd.clear(); /// clear the data in LCD
lcd.setCursor(0,0); //column 0 and line (row) 1
lcd.print(“Object Detected");
lcd.setCursor(0,1); //column 0 and line 2
lcd.print(“Buzzer");
delay(1000);
}
LCD display interfaced to ARDUINO
UNO ATMEGA328
Applications of LCD Diaplay
LCD (Liquid Crystal Display) screen is an
electronic display module and find a wide range
of applications. A 16x2 LCD display is very basic
module and is very commonly used in various
devices and circuits. ... A 16x2 LCD means it can
display 16 characters per line and there are 2
such lines.
Communication
• Communication is the process of exchanging
the data or information between two
communication network.
• Types of communication:-
1.Wired Communication
2.Wireless Communication
Types of Wired communication
soft.println(cmd);
if(soft.find("Error"))
{
Serial.println("AT+CIPSTART error");
}
else
{
Serial.println("AT+CIPSTART success");
}
String getStr = "GET https://api.thingspeak.com/update?api_key="; // prepare
GET string
getStr += apikey;
getStr +="&field1=";
getStr += x;
getStr += "\r\n";
cmd = "AT+CIPSEND=";
cmd += String(getStr.length());
//cmd += "\r\n\r\n";
soft.println(cmd);
//showresponse(10000);
if(soft.find(">")){
soft.print(getStr);
}
else{
soft.println("AT+CIPCLOSE\r\n");
Serial.println("AT+CIPCLOSE");
}
}
void loop()
{
int x = digitalRead(2);
if(x == HIGH)
{
wifiinit();
thingspeak(1);
}
else
{
wifiinit();
thingspeak(0);
}
}
WIFI MODULE INTERFACED WITH ARDUNO
UNO 328 USING THINGSPEAK
CONNECTED CIRCUIT RESULT
IOT enabled weather monitoring system
Introduction
Using Internet of Things (IOT), we can control any electronic
equipment in homes and industries. Moreover, you can read a data
from any sensor and analyse it graphically from anywhere in the
world. Here, we can read temperature and humidity data from
DHT11 sensor and upload it to a ThingSpeak cloud using Arduino
Uno and ESP8266-01 module. Arduino Uno is MCU, it fetch a data
of humidity and temperature from DHT11 sensor and Process it and
give it to a ESP8266 Module.ESP8266 is a WiFi module, it is one of
the leading platform for Internet of Things. It can transfer a data to
IOT cloud.
Components Required
Hardware Requirements
• Arduino Uno
• ESP8266-01
• DHT11
• AMS1117-3.3V
• 9V battery
Software Requirements
• Arduino IDE
DHT11 Humidity Sensor on Arduino
Circuit and Working
First make the connection as shown in fig.The 2nd pin is of DHT11 is a data
pin, it can send a temperature and humidity value to the 5thpin of Arduino
Uno.1st and 4th pin of DHT11 is a Vcc and Gnd and 3rd pin is no connection.
The Arduino Uno process a temperature and humidity value and send it to
a ESP8266 WiFi module. The Tx and Rx pin of ESP8266 is connected to the
2nd (Rx) and 3rd (Tx) of Arduino Uno. Make sure that input voltage
of ESP8266 must be 3.3V, not a 5V (otherwise it would damage a device).For
that, we are using AMS1117 Voltage regulator circuit. It can regulate a voltage
from 9V to 3.3V and will give it to Vcc pin of ESP8266.The Ch_Pd is a chip
enable pin of ESP8266 and should be pullup to 3.3V through 3.3KΩ resistor.
For reset the module pull down the RST pin of ESP8266 to Gnd.ESP8266 have
2 GPIO pins GPIO 0 and GPIO 2.
Circuit diagram for monitoring Humidity
and Temperature in IOT cloud
Component Description