Pages: [1]   Go Down
Author Topic: Newb Servo issues  (Read 933 times)
0 Members and 1 Guest are viewing this topic.
Offline Offline
Newbie
*
Karma: 0
Posts: 1
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hey guys I'm new here.  Little bit of background info.  I am a 19 year old Drexel University freshman in Philadelphia, PA. I am currently doing my final project for the year.  My group has decided to interface EMG tech with an Arduino to make a hand prosthesis. 

The original idea was to make the middle finger to the pinky as one unit, index finger and thumb move independently of each other. To make things simpler for the time being we decided to move the four finger as a unit and forget about the thumb.  We are going to use electrodes attached to our hand/forearm to send a signal through the Olimex EKG-EMG shield (https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG/) and then send a signal to a servo to spin and open the hand.

Our issue at this point in the project is getting an unhacked servo to spin more than 90* with a shield attached.  Without a shield, I can get the servo to spin 180*.   I have tried two different shields and two different servos and still can not get the servo(s) to spin more than 90*.

Attached is a copy of the code I am using to trouble shoot the servo.

* ServoResistor.ino (0.8 KB - downloaded 17 times.)
Logged

the land of sun+snow
Offline Offline
Faraday Member
**
Karma: 158
Posts: 2879
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Why don't you try writing a sketch to command the servo directly, and once that works
correctly, add in the bit about the analogRead().

That's how you do this stuff. Write the different parts in "isolation", test them, fix them,
and then combine them. It's 10X easier to troubleshoot that way.
Logged

0
Offline Offline
Tesla Member
***
Karma: 141
Posts: 9470
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Servo/pot test code that might be of use as it prints values to the serial monitor for troubleshooting.

Code:
//zoomkat dual pot/servo test 12-29-12
//view output using the serial monitor

#include <Servo.h>
Servo myservo1;
Servo myservo2;

int potpin1 = 0;  //analog input pin A0
int potpin2 = 1;

int newval1, oldval1;
int newval2, oldval2;

void setup()
{
  Serial.begin(9600); 
  myservo1.attach(2); 
  myservo2.attach(3);
  Serial.println("testing dual pot servo"); 
}

void loop()
{
  newval1 = analogRead(potpin1);           
  newval1 = map(newval1, 0, 1023, 0, 179);
  if (newval1 < (oldval1-2) || newval1 > (oldval1+2)){ 
    myservo1.write(newval1);
    Serial.print("1- ");
    Serial.println(newval1);
    oldval1=newval1;
  }

  newval2 = analogRead(potpin2);
  newval2 = map(newval2, 0, 1023, 0, 179);
  if (newval2 < (oldval2-2) || newval2 > (oldval2+2)){ 
    myservo2.write(newval2);
    Serial.print("2- ");   
    Serial.println(newval2);
    oldval2=newval2;
  }
  delay(50); // adjust as needed for viewing output
}

Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

Dubuque, Iowa, USA
Offline Offline
Edison Member
*
Karma: 44
Posts: 2452
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

A "sail winch" servo will give 360 degree or more rotation, unhacked.
Logged

Offline Offline
Jr. Member
**
Karma: 0
Posts: 88
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

hi , i have the same shield and have EMG sensor
https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG/
https://www.olimex.com/Products/Duino/Shields/SHIELD-EKG-EMG-PA/
but i can't get signal to move servo motors any one have code or any way to get analog signal from this shield i try to make code but i failed
is this shield used only to make heart rate analysis in elecguru program ?     
Logged

Pages: [1]   Go Up
Jump to: