Hi, this is my first time posting here so I apologize in advance if the topic isn't in the right section or if I forgot to add something which might help someone troubleshoot this.
I was working on building a temperature controller for a walk-in refrigeration unit using Arduino UNO started kit, 3 x MAX31855K chipsets and an 8 channel relay switch (Its a JBtek 8 channel relay, got it off cheap from Amazon). The whole point of it is to turn on/off an exhaust fan system and evaporator fans after checking a few simple temperature conditions (evaporator coils, box temperature and the outside temperature).
There are two issues I am facing right now
(1) I get a few errors (null values for temperature read) here and there in the middle randomly. I try to correct them in the code by averaging the values with the previous ones. I have also connected small capacitors (0.01uF) in parallel to the connections of the K type thermocouples to keep the readings stable but I keep getting random errors in the first few hours of booting up the arduino. Overtime the errors do decrease.
(2) This is actually my most frustrating issue right now. The system works great for first day or two but then does completely weird (well weird because I am probably missing out on something and I can't figure out what’s going on). As the code below shows, the evaporators turn on (the relay turns on by Arduino) once the temperature of the evaporators goes below 32F and the LCD screen shows the status as "E: On". The screen shows the correct status and the temperatures of the evaporators are also below 32 but it never turns on! It never turns the Relay on.
This happened twice already.. last time when this happened, I had to turn the board off (everything including the relay was powered by arduino) to run evaporators to prevent lines from freezing. The evaporator fans are plugged into NC on relay so as soon as the power goes off, the fans turn on (it’s more of a fail-safe). I didn’t have a multimeter at the time and I thought it was probably because Arduino was not providing enough power to the whole thing. So I ordered a few 5V power supplies and powered the circuit separately from the Arduino. Basically using Arduino only to drive the relays and sending/receiving signals.
Today, surprisingly, it did the same thing after running fine for last 2 days… So I kept the arduino on and turned off the relays. I checked the voltages on each relay driving lines on the Arduino. Pin 12 i.e. R1 was around 1.7mV (which is LOW instead of HIGH) and Pin13 i.e. R2 was at 4.98V (which is HIGH, as its supposed to be). This is what's driving me crazy! the LCD shows the correct status as well, the temperatures look fine to me too (no red screens or errors) but it should be HIGH not LOW.
(let me post the code in the second post, I have reached the character limit)