Hi,
I am currently working on a circuit that is going to turn a light bulb on when i double clap.
So far everything is working, I manage to recognize claps, and turn an LED on whenever i double clap.
But when i am connecting the relay through an optocoupler and a transistor - of course mi have a flyback diode at the relay -, the relay behaves strange.
It turns on but doesn't make the clicking noise. When I directly connect the relay coil to 5V and GND it makes the clicking noise. And if i upload a code to the arduino and the IO pin goes low, it clicks, but when im using digitalWrite() or the port manipulation it doesn't click.
I measured the current across the coil, if directly connecting it was 62 mA, if through the arduino signal its 60mA. I hope that 2 mA doesn't make so much difference.
I guess this may happen because the arduino might change the voltage slower thus the build up and collapsing of the magnetic field is not so rapid, thus the relay switches on more smoothly.
At this point i only connected an LED and 5V to the switch of the relay.
It works reliable.
But my main question is that is it gonna be safe to connect the mains voltage to the relay if it behaves like that or might it become unreliable?
The relay is an SRD-05VDC-SL-C.
The datasheet says the nominal coil current is 71.4 but even if connect directly to 5V 62 mA flows, i hope that is not an issue.
And as the transistor i am using an irlz44n mosfet at the moment.
Thank you very much in advance for any help and advice.
Best wishes, Agoston.