View previous topic :: View next topic |
Author |
Message |
Roger Guest
|
Flow sensor |
Posted: Wed Apr 14, 2004 12:32 pm |
|
|
Dear All,
I need help!!
I need to interface a liquid flow sensor to a PIC interrupt.
BUT the sensor gives a train of square wave pulses.
I do not want to measure them just need to know that some liquid is flowing
Can anyone suggest a circuit, Low pass filter???
Best Regards,
Roger |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
Liquid Flow Meter |
Posted: Wed Apr 14, 2004 12:51 pm |
|
|
You didn't say which PIC you were using or the voltage range of the square wave. You could, for example, simply tie a 5V square wave signal directly to pin RB0 and set it for L to H Interrupt trigger. Depending on impedence you need to include a resistor (330 ohms for example) between the two just for protection of the PIC input.
If the square wave signal is more than 5V a two resistor voltage divider can be used to get it within the 5V range and then you wouldn't need to use the protection resistor. |
|
|
Roger Guest
|
|
Posted: Wed Apr 14, 2004 1:08 pm |
|
|
PIC16f874
I am sorry if I confused you.
I only want there to be an interrupt IF the pulse train stop!!! (USING BO)
Regards |
|
|
Neutone
Joined: 08 Sep 2003 Posts: 839 Location: Houston
|
|
Posted: Wed Apr 14, 2004 1:26 pm |
|
|
Roger wrote: | PIC16f874
I am sorry if I confused you.
I only want there to be an interrupt IF the pulse train stop!!! (USING BO)
Regards |
When the edge interupt interupt occures set a timer to zero. When timer interupts you have no flow. |
|
|
dyeatman
Joined: 06 Sep 2003 Posts: 1934 Location: Norman, OK
|
Flow Sensor |
Posted: Wed Apr 14, 2004 1:56 pm |
|
|
To expand some on what Neutone said....
How fast do the pulses occur?
Example:
If they are twice per second then start a 700ms (something more than 500ms) timer at the first interrupt. Reset the timer every time a new edge comes in. If 700ms passes without an edge, the timer times out, a timer interrupt will occur and you can react. |
|
|
SherpaDoug
Joined: 07 Sep 2003 Posts: 1640 Location: Cape Cod Mass USA
|
|
Posted: Wed Apr 14, 2004 2:02 pm |
|
|
Roger wrote: | PIC16f874
I am sorry if I confused you.
I only want there to be an interrupt IF the pulse train stop!!! (USING BO)
Regards |
It might be worth considering a hardware solution. Maybe a diode from the signal to the PIC pin and a capacitor and resistor from the PIC pin to ground would do the trick. That is three cheap components that whould give a logic 1 if fluid was flowing, and a logic 0 when it stopped. A web search for a "peak detector" should give you more info. If you give us info such as the pulse train voltage and frequency, and how soon you must know if flow stopped, we can probably design the circuit here! _________________ The search for better is endless. Instead simply find very good and get the job done. |
|
|
|