# A Neuro-Prosthetic Device for Substituting Sensory Functions during Stance Phase of the Gait
## 2 Materials and Methods  
### Hardware Set-Up  
Our balancing device includes three cores: sensing, analytical, and stimulation. The stimulation core includes electrical charge delivery. The sensing core consists of four IMUs connected to Teensy 3.2 using two I\({}^{2}\)C buses. These IMUs are attached to the pelvis, femur, tibia, and metatarsus of the dog hindlimbs to obtain rotation rates and acceleration data of these joints and bones as the dog walks. Using these data, the analytical core can calculate hip, knee and hock joint angles during walking and stimulation. The analytical core also calculates the stimulation command based on a selected strategy. The stimulation signal then is applied to Pulse Width Modulation(PWM) pins connected to H-bridge and stimulation circuit and, when fully implemented on an actual dog patient, electrodes. Each H-bridge (TB6612 FNG dual motor driver carrier, PoloThe Teensy microcontroller uses PWM output to adjust the intensity of stimulation based on pelvis angle of rotation obtained from IMU #1 and the specific strategy. Electrodes deliver charges to the target muscles and make the stimulation core of our device. To test our device using our robotic dog test-bed, we removed the electrodes and stimulation circuits and connected the Teensy output to the robot joint motors using our two TB6612 FNG dual motor driver carriers [34]. We also read the robot joint potentiometers and obtained data from these sensors as well. These potentiometers read the position of the motor shaft and report accurate joint angles. However, we used the data obtained from potentiometers only for comparison with and validation of the data that we derive from IMUs about joint angles. All the device cores and device to test-bed hardware connections have been listed in Table 1.  
Figure 3: Device hardware. Our robotic test-bed is shown in Figure 4 with IMUs of the device attached to the right limb. Our robot dog is in a balanced posture at Figure 4a and the unbalanced posture with inclined pelvis tilted to the left has been shown in Figure 4b. We have designed this robot based on the anatomy of dog hindquarters with three motor-potentiometer joints for this robot to mimic hip, knee, and hock joint angle movements. We have simplified the dog hindquarters and modeled each limb as a three-link manipulator shown in Figure 5. In this model, ball and socket joints and motor-potentiometer joints can provide rotational movements while rod and bushing joints can provide both rotational and up and down movements. Our test-bed design, based on this mechanism model, provides hindquarter motion and rates that compare accurately with those of an actual dog [19]. In Figure 5, we have shown the orientation of the IMUs. Using IMUs, we can read the velocities and accelerations in three directions and we use 'Direction Cosine Matrix Filter' [35] to filter IMU noise and calculate Roll, Pitch, and Yaw angles of IMU simultaneously. IMUs are calibrated based on a multi-position optimization method. They need to be moved by hand in multiple directions and placed in a set of different static positions for calibration before they are used. An open access Arduino library is available to acquire a set of data from the IMU and calibrate Pololu IMU products [36]. For our application, the robot leg moves in a sagittal plane of the robot dog only, and the roll angles of the