HBT 2014 Big Giveaway - 94 Chances to Win!

Huge Supporting Membership Discounts!
 Home Brew Forums > Level sensing methods

01-15-2014, 11:35 PM   #21
Vesku
Feedback Score: 0 reviews
Recipes

Join Date: Feb 2011
Location: Lievala, Kuusumu
Posts: 108
Liked 19 Times on 13 Posts
Likes Given: 9

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, 07:52 PM   #22
helibrewer
Feedback Score: 1 reviews

Recipes

Join Date: Nov 2011
Location: Santa Rosa, CA
Posts: 2,922
Liked 145 Times on 134 Posts
Likes Given: 37

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:
Brite Tank/Lagering: Nothing
Kegged: Tart Cherry Cider, Belgian Tripel, AHA Summer Ale, Sonoma County Organic Cider, Maibock Bock, Ommegang Abbey Ale Clone, Belgian Golden Strong, Belgian Quad (Grand Reserve), Belgian Pale Ale, German Pils (split WLP830 & WLP838)
Bottled: Contentment (Trappist), Derangement (Belgian Dark Strong), Kranky (Kolsch v1.1), Wise One (Wit)
On Deck:
My Site: www.restlesscellars.com

Last edited by helibrewer; 01-24-2014 at 07:55 PM. Reason: spelling