Hi, I have attached a DC motor according to the attached circuity image. It gets really hot near the 9v power supply, and the on board leds flicker. I used the official 9v power supply, any suggestions or comments?
Do not pass the motor current thru the Arduino board. You are using your Arduino as a rather expensive motor fuse! Even if the Arduino does not smoke, it may reset due to noise, brownouts, etc. The supply should go directly to the motor circuit.
You also need a resistor between pin 9 and the transistor base pin to limit current from the arduino and not burn the pin out.
150 ohm, 180 ohm something in that range.
I tried adding a resistor, but it still heated up. Is there another circuit i should follow?
If you run the sketch without the transistor, does it still get hot?
If so, you may have smoked the chip by not having the resistor, and you're pretty much hosed. Put another chip on the board. Don't leave out the resistor next time.
If it doesn't get hot, then you need to power the fan circuit from something else.