Arduino Uno - Operating Power Contactor Switch 230Vac

Hello,

I'm currently using an Arduino Uno to operate the switch ON/OFF of two power contactors.
A relay shield is doing the switch control of the contactors.

The code seems to be working properly.

A cycle would be considered when the loop is done. I'm facing some issues having the loop executing more than a couple of hundred cycles.

The goal is to have around 7500 cycles performed and the maximum I observed so far is 450 cycles, then the code is stopped and does not operate the relay anymore.

Does this stop could be related to EMC issues? I observed that sometimes the counter is not written properly on my serial monitor, which might cause the program’s stop. The Arduino is powered with USB cable. Thanks in advance for the feedback.

Here the code I'm currently using :

const int mainsPin = 7;

const int mainsPin2 = 6;

int ct = 1;

void setup() {

pinMode(mainsPin, OUTPUT);

pinMode(mainsPin2, OUTPUT);

analogWrite(mainsPin2,0);

analogWrite(mainsPin,0);

delay(1000);

Serial.begin(9600);

}

void loop() {

while (ct < 7500) {

analogWrite(mainsPin2,255);

analogWrite(mainsPin,255);

delay(1000);

analogWrite(mainsPin2,0);

delay(1000);

analogWrite(mainsPin,0);

ct = ct + 1;

Serial.print("ct: ");Serial.println(ct);

delay(13000);

}

}

you have to be carefull when operating power contactors, the 'spikes' on power lines can reset the Arduino - in particular if the loads are inductive, e.g. motors, pumps, etc
on a system I built some time ago

  1. powered the Arduino from an good quality external power supply
  2. used opto-isolated relays to drive the contactors
  3. use screened cable to connect the relays to the contactors

the above was only a prototype - for the production system a PCB was designed and implemented

how do you connect the Arduino to the relays? dupont 'jumper' wires? very unreliable!
use a developmenmt board with screw or solder terminals

I don't think this is the issue, but you'll need to fix the PWM pins you're using for your analogWrite output. On an UNO, the PWM pins are: 3, 5, 6, 9, 10, 11. NOT 7.

Does the cycle complete if the mains power is off? (to eliminate interference as a cause)

arduino

Currently using the black relays that are connected directly to the Arduino
Does these relay Opto-Isolated ? not so sure about this
First I was using the blue ones and tought that having relays directed connected to the Arduino would help. This is not the case it seems to have even more shut down when directed connected.

One of the contactor is a resistive load of 32A.
I'm generating inrush current on the other one. This would make total sense with your feedback.
Thank you for the feedback

I'm using pins 6 and 7 because these are already defined in the relay shield.

When I was using a traditional relay with wires connected to the pins I was using numbers 9 and 10.

I faced the problem in both configurations.

Regarding the power supply, when I disconnect the power supply (5V USB cable), the cycle will interrupt.

Thank you for this feedback

These are equivalent to:
digitalWrite(pin, HIGH);
and
digitalWrite(pin, LOW);

Using 'analogWrite()' on digital pins is confusing.

Sorry - I meant the high-power lines that you are controlling. Do you still have the problem if you only flip the relays on and off without the high-power connected to (through) them?

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