Hello everyone. I´m starting with arduino and need help.
I have a refrigerator with a broken electronic control board which is impossible to find. I thought I could replace it with arduino but I´m thinking it will be really difficult.
This refrigerator works in this way:
Compressor starts with a fan in the freezer compartment, cools down at -18°C to -20°C (there is an ntc thermistor that measures the temp), when it reaches the temperature that was set up the compressor stops but the fan is still running. The compressor starts again at another set up temp. Every 4 hours aprox, the freezer needs to do a de-frost cycle with a heater and the fan stops so the heat only affects the ice that formed in the evaporator and doesn´t heat the rest of the freezer (another thermistor takes this temperature so the heater doesn´t heat too much). Everything remains off until the ice finishes defrost for itself (like half an hour) and then the compressor starts again.
But that´s not all. The refrigerator temperature is regulated by an electronic damper. A stepper motor controls the air flow that goes down and there is another thermistor that measure the temp in this compartment.
I thought that with an Arduino Uno, a shield with 4 relays and a stepper motor controller would be enough to do this. But there is a little problem. I don´t know how to program. I can read a program and understand it but I can´t write it because I don´t know that much. I´ve found some projects with fridges but nothing this complex so I need your help.
I hope you´ve understand me and could help me.
I´m Argentinian so sorry for my English and thanks for reading!
The project as such doesn't sound too complex - a handful of outputs, two sensors, and I assume some kind of user interface showing the current temperature and allowing you to set the desired temperature. You have to deal with delays in the switching on/off of the pumps, and the reaction of the temperature to it: when you switch on the pump, the temperature may continue to rise a bit before the refrigerant reaches the fridge department, and the other way around. So to bring it down to -20C you may have to switch off the cooling pump when reaching -19.5C.
Other than that, it's going to be pretty straightforward. Do make sure your relays are well insulated (so no moisture comes in) and can handle the rated power twice over.
The potentially tricky bit is the stepper motor - are you sure it's a stepper? It's spinning a fan, right? It'd make more sense if it's PWM speed controlled, based on your description. I may be missing something here, though.
I would have problems programming, that's complex for me.
3 outputs (compressor, fan and stepper) and 3 inputs (refrigerator, freezer and defrost sensor) are needed at least. Changing the temp wouldn't be necessary for now so I wouldn't need an interface.
Compressor current consumption is around 1A, but is higher when starts. The fan is around 0.5A
I think it's a stepper motor beacuse it works with 12VDC, generally PWM motors works with 220VAC (at least in my country). It´s located between the refrigerator and the freezer and opens a gate to control the air flow that goes down. I'm attaching an image:
raste85:
I think it's a stepper motor beacuse it works with 12VDC, generally PWM motors works with 220VAC (at least in my country). It´s
Ah, here we have a language issue. You really got your terms wrong (maybe you translate them from your native language?)
PWM = Pulse Width Modulation, typically used for DC circuits.
220V AC is normally switched with Triacs, partial wave. In a way a form of PWM.
Stepper motors are designed to make distinct steps, not to run at different speeds.
Sorry, I was missing something. The damper in its original function mode, opens partially or full-way to control the air flow. That's why I think it's a stepper.
OK that's something I misunderstood. Then stepper is possible, servo is more likely. Maybe you can get more details on this motor by opening the case.
The other two (fan & compressor) are 220V AC powered, right?
The compressor I suppose just on/off - a relay would be the best for that.
The fan if on/off again that'd be a relay, if you need to control its speed you need to use a TRIAC. Not particularly hard to build, but you must be really careful as it's connected to the mains.
That's right. Both fan and compressor are 220VAC and just on/off.
The fan doesn't change its speed, only turns off when the door is open but it's controlled by switches in the door that are connected in series to the live wire so they have nothing to do with the curcuit board.
Another problem not discussed is in refrigeration, the compressor must not be started unless it has been off for a few minutes to allow the pressure to reduce.
The damper (flap) it's definitely a stepper. I've measured its wires and it has 440k between 2 wires and the same between the other 2. So it's a bipolar 4-wire stepper.
Defrosting melts the ice formed in the evaporator caused by the water in the food. The heater starts melting it and then turn off (when the evaporator is at 5-7 °C) so the water can drain itself and the freezer doesn't get hot. The entire process takes 20 mins more or less.
Paul, I don´t think it would be a problem because the compressor starts with a big difference of temperature (starts at 16°C and stops at 20°C) so it'll have time to normalize the pressure. Problems can appear if the fridge is plugged and unplugged but it'll be once in a while. And it can be solved delaying the start. Anyway, thanks for the warning.
raste85:
The damper (flap) it's definitely a stepper. I've measured its wires and it has 440k between 2 wires and the same between the other 2. So it's a bipolar 4-wire stepper.
OK. So you'll need a control board for that.
(starts at 16°C and stops at 20°C) so it'll have time to normalize the pressure. Problems can appear if the fridge is plugged and unplugged but it'll be once in a while. And it can be solved delaying the start. Anyway, thanks for the warning.
That indeed won't happen too often, and requires just the normal care of dealing with fridges. Don't plug it in right away, and also let it sit for a while after moving before plugging in.
Adding a delay of a few minutes or so at startup is not that good an idea, unless you have some other form of feedback that tells the user "hey, I'm alive and well!". This as many people expect a device to do something, anything, upon plugging in or switching on.
So I have an Arduino in my hands now and I'm testing how everything I'll need works.
I wrote a sketch to measure the temperatures I need.
#define COMP 4 // Compressor pinout
#define FAN 5 // Freezer fan pinout
#define terEVA A0 // Thermistor measuring freezer temp
#define terDEF A1 // Thermistor measuring defrost temp
#define terHEL A2 // Thermistor measuring refrigerator temp
const int reedPin = 2; // Reed switch located in the freezer door (it'll be used to turn the light on...
const int luzPin = 3; // and the fan off when de door is open (luzPin is light pinout)
int reedState = 0;
const int dirDAM = 8; // Dir pin of stepper driver (A4988)
const int stepDAM = 9; // Step pin of stepper driver
// What is down below are the measuring temp calculations
float R2 = 9830;
// This numbers are Steinhart-Hart model coefficients
float A = -0.7634148451E-3;
float B = 5.314262518E-4;
float C = -9.837226181E-7;
// Freezer temp
float termEVA(int RawADC) {
long resEVA;
float tempEVA;
resEVA = R2*((1024.0 / RawADC) - 1);
tempEVA = log(resEVA);
tempEVA = 1 / (A + (B * tempEVA) + (C * tempEVA * tempEVA * tempEVA));
tempEVA = tempEVA - 273.15;
return tempEVA;
}
// Defrost temp
float termDEF(int RawADC) {
long resDEF;
float tempDEF;
resDEF = R2*((1024.0 / RawADC) - 1);
tempDEF = log(resDEF);
tempDEF = 1 / (A + (B * tempDEF) + (C * tempDEF * tempDEF * tempDEF));
tempDEF = tempDEF - 273.15;
return tempDEF;
}
// Refrigerator temp
float termHEL(int RawADC) {
long resHEL;
float tempHEL;
resHEL = R2*((1024.0 / RawADC) - 1);
tempHEL = log(resHEL);
tempHEL = 1 / (A + (B * tempHEL) + (C * tempHEL * tempHEL * tempHEL));
tempHEL = tempHEL - 273.15;
return tempHEL;
}
void setup() {
pinMode (COMP, OUTPUT);
pinMode (FAN, OUTPUT);
pinMode (dirDAM, OUTPUT);
pinMode (stepDAM, OUTPUT);
pinMode (luzPin, OUTPUT);
pinMode (reedPin, INPUT);
Serial.begin(9600); // Used to test temperature measurement
}
void loop() {
float tempEVA;
tempEVA = termEVA(analogRead(terEVA));
Serial.print("Temp. Freezer: ");
Serial.print(tempEVA,1);
Serial.println();
delay(2000);
}
I used this code to test if the measured temperature was right. I would like to know if there's something wrong in the code or something that could be better.
raste85:
I used this code to test if the measured temperature was right. I would like to know if there's something wrong in the code or something that could be better.
First of all, use code tags rather than quote tags. The first is for code, the second for quotes.
float A = -0.7634148451E-3;
A float can't handle that many digits, no more than 6-7 decimals. You'd need to use double, a 64-bit type which can do about 15 significant decimal digits, but which afaik is not available on Arduino (it seems to be an alias of float, so still only 32-bits).
If you really want that kind of precision you may get it by converting them to integers. Then you can use 64-bit math on an Uno (use the uint64_t type). As added bonus, your calculations go much faster and you need far less bytes for it - a log() takes some 1400 bytes I found out the other day... and that was the end of my hopes of using an ATtiny25
Hello guys, i hope i'm not too late for this follow-up! I've successfully completed a similar project i started building a couple of weeks ago, a full refrigerator with evaporator fan and defrost cycles. Also connected a custom arduino pcb serially to a pi3 to display nice graphics on a 7"touchscreen. Pretty happy with the whole project and i'd love to share schematics if it helps anyone! But i have a stability problem... sometimes (once a day) when i turn on the compressor relay, the arduino resets... i know it's a wild current draw from a compressor startup, and i've added big capacitors on my 5v rail (2200uf) but i still get the same problem. I use a dual transformer for my project. From one output i get 12V for my relays, and regulate the other output to 5V for the atmega. Ofcourse i use transistors and flyback diodes to swith the relays. At first i had resets when i opened the door (the fan motor stopped) but it was an easy fix with a snubber r-c across the motor. But the compressor startup... i can't figure out how to solve it! Any help would be much appreciated!