Skip to content

Latest commit

 

History

History
108 lines (75 loc) · 3.7 KB

File metadata and controls

108 lines (75 loc) · 3.7 KB

*

* -

* #%L

* **********************************************************************

* ORGANIZATION : Pi4J

* PROJECT : Pi4J :: EXTENSION

* FILENAME : README.md

*

* This file is part of the Pi4J project. More information about

* this project can be found here: https://pi4j.com/

* **********************************************************************

* %%

* * Copyright (C) 2012 - 2022 Pi4J

* %%

*

* Licensed under the Apache License, Version 2.0 (the "License");

* you may not use this file except in compliance with the License.

* You may obtain a copy of the License at

*

*

* Unless required by applicable law or agreed to in writing, software

* distributed under the License is distributed on an "AS IS" BASIS,

* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.

* See the License for the specific language governing permissions and

* limitations under the License.

* #L%

*

https://www.nxp.com/docs/en/data-sheet/MPL3115A2.pdf

----Pi------------------MPL3115A2 -------
3.3v--------------------P1---Vdd
Grnd--------------------P2---Gnd
3.3v--------------------P3---3v
GPIO26------------------P4---INT2 USE: for DRDY
GPIO15------------------P5---INT1 USE: for P/A & T interrupt SCL---------------------P6---SCL
SDA---------------------P7---SDA

At present supports retrieval Temperature Pressure and Altitude.
A future commit will incorporate 'target' interrupt support.

  1. mvn clean package
  2. cd target/distribution
  3. sudo ./runMPL3115A2.sh

The application demonstrates usage of public interfaces to the chip.
The app obtains pressure, altitide and temperature in the commons formats.
It then adjusts the altitude calculation to use the local pressure Pa value.

Use of different bus or device address or GPIO, use the applicable values
in the following command.
sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t trace

Bus and address, GPIOs connected to int1 and int2 Trace level

sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t trace -x
Bus and address, GPIOs connected to int1 and int2 Trace level
-x reset chip. Initial chip access may fail to retrieve data and log an error
message. When the chip has completed reset normal data retrieval will resume.

// using limits and window
sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t trace

Read the temperature 'C' value. Set -TW and -TG a few degrees above this
value.
-PW pressure/alt window -PG pressure/alt limit -TW temp window -TG temp limit

sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -t info -PW 3 -PG 314 -TW 1 -TG 35

Use heat gun on circuit board and temp interrupt1 will fire.

The altimeter and pressure share the same registers for limit and window.
Whether your application last called getting the altimeter or pressure will
effect the chips comparisons and interrupt handler.

Example: If you set the altitude to 300 meters limit, but the previous
operation was getting the pressure, the chip will compare the pressure which
is a large value to that 300 limit and fire the interrupt.
So in this case, get the altitude value from the chip before setting the
altitude limit.

sudo ./runMPL3115A2.sh -b 0x01 -a 0x60 -int1 15 -int2 26 -Pa 97720
To restore the chip using its default pressure, set -Pa 101326 or reset
the chip.