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?
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.
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.
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.
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.
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.