Close
0%
0%

A Simple Method to Measure Coffee Colloids

A novel and inexpensive technique for measuring colloids.

bobbob
Similar projects worth following
This project started with the intention of quantifying the differences between coffees brewed by various methods. The result is a novel technique for measuring colloids. A theoretical explanation of why and how it works and practical details about the use of the Raspberry Pi High Quality camera for data gathering. will be forthcoming.

Index


This page is the introduction.

Statistical Analysis

The Effect of Particle Size

Laser Calibration 1

Laser Calibration 2


What's a colloid?

Colloids are particles which are larger than molecules but are small enough that they stay dispersed in the coffee. They scatter light. When you shine a laser through a colloid dispersion, you can see the light beam. link

Do colloids matter for coffee?

Colloids and acids are two things that change depending on the brewing method. link

One major purpose of Traditional Cupping is to greatly enhance Brew Colloid formation, so that the broader spectrum of a coffees flavour can be perceived.

How does this project work?

We shine a laser through diluted coffee and take a picture of the resulting light beam. By analyzing the picture, we can tell how much light reaches the camera from each point along the light beam.

Results

unpack.py

This takes a Raspberry Pi High Quality Camera RAW file and extracts the red pixel data along the laser beam.

x-python - 1.09 kB - 01/07/2021 at 14:03

Download

getMaxVals.py

This takes the data file generated by procLaser.py and extracts the red values along the laser beam. The result is maxVals.txt which can be plotted.

x-python - 653.00 bytes - 01/07/2021 at 13:15

Download

procLaser.py

This extracts data from a jpg file and puts it in a file named data.txt The image must be 2272x1704 pixels. If the image isn't the right size, which is likely the case, run the convert command as outlined in Step 1 of the instructions.

x-python - 598.00 bytes - 01/07/2021 at 13:10

Download

annotatedSetup.png

This is a way to keep the laser pointing down the middle of the graduated cylinder and to have a consistent camera position. The clothes pin holds the push button depressed.

Portable Network Graphics (PNG) - 376.38 kB - 01/06/2021 at 20:57

Preview

  • 1
    For most cameras

    ===========================

    Nota Bene

    Digital cameras do a lot of processing. Try to run your camera in as manual a mode as possible. I set the Canon A520 to aperture priority and set the aperture to f-8.

    ===========================

    The heart of this project is the ability to extract data from an image file.

    For most cameras use the following procedure.  For RAW images from the Raspberry Pi High Quality Camera, follow the instructions are in the next section (ie. Step 2).

    To extract data from a jpg file, I have written procLaser.py

    NB: the image files were created by a Canon A520.  They are 2272 x 1704 pixels. Your camera is probably different. 

    If necessary, install imagemagick. 

    On the command line do:

    convert img_00001.jpg -resize 2272x1704 -rotate 180 laserCylinder.jpg

    You will have to change the image name.  ie. img_00001.jpg becomes whatever your camera created.

    Unless your image is upside down, you don't need: -rotate 180

    procLaser.py relies on the Python PIL module.  In Ubuntu, that module can be found in Synaptic..

    On the command line you can do: 

    sudo apt install python-pil

    Anyway, you have to install python-pil before you can use procLaser.py.

    procLaser.py requires that you name your image file laserCylinder.jpg.

    It produces an output file called data.txt.

    On the command line do:

    python getMaxVals.py

    You will get a file called maxVals.txt which you can plot using gnuplot.

    In gnuplot do:

    plot "maxVals.txt" using 1:2 with lines

    If you want to save the resulting graph, you can do:

    set term png

    set output "someFileName.png"

    replot

  • 2
    For the Raspberry Pi High Quality camera in RAW mode

    These are the instructions for the Raspberry Pi High Quality camera in RAW mode

    The command line instruction to take a picture is:

    raspistill -ISO 100 -r -ss 1000000 -o img_00001.jpg

    That sets ISO at the minimum value.

    The exposure time is 1,000,000 us = 1 second.

    The -r specifies a jpg file with RAW data.

    The aperture on the wide angle lens was wide open.

    To process the data I have written unpack.py.

    It's necessary to edit to change the file name for each image.

    My program is based on this excellent article.

    Note that, for the purposes of this project, I only care about the red pixels so that's all unpack.py deals with.

    unpack.py produces a data file named maxVals.txt.

    To graph the data in gnuplot do:

    plot "maxVals.txt" using 1:2 with lines

    If you want to save the graph, do:

    set term png

    set output "someFileName.png"

    replot

View all instructions

Enjoy this project?

Share

Discussions

Similar Projects

Does this project spark your interest?

Become a member to follow this project and never miss any updates