Can it even be done? Measuring Specific Gravity using Arduino or Raspberry Pi

Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Help Support Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum:

This site may earn a commission from merchant affiliate links, including eBay, Amazon, and others.

remthewanderer

Well-Known Member
Joined
Jun 10, 2011
Messages
86
Reaction score
5
Location
philadelphia
So. I want to track my fermentations a little better. I have brewpi installed on one of my raspberry pis. I know that this can track my temps just fine and it can integrate with arduino boards.

The holy grail for me would be the ability to see my specific gravity as it drops to get a ROUGH idea of whether or not fermentation is complete. I say rough idea because I just want a visual way to tell if a batch is ready to keg, I don't need to know if it finished at 1.010 or 1.015. This would be a nice to have feature but not necessary.

I've racked my brain and the best general solution I have come up with is to measure the capacitance of the wort and then use some math to translate that into SG. I've seen some charts on a salt water aquarium forum that did this math so I think capacitance measurements can correlate to SG.

But how to actually take capacitance measurements? I figure a food safe probe of some sort submerged in the wort. Pre-made EC probes are REALLY expensive. Enter the Arduino and the Capsense library.

Here is the hurdle for me right now: I don't currently own an arduino board.. I know that the cap sense library is used for touch based sensors and that people have used simple, food safe metals (could I use some stainless wire?) as the leads for home made EC probes. I have to assume that the capsense lib will output an integer or decimal value based on capacitance reading from the probe. I'm not 100% sure but I think the capacitance of wort will drop as the sugars change to alcohol. Can someone shed light on this? From this number I could work the math to get an SG or at the very least graph the number to see when it levels out.

Has anyone done anything similar? I've seen the beerbug kickstarter project which claims to measure SG but I have never read how they do it.

PS: How do large breweries know when their fermentation is complete? Do they take hydrometer readings manually or do they know that recipe X takes Y days to ferment out completely.

Can anyone here help shed some more light on how to digitally measure SG? I will gladly give you 1,000 internet points!
 
I had a professor in college tell me about how she worked on a project for Budweiser where they counted bubbles to get an idea of fermentation activity. I did a similar thing on a smaller scale using an optical trigger on an air lock to count bubbles. It works great to get an idea of fermentation activity when you graph the number of bubbles per time period. I like this way because you don't have to stick anything in the beer therefore it doesn't need to be waterproof and sanitized. Also the output is a digital signal that you can easily read in and manipulate. If you go this route make sure you don't get an optical trigger that uses the IR frequency range as it will pass through the water just fine so it never triggers on bubble edges.

I did run into some issues when you have very rapid bubbles flowing out where it wasn't able to capture all of the bubbles. But I wasn't interested in that data anyway. I just wanted to see when it was starting to slow down to know when to rack it to the secondary without having to open up my fermentation chamber everyday

image-4026369525.jpg
 
I am way too lazy to look it up but I've heard of highly sensitive scales being used and calculating various fermentation specifics based on lost weight.

... might be an easily obtainable and configured set up if I'm not on crack and dreaming the whole thing up.
 
I may be wrong but I believe for the aquarium salinity they are using Electrical Conductivity (EC) probes, not capactiance. EC probes are essentially measuring the ions in solution, so they wouldnt work measuring SG

Ive seen capacitance used for liquid level measurement, but nothing about gravity measurement. They do have digital refractometers though, you just put in a small sample valve in your fermentor and measure it that way, although Im sure you could modify them to your needs

IMHO though I feel like this is overkill, wait a couple weeks and call it good, in my experience with brewing, a little extra time rarely hurts, but rushing usually does
 
@crane - Thanks for the bubble counting example. I have heard of this done and I need to look into it further.

@Capebrewing - I've seen this too. I could use a set of sensitve load sensors to weigh the wort. I was not a fan of this method based on how I want to set up my fermentation chamber.

@ryane - We crap, I just assumed that EC was electrical capacitance not conductivity. RE: overkill. Absolutely this is overkill. It is more about coming up with a brand new way to use an Arduino or some other electronics to make this happen. The fun is in the build, not in the practically of it all.

I still need to know how the beerbug guys were able to do this. I think they will be at the AHA conference this year. I will have to ask them then.
 
As someone who works in a brewery, and my gf works at another. We still test gravity manually, not with a hydrometer but a device by Anton parr. We track daily what our gravities are till they are where we want them.
 
Wouldn't a neutral weight float on a linear encoder work best? It would be acting on exactly the same principle of a glass hydrometer, and linear encoders are immersion-proof and can be accurate to .00005" or tighter.

Or, alternatively, optical encoders, like those in a laser mouse. They have resolution high enough to measure .001" which is more than adequate. Solidly mount the laser above the liquid reading a floating scale.

Just throwing out some ideas.
 
The problem I see with a float in a fermentor is:

1. Krausen drying out on top of the float and weighing it down.
2. CO2 bubbles sticking to the bottom of the float causing it to float higher.
 
The guys over at Brewpi are working on this, I think using some kind of tensiometer but I'm not sure. I don't know what hardware they are using but the beer bug team has a wifi/bluetooth enabled SG device in manufacture now. It also measures temp and calculates alc % And of course it can be monitored in real time remotely.
 
@helibrewer: I am very familiar with the guy who runs brewpi. It is a bit annoying to me that he is not releasing details on his progress because he wants to try and patent something. This goes against my Open Source hardware ideals. I'm keeping tabs on him to see what he comes up with.

@Cathedral: Thanks for the ideas but I think that @crane brings up some good counter points. I'm still going to follow your path to a possible solution.

@chip82: So you take small samples off the tank to do your measurements?
 
I had plans to do this...

Honestly due to krausen and CO2 bubbles, i dont see how any float type sensor would work.

This leaves your two options really that i was looking into

1) Mass measurements, easy to brute force but you obviously have to use a big enough scale thats accurate enough...
2) Pressure differential...i was looking at using a pair of pressure sensors with tubes of known distance seperating them(height wise) going into your wort. With that you can use the equation
pressure difference = density x gravitational acceleration x height difference
And calculate for density, from there you can calculate SG.

I have the differential pressure sensors and everything, just havent had time to put it all together. I am still struggling with a cheap method of "wrapping" my tubes and getting them in a fixed location where they cant ever move. I was thinking of some sort of food safe plastic tubing with the smaller tubes squished in, or maybe even heat shrink wrapping them together? And set it so that there is a big delta, something simple like 6 inches or a foot. Something like this would be only really usable for buckets, which is all i care about...it could be done with a carboy though.
 
I have also put some thought into this... not an easy solution for sure.

I was thinking about creating a container in place of your airlock that has a blow-off valve. The blow-off valve would trip at a certain pressure and then equalize once opened. You know the volume of your container and the pressure inside the container when the blow-off valve trips. After counting the valve trips, you would have enough information at anytime to know how much CO2 has been produced.

This is certainly a non-trivial task, but seems like it would work.
 
FuzzeWuzze said:
2) Pressure differential...i was looking at using a pair of pressure sensors with tubes of known distance seperating them(height wise) going into your wort. With that you can use the equation
pressure difference = density x gravitational acceleration x height difference
And calculate for density, from there you can calculate SG.

I have the differential pressure sensors and everything, just havent had time to put it all together. I am still struggling with a cheap method of "wrapping" my tubes and getting them in a fixed location where they cant ever move. I was thinking of some sort of food safe plastic tubing with the smaller tubes squished in, or maybe even heat shrink wrapping them together? And set it so that there is a big delta, something simple like 6 inches or a foot. Something like this would be only really usable for buckets, which is all i care about...it could be done with a carboy though.

The last company I worked for made a custom fermentation controller for large 40 gallon wine fermenting vessels. There are 150 of them installed at UC Davis. They used the pressure differential method to measure specific gravity. The two tubes were spaced about a foot apart. For this to work correctly they have to use a small air pump to push air out so no liquid goes up into the tubes. I worked with the guy who developed it and he said it was quite a challenge to get it working as the readings get thrown off when the air bubbles break away from the end of the tube.
 
The last company I worked for made a custom fermentation controller for large 40 gallon wine fermenting vessels. There are 150 of them installed at UC Davis. They used the pressure differential method to measure specific gravity. The two tubes were spaced about a foot apart. For this to work correctly they have to use a small air pump to push air out so no liquid goes up into the tubes. I worked with the guy who developed it and he said it was quite a challenge to get it working as the readings get thrown off when the air bubbles break away from the end of the tube.

I heard this as well but never really thought about it happening in a 5 gallon batch, who cares if the beer goes up the tube slightly? The pressure wouldnt be high enough to push it into the sensor would it?
 
I've been playing with this on and off for a few years now.

The most effective solution I've come across so far is to use a mass flow meter to track the total quantity of CO2 blown off. This is an imperfect (though quite good) correlate to gravity and a perfect correlate to ABV. I use a mass flow controller that I got off ebay for around $65...works a treat and makes a great spunding valve for pressurized fermentations (if you're into that).

I could never get the floats and suspended stuff to work properly. Fermentation is just too gunky.
 
Wouldn't it be possible to simply measure the ethanol concentration in the vapor in the fermenter to arrive at the current gravity? Here's an example:

http://www.vernier.com/products/sensors/eth-bta/

They even describe experiments to follow the formation of ethanol by yeast using simple sugar. If you know the OG and the fermenter temperature, it is possible to calculate the current gravity.
 
Wouldn't it be possible to simply measure the ethanol concentration in the vapor in the fermenter to arrive at the current gravity? Here's an example:

http://www.vernier.com/products/sensors/eth-bta/

They even describe experiments to follow the formation of ethanol by yeast using simple sugar. If you know the OG and the fermenter temperature, it is possible to calculate the current gravity.

It's an interesting idea, but this sensor only goes up to 3%. I browsed around for one that went up higher but didn't see anything immediately. I wonder if headspace atmospheric vapor measurements are a reliable correlate to liquid ABV.
 
Measuring ethanol in the vapor in the headspace of the fermenter should give a reasonably accurate estimate of the alcohol concentration in the beer due to its partial pressure. Temperature would certainly impact this, but this could be controlled by using a separate sensor in a sealed chamber containing a known ethanol concentratio (e.g. 5%) near the measuring sensor. There is a cheap ethanol sensor called the MQ303A that is made for portable breathalyzers that might work under appropriate conditions. Still too low of a range though. Another option would be to measure CO2 output coming out of the airlock with a CO2 sensor. This is simply a way to measure fermentation activity though, not final gravity.
 
Measuring ethanol in the vapor in the headspace of the fermenter should give a reasonably accurate estimate of the alcohol concentration in the beer due to its partial pressure. Temperature would certainly impact this, but this could be controlled by using a separate sensor in a sealed chamber containing a known ethanol concentratio (e.g. 5%) near the measuring sensor. There is a cheap ethanol sensor called the MQ303A that is made for portable breathalyzers that might work under appropriate conditions. Still too low of a range though. Another option would be to measure CO2 output coming out of the airlock with a CO2 sensor. This is simply a way to measure fermentation activity though, not final gravity.

Like I mentioned in my earlier post, though, I get quite reliable correlations to gravity by tracking total CO2 released.
 
Instead of counting CO2 bubbles in an airlock, I was referring to using a CO2 sensitive sensor. I saw a nice writeup on the web showing fermentation monitoring using this approach. It would pretty much give you the same info as your airlock setup, so not much of an improvement. There are various ways to measure SG with in-line approaches, including ultrasonic doppler setups, etc. The one I thought was cool was based on a vibrating tube. The idea was to measure the resonance of a small tube filled with the fluid of interest. But, it seems tricky to realize this. Actually, given the delay in various commercial efforts for a cheap setup for home brewers, I guess this turns out to be a pretty hard nut to crack.
 
Instead of counting CO2 bubbles in an airlock, I was referring to using a CO2 sensitive sensor. I saw a nice writeup on the web showing fermentation monitoring using this approach. It would pretty much give you the same info as your airlock setup, so not much of an improvement. There are various ways to measure SG with in-line approaches, including ultrasonic doppler setups, etc. The one I thought was cool was based on a vibrating tube. The idea was to measure the resonance of a small tube filled with the fluid of interest. But, it seems tricky to realize this. Actually, given the delay in various commercial efforts for a cheap setup for home brewers, I guess this turns out to be a pretty hard nut to crack.

Hmm...I think you're confusing me with somebody else. I'm not counting bubbles in an airlock. I'm using a CO2-calibrated mass flow sensor. It's quite simple and reliable.
 
Sorry MalFet, I did confuse you with an earlier poster. Given an equal molar ratio of CO2 to ethanol, it should be theoretically possible to determine exactly how much ethanol is produced. I guess the issue is that this requires an accurate way to know how much CO2 has been produced during the entire fermentation. I can see how measuring CO2 release would show when the fermentation is dying off, but how would you accurately measure the total CO2 production during the entire fermentation? How reliable is this?
 
craigmw said:
Sorry MalFet, I did confuse you with an earlier poster. Given an equal molar ratio of CO2 to ethanol, it should be theoretically possible to determine exactly how much ethanol is produced. I guess the issue is that this requires an accurate way to know how much CO2 has been produced during the entire fermentation. I can see how measuring CO2 release would show when the fermentation is dying off, but how would you accurately measure the total CO2 production during the entire fermentation? How reliable is this?

If you're measuring rate of CO2 production throughout, the total quantity produced is simply your integral. Some models of mass flow meters have a totalizer built in, but even if they don't the math is simple enough.

It's quite reliable...I land within a point or two consistently.
 
If you're measuring rate of CO2 production throughout, the total quantity produced is simply your integral. Some models of mass flow meters have a totalizer built in, but even if they don't the math is simple enough.

It's quite reliable...I land within a point or two consistently.

Okay, I'd like to know more about your methods. What meter are you using? I've seen quite a few MAF sensors for auto engines, but haven't come across a CO2 specific version on eBay. I can understand how one goes about determining specific gravity from total CO2 produced, but I don't see how you could figure this out by taking only a single measurement toward the end of the fermentation. Total alcohol produced is one parameter that could be taken at any point rather than continuously because most of it remains in the fermenter, whereas CO2 is released from the fermenter. I do see how measuring CO2 output at one point in time would let you know about the relative level of fermentation, i.e. to signal the end of fermentation when CO2 output is low.
 
Okay, I'd like to know more about your methods. What meter are you using? I've seen quite a few MAF sensors for auto engines, but haven't come across a CO2 specific version on eBay. I can understand how one goes about determining specific gravity from total CO2 produced, but I don't see how you could figure this out by taking only a single measurement toward the end of the fermentation. Total alcohol produced is one parameter that could be taken at any point rather than continuously because most of it remains in the fermenter, whereas CO2 is released from the fermenter. I do see how measuring CO2 output at one point in time would let you know about the relative level of fermentation, i.e. to signal the end of fermentation when CO2 output is low.

Ahh...there's the rub. I'm not taking a single reading. I'm taking readings at fixed intervals throughout the fermentation. It's easy and reliable.

Mine is a Cole Parmer 33116-series mass flow controller (500sccm, CO2). I got it off of ebay for around $40. CO2 mass flow meters are generally available on ebay (I see several right now), though realistically any meter will work if you're willing to recalibrate it.
 
This was on kickstarter a while back. It wouldn't be using the RaspPi that we all want to incorporate into our brewing, but I think this project is great.
 
Ahh...there's the rub. I'm not taking a single reading. I'm taking readings at fixed intervals throughout the fermentation. It's easy and reliable.

Mine is a Cole Parmer 33116-series mass flow controller (500sccm, CO2). I got it off of ebay for around $40. CO2 mass flow meters are generally available on ebay (I see several right now), though realistically any meter will work if you're willing to recalibrate it.

I've checked this out, and most are reasonably pricey. Nice units from Horiba, but are $250+. The Cole Parmer unit you cite originally cost over $850! Good catch on that. Mouser has MEMS based units that have a 10V input 4V output for air for less than $50. I wonder if these could be calibrated for CO2 output? My thinking is that there isn't much air exchange going on in a fermentation, just CO2 release. So long as CO2 flow could be calibrated (though I'm not sure how to go about this), this would be a reasonable way to measure fermenter activity. BTW, your approach is far cleaner than some of the other methods I've seen for measuring CO2 production.

I have to say that I'm still partial to the ethanol measurement approach since any error in flow measurement is additive during the course of the fermentation, whereas EtOH measurement can be taken at any point.
 
I've checked this out, and most are reasonably pricey. Nice units from Horiba, but are $250+. The Cole Parmer unit you cite originally cost over $850! Good catch on that. Mouser has MEMS based units that have a 10V input 4V output for air for less than $50. I wonder if these could be calibrated for CO2 output? My thinking is that there isn't much air exchange going on in a fermentation, just CO2 release. So long as CO2 flow could be calibrated (though I'm not sure how to go about this), this would be a reasonable way to measure fermenter activity. BTW, your approach is far cleaner than some of the other methods I've seen for measuring CO2 production.

Those are new prices, though. Second hand units are readily available on ebay for sub-$60. The various gas-specifications are just a matter of a coefficient. There's a simple multiplier to convert between units.

I have to say that I'm still partial to the ethanol measurement approach since any error in flow measurement is additive during the course of the fermentation, whereas EtOH measurement can be taken at any point.

Sure, it sounds like a great approach in theory. Have you found a sensor that operates in a range useful for homebrewers? I'd like to give it a whirl to see if it actually works experimentally, but the sensor you linked to won't work.
 
Those are new prices, though. Second hand units are readily available on ebay for sub-$60. The various gas-specifications are just a matter of a coefficient. There's a simple multiplier to convert between units.


I guess I'd like to go with an approach that I could publish here, and using an off the shelf part that others could use would make this work better. I just need to figure out how to convert this particular part for EtOH instead of air.

Sure, it sounds like a great approach in theory. Have you found a sensor that operates in a range useful for homebrewers? I'd like to give it a whirl to see if it actually works experimentally, but the sensor you linked to won't work.

A couple of thoughts here... there are IR based ethanol sensors that use an IR spectroscopy approach with a spectral peak around 2900 nm indicating ethanol. I'm still trying to find a cheap solution for this. An alternative is to use ethanol sensors for E85 gas. These are flex fuel vehicle sensors that can detect the level of ethanol in gas between 0 and 100%, and send a frequency output based on this. I'm not sure this would be sensitive enough for beer though. So the issue is that the MQ3/MQ303 chip based EtOH sensors are too sensitive and the auto flex fuel sensors may not be sensitive enough for the typical 3-8% EtOH levels we usually see in finished fermentations. I think the best approach is the IR spectroscopy method, but I'm yet to find a reasonably economical solution for this.
 
You'll never be able to calibrate those electronic ethanol sensors accurately enough. They usually require 24 hours of preheating too.
 
I guess I'd like to go with an approach that I could publish here, and using an off the shelf part that others could use would make this work better. I just need to figure out how to convert this particular part for EtOH instead of air.

Great! Let us know if you get something working.
 
Hey Everyone, just saw this thread and although its a year old now, I figured I'd chime in.

I use a bubbler liquid level sensing system in my apartment setup using an arduino to read the voltages from an MPX5010dp differential pressure sensor (0-3ft of height is 0-5V). This works well as you have one port reading the pressure of the height of liquid, the second is open to atmosphere for reference.

5392539_orig.jpg


I'll be using this technique to do automated gravity readings with two bubbler tubes spaced a few inches vertically apart from eachother. I'll feed the system initially with an aquarium air pump however may eventually use C02 (from either a bottle or a C02 bath created by the fermentation of the beer itself :) The bubbling of the system as previously mentioned is not really an issue as you can filter this out with software.

Reasons I will be using the bubbler are:
1. no concern over crud or krausen or any other debris accumulating on the tubes
2. Already use a single bubbler tube for liquid height measurement on my brewery so integrating this will be simple
3. Its very simple (not as simple as an optical sensor in the airlock) and its output directly measures gravity not back calculating it from bubbles or mass flow of C02 or weight etc.....

I'm sure I'll learn a thing or two while doing this project so I'll be sure to keep everyone up to date with how I am progressing on this.

As this is a learning forum, please challenge anything i've said above if it doesn't seem to add up

-Jason
www.brewbot.ca
 
I hate to be a naysayer, and I think bubblers are great for volume measurements. However, I think that you should do some preliminary calcs before you go too far down this road. I don't think that you will be able to get the resolution that you are looking for. Even if you place the differential bubblers a foot apart the pressure change with respect to SG will be very small. I think that it would be something like 0.00043 psi per gravity point.
 
Time to come out from lurking mode I suppose! I did an experiment a while back using a differential pressure sensor:

http://www.digikey.com/product-detail/en/SSCDRRN025MDAA3/480-3660-ND/2704715

.. and a couple of tubes going in to a very ad-hoc-and-experimental fermentor vessel:




This is the result:



The wort OG was 1.043, and it ended at 1.018 (it was fermented in a too cold basement with too little WLP400, which is probably why it stopped early. No oxygen added or shaking wort either..) The values on the graph is voltage * 1000 so there is a 300 mV difference from start to finish.
 
How about calibrated weights (e.g. BrewBalls) with RFIDs inserted in them? Have a RFID reader at the bottom of the tank that reads which balls have fallen.
 
Time to come out from lurking mode I suppose! I did an experiment a while back using a differential pressure sensor:

http://www.digikey.com/product-detail/en/SSCDRRN025MDAA3/480-3660-ND/2704715

...This is the result:



The wort OG was 1.043, and it ended at 1.018 (it was fermented in a too cold basement with too little WLP400, which is probably why it stopped early. No oxygen added or shaking wort either..) The values on the graph is voltage * 1000 so there is a 300 mV difference from start to finish.

Nice work, the graph looks promising that you can use a DP to measure SG changes - would a cheaper sensor work like http://www.digikey.com/product-detail/en/MPXV7002DPT1/MPXV7002DPT1TR-ND/1168437 looks to have similar scale and accuracy values???
I was going to suggest making the carboy/bucket into a capacitor with 2 sheets of copper wrapped halfway round each and measure the change in capacitance :confused:
 
Back
Top