Objective:
In this project, we will use raspberry pi to get environment temperature, pressure from BMP180 sensor and calculate attitude, then display the result to monitor.
Parts and Devices
1 x raspberry Pi3
1 x GPIO to Breadboard 40-pin breakout interface
1 x BMP180
USB mouse and keyboard
1 x HDMI cable and monitor(or HDMI TV)
breadboard and jump wires
Circuit Graph:
Software Installation:
1)download BMP Python Library by typing following command:
wget http://osoyoo.com/driver/Adafruit_Python_BMP.tar.gz
sudo tar zxvf Adafruit_Python_BMP.tar.gz
2) Open I2C interface
Enter the following command in terminal: sudo nano /boot/config.txt
Move mouse point to the place as following picture, and change “#dtparam=i2c_arm=on” ( or “#dtparam=i2c_arm=off”) into “dtparam=i2c_arm=on”
Then press “ctrl” + “X” and type “Y” to save the file and exit nano editor. After this, restart your Raspberry Pi and then I2C interfact will be open.
3)install BMP Python Library
cd Adafruit_Python_BMP
sudo python setup.py install
4) test BMP180 program
cd examples
sudo python simpletest.py
5) result
after running code, you will see result as per following picture:
DownLoad Url osoyoo.com
You must be logged in to post a comment.
Hi, I get an error when I follow the install instructions and try to run the simpletest.py program:
…
IOError: [Errno 2] No such file or directory: ‘/dev/i2c-1’
Any clues?
Philbert
this is the last stack trace line, it gets invoked when the sensor = BMP085.BMP085() is called.
You need to open I2C interface. We have improve the tutorial and then follow the step 2 to open I2C interface.
sudo tar zxvf Adafruit_Python_BMP.tar.gz
の後に
sudo tar xvf Adafruit_Python_BMP.tar
を実行する必要がある。
ありがとうございました。修正しました。