Servo actuated hydraulic valve (jitter problems)

Hi,

Looking for some advice to calm my servos down a bit.

My project:
I have a trailer with a hydraulic crane attached.
Bought it with manual lever actuated hydraulic valve.
Changing valve or buying OEM remote kit for it is minimum $8K.
Decided to do it on the cheap and learn Arduino/servos.
Already designed my linkages and mount(needs re-enforcement, too much flex, easy fix, will do later).
Concept works, just needs tuning.

My problem:
As per video, servo is too jittery and erratic . Can't have this with a crane that can carry 3.5T

Hardware:

  • Arduino mega
  • servos: MKS HV9930 (31-43 KgCm)
  • Power supply for servo: Hobbywing UBEC 5A 2-8S (in 7.4v mode)
  • generic xy joystick pot
  • Batteries: trailer has 2 large 6v car sized batteries in series outputting 12v. Plenty of juice.

Schematic:

  • servo signal from pin 45,
  • servo has separate power supply from Arduino
  • All grounds are connected
  • joystick 5v supply from Arduino and signal to A0
  • Really simple but will draw and post if needed.

Measurements:

  • 1 servo peak current draw roughly .6amps
  • serial monitor for servo.readMicroseconds is stable when jitter happens.

Software:


#include <Servo.h>

Servo myservo;                                  // create servo object to control servo

int potpin = A0;                                // analog pin used to connet joystick x signal
int val;                                        // variable to read the value from the analog pin

void setup()
{
  Serial.begin(9600);
  myservo.attach(45, 855, 1995);                // attach the servo to pin 45 and set the min and max angle in microseconds
} 

void loop()
{
  val = analogRead(potpin);                     // reads value from the joystick(between 0 and 1012)
  val = map(val, 0, 1023, 0 180);               // scale it to use as seervo value
  myservo.write(val);                           // set servo pos
  Serial.println(myservo.readMicroseconds());   // monitor servo position

  delay(15);                                    // wait for servo to get there
}

Questions:

  • I've read capacitors can help. What capacitance/capacitor do I need for this?

  • Servo spec says working frequency is 1520us/333Hz. Servo.h library uses 50Hz. I can change this in the library source code under "REFRESH_INTERVAL" defualt is 20,000us(20ms/50Hz). Is it worth changing to 3003us/333Hz?

  • Any software filters to calm it down?

Any help would be appreciated

Thanks

From what I read the servo jitters but the servo position sent to the servo is stable, correct?

Jitter is power supply. Wires. Sized correctly? Wires connections? Show an image of the project. Can a schematic be posted?

From what I can tell from watching the MCU could be resetting.

Thanks for the reply.

Yes signal sent to the servo is stable and servo pos read from the servo is stable.

Everything is on a breadboard and pretty janky for now but wires in servo supply circuit are bigger than wires that come standard with servo and white signal wire is thicker Automotive gauge. Joystick tiny but that signal is stable.

The only thing I can see that could be wrong is that the servo is too weak to handle the mechanical load. Otherwise the wiring looks good.

What is the rating of the BEC? I highly, highly doubt your peak current draw is accurate, more likely the BEC is momentarily shutting down because of overcurrent. The generic small hobby servo can draw 1A or more under heavy load.

3 Likes

First, identify the real problem.

If you disconnect the servo from the load and send it a fixed value, e.g., myServo.write(100), does it still jitter or is it stable?

That can't be correct for a servo with torque in the range of 30-40 kgf-cm. I would expect a start/stall current of over 3 Amperes, which the servo will draw every time it starts moving.

The problem is clearly the servo power supply.

This is WAY TOO SLOW to show the jitter you are describing.

I did measure lever pull force with fish scale and roughly calculated (for 2 designs) to get servo torque requirements.

Lubricated lever pivots anyway to reduce load and it did work a little bit.

Power supply was issue though.

Thanks

This made my plotter a lot cleaner.

Thanks

Still had the issue.

Power supply was the issue.

Thanks

Hard wiring the servo power directly to one of the 6v batteries (no fuse no fuss haha) with a deutsch plug solved the issue.

Peaked at around 3.6A after this and no jitter.

BEC was rated for 5A. Not sure why it could handle it. doesn't matter better now that I don't need it anyway.

Thanks for your help

BEC is rated for 5A. Not sure why it had dramas. But didn't need it anyway.

Definitely right about current. Pulled 3.6A after I hard wired it to 6v battery.

Thanks for the help.

Peak or continuous?

There could be short-duration current spikes in excess of 5A. You would really need an oscilloscope to see something like that since a meter tends to average over time.

Not sure man, hobby shop recommended it. Glad I don't need it.

Spend a few minutes thinking about safety.
If the Arduino crashes and the load then moves , it could be an issue.
Something like electrically isolating the servo when the lift is stationary , or using simple electrical system instead? There might be a reason why the commercial version is so expensive ( is approved/tested to certain standards )
If it’s a system to be used by others at work ,then it is probably not a good idea .

Yeah, I hear you.
I am only testing right now.
I do have some ideas to make it safe.

  • electrical e-stop on remote and enclosure.
  • relay to cut power to pump and servos
  • software to shutdown under certain conditions ie. Input/Output discrepancies etc
  • software to detach servos with no input.
  • deadman switch so remote control can't accidently be bumped

Let me know if you can think of any others.

Only I will be using it. This project is mainly to learn.

I'm all for safety, but effective safety. Sometimes regulations and standards actually impair safety; when everything beeps, everthing flashes but you can't hear or see anything; when the extra work to make it safe triples the workload and therefore probability of an accident.
They also train people let others think about the dangers/risks and how to mitigate them.

A remote will make it safer for me working on my own as I can control the load better and less stressed.
Money is an engineering constraint just like safety.
There aren't an infinite amount of things to go wrong and I'm confident I can map the risks manage them through engineering. I'll bear the consequences directly of I'm wrong.

Anyway, sorry for the rant and thanks for making me think about it a bit more.

1 Like

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