Start - reset motor with arduino


in attachment you find the circuit i setup on breadboard. My local electronicshop help me out to do this. but, when my arduino pin 13 is low, the transistor dont turn off an motor stays on.

someone have a idea what i do wrong

The transistor is in the wrong place. The collector should be to the relay, the emitter at ground and the other relay coil lead to V+. The base resistor may be a bit high, too. 1K would be good.

You mean like this?

No, the relay coil goes above the transistor. Transistor emitter direct to ground. You also need a flyback diode across the relay coil driven by the transistor. refer to attached.

relay driver led.jpg

Looks good. I would go even lower on that base resistor. Taking it down to 220R will make 20mA coming out of the Arduino. That way you'll be sure to turn it on well. The other reason you keep it nice and low is it improves switching times.

If you go with 1K, that's about 4.3mA to the base and I see you were driving two relays. If each relay needs 250mA and the 2N2222 only has Hfe of 100, you are in trouble.

Why not connect the +side of your relays to +12V, then their switching off won't cause spikes on the Arduino's supply line and the 7805 won't have to work nearly as hard. Use 12V relays of course.

Lets be absolutely clear here - the relay coil must have a free-wheel diode across it
or else you'll burn out transistor. The page in the playground about driving a relay
shows the circuit to use.

The relay coil is highly inductive, if switching an inductor you must have a free-wheel
diode or some other sort of snubber circuit to prevent high voltages from being generated
(100's to 1000's of volts, instant death to most semiconductors).

And yes, never power a relay from the Arduino's 5V supply, that's for logic and sensors
only, not relays/motors/servos.