Go Down

Topic: Prevent servo to chop (Read 269 times) previous topic - next topic

rooyakkers

Hello.
I am controlling a robotarm with has 6 servoes. My problem is that the robotarm is chopping alot, the servoes are vibrating. How can I prevent this from happening?

Kind regard,
-Alex

rooyakkers

When looking at the PWM from the Arduino Uno, it is a lot of noise on the signal..

Robin2

Usual question - are you powering the servos from the Arduino 5v pin?

Don't
Give them a separate power supply with the servo GND connected to the Arduino GND.

...R

rooyakkers

Usual question - are you powering the servos from the Arduino 5v pin?

Don't
Give them a separate power supply with the servo GND connected to the Arduino GND.

...R
We are not powering the servoes from Arduino.

We use an external powersupply.

johnwasser

Are you using SoftwareSerial or any other library that might disable interrupts for hundreds of microseconds?
Send Bitcoin tips to: 1L3CTDoTgrXNA5WyF77uWqt4gUdye9mezN
Send Litecoin tips to : LVtpaq6JgJAZwvnVq3ftVeHafWkcpmuR1e

Robin2

We use an external powersupply.
That's good, but it means the simple solution is not available  :)

Post your code and provide details of how the Arduino and the servos are being powered.

...R

rooyakkers

This is the code, this is only 1 servo, but we have 7 of them. Still with 1 servo, it chops!




#include <Servo.h>

Servo griper;

int const ic_griper = A5;

int potVal_griper;
int vinkel_griper;

int i_aMin, i_aMax, i_vMin, i_vMax;


void setup() {
  griper.attach(11);
 
  i_aMin = 0;
  i_aMax = 1023;
  i_vMin = 0;
  i_vMax = 179;
 
}

void loop(){
  potVal_griper = analogRead(ic_griper);
 
  vinkel_griper = map(potVal_griper, i_aMin, i_aMax, i_vMin, i_vMax);

  griper.write(vinkel_griper);
   
  delay(15);
 
}

Embedded_Automation

@ rooyakkers:
hey, Its interesting that your code is actually the same code that in the Arduino Servo Example "knob". just with some modification to many of the variable name, therefore I do not think that is the problem of the coding itself.

It maybe be cause by the fact that your servo internal pot isn't set true. If I may, can i get the model of the servo you are using so that i could look up the necessary data sheet. However in my humble opinion this is cause by the internal pot feedback.
   

wildbill

The ADC tends to wander a bit, and your Pot may not be giving consistent results either. What happens if you ignore it and just set the servo to say 125 degrees?

Embedded_Automation

#9
Feb 20, 2015, 07:02 pm Last Edit: Feb 20, 2015, 07:04 pm by Embedded_Automation
@ rooyakkers:
This is how I would code the same thing, in essence it does the same thing but give plenty of room for your to expand the code later

Code: [Select]

#include <Servo.h>

Servo gripper;

const byte icGripper = A5;
const int  i_aMin = 0;
const int  i_aMax = 1023;
const int  i_vMin = 0;
const int  i_vMax = 179;

unsigned long previousTime = 0;


void setup()
{
  gripper.attach(11);
  previousTime = 0;
}

void loop()
{
  unsigned long timeNow = millis();
  if ( timeNow - previousTime >= 15 )
  {
    updateServo();
    previousTime = timeNow;
  }
 

}

void updateServo()
{
  int potValGripper = analogRead(icGripper);
  int vInKelGripper = map(potValGripper, i_aMin, i_aMax, i_vMin, i_vMax);
  gripper.write(vInKelGripper);
}

rooyakkers

@ rooyakkers:
hey, Its interesting that your code is actually the same code that in the Arduino Servo Example "knob". just with some modification to many of the variable name, therefore I do not think that is the problem of the coding itself.

It maybe be cause by the fact that your servo internal pot isn't set true. If I may, can i get the model of the servo you are using so that i could look up the necessary data sheet. However in my humble opinion this is cause by the internal pot feedback.
   
We use a Hitec HS-422

rooyakkers

The ADC tends to wander a bit, and your Pot may not be giving consistent results either. What happens if you ignore it and just set the servo to say 125 degrees?
We took a look at the osciloscope, but the PWM still jumps.

Embedded_Automation

@ rooyakkers:

What wildbill try to say here is that, what happen if you run this piece of code

this code is taken from the Servo Library names "sweep" with some edit
Code: [Select]

#include <Servo.h>
 
Servo myservo;  // create servo object to control a servo
                // twelve servo objects can be created on most boards
 
int pos = 0;    // variable to store the servo position
 
void setup()
{
  myservo.attach(11);  // attaches the servo on pin 9 to the servo object
}
 
void loop() 
{
  myservo.write(125); // directing the servo to move to angle 125 degree.
}


the code I had attach above would work if you directly copy and paste it into you Arduino IDE,

the outcome that we are trying to get here is for the servo to stay into one position that is 125 degree.

If say the servo still shake (trying to seek position) or in your term "chop", this indicate the servo is the culprit.. if say the Servo are able to keep its position at 125 degree, it may be that your Potentiometer is the problem

shooter


Go Up