Level sensing methods - Page 3 - Home Brew Forums

 Home Brew Forums > Level sensing methods

01-16-2014, 12:35 AM   #21
Vesku
Recipes

Feb 2011
Lievala, Kuusumu
Posts: 109
Liked 20 Times on 14 Posts

Quote:
 Originally Posted by mattd2 Hahaha, yeah it's funny how hard it is to stop that happening, it almost kind of sneaks up on you
You can blame the Hamilton guys (MegunoLinkPro) for that, they made the PC-interface with the Arduino + touchscreen so easy to do that the rest of it sort of followed it... Sure would be nice to be there now, it's -30 degC here at the moment

01-24-2014, 08:52 PM   #22
helibrewer

Recipes

Nov 2011
Santa Rosa, CA
Posts: 3,813
Liked 326 Times on 275 Posts

Here's another way you might consider...I gravity feed my MLT into a 2qt grant. The MLT drain rate is set by a ball valve and it's a PITA to match the rate on the pump that pulls from the grant so I built a level sensing circuit that turns the pump on when the grant is almost full, then turns it off when the grant is almost empty.

I think your situation is even easier since you are not trying to maintain a level. You know your MLT geometry (assuming it's a uniform shape of a cylinder or rectangle). pi * r-squared * h will give you volume, so determine how high to set your sensor in the MLT by just solving for h. Now we know the height of the sensor.

My sensors are simple...two bare wires attached to a length of plastic to hold them. One wire goes to ground, the other is connected to an Arduino pin using a 1M ohm pull-up resistor and a 100nF cap between ground and the pin.

Here's the sketch:
Code:
```/*******************************************************************
** This program will utilize a high and low level sensor system to *
** cycle a pump in order to maintain a specific volume range within*
** a vessel. The level sensors are comprised of a pair of wire ends*
** that will be shorted by the fluid to activate. The pump will be *
** operated by a relay. Version 1, 01/21/2014 by Mike Murphy       *
*******************************************************************/

/*******************************************************************
* METHODS                                                          *
* checkHighLevel()                                                 *
* checkLowLevel()                                                  *
* pumpStatus()                                                     *
*                                                                  *
* INPUTS                                                           *
* High Level Sensor -- Active = LOW (sensor shorted)              *
* Low Level Sensor -- Active = HIGH (sensor open)                   *
*                                                                  *
* OUTPUTS -- Active = HIGH                                         *
* Pump (via relay)                                                 *
* Status LED(s)                                                    *
*******************************************************************/

/********************************************************************
* OPERATION                                                         *
* At initialization the pump will be set to off (LOW). The          *
* checkHighLevel() method will determine whether fluid is in        *
* contact with the high sensor leads. If the sensor is wet (logic   *
* LOW), the pumpStatus is set HIGH, turning the pump ON. If         *
* fluid is not in contact with the sensor the method will end       *
* and the checkLowLevel() method will be called. If the low sensor  *
* is wet (logic LOW), the pump continues to run. If the low sensor  *
* is dry (logic HIGH), the pump is shut off by setting the          *
* pumpStatus to off(LOW). A delay will be initiated then the loop   *
* start over.                                                       *
********************************************************************/
const int HighSensor = 2;     // High sensor assigned to pin 2
const int LowSensor = 3;      // Low sensor assigned to pin 3
const int Pump = 4;           // Pump assigned to pin 4
const int pumpLED = 5;        // Pump status LED assigned to pin 5

// Pull-up resistors keep the sensors HIGH (Normally Open Configuration)
int highSensorState = 0;      // status of high sensor (LOW is active)
int lowSensorState = 0;       // status of low sensor (HIGH is active)

void setup()
{
Serial.begin(115200);
pinMode(HighSensor, INPUT);
pinMode(LowSensor, INPUT);
pinMode(Pump, OUTPUT);
pinMode(pumpLED, OUTPUT);
Serial.print("Pin modes set....");
digitalWrite(Pump, LOW);    // Initialize pump OFF
digitalWrite(pumpLED, LOW); // pump status light OFF
}

void checkHighLevel()
{
// if the sensor is wet, turn the pump on
if (highSensorState == LOW)
{
digitalWrite(Pump, HIGH);
digitalWrite(pumpLED, HIGH);
}
}

void checkLowLevel()
{
// if the sensor is dry, turn the pump off
if (lowSensorState == HIGH)
{
digitalWrite(Pump, LOW);
digitalWrite(pumpLED, LOW);
}
}

void loop()
{

checkHighLevel();
checkLowLevel();
delay(2000);
}```
In your case you would only need one pair of wires for a sensor since you are only interested in stopping the flow at a particular level. Because we use a pull-UP resistor, logic HIGH is the "open" condition for the sensor wire pair.
__________________
Something is always fermenting....
"It's Bahl Hornin'"

Primary:
Kegged: Bourbon Barrel Imperial Stout
On Deck: German Lager

Reason: spelling

 Similar Threads Thread Thread Starter Forum Replies Last Post MrNatural Automated Brewing Forum 64 08-26-2015 01:34 PM alien Automated Brewing Forum 35 02-04-2014 01:57 AM alien Electric Brewing 5 04-30-2013 03:42 PM OneHoppyGuy Automated Brewing Forum 9 06-22-2012 09:27 PM Coastarine Kegerators & Keezers 14 08-16-2009 12:25 AM

 Forum Jump User Control Panel Private Messages Subscriptions Who's Online Search Forums Forums Home Sponsor Showcase     Sponsor Showcase Home Brewing Beer     Beginners Beer Brewing Forum     General Beer Discussion     Fermentation & Yeast     All Grain & Partial Mash Brewing     BIAB Brewing     Extract Brewing     Gluten Free Brewing     General Techniques     Recipes/Ingredients     Equipment/Sanitation     Electric Brewing     Automated Brewing Forum     DIY Projects         Kegerators & Keezers         Brew Stands         Cleaners & Cleaning         Chillers & Stir Plates         Kettles, Mash Tuns & Hot Liquor Tanks         Fermenters     Bottling/Kegging     Label Display & Discussion     Brew Science     Lambic & Wild Brewing     Hops Growing     Home Brewing Photo Forum     Brewing Software Wine, Mead, Cider, Sake & Soda     Winemaking Forum     Mead Forum     Cider Forum     Soda Making     Kombucha & Fermented Tea Forum HomeBrewTalk.com Recipe Database     Homebrew Lager Recipes     Homebrew Ale Recipes     Homebrew Sours & Wilds Recipes     Specialty, Fruit, Historical, Other Homebrew Recipes     Mead Recipes     Wine Recipes     Cider Recipes Home Brew Market     Sampling and Critiquing and Beer Swapping     For Sale     Want to Buy     Group Buys     Homebrew Crowdfunding Food and Beverage     Cheese Making Forum     Cooking & Pairing     Coffee Brewing & Roasting     Meat Smoking, Curing and Sausage Making Home Brewing Community     General Chit Chat     Drunken Ramblings and Mindless Mumbling     Commercial Brew Discussion     Beer Blogs & Articles     Company Reviews Brewing Events & Local Gatherings     North West Homebrew Forum     South West Homebrew Forum     Great Lakes Homebrew Forum     South East Homebrew Forum     North East Homebrew Forum     North Central Homebrew Forum     South Central Homebrew Forum     International