0% found this document useful (0 votes)
14 views3 pages

EX14

The document describes setting up a temperature sensor monitoring system using an Arduino Uno, DHT sensor, NodeMCU, and ThingSpeak cloud platform. It involves creating a ThingSpeak account and channel, uploading the code to send sensor readings to the channel via ESP8266 WiFi module, and monitoring the temperature on the ThingSpeak interface. The code uses the DHT library to read temperature from the sensor and SoftwareSerial to communicate with the ESP8266 to send HTTP requests with the readings to ThingSpeak.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views3 pages

EX14

The document describes setting up a temperature sensor monitoring system using an Arduino Uno, DHT sensor, NodeMCU, and ThingSpeak cloud platform. It involves creating a ThingSpeak account and channel, uploading the code to send sensor readings to the channel via ESP8266 WiFi module, and monitoring the temperature on the ThingSpeak interface. The code uses the DHT library to read temperature from the sensor and SoftwareSerial to communicate with the ESP8266 to send HTTP requests with the readings to ThingSpeak.
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

EX.NO.

14
TEMPERARTURE SENSOR MONITORING

AIM :

HARDWARE REQUIREMENTS :

S.NO COMPONENTS QUANTITY


1 Arduino Uno R3 1
2 USB Cable A/B 1
3 Jumper cables(M to F) 4
4 NODE MCU 1
5 WIFI ADAPTER 1

PROCEDURE :

1. To create the think speak account


• Sign up to THINK SPEAK account ,by clicking on
create new account
• Enter the details e-mail id,name and click on continue,
• You will be receiving the confirmation mail link and
click on the link and then continue to sign in the
thinkspeak account.
2. Click on create channel and enter the field details.Then channel will be
created.
3. Click on API keys and there will be 2 keys write API and Read API
keys,write API keys will store the sensor values and write in think speak and
when you give the think speak key value to arduino board then it is called
write API keys.
4. Download DHT library and update into the arduino IDE
5. Upload below code in the arduino uno
6. Run the code and automatically the temperature will be increased upto the current
temperature in the think speak cloud interface
CODE:

#include "dht.h"
#define dht_apin
A0 dht DHT;
#include <SoftwareSerial.h> //Software Serial library
SoftwareSerial espSerial(2, 3); //Pin 2 and 3 act as RX and TX. Connect them to
TX and RX of ESP8266
#define DEBUG true
String mySSID = "GS"; // WiFi SSID
String myPWD = "ptleecnpt"; // WiFi Password String
myAPI = "IFNXUVCVENMT25D8"; //
API Key
String myHOST = "api.thingspeak.com";
String myPORT = "80";
String myFIELD =
"field1"; int sendVal;
void setup()
{
Serial.begin(9600);
Serial.println("DHT11 Humidity & temperature Sensor\n\n");
delay(1000);
espSerial.begin(115200);
espData("AT+RST", 1000, DEBUG); //Reset the ESP8266 module
espData("AT+CWMODE=1", 1000, DEBUG); //Set the ESP mode as
station mode
espData("AT+CWJAP=\"" + mySSID + "\",\"" + myPWD + "\"", 1000, DEBUG);
//Connect to WiFi network
delay(1000);
}
void loop()
{
DHT.read11(dht_apin);
String sendData = "GET /update?api_key=" + myAPI + "&" + myFIELD + "=" +
String(DHT.humidity);
espData("AT+CIPMUX=1", 1000, DEBUG); //Allow multiple connections
espData("AT+CIPSTART=0,\"TCP\",\"" + myHOST + "\"," + myPORT, 1000,
DEBUG);
espData("AT+CIPSEND=0," + String(sendData.length() + 4), 1000, DEBUG);
espSerial.find(">");
espSerial.println(sendData);
Serial.print("Value to be sent: ");
Serial.println(DHT.humidity);
espData("AT+CIPCLOSE=0", 1000,
DEBUG);
delay(10000);
}
String espData(String command, const int timeout, boolean debug)
{
Serial.print("AT Command ==>
"); Serial.print(command);
Serial.println(" ");
string response = "";
espSerial.println(command);
long int time = millis();
while ( (time + timeout) > millis())
{
while (espSerial.available())
{
char c =
espSerial.read();
response += c;
}
}
if (debug)
{
}
return response;
}

CONNECTION:

RESULT:

You might also like