Aquarium Heater Controller - Hysteresis Method

The Problem

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 Sensor

The LM335Z temperature sensor is basically a Zener diode with a breakdown voltage that changes by temperature.

Equation 1

My aquarium has two species of fish with different temperature tolerances.

FishLow (°C)High (°C)
Silver Dollar2428
Tinfoil Barb2225

My aquarium should be kept between 24°C and 25°C, giving Vz = [2.972,2.982]V.

The Strategy

Aquarium Heater Controller - Hysteresis Plot

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.

Schmitt Trigger

Equation 2

Because the relay will need 5V, I will use the same source for Vdd.

Equation 3

Setting R1 to 1kΩ, Ra is about 1.5kΩ, and Rf is about 300kΩ.

This means the complete schematic would look like this:

Aquarium Heater Controller - Hysteresis Schematic
C1 was added later after testing.

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.