Water level with the BCS - A how-to

Suggestions, Problems, Availability, etc. Everything is up for discussion.
User avatar
bbrally
Posts: 210
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC
Contact:

Water level with the BCS - A how-to

Post by bbrally »

Back when I first started designing my brewery I wanted it to be as fully automated as I could get it. Deciding on the BCS had me tone down my ambitions due to level control limited to level switches activating a DIN.

But I never gave up on the thought. Then while working on another project a solution came to me.

Using an Arduino to convert a pressure sensors voltage output (which the BCS can’t read) to a variable resistance (which the BCS can read) I could have the BCS read water levels.

The system uses a bubbler to measure the level of water. The following link provides an explanation of how a bubbler system works.

http://www.brewtroller.com/wiki/doku.ph ... ing_system

The system uses a pressure sensor which outputs between 0.2 and 4.7 volts from 0 to 40 inches of water. The Arduino reads this as a voltage between 0 and 5 volts and converts that to a number between 0 and 1023. This number is then divided by 4 to arrive at a number between 0 and 255 which is then transmitted to a digital potentiometer to set a resistance between 10099 and 20060 ohms (the max and min of the digital pot I used). It is this resistance that the BCS reads and then converts to a temperature.

Using a Thermistor Calculator, the temperature coefficients can be modified so that a coresponding degree is equal to a litre, quart, gallon, inch of water, or any measurement you like.

In repeated tests I get acurate measurements to +/- 1/16” of water. In my 16” diameter kettle thats less than half a liter.

One of the problems I have had with this is noise in the resistance circuit. I haven’t had the time to track down the cause and try to remove it, but resolution (or at least more consistent readings) could be improved with a less noisy resistance reading.

Another issue is the digital pot I used. I used what I was able to find, but a 10K pot is perhaps a little to small, as this only provides 39 ohms resolution, I’d suggest a 20K or 50K. A 20K pot would have the equivalent of half the noise of a 10K pot.

By adding another pressure sensor and digital pot, a second (or third) level could be monitored with the same arduino.

I’m no longer certain that my brewery should be this automated. As my wife has pointed out, I spend more time working on my brewery than actually brewing. So I may leave this project at the stage I have it so I can concentrate on other activities, but I wanted to share my ideas and progress with others so that they may continue if they have the interest and motivation.

If anyone has any questions I’d be happy to answer them.

Parts:

small aquarium pump $9.98
tubing $3.98
air valves $2.98
pressure sensor (MPVZ5010GW7U-ND) $15.79
digital pot (AD5241BRZ10-ND) $2.95
arduino uno (1050-1024) $28.84
Arduino shield (1050-1010) $14.17
Misc capacitors and resistors approx $5.00

Total of about $84.00

I had many of these parts donated from friends so my cost to start this was pretty minimal. The above prices were from digi-key and my local pets store.


Arduino Program:


#include <Wire.h>
const int numReadings = 10;
int readings[numReadings];
int index = 0;
unsigned long total = 0;
byte inputPin = A0;

void setup()
{
Wire.begin();
Wire.beginTransmission(44);
Wire.write(byte(0x00));
Wire.write(1);
Wire.endTransmission();
for (int thisReading = 0; thisReading < numReadings; thisReading++)
readings[thisReading] = 0;
pinMode(8, OUTPUT);
pinMode(7, OUTPUT);
pinMode(4, INPUT);
pinMode(2, INPUT);
}

void loop()
{
total= total - readings[index];
readings[index] = analogRead(inputPin);
total= total + readings[index];
index = index + 1;
writeNewResistance(map((total/numReadings), 0, 1023, 0, 255));
if (index >= numReadings) {
index = 0;
}
}

int writeNewResistance(byte resistance) {
Wire.beginTransmission(44);
Wire.write(byte(0x00));
Wire.write(resistance);
Wire.endTransmission();
}



Wiring:

Image
clearwaterbrewer
Posts: 383
Joined: Wed Feb 09, 2011 3:43 pm
Bot?: No
Location: Clearwater, FL
Contact:

Re: Water level with the BCS - A how-to

Post by clearwaterbrewer »

sure would be nice just to be able to use a strain gauge or similar detect the pressure and have the BCS be able to read it directly with no active electronics...
User avatar
bbrally
Posts: 210
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC
Contact:

Re: Water level with the BCS - A how-to

Post by bbrally »

Agreed!

This would be the answer.

http://www.adafruit.com/products/464

Anyone want to test the temp limits?
JonW
Site Admin
Posts: 1726
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: Water level with the BCS - A how-to

Post by JonW »

bbrally wrote:Agreed!

This would be the answer.

http://www.adafruit.com/products/464

Anyone want to test the temp limits?
That would be a very cool level sensor. Visual & electronic! The specs say it is only good to 140 degrees (F).
User avatar
Baron Ken
Posts: 99
Joined: Fri Jan 15, 2010 2:50 pm
Bot?: No

Re: Water level with the BCS - A how-to

Post by Baron Ken »

Thanks for the write-up. :)
bbrally wrote:The system uses a pressure sensor which outputs between 0.2 and 4.7 volts from 0 to 40 inches of water. The Arduino reads this as a voltage between 0 and 5 volts and converts that to a number between 0 and 1023. This number is then divided by 4 to arrive at a number between 0 and 255 which is then transmitted to a digital potentiometer to set a resistance between 10099 and 20060 ohms (the max and min of the digital pot I used). It is this resistance that the BCS reads and then converts to a temperature.
The BCS wiki says an NTC thermistor is needed. It appears as though you are providing a resistance that increases as your water level increases (i.e input voltage increases). How is the BCS figuring out that you want an increasing volume (i.e increasing temp) when it expects a decreasing resistance for an increase in temp?
EDIT: Is this taken care of by the Thermistor Steinhart-Hart Coefficients settings? /EDIT
Another issue is the digital pot I used. I used what I was able to find, but a 10K pot is perhaps a little to small, as this only provides 39 ohms resolution, I’d suggest a 20K or 50K. A 20K pot would have the equivalent of half the noise of a 10K pot.
The BCS wiki says it wants a 10k ambient reading. Any temp above ambient would be <10k (NTC). A 50k pot with your 10k resistor comes to 60k max that the BCS would see. This wouldn't be a problem for the BCS?

Thanks.
User avatar
Baron Ken
Posts: 99
Joined: Fri Jan 15, 2010 2:50 pm
Bot?: No

Re: Water level with the BCS - A how-to

Post by Baron Ken »

So now, my next question is, if you take a 1k strain gage in series with a 10k resistor and use that as the temp probe (meaning BCS GND and BCS Temp1 as connections) and set the Thermistor Steinhart-Hart Coefficients to values calculated based on the strain (resistance) at 3 volume levels (min, mid, max), would that work?
I don't have access to strain gages anymore or I would have already done this. ;)
JonW
Site Admin
Posts: 1726
Joined: Sun Jul 18, 2010 7:51 am
Bot?: No
Location: Huntington Beach, CA
Contact:

Re: Water level with the BCS - A how-to

Post by JonW »

Just FYI - Adam does have volume sensing listed on the roadmap. Hopefully it will be in one of the coming updates. ;)

In the mean time, this is a pretty slick solution.
User avatar
bbrally
Posts: 210
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC
Contact:

Re: Water level with the BCS - A how-to

Post by bbrally »

The BCS wiki says an NTC thermistor is needed. It appears as though you are providing a resistance that increases as your water level increases (i.e input voltage increases). How is the BCS figuring out that you want an increasing volume (i.e increasing temp) when it expects a decreasing resistance for an increase in temp?
I wrote: "This number is then divided by 4 to arrive at a number between 0 and 255 which is then transmitted to a digital potentiometer to set a resistance between 10099 and 20060 ohms"

I more acurately should have written "This number is then divided by 4 to arrive at a number between 0 and 255 which is then transmitted to a digital potentiometer to set a resistance between 20060 and 10090 ohms".

Wiring the BCS between pins A1 and W1 will give a decreasing resistance relative to the input. Wiring between B1 and W1 would give an increasing resistance.
The BCS wiki says it wants a 10k ambient reading. Any temp above ambient would be <10k (NTC). A 50k pot with your 10k resistor comes to 60k max that the BCS would see. This wouldn't be a problem for the BCS?
Someone else maybe able to confirm this, but I think the BCS should be able to handle 60K resistance. This is a chart of some 10K thermistors I'm using.

Image

It has no problem reading water at zero degrees C. That's 30K.

I'm not home to test this, but if I were to put the probe in the freezer it should read about 70K. If the BCS can read -20C it should have no problem with a 50K pot.

But if it did have a problem, I'm certain the 20K pot would be no problem.
So now, my next question is, if you take a 1k strain gage in series with a 10k resistor and use that as the temp probe (meaning BCS GND and BCS Temp1 as connections) and set the Thermistor Steinhart-Hart Coefficients to values calculated based on the strain (resistance) at 3 volume levels (min, mid, max), would that work?
I don't know enough about strain gauges to answer this, but my concern would be that 1K wouldn't give enough resolution to be very accurate.
User avatar
bbrally
Posts: 210
Joined: Sat Mar 27, 2010 3:59 am
Bot?: No
Location: Vancouver, BC
Contact:

Re: Water level with the BCS - A how-to

Post by bbrally »

I just realized that the etape level sensor is a strain gauge!

Those gauges have a resolution of 55 ohms/inch and 140 ohms/inch for the 12" and 8" sensor respectively and a total resistance of 700 ohms and 1500 ohms.

I think the resolution that would accurately give you is pretty poor. That would mean the 8" sensor would give 8.75 ohms for every sixteenth of an inch. Noise in the line would be greater than that.

I'd aim for about 800 ohms/inch. That would give 50 ohms/sixteenth of an inch.
User avatar
Baron Ken
Posts: 99
Joined: Fri Jan 15, 2010 2:50 pm
Bot?: No

Re: Water level with the BCS - A how-to

Post by Baron Ken »

And yet from this document (http://forum.embeddedcc.com/download/file.php?id=2) about the temp probes, the change from 160F to 161F is only 39 ohms, and from 211F to 212F is only 12 ohms.
Post Reply