Water flow gauges & Limited Interrupts

Long time browser/first time poster.

Project background: I am building a monitoring system/controller for my ground-source heatpump and domestic water system. This is a "home built" unit which is a "pump and dump" system that pumps water from a deep well and dumps it into a pond for maximum efficiency (required a permit to do so). This topic isn't about that though so I'll get into what I'm monitoring.

I am also using the system to monitor some of my domestic water features such as pressure and (ideally) flow in a couple of areas.

All in all thus far I have 6 stainless temperature probes (all communicating on the same input channel), a "room temperature"/humidity probe, 2 pressure transducers and 2 voltage monitors which monitor the state of a valve which supplies water to the unit. This is done so every ~2 seconds and I'd like to keep this frequency as I hope to eventually use this Arduino to control a water supply valve to my unit (to limit the amount of water to the unit in an effort to conserve water - basically it opens the valve up as heat exchanger coils approach the freezing point to increase the flow and keep it from actually freezing)

I have the above throwing values into a MySQL database via a PHP script by way of an Ethernet shield. I am using an Arduino Duemilanove which I picked up quite some time ago to tie it all together.

My issue is as follows: While I am easily able to get the flow sensors working/reading as per the well known tutorial (http://forum.arduino.cc/index.php?PHPSESSID=spqs36mmetm3fjfaiusfs3k9b6&/topic,8548.0.html) I am having issues using them at the same time as any of the networking functionality.

During my investigations it would appear that this is because the network shield uses the limited number of interrupts available on my Arduino device. I fought with this for a few evenings and gave up momentarily after coming to this conclusion. In speaking with my father last night (who has more electronics experience than I) he suggested that I build some form of a tachometer circuit which outputs a voltage.

In doing a bit more reading today I ran across the following: http://playground.arduino.cc/Main/PinChangeInt and: http://playground.arduino.cc/Main/PCF8574Class thanks to this thread: http://forum.arduino.cc/index.php?PHPSESSID=cr3tqjm7qlrvgnh3i26pdr5v86&topic=204596.0

While I've not looked into either of these options greatly I figured, since I am sitting in the office for the day, I would write up this post asking for advice/insights.

Outstanding questions: Are the issues I am seeing indeed because the network shield uses the interrupts?

My understanding of the interrupts is vague; can I even get an accurate reading from my flow meters over a 2 second interval? or does the attaching to the interrupt allow changes/events monitored via the interrupt to happen independently of the main loop of an Arduino program?

Might I be best to pick up another Arduino device to monitor the flow meters (Ideally I would like to eventually have 4 or 5) and link it to my existing Arduino device?

It looks to me like the PCF8574 chip utilizes the same interrupt pins as well, while I can see it potentially allowing me to monitor more inputs can I utilize this with the network shield?

Should I say "forget it" about trying to monitor interrupts entirely and come up with some form of tachometer circuitry which allows my flow meters to output a 0-5 voltage range and then read that?

I don’t know about the network shield using interrupts as I have not yet had flow meters running on the internet, but I don’t see why it should. The Mega has six external interrupts so I assume you can run six flow meters simultaneously. My flow meters run on a one second loop. The flow rate display live on LCD is so erratic it is clearly a waste of time, but I am able to compare the daily accumulated flow with an official meter and it has been extraordinarily accurate. My objective is water flow against temperature difference to get kWh, so I am hoping that deriving averages over one minute will suffice.

Nick_Pyner: The Mega has six external interrupts so I assume you can run six flow meters simultaneously. My flow meters run on a one second loop.

I do not have a Mega, I have a Duemilanove (as stated)

Nick_Pyner: The flow rate display live on LCD is so erratic it is clearly a waste of time, but I am able to compare the daily accumulated flow with an official meter and it has been extraordinarily accurate.

I'm not as concerned about instantaneous flow as I am about over-all flow as well. I also have a small farm and it (sadly) isn't uncommon for the water to be left on when filling water tubs. I will eventually setup an email notification when water has been flowing for more than half an hour etc.

To begin with I don't know if the Ethernet shield is eating all of your interrupts. You have at least checked that the shield does not have a pin conflict with your flow meter.

A suggestion, though not the most exciting one, is to use two or more Arduinos. Let one handle all of the Ethernet stuff, and communicate with any daughter boards using Serial or TWI. It sounds like you don't have anything that is time critical, so the latencies involved in this (which should be on the range of milliseconds anyways) won't be an issue.

You could build a circuit, and there are Freq->Voltage converters that would relatively simply convert your RPMs to an analog voltage. I do not have any direct experience with them myself so there is no chip I recommend for it.

mirith:
To begin with I don’t know if the Ethernet shield is eating all of your interrupts. You have at least checked that the shield does not have a pin conflict with your flow meter.

This is the issue, the flow meters (to my understanding) require an interrupt pin. When I was playing with them I had the Arduino and the Ethernet shield mounted in their case; with no Ethernet the flow meter works fine, enable Ethernet and it has issues. After a bit of google’ing that was the conclusion I came to/what was being suggested. I welcome other ideas though (hopefully someone with experience)

mirith:
A suggestion, though not the most exciting one, is to use two or more Arduinos. Let one handle all of the Ethernet stuff, and communicate with any daughter boards using Serial or TWI. It sounds like you don’t have anything that is time critical, so the latencies involved in this (which should be on the range of milliseconds anyways) won’t be an issue.

Nothing that is hugely time critical no, if I get in to making up controls I will need ~1-2 second resolution, not milliseconds.

mirith:
You could build a circuit, and there are Freq->Voltage converters that would relatively simply convert your RPMs to an analog voltage. I do not have any direct experience with them myself so there is no chip I recommend for it.

This is what I believe my father was talking about; there must be a better way though :wink:

The arduino ethernet shield doc says this:

The solder jumper marked "INT" can be connected to allow the Arduino board to receive interrupt-driven notification of events from the W5100, but this is not supported by the Ethernet library.

So there may indeed be interrupts fired, depending on your hardware setup, even if they do nothing. It looks as though the ethernet library sensibly relies on the buffer on the shield.

Dewie: My issue is as follows: While I am easily able to get the flow sensors working/reading as per the well known tutorial (http://forum.arduino.cc/index.php?PHPSESSID=spqs36mmetm3fjfaiusfs3k9b6&/topic,8548.0.html) I am having issues using them at the same time as any of the networking functionality.

Not that it helps with your question but, that water flow example is pretty much garbage. The interrupts have a delay() call in them and will almost certainly make your code really choppy.

Have a look here because I ran into the same thing a few years back. Before progressing with any more code I would make the corrections that Coding Badly helps with.

http://forum.arduino.cc/index.php?topic=73782.msg555003#msg555003

Am I right in thinking the water flow gauges output pulses at a frequency proportional to flow rate?

If so what kind of frequency range?

Anyway the sensors refered to in one of the postings appear to just be photo-transistor outputs, which means you might need signal conditioning circuitry to "debounce" them (basically a 74HC14 schmitt-trigger inverter gate and a carefully chosen pull-up resistor)

Then you can stick the signal to the Arduino using pin-change interrupt to monitor a whole bunch of them.