« mai 2005 | Main | juillet 2005 »
juin 15, 2005
Temperature regulator for a spa
In the spring of 1996, my father bought a three places spa. Back then, spas were not really known so he bought it for the bargain price of CAN $800. In 2005, it costs about CAN $4000 for a similar model. The only thing that a 2005 version of the spa has that the 1996 version doesn't is an electronic temperature regulator, it rather has a bimetal thermostat. The bimetal thermostat is very inaccurate and hard to set up, we would usually set it up in the spring and not touch it for the rest of the summer because of how hard it was to set up correctly. This means that we heated the spa 24/7 between May and September when we actually used it for a couple hours a week on average. Also, from the point of view of comfort, when the temperature of the spa was set up to 37°C, it would move from 35°C - too cold - to 39°C - too hot.
In the late 90's, we contacted the pool and spa shop that sold us the spa to know if it would be possible to buy the thermostat of their newest models to put on our old one. They basically gave us a blank stare, but finally told us that the controller costs CAN $500 and they has no idea if it was going to work. At the time I was in University, and I had lots of electronics courses, so I was confident that I could come up with an home-made solution that would be much more affortable and more flexible. It actually took me quite a while to make it, mainly because of my proverbial laziness, but I finally put it into work in the spring of 2004.
Components
There are three main components in this project:
- the temperature sensor,
- the relays controller
- and the brain, that is the computer.
![]()
Temperature sensor
I'm using a 1-Wire temperature sensor (DS18B20) made by Dallas Semiconductor/Maxim. Contrary to what its name implies, the 1-Wire devices actually require three of them, as it turns out that it needs one wire for communication plus a positive and a ground. Simple devices like the DS18B20 can work in parasite mode, so they actually need 2 wires, a communication wire and a ground.
Usually, 1-Wire networks use telephone wires with RJ11 connectors. In my setup, the RJ11 connector was connected to the serial port of a PC in my basement using a adpater (DS9097U) made by Dallas Semi. I received both the adapter and the sensor as free samples from Dallas Semi.
Relay controller
While the 1-Wire devices include a remote switch, it was not trivial for me to make it work with a 12 V relay. I tried for a while with the DS2405, but finally opted to go with a relay board controlled by the PC's parallel port. I ordered the kit 74 made by KitsRus for about CAN$ 50 assembled. I'm using an open source program made by James Cameron (Quozl) to control it from Linux. You might want to check out Quozl's page in details, as it lists many interesting projects, the Emu Fat Monitor is especially interesting.
If I had to redo the project, I would consider using this 1-Wire relay board by AAG Electronica. While this is more expensive than the kit 74, it would free up the parallel port on the PC.
100 feet of 4 conductor microphone cable is run between the PC in the basement and the spa on the deck. Two of the wires are used for the temperature sensor, and the two others carry a 12 V signal from the relay board to a 10 A relay located under the spa. The actual current used by the spa heater is 6 A.
Brain aka The Computer
The computer is an upgraded PC running Debian Linux. At the time of writing it is powered by an AMD Athlon XP 2000+, has 512 MB RAM and two 80 GB drives in a RAID 1 configuration. Of course, this is several million times more powerful than what is needed to run the temperature controller. Actually, the PC is running a BackupPC server, a mail server, a DNS server, a database server (mySQL) and a few other things as well. I recently bought a NSLU2 single board computer and I'm considering hacking it to run linux and use it as the brain of the system. I'll keep you posted on this...
The spa temperature is read from the sensors using DigiTemp, an open source program for Linux. Each minute, three temperature samples are taken, then the median of the samples is stored into a mySQL table, along with the date and time. When this is done, a perl script calculates the average of the last 15 readings (minutes) then compares this to a "goal" value set from the web interface. It then decides whether to activate the relay using Quozl's program. I use a 15 minutes moving average rather than just the last temperature reading to add some latency to the system with the hope that it will prevent it from oscillating too fast between on and off.
The web interface is made with PHP and jpgraph, it shows a graph of the spa temperature for last 12 hours, how many minutes was the heater on, the derivative of the temperature, and more. Notice that the temperature line is blue when the heater is inactive (off) and red when the heater is active (on).
In the future I might make an automatic mode where the computer gets the weather forecast from Internet and uses that to decide what temperature to keep the spa at. For example, if the forecast says that it will be sunny with more than 25°C, I set the spa to 35°C, if it's going to rain or the temperature will be below 25°C, it sets the spa to 25°C. I'm not sure how usefull it would be though...
Conclusion
It was really worth it. We now usually keep the temperature at 35°C on hot days, and at 30°C or 25°C on colder ones, when we're not going to use the spa. About an hour before entering the water, we log on the web interface and set the temperature to 37.5°C. With the web interface it's possible to log on to the spa from anywhere in the world - with the correct password - and set its temperature. Half an hour before leaving work, I log on the spa, set it to 37.5°C and it's ready when I arrive home! I also estimate that we save at least 30% of the cost of heating the spa, which is a few hundred dollars per summer. We also improved the insulation, so it's hard to tell what measure is the most effective in cost savings, but the result is that it's much cheaper and more comfortable than before to have that spa!
Posted by gfk at 7:51 PM | Comments (0)
Michael Jackson
Wow, il en fume du bon -- au cas où quelqu'un en doutait! Ce cher Michael Jackson a mis sur son site web une animation qui compare sa victoire en cour à la libération de Nelson Mandela, la chute du mur de Berlin et la naissance de Martin Luther King...
À voir sur le site officiel de Michael Jackson
Posted by gfk at 6:03 PM | Comments (0)
juin 8, 2005
Feux à Chibougamau
Quelques photos très impressionnantes des feux des derniers jours qui sévissaient aux alentours de Chibougamau.
Les flames à quelques centaines de mêtres de maisons.



Les avions pompiers Canadair CL-215 et CL-415 en train de combattre les flammes.






Plusieurs avions pompiers Canadair CL-215 et CL-415 en train de se recharger sur un lac.



J'ai reçu les images par une chaine de courriels, et je n'en connais malheureusement pas la source.
Posted by gfk at 5:38 PM | Comments (0)

