Transistors

Can I use a transistor so when I set a digital pin to high it will turn on a different circuit with a motor in it.

And whats the difference between the NPN and PNP transistors and which one should I use.

Can I use a transistor so when I set a digital pin to high it will turn on a different circuit with a motor in it.

Sure, it's done all the time. Note that the grounds for the Arduino and the 'different circuit' have to be wired together. Also you need to size the transistor for the current and voltage that the motor uses. Here is a simple circuit to drive solenoid coil, but works the same for DC motor. Note that if you utilize a Arduino PWM output pin you can vary the speed of the motor with the same circuit.

http://www.arduino.cc/playground/uploads/Learning/solenoid_driver.pdf

And whats the difference between the NPN and PNP transistors and which one should I use.

Most Arduino switching applications use an NPN like shown in the link above. Also logic level MOSFETS are very simple and useful for this kind of switching applications. If you need bidirectional speed control then you are probably better off buying a motor H-drive shield.

Lefty

NPN vs PNP: You can think of them like this: NPN wants to act like current sink - turn it on and its like you are switching the connection to ground on. PNP wants to act like current source - turn it on and its like you are switching the connection to the positive supply on. Here's a link to a motor H-Bridge that illustrates that: http://www.robotroom.com/BipolarHBridge.html When Q4 turns on it sources current to the motor which Q1 sinks to ground. The motor turns. When the other pair turns on, current flows the opposite direction in the motor and it turns the opposite direction.

Thanks.

On the link http://www.arduino.cc/playground/uploads/Learning/solenoid_driver.pdf is it possible to use a TIP120 NPN-D Trasistor instead of the TIP102.

A TIP120 is a npn Darlington transistor normally selected for it's very high current gain. However for your application it would most likely work fine if it's what you have on hand or available locally.

http://mediastudy.buffalo.edu/Robotics_Inventory/sheets/TIP120.pdf

If I use the TIP120 NPN-D Transistor will i still need heat sink on it?

It it gets too hot, yes, if not, no. I think it will be fine but sometimes you just got to jump in and give things a try for yourself. People far smarter then me let the magic smoke out once in awhile. ;)