As the control of the hand is based around many, repeating PID loops, the Arduino control code is designed to be modular, easily expandable and repeatable.
Each joint is based around a simple array which contains all the important data. The source code is available on the GitHub page.
The array for each joint contains the following data:
Kp |
The Kp, Ki and Kd are the constants used to tune the PID control loop for each finger. |
Ki |
|
Kd |
|
Motor pin 1 |
The motor pins are the physical PWM pins used by the microcontroller to control the H-Bridges. |
Motor pin 2 |
|
Output |
The Output is value (between -255 to 255) for the H-bridge control function to pulse the PWM outputs. |
Setpoint |
The Setpoint is the angle (in degrees) desired for each joint. |
Angle |
The angle is the current position of the joint translated into degrees. |
Analog Sensor pin |
The analog sensor pin is the physical ADC pin used for that joint to read the feedback potentiometer. |
This allows the code to be quickly expanded to allow for new joints.
All that is needed is to add a new array following the above method, the relevant values added and the PID control loop code cam then be replicated, linking instead to the new array. This makes adding newjoints very quick and easy.