Heat exchanger controller

I wonder if anyone has any help and guidance on this first project i have attempted. I am using a waterflow Hall sensor which will trigger an output connected to a relay to drive the gas solenoid.

I started off with a simple code which reads the pin state and output either goes high or low. The problem i have is that the hall sensor stops on high sometimes which holds the output high. I have tried using flow with the following code but this did not work.

All i want to do is simply have the output drive high when the water is flowing and low when it stops, but to ensure the sensor does not hold the output high if the hall sensor happens to land in a high position. I have tried so many different ways of doing this and it sounds simple but my limited skills here are driving me mad. any help would be much appreciated.

// constants won't change. They're used here to set pin numbers: const int hallPin = 2; // the number of the hall effect sensor pin const int ledPin = 13; // the number of the LED pin // variables will change: int hallState = 0; // variable for reading the hall sensor status

void setup() { // initialize the LED pin as an output: pinMode(ledPin, OUTPUT); // initialize the hall effect sensor pin as an input: pinMode(hallPin, INPUT); }

void loop(){ // read the state of the hall effect sensor: hallState = digitalRead(hallPin);

if (hallState == LOW) { // turn LED on: digitalWrite(ledPin, HIGH); } else { // turn LED off: digitalWrite(ledPin, LOW); } }

It sounds like the water flow sensor isn't a HIGH if the water is flowing, LOW if it is not flowing type input, but you are treating it as such. You should be using something like pulseIn() to determine if the sensor is pulsing. Also, when you post code, use the CODE tags; it makes it easier to read. It also shows that you can follow directions.

There was a similar thread a few days ago. I submit you are either using the wrong sensor or using the right sensor with the wrong approach.

You are trying to handle one pulse with no means of determining its nature but a hall effect flow sensor is designed to send a train of pulses when the water is flowing. You therefore need to test for flow, or the absence of flow, by testing for a train of pulses, or not, or an acceptable minimum. Since flow is what you are interested in, there should be no problem with this, and you simply use a water flow programme.

If the above does not suit, you will be better off ditching the hall effect sensor and getting a flow switch - which would do exactly what you want, every time, and demands a minimum of programming.

Presumably if liquid is flowing and this is a heat exchanger then there will be a temperature difference between input and output - if so could you not just measure these and therefore decide if fluid is flowing.

Is this a fluid to fluid heat exchanger or an air to fluid ?

Craig

Is it (a) a simple on/off flow sensor (i.e. magnet moved by the flow, which triggers the Hall sensor), or is it (b) the sort that measure the flow with a turbine wheel, and the Hall sensor produces pulses as the turbine turns?

If (a) then you have probably not mounted the sensor in the correct orientation, it may depend on gravity to return the magnet to its normal position when the flow stops.

If (b) then you need to write the code look for transitions in the output from the sensor, rather than a steady HIGH state .