Professional Documents
Culture Documents
Experiment: 1.2
1. Aim of the practical: Design a Cloud based weather monitoring system using IoT
platform and relevant sensors.
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
Adafruit_BMP280 bmp280;
Ubidots client(TOKEN);
Serial.print(topic);
Serial.print("] ");
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");
if (!status) {
}
Serial.println("Done");
Serial.print(WIFISSID);
Serial.println(WIFIPASS);
client.wifiConnection(WIFISSID, WIFIPASS);
Serial.println("Done");
client.begin(callback);
Serial.println("Done");
Serial.println("DONE");
void loop() {
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.println(" F");
if (!client.connected()) {
client.reconnect();
}
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.loop();
delay(5000);
}
University Institute of Engineering
Department of Computer Science & Engineering
6. Result and Summary:After uploading code the pressure and temperature is showing in
ubidots perfectly.
2.Use of ubidots.
University Institute of Engineering
Department of Computer Science & Engineering