Robin Lovelock
Senior Member
Hi Folks. I'm new to the PICAXE stuff, and hope
that someone can save me some time on getting
RS232 input to work on a AXE024 servo controller.
Many Thanks in advance for any help and advice.
Thanks also to my friend Roy who recently
introduced me to PICAXE and got me started.
I'm hoping to make an RS232 servo controller,
to replace a Pololu SCCII, based on the AXE024.
This is part of a robot boat project described on
www.gpss.co.uk/autop.htm
You may enjoy the "Snoopy Sails!" video
The robot boat is navigated by an iPAQ Pocket PC
with RS232 for GPS input and output to the servo controller.
For the past year we've used a standard Pololu SSCII
servo controller, plus a small card from friend Klaus
in Germany, because of the simple protocol we use on RS232.
We wish to do everything on one PICAXE card,
even if this restricts the number of servos to 2 or 3.
Please remember that I'm a newbie to PICAXE stuff,
and cannot afford to spend a lot of time on this
particular part of what is for me a hobby project.
I'm an old man of 62 who cut his teeth on computers
in the 1960s: details on www.gpss.co.uk/history.htm
So please be gentle with me
I'm having problems with RS232 input: details below.
Can the AXE024 handle RS232 input AND control three servos ?
The RS232 input is a very simple protocol:
a three byte servo command: 127=sync, 0,1 or 2 for servo number,
0 to 126 servo position (translated by my SC1 program on the AXE024).
I've tried quite a few other things already,
including putting the RS232 input onto a servo pin,
but what I have is now is using 08M pin 4 (signal 3).
My PC COM1 port has a test program, AUTOP,
already proven for testing the Pololu Servo Controller.
Clicking on a button sends the three required bytes out
via RS232 into the PICAXE AXE024 servo controller with 08M.
The RS232 is wired into pin 4 (signal 3) on the AXE024
(have tried with and without 10k pullup resistor)
and three servos are plugged in to the servo positions.
My SC1.BAS (code below) application runs OK, using SERVO to
do the correct test pattern of wagging all three servos twice,
before waiting on a byte from serial input with
SERIN 3,N4800_8,b1
It does as it should, waiting, until I send the 3 bytes from PC.
It SHOULD waggle just one servo and then wait.
There is a twitch on one servo, and then the program restarts.
Presumably due to an error condition.
Same symptoms both with and without the 10k pull up resistor.
I thought the error condition might be due to the next two bytes
coming in before the SERIN were issed, but this latest version of
SC1 program just does the SERINs. i.e. not waiting on sync byte.
No delays yet added between the three bytes from the AUTOP on PC.
Extra notes: wires from 9 way D on PC COM1: pin 5 = 0V, pin 3 signal.
Not using SERVOPOS due to unreliabity. Can return to this later.
But SERVO seems to work reliably enough while I work on this RS232 input.
Document for AXE024 servo controller: http://www.rev-ed.co.uk/docs/axe024.pdf
Document for programming: http://www.rev-ed.co.uk/docs/picaxe_manual2.pdf
Robin
www.gpss.co.uk/autop.htm
'SC1.BAS servo controller for robot boat
'input is RS232 group of 3 bytes:
'127=sync, 0,1 or 2=servo number, 0 to 126 servo position
verytop:
b5=100 'limits of servo travel
b6=191 '100 to 191 gives 360 degrees
'first a simple test pattern
'wag servos 1,2,4, twice.
SERVO 1,b5 'initiate 3 servos
SERVO 2,b5
SERVO 4,b5
PAUSE 3000 'pause 3 secs
for b7=1 to 2
SERVO 1, b6 'drive servo 1
PAUSE 1000 'pause 1 secs
SERVO 2, b6 'drive servo 2
PAUSE 1000 'pause 1 secs
SERVO 4, b6 'drive servo 4
PAUSE 1000 'pause 3 secs
SERVO 1, b5 'all back
SERVO 2, b5
SERVO 4, b5
PAUSE 3000 'pause 3 secs
next b7
'then wait for bytes on serial port to control servos
sync: SERIN 3,N4800_8,b1 'read byte from RS232 input on 3
'IF b1<>127 then goto sync 'wait for the sync byte of 127
SERIN 3, N4800_8,b2 'read servo number 0 to 2.
SERIN 3, N4800_8,b3 'read servo position 0 to 126
'this for test only - wag just servo 1
SERVO 1,b6 'drive servo to upper limit
PAUSE 3000 'pause 3 secs
SERVO 1,b5 'drive servo to lower limit
PAUSE 3000 'pause 3 secs
SERVO 1,b6 'drive servo to position based on 3rd byte
PAUSE 3000 'pause 3 secs
GOTO sync
'(logic here will be different if and when RS232 is working)
that someone can save me some time on getting
RS232 input to work on a AXE024 servo controller.
Many Thanks in advance for any help and advice.
Thanks also to my friend Roy who recently
introduced me to PICAXE and got me started.
I'm hoping to make an RS232 servo controller,
to replace a Pololu SCCII, based on the AXE024.
This is part of a robot boat project described on
www.gpss.co.uk/autop.htm
You may enjoy the "Snoopy Sails!" video
The robot boat is navigated by an iPAQ Pocket PC
with RS232 for GPS input and output to the servo controller.
For the past year we've used a standard Pololu SSCII
servo controller, plus a small card from friend Klaus
in Germany, because of the simple protocol we use on RS232.
We wish to do everything on one PICAXE card,
even if this restricts the number of servos to 2 or 3.
Please remember that I'm a newbie to PICAXE stuff,
and cannot afford to spend a lot of time on this
particular part of what is for me a hobby project.
I'm an old man of 62 who cut his teeth on computers
in the 1960s: details on www.gpss.co.uk/history.htm
So please be gentle with me
I'm having problems with RS232 input: details below.
Can the AXE024 handle RS232 input AND control three servos ?
The RS232 input is a very simple protocol:
a three byte servo command: 127=sync, 0,1 or 2 for servo number,
0 to 126 servo position (translated by my SC1 program on the AXE024).
I've tried quite a few other things already,
including putting the RS232 input onto a servo pin,
but what I have is now is using 08M pin 4 (signal 3).
My PC COM1 port has a test program, AUTOP,
already proven for testing the Pololu Servo Controller.
Clicking on a button sends the three required bytes out
via RS232 into the PICAXE AXE024 servo controller with 08M.
The RS232 is wired into pin 4 (signal 3) on the AXE024
(have tried with and without 10k pullup resistor)
and three servos are plugged in to the servo positions.
My SC1.BAS (code below) application runs OK, using SERVO to
do the correct test pattern of wagging all three servos twice,
before waiting on a byte from serial input with
SERIN 3,N4800_8,b1
It does as it should, waiting, until I send the 3 bytes from PC.
It SHOULD waggle just one servo and then wait.
There is a twitch on one servo, and then the program restarts.
Presumably due to an error condition.
Same symptoms both with and without the 10k pull up resistor.
I thought the error condition might be due to the next two bytes
coming in before the SERIN were issed, but this latest version of
SC1 program just does the SERINs. i.e. not waiting on sync byte.
No delays yet added between the three bytes from the AUTOP on PC.
Extra notes: wires from 9 way D on PC COM1: pin 5 = 0V, pin 3 signal.
Not using SERVOPOS due to unreliabity. Can return to this later.
But SERVO seems to work reliably enough while I work on this RS232 input.
Document for AXE024 servo controller: http://www.rev-ed.co.uk/docs/axe024.pdf
Document for programming: http://www.rev-ed.co.uk/docs/picaxe_manual2.pdf
Robin
www.gpss.co.uk/autop.htm
'SC1.BAS servo controller for robot boat
'input is RS232 group of 3 bytes:
'127=sync, 0,1 or 2=servo number, 0 to 126 servo position
verytop:
b5=100 'limits of servo travel
b6=191 '100 to 191 gives 360 degrees
'first a simple test pattern
'wag servos 1,2,4, twice.
SERVO 1,b5 'initiate 3 servos
SERVO 2,b5
SERVO 4,b5
PAUSE 3000 'pause 3 secs
for b7=1 to 2
SERVO 1, b6 'drive servo 1
PAUSE 1000 'pause 1 secs
SERVO 2, b6 'drive servo 2
PAUSE 1000 'pause 1 secs
SERVO 4, b6 'drive servo 4
PAUSE 1000 'pause 3 secs
SERVO 1, b5 'all back
SERVO 2, b5
SERVO 4, b5
PAUSE 3000 'pause 3 secs
next b7
'then wait for bytes on serial port to control servos
sync: SERIN 3,N4800_8,b1 'read byte from RS232 input on 3
'IF b1<>127 then goto sync 'wait for the sync byte of 127
SERIN 3, N4800_8,b2 'read servo number 0 to 2.
SERIN 3, N4800_8,b3 'read servo position 0 to 126
'this for test only - wag just servo 1
SERVO 1,b6 'drive servo to upper limit
PAUSE 3000 'pause 3 secs
SERVO 1,b5 'drive servo to lower limit
PAUSE 3000 'pause 3 secs
SERVO 1,b6 'drive servo to position based on 3rd byte
PAUSE 3000 'pause 3 secs
GOTO sync
'(logic here will be different if and when RS232 is working)