Tutorial: Easy brewing control build

This tutorial will show you build the how to build the worlds easiest to build brewing control. It’s very cheap to build, too. But it still offers all the features you need: Support for mashing and fermentation, recipes, auto calibration, etc. It can control up to 20A of electricity. We’ll be using an of the shelf WiFi switch: the Sonoff TH Origin rocking an ESP32.

Don’t be overwhelmed by the following amount of text. I tried to make the tutorial precise enough so that even beginners can follow easily. We’ll cover the following topics:

  1. Needed materials and tools (hint: not a lot)
  2. The actual build (connecting two wires)
  3. Flashing the FREE software
  4. Setting up your first mashtun

And if you prefer a YouTube video instead of a writting version, we also have you covered:

YouTube version of this tutorial.

If you want to read about the features: There is a feature list available at the bottom.

Materials and tools

Tools and materials you’ll need.

Required materials:

Required tools

  • Pliers (i.e. a Leatherman)
  • File (i.e. a Leatherman)
  • Sidecutter, or something to cut the extension cord
  • Something to strip the insulation of cable endings, i.e. the Knippex Multistrip
  • USB to serial converter (set it to 3.3V)
  • Soldering iron i.e. the awesome TS100.
  • Mini USB cable
  • Longitudinal screw driver
  • Philipps screw driver
  • Third hand to hold the pinheader in place while soldering, optional
  • Wire end ferrul pliers (optimally with 4 jaws), optional

The build

Preparing the Sonoff TH Origin

Open the lower cover on the housing with the longitudinal screw driver. Start at the sides. Then, use a table spoon to lever the cover away.

Flip the Sonoff TH Origin and remove the fours screws at the back.

The four screws to be removed at the back.

Remove the four screws holding the PCB in place.

The four screws holding the PCB in place.

Carefully lift the PCB out of the housing because the WiFi antenna cable is still connected. Remove the WiFi antenna cable.

Locate the four DIP holes labelled GND, RX0, TX0, and 3V3 on the PCB. Solder the 4×1 pinheader onto it so that the PCB header sticks out on the same side the relay and RJ11 jack is on the PCB. Clamp the pinheader to the PCB, locate the clamp in the middle of the pinheader. Solder the two pins on the outside first, remove the clamp, and solder the inner two.

Connect the rainbow cable and take a picture for future reference.

Reconnect the WiFi cable. Use the file to make a notch for the rainbow cable on both sides of the housing. It should be about 1mm deep and just as wide as the rainbow cable. Be carefull to “mirror” the location so the notches “meet” when the housing is closed.

Put the PCB back into place (using the 4 screws), close the housing again (also using four screws). The rainbow cable should have just enough space.

Final result (closed housing).

Attach the cables

Now it’s time to connect the AC cable. First, cut a AC into half (or whereever you want 🙂).

Cutting the AC extension cord.

Strip the insulation of the outer cable and all inner cables. Crimp wire end ferruls onto all ends. Repeat that for both loose ends of the AC cable.

Strip the endings of the cables and apply wire end ferruls.

Now it’s time to connect he AC cables and the Rainbow cable. Refer the following diagram:

Wiring of the Brick / Sonoff TH Origin.

Connecting the AC cables to the Sonoff TH Origin is easy:

  • the blue cables go to N (whether it’s the socket or the plug does not matter).
  • The brown cable coming from the plug / wall must go to “L In”, the brown cable going to your brewing equipment must go to “L Out”
  • The mass cables are connected outside the Sonoff TH Origin using i.e. the Wago 221 or a chanedellier terminal

Snap the cover back into place. Next step is to connect the USB to serial converter. The rainbow cable should be connected as follows:

  • GND to GND
  • RX from the TH Origin to TX of the USB to serial converter
  • TX from the TH Origin to RX of the USB to serial converter
  • 3V3 from the TH Origin to VCC of the USB to serial converter. ⚠ Set the jumper of the USB to serial converter to 3V3. The converter is most likely set to 5V when it’s delivered. This will fry your TH Origin.
  • Mini USB to your PC (as you might have guessed 😉)

Flashing the free software

Go to the device manager by hitting the “Win” key and typing “Device manager”. Be sure to plugin your USB to serial converter. Unfold the “Ports (COM & LPT)” section, and look for an entry saying “USB Serial Port (COM…)”. Note the number, i.e. “…” is in my case “3” / COM3:

Finding the out the used COM port – in this case COM3.

Grab the latest release of the free software here: https://github.com/BernhardSchlegel/Brick-32/releases/latest. Download the topmost zip file by clicking on it (i.e. “brick32_release_v.0.8.0.zip”, the “0.8.0” will be higher version when you get there). After download, unzip it to a folder. We’ll call that the “release folder” in the following.

Next, we need to grab the “Flash Download Tools” from here: https://espressif.com/en/support/download/other-tools. Download the latest version by clicking the download icon on the right. After download finished, unzip it. We’ll call that folder the “Flashing Tool folder” in the folder.

Screenshot of the website where we download the Flashing tool.

Open the flash download tool executable (i.e. “flash_download_tool.exe”) from the flashing tool folder. When windows annoys you with an “we protected you” screen, hit “more info” and “run anyway”. Select “chipType” to be “ESP32” (workMode can stay on “develop”). Hit OK.

Now we have to select the binaries from the release folder we just downloaded and configure the flashing tool:

  1. Select the four binaries in the order shown. Select the respective addresses (starting with 0x) on the right.
  2. Check all four checkboxes to the left of the filenames.
  3. Make sure the beginning of the filename (i.e. 0x8000_) matches the address on the right (i.e. 0x8000) for each respective row.
  4. Select “SPI SPEED” of “40MHz” (should be the default),
  5. set “SPI MODE” to “DIO” (should be the default)
  6. check “DoNotChgBin”.
  7. At the bottom select the COM port (to figure out which one is your USB to serial converter, simply unplug and plug it back it), i.e. “COM3”,
  8. set “BAUD” to “460800”.

Final result should look like this:

Final settings of the flash download tool
Putting the Sonoff TH Origin / ESP32 into flash mode.

But don’t click “START” yet! Before we can do that, we have to put the Sonoff TH Origin into flashing mode. To do that:

  1. Unplug the USB cable on one side (PC and PCB side works)
  2. Hold down the button on the Sonoff TH Origin
  3. While still holding down the button: Insert the USB cable again
  4. Release the button

Now it’s finally time to hit “START” in lower left corner of the Flash Download tool. If the flashing fails: Check your cable connections (does RX go to TX and vice versa), repeat the four steps above and re-open the Flash download tool.

Setting up your first mashtun

As an example, we’ll setup a mashtun. However, the Brick32 can be also used to control freezers, glycol chillers, agitators and pumps. Head to your brewery and connect the plug of your mashtun heating to the socket of the Brick32. Connect the Brick 32 to the wall. Insert the temperature probe into your mashtun and connect it to the brick.

If the temperature probe does not fit your thermowell, you can safely remove the plastic cover at the end.


  1. Go to bricks.bierbot.com
  2. Open the menu on the left and head over to “Bricks”
  3. Hit “Add Brick” or hit the blue “Plus” button on the top right.
  4. Select the Brick you want to add, in our case it’s the Brick32 (Note, you can also add iSpindels, TILT and Raspberry Pi, but we’ll save that for a different day)
  5. Copy the API key into your clipboard.
  6. Open the W Fi settings of your device and look for a hotspot named “Brick-32-000….” (“…” being a random number). Connect to it.
  7. You’ll be redirected to a captive portal. Hit “Configure WiFi”
  8. Tap on your WiFi network, provide your WiFi network password and paste the API key from your clipboard. Hit “Save”.
  9. Go back to the website and wait for the Brick to appear. Activate or rename it.

Now you only have to map the relay of your Brick32 to the heating of your mashtun by drag and dropping. How to do that is very well explained in the official documentation available here: https://docs.bierbot.com/getting-started/setting-up-your-first-mashtun.


  • Button on the control to override the automatic mode and manually switch the relay OFF or ON.
  • 3 Status LEDs (booted up? State of the relay? WiFi connection established?)
  • Various kettle setups supported: BIAB, RIMS, HERMS.
  • Various fermentation setups: Freezers, keezers, glycol chillers.
  • PDI controller that works with a simple and cheap non PWM/SSR relay and yet eliminates temperature overshoots.
  • Mashing controller and fermentation controller, both with automatic timer control.
  • Multi-language (German, English, Portugese, Spanish, tell us if you want to help!)
  • Integrated recipe management: Set the temperature, the time, etc.
  • Integrated logging: See your temperature log during the mash and export a PDF after brewing
  • User authentication
  • Access from everywhere
  • Found a brewery and invite friends to share equipment, recipes, etc.
  • Works perfectly on any Smartphone, Tablet, PC or Mac (or any web browser)
  • Beer.XML import
  • Configurable units for temperature (Celsius/Fahrenheit), gravity (°Plato, specific gravity), volume (Liters, Gallons), weight (Grams, pounds) etc.
  • Control agitators, pumps, valves.
  • Free, open source license (GPL-3.0 license).



If your device connects to mains electricity (AC power) there is danger of electrocution if not installed properly. If you don’t know how to install it, please call an electrician (Beware: certain countries prohibit installation without a licensed electrician present). Remember: SAFETY FIRST. It is not worth the risk to yourself, your family and your home if you don’t know exactly what you are doing. Never tinker or try to flash a device using the serial programming interface while it is connected to MAINS ELECTRICITY (AC power).

We don’t take any responsibility nor liability for using this software nor for the installation or any tips, advice, videos, etc. given by any member of this site or any related site.

disclaimer source

1 thought on “Tutorial: Easy brewing control build”

  1. Pingback: Boel iTap X review - The joy of bottling | BierBot | Homebrewing automation

Leave a Comment

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.