You are on page 1of 22

INSTITUTE - UIE

DEPARTMENT- ACADEMIC UNIT-1


Bachelor of Engineering

Disruptive Technologies-II
21ECH103

DISCOVER . LEARN . EMPOWER


Course Outcomes
CO Title Level
Number

CO1 Establish connectivity of IoT modules with cloud for sensor Remember
data collection and management.  
CO2 Design an appcessory with Bluetooth/Wi-Fi connectivity using Understand
standard mobile application development tools.  
CO3 Create robot prototypes enabled with sensors and actuators Apply
for restricted movement in different environments.

CO4 Develop augmented reality add-ons for smart-device Analyze and


applications to add interactivity, animate objects and build evaluate
logic into effects.
CO5 Demonstrate acquired skillset/technical knowledge of their Create
selected project topic.

2
AGENDA
Design a Cloud based weather monitoring system using IoT platform
and relevant sensors.
• #include <Adafruit_BMP280.h>

 Arduino library for BMP280 sensors.

• #include <UbidotsESPMQTT.h>

 MQTT library for connecting to Ubidots using MQTT protocol and an ESP32 board.
 MQTT(Message Queuing Telemetry Transport) is a standard messaging protocol for the Internet of
Things(IOT). It is ideal for connecting remote devices with a small code footprint and minimal network
bandwidth.
• #define BMP_SDA 21 //Serial data pin

• #define BMP_SCL 22 //Serial clock pin


• #define TOKEN "…………………." // Your Ubidots TOKEN

 A Token is a unique key that authorizes your device to interact with Ubidots API. A Device Token is a unique
key that is linked to a single device within Ubidots data base, with either one or both of the following permissions:
Send data: Publish to, or make POST requests to send data to the device.

• #define WIFISSID "……." // Your SSID

 A service set identifier (SSID) is a sequence of characters that uniquely names a wireless local area network. An
SSID is sometimes referred to as a "network name." This name allows stations to connect to the desired network
when multiple independent networks operate in the same physical area.
 SSIDs are a sequence of alphanumeric characters (letters or numbers), are case sensitive and can have a maximum
length of 32 characters.
• #define WIFIPASS "……….." // Your Wifi Pass

 It is a user defined password.

• Adafruit_BMP280 bmp280;

 Creating on object BMP for Adafruit_BMP280. An object file is created to access special functions.

• Ubidots client(TOKEN);

 Initialize the instance.


void setup() { //  Use it to initialize variables, pin modes, start using libraries, etc.The setup() function will only run once,
after each powerup or reset of the Arduino board.
  Serial.begin(9600); // This tells the Arduino to get ready to exchange messages with the Serial Monitor at a data rate of
9600 bits per second.
  Serial.println("Init... T2_Weather"); // Prints data to the serial port 
  
  Serial.println("Initializing BMP280"); // Prints data to the serial port 
  boolean status = bmp280.begin(0x76); // The device I2C address is either 0*76 or 0*77.
•   if (!status) { // Status is not available print not connected.
•     Serial.println("BMP280 Not connected!");
•   }
•   Serial.println("Done"); // otherwise done.
•   Serial.print("Connecting to SSID: "); // Connectivity with existing wifi.
•   Serial.print(WIFISSID);
•   Serial.print(", Password: ");
•   Serial.println(WIFIPASS);
•   client.wifiConnection(WIFISSID, WIFIPASS); // Client is the base class for all client based calls
•   Serial.println("Done");

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

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


to access API(Application Programming Interface)

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

•   client.begin(callback); // passing a pointer to a function

•   Serial.println("Done");

•   Serial.println("DONE");

}
•void loop() {//Repeat a section of code
•  float temp = bmp280.readTemperature(); // Acquiring data from BMP280
•  float pressure = bmp280.readPressure();
•  float altitude = bmp280.readAltitude();
•  float water_boiling_point = bmp280.waterBoilingPoint(pressure);
•  Serial.print("Temperature: "); // Printing data in serial port
•  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.print(water_boiling_point);

•   Serial.println(" F");

•   if (!client.connected()) {  // Establising connection with Ubidots

•     client.reconnect();

•   }

• For class client of Arduino, connected() is a function that tells Whether or not the client is connected. Note that a client is considered connected if the connection has
been closed but there is still unread data. Use syntax client.connected(). It Returns true if the client is connected, false if not. Reconnect function is used to reconnect
in case of disconnect. (every 5 seconds)
• // Publising data of both variable to Ubidots

• // add(char* variableLabel, float value, char *context, char *timestamp);

• Add a variable with a value, context and timestamp to be sent to a certain data source, once you use.

• // add() you can publish your variable using the ubidotsPublish() method.

•   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-system"); 

• // ubidotsPublish(char *deviceLabel);

• // Publishes the variables added to the specified device label.

•   client.loop();

• // Infinite loop for MQTT connection, insert it at the end of your routine

•   delay(5000);
Viva Voice Questions
• What are the most commonly used sensors in IOT?
• How did you measure the voltage using sensors?
• What is the purpose of Airflow sensors?

19
Summary
• BMP280 is an absolute barometric pressure sensor especially
designed for mobile applications. The sensor module is housed in an
extremely compact package. Its small dimensions and its low power
consumption allow for the implementation in battery driven devices
such as mobile phones, GPS modules or watches.
• Ubidots is a codeless IoT Platform designed to empower us to
prototype and scale IoT projects to production, whilst improving and
economizing the world around us with sensor data.

20
References
• https://www.bosch-sensortec.com/products/environmental-sensors/
pressure-sensors/bmp280/
• https://cdn-shop.adafruit.com/datasheets/BST-BMP280-DS001-11.pdf
• https://www.thethingsindustries.com/docs/integrations/cloud-integra
tions/ubidots/
• https://iot-fpms.fandom.com/wiki/Ubidots
• https://www.youtube.com/watch?v=YTQdTAXkq8Y

21
THANK YOU

For queries
Email:anuj.e10160@cumail.in

22

You might also like