I experienced a weird error with one of my homecontrollers. The controller consists of a Nano, Touch-Module, DHT22, CAN-Bus module and LM2596 DC-DC converter. One digital output triggers a 12V Power relay with optocoupler (image of relay ). On the power side of the relay are two 230V Led lamps connected. With the hit of the touchswitch the Nano should switch the relay module. The lamps are connected to "Normally opened" and is closed when a touchevent occurs. The touchevent has a timedelay after it registers a touch to prevent double clicks or other capacitive events in the short time a touch happens. Here is a short diagram of my setup and the bare minimum of the code responsible for switching the relay.
#include <Arduino.h>
#include <Logger.h>
const uint8_t SWITCH_PIN = 7;
long touchdelay = 2500;
long t0 = 0, t1 = 0;
bool touchevent = false;
bool isOn = false;
void setup() {
Serial.begin(9600);
Serial.println("--- Setup ---");
pinMode(SWITCH_PIN,OUTPUT);
// Initialize external IC via SPI
delay(100);
t0 = millis();
}
void loop() {
if((millis()-t0) > touchdelay) {
touchevent = true;
}
//touchevent is triggered via SPI
if(touchevent) {
if(isOn) {
Serial.println("ON");
digitalWrite(SWITCH_PIN,LOW);
isOn = false;
} else {
Serial.println("OFF");
digitalWrite(SWITCH_PIN,HIGH);
isOn = true;
}
t0 = millis();
touchevent = false;
}
delay(1);
}
Usually the relay switches correctly, but since last week the LOW signal seems to not fully switch of the relay. The HIGH event is clearly audible, but when the LOW signal is triggered only a faint clicking sound is noticble and the relay keeps "stuck" and is not opened (light keeps on). Hitting the switch again (HIGH), the clicking sound is loud again (light keeps on).
It is impossible to switch the light off.
Disconnecting the Nano also keeps the relay closed (light on). This seems very odd since the relay should be normally opened. Only after disconnecting the mains the functionality is restored.
My question: Can the load of 2x7W Led Lamps (230V) influence the switching behavior of the relay? Is there a guaranteed method to switch the relay off in such a case?
The module runs now with the code above ~1h with a switch event every 2500ms and not one event seems to stuck the relay.
If you buy a 10A 240VAC relay on AliExpress, then it can switch 0.5A at 12V. Well, maybe, if you are lucky.
Do you know if that module is manufactured according to the regulations in your country. I doubt it.
Perhaps the LED lamp has a high inrush current.
I would use a SSR (Solid State Relay). No more sparks or melting contacts.
@Koepel The ones I used in my home were purchased over Reichelt (no longer available). I only use Ali-Modules for prototyping. The sound the relay makes is also sort of a acknowledgment, that the action is triggered. How does the inrush current affect the coil being driven?
@runaway_pancake I connected the 'hot' wires with Com-NO. My idea was to break the connection of the 230V line. Can you explain the difference of your wiring scheme?
Reichelt should buy from known sources, it should work according to the specifications.
If the coil is deactivated, I assume that there is something mechanical that you can hear, even though the melted contacts stay together.
It is a known problem with relays. Most relays have hardened metal at the contacts to avoid this. Only a little sticking force is needed to prevent that they open for cheap relays.
Can you remove the relay from the circuit and measure the contacts with a multimeter ?
If they are stuck together then try hitting the relay to something, that might help.
Once the contacts are bad, there is no way back, unless you want to sand the contacts with sanding paper. But if the contacts are rough, they will stick sooner.
I meant a inrush current for the LED lamp, that goes through the contacts.
The LED lamp could have a rectifier with a capacitor behind it, that might cause a high current inrush pulse.
I think that sparks are the main problem. They happen when the relay is released and oxide/burn/melt the contacts a little.
LED lamps come with many different circuits. I learned that from watching the channel BigCliveDotCom.
Since my last testrun, the relay switched 720 times (every 10s for 2 hours). If the relay contacts were to be fused, shouldnt it be permanently faulty?
Sounds like contact welding. Rap it once with the handle of a screwdriver and maybe it will unstick.
But the CAUSE is overcurrent. You need a better relay or snubber on the contacts or both.
Realize that you need to derate components from their peak/maximum ratings to 75% for what you can expect them to operate at continuously. So you shouldn't run more than, say, 7.5-8.0A thru a set of 10A contacts without risking what you're experiencing -- contact welding.
LED lamps shouldn't lead to contact welding.
Every 10 seconds for 2 hours seems excessive, that would be a heavy duty application, "in the field", even for quality relays.
10s for 2 hours ON\OFF: Test if it happens after x-amount of times
1 hour ON, 10min OFF: Testing if the error occurs when there is a constant load on the relay (~2*0.5A)
So far the error did not occur. In the afternoon I will reupload my complete code on the controller. I made some comsetic changes and removed everything and replaced the touch part with a mechanical switch (digital input D6). Since only the variable "touchevent" was changed, I doubt the other peripherals have any influence on my current problem. I will report back after some testing time.