Introduction

Preparation

Hardware: Software:

Connection

NodeMCU BMP180 sensor
VCC 3V3
GND GND
D2 SDA
D1 SCL

Upload Sketch

Connect the NodeMCU to computer via USB cable,open Node_mcu_bmp180  by using Arduino IDE(Version1.6.4+): Edit the code to fit your own WiFi and MQTT settings as following operations:

1)Hotspot Configration:

const char* ssid = "your_hotspot_ssid"; const char* password = "your_hotspot_password";
Find above code line,put your own ssid and password on there.

2)MQTT  Server  Address Setting

const char* mqtt_server = "broker.mqtt-dashboard.com";
You can use your own MQTT broker URL or IP address to set above mqtt_server value. You can also use some famous free MQTT server to test the project such as  "broker.mqtt-dashboard.com",  "iot.eclipse.org" etc.

3)MQTT Client Settings

If your MQTT broker require clientID,username and password authentication,you need to change
if (client.connect(clientId.c_str()))
to
if (client.connect(clientId,userName,passWord)) //put your clientId/userName/passWord here
If not,just keep them as default. After do that,choose the coresponding board type and port type as below,then upload the sketch to the NodeMCU.

MQTT Client Settings

About how to config the MQTT client,check this link. Topics Settings:

Running Result

Once the upload is successful, open arduino's monitor window, the following data will appear Temperature, pressure, and altitude appear on the BMP180 sensor.

Remote MQTT Client Settings

command message to publish Result
S When NodeMCU receives message "S", it will show pressure、altitude and temperature
other character When NodeMCU receives message "0",pelese print S in your phone for bmp180
If you send an S command on the MQTT Dashboard, the window will show the temperature, altitude, and barometric pressure. Sending 0 or other characters will prompt you to enter S. or directly Download the app from IOT MQTT Dashboard Android APP Client Id should be anything which is not blank, Server must be same as mqtt_server variable value in Arduino code port must be 1883 After completes the required fields, click "CREATE" button firendly name should be anything which is not blank, Topic fill in the bmp180 already defined in the code After completes the required fields, click "CREATE" button

Running Result

When the S command is input on the PUBLISH interface on the MQTT Dashboard of the mobile phone

In arduino's monitor window, you will see the following result

When you enter characters other than S on the MQTT Dashboard.

The following results are displayed in the arduino's monitor window.