DIY inline refractometer

The idea of this project is to image the refractometer output, then convert the position of the blue line, to a digital reading, using image processing.

The idea is to measure the brix of wort during mash and sparging, so that sparging can be stopped around 1.010 SG, to avoid tannins.

It was necessary to alter /boot/config.txt, so that the temperature probe was recognised. Also without gpiopin=4, the probe didn’t seem to be detected on my Pi Zero W.


The following image depicts a Pi zero with a camera along with a thermowell with a DS18B20 temperature probe, also connected to the Pi.

Image from the refractometer taken via the Pi camera, without any liquid in the vessel.

The following video depicts water being recirculated through the refractometer being heated from around 17C to just below 70C, before the raspberry pi crashed, I believe being in too close proximity to the hot refractometer.

The idea of heating just plain water, is so that I can generate a calibration curve for brix as temperature increases.

As you can see from the video I need to alter the shutter speed of the pi camera, as the images become too dark at high temperatures.

Image of the first test, using a piece of paper as a diffuser and clumsily balanced on a tub to get the right angle for the liquid to fill most of the vessel. Note the photo below was taken just after the experiment, and the water in the vessel has dropped what looks like below the thermowell.

Version 1

Version 2


Software – the software to capture images and log temperature data to a CSV file, is located here.

I’m currently working on a stainless version, which will be much less clumsily designed! 😉 And the Pi will be kept far away from the metal, to prevent overheating!

Notes – 24th Nov. 2019

I had problems with the triclamp version I was working on (see image version 2), I believe possibly because not enough light was getting in from all angles. I need to have a think if I can create something more similar to version 1, but using triclamps.

  • Joel
    December 24, 2019 Reply

    Well, that’s a first as far as I can tell. Good work.

Leave Comment

Error Please check your entries!