got ethical husbandry?

DIY heat controller (snakes, PIDs, dimmers, galore)

richiev

Supporting Member
This is somewhat eutrophic zone (see my post about snakes), but now that we have a snake I've been looking at equipment there. The nice thing is there's a lot less equipment needs in keeping this snake. However, keeping temperature regulated is still important.

I started looking at temp controllers, and found some of the options are overlapping with reef tanks, particularly at the low-end there's Inkbird controllers. I started looking into the higher end ones a bit more, and in doing so decided to fall down the DIY end again, at least as an experiment. Since the temp measurement is so similar to a reef tank, I thought I'd share some of the things I learned, and how my current device is working.

For a snake enclosure, the heat management is usually one of:
  • a heat lamp -- effectively a lightbulb designed to generate a lot of heat instead of light (sometimes only infrared light)
  • a heating pad -- effectively a little pad you stick to the bottom of an enclosure (eg an aquarium) that gets hot
  • heat tape -- I believe this is effectively the same as the heating pad, but in tape form
By default none of those have any temperature control, so you either need to live dangerously and size it just perfect so it gets things to just the right temperature, OR you need a self-regulating temperature controler. The controllers fall into two main buckets:
  • simple on/off thermostat: this is what an Inkbird does, both in reefs and their reptile versions. At a certain temperature it turns on. At a different temperature it turns off. Repeat to keep the temp in about the right range.
  • dimming thermostat: instead of on-off, do a percentage on, like you would with dimming lights. When people talk about heaters always running on, but just enough to hold steady temperature, this is what they're referring to (assuming it's not just always at 100%). This is the more advanced/ideal setup.
To implement dimming, because all of these heat sources are AC current based, the dimming controllers regulate the AC voltage, making the effective voltage go from 120V to say 60V (at 50% dimming). In practice because AC current is a wave, not a fixed number, the implementation of that is a lot more complicated (involving messing with the wave peaks), but that's a close enough mental model. There's a thing called "Zero Crossing" sensor involved.

Ideally the microcontroller will then crank the output percentage up super high when the temp is way too low, and when it gets to approximately the right temp, it'll keep the voltage at just enough to keep the temp stable. The algorithm/technique for calculating and managing how much heat to output is done through a Proportional-Integral-Derivative controller (PID controller). That's just a fancy term for trying to make big changes when you're way off your mark, then be more controlled when you're closer.

Current state is I have an ESP32 + a standard 3-wire temp probe + a AC dimmer doing all this in a test setup in my living room:

History_–_Home_Assistant.png


You can see from around 10pm-10:24pm the temp was bouncing around a bit. That's the PID controller getting tuned (trying to figure out exactly how much it needs to stay on to keep temps stable). Once it figures that out, it's then rock-solid stable temp-wise.

The software for this is using ESPHome. Same as what I'd talked about in other recent little DIY electronic things. The really nice part about this is there's no code I had to write. I connected the wires, messed around with some configs (with a lot of ChatGPT help/guidance) and then install it through a web-ui.

Main points that I think are relevant for reefing, that I'm curious to continue looking into:
  • another example here where the hobby needs don't need hobby-centric stuff. This standard, smart home, climate control software does the same thing as the hobby specific ones, but has wayyyyy nicer UIs for visualization, and you can connect it to whatever else. Want your living room smart lights to flip red when your temperature is out of range? You can do it with a couple clicks. Want a push notification and email to your phone? Same.
  • what reef temp controllers out there are doing dimming versus pure on-off? I assume a lot (most?) of the heaters with built-in temp management are, but is that true? I assume most controllers are not doing this, and are pure on-off (Apex for instance). I wonder if the reptile controllers with a titanium heater would be the solution for a super reliable reef heater. For instance, the Herpstat 1 does proportional heating, and can handle 700w, for $150 (with wifi and a UI for $165).
I have some titanium heaters and I might give this DIY version a try on my QT tank. I'm pretty sure it'll work great and be as-safe, or safer, then the setup I have on my other tanks. It'll be trivial to have redundant temp probes, and also two-layers of control. I can have the little ESP-device with the plug control the dimming output of the heater, and I can have a secondary control on the smart home to automatically turn on/off the electric plug for the heater if the temp's tank is far outside of range.
 
very insightful and interesting. do you know anything about how dc controllers work and replacing broken ones with a diy/ebay one?
 
very insightful and interesting. do you know anything about how dc controllers work and replacing broken ones with a diy/ebay one?
Depends on the type of DC controller you mean. Generally, somewhat similar concepts, but different though. I don't want to claim expertise on any of this, but if you mean pump controllers, I think most of them are likely pretty basic circuits. For instance, my assumption is a lot of these pumps are a stepper motor, a stepper motor being little dc motor that you can tell to "take 1 step" or a part of a step. A full circle would be say 1200 steps.

So the controller is telling the motor "do 1 step" either really fast or really slow, depending on the speed. If you want it to do a pulse, you tell it 'step step step step' to get it to spin for a bit, then don't tell it to do anything (or tell it to step slower) then tell it to step fast again.

The controls/math/... to make the motor do the stepping seems complicated, but that part you don't have to figure out yourself. Motor controllers are like $2 on aliexpress, even before trying to do any bulk orders.

So the hard parts are all standard commodity hardware. Once you have that in place, the pulsing controls would be relatively simple on top of that.
 
Great insight into temp controllers.

How's the snake doing?!

Curious...how are you heating your snake enclosure? What kind of enclosure did you go with?
 
I use whatever cheap one I happen to find on aliexpress when I'm running low. Usually the usb-c ones, however they're really annoying because almost all of them require power from a cord that is usb-a on one end and usb-c on the other. I have no idea why, but I assume they're all using some faulty wiring or circuit.
 
Back
Top