Automated Distiller v1 - July 2011
I discovered the cheap tabletop distillation unit that I purchased had a few design flaws. The most common problems being the circuit breaker failing and the heating element cracking. With the heating element welded onto the bottom of the stainless steel container, repairing damage would be difficult or impossible. I set out to automate the distillation process to make it safe for anyone in my household to operate.
This is where I salvaged a few pieces from the control box of a previous project, a temperature- and humidity-controlled terrarium: 2 Crydom D1210 relays, wall outlets, an electronic rotary dial for input, and an ATMega. A dial was harvested from a child's clock-tower toy that was being discarded.
The dial input varies the amount of time the fan and heating element is to be turned on, based on how much water is to be distilled. The fan starts just before the water boils, when the proper temperature has been reached. User input is required (turning the knob any direction) to turn the unit on, preventing a power outage from activating the unit when power returns. This still has a 250-watt heating element and can produce 1 liter per hour. I routinely distilled over a gallon a day with it.
Automated Distiller v2 - September, 2011
With the acquisition of a new distillation unit, I decided to transfer and adapt the control interface from my previous distillation unit. I wanted a redesign that would reduce size and increase functionality. The 120VAC solid state relays, and ATMega were salvaged from the first controller and a 16x2 LDC and push-button rotary encoder were added.
A potentiometer controls the LCD backlight brightness and the black relay powers the backlight. Some of the code from my previous interface was be used, but much of it had to be rewritten for use with a rotary encoder instead of a 6-position dial and an LCD instead of an LED.
Coding was fairly straight-forward. The LCD was used in 4-bit mode, requiring only 6 pins, and was controlled with the LiquidCrystal library. I wrote a simple LCD menu library for the rotary encoder. The rotary encoder outputs gray code, which was easily handled with the QuadEncoder library.
With 12 KB remaining on the ATMega328, after programming, I decided to write a function to display a randomly-selected short quote across the LCD during the fan test upon startup. Like many ATMega projects that use LCDs, the 1K variable memory can be quickly used, leading to unpredictable results when the program runs. To overcome this, the quotes are stored in a 2-dimensional character array, which is placed in program memory with the pgmspace library.
To make the quote selection random, I turned to random(), however, even with the suggested randomSeed() called to initialize a pseudo-random series from an unconnected analog pin noise, I found that resulting random numbers to be biased, leading to the same few quotes being played. After finding and testing the TrueRandom library, I discovered it too is not that random. Then I came across an article by David Pankhurst that was exactly what I was looking for.
- Push-button used to wake the ATMega from sleep and activate the LCD backlight.
- The fan will spin for several seconds during startup, while a random quote is displayed.
- The total amount of water that has been distilled is stored in PROGMEM.
- A warning will be displayed when a set number of liters have been distilled (prompting acknowledgement that the carbon filter needs to be changed and the counter reset).
- The volume to distill can be selected for various sized vessels: 1, 1.5, 2.5, and 3 liters.
- Starting distillation can be delayed for a desired period of time.
- If set to start in the future, the LCD displays the volume to be distilled and the remaining time until beginning.
- If distillation has begun, the LCD displays the...