Need help with the servo LDX-227

Hi, I just bought an LDX-227 servo motor for my project, I’m trying to figure out what parameters the Servo library needs to make this servo work.

The datasheet only says:

PWM adjust the angle, the cycle is 20ms,

Pulse width level with duty ratio 0.5ms~2.5ms is consistent with the angle range(0 degree~180 degree) of servo,
which is in linear relationship.

Generally speaking, our servo controller using the range of 500~2500 is consistent with the duty ratio 0.5ms~2.5ms
of the output angle controlled by servo. In this way, the control precision of; ours servos can reach 3us,
the control precision can reach 0.3 degree among the range of 2000 Pulse-Width.

I really don’t know what to pass to this functions to make my servo motors work

servo.attach(<servopin>, ?, ?);
servo.writeMicroseconds(?);

Can someone help me? :cold_sweat:

The maximum range allowed by the Servo library is 0.544ms to 2.4ms so if the servo really needs more than that it could get tricky. It doesn't look as if it would be too difficult to modify the code to give the full 0.5-2.5ms range but I've never had to do it and there may be problems I can't easily spot.

I'd try your servo first with the library defaults, just servo.attach(pinNumber) and write(0) to write(180) and see how close that comes to your actual needs.

Steve

Hi Steve, I tryed what you said

#include <Servo.h>

Servo servo;

void setup() {
  Serial.begin(9600);
  servo.attach(9);
}

void loop() {
  servo.write(0);
  delay(3000);
  servo.write(180);
  delay(3000);
}

but the servo does nothing with this code,
instead if I try with this one the servo start moving… :o

#include <Servo.h>

Servo servo;

void setup() {
  Serial.begin(9600);
  servo.attach(9);
}

void loop() {
  for (int pos = 0; pos < 180; pos++) {
  servo.write(pos);
  delay(15);
  }
  for (int pos = 180; pos > 0; pos--) {
  servo.write(pos);
  delay(15);
  }

I’m really confused…

How is the servo connected and powered? It sounds like you don't have enough power to run at full speed only to take tiny steps like that 2nd (Sweep) version does. If you are trying to power that large power-hungry servo from the Arduino 5V pin stop now before you damage your Arduino!

Try it with a separate power supply or battery. Since the LDX-227 is specified for 6V-8.4V a 2S Lipo or maybe 6 x NiMH rechargeables should work.

BTW that's a 270 degree servo so 0 - 180 in the write() should send it the full 270 degrees, not just 180 (yes it can be confusing!).

Steve

The servo is powered by an external supplier at 5v 4A

Can you hand draw a wiring diagram, take a pic of it and post it here? I agree with Steve, it sounds like you have power problems.

You need to use 10v minimum to move this servo!