Continue to Site

Welcome to our site!

Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

  • Welcome to our site! Electro Tech is an online community (with over 170,000 members) who enjoy talking about and building electronic circuits, projects and gadgets. To participate you need to register. Registration is free. Click here to register now.

Full Rotation Servo Motor

Status
Not open for further replies.

surferdude89

New Member
I bought a full rotational servo motor for my project but it doesn't have any datasheet... =.=

so i run through the web and find some examples, can i use tis code? what further modification do i need? and can anyone explain the code used for servo motor? pls and thank you!

define osc 20

trisa.0=0 ''LEFT MOTOR''
trisa.1=0 ''RIGHT MOTOR''

LM var porta.0
RM var porta.1

Forward:
PULSOUT 0, 170 ‘ Left wheel anti-clockwise
PULSOUT 1, 130 ‘ Right wheel clockwise
PAUSE 20 ‘ Wait 20 ms
GOTO Forward ‘ Repeat
 
It depends on if the servo has been modified for simple motor usage (The onboard PWM circuit bypassed) or if the onboard controller is still available.
 
Basically a servo is a pulse stretcher fed into an h-bridge. It receives a 1-2ms pulse and at 1.5ms it does nothing, above or bellow 1.5ms and it will send a stretched out pulse of power proportionately related to the deviation from 1.5ms to the motor.

They're meant to be driven at around 20 times per second, that's what the above code does. It generates a pulse of 1.70ms for one servo and a pulse of 1.30ms for the other and then delays 20ms, .2ms above and .2ms bellow 'center' changing those numbers to 180 and 140 will likely increase the torque of the servo motors a bit but be careful when experimenting with pulse width vs pulse frequency. You could actually drive the motor with longer pulse widths less frequently for maximum torque but it depends on what point the pulse stretcher circuit of the servo will reset at. Send too long a pulse and the stretcher will reset before it ends resulting in lurching, send the pulse too frequently and there will be pseudo random interruptions to motor current and frequency feedback to the pulse stretcher that can cause random twitching.
 
is there a difference in code if i use don't use a servo motor controller compare to one that uses a servo motor controller?
 
I have never seen anyone completely gut a servo's electronics and drive the motor directly before, there's really no point, that's why servos are so nice, the drive electronics are already there, use them, I'm not sure what Nicksan was talking about; Modifying a servo for continuous rotation is as simple as detaching the feedback POT from it's drive train and using some hot glue to lock it in place. Then instead of the servo pulse relating to a proportional position it becomes a proportional velocity (torque) The further from center (whatever pulse position the feedback pot was locked at) the pulse gets the higher the torque pulses the motor gets.
What you've described is a servo modified for continuous rotation. The only bad thing about this is if the servo electronics are under extreme operating conditions (temperature or voltage) the normal servo 'center' signal will cause the motor to drift juuuuust every so slightly in one direction or another. Not an issue if you just don't send the servo a signal when you're not driving it, then the driven wheel will just float.
 
Last edited:
i'm only using 2 servo motor and the motor controller is quite costly so i wana try it without the controller... but really cannot T.T not sure whether is my code wrong or what...
 
Did you try the code? It looks fine to me.
 
Last edited:
Status
Not open for further replies.

Latest threads

New Articles From Microcontroller Tips

Back
Top