PDA

View Full Version : water flow meter..



ecca
- 17th July 2006, 16:31
Hi everyone,
I'm looking for ideas.
I want to use a flow sensor to measure incoming water flow using a PIC chip.
I have Pic basic pro.
The sensor I have, and it delivers 3000 odd pulses per litre.
I want to display on a LCD display the amount of water flowed, in litres.
I want the data to be retained when the power is switched off and I want a reset switch to zero it.
I'm not bothered about the hardware aspects of it but would appreciate help with the program writing.
Anyone help me ?
Cheers
Ecca

Charles Linquis
- 17th July 2006, 17:27
For starters -

Upon power up, read the LITRES counter out of two bytes of EEPROM (a WORD variable), write that value to LCD. Then sit in a loop and count the number of pulses and watch the switch. When 3000 pulses have been counted, clear that counter and increment the LITRES counter. Write that value back to EEPROM and update the LCD.
When you detect that a button has been pushed, clear the LITRES counter, updated the LCD and write the ("0") value back to EEPROM.

BigWumpus
- 17th July 2006, 18:39
Don't write to often to the EEPROM on the same position !
Think about a ring-buffer !

Maybe:
Get the olf value.
Count...
Write the new value to the next position and a checksum out of the new and the old value (asume a fixed value for non-existing old values!). If you reach the end of EEPROM, begin on the first position.

After Power-On
0: store 0 as backup-value.
1: read a value, check checksum.
2: if checksum is ok, store the value as Backup, goto 1
3: if checksum is bad, use the backup-value and exit

Just read to manual !
Maybe you can build hardware to buffer the pic fpr around 10ms to write the eeprom and then turn off. Use the Brown-Out-Reset !!!!

BobK
- 17th July 2006, 20:03
Hi Ecca,

Can you provide us with some information on the flow meter, such as the manufacturer and part number, perhaps a web site to look at this sensor closer?

Thanks,


BobK

Darrel Taylor
- 17th July 2006, 20:30
For saving to the EEPROM, choose a PIC with a LVD (Low Voltage Detect) interrupt.

When the power is turned off, the interrupt gets triggered, quickly save to EEPROM while the chip is still running on the capacitor charge.

The rest of the time, the value is available in RAM. No need to save it on every loop.
<br>

mister_e
- 17th July 2006, 21:27
Or a comparator interrupt OR modify the power supply. You place a diode between the bridge and the capacitor, then send the bridge side on a interruptable pin.

Just another idea ;)

How many different ways exist to skin a cat?

Charles Linquis
- 18th July 2006, 01:12
The 18F8722 datasheet claims the EEPROM is typically good for a million write cycles. I would probably trust it for 500K cycles.

ecca
- 13th August 2006, 11:26
Right then, having returned from holidays..... I continue.
I only require a 3 digit LCD with about 12mm digits.
What's around at the moment ?
Thanks for help all,
Ecca

jellis00
- 26th May 2010, 22:36
Hi everyone,
I'm looking for ideas.
I want to use a flow sensor to measure incoming water flow using a PIC chip.
I have Pic basic pro.
The sensor I have, and it delivers 3000 odd pulses per litre.


ecca, in hopes you will still receive this notice on this old thread, I have a similar reqirement and would greatly appreciate any info you have on your flow sensor....better yet even a data sheet. Please forward info to me at [email protected].

Ioannis
- 27th May 2010, 10:11
In similar cases I use magnetic flow sensors from Krohne. They do not have any moving parts and only require metal pipes or metal rings to work.

Ioannis