Good Day Programmers
I have a project in which most of the physical development is done and built. I have written some code as I learn and seem to have a working sketch. What I need is for someone to take it to the next level.
My project uses servos and I need to get more speed out of them, so they travel faster and reduce cycle time. Interested parties please PM me for details and documentation.
A Non-Disclosure agreement will be necessary.
Thank you for your consideration
Mike
ultratec:
Good Day Programmers
I have a project in which most of the physical development is done and built.
(...)
My project uses servos and I need to get more speed out of them
(...)
So, you want to speed up servos with code without change the physical structure?
luisilva:
So, you want to speed up servos with code without change the physical structure?
Ideally that would be the outcome. I have used some snippets of code that does indeed make the motor travel faster, but I am having issues incorporating these snippets into my current code.
Upping the motor size is also an option in conjunction with the code improvements.
Mike
Will these servos physically move as fast as you want? I mean, take this:
loop() {
servo.write(45);
delay(2000);
servo.write(135);
delay(2000);
}
If you do that, do the servos swing through 90 degrees at the speed you need? If not, then it isn't code that's the problem: those particular servos just plain won't do what you want.
If they will, and the problem actually is the sequencing of servo writes in the code, then what you want is do-able. But I suspect it will take a fairly severe restructure to do, because if the code is written properly with millis for timing then you could make those writes happen whenever you like. If you can't do that, then the code must have delays and blocking loops, many of which will need to be unrolled into state machines.
Without revealing your own proprietary code, I'd be interested in links to those snippets you mentioned. I'm having trouble with servos myself
.
Hi Paul
I am happy to help out with the snippet. It was shared with me by Robin2 and posted here:
http://forum.arduino.cc/index.php?topic=506797.msg3455713#msg3455713
I don't have much experience with libraries so I wasn't sure how to implement your test code.
Mike
ultratec:
I don't have much experience with libraries so I wasn't sure how to implement your test code.
Well, attach a servo to your arduino, give it power and ground, signal on pin 6.
put this:
#include <Servo.h>
Servo servo;
void setup() {
servo.attach(6);
}
void loop() {
servo.write(45);
delay(2000);
servo.write(135);
delay(2000);
}
into a new sketch and compile and upload it. It should make your servo swing through a 90 degree arc back and forth every 2 seconds. The point being that the servo will move as fast as it can to do this.
If it's not moving as fast as you would like, it might simply be a matter of the servo needing more go juice. If you are not already doing so, run a separate power supply for it. Be sure to tie the ground of of that power to the arduino ground.
My apologies to everyone, I said my project uses servos, it actually uses stepper motors, i cant explain the brain fart when i wrote my first post.
Again my apologies for the misinformation.
Mike
ultratec:
My apologies to everyone, I said my project uses servos, it actually uses stepper motors, i cant explain the brain fart when i wrote my first post.
Again my apologies for the misinformation.
Mike
Ok! Well then. More speed, eh? This might mean a few things.
Three (four) possibilities I can think of:
a) maybe you are using a library, and that library has a 'time between steps' that can be fiddled with. If this is the problem, then the fix is to fiddle with that setting or to use a different library that does let you define the speed.
b) perhaps your code is riddled with delay()s, and you need the stepper to be stepping while these delays are delaying. In the worst case, this may mean that your code needs a full refactor. Or, if you're lucky, it might just be a matter of taking advantage of the yield() function to give your stepper objects some time slices.
c) perhaps the code simply specifies longer intervals than is needed, and it's a matter of adjusting the various magic numbers in the code here and there.
d) perhaps your steppers need more go juice. I bought a 12v stepper from Jaycar, and let me tell you - it moved far more smartly when I gave it 18v. But I got a bit of magic smoke seepage, and the motor gradually began to work less well. Having said that, if you are a hardware guy then you have probably done power right, and this is probably not the problem. The thing about steppers is that they either work or they don't. If you switch 'em faster that they can go, they don't go slow: the sit there and vibrate.
I suppose the next step is to either PM you for details and NDA, or not.
I've done motion control for many years. The reason the steppers tend to sit and vibrate if you drive them too fast is often because the current can't rise and fall fast enough on each step. Raising the voltage helps that. Typically a 5V motor can be run at well over 10x nameplate voltage as long as it's current limited and you don't exceed the motor's maximum current rating. I've run 5V motors at 90V with no problem. However, you MUST limit the current or there will be lots of smoke coming out. The newer stepper control chips use a chopper drive to limit the current, but even if you're not using one of them, an inline low value resistor can accomplish the same thing, but at far lower efficiency.
Ok, I only just looked at that snippet link (which I should have done previously) and have just had to delete several paragraphs of useless reply. That's what happens when you are not thorough
.
I suppose the question is, if you could get more speed out of it with acceleration, is Robin2's code not working for you?
**Cmon, you know you want to at least take a look lol. In seriousness what would it hurt to look over?
I guess you're right. I'll send a PM, we can talk about this pesky NDA of yours. Remember: I may not be able to help at all.