Pages: [1] 2 3   Go Down
Author Topic: feasibility question: turning dc motor to servo?  (Read 4197 times)
0 Members and 1 Guest are viewing this topic.
0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Hi,
I installed 2 dc motors, one vertically to ground for left-right and the other on top of it horizontally, for up-down movement. My circuit is an Arduino and L298. I put one pot per motor, so I have the position. What I need is that when I break the motor (LOW-LOW), not only get it stopped right at the moment (which is done ok), but also to have it not to move, so if this is an arm that lifted something, it won't fall down!

Is there any hardware(electronics) / software solution, or such a thing must only be done mechanically?

Thanks,
Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Sure. You will need a way to sense the shaft position so you know when / where to stop.

You can do this with analog parts (comparators for example), or with a digital device (mcu), or mixed (adc + a digital device).
Logged

Idaho, US
Offline Offline
Edison Member
*
Karma: 21
Posts: 1041
Special User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

My guess is you're going to have a hard time keeping the motor in position, as gravity will pull on your arm. You can get somewhat of a "braking" effect by shorting both motor leads together using an H-bridge, but that will merely slow or resist turning, it probably won't actually stop it unless you've got a big motor and a lightweight arm. If your motor is geared, that will help a lot.

What you may have to use is software code to continually monitor the position and as soon as the shaft moves away from the desired position, actively move it back. That means that your motors will constantly "jiggle" as they struggle to maintain position. If you add some hysteresis code and if your overall code loop is tight enough (in the kHz range), the effect may be minimal, pretty much the equivalent of PWM.

However this still depends on the quality of your feedback sensor. A pot, for example, has some "noise" as it turns, the resistance will jitter or jump around a bit rather than going smoothly up or down. You may need to add hardware or software smoothing of the pot signal, but such smoothing will also decrease the angular accuracy of your positioning.

So, still do-able, just don't expect stepper or servo class precision and stability.
Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Thank you,

I think that I did not explain my problem clear enough. I already have the shaft position as I embedded a pot with gears in, so when motor turns, my pot value changes accordingly.

What I exactly meant is that, when I stop a servo motor in a pos, if it is keeping a load on it, say it is an arm and servo lifted something, it keeps the position. I try to move my servo by hand but it resists. Same time, when I break my dc motor in a position (reading the pot as feed back), I can turn it still by hand (it won't resist, as if its power is disconnected) and also if any load on it, will fall down!

I think it could be done only mechanically, that is something keeps the motor from turning in any position while fixed, and just before moving it is being released.

What I would like to know:
1. some google key word to search for the right mechanism,
2. if there is any hardware (electronics) / software solution to this and if os, keywords to google

Please give ideas smiley
Logged

Central MN, USA
Offline Offline
Tesla Member
***
Karma: 75
Posts: 7303
Phi_prompt, phi_interfaces, phi-2 shields, phi-panels
View Profile
WWW
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
I don't think this is doable. If you hold a DC motor in position with no power to it, it won't hold position. If you supply power to it, it warms up and eventually burn out the coil. They are simply not meant to hold position. Unless you have a very large screw, and turn the screw to change position, you won't be able to hold position. Stepper motors are designed differently to step and hold.

Well, scrap the above. You didn't say you had a DC servo motor. The servo motor will give you a spec on how much torque it can supply, just read the spec sheet.
Logged


0
Offline Offline
Edison Member
*
Karma: 8
Posts: 1250
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Is there  'need' to use a MOTOR vs a SERVO in this case then?  you can get servos that do 360 degree turning..
Logged


Left Coast, CA (USA)
Offline Offline
Brattain Member
*****
Karma: 362
Posts: 17305
Measurement changes behavior
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

What I would like to know:
1. some google key word to search for the right mechanism,

'feedback control'
 
2. 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
« Last Edit: October 04, 2012, 11:33:18 am by retrolefty » Logged

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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 :-(

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.  
« Last Edit: October 04, 2012, 11:56:26 am by ironbot » Logged

Offline Offline
Edison Member
*
Karma: 116
Posts: 2205
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
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.
Logged

Offline Offline
Edison Member
*
Karma: 37
Posts: 1352
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

Quote
What I would like to know:
1. some google key word to search for the right mechanism,
I'd say "brake". smiley-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.
Logged

UK
Offline Offline
Shannon Member
****
Karma: 223
Posts: 12630
-
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

I only provide help via the forum - please do not contact me for private consultancy.

0
Offline Offline
Tesla Member
***
Karma: 147
Posts: 9741
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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=
Logged

Consider the daffodil. And while you're doing that, I'll be over here, looking through your stuff.   smiley-cool

0
Offline Offline
Sr. Member
****
Karma: 0
Posts: 301
Arduino rocks
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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,
Quote
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:






Logged

Idaho, US
Offline Offline
Edison Member
*
Karma: 21
Posts: 1041
Special User
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

USA
Offline Offline
God Member
*****
Karma: 14
Posts: 644
View Profile
 Bigger Bigger  Smaller Smaller  Reset Reset

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

Pages: [1] 2 3   Go Up
Jump to: