Cubieboard with BMP085 Barometer, Alittute, Temperature

I’ve bought  BMP085 barometric pressure sensor and my goal was to get pressure and temperature data via I2C interface to my Cubieboard running linux (cubieboard2-lubuntu-installation).

If you want to enable I2C port on you Cubieboard / Cubieboard2, pls refere to my previous post: i2c-on-cubieboard-with-lubuntu

I2C is a useful bus for two main reasons:

  • It only requires two shared lines: SCL for the clock signal, and SDA for the bi-direction data transfers.
  • Each I2C device uses a unique 7-bit address, meaning you can have more than 120 unique I2C devices sharing the bus, and you can freely communicate with them one at a time on an as-needed basis.

This sensor is very cheap and you can buy it for les then 5€ from ebay.

I found very usefull guide for raspberry pi from adafruit.
Since I will use python, you need already installed python with smbus module:

apt-get install python-smbus

I have changed the needed files from the adafruit git and you can download modified files to work with cubieboard.

  • barometer.py
  • Adafruit_I2C.py
  • Adafruit_BMP085.py

Get data from BMP085 barometer pressure sensor by running:

sudo ./barometer.py

By diving into arduino BMP085 libs I found the calculation, how to use the real altitude to recalculate atmospheric mean see level pressure and translate it from C to python to get the requested result that I named AltPressure.  This calculation was not in adafruit sources for raspberry.

AltPressure is the pressure adjusted by knowing the real altitude. In my case it’s 150m. Pleass change the value according to your altitude if you want to use the BMP085 for weather atmospheric pressure.

Change the altitude in barometer.py file according to your current altitude.

altitute_in_cm = 15000  # 150 m in cm

I configured crontab to store weather atmospheric pressure value very hour and used apache with php to depicted values in chart.


Type crontab -e to configure cron and add this line that will store all values in bar.log file every hour:

0 * * * * sudo bash -c /home/linaro/projects/bmp085/barometer.py >> /home/linaro/projects/bmp085/bar.log

Other usefull links:


Related Posts

Kippo honeypot on Cubieboard Ubuntu

3

Kippo is an SSH honeypot written in Python. Kippo is used to log brute force attacks and the entire shell interaction performed by an attacker so I have installed it on my cubieboard2 Lubuntu version.[…]

Continue reading ...

Lubuntu – installing VNC server

vnc

I use vnc to access graphic interface from my PC to cubieboard that runs on lubuntu. I have chosen tightvncserver and spent some time to configure and run it. Also to my surprise it took me[…]

Continue reading ...

Apache+PHP on Cubieboard with Lubuntu

apache-logo

I executed the following steps to install apache with PHP on my cubieboard2 with lubuntu. Lets start with installation that will take about 25MB: sudo apt-get install apache2 sudo apt-get install php5 sudo /etc/init.d/apache2 restart[…]

Continue reading ...
  • http://www.blogger.com/profile/05834026475842811834 Pistoletov

    Hi! I just try to compile py files and receive a lot of errors.
    [root@alarm examples2]# ./barometer.py
    File "./barometer.py", line 42
    print datetime.datetime.today().strftime("%Y-%m-%d %H:%M:%St"),

  • http://www.blogger.com/profile/05834026475842811834 Pistoletov

    SyntaxError: invalid syntax
    I suppouse that the problem in python version my version is
    Python 3.4.3

  • http://www.blogger.com/profile/04882722492963296603 homecircuits

    Should by the version problem. My python is: Python 2.7.3
    Usage of comma in print is a problem since it is not the same in python v3 according to: http://stackoverflow.com/questions/18908897/whats-ending-comma-in-print-function-for

    Try to use the commented lines for print:
    #print "Temperature: %.2f C" % temp
    #print "Pressure: %.2f hPa" % (pressure / 100.0)
    #print "AltPressure: %.2f hPa" % (altPressure / 100.0)
    #print "Altitude: %.2f" % altitude