If you are a fan of sour, kombucha might be the drink for you. Unfortunately, it comes with the health food price tag of $3/bottle. Brewing it is much cheaper and way more fun. For a healthy culture and delicious tasting 'buch you'll need to maintain a pretty high temperature (~77F/25C) while brewing (5-7 days). Keeping the brew that warm is challenging in colder climates. With a little help from a terrarium heater and some electronics, I created a thermostat for brewing year round. Check it out below!
B. Parts Required
1. For Kombucha Brewing:
- Glass/Ceramic container: I highly recommend a container with a spigot.
- SCOBY and starter liquid: I bought my SCOBY from a local vendor but I've used this one too.
- Green or black tea
- Sugar: When first starting out it's best to use regular white cane sugar
2. For Kombucha Thermostat:
- Terrarium heater: I have this one but any low output heater will do.
- PowerSwitch Tail 2
- Adafruit Feather: I used the Adalogger in case I decide to store temperature data.
- High Accuracy Temperature Sensor Breakout Board (MCP9808): AKA thermometer
- Micro USB to USB cord and AC wall adapter: An old phone/kindle charger works fine.
- Jumper Extension wires
- Wire Spool (optional): Depending on your Kombucha setup you may need extra long connectors. I used wire spool between my Feather and my PowerSwitch Tail.
- Misc: Small Phillips head screwdriver, electrical tape, infrared thermometer.
C. Hardware Setup
1. Board Assembly
Board assembly is new for me so I had some help with this step. For the Feather, we went with socket female headers. For the Temperature Sensor MCP9808 (Thermometer), plain male headers were used. Check out the assembly guides for more details: Feather assembly guide and MCP9808 thermometer assembly guide.
2. Load CircuitPython Firmware and Drivers:
If you're starting from scratch you will need to load the CircuitPython frimware onto your board. Start by plugging your feather into your computer with the micro USB cord. Next, use this guide to install CircuitPython onto your Feather. If you're a beginner I STRONGLY suggest doing this on Mac OS in the terminal. Keep in mind CircuitPython is in development right now, if something doesn't make sense don't give up! Post on the Adafruit message boards and they will help you.
Once you have the firmware flashed onto your board your computer should recognize it as a USB mass storage device called CIRCUITPY. Next, load the drivers for your thermometer. To do this got to the Adafruit CircuitPython repository and download the lastest CircuitPython bundle. The file should look like this <adafruit-circuitpython-bundle-#.#.#.zip> where "#.#.#" will be the latest release number. Once downloaded, open the .zip file and drag and drop the adafruit_bus_device folder and the adafruit_mcp9808.mpy file onto your board (see picture below).
3. Connecting the Thermometer to the Feather
Now that you have the firmware and drivers installed, disconnect your Feather from your computer and grab your thermometer and jumper extension wires. Use the wires to connect the Feather to the thermometer following the diagram below. The VDD and GND pins will power your thermometer through the Feather. The SCL pin is the I2C clock pin and the SDA pin is the I2C data pin. Pinout diagrams for the Feather and the thermometer may be helpful at this point. If you're following my board assembly the male end of the jumper extension wires will go to the feather and the female ends will go to the thermometer.
4. Connecting the PowerSwitch Tail 2 to the Feather
For this step, it is important to know where your PowerSwitch Tail will plug-in in relation to your kombucha brew vessel and thermometer. For reference, my kombucha is in a cabinet about a meter away from an outlet. I used wire spool to connect my Feather to my PowerSwitch tail so it was the right length. Note: If you're using wire spool, you will have to strip the ends.
Now that you have the correct length of wire, connect pin A5 on the Feather to the PowerSwitch tail at 1: +in, tighten the screw on the top until the wire is secure. Connect the lower left ground pin (GND) to the PowerSwitch tail at 2: - in. Again tighten the screw until the wire is secure. There are a number of pins that you can use to connect your Feather to your PowerSwitch Tail, I chose A5 because it was on the same side of the board as the ground pin. If you choose to use a different pin make sure you edit this in the code (see below).
At this point your electronics should be connected (PowerSwitch Tail, Feather and Thermometer) and your feather should have CircuitPython firmware and thermometer drivers installed.
1. Getting Started
Plug your Feather into your computer with a Micro USB cable. The Feather will show up on your computer as a USB mass storage device called "CIRCUITPY". Open a new text file in the editor of your choice (I use Atom) and save it to the CIRCUITPY drive as "code.txt". To see the output of your Feather while coding you will need to connect a serial read–eval–print loop (REPL). If you are not sure how to open the serial REPL follow this guide. Once you have your code.txt file saved to your Feather (CIRCUITPY drive) and the serial REPL open you are ready to code!
2. Connect the thermometer:
In your code.txt file use the code below to import the thermometer and supporting libraries. This will also import the I2C protocol from nativeio and rename the thermometer output (here we used t). Save the code to your Feather and check to see that the temperature is printed in your serial REPL.
# Load the libraries we need. import adafruit_mcp9808 from board import * import nativeio import time # Do one reading and print it out. with nativeio.I2C(SCL, SDA) as i2c: t = adafruit_mcp9808.MCP9808(i2c) print("temperature in celsius:", t.temperature)
3. Connect to the LED and the PowerSwitch Tail
For this section you do not need to have the PowerSwitch Tail plugged into the wall, the microcontroller will power its LED. This code labels your indicator LED at pin D13 and switches it to output. Next, it connects the PowerSwitch Tail to the Feather through pin A5. If you used a different pin to connect to the PowerSwitch Tail, you will need to change the code here (edit A5).
led = nativeio.DigitalInOut(D13) led.switch_to_output() power = nativeio.DigitalInOut(A5) power.switch_to_output()
4. Write the code for the thermostat
I wanted to use as little power as possible to make my heater smart so I am using a pretty simple thermostat. First, the while loop creates an infinite loop for the microcontroller. Inside the loop, the temperature sampling is delayed to every 5 minutes with a sleep function. Since I am dealing with a large vat of tea, the temperature shouldn't fluctuate very much. To test your sensor you may want to change the "time.sleep()" function to something shorter or comment it out. As is, the print statement will output the temperature to the serial REPL every 5 minutes. The print statement is helpful during setup but can be commented out when you save the code to your board. The thermostat is a simple if/elif statement which turns the power on if the temperature falls below 24.5C and turns the power off if the temperature is over 26.5C. This works for me but if you are looking for something more exact you can may consider a PID function:
while True: #setting 5 minutes delay for temp sampling time.sleep(300) print (t.temperature) if t.temperature < 24.5: power.value = True led.value = True elif t.temperature > 26.5: power.value = False led.value = False
Here it is the code all together, it's easier to see the indentation this way:
# Load the libraries we need. import adafruit_mcp9808 from board import * import nativeio import time # Do one reading and print it out. with nativeio.I2C(SCL, SDA) as i2c: t = adafruit_mcp9808.MCP9808(i2c) print("temperature in celsius:", t.temperature) led = nativeio.DigitalInOut(D13) led.switch_to_output() power = nativeio.DigitalInOut(A5) power.switch_to_output() while True: #setting 5 minutes delay for temp sampling time.sleep(300) print (t.temperature) if t.temperature < 24.5: power.value = True led.value = True elif t.temperature > 26.5: power.value = False led.value = False
E. Connecting the Pieces
1. Testing the thermostat
Start by plugging your Feather into the wall socket with the micro USB AC adapter. If you have an infrared thermometer this would be a good time to use it. Measure the temperature of your thermometer and make sure it is behaving like you expect. If you don't have a infrared thermometer try this:
Check for the OFF position - To increase the temperature hold the thermometer in your closed hand, it should exceed 27C (~80F) quickly and the power should turn off. When the power is off the red indicator light on the PowerSwitch Tail AND the LED light on the Feather should be OFF.
Check for the ON position - Place the thermometer, temperature sensor side down, on a cold surface (a hard counter or window should work, if not, try the fridge). Once the temp is below 24.5 C (~75F) the power should turn ON. When the power is ON both the indicator light on the PowerSwitch Tail AND the LED on the Feather should be ON.
2. Connect the heater and assemble the pieces.
If you're confident that your thermometer and thermostat code are functioning you can start connecting the pieces. The schematic below is an overview of my setup. Start by securing your thermometer to your kombucha brew vessel with electrical tape. Make sure the temperature sensor is touching the brew vessel. Next attach your heater to the kombucha vessel. Plug the PowerSwitch tail into the wall outlet and plug the heater into the PowersSwitch Tail. Next plug your Feather into a wall outlet with the micro USB AC adapter. Observe your thermostat over the next few days to ensure that everything is functioning normally. Last but not least, brew for 5-7 days, and ENJOY YOUR 'BUCH!
F. Troubleshooting and Further Reading
Having trouble? I did too! Here are some great resources to get your thermostat up and running:
1. Similar Maker Projects:
- On-Air Streaming Sign with PowerSwitch Tail: This is a really good starting point for learning a bit about the capabilities of the PowerSwitch Tail.
- Sous Vide: Looking for a more robust thermostat? This guide uses a PID algorithm to keep the water bath at a very precise temperature.
2. Help with CircuitPython (MicroPython):
- MicroPython Basics: What is MicroPython?
- MicroPython Basics: Blink a LED
- MicroPython Basics: Load Files & Run Code
- CircuitPython documentation