Robot arm control using PWM. Axis' drifting

I have 6 Parallax HB-25 motor controllers on my Scorbot robot arm.

I'm using some simple Arduino joystick programming to control each driver with PWM.

When the drivers have no power the arm axis's are difficult to move manually. The are all brushed dc motors with harmonic gearboxes.

When the drivers are powered the axis's affected by gravity drift down. ( shoulder, elbow, wrist).

The base rotate does not move as gravity has no effect on it.

The joystick program on the Arduino works like its suppose to.

Anybody have any ideas??


IMG_4754

It makes no sense that the axis affected by gravity drifts down if you continue to supply a signal to it

Please post your full code or a smaller but complete sketch that illustrates the problem

code

#include <Servo.h>

#define basejoy A0
#define shoulderjoy A1
#define elbowjoy A2
#define wristjoy A3
#define wristrotatejoy A4
#define gripperjoy A5

Servo baseservo; 
Servo shoulderservo;  
Servo elbowservo;
Servo wristservo;  
Servo wristrotateservo;  
Servo gripperservo;  
 
void setup()                                                                                                                                                                                                                                                                                            
{
 Serial.begin(9600);

  baseservo.attach(2);
  shoulderservo.attach(3);

}
 
void loop()
{
 delay(100);                    
  int baseVal = analogRead(basejoy) ;  //read joystick input on pin A0
  baseservo.write((baseVal+520)/10);      //write the calculated value to the servo

 delay(100);

  int shoulderVal = analogRead(shoulderjoy) ;  //read joystick input on pin A1
  shoulderservo.write((shoulderVal+520)/10);      //write the calculated value to the servo

}






Driver data sheet

HB-25-Motor-Controller-Guide-v1.3.pdf (728.5 KB)

PWM X= Analog. it will move like dancing, PWM is a fast 8 bit pulse that is so fast, its so fast it gives illusion of analog. use resistor and capacitor to make a pwm to analog voltage (DAC)

Video of arm drifting

Hi,
What is your servo power supply?
What are the specs of the servo?

Thanks.. Tom.. :smiley: :+1: :coffee: :australia:

Hi,
What you have is a MOTOR CONTROLLER not a SERVO CONTROLLER, there is no feedback from the arm output shafts to show position for the servo effect to correct for gravitational forces on your arms.

The controller you have is for a continuous rotation servo, not a position servo.
A position servo uses position feedback to keep position.

Tom... :smiley: :+1: :coffee: :australia:
PS. In your case now, if you reversed the motor connections, the arms would probably drift upwards rather than downwards.

The "SCORBOT-ER4 u" (Educational Robot for You?) has an Optical Encoder on each axis. If you can read those with your Arduino you could use a PID control loop on each axis to make an actual servo.

I reversed the wires going to the motor so now the axis doesn’t drift. It’s works as it should. ????

Im working on the encoder programming now.
Has encodes on all axis. With home switch.
Limit switches on 4 of the axis.(Hardwire limits)

And there already 5v so no level shifting. Yeha

Encoder wiring

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.