I ended up getting a BMP180 pressure sensor. I also made a major change to my weatherstation: I have decided to make the transmitter using a 430G2553 microprocessor. By using deep sleep mode and only taking readings every 30 s or so, I can run the weatherstation off of two D batteries for much longer than an Arduino.
Components
- TI launchpad w/MSP430G2553
- BMP180 breakout board
Connections
VCC --> Launchpad VCC
GND --> Launchpad GND
SCL --> P1.6
SDA --> P1.7
Remove the P1.6 LED jumper as well.
How It Works
I modified the code to give pressure readings in inHg and temperature in Fahrenheit. To get temperature readings in Celsius, instantiate the BMP085 library with the argument
BMP085_C. Pressure is returned by default in hPa.
Interestingly, there are high precision modes, which can be activated when the BMP085 library is instantiated. I'm not using these, because I want to keep code size and power consumption low.
Before I setup my final weatherstation design, I'm considering going through the BMP085 library code and removing the temperature sensor functions, since I already have a dedicated temperature sensor. If not, I could just average both temperature sensor readings, so I'm not wasting clock cycles on unused data.
Show Code
I used the
BMP085 Template Library, which works fine with a BMP180. Here is some sample code that I've modified:
// Author: Zac DeMeo
// Uses BMP085 sensor library https://github.com/astuder/BMP085-template-library-Energia
// Import BMP085 sensor libraries
#include <Wire.h>
#include <BMP085_t.h>
BMP085<0, 0, BMP085_F> PSensor; // Instantiate sensor, 0 = low precision pressure reading
void setup() {
Serial.begin(9600); // Debugging only
Wire.begin(); // Initialize I2C for pressure sensor
PSensor.begin(); // Initialize pressure sensor
}
void loop() {
PSensor.refresh(); // read current sensor data
PSensor.calculate(); // run calculations for temperature and pressure
float p = (PSensor.pressure+50)*0.0002953; // Get pressure in inHg
float t = (PSensor.temperature/10.0); // Get temperature in F
Serial.print("Pressure: ");
Serial.print(p);
Serial.print(" inHg");
Serial.println();
Serial.print("Temperature: ");
Serial.print(t);
Serial.print(" F");
Serial.println();
delay(2000);
}