I'm currently trying to make a project that will switch a fridge on and off when it reaches the right temperature, and send the data over the network. I have a number of components working, but the ethernet seems to be blocking the power. I have a relay controlling the power for the fridge. This works in a script on it's own. I'm running the relay by using a signal pin for power, which I write HIGH in setup(), then I write another signal pin HIGH in the loop() when I want the fridge on. This works well, except if setup() contains Ethernet.begin(). That one line of code seems to be what's blocking the relay. Everything else works. The temperature sensors are read and the data is sent over the network. The red LED on the relay comes on, so it looks like it has power, but not control.
I have tried commenting out everything else except for the relay and ethernet code, and I've tried adding a massive delay, up to one minute, after the ethernet begin call, but this has made no difference.
I have attached the code below. It could be an issue with my setup, as far as I can tell, but I don't think there's anything wrong with the loop that executes. Do I need to find a different ethernet library which prevents blocking? From what I could see on Github, the current library has been designed to prevent blocking now, so I'm surprised that this is happening.
Any pointers on how I can fix this would be greatly appreciated.
sendtemps.ino (4.95 KB)