This web page shows how you can quickly setup your own Urinary Flow meter using a Raspberry Pi.
In my implemenation I chose to use a 5 gallon pail placed conveniently beside the bed, for easy access.
A urinary flow meter measures millilitres of urine per second. The easiest way to measure flow rate
is to measure the weight change versus time and convert to flow rate. Fortunately the conversion
is very simple. Since 1 millilitre of water weights 1g, if we measure a weight change of 1g in one second then know the flow rate is 1ml/sec.
The above picture shows the basic structure:
-funnel to collect the urine.
-container to hold the urine.
-loadcell assembly to measure the change in weight versus time.
Further Flow definitions are in this pdf file.
Many studies use urinary flow rates. A sample of those studies are in this pdf file.
The basic components of the flow meter are:
1. Load Cell (recommend 1kg size : Adafruit 4540)
https://www.digikey.ca/en/products/detail/adafruit-industries-llc/4540/12323569
2. Load Cell Amplifier: HX711 type Sparkfun SEN-13879
https://www.digikey.ca/en/products/detail/sparkfun-electronics/SEN-13879/6202732
3. Raspberry Pi (likely any version)
https://www.digikey.ca/en/products/detail/raspberry-pi/SC1111/21658261
The Raspberry Pi HX711 C++ Library software is available from:
https://github.com/endail/hx711
Install the software as follows:
pi@raspberrypi:~ $ git clone --depth=1 https://github.com/endail/hx711
pi@raspberrypi:~ $ cd hx711
pi@raspberrypi:~/hx711 $ make && sudo make install
pi@raspberrypi:~ $ sudo ldconfig
Download the hxBPH.cpp file and place it in the Raspberry Pi /home/pi directory
Also install gnuplot and imagemagick (recommended) on the raspberry pi:
pi@raspberrypi:~ $ sudo apt-get install gnuplot-x11
pi@raspberrypi:~ $ sudo apt-get install imagemagick
Calibrate the load cell
Run the calibration program as follows:
pi@raspberrypi:~ $ sudo /home/pi/hx711/bin/hx711calibration 2 3
then use enter the returned calibrations number on line 82 of the hxBPH.cpp program.
Example: AdvancedHX711 hx(2, 3, 1104, 152084, Rate::HZ_10);
Compile using:
pi@raspberrypi:~ $ g++ -std=c++20 -Wall -o hxBPH hxBPH.cpp -lhx711 -llgpio
Run using:
pi@raspberrypi:~ $ sudo /home/pi/hxBPH
The cpp program on the raspberry pi continually reads the weight 10 times per second. It automatically
detects a urine session, saves the data and graphs each result.
An example data file is 2024-04-02-Time-12-49-qM-68-qT-137.dat
Note that the name of the file can be broken down to the following information:
1. Date and Time
2. qMax (qM-68, is 6.8ml/sec)
3. Total Flow volume (qT-137, is 137ml total volume)
The resulting graph is shown here:
It is also useful to compile long time stats of changes in flow rate, etc. This is done by coping and pasting all the file names into a spread sheet. File names can be exported using the follow command line:
pi@raspberrypi:~ $ ls *.dat > list-2024-05-22.txt
An example spreadsheet in libre office is FlowAnalysis-2024-04-03.ods
An example graph of flow rate versus time is shown below:
Another view of the Scale Assembly.
Wiring to the Raspberry Pi.