feasibility question: turning dc motor to servo?

What I would like to know:

  1. some google key word to search for the right mechanism,

'feedback control'

  1. if there is any hardware (electronics) / software solution to this and if os, keywords to google

Please give ideas

Your problem is most likely your software. You can't just place the motor controls in the break mode and expect it to be able to continue to respond to changes in the pots output value. If the pot moves as a result of external forces on the motor position then you have to detect that by the change in pot's feedback value and command the motor to move to counter that change in position. A servo is all about 'feedback' control, all the time checking for actual position Vs last valid commanded position and adjusting motor commands until the difference error is zero. A true servo loop would never have a 'break mode', but rather it's always active reading the pot and making motor correction commands as needed. There are three key variables in such a software loop, the pot's position value, often called the process variable, the desired position, often called the setpoint variable, and the (motor) output signal, often called the error signal. PID control libraries are often used for those building their own roll-your-own servo loops.
That make sense?
Lefty

First I correct a mistake I may had in some place above:

It is an ordinary dc motor, not a servo type, so no torque report available :frowning:

Next, well yes, I had experience with Kalman filter and I can put there IMU (cheapest to implement for me) etc. and keep the motor in pos, but...

I was trying to find 1 mechanism to use both for arms and head, in arms it is ok to have the motor slightly move left / right to keep with pos, but for head, no.

So as I understand, I must go to feedback and correct motor position if arm, and for the head I must use a mechanical solution like:

  1. move motor to the desired position and stop it
  2. apply a mechanism that mechanically prevent it moving
  3. to move it again, first release that

Also I don't want to go to servos for cost: the head will be from fiberglass material and not really at the weight that my hobby servos could handle and don't like to take model airplane servos each by 30$ (need 2 motors for head).

It will be very helpful if you could please suggest a cheap idea to implement in a small robot neck for this (up-down movement on 1 motor is enough).

Thanks again.

Edit:
The bot has a router with 400Mhz Broadcom processor running on and in case of using a filter for noise or heavy PID algorithms there is no load to Arduino processing power from it.

I must go to feedback and correct motor position if arm, and for the head I must use a mechanical solution like:

No. All you need is to implement a form of negative feedback.

For example, if the motor moves past the right of your desired position, turn the shaft left; and vice versa. With the negative feedback, the shaft/arm will hold (likely vibrate slightly around the target), mechanical limitations not withstanding.

One area of leading edge research, almost directly comparable to what you are trying to do, is to use brushless motors as steppers.

It is definitely doable. However, getting the whole system stable and responsive isn't simple.

What I would like to know:

  1. some google key word to search for the right mechanism,

I'd say "brake". :wink:

But, I have no idea how to build a miniature brake. Maybe a friction device of some sort, or something poking through holes to stop rotation? I suppose it would use a solenoid. If you want to engage the brake when power is off, you'd need a spring to engage the brake and the solenoid would pull against the spring to release the brake when the servo is operating.

A stepper motor can make a pretty good brake, but they are not that cheap and they can only "brake" while powered-up.

There's nothing stopping you from putting a feedback loop on your motor control, and it would solve this problem completely.

Essentially, rather than switch the motor on to move it and switching it off when it reaches the required position, you would specify the desired motor position and continually compare the current position with the desired position and apply power to the motor to move it to the desired position. You could hard-code this feedback quite easily using a simple proportional algorithm, but if you have moving assemblies involved with inertia to deal with then a PID control algorithm would be ideal since it would take care of all of that for you. There is already a PID library for the Arduino. The error signal would be the difference between desired and actual position and the output would be PWM duty cycle and direction.

You probably could use the internals of a small servo to drive the L298 for your motors. below is a search for "monster servo". If your motors have to hold a load, you probably need to use motors with worm gears.

https://www.google.com/search?hl=en&as_q=monster+servo&as_epq=&as_oq=&as_eq=&as_nlo=&as_nhi=&lr=&cr=&as_qdr=all&as_sitesearch=&as_occt=any&safe=images&tbs=&as_filetype=&as_rights=

Thank you all! I Attach my design and you could see pots beside the neck and on top of head motor. I'm thinking may be good idea to double pot per motor, then feed each pair to a filter and get rid of error, then try a PID (don't have skills for).
.....................................................................
Zoomkat,
I'd study the search, sure I must know in detail the internals of servo and hope it ends to learn to hold the load with dc motor.

PeterH,

There's nothing stopping you from putting a feedback loop on your motor control

Well, unfortunately what is stopping me is lack of skills in control theory: I've not done the homework, not finished a single control theory book (but have chosen what to read, it has matlab simulations to pass to hopefully couple theoretical understanding with some intuition). I'd give a try to the PID lib you kindly suggested but hardly imagine that in this concept any good result comes without sound theoretical background and gained intuition in putting them to work.

DVDdoug,
I want to create a friction device but have nothing to start from other than my own idea. I learned that better to find examples of others, before realizing own idea, so not to reinvent the wheel. I don't know any similar project or what to google for. If you got something, please kindly leave me some links.

Dhenry,
I have a small experience in feedback: I used an IR-range finder sensor and programmed it so that:

  1. servo on which the sensor is installed, turns right all the time until detecting an object
  2. when detected, servo turns to left edge of object until losing it, back to 1.
    The result was not bad: robot could follow the object by edge.
    I think with pots on the neck I'd have the same story: motor turns toward set point and sure won't stay on it but pass it over, then returns. The error of pot will make problems I think.
    ==================================
    Design:

ironbot, do you have some kind of continuously-rotating pots? Most have somewhat less than 360° of rotation before they hit an internal stop. If you are gearing your motor to your pot with a 1:2 ratio, your motor will not be able to move more than 180° before it hits the stop in the pot.

Rotary encoders would allow a full 360°with the added bonus of a digital output. Although exactly type depends on how much you are willing to spend. There rotary encoders specifically designed for use with motors but expect to pay between $30 to over $100 (at least for low volume orders) a piece. There are others intended for much lighter duty, like input knobs those can be less than a $1.00. Here's some of the selection avaialble at from one major supplier.

ironbot:
PeterH,

There's nothing stopping you from putting a feedback loop on your motor control

Well, unfortunately what is stopping me is lack of skills in control theory: I've not done the homework, not finished a single control theory book (but have chosen what to read, it has matlab simulations to pass to hopefully couple theoretical understanding with some intuition). I'd give a try to the PID lib you kindly suggested but hardly imagine that in this concept any good result comes without sound theoretical background and gained intuition in putting them to work.

You may be surprised how easy it is once you have got your head around the basic concept. Instead of giving a movement command and assuming that the actuator ends up in the correct position, you find the current position and compare it to the desired position and tell it to move in the right direction. This is basically all you are trying to achieve. The PID algorithm is a feedback algorithm that works very well in a wide variety of situations which is why it is so popular. As well as dealing with the position, it also deals with the speed and acceleration which I suspect will be important to you when you're trying to move and position elements with a lot of inertia.

PeterH,

You may be surprised how easy it is once you have got your head around the basic concept.

This really helps to not to fear to give it a try yet before reading the control theory book, thanks :slight_smile:
Could you please point me to any tutorial/example project, where I can implement any simple movement (a line follower, or any other thing) isolated from my own project, toward known, target results (already achieved by the tutorial / example project) to develop some skill?

I have already tried "Arduino PID" on google and there lots of examples, but getting direction from you is the point.

Tylernt, Far-seeker:
My pots are ordinary under 1$, the neck and head motor both will have less than 180deg. movement.

The state of neck and head (turning left or right, up or down) will be reported by pot for the process and by limiting micro switches for end points so this should not be a problem. I first added micro switches and implemented them, then I had a problem with debouncing and turned to forum and made a post some days ago. Got great new ideas like always. Now in redesigning (will use debouncing with flip-flop chip this time, as suggested by community people).

Any comment will be greatly welcomed.

I suspect you will find some useful stuff here... http://www.openservo.com/

Thank you, indeed!

ironbot:
Tylernt, Far-seeker:
My pots are ordinary under 1$, the neck and head motor both will have less than 180deg. movement.

The state of neck and head (turning left or right, up or down) will be reported by pot for the process and by limiting micro switches for end points so this should not be a problem. I first added micro switches and implemented them, then I had a problem with debouncing and turned to forum and made a post some days ago. Got great new ideas like always. Now in redesigning (will use debouncing with flip-flop chip this time, as suggested by community people).

Well for less than a full circle you a rotary encoder can still offer better precision then the setup you describe, but the much greater cost of a precise rotary encoder means the potential improvement is probably not worthwhile.

Hi, just wanted to add some comment not directly connected to the issue.
i have been working with an industrial robotic arm for some time now. The industrial solution for your issue is by having a high ratio gear motor with high friction. the added friction coupled with a high gear ratio (1:100) improves the precision and reduces the gravity pull effect. in addition you need a high freq control loop to keep the arm well position and in high control. additionally it is common to add a low voltage break. meaning that if your power is cut out your breaks jump in.
hop it helped.

well, I used the system in this following way:

  1. the left-of-neck limiting switch was triggered, so robot knows that could only turn right
  2. the set-point of turning write is chosen,
  3. motor is commanded to turn, and reading pot, until pot<=x (x being the set-point)

I actually tested this system and not that bad, but one thing is really awful and that is the main concept I was for: keeping the load.

If I command motor (still not by PID) to keep on a position, say, if potx turn left, the noisy movement is not only coming from the fact that I didn't use a PID, but also from the pot being a <1$, too noisy type.

I guess - and look for your kindly guides to get sure - that beside PID I must change to a pot type which is less noisy but same time not on cost of 30$ as the question was "turning dc motor to servo", to try to pay less than the servo cost.

Now if the original question is someway wrong (impossible to turn dc motor to hold the load like a servo but for less price), then well, I have nothing more to say, or ask :slight_smile:

Well you might be able to find pots with less noise, but I don't think a noise-free pot exists on this planet. You should add some kind of filtering or smoothing algorithm to your software code to minimize the effect.

ironbot:
If I command motor (still not by PID) to keep on a position, say, if potx turn left, the noisy movement is not only coming from the fact that I didn't use a PID, but also from the pot being a <1$, too noisy type.

Then you might want to think about a rotary encoder, but not the type specifically made for motor control. Instead there are the type made for dials, knobs, and other turnable human input devices, you can find those from $0.50 to $5.00 a piece (higher priced ones exist of course, if you could spend that kind of money you might as well get one made to work with a motor). The price will vary with due to a few different things; how many bits in the code (which determines the maximum precision), whether they are optical or mechanical (which probably won't matter in your application, but mechanical are cheaper), and overall quality of construction (i.e. how many tens or hundreds of thousands of rotations before they wear-out). Digikey, for example, has thousands different of models...

A bldc motor is an excellent rotary encoder.