To test the wiring, we are going to use the program WiringTests which can be found in the VSCode folder of the RobotTools2021 that you can find here. If you don’t yet know how to load and run programs using Visual Studio Code, please review the following chapter of the Minibot tutorial: Running the program.
To test the wiring, load the WiringTests program into Visual Studio Code by choosing the File / Open Folder command and selecting the WiringTests folder found in VSCode.
Then execute the program and start the Pi Driver Station and enable the virtual joystick and Connect and Enable the robot.
Test 1 – Test the left motor and left encoder
Press and hold the B1 button. The left motor should turn on and the robot should turn right. If the motor runs backwards, or the right motor runs instead, check you motor connections.
After you release the button, the robot should stop. Then check the Terminal window at the bottom of the screen in VS Code. You should see something like:
This should show the speed of the robot. If the speed is zero or negative then you need to check the encoder connections.
Test 2 – Test the right motor and right encoder
Press and hold the B2 button. The right motor should turn on and the robot should turn left. If the motor runs backwards, or the left motor runs instead, check you motor connections.
As before, after you release the button, the robot should stop. Then check the Terminal window at the bottom of the screen in VS Code. You should see something like:
This should show the speed of the robot. If the speed is zero or negative then you need to check the encoder connections.
Once the motors are working correctly, you should be able to drive the robot with the virtual joystick.
Test 3 – Test the left IR Sensor
Before we run our test of the IR Sensors, we need to calibrate them. Take a white sheet and add a strip of black tape. Then turn the robot on and position it so that the two IR Sensors are over the white portion of the sheet. Then adjust the two little potentiometers so that the green light on the sensor comes on when the robot is over the white portion and turns off when it is over the black portion:
Now run the program and position the robot a few inches in front of the black tape. Then press button B3 and the robot should drive forward until the left IR Sensor is over the black tap
Test 4 – Test the right IR Sensor
Finally test the right IR Sensor by once again positioning the robot a few inches in front of the black tape and pressing button B4 this time. As before, the robot should drive forward until the right IR Sensor is over the black tape.