Servo Control Problem

Thread Starter

Ray Haugen

Joined Jan 17, 2016
1
Hello everyone. I am not sure which category to ask this question so I will start in the General discussion.

I have a Hi-tec HS-322HD servo that I am trying to drive with a picaxe microcontroller. I have no problem generating a 20ms period pwm with pulse width varying between 1100 us to 1900 us as confirmed with my DSO. The servo specs indicate the neutral position to be at 1500 us. When I hook up the servo to the chip, the servo simply rotates completely counterclockwise to its stop and remains there. It doesn't matter what pulse width I use, it is always the same. I have two of these servos and have tried them both with the same results.

I am hoping that someone can help me out or point me in the right direction. This my first attempt at using a servo.

Regards

Ray
 

djsfantasi

Joined Apr 11, 2010
9,163
Do you have pictures and s schematic of how this servo is connected? Are you sure you are sending the pulses to the control wire. Also, how are you creating the control signal for the servo? Have you programmed it yourself or are you using a library?
 

RichardO

Joined May 4, 2013
2,270
Is your waveform the right polarity? I suspect that the servo is trying to go to the 20ms position. Try inverting the pulse to the servo and see what happens.
 

Reloadron

Joined Jan 15, 2015
7,523
Since nobody here can see the setup and you do not mention which PICAXE or provide the code you are using here is what I will suggest. Take a look at this PICAXE manual. The code sample they use on page 221 looks like this:

Code:
init: servo 4,75 ; initialise servo
main: servopos 4,75 ; move servo to one end
pause 2000 ; wait 2 seconds
servopos 4,225 ; move servo to other end
pause 2000 ; wait 2 seconds
goto main ; loop back to start
As to the PICAXE you are using:
On X2 parts servo will only function at 8MHz or 32MHz. On M2 and X1 parts servo will only function at 4MHz or 16MHz. On all other parts servo will only function at 4MHz. On X2 parts it is possible to change the 20ms delay between pulses. This is achieved via the ‘preload’ value, which is the number to preload into timer 1 before it starts counting. On X2 parts timer 1 increments every 0.5us, so for a delay of 20ms (20,000us) we need 40,000 increments. Therefore the preload value is 65,536 - 40,000 = 25,536.


The PICAXE you are using and a sample of your code would help?

Ron
 
Top