Picaxe and Servo problem

Ive been using this picaxe uC for a while and have had no problems, but in my latest project I wanted to pan a servo back and forth. Problem: for the life of me I can only get the servo to move in one direction. It is a GWS pico servo and I have "operated" it on 5v and 6v, so i dont believe it to be a voltage issue. coding issue perhaps? ( I have tried the SERVO command, the SERVO and SERVOPOS command, and even the correct PULSOUT commands to no avail) I have scoured other forums, even rev-ed.com's, but no one seems to have my same problem. As far as I know the SERVO command SHOULD work fine but doesnt. I have tried the commands with and without a 220 ohm resistor on the signal wire, but this seems negligible. When my picaxe 18x is loaded with any servo capable code and the connections are all hooked up, the servo simply moves all the way and stops. the only way i can "reset" my servo to its original position is by quickly removing and tapping the V+ or GND supply wire to the servo. after the servo has moved I can feel the tiny motor jiggle whenever I tap the signal wire as if trying to work. ANY suggestions are welcome!

Picture of Picaxe and Servo problem
sort by: active | newest | oldest
1-10 of 20Next »
protoproff3 years ago
Hello bud is it an analogue or digital servo?
Aleator777 (author)  protoproff3 years ago
Haha, I'd almost forgotten about this topic. I've made a lot more progress when it comes to working with electronics since then. It was a digital servo. There was no major issue, I had simply forgot to connect the two ground/common lines together. Worked like a charm afterwords!
Nice 1 bud, i was also having issues with diff type of servos until i cracked it.
Keep up the good work.
targetdg155 years ago
Im just getting into Picaxe... How would i connect the servo to a picaxe 18 like the one pictured?
Aleator777 (author)  targetdg155 years ago
Well, first you'll need a separate 6 volt powersupply for powering the servo (4 AA batteries connected together in series will work) a 4.5 volt power supply for the PICAXE (3 AA batteries) and a wire to connect from the digital output line of the PICAXE to send the signal to the servo. I made a quick image to show this. Note, the grounds (negative black wires) need to be connected together too.
picaxe servo.jpg
Thanks! I guess I was more hoping for an attachment I could solder the to picaxe board for servos.... Is there anything like that? That picture really helps!
Aleator777 (author)  targetdg155 years ago
Well, I've long since lost that particular board, but if you have that same one, I recall that the output holes are spaced very wide, so no standard attachments. I would just solder a wire directly from the digital output pin you wish to use for the servo. If you google picaxe servo board, plenty of boards should show up. You may wish to check out: http://www.picaxe.com/Hardware/Add-on-Modules/21-Channel-Servo-Controller/
sci4me5 years ago
has this been fixed?
nealbirch5 years ago
for you who don't want to read this whole post the short version is:

when servo is on pin2, the servo command is
servo 2,<position>
where position is stepped from position 65 to 220 by 5's and back using "for, next" instruction.  My servo could move from about position 60 to 220.

output 2 'declare your outputs!
for b2 = 65 to 220 step 5
servo 2,b2
pause 9
next b2
for b2 = 220 to 65 step -5
servo 2,b2
pause 9
next b2

I am using this code to make a picaxe 08m drive a useless box, I destroyed the box while I was tweaking it so I need to get a new box from the craft store at the moment.

I use one pole of a dpdt as the on-off switch, when you turn it on it powers a 7805 to convert 9v to 5v, arm moves off a microswitch which powers the circuit when dpdt is in power-off position, arm moves to turn dpdt to power-off position, second pole of dpdt closes to send signal to pin4 which moves arm back to open microswitch and removes power from the 7805. Sadly the capacitors needed to smooth the power held enough juice to move the servo off the microswitch, which caused the servo to cycle off and on the microswitch. I found I could drain the power to ground but broke the box trying to get the microswitch flipped around so I could do that.

' useless_box.bas - using picaxe as controller
' pin1 is led, servo is pin2, off switch(dpdt) pin4
'need to debounce open micro-switch, try grounding non-power side
' by connecting ground to center pin of microswitch to drain capacitors
' or figure out code to do so.

input 4 'second pole of dpdt
output 1,2 ' led is output 1, servo is output 2
low 1 'set led low

gosub switch_off: 'move arm to turn dpdt switch power open, input 4 closed
gosub detect_off: 'sense that switch has been turned to off position
end ' nothing else as power should be off at this point

switch_off: high 1 'led on
for b2 = 65 to 220 step 5
servo 2,b2 'servo on pin 2 gets signal to move to switch off
pause 9
next b2

if pin4 = 1 then shut_down:
pause 50 'added delay to detect pin4
goto detect_off:

shut_down: 'move arm back to rest position
low 1 'led off
for b2 = 220 to 65 step -5
servo 2,b2
pause 9
next b2
return ' power is off at this point

smatt4447 years ago
I have the same servo and im getting the same thing it only wants to go one way
1-10 of 20Next »