The motor is connected between the two poles of the relay contacts. The relay which switches the two circuits is controlled by a 2n2222 npn transistor which is activated or deactivated by one of the digital outputs from the arduino board.

2 Simple Bidirectional Motor Controller Circuits Explored
Bidirectional motor control using relay. This is a simple and easy to construct circuit that can be used to provide a bidirectional drive to a dc motor. The coil terminals of the relay are connected to the supply with a push switch. So the motor terminals will have a positive polarity on the left side and a negative polarity at the right side. The negative wire from the 9v battery will connect to both of the nc bottom inputs. The following circuit allows a motor such as a train to travel in the forward direction until it hits the up limit switch. How to make dc motor forward reverse control using relay diy project the backbenchers diy duration.
Output of an astable mutivibrator based on ic1 ne555 is used to control the relay rl1 driving the motor. It operates on 12 volts and the ba158 diode protects the transistor against the return currents that can occur when the coil is depolarized. The circuit operation is straight forward. The switch s1 and s2 control the relay 1 and relay 2 respectively. Connect normally closed terminal of both relays to positive terminal of battery. Connect normally open terminal of both relay to drain terminal of mosfet.
The trasnsitor based h bridge can control the motor speed using the pwm technic which is nothing more than a fast flickering of the transistors. Make the connections according to it. In the circuit diagram shown the switch s1 is on and switch s2 is off. This input is perceived by the motor as an intermediate voltage and not as a stream of onoff voltage. In this project both wires from the motor will connect to both of the com middle inputs of the relay switches. The train travels to the down limit switch and reverses.
The positive wire from the 9v battery will connect to both of the no top inputs. This sends a pulse to the latching relay to reverse the motor and ends the short pulse. A circuit which allows a connected motor to operate in clockwise and anticlockwise directions through alternate input triggers is called a bidirectional controller circuit. Circuit diagram of this bidirectional motor control project is shown in image below. The backbenchers diy 3947 views.