Many projects with Arduino often need motors, whether it is a car or a vacuum cleaner or anything else. But the problem is that you cannot connect a motor directly to Arduino as the output current is very low. So, you can use an H-bridge circuit to operate the motors. The H-bridge circuit can operate the motors in both directions (clockwise and anti clockwise), but in many projects you don't need a motor to turn in both directions (e.g. fan). In such cases, it is a waste of money to buy an H-bridge circuit. So, in this instructable I'm going to show you how to make a motor driver board using transistors which can power two motors. This motor driver board will be able to operate the motors only in one direction, but would be cheaper than an H-bridge (E.g. For me, H-bridge would cost about Rs 150+ , whereas I could make this board in about Rs 30); and more importantly it's fun to do it.
Step 1: Components and Tools Needed
2* BC-547 Transistor (NPN)
2* 1k Ohm resistor
2* capacitor (between 1 and 5 uF) (I used 2.2 uF)
Perf board (Any size you like, you can cut it later)
Bread Board (for prototyping)
Single stranded wire
Arduino (Any will do)
Step 2: The Circuit
Now, for the circuit. There are two transistors which do the same thing, have the same connections except the motors they power are two different ones, and their bases are connected to two different pins on Arduino, one is connected to pin 10 and the other 11 (refer to first picture).
When either of the transistor's base goes HIGH, it forms connectivity between the collector an the emitter (refer to the second picture) . As +9v is connected the collector and the motor is connected to the emitter the motor starts spinning (refer to the first picture). The capacitor is connected to protect the Arduino from noise created by the motor.
Now assemble the circuit on your breadboard, as it is not a good idea to do it on the perf board before making sure that your circuit is working (diagram shown in first picture). To make sure that your circuit is working upload the sketch given below. Connect the battery as shown in the first picture.
If your circuit works, then the motor would be stationary at the beginning then will gradually increase its speed then stop again (the same thing would keep repeating).
Step 3: Perf Board It!!
If your circuit works then it's ready for perf boarding. I haven't made it as a shield because it uses very few pins of the Arduino so, it is much harder to make it as a shield. Instead I have made it as a separate board with wires sticking out of it which you have to connect to the Arduino. But if you like, you can make it as a shield (here is a link to help you on how to make shields - https://www.instructables.com/id/How-to-Make-Custom...) .
To create a circuit board, solder all components shown in the fritzing image above to your perf board (except for the Arduino, of course). If you don't know how to solder on perf board watch the video below (This is not my video, of course).
After you have finished soldering on the perf board, test it out and your motor driver is ready!