a timing glitch with this. Not a big deal.
Figure 4 shows all the controllers that I tried. The silver
GameStop controller isn’t as sexy as the other ones and it is
a little smaller, but it worked! I guess you could call this list
“the good, bad, bad, and the ugly.” Okay, maybe ugly is
too harsh a word, but I’ve never liked my electronics to be
The motto of this ordeal? Know your dealer to make
sure you can return pre-owned hardware that doesn’t work
right (the GameStop folks were top-shelf cheerful about
this) or buy only new. I bought a Lynxmotion wireless PS2
controller setup as well, but as of the time of this writing I
hadn’t gotten it yet. I’ll let you know how it works and
what the PS2X library discovers about it when I get it.
Now I have the hardware, cabling, software, and
sketch working fine. Figure 5 shows the Clock and Data
trace of an entire dual shock wireless controller frame. The
big “blips” to the right are three of the four joystick analog
data bytes; the fourth one didn’t fit on to the screen at this
Experimenting with one of these
wireless setups got us at least 70
feet of range, then the local coffee
shop wall stopped our range tests.
There’s a breakdown in Table 1
of the bytes you get back from a
polling sequence in analog mode.
The JoyR and JoyL are the buttons
when pushing down on a joystick.
RJoyH is right joystick horizontal;
RJoyV is right joystick vertical. Same
with the left side joysticks. Read the
example program to see how one
locks the controller into analog
mode and reads the buttons if you
can’t wait for my next article.
It took me quite a while to get
all of this together reliably, and I
want to do justice with the
programming sequences and use of
the controller data to guide a robot.
This will get you started, and you
may even beat me to getting your
robot running. I love this remote control concept and want
to take it a bit further by using hardware SPI and cranking
up the communications rate, but this is a really good start
on getting your controller interfaced and working.
PS2 Controller Hacking Resources
I could not have gotten this far this quickly without the
work done by many other hackers and innovators on the
Web. This is my list of resources that were indispensible to
md Ylh5rh YV3daQOKFjRkavwM-pJjETpRCYLpKtHE
(You’ll need a Google Docs login for this one.)
• www.microchip.com (helped with
notes on level translation)
• And whatever pioneers were there
before even these!
Table 1. Analog Controller Mode.
Bit 1 Bit 2 Bit 3
JoyR JoyL Start
R2 L1 R1
Well, that’s it for this month. Next time,
I’ll be customizing this code a bit and
hopefully moving it to a hardware SPI
interface to make it faster and more robust.
Until then, keep on hacking and building
robots! As usual, if you have any questions for
Mr. Roboto, feel free to email me at
email@example.com and I’ll be happy
to try to answer them. SV
18 SERVO 09.2012