Hello friends, greetings. I have designed a robotic arm based on emg signal extracting from biceps. The emg signal I extracted using amplifiers is faithful and reliable. So to interface it with the arduino board I am giving emg signal to analog pin of the board and did common ground (of both emg circuit and arduino board). The robotic arm I have constructed have three servo motors:
Base (shoulder)
Elbow
Wrist
Well, I want to control base servo motor using emg signal and the other two servo motors should actuate with the base motor movement using arduino control, i.e;
What code do you have now? What values are you getting from the analog pin? How do you intend to map those values to the servo limits? What kind of servos are they?
Elbow motor activate using base motor movement
Wrist motor activate using base motor movement.
You don't just "activate" a servo. You tell it to go to a specific position (or to rotate at a specific speed).
Starting a robotics project it is best to start small and work your way into something that is larger. Do a simple thing with small cheap servos then build it more powerful and elegant latter. Throw all the large cheap scavenged parts into a back pack or something with power and control wires to the arm until you can engineer it down to be just an arm.
The sweep example for arduino is best to start as it shows how something like a pot can control the position of the servo even though they are two different creatures.
Your project requires a couple things:
Understanding the signal coming from your sensors.
is the signal magnitude or on/off or multiple on/off? Do you want to signal it to start, and signal again to stop moving?
is there noise on the signal where values below a certain value should be ignored?
can the signal to move the servo be either translated from digital into a range of values or is the signal a 0-x volt range (where a resistor can scale the voltage of the signal down to an easy to interpret 0-5 volt range.
Servo
-you say you have your servos, but most servos are useless for holding a can of coke because the the scale of the forces involved with the task is way out of range.
-I recommenced using an ultra high torque servo. http://www.servocity.com/html/spg785a-5_0_servo_gearbox.html
They are bulky but being able to lift a 6-pack of tasty beverages is way more useful.
-you will need the microsecond range (or degree) that each servo needs to travel to accomplish its task.
-direction, start, end positions, power requirements need to be known for all the servos. Make a chart, make educated guesses.
-borrow a variable power supply with an amp meter built in to get how many amps the servo needs under load. You almost have to make the arm, attach the servo, load the arm then measure it. You can skip this step if your servo is way powerful to begin with (recommended above) Expect ultra heavy load to be around 3 amps at 6v, light load 1 amp at 6v
Power
-Basically batteries suck. To do any useful task with portable robotics you need a battery pack similar to what is used in model airplane or RC cars. NiCad power sticks (RC cars) are great, cheap and durable.
Code:
You could crowd source your entire code but you will really need to be able to troubleshoot your own creation. Here are some links to people who have written code to get servos to do things:
Servo1 is controlled with an actuation signal from Servo0
Servo2 is controlled with an actuation signal from Servo1
Created: AVSR_2k13.8.29
*/
#include <Servo.h>
Servo servo0; //Object defining three servos control
Servo servo1;
Servo servo2;
int emgpin; // Pin where emg signal is connected to POT
int val = 0; // Any variable value to store POT data
int motorpin_A; // Pin where digital data rotates servo0
int motor_A = 9; // Variable writing the ADC converted PWM s/n
int motorpin_B; // Pin where digital data rotates servo1
int motor_B = 10; // Variable writing the ADC converted PWM s/n
int motorpin_C; // Pin where digital data rotates servo1
int motor_C = 11; // Variable writing the ADC converted PWM s/n
void setup() {
servo0.attach(9); // attaching the servo motors to pin 9, 10, 11
servo1.attach(10); // and to the servo objects: servo0, servo1, servo2
servo2.attach(11);
}
void loop() {
val = analogRead(emgpin); // variable reading POT value
val = map(val, 0, 1023, 0, 179); //scaling the desired value using ADC
servo0.write(val); // servo0 writing data for rotation
delay(15); // Waiting for servo
motor_B = digitalRead(motorpin_A); // Motor_B Reads the value from pin 9 of servo0 rotation
for(motor_B = 0; motor_B < 180; motor_B += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
servo1.write(motor_A); // tell servo1 to go to position in variable 'motor_B'
delay(15);
}
motor_C = digitalRead(motorpin_B); // Motor_B Reads the value from pin 10 of servo1 rotation
for(motor_C = 0; motor_C < 180; motor_C += 1) // goes from 0 degrees to 180 degrees
{ // in steps of 1 degree
servo2.write(motor_B); // tell servo2 to go to position in variable 'motor_C'
delay(15);
}
}
revestroke, I'm not sure what you're trying to do. What do you mean when you say that the elbow and wrist are activated using the base motor movement? Sounds like the incoming emg signal positions the base, then the base movement dictates what the elbow and wrist do?
I'm not getting a clear picture of what you're trying to do.....