EXPERIMENT 09
EXPERIMENT 09
2210040117
OM RAJ
SOFTWARES USED
1. ESP8266
2. BMP180 PressureSensor
3. Connecting Cables
4. DC 5V, 1A Power Adaptor
THEORY:
This precision sensor from Bosch is the best low-cost sensing solution for measuring barometric
pressure and temperature. Because pressure changes with altitude you can also use it as an
altimeter! The sensor is soldered onto a PCB with a 3.3V regulator, I2C level shifter and pull-up
resistors on the I2C pins.
The BMP180 is the next-generation of sensors from Bosch, and replaces the BMP085. The good
news is that it is completely identical to the BMP085 in terms of firmware/software - you can use
our BMP085 tutorial and any example code/libraries as a drop-in replacement. The XCLR pin is
not physically present on the BMP180 so if you need to know that data is ready you will need to
query the I2C bus.
This board is 5V compliant - a 3.3V regulator and a i2c level shifter circuit is included so you
can use this sensor safely with 5V logic and power.
Using the sensor is easy. For example, if you're using an Arduino, simply connect the VIN pin to
the 5V voltage pin, GND to ground, SCL to I2C Clock (Analog 5) and SDA to I2C Data (Analog
4). Then download our BMP085/BMP180 Arduino library and example code for temperature,
pressure and altitude calculation. Install the library, and load the example sketch. Immediately
you'll have precision temperature, pressure and altitude data.
HARDWARE CONNECTION:
INSTALL THE NECESSARY LIBRARY FILE:
CODE/PROGRAM:-
#include <ESP8266WiFi.h>
#include <SFE_BMP180.h>
#include <SPI.h>
#include <Wire.h>
void setup()
{
Serial.begin(115200); // open serial port, set the baud rate to 9600 bps
delay(10);
Serial.println("Connecting to ");
Serial.println(ssid);
WiFi.begin(ssid, pass);
while (WiFi.status() != WL_CONNECTED)
{
delay(500);
Serial.print(".");
}
Serial.println("");
Serial.println("WiFi connected");
Serial.println("REBOOT");
// Initialize the sensor (it is important to get calibration values stored on the device).
if (pressure.begin())
{
Serial.println("BMP180 init success");
}
else
{
// Oops, something went wrong, this is usually a connection problem,
// see the comments at the top of this sketch for the proper connections.
void loop()
{
char status;
double T,P,p0,a;
status = pressure.getTemperature(T);
if (status != 0)
{
// Print out the measurement:
Serial.print("temperature: ");
Serial.print(T,2);
Serial.print(" deg C, ");
Serial.print((9.0/5.0)*T+32.0,2);
Serial.println(" deg F");
status = pressure.startPressure(3);
if (status != 0)
{
// Wait for the measurement to complete:
delay(status);
// On the other hand, if you want to determine your altitude from the pressure reading,
// use the altitude function along with a baseline pressure (sea-level or other).
// Parameters: P = absolute pressure in mb, p0 = baseline pressure in mb.
// Result: a = altitude in m.
a = pressure.altitude(P,p0);
Serial.print("computed altitude: ");
Serial.print(a,0);
Serial.print(" meters, ");
Serial.print(a*3.28084,0);
Serial.println(" feet");
}
else Serial.println("error retrieving pressure measurement\n");
}
else Serial.println("error starting pressure measurement\n");
}
else Serial.println("error retrieving temperature measurement\n");
}
else Serial.println("error starting temperature measurement\n");
Serial.println("");
Serial.println("Data Send to Thingspeak");
}
client.stop();
Serial.println("Waiting...");
Serial.println("");
Serial.println("*************************************************");
delay(5000); // Pause for 5 seconds.
}
PRECAUTIONS
1. Use insulation tools while you connect the Circuit.
2. Wear Good Insulating Shoes.
3. Avoid contacting circuits with wet hands or wet materials.
4. Maintain a work space clear of extraneous material such as books, papers, and clothes.
5. Be careful while connecting any actuators in 230V AC Mains.
Results
VANGALA THANUSREE
REG NO:2210040049
ECE-HONOURS