The first thing we need to do is provide power for the robot. For this you will need some kind of battery. We need to create the wiring cable which will connect the battery to both the Arduino/Raspberry Pi and the Motor Controller.
I am using a two cell NiMh battery with a Tamiya Big Style connector and I have created a wire cable which plugs into the battery’s connector and then splits to provide power to both the Raspberry Pi and Motor Controller. The cable I created looks like this:
And when it is wired to the robot it looks like:
Pay very careful attention the the order of the black and red wires for both the connection to the Arduino Board and the Motor Controller. Connecting these in the wrong order will lead to a very bad result.
Next, connect the power to the left and right motors as shown:
Next use a four conductor jumper wire to connect pins 4, 5, 6, and 7 of the Arduino to the Motor Controller. You don’t need to use the same color wires, but the connections should be made in the order shown below
Now attach a four conductor jumper wire to the left wheel encoder as shown below. Make a note of which color wire represents each signal type, Signal A, Signal B, 5v, and Ground:
Then attach the other end of the four conductor jumper to analog pins 0 and 1 of the Arduino. Take care to match up the pins with the signals as shown below:
Now repeat the process for the right encoder. Attach a four conductor cable to the encoder as shown below:
Then attach the other end to the Arduino analog pins 2 and 3:
Now attach 2 three conductor jumpers to the two IR Sensors as shown below:
Then connect the other end of the right IR sensor to pin 11 of the Arduino and the left IR Sensor to pin 10 of the Arduino as shown below:
Your robot is now wired.