The servo now Moves! but not smoothly

Ok I have finally got the servo to move but it took the servo about 5 min to move from one side to another and the way it was moving was even more puzzling. It would move an inch then stops completely then after a few min it would suddenly move again. I do not know if it is my battery ( a 6v heavy duty) or the code I am using. I used two versions of the same code.

  1. init: servo 7,75
    main: servopos 7,75
    pause 2000
    servopos 7,150
    pause 2000
    servopos 7,225
    pause 2000
    goto main

  2. init: servo 7,90
    main: servopos 7,90
    pause 2000
    servopos 7,150
    pause 2000
    servopos 7,210
    pause 2000
    goto main

Can some one help me on this new problem? Thank you for all your help in advance.

I am using a PICAX 28X1 and I have everything connected to the common ground. I don’t think that it is the battery because when I hook my multi meter up to the power rail I don’t see the voltage fluctuate much as for amperage though I have no Idea because my multi meters fuse will fry if I try to measure the amperage. That is why I have yet to rule out the power.

I cant really tell you I bought the PICAXE-28X1 USB Starter Pack and I do not know what oscillator is on it (if any I think it might have an internal oscillator on it) and I am using a X1 model and I think only the X2 have ways to change the frequency it runs at with out changing the oscillator. The only thing I can tell you is it says in the manual something about servo frequencies (I cant remember exactly) under the servo part of that but I think it was Cbenson that connected the makers of the picax and said that the picax 28X1 should work fine with my servo. Also my servo is fine because I have two Hitec Hs-311 servos and one Hitec Continuously rotating servo and the same thing happens to all three.

Thank you for all the help so far.

Ok I set my microcontroler to to 4MHZ and nothing happened with the servo. I also tried 8MHZ but that didn’t work either. I would have set it to 16MHZ like you suggested but 8MHZ is the highest setting. I also rechecked the battery and it is still at 5.5v. I wish I could figure out what is going on.

Ok I switched all the servopos with the servo command and tried every combination of the code I could think or and still nothing works. Thanks for all your help so far though I really appreciate it. Also here are some pictures just like you requested. Sorry for the bad quality I couldn’t find the camera so I had to use a video camera.

Ya I am sorry about that once agin I couldn’t find my camra. Ok just tell me what to do and Ill do it. Thanks agin for your help.

Actually that code is fine, and was taken from the examples in the manual. What frequency are you running the PICAXE at?

You need to lock in the PICAXE at a specific frequency for the timing to work, this can be done with the setfreq command (page 185 of the manual). For your X1, you want to go with 4 or 16MHz.

setfreq m4 ‘ setfreq to 4MHz

Can you please take pictures of your setup, that would help.

We suggest you stay with 4MHz.

Also, try converting all the servopos commands to simply servo commands, this might solve your problem.

Haha, those images will not work (a bit too dark) :smiley:

At this point, we suggest you contact PICAXE directly for support. We have exhausted solution ideas for this problem… This should not be so complicated!

Hi Pttn40,

Which microcontroller are you using? Noe that you need to have common ground between the servo and the power supply, as well as the microcontroller. The signal needs to be repeated every 20-30ms.

Sincerely,

A servo motor does not use much current unless you are using a giant scale or high torque servo motor. You have the servo’s ground connected to the microcontroller’s ground, the microcontroller’s ground connected to the batter’s ground. The battery’s positive terminal connects directly to the servo’s red wire. What voltage battery are you using andwhat capacity?

If this is the setup, and you are using the correct pin on the microcontroller, it can only be a problem with the code or the servo itself. Do you have any way of testing the servo itself? In your initial code, notice the pause 2000 - this means that for 2 seconds the servo position is not updated; a servo position needs to be updated every 20 to 30 milliseconds. The pause should be only 20 assuming it is in milliseconds.