AquaticTechTank.net

A forum dedicated to design and program aquatic tanks
It is currently Thu Nov 23, 2017 12:13 am

All times are UTC - 5 hours




Post new topic Reply to topic  [ 3 posts ] 
Author Message
PostPosted: Sun Mar 08, 2015 2:37 pm 
Offline
Site Admin

Joined: Fri Nov 30, 2012 1:54 pm
Posts: 275
http://www.seeedstudio.com/depot/G12-Wa ... -1915.html

USD
$9.50

There should be little resistance with this as it has a rotor that spins with the flow of the water freely and the rate of the rotor is measured with a Hall Effect sensor (electromagnetic field).


Top
 Profile  
 
PostPosted: Sun Mar 22, 2015 10:01 am 
Offline
Site Admin

Joined: Fri Nov 30, 2012 1:54 pm
Posts: 275
I wrote code for this. I add an LCD temporarily for testing.

Code:

// include the library code:
#include <LiquidCrystal.h>

// initialize the library with the numbers of the interface pins
LiquidCrystal lcd(12, 11, 5, 4, 3, 2);
volatile int count = 0;                       // measuring the rising edges of the signal, volatile - to change anytime: share with ISR
int calc;
int hallsensor = 7;                           // The pin location of the sensor
unsigned long lastRead = 0;

void rpm ()   // ISR           
{
    count++;                             
}

void setup() {
 
  // set up the LCD's number of columns and rows:
  lcd.begin(16, 2);
  // Print a message to the LCD.
  lcd.print("L/minute");
  pinMode(hallsensor, INPUT);
  attachInterrupt(2, rpm, RISING);
}

void loop() {

 
   if (millis() - lastRead >=1000) //read interrupt count every second
    {
      lastRead = millis();
     
      noInterrupts(); // disable interrupts for correct calculation
      calc = (count / 5.0);  //counts per second = Hz; divide by 5 for Flow rate l/min   
     
      count = 0; // reset for next calc
     
      interrupts(); //start interrupt back up
     
      //clear out for next print out
      lcd.setCursor(0, 1);
      lcd.print("     ");
     
      lcd.setCursor(0, 1);
      lcd.print(calc);   

    }
   
}


 


Top
 Profile  
 
PostPosted: Sun Mar 22, 2015 10:03 am 
Offline
Site Admin

Joined: Fri Nov 30, 2012 1:54 pm
Posts: 275
Ready for testing.
Make sure to add a 10K pullup resistor between signal & 5V.

Image

I took 2 readings on a small canister filter with no medium.

The sensor does limit output but only by 5-11%. While the filter was running, the arduino read anywhere from 9-12L/minute. It varies I'm not sure why; maybe that's how filters run but I'd have to account for margin of error on the sensor and my errors. It might be better if I took multiple readings and average them out instead of take a calculation ever second.

It's fairly accurate with actual numbers being 11.13 l/m, and 10.97 l/m. I used my iPhone as the stop watch.


Top
 Profile  
 
Display posts from previous:  Sort by  
Post new topic Reply to topic  [ 3 posts ] 

All times are UTC - 5 hours


Who is online

Users browsing this forum: No registered users and 1 guest


You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot post attachments in this forum

Search for:
Jump to:  
cron
Powered by phpBB® Forum Software © phpBB Group
Copyright 2noodles LLC 2012