Frankenflair 58
The espresso machine modifying scene is very active. The projects range from simple PID mods to full machine rebuilds like the awesome Gaggiuino project. Yet, for whatever reason, Flair lever machines have received very little hacker love from the community. So I took it upon myself to turn something extremely simple into something outrageously complex. This is..
The Frankenflair 58.
Introduction
I got my first Flair Espresso maker — the original “Classic” — from the Kickstarter campaign nearly 10 years ago. I admired its simplicity and the fact that it could brew seriously tasty espresso, but the preheat routine always drove me nuts. When the Flair 58 was announced, I was excited about finally skipping that annoying preheat ritual. Despite this, I opted for the non-electric 58x because, as much as I disliked preheating, I disliked the awkward electronics design even more.
The Frankenflair 58 project is based on single premise: “Just because you can”. It is all about building the Flair 58, no one knew they needed.
In the spirit of open source, all source code, PCB design files, and related materials are available for anyone to use under the MIT license. Go wild!
Disclaimer: Understanding and utilizing safe electrical practices are critical to your safety and MANDATORY for safely completing this project. If you attempt this build, please exercise caution. I take absolutely no responsibility for any damage or injuries — especially when working with mains-powered USB-C PD chargers.
Design requirements
There were few things I actually wanted to address in the Flair 58 design:
- Temperature stability
- The unnecessarily large power brick
- The dangling preheat controller
- Ability to get useful brew data, without external additions (debatable if my mods classify as external additions)
- Not needing a smartphone to see brew graphs
Temperature stability
Temperature stability in the Flair 58 — electric or non-electric — has always been adequate. Could it be better? Probably. Would it need to be better? Guess I’ll find out. To understand Flair’s approach, I bought a preheater-equipped cylinder. It is identical to the 58x cylinder I already had, but has a heating pad inside, with a 4-pole, A-coded M12 connector (PG9).
Measuring the pins, I got ~7 Ω and 100 kΩ resistances at room temperature. The 7 Ω resistance corresponds to what you would assume for a resistive heater (24V² / 7Ω ≈ 82W). The 100 kΩ reading at room temperature is a 100k NTC thermistor.
The original Flair preheat controller possibly uses a comparator and a relay to maintain a fixed temperature. I don’t have the original preheat controller so cannot confirm this. Placing the NTC inside the heater pad doesn’t accurately reflect the cylinder’s internal temperature — which is what I actually care about.
The fix, PID. Of course it needs to have a PID. All of the other cool hacked coffee machines have a PID. But I’ll need to fit a thermocouple inside the cylinder somehow for accurate PID feedback.
It has been mentioned in multiple reviews and forum posts that for whatever reason the heat is concentrated to the top of the cylinder. Thermal images I took confirm the findings made by other people.
The heat is very concentrated on the top part of the cylinder. There are multiple reasons for this, such as the thin walls and considerable thermal mass at the bottom of the cylinder. There are various people who have done measurements using the scace device, including Lance Hedrick and Mark Prince of Coffeegeek.
Data from these and other testing is suggesting a roughly 2°C temperature gradient between the outside wall and the bottom of the cylinder. A simplified thermal network model to represent this is
$$ [ T_{\text{top}} - T_{\text{bottom}} = Q \cdot R_{\text{total}} ] $$
However, because the actual conditions at the portafilter (such as preheating of the portafilter and puck screen) are difficult to estimate reliably and can vary, I chose not to add extra compensation. I came into conclusion that, relying on a fast-acting PID loop that bases its control on the water temperature measured inside the cylinder, ensures sufficient thermal stability and accuracy despite a thermal gradient.
The PID is also able to take into account the varying heating needs as the water volume inside the cylinder changes during the brew process.
The less water there is the less heating is required to maintain the same temperature. Which is also why the original preheating controller results in a rising brew temperature during the shot, even if a steadily declining profile would be more advantageous. The PID should also take care of any overshoot in the temperature when doing back to back shots with the portafilter and the cylinder getting warmer and pushing the temperature over the setpoint.
Power brick
Easy fix. The original Flair 58 uses a bulky 24V/5A brick. However, USB-C PD chargers now commonly provide up to 20V at 5A, sufficient for our needs. Compact USB-C GaN chargers make this approach even more attractive. (Note: The recently revised Flair 58 Plus 2 features now a smaller power brick)
The dangling pre-heat controller
There are plenty of hidden cavities within the Flair 58 frame. The goal is to fit all custom electronics inside these cavities, keeping the external appearance as stock as possible. (Note: The recently revised Flair 58 Plus 2 features now a built-in controller)
Brew data display
Existing solutions like Bluetooth pressure sensors and smart scales require pulling out your phone — an unnecessary hassle. I want real-time graphs for pressure and temperature displayed right on the machine. A touchscreen will be mandatory, as it would allow also temperature adjustments and data visualization without disrupting the original look with buttons.
The build
The Frankenflair 58 design is modular and hackable. It should provide a reasonable platform for others to improve. The PCBs are based around Seeedstudio XIAO boards (ESP32S3 in my case), providing ample performance and built-in Wi-Fi and Bluetooth. You have large variety of different boards to choose from, RP2040, ESP32s, nRF52 etc.
High-level design
Given the limited I/O on XIAO boards, careful component selection and bus sharing (I2C, SPI) was essential:
- Display: 240x240 round capacitive TFT (GC9A01, SPI), touch controller (CTS816, I2C).
- Thermocouple ADC: MAX31856 on the same SPI bus.
- Pressure sensor: Sensata PTE7300 on I2C bus. (Fairly expensive industrial sensor, that I already had at hand)
- Analog multiplexer: switching between multiple thermocouples (inside and outside cylinder).
PCB design
There is very little room inside the frame cavities, but the design has a quite few components. I decided to split the main functionalities into two different PCBs rather than trying to fit everything into a single one. This also allowed me to use a bit larger, and still somewhat hand solderable SMD components.
I used two cavities to hide the PCBs:
- The half moon shaped, directly underneath the Flair 58 badge (MCU board).
- Right-hand side cavity at the back of the frame (Power board).
MCU Board: Microcontroller (XIAO), thermocouple multiplexer, MAX31856, connectors for display, sensors, and power.
Power Board: USB-PD controller, MOSFET solid-state relay, 3.3V/5V regulators, connectors, and an analog comparator tracking the heater NTC temperature and shutting the power from the heater in case the temperature reaches over 120C. This is to have a fall-back safety mechanism in case something goes awry with the microcontroller. Yes I don’t trust my code enough to NOT have a fail-safe.
People with an eye for detail might spot a slight error — the power board ended up on the wrong side because, by accident, I designed it upside down. It works fine; the wiring just runs across and over the MCU board. And I’m too lazy to fix it. If it bothers your OCD mind, the KiCad PCB design files can be found from the resources.
Note: I made some last minute changes to the power board and made another revision for it after taking the photos for the post. This change is for the 5V power output. My original two-stage LDO design wasn’t as efficient as I hoped so I replaced it with a monolithic voltage regulator IC.
Firmware
Is based on a GC9A01 micropython implementation, the firmware uses both of the cores available on the MCU. This is to ensure responsive display updates (5ms intervals) and control loop that runs at different speed (100ms intervals). The PID runs every second to add small hysteresis to the system. The PID tuning was done using Ziegler-Nichols method to find the optimal values based on the oscillations.
The high-level firmware structure:
frankenflairDevices.py
: Manages sensors and PID control loop.frankenflairDisplay.py
: Low-level GUI management. It was an on-purpose decision to not build this on top of extensive and complex frameworks such as LVGL as the GUI needs for something like this are quite simple to achieve with much less code.frankenflairPage.py
: GUI page definitions.frankenflairTouch.py
: CST816 touch controller integration (borrowed from here).frankenflairUI.py
: Page management and UI logic.max31856.py
: Slightly modified MAX31856 interface library (borrowed from here).main.py
: The main loop that sets up everything and starts the processes on the different cores etc.resources
: Converted bitmap fonts 16x16font.py, 32x32font.py and 64x64font.py. The boot splash screen.
Putting it all together
This build probably shouldn’t be attempted by everyone. The ones who can and should try it, know how to get from zero to having all the parts and blank PCBs. So this section has been left out on purpose.
Assemble the PCBs
Either solder yourself or get some of the PCB fabs to do the SMT assembly for you.
Mount the PCBs
Mounting the PCBs to the frame requires a bit of work and cutting of the frame from multiple places.
Start by punching out the Flair 58 logo. This is easiest to do by placing a punch through the small hole on the underside of the frame and giving it a fair smack.
Once the logo is gone, use Dremel to cut a small cavity in the middle of the circle to feed the display FFC cable through to the mcuboard. The bottom half of the hole doesn’t need to go fully through but some space is required to fit the display control ICs mounted on the FFC cable.
Cut similar holes for the USB-C cable and the wiring harness going to the power board.
For the mounting, drill holes in the frame for the standoffs. To ensure neat installation I tapped M2 threads in the holes. The two mounting holes for the powerboard along the USB-C connector edge sit flush with the frame using M2x20 standoffs. And the two standoffs near the rubber leg (if used), should be M2x15mm. I didn’t end up using the other two to make wiring easier to route.
If you know you will be running the heater for long time, making multiple back to back shots. It is suggested to grind the anodization off the frame and add thermal conductive pad between the CPC1709 solid state relay and the frame. This way if the relay starts to get hot, the heat is transferred out via the frame.
Drill holes for the MCU board and in similar manner tap M2 threads on the holes. I used 2mm standoffs just to have a bit of room for the FFC cable to wrap around and into the connector. If using Wi-Fi or BT the antenna should be mounted on the outside of the cavity. I had some issues with low signal levels with the antenna being underneath the PCB.
The wiring should be ran underneath the PCBs as that will prevent the wires from sagging.
Wiring harness
Place the external thermocouple under the silicone heater, securing it with high-temp kapton tape. This sensor should be mounted as close to the bottom of the cylinder as possible, to ensure accuracy and to take into consideration the heat losses from the exposed mounting ring.
Insert another thermocouple through the valve plunger cavity, protruding slightly inside the cylinder. The easiest way to pull the thermocouple throught the valve plunger is to use adhesive lined heat shrink and a thin, single core wire. Push the wire through the valve plunger and fasten the thermocouple to the pull-through wire using the heat shrink. Then use the wire to pull the thermocouple through. Once through leave the end sticking out just couple of millimeters so it doesn’t touch the puck screen.
Use a G1/8 T-junction and epoxy-filled G 1/8 cap to seal the hole for the thermocouple wire.
Attach a pressure sensor, bundle the 4 wires neatly with the thermocouple wires.
Add cylinder heater and NTC wires in the loom, run them through the hole made to the frame next to the USB-C port.
Split the wiring harness at the powerboard. The larger diameter wires from the M12 heater connectors connect to the two, two wire Metz wire terminals (denoted Heater and NTC) (the purple line).
The pressure sensor (SDA,SCL) and thermocouple wires continue their way along with 3 other wires leaving the powerboard (5V, GND and PID control). Take these three wires, the I2C data wires, and make a neat loom from them with the two thermocouple wires. The power and ground for the pressure sensor should be taken directly from the 5V and GND terminals on the power board.
Drill small holes to the support braces on the frame and feed the wiring harness through those holes until you reach the mcuboard.
Once at the MCU board crimp Molex connectors to the end of the wires and connect the finalized connector to the MCU board. The Molex crimp terminals are tiny and you can’t get them properly fitted inside the connector housing unless you have a proper crimping pliers. Either get the official Molex ones or one of the many cheaper alternatives such as Engineer PA-09.
Flashing the firmware
Download the base firmware or build it yourself. Once you have the base firmware press “B” button and connect the XIAO board to the computer. Use Thonny, esptool or tool of your choice to flash it.
Once done, copy all of the .py files and the boot-splash.jpg onto the device memory. Reboot the board and check that everything is working without any errors and you get legitimite looking readings on the display. It is highly suggested to use a portable USB powerbank first before connecting this to a 100W USB-C PD charger using the mains.
The cost
Item | Price | Description |
---|---|---|
PCBs | 5€ | for 5 pieces each |
Passives | 10€ | For both boards |
MAX31856 | 10€ | |
ESP32S3 | 8€ | |
CPC1709 | 8€ | Solid state relay |
Thermocouples | 12€ | 2x K-type |
Touchscreen | 18€ | MDT0128AISC-SPI or similar |
Wiring, connectors etc | 15€ | M12, Molex, standoffs |
Total cost (without the pressure sensor): 86€
With some careful component choices and the use of Aliexpress this can be probably halved
I’m on purpose not listing the pressure sensor in the costs as the prices vary from 8€ (aliexpress) to 120€ (industrial ones from Farnell). The one I used is an industrial one that retails for 85€, I happened to have one at hand. Also, if you already have Smart Espresso profiler, it should be straight forward to integrate it here. Just modify the firmware to connect to it.
GUI
GUI is simple. There are 4 pages that can be changed by swiping left and right on the screen.
The pages are, splash screen, setpoint adjustment screen, pressure/temperature graph display and the data overload page.
The graphing page auto-scales the collected measurement results to the allowed space and starts to scroll the screen losing the oldest measurements when 240 seconds worth of measurement data has been collected.
The data page shows the most recent readings from all the sensors and the state of the PID, if the heating is active or not.
Conclusion
If all went well, you now have a fully functional Frankenflair 58!
If not, have fun debugging. :)
So what is frankenflair 58? It is my attempt to build a Flair 58 no one knew they needed. If I would have to write a spec sheet, here are the highlights.
Frankenflair 58 - PID Controlled manual espresso machine
- Digital setpoint temperature control with PID, using two thermocouples
- Pressure and temperature graphing
- 240x240 capacitive touchscreen
- Wi-Fi
- Bluetooth for BLE enabled scale connectivity
- On-device brew data storage
- USB-C PD power
Resources
In the spirit of open source I’m sharing all of the PCB designs and firmware source code. Go wild!
- Firmware and source code download
- PCB design files download
- Gerbers for the lazy people who just want to order the PCBs download
- Bill of materials and CPL files for SMT assembly download
- Datasheets download
All the material is licensed under the MIT license
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.