I have a circuit similar to the attached pic. To describe this, I have a 12v/5a power source which is split between feeding the MOSFET and a fixed 5v regulator. The output of the 5v regulator feeds the Arduino and has a 1000uf capacitor. A digital output of the Arduino triggers the MOSFET which supplies power to the 12v bell.
What happens is sometimes it seems to get ‘stuck’. I am trying to make the bell ‘ding’ rather than ‘ring’ so am writing high, delay of 25, writing low. If I wish to ring the bell multiple times (max. 3) I delay 75 and then repeat. The code is written in such a way that it should be impossible for the bell to sound more than 3 times or for more than the combined time that 3 times should take. Infrequently (1 out of 10, sometimes more often, sometimes less) it seems to get ‘stuck’ after I set high and so the bell continues to ring indefinitely. At this point the only way to recover is to reset the Arduino. It does/has worked, but sometimes doesn’t.
Thanks all for the responses. I should have clarified the diagram is a approximate representation, the mosfet is wired the correct way but shown incorrect in the diagram.
@Railroader@jim-p I will try a kickback diode. Any advice on diode selection? I’m have a bunch of 1N4001s kicking around. And just to check this is a diode ‘reversed’ (diode + to bell -, diode - to bell +) in parallel with the bell itself?
Would likely work but personally I would use a 1N4007 if I had it.
Yes. Think like this: The current through the coil flowas from positive to negative. When the relay/transistor brakes the flow the diode should carry the current through the coil in the same direction.
Diodes had anodes amd kathodes, not + or -.
Why.
The 1N4001 is better suited for low voltage.
And the diode will never see a higher reverse voltage than the supply.
I never understood why people prefer the 1N4007 for low voltage applications.
Vf is a bit higher and the 4005-4007 group is a bit slower than the 4001-4003 group.
Bigger is better doesn't work here. Not that it makes a difference in OP's application.
Leo..