Week 2 Individual Research

Image result for bmp180 labeled

I decide to start and to assemble my part. the diagram above shows a four pin bmp180 sensor but mine has 5 pins. But I only need to set up four of them.

On BMP180  On Arduino Board
VCC 3V3
GND GND
SCL A5
SDA A4

After setting up the circuit I needed to find some example codes online:

The first code i found and tries was a code by Smart Microcontroller Channel

void setup() {
Serial.begin(9600);
bmp.begin();
}

void loop() {
Serial.print(“Temperature = “);
Serial.print(bmp.readTemperature());
Serial.println(” C”);

Serial.print(“Pressure = “);
Serial.print(bmp.readPressure());
Serial.println(” Pa”);

Serial.print(“Altitude = “);
Serial.print(bmp.readAltitude());
Serial.println(” meters”);

Serial.println();
delay(2000);

But using this code I found that I was getting false readings and that i would only be given the pressure and the altitude and not the temperature. and the readings it give me for the pressure and the altitude were wrong as well.

Temperature  0.0C 
Pressure  234 Pa 
Altitude  30367.0 Meters 

To check that it wasn’t the code that was wrong and not me or the BMP180 I tried a different code.

This code was by Paul McWhorter

#include “Wire.h” // imports the wire library for talking over I2C
#include “Adafruit_BMP085.h” // import the Pressure Sensor Library
Adafruit_BMP085 mySensor; // create sensor object called mySensor

float tempC; // Variable for holding temp in C
float tempF; // Variable for holding temp in F
float pressure; //Variable for holding pressure reading

void setup(){
Serial.begin(9600); //turn on serial monitor
mySensor.begin(); //initialize mySensor
}

void loop() {
tempC = mySensor.readTemperature(); // Read Temperature
tempF = tempC*1.8 + 32.; // Convert degrees C to F
pressure=mySensor.readPressure(); //Read Pressure

Serial.print(“The Temp is: “); //Print Your results
Serial.print(tempF);
Serial.println(” degrees F”);
Serial.print(“The Pressure is: “);
Serial.print(pressure);
Serial.println(” Pa.”);
Serial.println(“”);
delay(250); //Pause between readings.
}

 

I had to change this code slightly those as this guy has set it up to tell the temperature in Fahrenheit.

But again in this coding the results were coming out wrong. The pressure was again 234 Pa and there was no temperature.

Next thing i need to do is try and find some test i can do to see if my part is working correctly.

Advertisements

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s