Spring 2017 Prosthetic Arm: Finite State Machine Servo Test

The Robot Company | CEO Dr. Gary Hill

Blog Post Created by Project Manager | Bianca Esquivel

Project Test Executed by Mission, Systems, and Test Engineer | Phuong Tran and Electronics and Control Engineer | Mikael Movsisyan

Preliminary Information

Test Objective

This experiment was performed in response to requirement

L1-2 Integration: Together, the hand and arm shall be able to perform 3 tasks: pick up a cup of water, a Chips Ahoy cookie, and operate a computer mouse to play a game of minesweeper.

L2.2.1 Wrist Rotation: The prosthetic hand shall provide a 90 degree rotation at the wrist. (clockwise/counterclockwise)

Problem: Write Arduino code to rotate servo only when the EMG sensor detects muscle contraction. Realization of this experiment will prevent servo rotation when the muscle is relaxed.

Materials

  • EMG Sensor
  • MG996R Servo
  • Arduino UNO
  • Arduino IDE

Test Set Up

Steps:

Step 1: Connect the EMG sensor to analog pin 0 on the MCU to read analog input.

Step 2: Connect the servo the PWM pin 9 on the MCU.

Step 3: Write Arduino FSM code to create 3 states: [Fig. 1] [Fig.2]

  • State 1: When muscle doesn’t flex, do not rotate servo. This is the default state. Program will remain in state 1 until muscle is flexed.
  • State 2: State is entered when muscle is flexed and consecutively relaxed. Servo rotates 60 degrees. Program returns to State 1 automatically.
  • State 3:  State is entered when muscle is flexed and consecutively relaxed. Servo rotates 180 degrees. Program returns to State 1 automatically.

Step 4: Edit code such that when the conditions of muscle contraction and relaxation are met, the transition from S1-S2 and S1-S3 alternate.

Results

Successful FSM state transition ensures servo rotation, hence wrist rotation, when the appropriate conditions of muscle contraction and subsequent relaxation are met.

FSM States

FSM Firmware

Conclusion

FSM Code can be implemented in the main program code.

Link to Code:

https://drive.google.com/open?id=0B6kkqAMmUffrbTRQZnJfYzloUjg