Serial and the servopos command.

Joeroddis

Member
Hello all, i am planning to build a wireless servo controller for a project.
I plan to do this by
Picaxe -> 433mhz transmitter---Reciever -> Picaxe -> Servos

In the manual it says 'Note that the overhead processing time required for processing
the servo commands every 20ms causes the other commands to be slightly
extended i.e. a pause command will take slightly longer than expected. The servo
pulses are also temporarily disabled during timing sensitive serin, serout, sertxd
and debug commands.'

Does this mean the servos would lose position when a command is recieved on the serin pin?
If so what work arounds are there? i would like to avoid purchasing the 21 servo driver board if possible.

Cheers
 

hippy

Ex-Staff (retired)
What happens is that when the PICAXE executes a SERIN it waits until data is received and during that time the servo updates won't happen, the servo 'goes floppy' or can lose its intended position.

There are work rounds. The 21 servo driver is one. Alternatively use a master PICAXE to drive the servo(s) and a slave PICAXE which handles the received data via RF. The slave will tell the master when it has valid data, the master will ask for it and the data gets passed over. The master will only enter SERIN when there is data available so any disruption to servo control is minimised.

A forum search should give a lot more information on RF reception and servo control.
 

Joeroddis

Member
Thanks hippy, sounds like the same principle that the 21 servo driver board works on. Might just be easier buying that (Y)
 

steliosm

Senior Member
Joeroddis what are you trying to control with the servos? Do you need force to be always applied from the servos?
 

jppizhere

New Member
I am working a very similiar project

Joystick -> Visual basic -> Serial Out -> ?picaxe maybe? -> 433mhz Receiver->Picaxe->servos

Currently running 14m for this project, I am using two axis and throttle of joystick along with six buttons for fine trim to control 3 servos via serial (have not yet added in transmitter, just straight serial link from PC) and using pulsout on 3 pins instead of the servo command available to only one pin at a time. Using a Timer in VB with interval set to 105 (any faster and I get erratic output from the servos, I presume due to processing time for the three pulsout commands.) I process joystick position, convert it mathmatically to usable servo output values and transmit it.

With this setup I get servo movement nearly as smooth as I get out of the R/C system in my small helicopter. I have tested this setup by hand, holding the servo in position and resisting movement of the servo (up to stalling the servo, ruined 2 servos on this project so far) and have not noted the servos "going floppy" so to speak. At very worst, resisting the servo to near stall or stall there is a ratcheting or pulsing type movemet felt in the servo, but under normal load conditions i do not feel that it would even be noticeable.

Servos do not "go floppy" in the 20ms pause between pulses out of an R/C receiver and it seems this 20ms can be streched significantly.
 

jppizhere

New Member
I just tried this setup with the joystick throttle controlling an ESC hooked to an electric ducted fan I had lying around. It worked perfectly.
 

krypton_john

Senior Member
What happens is that when the PICAXE executes a SERIN it waits until data is received and during that time the servo updates won't happen, the servo 'goes floppy' or can lose its intended position.

There are work rounds. The 21 servo driver is one. Alternatively use a master PICAXE to drive the servo(s) and a slave PICAXE which handles the received data via RF. The slave will tell the master when it has valid data, the master will ask for it and the data gets passed over. The master will only enter SERIN when there is data available so any disruption to servo control is minimised.

A forum search should give a lot more information on RF reception and servo control.
Hippy, what is the simplest picaxe - pixaxe communication method for this sort of master/slave job? Obviously we can't use serial comms, and if using the smaller parts there's no i2c. If there's more than a couple of bits of data then there's also insufficient pins on the smaller parts.
 

jppizhere

New Member
This problem would only seem to exist when the picaxe is spending a considerable amount of time waiting for data.

As long as we can wait, receive, and write data in under 20ms everything is still within the specs for servo operation, and obviously servos will operate quite well even when these specs are deviated from by a fair amount.

I have seen a frequent work around where people are setting the servo pin low to "turn off" the servo command prior to receiving serial data. Turning off all control to a servo does in fact basically put into nuetral, you can see this for yourself simply by unplugging the data line on an operating servo. I use pulsout because even if the pulses are delayed past 20ms the servo still seems to be trying to maintain last position while waiting for input and not just going limp. I can not absoulutly verify that this is what is happening, but if it is going into nuetral and the restarting it is to fast for me to catch, I do however know that a servo does not go limp in the 20ms pause between pulses on a regular r/c system.
 
Top