Playstation Servo Controller Interface PDF
Playstation Servo Controller Interface PDF
Playstation
Servomotor
Controller
Interface
As of 2009, the PS2 has sold over 140 million units. With the PS2 still in
production and so many controllers available, it’s a natural to apply
this controller for more than games. This makes it an excellent
controller for servomotors and robotics.
The PS2 SMC (Servo Motor Controller) interface allows you to control six
hobby servomotors using the Playstation controller (also called the Dual
Shock 2 [DS2]). Both corded and cordless versions are supported. Therefore,
the wireless SMC can be used for remote control of your moving platform.
by John Iovine
T
he PS2’s analog sticks give precise
servomotor movements with speed
control. Rumble feedback occurs
when the servomotor is instructed to
move out of range (stalling).
Sony has not released the communication
protocol of its PlayStation controller, however,
there are a few Internet sites that have teased
out enough of the details for us to work with.
The technical specifications I used were from: FIGURE 1. The PS2 interface controller.
• mikroElektronika
www.mikroe.com/forum/viewtopic.php?t=8792 I will not repeat the communication protocol
• Nuts & Volts September ‘03 column information available on these sites, except to discuss how
by Jon Williams it relates to our current project. If you want to dig deeper
• Curious Inventor into the PlayStation controllers communication, you can use
http://store.curiousinventor.com/guides/PS2 those references cited.
SERVO 02.2011 57
Iovine - Servo Controller.qxd 12/28/2010 11:15 AM Page 58
FIGURE 4.
Circuit
schematic.
58 SERVO 02.2011
Iovine - Servo Controller.qxd 12/28/2010 11:16 AM Page 59
www.servomagazine.com/index.php?/magazine/article/february2011_Iovine
and the toggle switch labeled S1. Mount and solder the
power supply jack labeled P1. When mounting capacitors,
the longer lead is the positive lead. Capacitors C2 and C6
are 1,000 µf. C5 and C7 are 10 µf capacitors. The following
capacitors are non-polarized and may go in with the leads
facing either way. Capacitor C4 is a 0.1 µf 100V. C1 and C3
are small 22 pF capacitors. Next, mount and solder the 8
MHz crystal labeled Y1. Now, mount the SMH-03’s labeled
P2-P7, then mount the seven-pin header P8 and the
LM2937 labeled U1. Before mounting the 7805* voltage
regulator, first attach it to the heatsink (heatsink is included
with the three and five amp versions only) and then mount
it to the PCB in the position labeled U3 (see Figure 9).
When mounting voltage regulators LM2937 and 7805*
to the PCB, the flat side must be aligned with the small FIGURE 3. Playstation nine-pin connector with wires out.
rectangle printed on the board.
Plug the PS2 connector into the P8 connector. The
black wire of the connector faces toward the right, with the
PS2-SMC-06 facing you. Secure the PS2 connector to the
top side of the PCB as in Figure 10.
The hex file for programming the 16F88 accompanies
this article. If you purchased the kit, the PIC microcontroller
is pre-programmed.
Power Supply
The PS2 SMC can use a variety of power supplies from FIGURE 5. Prototype PS2 interface controller.
6V to 9V (AC/DC, one Amp, or more) thanks to the
onboard rectifiers. You don’t have to worry about DC
supply polarity. On my prototype, power is supplied to the
board through the 2.1 mm DC barrel jack. The circuit can
be reset anytime using a momentary contact reset switch.
Servomotor Connectors
There are six standard three-pin male headers for
connecting hobby servomotors Servomotor 1 to Servomotor
6. Connect one to six servomotors as shown in Figure 11.
FIGURE 6. PCB for interface controller.
Power-Up
Plug in the PS2 controller, connect the servomotors, the PS2 is in analog mode. All six servomotors in normal
and toggle the on/off switch to the “on” position. The Independent mode will move to the center neutral position
green LED will light indicating that power is on. The amber on power-up.
LED (status LED will go on after a couple of seconds) When using the cordless PS2, make sure the
indicates a communication link has been established communication link between the PS2 and its wireless
successfully with the PS2 and that the servomotors are now receiver is established. Pressing any of the action buttons
ready to be controlled. This amber LED will stay on. At the on the PS2 will help establish the wireless link on power-up.
same time, the red LED on your PS2 will go on, indicating When a proper link between the PS2 and its wireless
SERVO 02.2011 59
Iovine - Servo Controller.qxd 12/28/2010 11:17 AM Page 60
FIGURE 7. FIGURE 8.
receiver is established, pressing the action button will result joysticks (thumb sticks) on the PS2 controller; see Figure
in the LED blinking on the wireless receiver. 12. Servomotor 1 and Servomotor 2 are controlled by the
left analog joystick. The X axis of the left analog joystick
Controller Map controls Servomotor 1 and the Y axis controls Servomotor
2. Tilting the joystick along any axis will result in motion of
The six servomotors are controlled by the two analog the servomotor associated with that axis. Tilting the joystick
in the opposite direction along the same axis will result in
servomotor motion in the opposite direction.
Servomotor speed is proportional to the tilt angle of
the joystick. Tilting the joystick slightly will result in the
slowest servomotor motion. Tilting the joystick all the way
will result in fastest servomotor motion. There are three
levels of servomotor speed along one direction of the axis.
Releasing the joysticks will bring it to center position
and the servo will stop at its current position.
Since sticks may not always return to the center neutral
position, there is a dead band around the center of the
stick which results in no movement. This ensures the
servomotor doesn’t keep moving in case the stick has not
returned to the neutral position.
Servomotor 3 and Servomotor 4 are controlled by the
right analog stick in the same manner as described for the
left analog stick. Pressing Left 1 (shoulder button) in front
FIGURE 11. Servomotor connections. of the PS2 will shift control of the right analog stick from
60 SERVO 02.2011
Iovine - Servo Controller.qxd 1/4/2011 5:52 PM Page 61
Rumble
The servomotor has a maximum limit in both directions
and driving it beyond these limits will cause damage to the
servomotor and drain heavy current from the power supply.
To avoid this, servomotors are not allowed to be driven
beyond their Pulse Width (PW) limits, as determined by the
manufacturer’s recommendation for PW signals sent to the
servomotor. When any of the servomotors have reached FIGURE 12. Servomotors mapped to PlayStation controller.
their limit and the user continues trying to move it by tilting
the corresponding analog stick, the servomotor will not
move and this condition will be indicated by a Rumble
(force feedback) feature. Rumble will stay on as long as the
user keeps the stick tilted.
Programmable
Configuration Modes
The PS2 SMC can be configured in three different
operating modes. These modes can be changed “on-the-fly” FIGURE 13. Mobile test platform.
during normal operation. New mode selection is stored in
the non-volatile memory of the PIC. The stored mode will
automatically load the next time the PS2 SMC is turned on.
SERVO 02.2011 61
Iovine - Servo Controller.qxd 12/28/2010 11:18 AM Page 62
turn of your moving platform. The tilt angle of the stick will
General Notes determine the speed. Two-level speed control is
implemented.
1. One should plug the PS2 controller and servomotors on the Sometimes the stick doesn’t return to the neutral
interface board before powering up. Only remove them
after turning off the board. position on release which may result in unwanted
2. Configuration modes can be changed anytime the user movements of the servomotors. Creating a small dead
wants in normal operation. However, since the associated space or band around the center position of the joystick
mechanical hardware connected to the motors for different
modes is so different, practically speaking, a need for eliminates this movement. Within this dead band, the
changing from one mode to another won’t arise during an servomotors aren’t activated. To test this mode, I created a
operation. Mode change can be done when required quick and dirty mobile platform using two continuous
immediately at power-on, once the status LED goes on. This
will ensure that the servomotors are at the center position rotation (CR) servomotors and a dual servomotor bracket
when the mode is changed so an unwanted movement of (see Figure 13).
the servomotors won’t occur as a result of mode change. For mobile operations or if you’re just tight on space,
3. Servomotor control is inhibited when the mode change the PCB can be cut down (before assembly) so its footprint
buttons are pressed.
is much smaller (Figure 14). The PS2 connector is secured
62 SERVO 02.2011
Iovine - Servo Controller.qxd 1/4/2011 10:08 AM Page 63
to the bottom of the PCB. and Servomotor 4; the right stick controls Servomotor 5
and Servomotor 6.
2. Opposite Phase Mode – OPM When the Shoulder button is pressed,the right analog
(Cross and Triangle Buttons) stick will control Servomotor 1 and Servomotor 2. Basically,
Leftie and Righty mode are independent of other modes
Servomotor 3 and Servomotor 4 can be configured to selected; control between the two sticks is swapped,
be controlled independently or in Opposite Phase Mode irrespective of the mode.
(OPM). In OPM, each servomotor shaft moves in the
opposite direction from the other, 180 degrees out of Wrap-Up Mode
phase. Pressing the Cross button will select OPM mode.
Pressing the Triangle button will select Normal Independent Utilizing existing equipment in your robot projects is
Mode (NIM). always satisfying. Using the PS2 controller and joysticks
OPM can be helpful when two servomotors are adds to the enjoyment of deploying your builds. SV
connected to a common load, or
when you’re using two servomotors
for increasing the overall relative
speed of movement.
In OPM, the X axis of the right
analog stick will control Servomotor 3
and 4. Tilting the stick along the X
axis in one direction will result in the
simultaneous opposite movement of
Servomotor 3 and Servomotor 4 at
the same speed.
Tilting the stick in the opposite
direction will result in the
simultaneous opposite movement of
Servomotor 3 and 4, but in the
opposite direction to that of the
previous case. As in MPM, there is a
dead band around the center of the
stick and three-level speed control
proportional to the stick tilt.
Servomotor 5 and Servomotor 6
always operate in NIM.
Handiness
(Righties and Lefties)
When selected, MPM mode by
default sets the left analog stick to
control Navigation. For righties, they
can switch Navigation control to the
right analog stick by pressing the right
arrow button on the directional pad.
Pressing the left arrow button on the
directional pad brings the stick
controls back to their default
mapping. In Righty mode, the left
analog stick will control Servomotor 3
SERVO 02.2011 63