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.

  • Justin
    March 30, 2020 Reply

    Great idea, thanks for posting it! I am interested in building something similar and have a couple questions.

    1. Did you remove the prism housing (the angled part) or does it sit in the fitting?
    2.What kind of fitting did you use?

    • admin
      March 31, 2020 Reply

      Hi, thanks, I just used the whole refractometer for both the triclamp metal version and version with the plastic jar.

      For the plastic jar version, I used a cable gland fitting.

      For the triclamp version, I had a metal triclamp ferrule milled out (but this version didn’t seem to give very clear pictures, because not enough light was getting in I think).

      Hope that helps.

  • Joel
    August 20, 2020 Reply

    This is great. I am looking to make something like this.

    Why didn’t you use a digital refractometer?

    Wouldn’t it be easy to read the data from it?

    • admin
      August 21, 2020 Reply

      Yes that’s a good point regarding a digital refractometer. I have got one of those,
      but didn’t really want to take it apart to use it ‘in-line’.

Leave Comment

Error Please check your entries!