Search
Counting BubblesI'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? ![]() 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. ![]() Mmmm! Grape juice goes in. What will come out? ![]() Added:
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! ![]() 1.040 - getting there! ![]() After dumping nearly 5 lbs of sugar into the mix, I finally hit 1.085! 5lbs! ![]() 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: Now the idea is to take the Logomatic and reprogram it to record when a bubble goes by. ![]() 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. Stats:
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: ![]() I am so bad with Excel, I can't even get the axis labeled correctly. On the left axis we have bubbles per minute. On the bottom axis we have seconds elapsed. Wouldn't it be nice if that axis was in hours or days? Man I hate excel. Can someone take this excel file and show me how to get the axis in days? Graph submitted by JWood (user comments): What can we learn from this graph? Assuming the data is sort of correct, it fits with what I would expect: the fermentation heats up quickly and (logarithmically?) dies as the yeast consumes all the sugar. There is some interesting behavior on the tail. There are rhythmic dips in bubble production. This could be an interesting yeast behavior, or it correlates with each morning that I got up and reset the system (tapping the bucket and disturbing the system). Perhaps those dips are around when I would come home and the vibrations of walking around caused latent pressure to be given off? No, that doesn't really make sense with the data. But I did notice that my walking around was enough to cause the air lock to shake out a bubble. In the end, the system seems to work. But I did notice that the photo gate did not catch every bubble. A bubble could slip by undetected. The system was also unable to capture multiple bubbles within the same second (possible during peak fermentation). I believe I captured the rough nature of the fermentation process but it certainly could be run again. Oh, and the wine? It was murky, smelly, horrible concoction that got sacrificed down the sink. Questions to answer: What is the best way to visualize data stored in text files? Phython scripts? There must be something online? How to beat excel into shape? |
||||||||
Feeds
Currency
Display prices in
Feedback
If you would like to tell us more, you can fill out our form if you need some psycho-suggestive questions. Go to the form.
















e.g.
ln e^{-ax} = -ax
OpenOffice spreadsheet file
I just added a "Day"=minutes/(24*60) column and did an XY(scatter) graph with days on the x axis and bubbles per minute on the y axis.
I don't have excel at home, but I have crunched numbers like this at work. The easiest way I have found is to create a histogram (http://www.vertex42.com/ExcelArticles/mc/Histogram.html)
If not, your wine most likely got wild yeast or bacterial infection from unsanitary equipment or from the sugar or even from tap water. Nasty microbes are everywhere and love to eat sugar-water. Only certain microbes actually make something that tastes good.
You could make some decent tasting wine this way (see http://www.homebrewtalk.com/f79/welchs-grape-juice-wine-21093) if you sanitized your equipment. Immersion in solution of water and iodophor or star san [mostly phosphoric acid] or even bleach would do it. Also you'd want to boil at least the sugar (in a sugar-water solution) and the water. 15 minutes should do it. (for the water, you can just use sterile water like store-bought spring water, but the sugar needs to be dissolved and boiled)
Of course, if the point was just fermenting something to bubble for the experiment that you didn't intend to drink, mission accomplished. :) Of course, you could have just used sugar-water and bread yeast for that.
If anyone reading this is interested in getting into brewing, the best place to start is: "How to Brew" http://www.howtobrew.com/intro.html -- it's about brewing beer at home, but most of the same techniques and equipment apply to wine.
E
It is python and super easy to create great looking results. Find the kind of graph you want on matplotlib gallery and crib away.
You should add temperature logging too since that is such a key variable in the proper fermentation of wine.
You could easily stabilize temperature. I used once a cheap aquarium heater (with integrated thermostat) to accelerate sourdough fermentation in a bread making process. The idea is to put all the installation in a bucket of temperature controlled water.
I wrote a simple macro that aggregated you data into hours. Then made a slightly better looking graph.
Cheers,
I've used it to plot weather data. Bubbles per minute should be easy. Sometimes I reformat the raw data by running it through perl, then into ploticus.
One thing I would suggest is to let the OS (Windows in your case) do the file concatenation for you - then, once the data is globbed together, do your data transform on it to get it ready for "Excel".
So if you had LOG06.txt, LOG07.txt and LOG08.txt you could do something like (in a DOS prompt):
type LOG06.txt > out.txt
type LOG07.txt >> out.txt
type LOG08.txt >> out.txt
This will put LOG06.txt into a new file named out.txt (the single > means create a new file with the output of type). Then additional files can be appended to out.txt by using the >> (which appends rather than creates a new file). By getting a little creative you could glob your daily output into an out.txt and then glob your daily out.txt files together, etc., to create a "master" log file with all of the data in it. This would be a good place to use a DOS .bat / .cmd file. Its been a while since I played around with Windows but I could probably help you with that as well.
By allowing the OS to take care of the file concatenation step your python (or VB) program becomes simpler - no need to rewrite what the OS already provides. Yeah the batch file below is a bit overkill but I tried to make it fairly general purpose (and had some fun doing so)!
An example usage for Nate would be (assuming the batch file lived in C:GlobalBubbleLogs):
C:GlobalBubbleLogs>doit.bat C:GlobalBubbleLogsUpTo-11-11-08
@echo off
REM make sure that we got a command line parameter
if (%1) == () goto USAGE
REM navigate to user supplied directory and process files
pushd %1 > nul 2>&1
if errorlevel 1 goto BAD_DIR
del /F /Q out.log > nul 2>&1
del /F /Q out.txt > nul 2>&1
for /f %%a IN ("*.txt") do (type %%a >> out.log) > nul 2>&1
ren out.log out.txt > nul 2>&1
popd
echo SUCCESS! out.txt created in %1
goto DONE
REM echo missing paramater/usage error
:USAGE
echo usage: doit.bat [directory to process]
goto DONE
REM echo bad user supplied directory error
:BAD_DIR
echo %1 is not a valid directory
goto DONE
:DONE
@echo on
d[sugar]/dt = A*[sugar][yeast]
d[yeast]/dt = B*[sugar][yeast]+C*[yeast]
which fits your data quite well for A=-3.16E-4, B=8.05E-3, and C=-1.55E-4, with [sugar] and [yeast] both 1 initially. Oh, and one has to scale to go from [yeast] to the rate of gas production. :)
You really might want to look into R and/or Gnuplot.
And thanks for the memories. When I was a teenager I brewed cheap wine at home. Welch's grape juice, sugar, and plain old bread yeast. Put a balloon over the mouth of the gallon jug, rather than a water bubble airlock. No sterilization, no hydrometer, and no ARM processor (circa 1970). It actually wasn't bad, if you like Mogen David. The only real disaster was once when the balloon burst in the middle of the night. What a mess all over the kitchen!
The data is fairly "choppy". Some minutes there are no bubbles, other times there are a lot of bubbles. There's a high deviation of bubble distribution when your sample period is a minute. Logging bubbles per hour cleans that up significantly as the by-hour chart shows.
Bubbles per time unit is an ok way of measuring progress but really, the better way is to measure the amount of CO2 generated. You can do this by measuring the volume of a bubble (or maybe a couple thousand...) and doing the math. But see my comment on "continuous bubbles".
A dark, sterile fluid in the airlock would increase the bubble contrast and allow you to decrease the sensitivity of the phototransistor, thus maybe reducing/removing the interference of ambient light.
In brewing beer, when the yeast really gets going, I will see multiple bubbles that merge into one continuous "bubble". So timing the length of the pulse from the photo interruptor might be useful to determine total volume of gas.
Also, gnuplot is really easy to use and makes some nice looking plots.
http://www.circuitpeople.com/Blog/Attachments/Wine.png
Looks like the nights (cool temperatures?) are hard on those little bacteria.
:)
You can almost hear the yeast cells going "YEA!!...awwww..."
Also if perchance your fermenting outside or with windows open where bugs can enter - I find they get attracted to the CO2 or smell or something and end up dead inside the water in the airlock which defeats the purpose of a hygenic seal.. So try putting a wad of cotten ball over or in the outlet - J.I.C.