I have mechanical relays that are connected properly to my arduino mega that turn on respectively a bulb and a misting pump (for a terrarium).
Both relays are working correctly at first. But the misting relay which is triggered by the humidity insidd the terrarium malfucntion after some cycles of high and low.
What's happening is that at some point the relay is triggered to let the current pass but it does not open the circuit anymore.
I can see the led light on the relay module lighting perfectly according to my code but the relay does not click and keeps passing the electricity.
I have a 5V relay and verified with a multimeter and can see that it is getting 4.9V from the arduino.
The pump is connect to the NO (normally open) pin of the relay module.
I tried to change the module and it works fine for some time and then it stops let tge current in enven when the led is off.
The probrem is that the pimp is over heat because it is triggering while I'm away from home.
Anyone has a suggestion to help solve the issue ?
From your story it seems that the relay contacts for the pump are welded closed. This happens when switching an inductive load (pump), and you have forgotten to add a snubber circuit across the relay contacts.
Leo..
I don't think they are welded close because at first it was working correctly and then it started only passing the current.
I did though tried to test it with the following code
The behaviour was weird. The first 2 iteration it was passing the current on high and low without ticking noise while the led was turning on for high and off for low.
After the 2nd iteration I heard a ticking noise and the relay started working properly.
I then re uploaded my original sketch for the pump it worked for 2 iterations and then back to always passing the current.
I'm not sure what you mean by snubber circuit and what it is used for. Can you provide a schema that explains how to connect it and what it does please?
I will try at first the proposition of @xfpd by using an SSR.