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.
2. Tool Used:
AIM: Design a Cloud based weather monitoring system using IoT platform and relevant sensors.
#include <UbidotsESPMQTT.h>
University Institute of Engineering
Department of Computer Science & Engineering
#define BMP_SDA 21
University Institute of Engineering
Department of Computer Science & Engineering
#define BMP_SCL 22
Adafruit_BMP280 bmp280;
Ubidots client(TOKEN);
Serial.print(topic);
Serial.print("] ");
Serial.print((char)payload[i]);
Serial.println();
void setup() {
Serial.begin(9600);
Serial.println("Init... T2_Weather");
Serial.println("Initializing BMP280");
University Institute of Engineering
Department of Computer Science & Engineering
if (!status) {
Serial.println("Done");
Serial.print(WIFISSID);
Serial.println(WIFIPASS);
client.wifiConnection(WIFISSID, WIFIPASS);
Serial.println("Done");
account client.setDebug(true); // Pass a true or false bool value to activate debug messages
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");
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(9207);