Go Down

Topic: Help newbie with closed-loop servo control (Read 3843 times) previous topic - next topic

I am not sure if this is the right place to ask, but I am looking to build a servo controlled camera pan and tilt device.  It appears that the only way I can get fast and accurate servo response is with a closed loop system.  On a scale of 1- to 10, my experience with open loop servos is about a 2, and closed loop servos a 0.5.  Any tips on learning to interface a closed loop servo to the Arduino would be appreciated.  BTW, my Arduino experience is a 3, but at least I was a software engineer before retiring.
(I tried searching the forums, but the search algorithm here is "or", so search for "closed loop" returns every occurance of "closed" or "loop".)

TIA

PaulS

What do YOU mean by closed loop? Typically, that means that there is some feedback from the driven device to be used to define new drive instructions.

What feedback are you getting? How are you using it?

retrolefty

#2
Feb 23, 2013, 03:13 am Last Edit: Feb 23, 2013, 03:15 am by retrolefty Reason: 1
Closed loop system means that you have a physical measurement brought back to the controller showing the actual position of the motor shaft you are trying to control. Then you would typically have a PID software control program running on your controller. The input variable for this PID would be the external position signal, the setpoint would be the desired position you want the motor to go to and the output signal of the PID (often called the error output, would be sent to typically a H-drive controller to command the motor direction and speed such the the position signal is driven to equal the setpoint value where the motor would stop. While that is a simple concept there is a ton of details to get a real world example functioning correcting. There are tuning value to come up with for the PID algorithm to use, Scaling of the position input signal, proper scaling of the error output to be compatible with the motor H-drive circuitry you are using.

A hobby type servo is a closed loop system, it's just that the PID type control, position feedback signal and motor H-drive are all included inside the servo, the signal you send it is the desired 'setpoint' position you desire and it will drive until it's final position equals the setpoint you are sending it. I would consider this an advanced DIY project to take on even if you do have some prior software and hardware experience.

Many people are able to build pan and tilt assembly using hobby type servos as such servos come in many torque and speed and quality choices. You kind of get what you pay for, and you have to have the mechanics correct for the servo to control axis's, no slop or backlash allowed if using gear or belt coupling. I'm sure if you look around the web you can find examples of good pan and tilt projects using standard R/C servos and that would give you a much better chance at success rather then trying to build your own closed-loop servo assemblies.

Lefty

zoomkat

Quote
I am looking to build a servo controlled camera pan and tilt device.  It appears that the only way I can get fast and accurate servo response is with a closed loop system.


A servo has mechanical speed limits. I've made a simple joystick pan/tilt cam and it tracked the joystick movement closely. Check the "knob" servo control program in the IDE.
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

I appreciate the tips.  The camera weighs almost 5 pounds and the system that I am looking at is the Servo city PT785-S.  (http://www.servocity.com/html/pt785-s_pan___tilt_system.html)

I have used joystick controlled cameras and they just aren't intuitively obvious to the average videographer, and in my application it has to be smooth.  Yes, with practice an operator can get good with the joystick, but after using a joystick camera system weekly for two years (local cable channel), I still can't make camera moves as silky smooth as I can with a camera on a tripod.

With a closed system I can add a lot of dampening in the controller to make the movements slower - smoother.  The PID loop in the hobby servos responds too fast.  I guess this may be an ambitious project, but heck, I have plans to add an IR "follow me" detector so that the person on stage will be followed by the camera.  You can't get lazier than that.

What I don't know is what the feedback looks like from the servo motors - so I ordered one (servo, not the whole pan/tilt system) to experiment with.  I was kind of hoping that I wasn't reinventing something someone else already made.

zoomkat

You have said two things below that are 180 deg out. You want fast or slow? If you want slow, then some simple solutions might be available. With the "knob" code and a 300 deg pot, try putting a large operator on the pot (similar to the handwheels seen on some large tv studio cams). I've hot glued a large plastic jar lid to the shaft of a pot to make it easier to make very slight changes to the pot position (similar to the servo pot adjusting tool below). If you need even finer adjustment, do the same using a 10 turn pot. If you only need only 90 deg of rotation, you might directly control the servos using $5 servo testers.

Quote
It appears that the only way I can get fast and accurate servo response is with a closed loop system.


Quote
With a closed system I can add a lot of dampening in the controller to make the movements slower - smoother


http://www.hobbyking.com/hobbyking/store/__470__189__Servos_Parts-Servo_Tester.html

Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

JimboZA

Quote
What I don't know is what the feedback looks like from the servo motors


There isn't any, it's all inside as Lefty said:

Quote
A hobby type servo is a closed loop system, it's just that the PID type control, position feedback signal and motor H-drive are all included inside the servo, the signal you send it is the desired 'setpoint' position you desire and it will drive until it's final position equals the setpoint you are sending it.


The Arduino servo library sorts out the signal to send the servo, based on the position in degrees you map from the analog reading from the pot in the joystick.
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

zoomkat

Just looking at the servocity big pan/tilt mount, it doesn't really move that fast due to the reduction gearing to move the heavy cams.

http://www.youtube.com/watch?v=6pwL4Twg5Tw
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

JimboZA

How is that video closed loop?

Yes I know it's closed loop inside the servo, but the video title indicated to me that there is some means of checking externally that the servo actually got to where it was supposed to be.

If it doesn't check, then to me that's not closed-loop as far as the whole system is concerned.... you're still sending the servo a setpoint without testing to see if your setpoint is met. But maybe there's more to it than just that 1 minute video.
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

zoomkat

I think they use closed loop in that the pan/tilt platform position always follows the joystick position. Their open loop video below just uses the joystick to operate what are probably continous rotation servos.

http://www.youtube.com/watch?v=3om3RAInJ7w
Google forum search: Use Google Advanced Search and use Http://forum.arduino.cc/index in the "site or domain:" box.

JimboZA

Quote
I think they use closed loop in that the pan/tilt platform position always follows the joystick position. Their open loop video below just uses the joystick to operate what are probably continous rotation servos.


Ah ok, that makes sense.
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

retrolefty

I think the videos are just misusing the terms 'open loop' and 'closed loop'. If there is no position signal being electrically sent back to the controlling device then they are always being controlled 'open loop' via their manually operated controller and only the servo(s) is always operating as a 'closed loop' device. Because they say something doesn't make it a fact, it's the Internet dudes.  ;)

Lefty

JimboZA

Quote
Because they say something doesn't make it a fact, it's the Internet dudes.


NO! Surely not Lefty?.....

You mean that sometimes the Internet is, like, well, wrong?

Surely Wikipedia's always right? Say it's so!
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

retrolefty


Quote
Because they say something doesn't make it a fact, it's the Internet dudes.


NO! Surely not Lefty?.....

You mean that sometimes the Internet is, like, well, wrong?

Surely Wikipedia's always right? Say it's so!


Have no fear, I'm on it.

http://xkcd.com/386/

Lefty

JimboZA

Quote
Have no fear, I'm on it.


Thank Goodness.... I was just reading up on how to perform an auto-appendectomy, and I'd hate to take my appendix out with the wrong instructions.
"Could you do the egg bacon spam and sausage without the spam then? "

No PMs for help please.
DO NOT power servos from Arduino 5V: give them their own power and connect the grounds.

Go Up