PICAXE 28X2 and Servo

henriksod

Member
Hello. I'm using the PICAXE-28X2 with a servo attached to port 0. I am programming the picaxe with this block of code and it works like a charm to transfer it over and all:

Code:
' TEST
servofun:

servo 0, 75

wait 2

servo 0, 225

wait 2

servo 0, 150

wait 2

goto servofun
The problem is that the servo doesn't start running. I try to re-plug the power cable and it moves a little bit before it stops and is dead.

Anyone knows what the problem is?

EDIT:

I am using an PICAXE28X2 Shield Base (AXE401) together with the Instant Robot Shield (AXE408).

I've set the base to 5V with a block and I've tried to feed everything with
1. A 4-slot battery box with 4 1.2V 2500mAh batteries (Portable). Just noticed that this gives a too small voltage output (4.8V)
2. A 600mA 230V->12V Adapter (Not portable)

The first method made the LED on the base light up fairly good. Method two made the LED light up probably at it's max, because I've read that 12V is the maximum ammount of voltage the PICAXE can take.

There are 7 regular slots and 5 A-slots (I am a beginner at this, so I'll call them that) on the Robot Shield. The servo is connected to the Robot Shield at regular slot 0 (White: Signal, Red: +, Black: -). I am almost totally certain that it should be that way. Or maybe I should try A0-A5?

UPDATE: It magically worked! I put the servo at slot 5 and re-programmed the PICAXE to...
Code:
' TEST
servofun:

servo 5, 75

wait 2

servo 5, 225

wait 2

servo 5, 150

wait 2

goto servofun
...and it worked! But the question is why? Why on pin 5 and not on pin 0?
 
Last edited:

Technical

Technical Support
Staff member
Make sure the servo is connected direct to the PICAXE output pin, not via a buffered output (e.g. on the AXE020 project board).
 

westaust55

Moderator
What is the power supply arrangement for the PICAXE and SERVO?
If they are from a single supply that is a bit "weak" so that the voltage dips when the Servo starts to move, that may cause the PICAXE to reset.

Likely not the cause of your problem but after you use the SERVO command for a particular pin once, it is batter to use the SERVOPOS command for subsequent movements of the Servo.

Some details about:
1. what project board you are using
2. the power supply configuration

A schematic diagram showing how you have the parts connected would also be useful. Show any capacitors that you have in the circuit - there should be decoupling capacitors to help filter out electrical noise and "bulk" energy capacitors to help ride through voltage dips.

Many people have found a separate supply for the servo motor is the solution.
IF using two separate supplies, do you have the ground / 0 Volt of both supplies connected together?
If not there will be no reference for the Servo signal and hence no movement of the Servo shaft/horn.
 
Top