Welcome! Log In Create A New Profile

Advanced

Eight servos with RAMPS 1.4 and Marlin

Posted by jessicabrenner 
Eight servos with RAMPS 1.4 and Marlin
October 28, 2015 02:16AM
I have 8 servos using signals from pins 32, 47, 45, 43, 41, 39, 37, 35. The servos are all powered and grounded to an appropriate voltage regulator (can output 2A continuous). Each servo uses 30 mA when stationary, 300 mA when moving, or 600 mA when stalled. I'm using RAMPS 1.4 and Marlin. I'm pretty certain its not an electronics issue, must be software.

If I move them one by one using M280, everything is fine. However, if I start a print in which each servo is repeatedly activated in succession (one at a time) with a 1 second pause between each move (using G4 P1000), the behavior is weird. The first 8 moves will be fine, the next 8 moves will be fine, then on the next 8 moves, the 3rd and 5th servo will delay to an unpredictable amount of time while the other servos will move exactly when expected. And every time I run this, the 3rd and 5th servo will have troubles at that part of the cycle, and usually another random servo will exhibit the same behavior.

Does anybody have any experience running multiple servos with RAMPS 1.4??

Edited 2 time(s). Last edit at 10/28/2015 02:30AM by jessicabrenner.
Re: Eight servos with RAMPS 1.4 and Marlin
October 28, 2015 09:48PM
With 8 servos, I suspect you are well into the realm of untested code.
Re: Eight servos with RAMPS 1.4 and Marlin
October 28, 2015 10:21PM
This sounds like quite an advanced setup so I would expect your trouble shooting skills are not in question. In your position i would check a couple of things first just for sake of sanity.
1. Check all electrical traces and connections to the RAMPS (is it a good quality board or a cheap ebay jobby?)
2. Swap a couple of connectors and see if the fault remains with the servos or travels to other servos connected to those ports
3. Try disabling one or two servos in the code and see if the fault changes in some way
4. Try disabling the first servo in code entirely, and see if the problem shifts to 4 and 6 or 2 and 4
It does however sound like a software issue, a counter or loop or something not being initialised or reset correctly? Maybe an overflow somewhere? It could be anywhere but the obvious place to start would be in servo code once you have done some physical and electrical checks.
Also consider trying another ramps/arduino if you have a spare, check what firmware version your using aswell making sure its the latest. or compare to another version to see if any changes have been made that might give you a lead.
Just another thought - a loop count in hex + 8 servos x 2 cycles going into third cycle might be using an extra byte? might be just coincidence! might be shifting a bit.
Re: Eight servos with RAMPS 1.4 and Marlin
October 29, 2015 11:27AM
I would monitor your input voltage and current to your servos. See if the power drops. If you have a scope you could also see if you input voltage is dirty, and needing a filter. If not try addig a filter to see if it helps.
FYI - I am dealing with a similar problem using 5 servos, I am using the I2C output to contol them however. It is one of the issues on my list to resolve, I just have not gone beyond the research while working on other problems.
Re: Eight servos with RAMPS 1.4 and Marlin
November 06, 2015 04:54PM
Thanks for all the suggestions Mutley and CatFarmer, I'll give them a try. I don't have a scope, but I can borrow one or get a cheap one. By "dirty input voltage," would that just look like a DC voltage with lots of ripples? Would just a cap between power and ground fix that?

More setup info: the power to all the servos comes from the power supply through one single wire, then splits off to each servo. Same with the ground. The signal wires are all separate (obviously). The wire lengths are about 3 to 4 feet, not sure if its a bad idea to have that long of wire for powering/signaling the servos.
Re: Eight servos with RAMPS 1.4 and Marlin
November 07, 2015 07:10AM
yes, dirty means just that ripples and with any signal wires the shorter the better.

On the power line a capacitor will do, search the web for capacitor filter, as there are several types, and you may need a resistor in the circuit as well.
you can also try a ferrite ring on the servo lines to help kill any EMI,
Re: Eight servos with RAMPS 1.4 and Marlin
November 11, 2015 03:36AM
Finally fixed the problem. It turned out that these servos become unresponsive for 4 seconds when I disconnect then connect power. I realized that the servos were acting as if power was disconnected and connected again (but only if several servos made several moves beforehand, and only if those moves were opposed by the load they were meant to move).

So the problem was the long length of wires. For power, there were 2 feet of jumper wire, which split into 8 jumper wires (half a foot each), then to 8 short JST adapters, then the servo wire. Same for ground. Cutting the length in half helped but the servos would occasionally still mess up. The final fix was to mount the regulator near the servos so that the power and ground wiring could be really short. Then they worked perfectly.

This will work for me, but if it turns out that I don't like the regulator mounted there, I will try other things like smoothing the servo's input voltage with a capacitor.
Re: Eight servos with RAMPS 1.4 and Marlin
November 11, 2015 11:40AM
Glad to hear the issue is resolved. Did you shorten the wires on the servos? Or just remove your extention wires?

Edited 1 time(s). Last edit at 11/11/2015 11:40AM by cat.farmer.
Re: Eight servos with RAMPS 1.4 and Marlin
November 11, 2015 11:49AM
What's the wire diameter? This can make a difference at lower voltages over longer lengths.
Re: Eight servos with RAMPS 1.4 and Marlin
November 29, 2015 09:01PM
I shortened the wires so that the regulator that changes the voltage from 12V to 4V is very close to the actual servos, instead of far away.

Not sure what the diameter or gauge of the wire is. They are just jumper wires I bought on amazon.
Re: Eight servos with RAMPS 1.4 and Marlin
November 29, 2015 10:07PM
4V is quite low for servos, I assume you're talking about R/C style servos?

Most of them prefer 5V or higher.
Re: Eight servos with RAMPS 1.4 and Marlin
November 30, 2015 12:30AM
The particular servos I was using recommended 3.7V and stated a range from 3.2 to 4.2V.
Sorry, only registered users may post in this forum.

Click here to login