Servo motor Help!

xtech007

Senior Member
I was doing a little experiment with 2 small servo, a 2 axis base I would say.
I used a 28x1 pic to control the servos, the output was exactly where I wanted the servos to move.

Well.... I would like to try with bigger motors. 2 24volt, 150watt motors.
Problem these 2 motors are not servos, but are reversible, I have interfaced them with the same 28x1 pic and an MD03 controller to move the motor but I can only make them go FWD,Reverse, and stop but not to a specific position like the servo motors.

All Suggestions are Welcome, and Once again thanks for the Support.
 

demonicpicaxeguy

Senior Member
you'll need some sort of feedback,

how many divisions per rotation are you going to need?
i'll post a photo a little later of somthing i've managed to get going very reliably on my cnc milling machine,
 

xtech007

Senior Member
thanks for the fast reply.

demonicpicaxeguy Thanks for the reply.
Also for the hope that someone had done this before.
I was browsing allover for some light.
All that came close I would say was an Encoder.

You Mention I'll need some sort of feedback, would a pot work?
Also
how many divisions per rotation are you going to need?
I don't really understand this Question.
Do you mean that for every turn of the DC Motor it can be a specific angle like a servo?

I'm Pretty New to the electronic World, Please bear with me. :(
Once again thanks for the Help..
 

SD2100

New Member
how many divisions per rotation are you going to need?
I don't really understand this Question.
Do you mean that for every turn of the DC Motor it can be a specific angle like a servo?
Do a search in google images on "shaft encoder disc" it will show images of encoders attached to motors etc, each little line on the encoder disc will output a pulse from the encoder, the more lines on the disc means more pulses per revolution of the motor shaft, an encoder with 200 divisions or pulses per revolution will give a pulse every 1.8 deg the motor shaft turns.
 

BeanieBots

Moderator
Are you trying to replicate the function of a hobby servo or do you want continuous rotation as well?

As stated by dpg, you need feedback. A motor with feedback is actually called a "servo". It's only here and within the RC community that "servo" is assumed to mean the common "hobby servo" which uses pulses for position demand.

If you want continuous rotation AND the ability to hold position, you will need a feedback with the ability of continuous rotation such as an encoder or the much better but much more expensive resolver.

For "hobby servo" type limited movement, then a pot would be easier to implement but any position feedback device could be used.

The "servo loop" which is implemented by the electronics within a hobby servo is quite complex and involves a mathematical control loop known as "PID" (proportional, integral & derivative). This is not a simple thing to emulate in a micro and requires a very fast one to get anything close to the response speed of a regular "hobby servo".

However, it is possible to 'cheat'.
You can use the guts of a hobby servo to do the control. Just take the two signals used to drive the small motor and feed them into a powerful H-Bridge which then drives your larger motor which in turn moves the pot.

Another method which is used by many roboteers to achieve a form of power steering, is to keep with the mechanics of the hobby servo and use it to provide the basic movement. That movement is then used to push against two microswitches on whatever is to be moved. The hobby servo will move and activate the switch, that activation is then used to drive the large motor, the large motor will then drive "whatever" until the microswitch is released. If the hobby servo is then moved the other way, another microswitch is activated making the large motor drive the other way. Hence, the large motor mimics the movement of the hobby servo. This method ends up with a small "deadband" where there is a small amount of hobby servo movement but no large motor movement because of mechanical limitations with the microswitches but is a very effective cheap & simple solution.
 

Andrew Cowan

Senior Member
I think the problem will be the speed. Say you want to turn the motor 90 degrees, you apply power and it wizzes round several times. That is irrelevent if it is a geared motor, however...

If it is not a geared motor, you have very little hope.

A
 

Rickharris

Senior Member
I think the problem will be the speed. Say you want to turn the motor 90 degrees, you apply power and it wizzes round several times. That is irrelevent if it is a geared motor, however...

If it is not a geared motor, you have very little hope.

A
For such large motors I would think the easiest DIY solution would be to build a linear actuator. Assuming the need for linear motion from rotary (the normal use of a servo), attaching the motor to a long screw thread (threaded studding) with a captive nut on the screw. When the motor turns the nut will transit along the bar.

The gearing down can be considerable depending on the thread chosen. Metric fine at 8 mm dia will gibe 1mm per rotation.

As a suggestion at this large size - a normal nut will produce quite a lot of friction unless heavily lubricated. As an alternative and to take out most/all of the back lash try making a "nut" by heating the screwed rod and pressing into a lump of HDPE (often used for cheap plastic cutting boards.) This will impress a suitable thread and the HDPE will act as a purpose made nut for the thread - In addition HDPE is very slippery.


The feedback can come from the end of the screwed rod via a coding disc there are many printable examples on the web. Or indeed a grey code disk.
 
Last edited:

demonicpicaxeguy

Senior Member
ok as promised here's some inspiration this a cordless drill servo

this is a cordless drill servo in position with the obvious hall effect sensor
you can see the diy magnetic encoder the red marks indicate the south side of the magnets

and for thos of you wonderings what drives this... thing,:
a pic18f4550 via usb :)

with this setup the timing gears are geared at 3:1 and i can get 0.1mm reliably

believe it or not even though some of the wiring looks a little in adequate these motors are actaully running at around 10 to 15% of their capable speed and as a result i don't really need those heat sinks,
 
Last edited:

BeanieBots

Moderator
What is your control method?
The relays look like it might be simple ON -> at position -> stop, or is it more complex, eg full PID?
 

Wrenow

Senior Member
demonicpicaxeguy Thanks for the reply.
Also for the hope that someone had done this before.
I was browsing allover for some light.
All that came close I would say was an Encoder.

You Mention I'll need some sort of feedback, would a pot work?
Also
how many divisions per rotation are you going to need?
I don't really understand this Question.
Do you mean that for every turn of the DC Motor it can be a specific angle like a servo?
Learning a bit more about how a servo actually functions would be very useful if you want to roll your own.

In a nutxhell, you have a geared motor, with a pot attached to the geartrain (in R/C hobby servos) for position feedback and a "servo amplifier" board that thkes the position command pulse, sees if the servo is in the correct position, and moves it if not.

Understanding this, if you need more power and range, there are modifications you can make to the servo (like the gearbox mod here http://servocity.com/html/robotzone_servos.html. Servo City also has linear actuators style servos that might be useful in what you describe, though they are not exactly inexpensive.

Or, if using heavier duty, more commercial servos, there are heavier duty, commercial servo controllers.

Many are suggesting using shaft encoders - that will let you know how many turns the shaft has made, from which you can calculate the relative position from where you began counting, but it does not, per se, give you absolute position sensing over the rante (you need to set the position from time to time by going to the end or gointg until a sensor is tripped, etc.)

It also kind of depends on what you are driving as to what might be appropriate. For a lead screw (with tons of rotations), you might have one solution, while with a timing belt to move your widget, you can get by with far fewer rotations (Instructibles has an X-Y table with a timing belt that uses a 10-turn pot for the position sensor and uses regular a regular old servo for the rest of the guts. http://www.instructables.com/id/Low_Cost_Hobby_Servo_XY_Table/

Cheers,

Wreno
 

xtech007

Senior Member
Lots of great responses!

to answer some of your questions,
Yes its a Gear head motor from a wheelchair.

I like the pot Idea !!
thanks for the pictures..

Has anyone experimented with the guts from a small servo?
would it be possible to show me some samples..

You guys are great !! thanks..
I'm open for any suggestions.
 

BeanieBots

Moderator
You will need more than just a basic transistor or FET if you want to drive in both directions. You will need a full H-bridge.
You could either buy an h-bridge chip or make one. There are plenty of circuits out there if you put "H-Bridge" in google and quite a few circuits can be found here as well. Just use the signals which would normally go the servo to drive the inputs of the H-Bridge.
 

xtech007

Senior Member
Its getting Interesting!

BeanieBots thanks for the reply.
I'm Planing to use the MD03 controller witch is an H-Bridge to drive the motors.
What I'm wondering is how would the dc motor get a reading using a pot and translate that to make it think its a Servo?:rolleyes:
 

demonicpicaxeguy

Senior Member
What is your control method?
The relays look like it might be simple ON -> at position -> stop, or is it more complex, eg full PID?
actaully those two relays are basically where my h bridges used to be, the are double throw so if you wire them up correctly you can get full forward and reverse, as for control i've written a software pwm module for control
 

Marcwolf

Senior Member
Hi.
I have recently modified a small 9g servo to becume a 10 turn winch. Unfortunately due to the small size of everything my photo's of the proceeding are very blurred.

What I did was take a standard TowerPro 9g servo. after unscrewing the base I took off the gears to expose the pot and its spindle.

I then removed the pot (it just slips out) and replaces it with 3 washers superglued together as a base.

Next I got one of the long 10 turn pots (not the little square ones) and with some careful soldering and some brass tubing (Model shops have a very nice range of small bras items) I soldered up a new spindle. Also soldered some wires onto the pot.

Using some Silicone sealent I then glued the 10 turn pot back into the servo housing. As I do not have micrometer accuracy re soldering this alowed the pot to shift a little when the spindle was rotaing with the gears.

Next I solgered the wires onto the servo controller board. I could test this by applying poers to ne serve and adjusting the pot untl the motor stopped. Once I had a base line I could see the motor rotate one way and then the other depending on which way I rotated the spindle.

Next I cut a hole in the plastic base of the servo so that the pot could poke through.

Finally I reassembled the servo - dropping a tiny smear of superglue on the pot spindle when I was pressing on the last gear.

Sealing any open holes with silicon sealet I then put a piece of heat shrink over the other end of the servo ro protect the control board.

I now have a 10 turn minature winch. For a spool I am using a plastic sewing maching bobbin. Even though it is still a 9g it has a decent pull.

It took a lot of fiddling but I now have 2 and with a little work I could refine my techniques to do a better job.
One thing I have found is a new Selley's product which is a superglue but with a rubber inclusion. This means that the glue still has flexibility re vibrations but the same holding power of normal superglue. I migh try using that to secure the spindle onto the pot so to give a little more play.

Hope this helps someone.. Again - sorry no pictures


Dave
 

BeanieBots

Moderator
@ xtech007
You need to mechanically attach the pot to the motor (obviously) and then connect the pot to the electronics from the hobby servo. The connections from the hobby servo electronics which originally went to the hobby servo motor then go to the more powerful H-Bridge which is required to drive your larger motor. Essentially, it boils down to adding an "amplifier" between the servo motor output and the larger motor.

@dpg
What I was really after is what is your transfer function between encoder and PWM?

@Marcwolf
Yes, I've done that too and was lucky enough to have a 10-turn pot which could actually fit in the same location as the original pot. However, I did find the result gave rather sloppy response around the setpoint position. Might have a go at increasing the servo loop gain one day to make it crisper.
 

demonicpicaxeguy

Senior Member
@ xtech007

@dpg
What I was really after is what is your transfer function between encoder and PWM?
as i said it''s a software implemented pwm the code for it is below, it isn't however picaxe in nature basically the output pin on the hall effect sensor goes straight into the adc on the pic and it's read in 8bit mode and once the readings cross a certain threshold the power is cut and the step is complete,
the

t1:
xpower = 1
WaitUs xontime
xpower = 0
WaitUs xofftime
Adcin 0, reading
If reading < 140 Then Goto t1
xpower = 0
pxbit = 0
Goto ee


my problem is that because i'm using double throw relays as a hbridge i've got no electromagnetic brake like you would in a normal h bridge,
i might try and build one on the weekend,
 

BeanieBots

Moderator
In a nutshell then, infinite gain proportional only with time domain hysterisis.
Fancy words for "drive full wack till you get there then stop".
 

Peter M

Senior Member
DPG can't you use DPDT relays and use the spare contacts to short the motor windings?
i.e. both relays in series, across the motor, so that when either relay is activated the short is removed..... commonly used in electric and battery tools... stops 'em pretty quick!
 

demonicpicaxeguy

Senior Member
DPG can't you use DPDT relays and use the spare contacts to short the motor windings?
i.e. both relays in series, across the motor, so that when either relay is activated the short is removed..... commonly used in electric and battery tools... stops 'em pretty quick!
i'm just going to use a mosfet hbridge and do it properly,
 

xtech007

Senior Member
Getting closer but still no Luck :(

Ok this is what I have done so far..
Removed the electronics of a 9G servo, replaced the pot with a 5K 7/8 turns,
attached the pot to my gear head DC motor, Removed the servo motor, I'm planning to use these 2 wires from the servo electronic board that attached to the servo motor to connect to a 24Volt dc. Beaniebots advised earlier,The connections from the hobby servo electronics which originally went to the hobby servo motor then go to the more powerful H-Bridge which is required to drive your larger motor
Can I connect it to my MD03 board?
If so can anyone guide me Please.. ?
I have ran out of Ideas, But here is the MD03 data sheet if anyone is Interested
http://www.robot-electronics.co.uk/htm/md03tech.htm
I have tried connecting the signal positive from the servo to the SDA line and negative to ground but it just moves like it tries to center but it stops and that's where it stays.
the code I used with a 28x1 pic is the one from the data sheet to test the servopos.

I Wait for your reply's ..
Once again thanks!!!!!!!!!!!!
 

Rickharris

Senior Member
Unless I miss something vital i can'#t see any reason why - other than cost - you can't use a picaxe 08M/H bridge as a servo driver. The 08M is capable of counting pulses, of detecting and measuring the output from a RC receiver and producing the necessary signals for driving the motor whilst monitoring the feedback pot or whatever you use.

At around £1.50 for the 08M and a few bits and bobs for the H driver this seems cheaper than wreaking an RC servo.

It is also programmable to do exactly what you want it to do.
 

Wrenow

Senior Member
Unless I miss something vital i can'#t see any reason why - other than cost - you can't use a picaxe 08M/H bridge as a servo driver. The 08M is capable of counting pulses, of detecting and measuring the output from a RC receiver and producing the necessary signals for driving the motor whilst monitoring the feedback pot or whatever you use.

At around £1.50 for the 08M and a few bits and bobs for the H driver this seems cheaper than wreaking an RC servo.

It is also programmable to do exactly what you want it to do.
Hmmm. With some decent hobby servos running less that USD$10 brand spanking new, and often for sale for less (and used ones with various parts broken, like case ears, or a stripped gear, etc. available probably free from modelers or in models from rummage sales), I am not so sure the 08M is that much cheaper (if any cheaper at all) than harvesting the parts from a servo for this particular job.

And the PID stuff is already done in the hardware.

I doubt I would harvest a >USD$100 top-shelf digital servo, but a <USD$10 regular old servo - absolutely. In many RC circles, they are pretty much a disposable commodity.

Find a local RC car, boat, or plane club and ask around, I would bet you can pick up some used or broken ones with the electronics portion still fine tor tuppence or less.

Cheers,

Wreno
 
Last edited:

xtech007

Senior Member
I have desassemble the servo..

The servo is not a problem its only $4 US and its all ready put together to my gear head motor.
Can I use a 24 Volt 200watt motor attached to the 08M ?
Rickharris if this is possible would you please elaborate, I would really appreciate it.
Thank you all.
I will post my progress.:)
 

Rickharris

Senior Member
The servo is not a problem its only $4 US and its all ready put together to my gear head motor.
Can I use a 24 Volt 200watt motor attached to the 08M ?
Rickharris if this is possible would you please elaborate, I would really appreciate it.
Thank you all.
I will post my progress.:)
NOT directly! - You need an H bridge, what type depends much on what you intend to do with the motor/servo system. In some cases a simple 2 relay bridge will do - In other cases things need to be complicated and PWM/PID loops/transistor/MOSFET Driver systems are required.

My plans & thoughts:

First I have to say I haven't yet done this yet, but at some time will need to drive some geared 180 watt DC motors using Picaxe - My thoughts so far have been:

For my application I do not need to worry about the 20ms frame rate of a standard servo so the picaxe should run fast enough even at 4 MHz my inputs will be direct to the PICAXE.

My application is to make a fairly robust linear actuator. I run a suitable nut (perhaps a ball nut or a lead screw) up a threaded shaft where the shaft is drive by the geared motor. The ball nut provides a linear push/pull output proportional to the number of times the shaft rotates.

RS components carry both lead screws and Ball nuts (the latter being much cheaper.) It is possible to make your own lead screw but a standard nut actually provides considerable friction unless very well lubricated. Nylon nuts can provide much smoother running. Alternative systems using toothed belts with the output actuator attached to the belt are even cheaper and do work.

Initial trials with an electric drill motor look hopeful.

At school, on a small scale, we have used a tube with LED/LDR at each end as the distance between them increases the LDR resistance increases, this can be used to control the position of the nut on the linear actuator - As things go it doesn't provide good repeatability of positioning though - at least as far as we tried it.

One possibility is to build a MOSFET H bridge - there has been some discussion on this in this forum so a search should throw up several threads. As I don't need to run to PMW even simple relay H bridge may suffice.

I intend to monitor the shaft rotation using a slotted disc and LED/Phototransistor. I intend to make the DC motor act like a stepper (in a way) so I can count revolutions of the geared down output shaft - this way the software is closed loop and simple to do:

Code:
Turn motor on in required direction for xx revolutions
Monitor shaft counter until count = xx
turn motor off.
Provided I keep track of where the nut is I know the relative position of the output - A strategically positioned micro switch can mark end stops/centre position.
 
Last edited:

BeanieBots

Moderator
I second everything stated by Wrenow.

Trying to make your own from an 08M would be a fun project but I doubt you would ever get very good results control wise.
Basic control theory, do the sums. Resolution, calculations and number of itterations per second vs harware solution. No harm in trying though, the excersise alone would be very good experience.
 
Top