Programming Arduino: In this step we program the Arduino (a basic controller) with a set of instructions so that it knows what to do when it received a signal either from the potentiometer or muscle signal  

NOTE: These instructions are for the Arduino-based version which is not the latest version and does not include the machine learning and pattern recognition approach we are taking to pick up muscle signals. It is therefore not suitable for use cases where the muscle signal strength is really weak. If you are want to build the more advanced version, please help us complete the final challenges we are working on: Help Needed.


Arduino + Potentiometer
   
 
Like mentioned in the previous step, using something like a potentiometer may be an easy way to get a usable device working really quickly. A Potentiometer is a Radio-dial-like knob that you can turn and which can simulate the type of signal we could get from a muscle. You turn it one way and the arm will pull up, you turn it the other way and the arm will go down again.  

To program the Arduino we used the same site that we found the wiring diagram from: http://www.silvinopresa.com/how-to/arduino/control-a-servo-with-arduino-and-a-potentiometer/   


 
#include <Servo.h> //include the servo library

//variables for the servo motor
int pos; //declare variable for servo position
int servoPin = 9; //declare the pin where the servo is connected
int servoDelay =15; //delay to allow the servo to reach position and settle down
int potRead; //declare variable for the value read from the potentiometer
int potPin = A0; //declare the pin where the potentiometer is connected

Servo myServo; // create a servo object calle pointer

void setup() {
  myServo.attach(servoPin); //declare to which pin is the servo connected
}

void loop() {
  potRead = analogRead(potPin); //read the potentiometer
  pos = (170./1023.)*potRead+5;  // calcuate the position from the potentiometer reading
  myServo.write(pos);  //write the position on the servo
  delay(servoDelay);
}
 
Arduino + MyoWare Muscle Sensor
   
 
Like mentioned in the previous step, If you have a strong muscle signal to use then you could try the using a MyoWare muscle sensor to control the actuator. In our case, this only really worked for me and not my daughter as her signals were just too weak. However, if you want to test this out, here is a video we used to figure out how to do that:  https://youtu.be/-JYi08WKe6c


#include <Servo.h> Servo myservo; const int threshValue = 250; void setup() { myservo.attach(9); } void loop() { int value = analogRead(A3); if(value < threshValue) { myservo.writeMicroseconds(800); } else { myservo.writeMicroseconds(2250); } }


Optional - Help build next version
   
 
The next version of the assistive arm that we are currently working on will not use the Arduino, potentiometer or the MyoWare muscle sensor but rather a series of electrodes that will provide a Raspberry Pi up to 8 separate raw signals from the limb. The onboard software will learn to recognize the unique signals being produced by the limb and use those to control the assistive device. 

With this approach, we were able to consistently pick up my daughter's muscle signals! If you want to help us with this challenge please go to this page: Help Needed.
 





 
Step 1 - Understanding the problem
 
  Step 3 - Measurements & 3D designing