A simple port of the Adafruit MPL3115A2 barometric/altitude pressure sensor to the RPi
This code is based on both https://github.com/ControlEverythingCommunity/MPL3115A2/ and https://raw.githubusercontent.com/adafruit/Adafruit_MPL3115A2_Library
Note: The code is not complete. Feel free to use, modify, and pull update
Adafruit MPL3115A2 uses I2C to communicate with the Pi.
Rpi Pin | MPL3115A2 |
---|---|
PIN #1 (3.3v) | 3V |
PIN #3 (SDA1 / I2C) | SDA |
PIN #3 (SDL1 / I2C) | SDL |
PIN #6 (GND) | GND |
I have attached picture of the wiring
Basically, all your have to do is enable I2C communication.
Log in to your pi, and run:
sudo raspi-config
Navigate to the "Interfacing Options"
Choose "I2C"
Enable "I2C"
Reboot
sudo reboot
Login to the Pi, and execute the following:
sudo apt-get install git python-smbus
git clone https://github.com/phenelle/RPi_MPL3115A2
cd RPi_MPL3115A2
python RPi_MPL3115A2.py