Beer Cooler or: a Raspberry Pi Zero W walks into a bar…

You know how it is. You move into a house that used to be a pub, and you can’t bring yourself to do away with the bar. In fact, after several years of planning, you find yourself buying a hand pump on eBay, and a polypin of craft ale from the local microbrewery. Suddenly, you’re the landlord. The barkeep. Everyone’s best friend.

A GIF from the movie Shaun of the Dead - Raspberry Pi Beer Cooler

And yet …

There’s something not quite right about this setup. Something not quite perfect. You’re pulling pints and drinking your craft ale one day when you realise — the beer isn’t cold enough!

You need a beer cooler.

Cool customer

Electrical engineer Alan Platt found himself in this enviable position, and he decided to design his own draft ale fridge.

‘The original pub cellar had been filled in, so I couldn’t keep my beer underground and pipe it up to the handpump — it had to sit under the bar. I needed to build my own beer cooler, because there is only so much space under the bar, and a commercial fridge wouldn’t fit.”

Alan set about constructing a box for the beer using sheets of insulation board and elastic bands. He then installed two Peltier cooling pumps in the lid of the box, and routed a pipe up to the handpump for the beer. One trip to the microbrewery later, and the craft ale was chilling nicely.

The outside of Alan's beer cooler showing the cooling apparatus and insulation boards

Alan’s beer cooler

But there was a problem.

‘The Peltiers ran happily for an hour or two, but after that, they proved to be too effective. A layer of ice built up on the heat sink connected to the cold side of the Peltiers, jamming the fans, and allowing the beer to grow warm. They also made a horrible rattling sound, and disturbed everyone in the house.”

It seemed that the perfect pint was still out of reach.

Complex circuitry

Not to be defeated, Alan realised he would need a way to control the power to the Peltier units. Switching the power using a simple thermostat would cause damaging thermal shock in the Peltiers, so Alan turned to Raspberry Pi Zero W as his solution.

A photo of the inside of Alan’s beer cooler complete with Raspberry Pi and a heap of wiring (as described in the paragraph below)

Testing the completed control circuit

In order to fine-tune the cooling process, Alan decided to control the current running through the Peltier units. He used a hardware PWM output on a Raspberry Pi Zero W alongside a power MOSFET, an inductor, a capacitor, and a current measurement circuit to create a switched-mode variable current power supply. By measuring the temperature on the cold side of the Peltier units, and using a PID control loop to adjust the PWM output, Alan was able to maintain the cold side at just above freezing. He used a second PID control loop to keep the beer inside the fridge at a perfect cellar temperature of 8°C.

Aware that this cooling system was both overcomplicated and built from very high-power components, Alan designed multiple failsafes using hardware and software to ensure that the control unit would not spontaneously combust while attempting to cool the beer.

The perfect pint was within reach.

Consultation

And then Alan tried to explain the failure modes to his wife, in case he wasn’t in the house when the electronics overheated, or the failsafes kicked in.

“I wanted her to know what to do if the cooler failed”, Alan explains. “But this required her to check the beer fridge regularly. It’s on the floor, under the bar, and she didn’t seem keen.”

The project was about to get significantly more complicated.

What about an audible alarm?

It was an innocent suggestion, but the idea grew from a simple beeping alarm to a series of spoken alerts. What could be used to produce these alerts?

“I found myself programming a second Raspberry Pi Zero with a DAC HAT, audio amp, and speaker, just to communicate the status of the beer cooler. Originally, the spoken alert was to indicate a fault in the control circuits, but it seemed a waste to stop at a single message.”

A breadboard covered in wires - Raspberry Pi Beer Cooler

Prototype for the audio amplifier

After days of planning, programming, and searching for MP3 files online, the fridge can now inform Alan (and his wife) when it is switched on, when the Peltiers power up, when it reaches maximum power, when it is switched off, and when there is a fault.

The alert messages are all quotes from sci-fi shows and films: Han Solo claiming he has a bad feeling about this; Scotty telling Captain Kirk that the Enterprise is giving it all she’s got; and Kaylee telling Captain Reynolds that everything is shiny.

And the fault alert?

“If there’s a problem with the beer cooler, the Raspberry Pi declares ‘Danger, Will Robinson, danger.’ on a loop, until someone checks it and resets the controls. It’s annoying and effective!”

The perfect pint

The Raspberry Pi also acts as a web server, using the REMI library to display and change the temperatures, currents, and control parameters, so the beer temperature can be monitored and regulated from anywhere on the home WiFi network.

The final build next to a laptop displaying the beer cooler web interface for maintenance on the go

Control box and web interface

Alan’s beer cooler has been successfully tested, and several polypins of local craft ale have been drunk and enjoyed — and it’s only taken two Raspberry Pis; some high-current circuitry; two Peltier units; a pile of household insulation board; and Han Solo, Scotty, Kaylee, and the robot from Lost In Space to achieve the perfect pint.

Over-engineering

Use the comments to tell us about your own over-engineered projects and any excuses you’ve found for including an extra Raspberry Pi in your build!

And thank you to Rachel, aka ‘the wife’, for this wonderful blog post!