This an example to messure pressure (that equals water depth) using a Raspberry Pi, an ADC Pi shield and a couple of MPX5050 pressure sensors.
- Wire pin 1 of the first MPX5050 to
A1
on the ADC Pi. - Wire pin 1 of the second MPX5050 to
A2
on the ADC Pi. - Wire pin 2 of both MPX5050 sensors to
GND
on the ADC Pi. - Wire pin 3 of both MPX5050 sensors to
5V
on the ADC Pi. - Wire pin
A8
on the ADC Pi to a 5V source (i used a 5V address selection pin on the ADC Pi).
Just run bin/mpx5050, the expected output is:
# ./mpx5050
channel v kpa m
----------------------------------------------------------------
1 0.855210 7.167939 0.730930
2 0.351403 1.636162 0.166843
vcc 5.059726
Since the MPX5050 sensors have a small offset error and linear output
from Vcc to Vss that isn't exactly 5 V, the mpx5050
script can take
that into account to give more precise output.
To calibrate your sensors follow this steps:
-
Without applying pressure run
mpx5050
and write down channel 1, 2 and vcc volts values. -
On the
mpx5050
script setcal_on
to 1 and fillvcc_cal
,mpx_cal1
andmpx_cal2
with the values from step 1.
See the transfer function on the MPX5050 datasheet for more information.
Manuel Rábade <manuel@rabade.net>
Based on adcpiv2.py demo by ABE Electronics UK.
This work is published under a Creative Commons Attribution 4.0 International License.