Counting Bubbles



I've been making wine with my family ever since I can remember. It's a fairly straight forward process that is nearly impossible to master. The wine my family made always started a grape varietal (such as Merlot or Sangiovese). We would crush the grapes and throw the slurry into primary fermentors where we would add a specially cultured wine yeast. After a few days of this harsh smelling fermentation, we would then press the grapes and put the liquid into glass carboys where you would then add chemicals, sugar, and put the liquid under a water lock to keep natural-air yeasts from infecting the brew and turning it to vinegar. This goes on and on for months, until you might end up with something that tastes pretty good.



Now let's say you're a poor college student. How to brew cheap wine? You can combine grapes (or cheap Welch's grape juice), some water, and some yeast (I even sunk so low at one point where I used bread yeast) and you will undoubtedly end up with something that resembles wine. It won't taste good! But it should get you snake-eyed. Either approach uses a very straight forward biological process of yeast, eating sugar, and giving off CO2 and alcohol. Wouldn't it be fun to see how this biological process acts over time?



I decided to return to my roots and whip up a batch of world (in)famous homemade wine. And while I was at it, why not log the bubbles that are given off during fermentation?



























4 cans Welch's Concord 100% Grape Juice

Tap water to 3 gallons

2 tablespoons acid blend

1 spoon pectic powder

Lalvin K1-V1116 wine yeast

After adding the water and acid blend chemicals, I took an initial hydrometer reading to get the sugar level.







I found the initial sugar level from the frozen juice was about 1.025. I wanted the level to be near 1.080. Time to add sugar!





























Now the point of this experiment is to capture the rate at which bubbles (we presume CO2) are vented off the fermentation. I found that this 'double bubble' air lock worked great with our IR photo gate After dumping nearly 5 lbs of sugar into the mix, I finally hit 1.085! 5lbs! 1.040 - getting there! Added:After adding the water and acid blend chemicals, I took an initial hydrometer reading to get the sugar level.I found the initial sugar level from the frozen juice was about 1.025. I wanted the level to be near 1.080. Time to add sugar! Mmmm! Grape juice goes in. What will come out? Step 1 was to get all the materials together. Grape juice, acid blend, yeast, sugar, hydrometer, journal, a fermentor with water lock, and a big spoon.









Now the idea is to take the Logomatic and reprogram it to record when a bubble goes by.













to my cleaned up Logomatic code. It doesn't support the regular config file parsing that makes the stock Logomatic so great, but I think this code is easier to understand and should serve as a good starting point for people wanting to edit the firmware for their own purposes.



Ok - so the brew is brewing. The Logomatic with Bubble Logging firmware is installed and running. Now with the magic of TV, we can fast forward 10 days.



Stats:

With a little testing, I was able to confirm that the photo gate would trigger each time a bubble went by. Then I spent a few days streamlining the Logomatic code to fit my purposes. The Logomatic is a fantastic little product. Ryan's USB bootloader makes it easy to reprogram the Logomatic with new firmware specific for my needs. Here is a link to my cleaned up Logomatic code. It doesn't support the regular config file parsing that makes the stock Logomatic so great, but I think this code is easier to understand and should serve as a good starting point for people wanting to edit the firmware for their own purposes.Ok - so the brew is brewing. The Logomatic with Bubble Logging firmware is installed and running. Now with the magic of TV, we can fast forward 10 days.

3,118,000 bytes of logs



159,098 bubbles

851,580 seconds



14,193 minutes

9.85 days

As with any logging project, getting the data is easy, visualizing it is the hard part. One of the problems with the logs is how the events were saved. The logs looked something like this:





Bubble #, Seconds elapsed

44732, 6211

44733, 6232

44734, 6296

44735, 6315





This made it very difficult to graph in Excel (or Calc because we use Open Office). These spreadsheet programs expect time to be linear. In my logs, time jumped around as the bubbles rolled through. I also had 7 or 8 logs as each morning I would reset the system to make sure I didn't overflow any given text log file. So to stitch the logs together and fix the time-base problem, I created this quick and dirty Visual Basic program. I publish it so that hopefully you can use similar text file parsing tricks as the basis for your own log challenges.



Can someone show me how to write something similar in Python? I should really learn Python one of these days.



After stitching, I ended up with a nice linear time-based CSV file (check it out!) that can be easily imported into your favorite graphing program. In this case, I used the very limited Excel to graph the bubbles per minute over a 10 day period:



