top of page
Writer's pictureRamesh G

IoT Based Temperature, Altitude and Pressure Monitor using BMP180 and Ubidots IoT Platform


In this tutorial, you will learn how to use the BMP180 sensor with NodeMCU ESP8266 wifi module, 4 line LCD display with the help of this project you can monitor the temperature, pressure, and Altitude values using Ubidots dashboard from anywhere around the world. Ubidots IoT cloud platforms can be used to manage, process, and transfers the information from IoT devices to cloud or from cloud to the connected device with the help of the Internet.

Uploaded data can also be visualized on Ubidots Dashboard with the help of Widgets.


Circuit Diagram



Components Required

  • NodeMCU ESP8266

  • BMP180 Sensor

  • Jumper Wires


BMP180 Sensor

BMP180 is a high precision sensor designed for consumer applications. Barometric Pressure is nothing but weight of air applied on everything. The air has weight and wherever there is air its pressure is felt. BMP180 sensor senses that pressure and provides that information in digital output. Also the temperature affects the pressure and so we need temperature compensated pressure reading. To compensate, the BM180 also has good temperature sensor.

BMP180 is available in two modules. One is Five pin module and other is Four pin module. With Five pin module we have additional +3.3V pin which is absent in four pin module. Other than that the functioning is same.

The BMP180 barometric sensor uses I2C communication protocol. So, you need to use the SDA and SCL pins of the ESP8266 12E.

Pin Name Description

VCC- Connected to 3.3V

GND- Connected to ground.

SDA- Serial Data pin (I2C interface)

SCL- Serial Clock pin (I2C interface)



BMP180 MODULE Features

  • Can measure temperature and altitude.

  • Pressure range: 300 to 1100hPa

  • High relative accuracy of ±0.12hPa

  • Can work on low voltages

  • 3.4Mhz I2C interface

  • Low power consumption (3uA)

  • Pressure conversion time: 5msec

  • Potable size

BMP180 MODULE Specifications

  • Operating voltage of BMP180: 1.3V – 3.6V

  • Input voltage of BMP180MODULE: 3.3V to 5.5V

  • Peak current : 1000uA

  • Consumes 0.1uA standby

  • Maximum voltage at SDA , SCL : VCC + 0.3V

  • Operating temperature: -40ºC to +80ºC

BMP180 Equivalents

BMP280, BMP085, etc


Ubidots Setup

Ubidots has become popular as an affordable, reliable, and most usable platform for building an IoT application enabled ecosystem within hardware, software, and embedded engineering industry. To send the data, first create an account on Ubidots. After completing the account setup, click on the user dropdown menu and click API documentation. Make a note of your Default Token as it will be write in Arduino code.






NodeMCU

NodeMCU ESP8266-12E MCU is a development board with one analogue and many general-purpose input output (GPIO) pins. It has 4MB flash memory, and can operate at a default clock frequency of 80MHz. In this project, digital pin D1, D2 of NodeMCU is connected to SCL, SDA pin of BMP180 Sensor and LCD display.


Installing the BMP_085 Library

Download BMP_085 library by Adafruit. This library is compatible with the BMP085 and the BMP180 sensors.

Download Ubidots.h is used to send data to the Ubidots platform.

Download Liquid crystal Library.


After downloading the .zip files, add the libraries in Arduino IDE by clicking on


To install the library navigate to the Sketch > Include Library > Manage Libraries… Wait for Library Manager to download libraries index and update list of installed libraries.


Subscribe and download code.


Arduino Code:

#include <ESP8266WiFi.h>

#include <Wire.h>

#include <Adafruit_Sensor.h>

#include <Adafruit_BMP085.h>

#include <Adafruit_BMP085_U.h>

Adafruit_BMP085_Unified bmp = Adafruit_BMP085_Unified(10085);


// WiFi network Credentials

////const char* ssid = "TP-Link_3200"; // replace with your SSID

//const char* password = "95001121379884265554"; //Replace with your WIFI Password



#include "UbidotsMicroESP8266.h"

#define TOKEN "BBFF-HYfUHivZQVJKjxO12FkQ6X7SWDpdiy" // replace with your Ubidots TOKEN here

Ubidots client(TOKEN);

#define WIFISSID "TP-Link_3200" // your SSID

#define PASSWORD "95001121379884265554" // your wifi password



#include <LiquidCrystal_I2C.h>

LiquidCrystal_I2C lcd(0x27,20,4);


void setup() {

Serial.begin(9600);

lcd.init(); // initialize the lcd

// Print a message to the LCD.

lcd.backlight();

delay(100);

if (!bmp.begin()) {

Serial.print("Ooops, no BMP085 detected ... Check your wiring or I2C ADDR!");

while (1) {}

}


Serial.print("Connecting to ");

//Serial.println(ssid);

//WiFi.begin(ssid, password);

while (WiFi.status() != WL_CONNECTED) {

delay(500);

client.wifiConnection(WIFISSID, PASSWORD);

Serial.print(".");

}

Serial.println("");

Serial.println("WiFi is connected");

}

void loop() {

sensors_event_t event;

bmp.getEvent(&event);


if (event.pressure)

{

Serial.print("Pressure = ");

Serial.print(event.pressure);

Serial.println(" hPa");

float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA;

Serial.print("Altitude = ");

Serial.print(bmp.pressureToAltitude(seaLevelPressure,

event.pressure));

Serial.println(" m");

Serial.println("");

float temperature;

bmp.getTemperature(&temperature);

Serial.print("Temperature: ");

Serial.print(temperature);

Serial.println(" C");

client.sendAll(true);

}

lcd.setCursor(0,0);

lcd.print("Weather Monitor");

float seaLevelPressure = SENSORS_PRESSURE_SEALEVELHPA;

lcd.setCursor(0,1);

lcd.print("Altitude m: ");

lcd.print(bmp.pressureToAltitude(seaLevelPressure,

event.pressure));

lcd.print(" ");

float temperature;

bmp.getTemperature(&temperature);

lcd.setCursor(0,2);

lcd.print("Temp ");

lcd.print((char)223);

lcd.print("C: ");

lcd.print(temperature);

lcd.print(" ");

lcd.setCursor(0,3);

lcd.print("Press mb: ");

lcd.print(event.pressure);

lcd.print(" ");

delay(5000);

}

Comments


bottom of page