Call it the “Internet of Things” or what you want, the days that the internet was only reserved for computers or even mobile devices are becoming a thing of the past. Especially with hardware getting smaller and a lot cheaper.

For less then €20 you can build a device that measures a wide range of parameters (temperature, air pressure, air quality, lightning to name a few ) and pushes this information to the internet. For this experiment I decided to build an on-line barometer.

The electronics

The sensor that I have chosen for this project is the Bosh BMP085. It is cheap (you can find a breakout board for €5 on ebay) and there is a lot of example code available for using it with an Arduino.

The Arduino is an inexpensive prototyping platform that I’m a big fan of. There is an open source IDE and you can use a C like language to program the board. It is also relatively easy to build something that you can connect to the internet when you combine the Arduino with an Ethernetshield.

The biggest challenge was keeping the code base small, as the microprocessor only has 32 Kbytes of available memory. A big chunk of it went to the IP stack that is needed for the internet connectivity.

arduino_bmp085.png

Mongo & Node.js

For processing the data (which is send every minute) and displaying the dashboard I chose a node.js solution. The packages that I used are express, underscore.js, chart.js, socket.io and the mongodb driver.

At the time I started this project I was also following a MongoDb course. As I wanted something different to experiment with than only a collection of zip codes, it looked like a good idea to write the barometric readings to a Mongo collection.

I’m not going to claim that a NoSQL database was the best or only storage solution, but the aggregation framework did make my life a lot easier.

The dashboard

I kept it rather simple. There is a (simplistic) trend projection and some charts. The dashboard also updates in real time and that every time the arduino sends new barometric pressure readings to the server.

arduino_bmp085.png

Adjusting for sea level

When I compared my first readings against that of a nearby airfield, I noticed that my readings were 3hpa lower. While the local pressure can be different, the difference was just too high. 3hpa = +/- 30m height difference and that is certainly not the case.

The reason was that the Bosh BMP085 sensor reports absolute pressure values. Weather stations and airports reports the pressure at sea level. So I ended up writing code to adjust the pressure for sea level and that based on a formula that I found in the data sheet.

arduino_bmp085.png

The formula looks daunting, but is really easy to work out in code. You only need to fill in 2 things: p the absolute pressure that is measured and the altitude of where you are measuring from. The rest is just basic math.

Source code

All of the source code and diagrams can be found on my github account.