Safety warning again – this post describes working with 240V AC mains power. This can kill you and / or cause fires. You copy my designs at your own risk. This module could damage any mains appliance plugged into it. It could destroy a computer plugged into the USB connection on the Arduino. No guarantee of suitability for any function is given or implied, for either the source code or any part of the design I’m describing.
This post is aimed at people with a fairly good understanding of electronics, and if you don’t have that, you shouldn’t try to build anything involving 240VAC mains voltage.
While I’ve been brewing and malting I’ve had to carefully control the temperatures of liquid using kettle elements (making the wort) and the temperature of air (drying malt). This is possible manually, but I built a module based on an Arduino, thermistors, relays, mains plugs and single extension sockets. I can plug any mains appliance into a plug socket on my module, plug the module into the mains, and select a temperature up to 100C. If the thermistor is placed into liquid or air heated by that appliance, the temperature is regulated automatically. I wrote a Processing project to control the temperature at different levels over time via USB, in particular, for making wort – this is a work in progress but I’ll post the source code for that too.
My module can control 2 appliances independently based on readings from 2 thermistors.
Since the module uses mains power, I packaged it in a sealed plastic project enclosure from Maplin. I could have used a metal enclosure, but I would have had to earth it on both the earth wires from the plug sockets. I ALWAYS TESTED THE CIRCUIT WITH THE ENCLOSURE LID SHUT for safety.
This is the circuit I designed:
RELAYS: I used relays similar to these 4PDT 10A power relays, which have coils meant for 12VDC. Since the loads I’m switching are high – current inductive ones (basically, out of all mains appliances, kettles and heaters draw the most current) I treated the 4PDT switch of the relay as if it was an SPDT switch, to spread the load across the whole relay. I soldered the neutral wire from the plug to all four poles at once, and the neutral wire from the socket to all four NO throws at once.
DC POWER: An AC/DC adaptor powers the relay coils, and through a 7805ACT 1A DC voltage regulator, powers the 5VDC portions of the circuit.
POTENTIOMETERS: Connected to A0 and A1. These can be used to set the target temperature. The target can be set via USB too with the Processing sketch I wrote, which also gives accurate temperature feedback from the thermistors.
This shows how I connected the mains portion of one of the halves of the module:
I borrowed the thermostat reading code from Arduino Playground. I found calibration values for my thermistors using the steps explained there, and hard-coded the values I got into my sketch. My code is full of misleading comments and is quite messy!
The Processing source code is certainly a work in progress. I hard – coded a basic beer recipe into it, which I use by plugging kettle elements into the sockets on the module. The temperature can be set and read directly via the Arduino serial monitor too.
MEASURING THE TEMPERATURE OF A LIQUID (eg. BEER WORT) WITH A THERMISTOR
..ideally without contaminating the liquid with chemicals, or getting the thermistor wet!
I chose copper as a reasonably food safe shell for my thermistor. Fermentation vessels etc have been made out of copper for hundreds of years, after all. It’s also an excellent conductor of heat, so it doesn’t hurt the performance of the thermistor much. First of all, I soldered the thermistor to a 1.5m length of 2-core mains cable I had lying around, and heat-shrinked over the bare wires and solder joints. Then I found a piece of copper tubing roughly 40cm long, and just wide enough to slide the thermistor and mains cable into. I crimped one end of the tubing very firmly shut in a vice, more or less pressure – welding it closed, then neatened it up with a file. I slid the thermistor inside and down to the crimped end, taping the mains cable to the copper tube at the open end, to stop it slipping back out.
So as long as I don’t immerse it all the way to the taped joint at the open end, my wort will stay free from contamination by whatever chemicals are in solder, heatshrink and thermistors, and my thermistor readings won’t get ruined by liquid shorting the wires.