Step 8: Setup
Test the electricals
It is possible that the wiring of the accelerometers and the motors results in the motors turning in the opposite direction to what they should when the controller is tilted. This is best tested without the strings connecting the motor shafts to the board.
1. Hold the board as close to horizontal as possible, and tilt the controller until the motors stop. If the controller is not horizontal then you should adjust the flat accelerometer values in the Arduino code.
2. Tilt the controller slightly in just the X or Y plane and the corresponding motor should start turning. Tilt the board in the same direction and the motor should slow down and stop when the board is at about the same tilt as the controller. If the motor actually speeds up, then you need to swap the values of the variables tableXmin, tableXmax or tableYmin, tableYmax.
3. Repeat in the other direction
4. With the board and the controller horizontal so the motors aren’t turning, tilt the controller in one direction and watch the spin direction of the shaft that will be pulling the string. If the string was being wound onto the underside of the shaft, would it be pulling the board in the correct direction? If not, reverse the wire connections on either the motor or the motor driver board.
5. Repeat in the other direction
Attach the string
1. Tie a hook to one end of the string.
2. Attach it to the loop on the underside of one edge of the board.
3. Thread it under the pulley and then around the shaft in the motor housing. The string should feed onto the shaft from the underside of the shaft.
4. Wind three loops around the shaft and then out to the pulley at the other side.
5. Hold the board level and position the three loops around the shaft so that they are in the middle of the length of the shaft. This will avoid the string getting jammed at one end of the shaft when the board reaches full tilt.
6. Tilt the board to add tension to end of the string already attached to the board.
7. Pull the string with similar tension at the other end, and attach a hook at a suitable place on the string to keep a solid tension.
8. Attach the second hook to the loop on the underside of the board.
9. Manually tilt the board up and down to check that the tension is enough to move the motor shaft without slipping, but not too tight.
10. Repeat with the other string.
Adjust PID factors
Now, connect the battery and test the responsiveness of the system. The board should follow the movement of the controller with minimal lag or overshoot. To speed up the movement of the board, increase the Kp (proportional) factors in the Arduino code. If Kp is too high, the board will start to oscillate. The increase in speed will result in some overshoot on rapid movements. This can be reduced by increasing the Kd (differential) factors. If Kd is too high, the board will oscillate wildly. You’ll probably need to experiment with Kp and Kd factors for a while to get the optimal performance. The Ki (integral) factors are not needed in this case since they are more for helping to achieve exact absolute positioning. Since the board is always moving, we can ignore these so they are set to zero.
Setup the body controller
The rangefinders should be attached to stands at between 900mm and 1200mm (3 to 4 feet) off the ground. One is positioned on the other side of the board from where the operator will be standing. The other is about 900mm (3 feet) off to one side of the operator, orthogonal to the first.
Press the Mode switch to change to body controller mode, and adjust either the position of the rangefinders, or the distanceXflat, distanceYflat variables in the Arduino code until the board is flat when the operator is standing in a central position.
There are a separate set of PID variables in the Arduino code that will need to be adjusted for optimal performance.
Setup the Android controller
There is another set of PID variables in the Arduino code associated with the movement of the Android controller. These will need to be adjusted for optimal performance.