You are on page 1of 7

University Institute of Engineering

Department of Computer Science & Engineering

Experiment: 1.2

Student Name: Pratik Mishra UID:21BCS7830


Branch: CSE Section/Group: 220 B
Semester:2 Date of Performance:21.02.2022
Subject Name:Disruptive Technology-2
Subject Code:21ECH-103

1. Aim of the practical: Design a Cloud based weather monitoring system using IoT
platform and relevant sensors.

2. Tool Used: BMP280, ESP32, UBIDOTS.

3. Basic Concept/ Command Description:

4. Code:

#include <Adafruit_BMP280.h>

#include <UbidotsESPMQTT.h>

#define BMP_SDA 21

#define BMP_SCL 22
University Institute of Engineering
Department of Computer Science & Engineering

#define TOKEN "BBFF-zkPpscJnEANLm6jB82ZbIEGAieVOXh"   // Your Ubidots


TOKEN

#define WIFISSID "Joker" // Your SSID

#define WIFIPASS "Joker@tenda" // Your Wifi Pass

Adafruit_BMP280 bmp280;

Ubidots client(TOKEN);

void callback(char* topic, byte* payload, unsigned int length) {

 Serial.print("Message arrived [");

 Serial.print(topic);

 Serial.print("] ");

 for (int i = 0; i < length; i++) {

  Serial.print((char)payload[i]);

 }

 Serial.println();

void setup() {

 Serial.begin(9600);
University Institute of Engineering
Department of Computer Science & Engineering

 Serial.println("Init... T2_Weather");

 Serial.println("Initializing BMP280");

 boolean status = bmp280.begin(0x76);

 if (!status) {

  Serial.println("BMP280 Not connected!");

 }

 Serial.println("Done");

 Serial.print("Connecting to SSID: ");

 Serial.print(WIFISSID);

 Serial.print(", Password: ");

 Serial.println(WIFIPASS);

 client.wifiConnection(WIFISSID, WIFIPASS);

 Serial.println("Done");

 Serial.println(" Initializing Ubidots Connection...");

 client.ubidotsSetBroker("things.ubidots.com"); // Sets the broker properly for the


business account

 client.setDebug(true);            // Pass a true or false bool value to activate debug


messages
University Institute of Engineering
Department of Computer Science & Engineering

 client.begin(callback);

 Serial.println("Done");

 Serial.println("DONE");

void loop() {

 // Acquiring data from BMP280

 float temp = bmp280.readTemperature();

 float pressure = bmp280.readPressure();

 float altitude = bmp280.readAltitude();

 float water_boiling_point = bmp280.waterBoilingPoint(pressure);

 Serial.print("Temperature: ");

 Serial.print(temp);

 Serial.println(" °C");

 Serial.print("Pressure: ");

 Serial.print(pressure);

 Serial.println(" Pa");

 Serial.print("Altitude: ");

 Serial.print(altitude);

 Serial.println(" m");
University Institute of Engineering
Department of Computer Science & Engineering

 Serial.print("Water Boiling Point: ");

 Serial.print(water_boiling_point);

 Serial.println(" F");

 // Establising connection with Ubidots

 if (!client.connected()) {

  client.reconnect();

 }

 // Publising data of both variable to Ubidots

 client.add("temp", temp); // Insert your variable Labels and the value to be sent

 client.add("pressure", pressure);

 client.add("altitude", altitude); // Insert your variable Labels and the value to be sent

 client.add("wbp", water_boiling_point);

 client.ubidotsPublish("weather-monitoring"); // insert your device label here

 client.loop();

 delay(5000);

}
University Institute of Engineering
Department of Computer Science & Engineering

5. Observations, Simulation Screen Shots and Discussions:

6. Result and Summary:After uploading code the pressure and temperature is showing in
ubidots perfectly.

7. Additional Creative Inputs (If Any):

Learning outcomes (What I have learnt):

1.How to creat account in ubidots.

2.Use of ubidots.
University Institute of Engineering
Department of Computer Science & Engineering

3.What is cloud based weather monitoring system.

4.How to make weather monitoring system.

Evaluation Grid (To be filled by Faculty):


Sr. Parameters Marks Obtained Maximum Marks
No.
1. Worksheet completion including 10
writinglearning objectives/Outcomes.
(To besubmitted at the end of the day)
2. Post Lab Quiz Result. 5
3. Student Engagement in 5
Simulation/Demonstration/
Performance and Controls/Pre-Lab
Questions.
Signature of Faculty (with Date): Total Marks Obtained: 20

You might also like