dSwitch Aquasaurs Temp Monitor
We recently picked up one of those Aquasaurs kits for the kids – which lets you hatch and care for some neat little aquatic fish (or shrimp) that date back to pre-historic times. After reading the instructions we got everything set-up and all was good, until we read the part about the temp of the water needing to remain between 72 – 80F. Problem is, we tend to keep our house around 70ish, and during the day, we have our automatic thermostat drop the temp to more frigid temps (to conserve you know!). We quickly realized that these things would likely not get past the larvae stage at those temps. For the first two days, we had the tank propped up on the stove under the halogen lights to keep the water warm. However, over time, they would heat the water too much and need to be monitored / turned off for periods of time. We needed to come up with a longer term solution.
One option would be to simply go out and drop $$ (insert cost here – I don’t know) on a aquarium heater – but that would be too easy. I’d rather take my $300+ extra NXT & temperature sensor and make them work for a bit. Now you ask yourself, how the heck would the NXT heat the water. Well, that’s where dSwitch from Dexter Industries comes in. Interestingly enough, the dSwitch did not come to me with the intent of using it to heat the Aquasaurs tank. It was more like irony and good timing that I just received the dSwitch and we got the Aquasaurs going.
How does it work?
Pretty simple really. dSwitch allows you to programmatically control a 120V (also available in 240V for other countries) outlet to switch a power source on/off as desired. The NXT is programmed to monitor the temperature using the LEGO temperature sensor and the dSwitch NXT-G block is used to turn the light on and off based on temperature thresholds. My current setup has the dSwitch turn the light on when the water temperature is below 72F and turn it off when it hits 79F. With NXT-G I am also able to control how often it polls the temperature to ensure that the granularity of monitoring is over a longer period of time (e.g. we dont want the light flicking on and off when the temp is near 72F and 79F). Currently I have it set to evaluate the temperature every 10 minutes and switch the light on/off as necessary.
[ad name=”GoogleAS728x90ImgOnly”]
The following shows the NXT screen with current & average temperature and the status of the dSwitch. The average temperature is done by taking 10 readings over a period of time and averaging the result. The current program has this being done every 20ms. However, that was only for testing. You would likely want this at something like every minute or so and then average the result every 10 minutes.
The Aquasaurs setup in a temporary location with the dSwitch, NXT, temperature sensor and light all connected to the 120V outlet. If it wasn’t yet obvious, the light is used as the heating source for the tank. 🙂
The dSwitch beside the NXT currently heating the tank. (I plan on connecting the NXT to a wallwart later so it doesn’t eat up the batteries)
The NXT-G code has 2 main loops. The first monitors the temperature and averages its values over time. The average temperature is stored in a variable to be used in the switching loop. Additionally, this loop also handles the display of the temperature, avg temperature and counter (for debugging). Click for a larger view.
The second loop is the switching loop. This loop monitors the average temperature variable for changes over time. The first entry (logic switch) determines if the temperature is below 72F, if True, then evaluate the average temperature again (to ensure that it is not above 78F). If the average temperature is within the 72F-78F range, dSwitch is on. If it s > 78F, dSwitch is turned off and if it is < 72F, dSwitch is turned on. Click for a larger view.
The following shows the entire program.
[ad name=”GoogleAS728x90″]
Download the NXT-G block here ~ 1MB. (requires the dSwitch block available at Dexter Industries)
More information on the dSwitch at Dexter Industries
Rate this Post:
Hi! Nice project! You may want to read up on PID loops, and possibly varying the “ON” time. This will give you better control of the temperature, and avoid overshoot.
I guess the dSWitch is failsafe (so a power/software failure on the NXT will not leave the power on continually?)
In industry, there are fairly low cost temperature controllers, but probably not much fun! lol I’m still trying to find time to get my self-balancing NXT bot working well, so nice to see others actually get stuff done! Jason
I enjoyed reading your post above. I hope you keep your site going, usually the sites I find and enjoy seem to run out of steam and then grind to a halt.Keep up the good work!