Here we are homebrewing and using an arduino with an cheap optocoupler sensor to detect bubbles in a bubbler type airlock.
Why are we doing this?
Well .. firstly it's fun. Secondly, if you are a homebrewer, this will give you a handle on CO2 emission levels of your brew thorough fermentation time.
Important safety warning - Please do not stop fermenting when bubbles stop. Stuff tends to happen when Co2 ceases ie bubbles slow down or stop. Use a hydrometer to check fermentation has finished. (especially if you are bottling your booze in glass bottles!)
What am I brewing?
In case your interested .. here I'm brewing a Russet apple cider with russet apples harvested from our allotment.
• 1.2 Kg Russet apples (quatered and macerated for a couple hours with 100g sugar then pressed)
• 500g table sugar
• 1 campden tablet
• tap water to make 5 Litres or 1 UK gallon
• 2g champagne yeast
This will make a beverage of approx 5% ABV (my original gravity was 1051)
Step 1: Parts List, What You Will Need
An arduino. There are many flavours available and each one will do this job. I used an arduino uno:
Arduino Uno* with appropriate usb cable
An opto coupler device with a detection gap of 10mm
Dupont cables for easy wireup
Bubbler airlock for homebrew
plus of course your fermatation vessel and sugary stuff you are fermenting
nb other suppliers* are available
Step 2: Wiring
This will need three dupont wires
Vcc and Gnd, also the data cable to pin 2 digital pin of the arduino
If you connect your pc with the usb cable to upload the following sketch, this will also power the arduino
Step 3: Uploading the Sketch
Using the arduino IDE on your pc upload this sketch:
Plug in your arduino to your pc and ensure that the arduino port is selected as shown. nb your com port number may be different to mine.
Next upload the sketch to your arduino by clicking the second icon on the left below the menu bar.
To see the output, you'll need to open the serail monitor in the arduino ide from the Tools menu
Step 4: Positioning the Sensor
I used a couple of elastic bands to position and secure the opto coupler to the bubbler. I found that it was a little tricky to align the sensor at first, especially if fermantation has just kicked off and it is slow. Once it is aligned, and bubbles are being reported on the
Tips for sensor alignment
Try to align the sensor so that it its path is just past the bottom neck of the bubbler tube (see red line in pic above) . This will help to prevent false readings.
The sensor , helpfully has a red led on board which flashes when a bubble is detected in its path. I found it's better if the LED is on when there is no bubble and off when a bubble is detected (it works conversely, however its harder to align)
Alignment is much quicker/ easier If you align the sensor when fermentation has got going (bubbles 2 secs or less apart) try it and see!
A bit of sugru on the bubbler can be used to fix the bottom position of the sensor for easy subsequent alignment. Only the top elastic band will be needed then
Step 5: The Arduino Sketch
What's going on here?
I'm using an interrupt routine to detect level changes on pin 3 of the arduino.
Another option would be to poll pin 3 for state changes. The disadvantage of doing this is that it would require arduino's full attention, not letting you do other things.
If you'd like to learn about using interupts on the arduino a good tutorial can be found here
Step 6: Summary, Results and Development
Terminal output once fermentation starts as picture above
• output example during fermentation
• IOT using esp8266
• fermentation tuning using bubblecatcher and fermentation temperature.
Live IOT brew now on
Grodziskie fermentation IOT
New instructable coming soon