January 09 - Details now available on a new
speed enhanced SPU running
at 115200 Baud to give smoother motor drive.
December 08 - V2 of the PID Servo Control software is
now available and works with the V2 Motion Driver. V2 of the
Servo controller adds support for US Digital MA3 feedback
encoders and also adds dual PID settings which allow the SPU
servo characteristics to be switched automatically between
in-air and on-ground tunings. See the
US Digital Encoder
Support Page.
With the motion platforms operational for a while
now I've been able to think through and implement some substantial
improvements and simplifications to the platform control
system. Any way in which the build process can be made
easier and less expensive will make life a bit easier for DIY'ers, and the electrical and control system is a major
part of this. By changing where and how the control system
position feedback loop calculations are done I've
managed to substantially simplify the Signal Processor Unit.

The changes I've made to the
control system are:
-
Move the position
feedback loop / speed demand calculations out of the
external SPU and onto the PC with new PID Servo
Controller software.
-
Reduce the number of
PICAXE chips on the SPU from FOUR to ONE, and
substantially simplify the wiring complexity with a bit
of cost reduction too.
-
Drive the 3 MD03 speed
controllers from the SPU using the PICAXE chip's
built-in
Philips I2C
capabilities with the single PICAXE 28X1 chip as the I2C
bus master
- simpler wiring and more robust operation.
The result is a much
simpler SPU to build, simpler system wiring, more reliable
operation (the I2C bus seems to be much harder to knock
over than my previous pulse-based approach) and better more
easily tuned control settings using the PID Servo Controller
software. And looking forward it should also be possible to
change the I2C drive to a Serial drive without
much difficulty for other speed controllers that do not use
I2C but do accept Serial commands.
Single Chip SPU
By removing the need to do
any calculations in the external hardware the job of the SPU has
been much simplified - it now uses only a single 28X1 PICAXE
chip. Now its role is to collect and write
the platform position feedback information to the PC, and
then to
read back speed demand information and pass it straight
through to the motor speed controllers. It does have a
further important job and that is the critical role
of detecting loss of signal from the PC. By using the newer
28X1 chip instead of the 28X it has been possible to put a
time-out on the serial data read which allows the SPU to
react almost instantly to any loss of the speed demand
instructions from the PC and to stop the drive to the
platform before any damage is done should the PC or any of
the software hang.
The position feedback send
and speed demand read are done on the same Serial line to
the PC (and with the correct download cable from PICAXE can
be driven from a USB port instead so only a single Serial
or USB port is needed - important, see
note at page bottom). The comms is at 9600 Baud and is fast
enough to allow overall data refresh rates of 25 sets/sec or
higher. The communication with the speed controllers
makes use of the built-in I2C functions of the
PICAXE chip and of the
MD03 controllers - the wiring is
simplified here also as each controller is linked to the
same two SCL and SDA lines from the SPU - the mode switches
on the MD03's are simply adjusted to give each a separate
"address" on the I2C bus.
This all results in much
simpler PICAXE programming with only a single chip flash
needed.
PID Servo
Controller Software
To get the scheme with the
simplified SPU to work I
have written a PID Servo Controller program that runs on
the same PC as the BFF Motion Driver.
This is now where the servo control calculations are done using
the position feedback information from the SPU and the
position demand information from the Motion Driver. As of
December 2008 V2 of the PID Servo Controller is available.
With
system safety in mind the servo controller runs as a separate process
on the PC and communicates with the Motion Driver through a
shared memory area - so any hangs or crashes in the flight sim or Motion Driver will not stop the Servo Controller from
continuing to send control data to the external hardware.
This gives the system two layers of failsafe - one at the
PICAXE chip level which monitors data output from the PC and
the other at the Servo Controller software level which
monitors data output from and the status of the Motion
Driver - both are programmed to cut the drive to the
platform should the data stop flowing.
This failsafe protection is
necessary. The motor speed controllers act on signals which
request a certain platform speed - not position! The rest of
the control system has to figure out how fast and in what
direction the motors should be running at any moment. If the
control system fails and the speed demand instructions to
the controllers are not constantly updated then the platform
may simply continue to drive at the last requested speed -
straight into the end-stops. The double protection built
into the new design substantially reduces the chance of this
happening.
The BFF PID Servo Controller
is started from the Motion Driver. It uses standard PID control algorithms to determine the required platform
speed to try to get the actual movement to follow the motion described by the Motion
Driver. The settings used for each of the three drive
outputs can be set "live" as the platform is operational so
you can see immediately the effects of your adjustments
(care required). The
input and output motions can be compared visually, and you
can see the magnitude of the individual PID terms as they
change in real-time. You can also dump a data trace to file
from which all of the variables can be plotted if you wish
to examine your platform response in more detail.
There is a good article about
PID control
here should you need more detail. In short the final
speed demand for each drive is made up from three elements -
-
the Proportional term is
the main element and sets the speed proportional to the
size of the position error.
-
the Integral term adjusts
the speed based on the accumulating error and is useful
for ensuring the pitch and roll angles return fully to
their upright positions.
-
the Derivative term
adjusts speed on the basis of how fast the error is
changing and can acts as a brake on the system to
reduce overshoot. It can also be used to increase the
controller reaction to sharper position demand changes. This term is the trickiest to work
with as it is most affected by noise in the feedback
signals which can make the response very jumpy. See the
US Digital Encoder support page for how this can be
improved.
I will continue to see how
the response can be refined and will be looking particularly
at the derivative term and its use.
For the pilot's benefit the
PID Servo Driver has large start, stop and hold buttons
which allow you to kill the drive quickly should you need
to, and the Tab key remains programmed as a Hot Key to kill
both the Motion Driver and Servo Controller with a single
key stroke should your platform turn into a bucking bronco!
Here's a clip of the software
and SPU in action driving 3 of the DIY linear actuators -
Movie Clip
Wiring Diagrams
The SPU wiring details are
available below. The PID Servo
Software is included with V1.5 of the BFF Motion
Driver. Details of its use and set up are in the updated
User Manual also included in the software download package. The
manual is also available by itself on the
downloads page.
Below - Overall system
wiring, SPU wiring and the 28X1 chip pin designations
.......



Have fun ...................
Important Update
Information
IMPORTANT NOTE
FEB '08 - I've had a chance to do some testing with the USB
download cable supplied by PICAXE and haven't had much
success in getting the SPU to run with it. The cable
installs a "virtual" COM port on your PC but is physically
connected to a USB port. It looks like the software
interaction with the virtual COM port is slightly different
from that for a standard COM port and the driver and PID
controller COM programming has difficulty with it.
FURTHER USB UPDATE - After a
bit of testing I have managed to get the single chip SPU
running with the USB download cable. It seems to be a PICAXE
timing issue. Currently the 28X1 PICAXE program includes a "calibfreq
-6" statement to slightly modify the chip frequency to allow
serial comms with the PC. I found that altering this to "calibreq
-4" also allows serial comms using the PICAXE USB cable
whereas "calibfreq -6" doesn't.
So if you wish to use the
AXE027 USB cable then I suggest that you alter the
"calibfreq -6" statement in
the flash program to "calibfreq -4" and give it a shot.
ABOVE APPLIES to A.2 Firmware chips only.
August 08 - IMPORTANT The
PICAXE 28X1 chip programming has now been updated to allow
newer 28X1 Firmware A.3 chips to be used. Make sure you are
using the SPU_I2C_16.bas program and have an external 16MHz
resonator fitted to the chip if you are using a A.3 firmware
chip. Or, you can use an A.3 28X1 with its internal 8 MHz
resonator if you use the SPU_I2C_8.bas flash program.
Original System Page
Original SPU Design
Original Controllers & Wiring
© This site is
copyrighted, If you'd like more information or have any
comments please contact me at