ESP8266 Project : BMP180 readings on an OLED

In this particular example we are going to display temperature readings from a BMP180 on an OLED display, we will be using a Wemos mini and a variety of shields which make it easy to create projects like this with no wiring.

Lets take a look a the shields and boards that are required

 

Image Summary
The Wemos mini – ESP8266 based board, it comes with various headers. This is the beauty of it you can create stackable projects with the board and pin compatible shields
Another unofficial shield that is readily available – this time its a BMP180 sensor thats fitted
A  64×48 OLED screen
This is simply a base, you plug the Wemos Mini into one side and you can plug a shield or shields into the other side

 

 

 

Parts List

1 x Wemos Mini
1 x Wemos Dual Base
1 x OLED Shield
1 x BMP180 shield

I connect the Wemos Mini to the dual base and then put the OLED shield along side this, I then place the BMP180 shield on top of the Wemos Mini.

 

Code

Various libraries required – you can install these via the library manager, here are links to them

https://github.com/sparkfun/SparkFun_Micro_OLED_Arduino_Library 

 

[codesyntax lang=”cpp”]

#include <Wire.h>
#include <Adafruit_BMP085.h>
#include <SFE_MicroOLED.h> // Include the SFE_MicroOLED library
#define PIN_RESET 255 //
#define DC_JUMPER 0 // I2C Addres: 0 – 0x3C, 1 – 0x3D

MicroOLED oled(PIN_RESET, DC_JUMPER); // Example I2C declaration
Adafruit_BMP085 bmp;

void setup()
{
Serial.begin(9600);
if (!bmp.begin()) {
Serial.println(“Could not find a valid BMP180 sensor, check wiring!”);
while (1) {}
}
oled.begin();
oled.clear(ALL); // Clear the display’s memory (gets rid of artifacts)
oled.display();
}

void loop()
{
// Wait a few seconds between measurements.
delay(2000);

oled.clear(PAGE);
oled.setFontType(0); // set font type 0, please see declaration in SFE_MicroOLED.cpp
oled.setCursor(1, 3);
oled.print(“Pressure = “);
oled.setCursor(1, 12);
oled.print(bmp.readPressure());
oled.print(” Pa”);
oled.setCursor(1, 21);
oled.print(“Temp =”);
oled.setCursor(1, 30);
oled.print(bmp.readTemperature());
oled.print(” *C “);
oled.display();
delay(2000);
//2nd page of readings
oled.clear(PAGE);
oled.setFontType(0); // set font type 0, please see declaration in SFE_MicroOLED.cpp
oled.setCursor(1, 3);
oled.print(“Altitude = “);
oled.setCursor(1, 12);
oled.print(bmp.readAltitude());
oled.print(” m”);
oled.setCursor(1, 21);
oled.print(“Sea Level=”);
oled.setCursor(1, 30);
oled.print(bmp.readSealevelPressure());
oled.print(” Pa”);
oled.display();
}

[/codesyntax]

 

Again if you don’t want to type all of this in then you can download wemos_OLED_bmp180

Output

Here you can see the output and my setup

 

bmp180 output

 

Links

 

Smart Electronics D1 mini – Mini NodeMcu 4M bytes development board based ESP8266 by WeMos

0.66″ inch For Wemos Oled 64X48 IIC I2C LCD OLED LED Display Shield

Dual Base Expansion board for WeMos D1 mini NodeMCU ESP8266

Wemos BMP180 Digital Barometric Pressure Sensor Module Replace BMP085 BSG For Wemos D1 Mini

Related posts

Creating an infrared thermometer with a Wemos Mini and a MLX90614

ESP8266 based TMP175 temperature display project

ESP8266 MPL3115A2 pressure sensor project