Aquarium Heater Controller - Hysteresis Method
My new apartment gets much colder than my old apartment. That means that the water in the aquarium now gets colder than my tropical fish can stand. So, before I went on vacation, I bought a cheap aquarium heater. The problem is that the heater doesn't shut off no matter what the water temperature is. I had a temperature sensor IC, so I threw something together to control the heater while I was gone. To do this quickly, rather than pulling out the microcontrollers, I did everything with linear components.
The LM335Z temperature sensor is basically a Zener diode with a breakdown voltage that changes by temperature.
My aquarium has two species of fish with different temperature tolerances.
|Fish||Low (°C)||High (°C)|
My aquarium should be kept between 24°C and 25°C, giving Vz = [2.972,2.982]V.
- If the current temperature is below 24°C, the heater should be on.
- If the current temperature is above 25°C, the heater should be off.
- Between 24°C and 25°C:
- If the temperature was 24°C, heat until 25°C. (heater on)
- If the temperature was 25°C, cool until 24°C. (heater off)
That looks like hysteresis, specifically a Schmitt trigger. I can probably use an op-amp I have lying around and a couple of resistors to activate a relay connected to the heater.
For a good explanation of creating hysteresis in a circuit, take a look at Comparator Hysteresis in a Nutshell by Dave Van Ess. This schematic came from it.
Because the relay will need 5V, I will use the same source for Vdd.
Setting R1 to 1kΩ, Ra is about 1.5kΩ, and Rf is about 300kΩ.
This means the complete schematic would look like this:
D1 is the LM335Z. U1 is an LM324N.
In the next article, I'll write about how I waterproofed the LM335Z and what was wrong with this design.