DC Motor to Sweep from Position 1 to Position 2

I quickly put together the attached circuit for a bidirectional motor that I need to move back and forth from point A to point B to point A to point B, etc.

Here are the components I’m using:
Q1 - TIP 120 (max Ic = 5A)
Q2 - PN2222 (max Ic = 600mA)
D1 - Chanzon 6A10 (6A, 1000V diode used for flyback to protect TIP120)
RY1 - RT424012 DPDT Relay (8A, 12V)
M1 - CQRobot (12VDC gear motor with encoder)

Setting pin 6 to “HIGH” on the Arduino turns the motor on
Setting pin 5 to “HIGH” on the Arduino reverses the current direction of the motor.

Does this motor have a motor driver included? Is that why it appears that one isn’t needed for this to function? This circuit works with the use of Arduino IDE and Processing.

What I want to do is be able to turn the motor on with the press of a button and have it sweep back and forth from a specific position to another position then back repeatedly for a certain amount of oscillations or time. However, I am unsure how to use the encoder on the motor. Do I need to purchase a motor driver to do this? If so, what kind specifically should I buy?

At this point, I can have it go forward for a certain amount of seconds then reverse for a certain amount of seconds. I want it to move to each position.


The back-emf diode is drawn the wrong way.

The encoder can be used to keep track of the rotations (position) of the motor.
If you decide to use it, then you can make exact sweeps.

You're right about diode direction so that the current is sent to the relay and not the transistor.

Thank you. I've realized that, in my circuit, I have essentially created a motor driver. I am currently researching how exactly to use the encoder and where to make the connects/how to code it.