25kg Servo Controlled by a Joystick

Hello,

I am having issue controlling my 25kg servo with a simple joystick. I am using a simple analog joystick to control just the x axis, but the motor seems not really responding to the joystick movements (sometimes it moves randomly after a couple of seconds).

this is my code:

#include <Servo.h>

Servo myServo; 


int Joy = A0; 

int JoyVal;




void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  myServo.attach(5);

}

void loop() {
  // put your main code here, to run repeatedly:

  JoyVal = analogRead(Joy);
  JoyVal = map(JoyVal, 0, 1023, 0, 180);
  Serial.println(JoyVal);
  myServo.write(JoyVal);
  delay(20);

}

This is my simple circuit, using a 5V power supply instead of 9V and also the potentiometer represents the joystick as I couldn't find it.

Do you know what could be a possible issue?

Thanks

the servo is being powered by 9V but the control pulse coming from the Arduino will only be 5V. will the servo recognize the control pulse?

Are you seeing the full range of 0-180 when you print JoyVal?

Does the servo power really go through a breadboard? Bad idea, breadboards cannot take much current and that's a power-hungry servo.

Steve

Your diagram shows A0 connected to one end of the pot. A0 should connect to the wiper which is almost always the middle terminal.

Have you checked the power requirements of your servo and provided adequate power?

I am actually using a 5V power supply. Not sure about the control pulse (?)

Yes I am able to see the full-range. So how should I connect it?

As I mentioned in the post, I couldn't find the joystick for the circuit, but the wiring is correct, VRX is connecting to A0.

I think I have solved the issue of joystick control. However, it looks like the motor needs a slight input to start working. Also for example if I just set a starting position such as:

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);
  myServo.write(60);
  myServo.attach(5);
}

The motor doesn't actually rotate to that position. What could be a possibel issue?

Thanks

Bad servo? Insufficient power? Poor connections?

Try running the example Sweep program from the IDE. If that doesn't work it's probably a bad servo. If that works but a simple write(60), delay(100), write(120) doesn't then you don't have enough power. What is the current rating of your 5V power supply?

Yes it seems I don't have enough power. The current rating is 1A. I am able to increase the voltage, not sure if this would help

You need a power supply of at least 3.4 (found on a few pages, such as this one).
If you have a cheap power supply from Ebay/Amazon/AliExpress, then you need a power supply of 10A and hope that it can deliver 3.4A.

Is your servo motor a "TD-8125MG" ?
Try to find its stall current. That is current that the power supply should be able to provide.

Even if you do not stall the servo motor, the peak current when it starts moving could be near the stall current.
A breadboard can not be used for those currents. A breadboard can be used for a led or a sensor, and even then they often fail to make good contacts because of the low quality.

This is a common mistake. When buying a servo motor, some think that stronger is better. But for a servo motor, smaller and less current is better. If the servo motor is not strong enough, perhaps that can be solved in a mechanical way.

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