# Best way to install flow sensor?



## jsiegmund (12 Jun 2016)

For my tank-automation project I'm doing (see https://github.com/jsiegmund/submerged) I'm looking into keeping track of flow. I found the following very affordable sensor: 





The diameter is 1", which is the same as the diameter on my FX5 filter. But I have no clue on how to best fit the hose onto this type of coupling. So the questions I have at the moment are: 

- Which connector to use 
- Whether this is going to work with fluval ribbed hose. If not (which I expect) I think I might switch to rigid PVC for parts of my set-up.
- Would it make any difference placing this before or after the filter? Obviously I don't want to hinder flow too much, doing it in the intake line sounds best since gravity would be lending some help.


----------



## jaHko (13 Jun 2016)

So first thing to check would be whether you have BSP or NPT thread on the flow meter but I guess it would probably be BSP.

Pipe work is like Lego - lots of ways to build something to get the same result. Not sure about your pipe work on your system ( PVC or flexible hosing) but I would do the following. 

1" uPVC Female threaded coupling with the other side a solvent weld end socket. Into this end you can  glue your 1" uPVC pipe. It is important to note here that flow meters requires a straight flow run ( this would probably be 5D before and 2D after but check manufacturers installation notes) This is to ensure you have laminar flow and get accurate readings. 
At the ends of the straight pieces of pipe you can glue a solvent weld socket and into that a PVC hose connector to which you can fit your flexible hose ( and maybe add a pipe clamp to keep it there) if you don't have flexible you can of course just continue piping in PVC.

Would you mind elaborating a bit more on your system and what automation you have integrated ? I'm keen to do the same on mine and would be nice to see what others are doing.

Good luck!


Sent from Nokia 3310 using Tapatalk


----------



## iunknown (13 Jun 2016)

Here is an instructable on it:
http://www.instructables.com/id/How-to-Use-Water-Flow-Sensor-Arduino-Tutorial/
I always just pictured doing it just for checking the flow, and just at the end of the j on the outlet pipe.  I would be worried about gunk build up keeping it installed all the time.


----------



## jsiegmund (13 Jun 2016)

Thanks! That's useful info and I guess I need to explore the world of PVC a bit more. At the moment I've got the plumbing as follows: intake is connected to FX5 using Fluval ribbed hose. FX5 outflow is connected to an AM1000 CO2 reactor using flexible (well somewhat at least) eheim hose. From the AM1000 to my spraybar it's ribbed hose again. So another challenge would be to place the AM1000 in between. I've already got adjusted fittings on that one (1 inch) so I guess I could make another set, but it does need to be easy maintenance, taking out the reactor once in a while for a clean. 

I agree with the gunk build up. The sensor basically is just an impellor so that would need to be cleaned once in a while, would do that in the same maintenance scheme as with my filter impellor. 

As for the project, I've got some overview documentation up on github. Basically I'm using a Raspberry Pi as a gateway device which can connect to multiple Arduinos via Bluetooth. The Arduinos collect data (temp, ph), switch relays, do leak detection, etc. controlled by the Pi. The system itself is managed via Azure IoT hub. Everything is fed into a mobile app (cross platform) on which you get a realtime feed of how things are, notifications and some options to control the things like relays and stuff. At the moment I'm monitoring temp inside and outside of the tank, pH and leak detection (basic water / conductivity sensors). Flow would be a nice addition for maintenance warnings. I've also got some simple float sensors ordered which I want to use to check my stock solutions. Lots of ideas  I can open up a new thread about that one if you think more people will be interested? I know I'm not the first one with such a project, but I think I might be the first one with a multi-tenant back-end service.


----------



## ian_m (13 Jun 2016)

Couple of things to think about...

Nice project.

Must be on the outlet of the filter so it operates in cleaner water. It will very quickly gunk & jam up on the filter inlet.

You should fit isolating valves and a way of completely disconnecting it for cleaning. As despite being on the filter outlet, it will eventually, after months (?), get dirty and give false readings and/or jam. So you need isolating valves, a way of taking it out of the piping, as well as a way of disconnecting it electrically. You could probably find 1" PVC to 1" barb (search Ebay, if your sensor is 1"), connect via a short lengths of 1" hose to isolating valves. Put stainless jubilee fixings on pipe barbs. Thus to clean, you isolate flow, undo jubilee clips and remove the flow sensor. Clean sensor, done.

A slightly easier way would be to use something like a "rotorflow" sensor (search Ebay, not cheap), as once flow is isolated the cover can be taken off to remove and clean the rotor quite easily.

Even better (but in £100's maybe) is an ultrasonic flow sensor. These are just a straight length of pipe, thus no blockage to flow or gunk, the speed of sound is measured to calculate the flow. Probably would never need cleaning, but then you could probably buy 100's of Chinese flow sensors for this price  .


----------



## zozo (13 Jun 2016)

I would use these swivels with a rubber sealing..


----------



## ian_m (13 Jun 2016)

zozo said:


> I would use these swivels with a rubber sealing..


Yip those will do. Just remember to jubilee clip the hose fixing. Jubliee clips cost pennies, new house flooring costs a lot more !!!


----------



## jsiegmund (13 Jun 2016)

Hmmm alright, so those swivels I could use with my current set-up without having to change too much. Interesting! I think I'll go with that and wait with the PVC until I move to a different house, seems like the perfect opportunity to rethink some stuff.


----------



## tubamanandy (13 Jun 2016)

This looks promising ?

http://www.ebay.co.uk/itm/Hall-effe...065958?hash=item4b0194a4e6:g:0kcAAOSw6btXRsNu


----------



## jsiegmund (15 Jun 2016)

tubamanandy said:


> This looks promising ?
> 
> http://www.ebay.co.uk/itm/Hall-effe...065958?hash=item4b0194a4e6:g:0kcAAOSw6btXRsNu



? I don't really need an LCD and stuff, I already have a display hooked up for my app displaying current water parameters. I've ordered two of the mentioned sensors from China, along with 4 swivels for installation. Will see how we go from there when the stuff arrives


----------



## markk (16 Jun 2016)

jsiegmund said:


> As for the project, I've got some overview documentation up on github. Basically I'm using a Raspberry Pi as a gateway device which can connect to multiple Arduinos via Bluetooth. The Arduinos collect data (temp, ph), switch relays, do leak detection, etc. controlled by the Pi. The system itself is managed via Azure IoT hub. Everything is fed into a mobile app (cross platform) on which you get a realtime feed of how things are, notifications and some options to control the things like relays and stuff. At the moment I'm monitoring temp inside and outside of the tank, pH and leak detection (basic water / conductivity sensors). Flow would be a nice addition for maintenance warnings. I've also got some simple float sensors ordered which I want to use to check my stock solutions. Lots of ideas  I can open up a new thread about that one if you think more people will be interested? I know I'm not the first one with such a project, but I think I might be the first one with a multi-tenant back-end service.



Looks like an interesting project. Why did you decide to have separate arduino modules to run sensors? I can see potential advantages but it just seems to complicate the design.

I've been meaning to post some details of my own project for some time.

The code is available here:
https://github.com/mark-kendall/torc

and documentation (what there is at the moment - and slightly out of date):
http://mark-kendall.github.io

Hardware wise, it's built around Raspberry Pi's but it's a c++/QT5 based application - so runs on any linux distro, OSX and windows. Support for other platforms such as beagle bone should only require writing some low level GPIO classes. Current external hardware support includes any simple input (buttons, switches, PIR sensors etc), simple outputs (switches, relays etc) and 1Wire temperature probes. PWM outputs are either software driven, 'hardware' via the supported pin or via external PCA96585 (I2C) PWM devices. I'll be adding native hardware PWM on any pin via the servo blaster code at some point (reduces the need for external devices). There is also code stubbed out for pH and lux sensors. All input and output types have a network 'equivalent' as well - which allows for external input/output and setting values for dimmers etc.

Software wise, configuration assumes one of four device types - input, logic, output and notification.

Inputs and outputs obviously define how your pi is connected to the real world and notifications update external devices (current support is for PushBullet notifications to your mobile device and ThingSpeak for external data logging and analysis).

Logic devices add the 'intelligence' - timers for lights/pumps etc, transitions for fading/sunset/sunrise effects and comparison/logic devices for 'decision' making (greater than, less than etc).

There is a built in web server for querying and controlling the state (every device is exported as a service) and a 'built in' HTML5 web app for your viewing pleasure The web page is dynamically updated, as it uses a web socket to talk to the pi. The web interface is password protected and I'm working on SSL encryption. There is full support for translations in the web interface - just needs people to translate it.

Each server advertises itself on the network via Bonjour and UPnP and servers are aware of each other on the network. At some point I'll finish the code that allows them to control and report on one another (e.g. to allow one pi to act as the interface to the web or allow a server to report that another has gone offline).

The web app still needs work to make it a little (lot) more user friendly - but the core code has been working for 18 months now. I'll post some screen grabs at some point to show the current web interface - which will make much of the above a little more comprehensible.

Cheers, Mark


----------



## jsiegmund (16 Jun 2016)

Hi Mark, cool project! There's a couple of these projects out there and I find it very interesting to see how others are solving similar problems  

I'm using Arduino nanos from a cost and usability perspective. The Pi can act as a gateway for multiple Arduino modules, connecting them via wireless. Bluetooth at the moment, but I'm looking into alternatives. This means you could connect several modules for one or multiple tanks with only one Pi, which is a clear cost benefit as the Arduino's cost near to nothing.  It also simplifies wiring, as you can place an Arduino in a small case in the most logical place. My sensor module is behind my tank (only requires a power line via mini USB), the leak / relay module is in the cabinet. I can monitor a second tank in the exact same way without running any wires to it (apart from power which should be there any way). The Bluetooth range is really the only limiting factor at this moment which is why I'm looking towards WiFi / Alljoyn now.

The Arduino modules themselves are dumb, they only follow orders and deliver data. All of the intelligence is in the back-end orchestration layer. This makes it very easy to implement new modules; you only have to make sure they provide data (via standard firmata) or accept the commands they're given. This might change when I start adding a LED controller or something in that category, but for now this works perfectly (and very stable). The end goal would be to have "plugin"-style modules which come from the open source community, but that's a long way to go at this point. 

I'm building the software so that I can easily add modules having have their own dedicated piece of UI for display / settings and stuff like that. The back-end doesn't care about how many or which modules you configure.


----------



## ian_m (16 Jun 2016)

I chose to just automate all the timers on my tank, not bothered about flow, CO2 levels, temperature etc as these are normally fairly constant anyway. I chose a Siemens Logo8 programmable logic controller, with add-on module giving 12 relay switched outputs and 16 mains inputs. I basically programmed it as a glorified web accessible 12 channel timer. It can be programmed over Ethernet as well as being accessible for monitoring and/or changing settings.



All fitted under the tank.



On screen display showing only 2 tubes out of 4 turned on.




Being accessed remotely from a web browser, nothing is switched on as it is morning. 963 is run time in hours. 5.16 is 5 days 16hours since last water change.




Accessing timer setup remotely (same as on display of the device). This is the time settings for just 2 tubes of light being on.




PLC is programmed by joining blocks together (function block diagram), this connects a timer to relay output 1, connected to the lights. Done. Easy peasy. This is lights on 17:00 to 23:00 on Mon, Tue, Wed, Thur, Sun and different times of 18:00 to 23:45 on Fri & Sat.

I am writing a full article for UKAPs, but is still work in progress.

Siemens Logo controllers here.
http://w3.siemens.com/mcms/programmable-logic-controller/en/logic-module-logo/Pages/Default.aspx


----------



## jsiegmund (16 Jun 2016)

Cool stuff. By the way:


> not bothered about flow, CO2 levels, temperature etc as these are normally fairly constant anyway



I though the exact same thing until I started measuring. The pH graph is interesting to see and forced me to make some improvements to my CO2 reactor which is now more efficient and comes on at the right time. A drop checker is a good indication, but is behind on reality and sometimes hard to read. For temperature I noticed my living room temp has more effect on the tank than I thought, increasing temperature when the room gets hot in the summer. Maybe logical things, but still the insight to me was valuable. I also plan on adding intelligence into the mix, for instance dropping the water temperature a couple of degrees when a hot day is expected so the maximum stays lower. Same could be done for CO2; creating a intelligent controller which ensures the CO2 levels perfect when the lights come on, even when you decide to have a different schedule per day. Anyways, that's all long term stuff.

I'm also still working on documentation and will create a separate thread in due time.


----------



## ian_m (16 Jun 2016)

jsiegmund said:


> for instance dropping the water temperature a couple of degrees when a hot day is expected so the maximum stays lower.


I looked into to that, but the heat capacity of my tank 180l is so huge and the heat input on a hot day is so huge, even having the heater off (ie I forgot to turn it on after a water change) doesn't stop my tank reaching over 30'C on hot days. Putting a desk fan blowing across the surface did lower the temperature to 26'C in an hour or two though.

Are you temperature compensating your pH readings? That would be the great advantage of having a temperature and pH controller in the same box. Probably doesn't make any difference in the fish tank scheme of things, but worth thinking about when people say "my probe is accurate to 0.01pH".

My next project (if I get time) is same type of PLC again but with analogue inputs for pH probe and temperature probe to control pH (actually CO2 in ppm) and tank heater, just like you are proposing. The Logo's can display things like this from their analogue inputs.


----------



## jsiegmund (17 Jul 2016)

ian_m said:


> I looked into to that, but the heat capacity of my tank 180l is so huge and the heat input on a hot day is so huge, even having the heater off (ie I forgot to turn it on after a water change) doesn't stop my tank reaching over 30'C on hot days. Putting a desk fan blowing across the surface did lower the temperature to 26'C in an hour or two though.
> 
> Are you temperature compensating your pH readings? That would be the great advantage of having a temperature and pH controller in the same box. Probably doesn't make any difference in the fish tank scheme of things, but worth thinking about when people say "my probe is accurate to 0.01pH".
> 
> ...



Yeah that's true. I haven't had any severe heat issues just yet, with room temp at 30 degrees my tank usually gets to 28 max. I only use the surface agitation to drop the temp, haven't got any fans. 

Heat compensation is built in on the Atlas pH module but I must admit I don't use it yet. Should be easy to set-up though, so definitely going to do that.

Ontopic: I've got the sensors now and also received the swivels. Problem is that the inside diameter on those is pretty narrow, the sensors' opening is considerably wider. I'm worried about restricting flow way too much. I also have this kind of swivels mounted on my CO2 reactor, but those don't have the screw part and their opening is much wider. :S I was expecting the same inside diameter but obviously there's different sizes there. Guess thats the downside of ordering stuff from the internet, couldn't judge real well from the pictures.


----------

