Motor driver using only a 2N2222 transistor?

Well, by motor driver... you could mean anything.

Is the motor AC or DC? Do you want to be able to vary the direction of the motor? How about the speed? What about braking the motor?

A 2N2222 is quite a powerful transistor, but is only good up to 800mA or so. So any motor you use must not consume more than this current when spinning and when stalled, or the transistor may burn. Also, the 2N2222 is rated for 40V maximum, so you can't drive high voltage motors.

Here is probably the simplest circuit:

+12V ---------+---------+
              |         |
             / \        |
             |M| motor ---  1N4001
             \ /       / \
              |         |
              +---------+
              |
            |/
CTL -/\/\/--|    2N2222 NPN
      1k    |\>
              |
             ---
              -

The 1N4001 is a flywheeling diode. As the motor is an inductor, when you turn it off the energy has to go somewhere. The diode provides a path for this; otherwise, the transistor could be burnt out by switching the output off.

This "driver" allows you to run the motor forwards and coast it. With PWM, you can vary the speed.

Here is a H-bridge using four 2N2222 transistors.

+12V --------+------------------------+
             |                        |
      1k    /  c                    c  \   1k
1 --/\/\/---|   2N2222        2N2222   |--/\/\/--- 3
            \> e                    e </
             |       +       -        |
             |-------- MOTOR ---------|
             |                        |
     1k     /  c                    c  \   1k
2 --/\/\/---|   2N2222        2N2222   |--/\/\/--- 4
            \> e                    e </
             |                        |
            ---                      ---
             -                        -

Making S1 = 1, S2 = 0, S3 = 0, S4 = 1 the motor would go forwards

Making S1 = 0, S2 = 1, S3 = 1, S4 = 0 the motor would go backwards

Making S1 = 0, S2 = 0, S3 = 0, S4 = 0 the motor coasts

Making S1 = 1, S2 = 0, S3 = 1, S4 = 0 the motor would brake (slow down quickly)

Making S1 = 0, S2 = 1, S3 = 0, S4 = 1 the motor would also brake

Making S1 = 1, S2 = 1 would be bad and should be avoided. It would cause both transistors to come on giving a direct path to ground. The transistors would burn up, and you could damage your power source. The same applies for S3 = 1, S4 = 1, as well as setting all switches on.

There should also be diodes across each transistor, anode to the emitter. For simplicity and due to the text-only media, I omitted these. Use the same 1N4001's.

You could also replace the 2N2222's with something else to allow it to drive heavier loads. With heavier loads it's a good idea to use heatsinks on each transistor.

The inputs can be controlled from an Arduino.