Drawing 450mA, how to supplement

First post, apologies if its in the wrong place. Im fairly new to Arduino. This particular project is my 5th, and largest. Im controlling a commercial refrigerator that I have in my garage, the thermostat went bad, new idea for an Arduino project. I have an uno r3, 2004 I2C LCD(45mA), and three 30amp relays with 5v trigger that draw 200mA to trigger. The relays are whats killing it..I have a draw of roughly 450mA from the 5 volt pin with two relays triggered and the LCD screen, not even all three relays. I read that 400-500mA is about the max for the uno board, it gets hot and will eventually crash, even in the cold fridge lol. 200mA seems like a lot for these relays.

Relays are switching 110v for-
-compressor (12A max)
-evaporator fan(2A max)
-interior lights(less than 1 amp)

While I cpuld probably get smaller amperage relays for the e fan and lights, is there a way to supplement the 5v, or what is the recomendation here? I don't really want two transformers up in the top of this fridge, seems messy and more points for failure. When I wrote the code and bench tested this, I did not have the relay board hooked up, I had LEDs in its place, I had no idea that it would draw so much.

How do you power the Uno now.

I would power the relays, Uno and LCD from a 5volt/1Amp (cellphone/tablet) supply.
So 5volt connected directly to the Uno's 5volt pin.

Warning: Disconnect everything when using USB, to upload new software.
Leo..

I'd like to see a schematic but since there isn't one (nudge), I'll ask: you're not trying to power a 200mA relay coil from an Arduino output pin are you? If so, stop. The absolute maximum you can draw from an output is 40mA and the recommended maximum is 20mA.

Consider opto isolated relays. And power the coils from a separate power supply (i.e not from the Arduino). As a rule of thumb, never use the Arduino as a power source. Well, hardly ever, at any rate.

Ill work on a schematic, need to find a program to do something like that.

Heres a link to the relay board- https://www.amazon.com/gp/product/B07BLKV64Y/ref=ppx_yo_dt_b_asin_title_o01_s01?ie=UTF8&psc=1

Im powering the board power and LCD from the arduino 5v pin. Then D4, D5, and D9 are triggering. I'm drawing a blank on how else to trigger the relay if not from the digital pins? I could power the board and LCD from a separate power supply, but just the voltage to the board draws little current.

You have problems and are lucky if the Arduino is still working. Two golden rules with Arduino's.
Rule #1. A Power Supply the Arduino is NOT!
Rule #2. Never Connect anything Inductive to an Arduino PIN!
Go to an external power supply and use MOSFETs or something to drive the relays or get relays that have built in drivers. I prefer solid state relays but that is your choice. If you do use a solid state relay get one that cycles on zero cross.

1 Like

I got it actually, just after I posted. I powered the relay board with a separate 5v, and measured current draw to the digital pins triggering it at 10mA. This should be fine, correct?

1 Like

That's perfect.

Seems like a decent relay module and with optocoupler's you only need two wires from your Uno.

But how are you powering the Arduino.
USB socket, DC socket (voltage?).

What is "it".
Leo..

Powering the board with a 12v 2A power supply into the DC socket. The piece getting hot(I don't know the electronic term for it) is right next to the DC socket.

I ordered a hardwired 110VAC to 5VDC 3A power supply to power the LCD and relay board, and will power the Uno from this as well to keep it simple.

That would be the linear 5V regulator that, at 12V in, is trying to dissipate 700mW of heat for every 100mA of current the Arduino and accessories are drawing. And it's trying to do it without a heatsink. It will not be happy trying to do that.

If you do end up needing to go the separate power supply route, it will be much happier with an 8V power supply where it will only have to dissipate 300mW of heat for every 100mA drawn.

Too high.
The regulator has to drop that to 5volt, using more power (7/12) than all the rest in the process.
No wonder it will get hot.

If you must use a 12volt supply, then use a 12volt to 5volt buck (not linear) converter,
Power as adviced in post#2
Leo..

1 Like

Hi guys. Having a problem with my circuitry and or power supply.

Im controlling a commercial cooler. The thermostat went out, so I thought I would make one with Arduino. Im fairly new to this stuff, this is my largest and most complex project so far.
Specifically controlling the compressor/condenser fan and inside evaporator fan based on temperature. Plus, interior lights, and have an alarm relay output in case of a freeze condition, compressor failure, or arduino goes down.

Components-
Uno R3

5V 3A power supply (x2) https://www.amazon.com/dp/B005T6UJBU?psc=1&ref=ppx_yo2ov_dt_b_product_details

4 position 5V relay board rated for 30A https://www.amazon.com/dp/B07BLKV64Y?ref=ppx_yo2ov_dt_b_product_details&th=1

temp sensor
5V motion
2004 LCD +I2C

When I started this, I had the project put together on my desk while writing the code to work out bugs. Ive gotten the bugs worked out of the code. It ran on my desk for days without issue. But, instead of the relay board I had LEDs to indicate what is in what state. It was also running only from USB power.
Fast forward to installing it in the cooler. Found the relay board takes quite a bit of power to power all 4 relays(about 200mA per relay). Was originally powering with a 12v 1A transformer into the DC socket. It was recomended that I not do that, so I installed a 5V power supply for the entire project, powering the arduino through the 5V pin, It works like this, until at some point it crashes when any relay turns off or on.

I then added a second 5V power supply, one for the relay board, and the other for the Arduino, temp sensor, motion, and LCD, powering the Arduino through the 5V pin still. It works for a little longer like this, but eventually, things will crash at some point when a relay is turned off or on, either right away, 10 minutes, 1 hour, at some point. By crash, I mean the LCD will display jibberish, the code will stop looping, or both.

I also want to note that there is about 4 feet of cable 4/22awg cable between the arduino and LCD. The arduino and relays are in the cooler in the cold, the LCD on the outside.

I attached the code and a circuit schematic of how things are wired right now.

Again, I'm a beginner. The code works just fine. Not sure what is wrong to crash it.

Questions-
-In the schematic you will notice I have an output attached to an input, in two different places(4&5. 6&7) This is the only way I could think to do since you can't digitalRead an output pin. This is okay, correct?
-I do not have any resistors on the I2C, I read this is a thing just before this. Will this help?

Screen Shot 2023-11-10 at 2.57.50 PM


//INPUT PINS
int tempsensor = 11;  // Interior temp Sensor
int fanState = 7;     // State of Evaporator fan, used for on/off timing.
int compState = 5;    // State of Compressor, used for evap fan delay.
int SPdn = 2;         // Setpoint down
int SPup = 3;         // Setpoint up
int motion = 10;      // Motion detector for light

//OUTPUT PINS
int evapFan = 6;      // Evaporator fan relay
int compressor = 4;   // Compressor relay
int light = 8;        // Light relay
int alarm = 9;        // Alarm relay
int heartbeat = 13;   // Status blink

//INTEGERS
int temp;
int tempLOW = 35;         // Low setpoint
int tempHIGH = 38;        // High setpoint
int OFFcountdownMIN = 4;  // "Fan OFF for" countdown
int OFFcountdownSEC = 59; // "Fan OFF for" countdown
int ONcountdownMIN = 1;   // "Fan ON for" countdown
int ONcountdownSEC = 59;  // "Fan ON for" countdown
int compRunMIN = 0;       // Compressor Runtime
int compRunSEC = 0;       // Compressor Runtime
int fanDelay = 0;         // fan delay on compressor start
int lighttimer;           // light on for 10 minutes(600)
int freeze = 32;          // freeze alarm


// Shortcuts
#define ON HIGH
#define OFF LOW


//LIBRARYS
#include <OneWire.h>
#include <LiquidCrystal_I2C.h>
#include <Wire.h>
#include <DallasTemperature.h>

OneWire oneWire (tempsensor);
DallasTemperature sensors(&oneWire);

//LCD Setup
char array1[] = "SETPOINT       -   F";
char array2[] = "TEMPERATURE        F";
char array3[] = "FAN            :    ";
char array4[] = "COMP           :    ";
LiquidCrystal_I2C lcd(0x27, 20, 4);
// A
//


//------------------------------------------------------------------------------------

void setup() {
  pinMode(evapFan, OUTPUT);
  pinMode(compressor, OUTPUT);
  pinMode(light, OUTPUT);
  pinMode(alarm, OUTPUT);
  pinMode(tempsensor, INPUT);
  pinMode(compState, INPUT);
  pinMode(fanState, INPUT);
  pinMode(SPdn, INPUT);
  pinMode(SPup, INPUT);
  pinMode(motion, INPUT);
  pinMode(13, OUTPUT); //Yellow LED on board.
  digitalWrite(evapFan, OFF);
  digitalWrite(compressor, OFF);
  digitalWrite(light, OFF);
  digitalWrite(alarm, HIGH); // Normal= Relay on, wired NC to 5816
  digitalWrite(compState, INPUT_PULLUP);
  digitalWrite(fanState, INPUT_PULLUP);
  digitalWrite(SPdn, INPUT_PULLUP);
  digitalWrite(SPup, INPUT_PULLUP);
  digitalWrite(motion, INPUT_PULLUP);
  digitalWrite(13, LOW);
  lcd.init();
  lcd.backlight();
  lcd.clear();
  lcd.print(array1);
  lcd.setCursor(0, 1);
  lcd.print(array2);
  lcd.setCursor(0, 2);
  lcd.print(array3);
  lcd.setCursor(0, 3);
  lcd.print(array4);
  sensors.begin();
  Serial.begin(9600);
}
//------------------------------------------------------------------------------------
void loop(void) {

  digitalWrite(heartbeat, ON);
  delay(200);
  digitalWrite(heartbeat, OFF);
  delay(200);

// SETPOINT BUTTONS------------------------------------------------------------------

  if (digitalRead(SPdn) == LOW) {        // setpoint down button
    tempLOW = tempLOW - 1;
    tempHIGH = tempHIGH - 1;
  } 

  if (digitalRead(SPup) == LOW) {        // setpoint up button
    tempLOW = tempLOW + 1;
    tempHIGH = tempHIGH + 1;
  } 

// INTERIOR LIGHT--------------------------------------------------------------------

  if (digitalRead(motion) == LOW) {      // light timer start at 10 minutes (600)
    lighttimer = 0;
  }
  
  lighttimer++;
  
  if (lighttimer <= 600) {    // light on, off after 10 minutes no motion
    digitalWrite(light, ON);
  } else {
      digitalWrite(light, OFF);
    }

//TEMP DISPLAY------------------------------------------------------------------------

  lcd.setCursor(13, 0);
  lcd.print(tempLOW);                   //low setpoint
  lcd.setCursor(16, 0);
  lcd.print(tempHIGH);                  //high setpoint
  sensors.requestTemperatures();
  lcd.setCursor(13, 1);
  lcd.print((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0);//temperature in F 


// Temp Control-----------------------------------------------------------------------
  
  temp = ((sensors.getTempCByIndex(0) * 9.0) / 5.0 + 32.0); // read temp
  
  if (temp > tempHIGH) { // Temperature HIGH Setpoint, turn compressor on
    digitalWrite(compressor, ON);
    }
  
  if (temp < tempLOW) { // Temperature LOW Setpoint, turn compressor off
    digitalWrite(compressor, OFF);
    }

  if (temp < freeze) { // Freeze alert
    digitalWrite(compressor, OFF);
    digitalWrite(evapFan, ON);
    digitalWrite(alarm, LOW);
    lcd.setCursor(13,1);
    lcd.print(" FREEZE");
    lcd.setCursor(4,2);
    lcd.print(" ON            ");
    lcd.setCursor(5,3);
    lcd.print("DISABLED       ");
    delay(60000);
    }


  
// Compressor ON----------------------------------------------------------------------
  
  // Compressor ON
  
  if (digitalRead(compState) == ON) {
    lcd.setCursor(5, 3);
    lcd.print("ON for    :   ");    //comp on
    lcd.setCursor(13, 3);          //compressor minutes
    lcd.print(compRunMIN);
    lcd.setCursor(16, 3);          //compressor seconds
    lcd.print(compRunSEC);
    fanDelay++;
    compRunSEC = compRunSEC + 1;
    if (compRunSEC == 60) {        // compressor seconds counter
      compRunSEC = 00;
      compRunMIN = compRunMIN + 1;
    }
    
  // Evap fan ON after compressor is on for 20 seconds
  
    if (fanDelay > 20) {          //compressor less than 20 sec
      digitalWrite(evapFan, ON);
      lcd.setCursor(5, 2);        //fan
      lcd.print("ON           ");
    }
    else{                         //compressor more than 20 sec
      digitalWrite(evapFan, OFF);
      lcd.setCursor(5, 2);
      lcd.print("DELAY        ");
    }
  }

  
// Compressor OFF--------------------------------------------------------------------

  else {
  //evap fan run for 2 minutes after compressor off
    lcd.setCursor(5, 3);
    lcd.print("OFF    (");        //compressor OFF
    lcd.setCursor(18, 3);
    lcd.print(")");               //History time
    compRunMIN = 0;               //runtime reset
    compRunSEC = 0;               //runtime reset
    fanDelay = 0;                 //fan delay reset


    
    
  //evaporator fan ON interval-------------------------------------------------------
    if (digitalRead(fanState) == ON){
      OFFcountdownMIN = 4;                 //OFFcountdown reset
      OFFcountdownSEC = 59;                //OFFcountdown reset
      lcd.setCursor(5, 2);
      lcd.print("ON  for   :  ");          //fan low for
      lcd.setCursor(13, 2);                //fan minutes
      lcd.print(ONcountdownMIN);
      lcd.setCursor(16, 2);                //fan seconds
      lcd.print(ONcountdownSEC);
      ONcountdownSEC = ONcountdownSEC - 1;
      if (ONcountdownSEC == -1) {          // on seconds counter
        ONcountdownSEC = 59;
        ONcountdownMIN = ONcountdownMIN - 1;
      }
      if (ONcountdownMIN == -1){           //fan off at 0:0
        digitalWrite(evapFan, OFF);
      }
    }
      

  //evaporator fan OFF interval-------------------------------------------------------
     else {
        ONcountdownMIN = 1;                //ONcountdown reset
        ONcountdownSEC = 59;               //ONcountdown reset
        lcd.setCursor(5, 2);
        lcd.print("OFF for   :  ");
        lcd.setCursor(13, 2);              //fan minutes
        lcd.print(OFFcountdownMIN);
        lcd.setCursor(16, 2);              //fan seconds
        lcd.print(OFFcountdownSEC);
        OFFcountdownSEC = OFFcountdownSEC - 1;
        if (OFFcountdownSEC == -1) {       // on seconds counter
          OFFcountdownSEC = 59;
          OFFcountdownMIN = OFFcountdownMIN - 1;
        }
        if (OFFcountdownMIN == -1){        //fan on at 0:0
          digitalWrite(evapFan, ON);       
        }
     }
   }        
}

What you call a schematic is a wiring diagram and is missing a lot of information. I hope you are not in a hurry. First do you have any background in refrigeration, if so you know the compressor has a minimum off time IE when it is turned off it has to stay off for a period of time to stabilize and balance the high and low sides. There are also high and low side safeties etc to consider.

Wires connected to your Arduino make great antennas for collecting noise. The LCD wiring would be fantastic for that. Keeping the wiring under 10" will help a lot. Also be sure when logic and power meet it is at right angles, definitely not parallel. Using solid state relays with zero crossing for the AC would help a lot. You have a long way to go but this should give you a good start. let us know as you progress.

Thanks for your reply. No hurry, I have two of these coolers and only use one. Yes, I am aware that the compressor needs off time. Although I have not written it in yet, I add and make changes to the code as I go. Also, the only time I have the compressor active is when I'm trying to let it run a cycle. If not letting it run, I have it disconnected while I change things and reset/power cycle the arduino with a switch before the start capacitor. As for high and low safety switches, this cooler doesn't have any of that. Its the kind of cooler you would see in the checkout line at Walmart.

The wires between LCD and arduino board run through a channel along side 110 VAC, for about 3 feet...lol. I will re route this and continue. This is something I should have known, but did not think about obviously.

Would looping any thing through a ferrite magnet ring help? arduino to LCD, or power to arduino?

1 Like

Why ??

Why not put the UNO and display together and run the 4m of wire to the relay PCB?
I assume the buttons are at the LCD.
Where is the PIR?

Thanks... Tom.. :grinning: :+1: :coffee: :australia:

I had everything mounted in the top of the cooler where the old thermostat housing was. The relay board is here with the 110 wiring. I figured this was the best place for the Arduino as well to have short wire runs to the relay board and temp sensor. The LCD is mounted to the face of the cooler which I was able to move it and now have a total wire run of less than 24", and got it away from 110 ac. The motion sensor is down in the bottom mounted in the condenser Grille. Setpoint buttons are inside the door next to the light.

Im considering redoing all of it with the arduino and relay board easily accessible in the condenser area in the bottom. But this would make for a long wire run to the LCD again.

Further testing, It seems that everything functions okay, until after 10 minutes of no motion, and the relay for the light lets go. At this point, the screen freezes and the code loop stops.

@tmarsh1994, please do not cross-post. Threads merged.

FYI: I generally start with a 5 minute off time for small compressors. I think you have it under control. I am ready to sample goodies from the cooler:-)

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.