Connecting the barometer to Wise Clock 4 is trivial: I soldered wires directly to processor pins (SDA, SCL, VCC and GND), as shown in the photo. There is plenty of clearance between the board and the display.
In the software, as mentioned, I used the Adafruit BMP085 library, which also covers the compatible BMP180. There is no extra setting required from the user: the pressure is displayed together with the temperature, and enabled/disabled from the TEMP+/- menus. Also, there is no extra settings when compiling/building: if the BMP180 module is not installed, no pressure data will be displayed.
Essentially, the new code consists of 2 functions added to the AppTmp class:
boolean CAppTmp::initBarometer()
{
bmp = new Adafruit_BMP085_Unified(10085);
isBaro = bmp->begin();
}
int CAppTmp::getPressure()
{
int pressure = 0;
if (isBaro)
{
sensors_event_t event;
bmp->getEvent(&event);
if (event.pressure)
{
pressure = event.pressure;
}
}
return pressure;
}
Another nice thing about BMP180 is that it can also provide the temperature. But, like DS3231, it seems to be a little off compared with a regular thermometer sitting nearby.
Next, I will try to attache the little barometer to wsduino in an aesthetically pleasing manner, probably in the empty space in the top left corner.
No comments:
Post a Comment