A simple question regarding npn transistor , please help

I have a NPN transistor - PN2222A , and I am using it for switching a motor - on & off...
So, my question is if I connected +ve 9v dc battery terminal to Emitter (of transistor) and I don't give any input to base (for switching it on), but I still get 5v dc on collector! , and which I give little current (from Arduino uno) on base to switch it on - it gives 7v DC on collector.
So, why I am getting the unwanted current on collector of transistor ,if I havnt switch it on? My motor automatically runs without switching on the current and after switching on current increases...

What am I doing wrong? Please help..
Any help will be appreciated.
Thanks.

Can you draw a simple diagram?
+9V on the emitter sounds wrong.

Oops, sorry mistakly replaced 'emitter' with 'collector' ,
My question is that I'm getting constant current in emitter without input in base.. I gone through data sheet of pn2222a but it looks fine.

I agree with AWOL, you have the connections to the transistor reversed. In an NPN transistor the negative terminal of the battery goes to the emitter. In a schematic diagram, electrons from the negative terminal of the battery flow against the arrow symbol in transistors and diodes. This is something that often confuses students, thanks to schools and text books that emphasize "conventional current flow" over electron current flow. You have probably destroyed the transistor by now, so you should replace it and this time ground the emitter to the negative terminal of the battery through a suitable resistor and connect the motor between the collector and the positive terminal of the battery. Don't forget to use a protective diode across the motor, or you'll destroy the new transistor. In this case, the diode's arrow (the banded side of the diode) should point toward the positive terminal of the battery to shunt reverse current when the transistor turns the motor off. Next, you said "I don't give any input to base", I'm not sure exactly what you mean by that, but when you get the emitter and collector connections fixed, you can't leave the base floating or the motor will probably turn on. The base should be pulled down by connecting the base of the transistor to the negative side of the battery through a suitable resistor, which biases the base and prevents the motor from turning on erratically. You can dispense with this if you're using a micro-controller, because this can be done by setting a digital output LOW and connecting it to the base through a suitable resistor (typically 1K). However, this only works if the micro-controller and motor are powered by the same battery and turned on and off at the same time by a physical switch. Once you solve the problem with the motor turning on by itself, then you can turn the motor on intentionally by setting the digital output of the micro-controller HIGH. I'm talking about the digital output connected to the base of the transistor through a resistor. If the transistor is not connected to a microcontroller, then you have to bias the base by connecting it to the negative side of the battery through a suitable resistor (typically 3K to 4K). This way, the motor will only run when it's connected to the positive terminal of the battery through another suitable resistor, typically 300 to 500 Ohms. I tried to cover everything in a small space, so I hope cramming in so much information was not confusing. If it's still not clear, then you need to study transistor theory.

When I finished my reply, I saw that while I was writing you posted a new comment saying you had the transistor connected correctly all the time and you just made a mistake in your description. That would have saved me a lot of writing if I had known that sooner. Here is the simple answer to your question: You need to pull the base low by connecting a 3.3K to 4.7K resistor from the base to the emitter. This will stop the base from floating and causing the motor to turn on. The easy way to remember this is to think of the transistor as a switch. In an NPN transistor, pulling the base low through a resistor (toward the negative side of the battery) turns the switch off (turning off your motor). Pulling the base high through a resistor (toward the positive side of the battery) turns the switch on which will turn your motor on. If you just leave the base of the transistor floating, then anything can happen and the transistor will probably turn on causing the motor to run when you don't want it to.

You do not have the problem of a floating base with BJTs - they are current controlled; they aren't floating like the gate of a MOSFET does.

Apart from wiring problems, which I hope you've sorted - the 2n2222 is quite a small transistor . It will only handle 600mA maximum.

What current does your motor draw?

Allan

While it's true that transistors are current operated devices, you can touch the floating base of many common silicon transistors with your finger and light an LED connected to the collector. The tiny current induced into your body by electrical wiring in the walls can be amplified enough by a single transistor to turn on an LED, even though there's not a complete DC circuit. A piece of wire connected to a floating base can do the same thing. Although a DC motor requires more current than an LED, an avalanche effect can occur once an unbiased transistor starts to conduct, pulling the base high internally. Mosfets, which are voltage operated devices, are more sensitive to stray electric fields than transistors; however, transistors are also unstable when the base is left floating and it's never good design practice to leave an input floating. Typically, the base of a transistor will oscillate when left disconnected and eventually settle in the conduction state. One explanation I've read for the base floating high said it's due to internal charge migration. I base my observations on working with discrete transistors and TTL logic for sixty years. There are many possible explanations for why this man's motor keeps running, including wiring mistakes he may have made, or a shorted transistor. I was attempting to suggest one possible solution to the problem based on the information he provided. It would be a simple matter for him to ground the base through a resistor to remove the possibility of a floating base as the cause of the problem. I challenge the person who went to all the trouble to criticize my explanation to offer his explanation for why this man's motor keeps turning on.

So, why I am getting the unwanted current on collector of transistor ,

You are not.
You might have an unexpected voltage but their is nothing in your description about a load so you don't have any current flowing.
Wiring up half a circuit and wondering why it is not behaving like you thought is a bit of a waste of time. Wre it all up and post a schematic. Have you a series resistor in the base?