How to make your own servo

DIY_SERVO.bas (1588Bytes)

(If Google video is down, video is here)

I like servos!

However, sometimes you want what a servo does, but you need one that is special: Very strong, very fast, takes more voltage, does not need a servo controller etc.. And you are not going to buy one for a trillion dollar and wait for it to arrive.. So you build it yourself :)

It is quite easy: A motor hooked up to a motor controller so it can turn both ways has a potmeter on it, and the potmeter tells the microcontroller where the motor is, and there you go!

You can make the fastest servo in the world by using a low or no-geared motor. Or you can make it huge and strong enough to lift you..

In my case I just needed a servo that would not mind being kicked back to another position really fast when power was off.

Not much more to say? Potmeter has 3 pins. Middle goes to analouge in, the 2 other goes to G & V. If you switch them, your reading will just be reversed.

The potmeter is very light to move, so you can easely just make something with hot-glue-art, as I did, to make it follow the wheel.

Some geared motors has the axle sticking out at the other side, making it even more easy to mount the potmeter.

The potmeter I have used actually comes from an old servo.

Here is a sample program (To Picaxe) of one way to use the setup, it is what is running the homemade servo on the video: (Also attached)


 

' Set this up to match your hardware:
symbol PotmeterPin = 1' The analouge pin connected to the potmeter
' The lines marked with (M) should match your motor driver, in my setup below, it is output 6&7 ("B" on the picaxe 28 board)
'**************
symbol ServoPuls = w0' Word variable to calculate the puls to send to the motor
symbol DesiredPosition = b2' The variable used in the main routines to set servo at a position. 127 is middle.
symbol CurrentPosition = b3' The value returned from the potmeter


'**************


main:' Example program; If Pin7 is 1 then go to one position, else go to another..

if pin7 = 1 then

DesiredPosition = 70 gosub setservo 'this line is instead of the usual "servo pin,position" - 127 is middle

else

DesiredPosition = 210 gosub setservo 'this line is instead of the usual "servo pin,position" - 127 is middle

endif
goto main


'**************


setservo:' a subroutine that takes care of positioning the "servo"

readadc PotmeterPin, CurrentPosition

if CurrentPosition < DesiredPosition then
ServoPuls = DesiredPosition - CurrentPosition
' if ServoPuls < 2 then return end if ' Optional, to prevent jitter and buzzing, but getting less accuracy
ServoPuls = ServoPuls * 100
low 6 pulsout 7, ServoPuls ' (M)
end if
if CurrentPosition > DesiredPosition then
ServoPuls = CurrentPosition - DesiredPosition
' if ServoPuls < 2 then return end if ' Optional, to prevent jitter and buzzing, but getting less accuracy
ServoPuls = ServoPuls * 100
low 7 pulsout 6, ServoPuls ' (M)
end if

return


 

IMG_4845.JPG

IMG_4847.JPG



Very very cool
Very very cool

Potmeter?

I thought the scale that the dealer uses to weight your pot was a pot-meter.

(potentiometer)

www.rocketbrandcustom.com baby!!

good

very good, but the video don’t work.

 

pot controlling the servo
Very cool. Do you have a picaxe method for controlling a standard servo with a pot?

That would just

That would just be

main:

readadc 0, b0

b0 = b0 max 225 min 175

servo 0, b0 pause 20

goto main

Hook a potmeter to analouge in (3 pins on potmeter, 3 pins on analouge in (you need to add an extra pin yourself if you want) middle pin goes to middle, the two other can go either way, will reverse range if opposite)

Hook servo to digital out 0, read instructions, possibly see the “start here-project”, top menu.

lol

I was thinking the same thing,hey if you wanna bring your “bag of parts” to my place I will provide a potmeter and we can discuss potentiometer’s all night…

[email protected]

 

 

i like what your doing

I like what your doing but a PWM servo is just a brush type DC electric motor using an Hbridge, some are directly driven some are gear drive most common ones we see are wormdrive now I dont know about digital but pwm is just that.

I do like the horn improvement you done there is that epoxy or polymorph?

[email protected]

 

 

It’s hot glue
It’s hot glue

this has solvedd my servo

this has solvedd my servo issue… since i have a whole bunch of motors and 2 open motor ports and a bunch of pots and some hot glue …i will start tonight…

thanks for the great idea Frits!

Arduino??

I am making a steering servo out of an arduino, potentiometer and a windsheild wiper motor, wat would this code be if the output of the motor was going to an esc?

Well, ESC’s eats standard

Well, ESC’s eats standard “servo” pulsewidth signals, and in the example above, I was doing PWM to control the motor directly. ESC’s are individual, so my best advice is to first hook up the ESC to the motor, and learn how to control the motor the way you want it; Find out where neutral is etc. You do so by sending it same type of pulses you’d send to a servo.

Some ESC’s are a little too clever; They try and prevent something like an RC car from going from full speed ahead to full speed reverse in one go - some implement stops and need a neutral, perhaps a pause, before they will reverse.

And some will go faster one way than the other etc. First make sure you know all the servo signals (and possibly in between steps) to make your motor go to the side you want.

When that is done, all you have to do is place the potentiometer on the motor, lock it, and set the value of “straight forward” (turn the motor till it’s pointing ahead), and let that value of the potentiometer match the value of the neutral position in your program.

Boy, that sounded complicated, but I hope it made sense :slight_smile:

I cannot write the code for you, both because I find Arduino code to be so complex, so I am sure I’d make errors that needs to be debugged, and because I do not have your specific equiptment at hand, sorry.

Hi Frits from the past!

Hi Frits from the past! Thank you for posting this - I just needed it now, and the code was really well documented, you just saved me an hour or more - works terrific, thank you! :smiley:

Smart thing was; I needed a

Smart thing was; I needed a “servo” that could do over 360 degrees, and by a simple gear to the potmeter this was no problem. Thank you agan!

PID

 

This is like a easy version of PID?  how did u determinate the number 100?

I have no clue, the post is

I have no clue, the post is from 2008 :smiley:

:frowning:

That is a shame Fritsl from the present…if you see to Frits from the past please ask him.

 

any way thanks for your reply.