// Hi! Barb here: this is a quick and dirty implementation of a refrigeration compressor + evaporator fan(s) controller.
// I wrote this code to run it on an attiny45 that I was able to solder on the back of a 5V relay inside the refrigerator's
// I wrote this code to run it on an arduino nano 168 (previously: attiny45) that I was able to solder on the back of a 5V relay inside the refrigerator's
// control panel. This code relies on an external thermostat already doing its work and is not meant to manage internal
// temperature. It is written to make sure the compressor can get a minimum rest-time between cycles as to not overheat.
// This relay and attiny are connected in series with the main thermost's relay, so that they only function when it's calling.
// With this in mind, we assume the thermostat has just called for cooling every time the attiny is booted and leave the
// This relay and microcontroller are connected in series with the main thermost's relay, so that they only function when it's calling.
// With this in mind, we assume the thermostat has just called for cooling every time the arduino is booted and leave the
// compressor running. After a set period of s (timerMAX) the compressor is switched off.
// In order to aid thermal transfer and maximize COP while using butane as refrigerant, the system needs to have a higher
// average temperature. Due to this reason, a fan is fitted between the fridge and freezer compartments to move air between
// the two. The fan is turned on after fanStartDelay to prevent rapid heating of the freezer and turned back on when the
// timer hits fanStopAdvance to allow for further freezer sub-cooling.
// Last updated: 05/03/24
// updated: 05/03/24
// notes: tweaked timing and added fan startup delay + anticipated shut-off
// updated: 02/07/24
// notes: added temperature-based clog detection and provision for reversing valve
// updated: 04/07/24
// notes: moved from attiny45 to arduino nano to increase memory and serial port
#include<OneWire.h>
#include<DallasTemperature.h>
booldisable=0;// bool to store compressor disable status
inttimer=0;// active countdown timer, between timerMax and 0
@ -4,4 +4,13 @@ Questo controller è montato DOPO il termostato, in modo da impostare dei limiti
UPDATE 03/'24:
Ho aggiunto un delay di 60s all'accensione delle ventole per permettere al freezer di pre-raffreddarsi e poi uno spegnimento delle stesse 30s prima del compressore per far calare ulteriormente la temperatura nel comparto freezer.
Ho aumentato il tempo totale di accensione a 1500s (25'), portando il tempo di spegnimento forzato a 1/5 (5' con l'impostazione corrente)
Ho aumentato il tempo totale di accensione a 1500s (25'), portando il tempo di spegnimento forzato a 1/5 (5' con l'impostazione corrente)
// updated: 05/03/24
// notes: tweaked timing and added fan startup delay + anticipated shut-off
// updated: 02/07/24
// notes: added temperature-based clog detection and provision for reversing valve
// updated: 04/07/24
// notes: moved from attiny45 to arduino nano 168 to increase memory and serial port