Temperature, Humidity Sensor Tutorial for BMP180 Sensor
In this section we’ll walk through creating a Temperature Sensor using ESP32, ESP8266 and then view the temperature via Alexa, Google Home or SmartThings.
Prerequisites :
- ESP32, ESP8266 x 1.
- BMP180 x 1.
- Jumper Wires.
Quick introduction to BMP180 Temperature Sensor
The BMP180 sensor is a digital barometric pressure and temperature sensor from Bosch. The BMP180 sensor can measure barometric pressure within a range of 300 to 1100 hPa (9000 m to -500 m above sea level) with an accuracy of ±0.12 hPa. It can also measure temperature within a range of -40 to +85 °C with an accuracy of ±2 °C. The BMP180 sensor communicates with other devices using the I2C interface. It is a low-power sensor that consumes only 3 μA in standby mode.
Wiring for BMP180 with ESP8266
ESP8266 | BMP180 Pin |
3.3V | Vin |
GND | GND |
SCL | 5 (D1) |
SDA | 4 (D2) |
Please note that you must use I2C pins in ESP8266.
Wiring for BMP180 with ESP32
ESP32 | BMP180 Pin |
---|---|
3.3V | Vin |
GND | GND |
SCL | 22 |
SDA | 21 |
Please note that you must use I2C pins in ESP32.
Let’s verify that temperature is wired correctly and working.
Step 1 : Install supporting libraries
- Install the BMP_085 library
- Install the Adafruit_Sensor library
- Install Sinric Pro Library
Step 1 : Create a new device in Sinric Pro
- Login to your Sinric Pro account, go to Devices menu on your left and click Add Device button (On top left).
- Enter the device name Temperature Sensor, description My Temperature Sensor and select the device type as Temperature Sensor.
- Click Next the in the Notifications tab
You can set the threshold here to receive a push notification via the Sinric Pro app when the temperature goes below or above a certain temperature. Use the Retrigger Time to set the delay between notifications.
-
Click Others tab and Click Save
-
Next screen will show the credentials required to connect the device you just created.
- Copy the Device Id, App Key and App Secret Keep these values secure. DO NOT SHARE THEM ON PUBLIC FORUMS !
Step 2 : Connect to Sinric Pro
You can generate the code using Zero Code feature or write it by your self. If you do not have programming experice, we recommend to use Zero Code feature in the Portal to generate the code, download and flash.
2.1 Complete Code
Now you should be able to view the temperature via Sinric Pro App
Please note that Google Home App shows the temperature sensor as a Thermostat due to Google Home limitations.
Troubleshooting
-
This tutorial is for BMP180. Make sure it’s not BME280 module.
-
Error: Could not find BMP180 sensor!. It’s likely you have not wired correctly. You can run the I2C scanner sketch to check whether the sensor is wired correctly.
-
Please refer to our common Troubleshooting page for more details.
This document is open source. See a typo? Please create an issue