Adjusting calibration based on temperature, how do?

I"m working on building an Arduino hydrometer for measuring the specific gravity of homebrew beer. So far, I've decided on measuring the head pressure at the bottom of the tank and mapping that against my glass hydrometer. The question is, how can I use a temperature reading to figure out what the specific gravity of the brew would be if it were at a predefined temperature, even if it is not, in reality, at that temperature.

For instance, let's say the predefined temperature (call it set_temp) is 22 degrees celsius. I take my pressure and temperature readings and discover that the gravity is 1.028, and the temperature is 27 degrees celsius.

The gravity of the beer at 27 degrees will be different to the gravity at 22 degrees. How can I use the temperature reading to figure out the density at a particular temperature?

Is that clear, and does anyone have any ideas?

Density and change in Temperature
When temperature is changed the density of a fluid can be expressed as

?1 = ?0 / (1 + ? (t1 - t0)) (1)


?1 = final density (kg/m3)

?0 = initial density (kg/m3)

? = volumetric temperature expansion coefficient (m3/m3 oC)

t1 = final temperature (oC)

t0 = initial temperature (oC)

Volumetric Temperature Coefficients - ?
water : 0.0002 (m3/m3 oC)
ethyl alcohol : 0.0011 (m3/m3 oC)

Get your head around that lot !!
As you will observe the beta factor changes quite a bit, based upon the fluid being measured. Your first problem is that beer in ferment is a "live" variable, ie the fluid beta factor will change as the beer raw mix converts to alcohol. Also the effervescence will raise volume and reduce apparent density since the fluid is no longer a homogenous mix (its liquid plus gas plus suspended solids)

In effect you are measuring pressure head so the shape of the vessel will greatly affect the ability to accurately measure pressure - a tall narrow vessel will give higher resolution than a short squat vessel. You are also looking for minute pressure changes which may well be outwith the resolution capability of whatever sensor you use.

But apart from that, it's an interesting project, with a promising reward at the end of the brew even if the project fails, so the very best of luck

Your first problem is that beer in ferment is a "live" variable

This is the variable that I'm wanting to measure, the calibration that I'm talking about is at one instant, so I know the temperature and the density of the liquid at that temperature, and from there I want to figure out what the temperature would be if it were at another temperature. The point of the exercise of measuring density while brewing is to determine the rate and amount of change in density, but to do this you normally have to read at a particular temperature.

Also, not much effervescence, if any, builds up during the primary ferment. The CO2 is released into the atmosphere through an airlock.

The vessel whose pressure I will be measuring will actually be a tall thin tube with a diaphragm over one end. This end will be held about 2cm from the bottom of the vat, and the sensor will measure the air pressure in the thin vessel.

The equation will give you the density at a temperature other than the measured one

The vessel whose pressure I will be measuring will actually be a tall thin tube with a diaphragm over one end. This end will be held about 2cm from the bottom of the vat, and the sensor will measure the air pressure in the thin vessel.

Can you sketch out exactly what you are planning for the pressure measurement

Brown is the beer, the thin grey tube is the temperature sensor. The thick grey tube is hollow, but sealed at each end, at the top end by a solid wall, at the bottom end is a latex diaphragm(the black thing). I'll measure the air pressure inside the thick grey tube. The volume of the cavity under test will in reality be quite small, but it will be at the end of the long tube, so as to make it possible to hold it at the bottom of the vat.

How much of a difference do you think the beta value will make? If I set it at somewhere halfway between water and alcohol, how far out will that throw my readings? By the way, I will be calibrating as I start each brew using my glass hydrometer, and after the brew has reached its fermenting temp, it will stay pretty much at that temperature.

Even more variables creeping in, I'm afraid.

Air temperature and barometric pressure will both affect the volume of the sensor tube and the measured internal pressure, though by how much I couldn't say.

The depth you plunge your column will be the major variable component since the hydrostatic pressure will be proportional to depth, the variation of which will be many, many times greater than any variance in SG. Add to this the fact that the tank level also varies the hydrostatic pressure so any variation in content during fermentation will affect the sensor output.

I feel the maths are going to be a real headache and your best bet might well be to simply build it and do a periodic calibration against a glass hydrometer (with inbuilt temperature compensation) from which you may be able to produce a calibration chart.

However I'm afraid that pessimism is fast creeping into my thinking on your idea.

On a more positive note, such things obviously exist, see attached link Digital Hydrometers for Battery Testing and More - Specific Gravity Meters so all you need to do is find out how they actually work and take it from there.

How about attaching a liquid level sensor such as this: Liquid Level Sensor - 8" - SEN-10221 - SparkFun Electronics to a glass hydrometer?

There's some interesting reading on the topic of brewers trying to build a digital hydrometer at Digital Hydrometer | Homebrew Talk - Beer, Wine, Mead, & Cider Brewing Discussion Forum

Response No 65 on page 7 seems to offer a potential method of measurement