Skip to content

ehedman/flowSensor

Repository files navigation

Raspberry Pi Pico W flowSensor and TDS Meter

Marine water flow sensor and meter

Hardware used

  • Raspberry Pi Pico W
  • Waveshare Precision RTC module
  • Waveshare 1.14" color display
  • A water flow sensor
  • A TDS sensor Module (Gravity TDS module)
  • A Conductivity probe (Hanna HI7634-00)

Features

  • Monitor filter elapse time
  • Monitor total flow through filter
  • Monitor volume / time
  • Monitor TDS water Quality and water temperature
  • Real-time trim of TDS probe K-value from web page
  • Real-time trim of Q value for the flow sensor from web page
  • Live graphical dashboard
  • Near end of filter life alert
  • End of filter life alert
  • Automatic data memorised in flash
  • WiFi connectivity, NTP and HTTPD functions
  • WiFi connectivity management for AP and STA modes

Environment

  • Linux Mint (Debian/Ubuntu) platform for development
  • The folder structure of this application follows the Waveshare SDK "Pico_code/c" structure. The free Waveshare libs are included here.

Build

  • Install Pico SDK (if not installed already)
  • Install pico_extras (if not installed previousy) using the script preparePico-extras.sh
  • Alter the default WiFi credentials in ./examples/water-ctrl.h
  • mkdir build; cd build; PICO_BOARD=pico_w cmake ..
  • make fsdata (make embedded file system to hold html index files etc. Run each time html files has been changed)
  • make (to produce the executable main.uf2)
  • make install will install the main.uf2 into /media/(your logname)/RPI-RP2 assuming here that this folder is automounted when the Pico is set to "BOOTSEL" mode.
  • The hostname of this Pico W is set to DigiFlow, so it should be possible to surf in to the device referenced that name (+plus your domain name).

Test

It is possible to test this app on a bare Pico W without the extra hats and just browse in to this device home page. In such case, disable the RTC define in the water-ctrl.h to get sane date timestamps.

The first time this app is installed on a fresh Pico W, the pico will enter AP (Access Point) mode and from there it can be configured as a ordinary (STA) wifi node. The passord for AP mode is "digiflow" and the GW I.P is 192.168.4.1 to point your browsser to.

It is also possibe to switch between these modes by using the display (GPIO) buttons. The AP mode is considered a "rescue" mode if the pico is somehow lost in the wifi universe.

It is possible to simulate a flow sensor by applying a 2.5 Volt square wave to GPIO(5) at a frequency between 1 to 110 Hz.

To simulate a TDS Water Quality Sensor, regulate with a pot a voltage between 0 to 3.3v at GPIO(26).

To folow the console output, attach a seral to USB dongle to the Picos' No 1 (output) pin.

External dependencies

Screenshot

Check THIS out




The main components