Pages: [1] 2   Go Down
Author Topic: HOw to detect the flow of water through a pipe  (Read 4971 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi, I need to detectt the flow of water through a pipe of 1" Diameter but  I can't find anything to do the job  smiley-sad

This is exactly what I need but for 1"



This is the SeeedStudio Liquid Flow Switch. This sensor works as a switch, conducts while flow pass though. It features the maximum resistance of 100 ohm. Maximum load current is 1.0A and the maximum load power is 10W. More information is given in specification tab. Color may vary. The thread is a 1/2 inch NPT tapered thread, one on each end.


Does somebody saw something like this for 1" somewhere? Any other idea of how I can detect the flow of water through the pipe, the pipe is always full of water, but I need to know when the flow start.

Thank you!
Logged

Massachusetts, USA
Offline Offline
Tesla Member
***
Karma: 208
Posts: 8821
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Here's one.  It has male threads on both ends so you may need an adapter:  http://www.aliexpress.com/item-img/Small-Size-Plastic-Piston-Flow-Switch-1-inch/326245735.html
Logged

Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Offline Offline
Newbie
*
Karma: 0
Posts: 13
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you johnwasser, I never bough something from China, but I think it will be my only choice. I don´t have nothing againt China products, but hope the shipping don´t take too long
« Last Edit: September 25, 2012, 12:13:53 am by travis12 » Logged

Sussex UK / CT USA
Offline Offline
Edison Member
*
Karma: 0
Posts: 1028
Forums forever
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Depending on WHY you want to know about flow, and what flows are involved, two "answers" may be available....

a) Keep an eye on the pressure in the pipe, or the pressureS at two well chosen points.

b) Why does the water move? If it moves because of a pump, just monitor the electricity going to the pump.

(I'm not calling anyone stupid with that second suggestion.... well, unless you include me in the group. For YEARS I looked for a way to watch for leaks from my domestic water system at times when I'm away from the house... before realizing that as I am on a well, monitoring the well's pump would alert me to a leak.)
Logged

Atlanta, GA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I got really lucky on ebay and got a new elster amco meter v-100 3/4" for $15 including shipping. It cost me an additional $18 for the couplings that I sourced at the local plumbing supply house - I tried to get the couplings online - but couldn't really find any thing that much cheaper based on not knowing actually what would work. 

This type of meter is simple pulse and I'm using it for whole house water count.

A quick search on ebay (just now) I found a buy it now for about $46 with shipping.



Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Did you find any documentation for the Elster that shows the wiring info?  I found that it is "pulse count" but nothing specific about the 4 wires  smiley-confuse
Logged

Atlanta, GA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I can't recall if I found a doc or just tried different pairs - I've had mine running for 11 months - so I'll check out the color pair that I wired up and post back in the next day or so.
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I worked on this some today...  If you apply 5V/ground to the red/black the other two wires (blue and yellow IIRC) will go high (5V) when the meter increments another full unit then falls low (0V) before the halfway point (need to test more to pinpoint this...manually blowing air into the fitting on my bench was getting old fast) to the next full unit and back to high at one full unit.  It appears each instance of going high marks 1 unit.

Now to decide how to use this info  smiley-razz  I am thinking of polling the unit every 30 seconds, recording the state (high or low) then incrementing a number if the state has changed.  This number will then be sent to Cosm... 

If anyone has a better/different solution I am certainly open to ideas!

For the record I wish this sensor (elster amco meter v-100 3/4) had better resolution  smiley-cry  It looks like it will be great for "I used this much water today/this week" but not so great for what I wanted which is more of a "when is water being used and at what rate".  For example I just flushed a toilet and it went from a little under 14.2 to a little over 14.3 which is going to result in exactly nothing on whatever graphing solution I end up with.  I am thinking an analog sensor that changes based on the rate water flows through it might be more my speed since I care more about flow/duration

Also for the record the male threads on the meter seem to be not quite right/not standard plumbing threads.  This is according to two folks in different plumbing departments and me since one connection worked on the first try with plumbers dope and the other leaked with plumbers dope and still leaks (ever so slight drip once every few minutes) on the second try with another round of fittings and teflon tape.  Disclaimer:  I have never used plumbers dope before so I might not have used enough or let it cure long enough...
Logged

Atlanta, GA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

You need "water meter couplings" do a search on google and you will see what they look like.

See one of my comments above - they cost about $18 for a pair of them. I when too a plumbing supply place (the big box stores aren't going to have them). You should be able to find them on eBay.

Polling every 30 seconds is not going to work you will miss pulses - could use an interrupt to catch the pulses.

Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thanks for the tip on the couplings!

I am not sure I can flow enough water to trigger a pulse in under 30 seconds  smiley-mr-green
Logged

Atlanta, GA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

I'm using the red and blue wires - the other two wires I believe are use for the taper protection feature. I don't have them connected.

this is what I do - poll the water  meter - track 5 minutes and total counts - send out the serial every 10 seconds

Code:
// Synchronization loop for long intervals (more than 32 seconds)
#define TimeLapLong(t1) (long)((unsigned long)millis()-(unsigned long)t1)
#define TimeLapWord(t1) (int)((word)millis()-(word)t1)
const long WATER_DEBOUNCE = 50;
const long TIME_SEND = 10000;
const long TIME_CLICK = 60000;
const int water_pin = 4;
unsigned long waterTotal = 0;
int waterLastRead = LOW;
unsigned long waterHit = 0;
unsigned int water5[5];
unsigned long timetosend =0;
unsigned long timeclick=0;

void setup(){
 
  pinMode(water_pin,INPUT);
  digitalWrite(water_pin,HIGH);
  waterLastRead = digitalRead(water_pin);
  for(int x = 0;x<5;x++) water5[x] = 0;
 
  Serial.begin(115200);
}

void loop()
{
    if (digitalRead(water_pin) != waterLastRead &&  TimeLapWord(waterHit) >=0 ) {
waterTotal++;
        waterLastRead = !waterLastRead;
        waterHit = millis() + WATER_DEBOUNCE; //millis();
    }

if(TimeLapLong(timeclick)>=0) {
        timeclick += TIME_CLICK; //millis();
       
        for(int x = 0;x<4;x++) water5[x] = water5[x+1];
        water5[4] = waterTotal;
}

// 10000 every 10 seconds
    if(TimeLapWord(timetosend)>=0)
    {
      timetosend += TIME_SEND; //millis(); // += 10000; //millis();
      outbufferIdx = 0;

      OutTitle('H','0');
      OutBufferPrint(1,waterTotal,1);
     
      OutTitle('H','5');
      OutBufferPrint(1,waterTotal-water5[0],1);

      outbuffer[outbufferIdx++] ='\n';
      outbuffer[outbufferIdx++] ='\0';
     
      Serial.println(outbuffer); 

      }
}

void OutBufferPrint(int id, unsigned long reading,unsigned long  i) {
  unsigned long temp;
 
  while (i*10 <= reading){
   i*=10;

  while (i>0){
    if (outbufferIdx >= OUTBUFFER_SIZE -1) break;
     temp = reading/i;
     reading -= temp * i;
     outbuffer[outbufferIdx++] = 48+temp;
     i/=10;
    }

  }
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 27
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote

That thing looks very sketchy. Especially the screws in the plastic. smiley-eek

Why not get a surplus water meter and monitor it with a hall effect sensor?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

So do the red and blue wires just connect to each other when the meter pulses or?
Logged

Offline Offline
Newbie
*
Karma: 0
Posts: 21
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hmmm...what version of the IDE are you running?

I tried to give your code a whirl on a spare Arduino but it exploded (see below)


watermeter.cpp: In function 'void loop()':
watermeter:43: error: 'outbufferIdx' was not declared in this scope
watermeter:45: error: 'OutTitle' was not declared in this scope
watermeter:51: error: 'outbuffer' was not declared in this scope
watermeter.cpp: In function 'void OutBufferPrint(int, long unsigned int, long unsigned int)':
watermeter:66: error: 'outbufferIdx' was not declared in this scope
watermeter:66: error: 'OUTBUFFER_SIZE' was not declared in this scope
watermeter:69: error: 'outbuffer' was not declared in this scope
watermeter:69: error: 'outbufferIdx' was not declared in this scope
watermeter:73: error: expected `}' at end of input
Logged

Atlanta, GA
Offline Offline
Jr. Member
**
Karma: 0
Posts: 86
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sorry - I cut and pasted my code because it had other stuff in it. Here's the complete code unedited. I'm using ide version 18.

Code:
// Synchronization loop for long intervals (more than 32 seconds)
#define TimeLapLong(t1) (long)((unsigned long)millis()-(unsigned long)t1)
#define TimeLapWord(t1) (int)((word)millis()-(word)t1)
const long WATER_DEBOUNCE = 50;
const long LIGHTNING_1 = 250;
const long LIGHTNING_2 = 500;
const long TIME_SEND = 10000;
const long TIME_CLICK = 60000;

const int lightning_pin = 2;
const int errorCt = 50;

const int water_pin = 4;

unsigned long waterTotal = 0;

int waterLastRead = LOW;

unsigned long waterHit = 0;
//unsigned int waterDebounce = 50;

#define OUTBUFFER_SIZE 300

char outbuffer[OUTBUFFER_SIZE+1];
int outbufferIdx = 0;

unsigned long updatesSince = 0;

unsigned int lightning=0;
unsigned long lightning10=0;
unsigned long lightningTotal=0;
unsigned long lightningTotal60=0;
unsigned int lightning60[60];
unsigned int lightningPos = 0;
unsigned long lightningAttach1 = 0;
unsigned long lightningAttach2 = 0;

unsigned int water5[5];

void setup(){
  
  pinMode(lightning_pin, INPUT);
  digitalWrite(lightning_pin,HIGH);
  for(int x = 0;x<60;x++) lightning60[x] = 0;
  
  pinMode(water_pin,INPUT);
  digitalWrite(water_pin,HIGH);
  waterLastRead = digitalRead(water_pin);
  for(int x = 0;x<5;x++) water5[x] = 0;
  
  Serial.begin(115200);
}


int interupoff = 1;
int swappedState = 1;

unsigned long timetosend =0;
unsigned long timeclick=0;
//unsigned long timetoattach=0;


void loop()
{
  
  //if (digitalRead(water_pin) != waterLastRead &&  (millis()-waterHit) > waterDebounce ) {
    if (digitalRead(water_pin) != waterLastRead &&  TimeLapWord(waterHit) >=0 ) {
waterTotal++;
    waterLastRead = !waterLastRead;
    waterHit = millis() + WATER_DEBOUNCE; //millis();
 }
  
  int dRead = digitalRead(lightning_pin);

  //Serial.println(dRead);

  //if (swappedState == 0 && interupoff == 0 && dRead == 1 && (millis() - timetoattach) > 250) swappedState = 1;
  if (swappedState == 0 && interupoff == 0 && dRead == 1 && TimeLapWord(lightningAttach1)) swappedState = 1;
  
   if (interupoff == 1) {
     if ( dRead == 0) {
       lightningAdd();
     }
} else if(TimeLapWord(lightningAttach2) && swappedState == 1){
  
      interupoff = 1;
   }
    
    //if(millis() - timeclick > 60000) {
      if(TimeLapLong(timeclick)>=0) {
        timeclick += TIME_CLICK; //millis();
        
        for(int x = 0;x<4;x++) water5[x] = water5[x+1];
        water5[4] = waterTotal;
        
        lightningTotal60 = 0;
        lightning60[lightningPos]=lightning;

        for(int x = 0;x<60;x++) {
          if (lightning60[x] < errorCt) lightningTotal60 += lightning60[x];
        }
        
        lightning10=0;
        int z;
        for(int x = 0;x<10;x++) {
          z = lightningPos - x;
          if (z<0) z += 60;
          if (lightning60[z] < errorCt) lightning10 += lightning60[z];
        }
      
        lightningPos++;
        if (lightningPos>59) lightningPos = 0;

        lightning = 0;
    }
    
    //if(millis() - timetosend > 10000)   // 10000 every 10 seconds
    if(TimeLapWord(timetosend)>=0)
    {
      timetosend += TIME_SEND; //millis(); // += 10000; //millis();
      
      outbufferIdx = 0;
          
      OutTitle('T','0');
      OutBufferPrint(0,lightning,1);
      
      OutTitle('T','t');    
      OutBufferPrint(1,lightningTotal,1);

      OutTitle('T','l');
      if (lightning < errorCt) {
        OutBufferPrint(2,lightning10 + lightning,1);
      } else {
        outbuffer[outbufferIdx++] = '0';
      }
      
      OutTitle('T','6');
      if (lightning < errorCt) {
        OutBufferPrint(2,lightningTotal60 + lightning,1);
      } else {
        outbuffer[outbufferIdx++] = '0';
      }
      
      OutTitle('H','0');
      OutBufferPrint(1,waterTotal,1);
      
      OutTitle('H','5');
      OutBufferPrint(1,waterTotal-water5[0],1);
      
      OutTitle('T','u');
      OutBufferPrint(3,updatesSince,1000);
      updatesSince++;

      OutTitle('T','i');
      
      for (int x=0;x<60;x++){
        int v = (int)lightning60[x];
          if (v>9) Out('.');
          if (x == lightningPos) Out('>');
          OutBufferPrint(4,v,1);
          if (v>9) Out('.');
      }
            
      Out(':');
      //OutBufferPrint(5,millis(),1);
      //Out(':');
      //OutBufferPrint(6,millis()- timeclick,1);
      //Out(':');
      //OutBufferPrint(7,dRead,1);
      //Out(':');
      OutBufferPrint(8,outbufferIdx,1);
      outbuffer[outbufferIdx++] ='\n';
      outbuffer[outbufferIdx++] ='\0';
      
      Serial.println(outbuffer);  
    }
  }
  
void OutTitle(char c1, char c2)
{
  if (outbufferIdx < OUTBUFFER_SIZE -4) {
    outbuffer[outbufferIdx++] = '[';
    outbuffer[outbufferIdx++] = c1; //'T';
    outbuffer[outbufferIdx++] = c2;
    outbuffer[outbufferIdx++] = ']';
  }
}
void Out(char c)
{
  if (outbufferIdx < OUTBUFFER_SIZE -1) {
  outbuffer[outbufferIdx++] = c;
  }
}
void OutBufferPrint(int id, unsigned long reading,unsigned long  i) {
  unsigned long temp;
  
  //if (id > 10){
  //  outbuffer[outbufferIdx++] = 48+(id/10);
   // id -= (id/10)*10;
  //}
  
  //outbuffer[outbufferIdx++] = ',';
  
  while (i*10 <= reading){
   i*=10;
  }
  
  while (i>0){
    if (outbufferIdx >= OUTBUFFER_SIZE -1) break;
     temp = reading/i;
     reading -= temp * i;
     outbuffer[outbufferIdx++] = 48+temp;
     i/=10;
    }
}  

void lightningAdd()
{
  //timetoattach = millis();
  lightningAttach1 = millis() + LIGHTNING_1;
  lightningAttach2 = millis() + LIGHTNING_2;
  interupoff = 0;
  swappedState = 0;
  lightning++;
  lightningTotal++;
}

//int freeRam1 () {
//  extern int __heap_start, *__brkval;
//  int v;
//  return (int) &v - (__brkval == 0 ? (int) &__heap_start : (int) __brkval);
//}




« Last Edit: October 29, 2012, 05:20:54 pm by pantonvich » Logged

Pages: [1] 2   Go Up
Jump to: