pic: PS2 Driven Robot

Well, good question. Here’s the rule.

2005 FIRST Robotics Competition Manual: Section 5 – The Robot rev A Page 18 of 29
5.3.8 Operator Interface Rules

<R69> All equipment connected to the Joystick Ports of the Operator Interface must be powered solely through the power available through the port. External power sources of any type are not permitted on any
equipment connected to the Joystick Ports. Portable computing devices may not be connected to Joystick input ports on the Operator Interface.

I have to admit, even I forgot about the part about portable computing devices connected to the joystick ports.

This then brings about the question of what exactly they meant by the rule. Did they mean to explicitly ban everything but pots and switches and the things they’re housed in, or was the rule intended to block things like PDAs and laptops (which the average guy on the street would consider a portable computing device)?

In any event, nice work.


Where did you get a mating connector for the controller. An extension cable?

May be these can help?
Link 1
Link 2

PS2 controllers use a fairly simple synchronous serial protocol.
here is some info on the PS1 interface:http://www.gamesx.com/controldata/psxcont/psxcont.htm

from what i understand the PS2 controllers are the same electrically with only very minor changes in the protocol.

There was a pretty good article in the June 2003 Nuts and Volts on using PS controllers

LOL, nice seal of approval, Billfred :smiley:

Yeah - me and another mentor wondered the same thing. In fact, from what I can tell (being a mechanical kind of guy anyway), it’s not legal. So it went a little something like this (paraphrased for humor of course…)

Mentors: Hey, I don’t think that’s legal.
Students: But it’s gonna be cool
Mentors: Really - look at rule R69
Students: But it might change… we should ask FIRST
Mentors: Don’t bet on it
Students: Yeah… it’s gonna be cool… we should do it
Mentors: Oh fine - but we are still going to do a regular control for next year
Students: YEAH - lets do it
Mentors: I have no idea how or if that’s going to work
Students: Look - it’s working
Mentors: Holy ^#&@# - How’d ya do that?

So… they went on their merry way.

  • They didn’t have a programmer for the pic
    – So they made their own
  • They didn’t have software to download the program into the pic
    – So they wrote their own
  • The robot was not around, going to demos
    – They followed the robot to a weekend demo, and worked out the bugs in the middle of a festival (Thanks 470).

I can see your team either getting the device banned or getting an Innovation in Control award every regional you stop at…

Loving this thread!

  1. Most of the veteran teams won’t touch the right-hand only beige joysticks that have been included in the kit for the past few years. The problems with broken axes, poor range, inconsistent centering, etc etc are well known.

  2. Veteran teams lucky enough to stockpile those CH flightsticks from many years ago love them. They’re getting extremely rare now, and I think most of us realize aren’t may seasons left in them.

  3. What would it take to get to IFI to integrate one of your PS2 dongles right into the OI next year? or the year after? Would you be willing to give up the dongle design in the spirit of improving FIRST as a whole?

Yeah they did an awsome job. It worked right the first time we tried it, only needed minor tweaking

Hey everyone, I am one of the three students that worked on the PS2 adapter.

We used a 16f688 PIC chip and two dual pot digital potentiometers from Maxim. The device currently breaks the rules of official competition because it uses an external power source (9 volt battery). We are working on drawing power from the OI using the LED driver pins, since the circuit only draws around 6 miliamps of current. Since we got the beta working this weekend, we are now taking steps to finalize the design. We are working on soldering it together more permanently, so that you won’t have to worry about wires, etc. coming loose on our messy breadboard. Once it’s put together, we will be adding just a few more things, such as the drawing OI power thing. Once that’s done, we will be posting up our PIC source code and schematics so other teams can build this device for themselves. It uses a conventional PS2 controller, any analog one will do, and it fully controls all the functions of our robot. (We used to use 3 joysticks for this.) It actually drives better this way because you can coordinate your actions more precisely without a second driver. (Sorry copilots :wink: )

The outputs are the 4 analog ones directly to the OI. Analog input 1/2 are the tank drive for the main robot. While 3/4 each send 4 digital inputs. This was done because we didn’t have enough pins to use, so we had send multiple digital signals over analog.

Even if we won’t get to use it in competition, it was still a fun project to work on, and we all learned a lot about PIC programming (we built our own programmer since we were on a budget) and electronics in general (Our software team did most of the electronics o_O).

BTW: The PS2 controller in the picture is not modified in any way, the wires are sticking out because it’s a used controller. (Which is also why the trim is messed up and the robot tends to go backwards when not touching the sticks at times)

Hey Jake (or anyone else) - I heard that you can damage the OI if you draw too much current from it. Is that true? How much? Just want to keep that in mind before we start to blow up OIs.

the rumble motor will work, it has to me a signal read by the PIC and sent oto the PS2 controller on the command line (data to the controller)

yes u can blow the internal fuses by drawing too much current, we are gonna put an adapter that goes between the power port and the OI

If you can go for it but I’m not sure you can get the necessary power. Also can the game ports output signals?


heres the schematic for our current one

I think the rule is fairly clear that something as powerful as a laptop or PDA is the target of the rule. A dedicated controller feeding digipots and with no intelligence otherwise should be allowed.
The output current on the LED outputs is current limited to 10ma, but I wouldn’t want to depend on using two of them in parallel to get higher current. All it would take is a few startup/init where one of the outputs comes on before the other and you would be dumping power supply current from one output to the other. Two diodes (one in series with each output) might work but you would have a voltage drop in the diodes that would be 0.6 volts below the OI 5 volt rail. Don’t forget that the majority of the current demand occurs at the switching point of the proc so a simple averaging meter might be too slow to respond for accuracy. Your 6 ma might actually be close to current limit. You might be able to supply the digipots from one output and the proc from another and stay inside a safe current area. A lot of testing will tell for sure. Nice solution, I like the way you guys work and think.

I am one of the three main people working on the PS2 controller project. I believe Derek emailed First and asked about the controller being a “Portable computing devices” and First said that it was okay, but that of course the rules might be different in the next game. This is all assuming that the circuit can grab power from the OI, I believe.

I coded the asm on the pic chip (about 250 lines I believe), and will post it as soon as I completely fix it up. The circuit connects one of the digital outs (aux I believe) directly to ground. Because it is impossible for the normal joysticks to do this (they only uses different digital outs), the software on the robot should be able to figure out if a normal joystick or the PS2 adapter are plugged in, without requiring a physical switch on the OI or the robot to be programmed in only one mode. This would possibly allow hot-plugging of what is controlling the robot, assuming that one disables the robot when changing the cords.

So far if the PS2 controller is not pluged in to the circuit, or if it is not in analog mode, the circuit will output “nothing” to the OI (i.e. don’t move the wheels or do anything). Hopefully in the future the circuit will be able to automatically put the PS2 controller in analog mode, like some PS2 games. This way the driver won’t have to hit the “analog” button every time they turn on the OI.

The two digipots are ds1267’s. Each digipot IC contains two 256-step digital potentiometers. The microcontroller is a pic16f688. Basically, the PS2 sends all its data digitally in serial to the microcontroller over one pin. This is how even if the PS2 controller uses 10k pots (which I’m not sure about) the circuit would still output using the correct 100k pots. L1, L2, R1, R2, the diamond, the circle, and if the driver is pressing down on the joysticks are sent from the PS2 controller to the OI. This is done by sending these eight digital inputs over two analogs. This is done by setting the 4 most signifigant bits of each analog (aux and wheel) to the correct value, and setting the least signifigant bits to 0111. This allows the “value” of the analog to vary by +8/-7, and have it all still work. The analogs “x” and “y” are used for the y value of the left and right PS2 joystick, respectively.


Congratulations to your team on a great addition to the OI! I’m very impressed that you created your own programmer and wrote your own downloader. That info could be very useful for teams interested in starting to use PICs.

You mentioned that you’d like to have the joystick automatically go into “analog” mode. Here are the commands you’ll need.
0x01, 0x43, 0x00, 0x01, 0x00, 0x00, 0x00, 0x00, 0x00 //enter config mode
0x01, 0x44, 0x00, 0x01, 0x03, 0x00, 0x00, 0x00, 0x00 // set to analog mode and lock out the mode button
0x01, 0x43, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00, 0x00 //exit config mode

***Note: All of the values are in hexadecimal format.

Good luck,

wow, thanks, weve been looking for that, it helps alot because if the controller goes digital, the robot goes nuts

The OI has a pull-down resistor on each analog input. It will interpret your ground as a disconnected joystick, and will send a “neutral” value of 127 to the robot. You won’t be able to distinguish things based on that.

You might try connecting +5v instead. Very few joysticks are capable of getting the analog value above 250, so you might be able to detect a higher value as indicating the existence of your special circuit. Or you could try to find the proper mid-range voltage to make the OI send out “0” without triggering its open circuit detector (see if a 100K or 120K resistor to +5v works).