Should I use a relay?

Hello, I am trying to control a 9v DC pump with an arduino. I am thinking that I will need to attach a relay to the pump, and control the relay with a transistor from my arduino. Is this correct?

sort by: active | newest | oldest
Yes. Make sure you put a diode across the relay coil, tie the diode's cathode (the end with the marking) to the most positive side of the supply, and tie the anode to the top of the transistor/connection to the relay.

KarateLover21 (author)  steveastrouk6 years ago
the diode is to make sure that no power goes back into the arduino?
dog digger6 years ago
You could use a mosfet. Make sure you use a diode on terminals
kenyer6 years ago
check this for nice schematics:

It helped me to understand relays.
The diode stops a very high voltage that will be generated in the relay coil when its switched off from damaging the Arduino.