Pulse read out data logger for water meter

Hi,

I have an off grid cabin with 2 water meters. One for potable water and one for irrigation. They both have pulse read out capability and I have the cables to connect to a logger.

I would like to set up a Raspberry Pi Zero with WiFi and log the pulses seperatly with date and time stamps as a minimum and write to a tab deliminated text file.

From there I could run a Cron job to upload the files to my OneDrive for further analysis.

Alternatively write a more advanced python script to create a text file that aggregates the daily, monthly and annual water consumption in a separate Collum.

Do you think that the Raspberry Pi Zero would be able to handle this and any suggestions for a script.

I assume that I will need;

1 Raspberry Pi Zero with WiFi

1 Power supply (I have 240V from a solar power system)

1 set of solder pins to allow for the end of the data logger cables to connect to the Pi.

Thank you for you advise in advance.

1 Like

I’m sure you could.. or, a Pico W would also work just fine. Pico 2W - even better! These are REALLY cheap… but quite powerful.

In my project I measure a few things, and log datestamped records. One of my measure looks at 50Hz zero-crossings on a photodiode-linked connection to a mains relay. This sort of stuff is pretty easy on a Pico (or Pi)

If you don’t have prior experience coding this sort of thing, I’m happy to help you get started.

Cheers, T.

1 Like

Thank you for your quick reply Trevor, I will have a look at the Pico 2W and come back to you if I need some assistance with code.

2 Likes

Andreas…are you across the hardware aspects of interfacing the water meter pulse output to the Pico? I have no idea of your experience level… just note you should not present anything over 3.3V to the Pico GPIO pins.

We can provide further advice if you give us more info on the nature of the pulses from the meter. You may need some interface logic… This is all very similar to what I have done in my project!

Cheers, T.

2 Likes

Hi Trevor,

I have purchased the Pico W Perma-Proto Kit and drawn up a schematic of the proposed set up. The water meters have a simple reed switch and provide a pulse per 1 L and 5 L respective.

I will solder the parts onto the maker board tomorrow and then upload Micro Python.

PicoW_WM_logger_1.0.pdf (72.1 KB)

1 Like

Hi @Andreas165391,

How did you got with the data logger? Did you run into any issues?

Hi Jane,

so far so good, assembled the Pico on the board as per photo and schematic, installed Micropython and checked that everything worked. Also tried to connect to the internet and that is fine too.

I have started to write some basic code based on an example I found on the web to count the switch activation. This will take a bit of time as I need to;

  1. Connect to the WiFi on start up
  2. Syncronise the PICO clock
  3. Read the reed switch from each meter
  4. Write it to a CSV or text file

Later I would like to run a web server that shows the data in L/day, week, month and year.

PicoW_WM_logger_1.1.pdf (73.1 KB)

1 Like

Just had a quick glance at the schematic in the pdf and some thoughts to help protect things a little.

I think adding a current limiting resistor between the 3v3 and the screw terminal could be worth it. I’m not a pico person, so need to look up the max GPIO input/sink current and work out the resistor size to keep things under that.

This will protect 2 key things.

  1. The pico 3.3V supply if a short happens somewhere.
  2. IF GPIO20/21 for some reason are put into output mode and set to “0/Low”.

Im happy if there is some protection already in the pico, but normally there is not.

i.e. A GPIO pin in input mode will/should be in high impedance, so no current should flow into the pico, it should just see if its High or Low.
When a GPIO is in output mode, when set to High it will output 3.3V, when set to Low its connected to ground to pull down the line, so without the current limiting resistor, you will be trying to sink the the 3.3V direct to ground (when the reed switch is closed).

I do note this is not how its operating, more a just in case.

On a 2nd point, you MAY get an issue with the signal at GPIO20/21 staying high after the read switch opens. This can be due to the power having no where to go. Adding a high value resister like 10K - 50K (or more) between the GPIO20 to ground and the same for 21.
So when the reed switch is closed, power will have a very slow sink to ground via these resistors and still present a V at the GPIO pin, then when the reed switch opens, any remaining power will drain to ground.

Need to do that math as the resistor on the 3.3v line and the sink resistors will create a voltage divider, so just need to make sure the V at the GPIO is still strong enough.

Some quick math (needs checking and finding the actual max current for the pico gpio)
3.3V 25mA
R = V/I = 3.3/0.025 = 123 ohms
Lets say a 20K sink resistor, that should give about 3.28V at the GPIO when High, so plenty.

Just a thought.

1 Like