I keep pythons, woo! Pythons needs a temperature gradient which means you need a thermostat to switch your heat sources. All the thermostats on the market are expensive and suck balls, boo
So I’m going to build my own. The idea is to use an arduino yun with a screen as a ‘master controller’ and then to do a small board for each tank that talks serial and takes sensor inputs and control 240v outputs.
The idea is to have 2 temp sensors, a humidity sensor and a water level sensor in each tank, and to control the day lighting and 2 heating devices, all of which are 240v and have different characteristics when you talk about how to switch them on or off or dim them.
First question: Is there anything critical that I’ve missed in that parts list, apart from various discrete components to do the serial daughter boards.
Second question: Whats the best way for me to set this up to control 240v, with the ability to dim.
Easy first option:
To simply switch 240v on/off at regular interval/s use a suitable SSR ( Solid State Relay ). … these take a small digital input from an arduino or similar, and can switch a large AC load in a safe, and properly isolated way. ( eg, from ebay, a “Fotek” brand SSR-10DA or SSR-25DA ( google them ) can use 3v DC, and switch up to 380V AC - it’s mostly just a big triac on the inside ). be sure to get the DA, not the DD ( which is for switching high-voltage DC) .
Just connect it to your Arduino, and use the LED blink demo to flash the SSR on/off as essentially any speed you like. It gets messy when u want to flash it faster than ~10Hz though. Depending on the type of SSR ( either zero-crossing, or random-fire ), your SSR will actually tun the AC power on either at the next zero-crossing of the AC waveform, or immediately when u request it, which can be part-way-through a waveform ). Either way, below 10Hz, it’s less than relevant, so either type of SSR will do.
Second, Harder Option:
In order to be able to “dim” AC properly, you need a zero-crossing detector circuit, to “listen” to the AC waveform with your microcontroller and you need to connect that to your arduino ( or other micro) , in a safe an opto-isolated way and then use very careful timing to trigger a delay between when the zero-crossing occurs, and when you turn on your SSR. This method needs a random-fire SSR, other wise you’ll find that you AC doesn’t really turn on immedialtely when you request it to, and instead it’s turning on less than 1/2 a waveform later , at the next zero-crossing. Zero-crossing SSR’s are more common, and cheaper, becasue they don’t need to have as as big of a traic or heatsink of they turn the AC on only at the time when it’s a really low voltage anway ( ie at the zero-crossing). To make latters workse, manufacturers rarely ever tell you what tipe of SSR it is without hiking the price way up.
Third, a little bit different…?
Does your heater really run on 240V? Maybe it has a power-adaptor ( wall-wart, or brick), but it’s actually running 24V DC ( or whatever) through the heater element? In this case you’re in luck for a bunch of reasons… 1 - you can "dim’ the DC voltage much easier ( with a suitable DC SSR, like a SSR-25DD - it’s mostly just a big mosfet on the inside ) , and you can switch the mosfet on essentially as quickly as you like, without any need to do any AC synchronisation. ( don’t run it as kHz though) . You also avoid the need to do any 240V work at all.
From personal experience, trying to pulse a random-crossing SSR with anything that has a high inrush current is a quick way to kill them, even when grossly overrated for the job. Given that the McSnakeson’s family really won’t like having their heater stuck on, I’d recommend you only use a known zero-crossing SSR with @buzz’s first option, if that’s the way you decide to go.
I think option two, while the most effort, is probably the best option. It needs to safely and reliably control these heat sources otherwise unhappy/dead animal. Is there a known good circuit or something documented somewhere for this? I found one on instructables a while back but it wasn’t a very good explanation.
Heat sources are things like heat pads which are just resistive wire setups, heat cord, heat rocks (all very similar). Or halogens or other type of heat lamps. Theres also humidity control with misters in water sources. Also its standard to use special fluorescent bulbs for UV sources. All these things are actually 240v yeah (I think my particular halogen setup is dc but its the outlier). You’ve also got to manage your dimming appropriately on the type of lighting, ie none for fluro’s, halogens have a special heatup and cooldown cycle to preserve the bulb, ceramic heat bulbs have their own thing.
I’m not sure I understand the issue you’re outlining Mike?
Personally … if it were me I’d use option 1 for the heater elements as (depending on the thermal mass ) it probably doesn’t matter if you run them at a low on - off cycle time of a few seconds or longer.
Here’s a test… When you turn the heater element on at full tilt, how long does it take to go from ambient to the desired heat…? Are we talking seconds? Minutes? ( and what is the desired target heat)… you will need to know this characteristic to make a stab at a controller algorithm. …
Also. … if you are dealing with light fittings… as you said, fluro s aren’t dimmable anyway so option 1 is also the right choice for switching them…
Finally. … halogen bulbs… which run at a low DC voltage are best dimmed with a DC SSR ( a mosfet) … which is option three…
Option 2 might sound cool , but doing it right is hard, and involves high voltages , and only really adds value in the case of 240 incandescent bulbs or 240 v cooling fans… where turning on and off in cycle with the AC is essential. …
Thats pretty much it. I have halogens currently but I am not sure I’m going to stick with them, they’re not great. So I’ll probably be changing to a ceramic or incandescent heat lamp. I don’t like using heat mats or rocks/cord etc because they have a known history of cooking/killing animals in failure modes.
I appreciate that you’re trying to find me the ‘short way out’ but I think that will bite me sooner or later yknow. I’d like to have just one ‘control a 240v circuit’ thing that I use for all the various outputs, rather than this is dc, this is ac type one or ac type two etc etc.
I’m really not trying to find u the cheap way out. I’m suggesting what I think is the most correct way to switch a given device. I really do think that when used as a heater (not a light source) , even an incandescent lamp can be switched using option one… if it has enough thermal mass to make the heating/cooling cycle slowing. Eg… Ive seen snake keepers putting a standard 40w incandescent bulb into an essentially sealed wooden box that the bulb warms up from the inside, and that the snake can draw warmth from on the outside by lying on or near it. This is increasing the thermal mass and means the switch on and off cycle can be quote slow. … on the order of seconds or longer…
Another thermal mass option is to shine the bulb onto a sheet of something heat resistant like fibre cement or terracotta … put the bulb inside an upturned plant pot?
I think you will find fluro’s are dimmable well at least the ones I installed in logan city hospital about 8 years ago were
It sounds like you want to setup your own central control system using serial nodes for 2 tanks which is a grate idea, scaleable and a nightmare. I would look at the job totally differently and look at the functionality you really require to do the job. Snakes will move to change their temp that’s why a basic setup works but its no where near as fun as what you have come up with. So I will assume you just want a rock solid setup that works and has redundancy which is fail safe ( fail makes snake unhappy but alive)
Here is an option for you to consider instead of the proposed system. Build a distributed control system.
I would suggest putting an eather10 in each tank and push the data back to your server and change settings or watch tank with you phone from anywhere. You can also send data to the tank to tweak settings.
Use an ssr as buzz suggested to control heaters. The heaters will have their own control in them with max on time (heat for max of x time within y period) so this will have to be bypassed if you want to control the heater. Run the ssr at a low hrz like 1hrz so you don’t prematurely kill the ssr as Mike suggested. I would also run the power through a relay that can be shut off in the event of failure that is energized when everything is ok to run. Thermal mass as buzz suggested will take out alot of the temp fluctuations.
You will need a temp probe for each heat source + you will have the ambient air temp with the humidity sensor. I would use that air temp sensor to change the algorithm for heating. The warmer the air temp the less heating time on the heaters to slow the rate of change so less chances of pid overshooting the temp.
You could increase the humidity by using an ceramic fogger or decrease it by turning fan on to bring in fresh air.
I would need more information on your halogen light to suggest dimming option or control.
The water sensor looks great but I not sure it would give the correct reading if the snake was laying on it. So I would allow for that in the design of your tank. You could also have a water tank outside and use a little pump to top up tank when it is getting low.
Having a controller for each tank would mean in the case of a catastrophic failure only one tank will be effected and would just mean the tank would be cold and dark. I realise it is more expensive but meh it will be worth it in the long run.
Oh, it also occurred to me that since too-much heat can kill, but not-enough heat isn’t really an issue… a great way to make a totally fail-safe system would be to have 2 separate “master controllers” ( each being some sort of arduino , doesn’t matter what ), and two fully separate sets of sensors, and two separate SSR’s that control the heater element … but with the SSR’s in series, so that if either of the arduino/s decides the heater should be off, then it’s turned off ( even if the other disagrees ). This dual-ssr system will prevent a shorted-out or busted or badly wired SSR from getting “stuck on”, and overheating/killing anything… and if done right it will also prevent bad micro-controller firmware/bugs from killing anything ( eg, imagine if your microcontroller has a software bug that causes it to lock-up after 2 weeks , and happens to do that while the SSR is “on”? ) . Finally, it will also mean that any failure of a sensor will also not kill anything. If you decide to go for this idea, just remember to get two separate people to write the firmware for your controller/s, so that if there are bugs, they are at least different ).
Jimmy already covered it but the usual heaters you’d use in a reptile enclosure, like an incandescent/halogen heat lamp, have a high inrush current. If you try to dim or pulse these by rapidly switching them on & off with a random-fire SSR a few times a second, your SSR will fail in under a week. And they tend to fail switched on too, which is the worst outcome. You could get an SSR specced for a much higher current to stop this, but keep in mind incandescents etc regularly spike at 15x their rated current. Use either a zero-crossing SSR and lose the ability to finely dim it, or grossly overrate your random-crossing SSR to handle the inrush current, or use a pure resistive heater.
@buzz could use a bi-metallic strip to shut off heat at a set temp then it would be a hardware fail-safe