Original Post

Hey,

Just thought some of you might be interested in seeing my latest project. Currently, it’s basically a PS2 controller to VB converter, but it’s very expandable, so I plan on using it to add cool features and interface a wide range of inputs. Since the PS2 controller can do everything the VB controller can, I decided to start with that one (good for commercial or homebrew), although I can easily add other controllers (which would really be most useful for homebrew).

Right now it just emulates the VB controller using the digital and/or analog inputs, although it’s taking all inputs (digital, analog, and button pressure) and is able to control the rumble, so it could be used to do some really cool stuff w/ homebrew apps.

Like I said, it’s also very expandable, so if you prefer, you could use a Gamecube, N64, Atari, or NES/SNES controller (which we can actually do natively), or mouse/keyboard… or even some cool stuff like an accelerometer or tons of other stuff you can think to add. And I guess there’s no reason you couldn’t add multiple inputs if you wanted. Of course we are limited by the bandwidth of the controller port, but with the software read, we can read faster, and better.

Anyway, just thought I’d share w/ everyone here… I figured there’s nothing too exciting to show off (a picture can show everything), but it’s been kinda quiet in the dev forum lately. I’d be interested in hearing some of your input/ideas as well (let’s see what wacky ideas RunnerPack comes up with! πŸ˜‰ ).

DogP

13 Replies

WOW, this is cool! So could it be used with a wiimote? :O
A mouse would of course be a cool start, for some kind of 3D Pong for example.
Or how about a Racing Wheel, Fishing Controller, or… Steel Battalion VB? πŸ˜€

LOL! Steel Battalion VB πŸ˜› . I actually don’t think you could do that one as easily because the xbox controllers are basically USB, and the microcontroller doesn’t support USB (so you’d need to add a USB host chip… which is doable, but I don’t have one installed). Same with a Wiimote… since it’s bluetooth, you’d need a bluetooth controller. I think the nunchuck is i2c, so that could be done natively, but meh. Dreamcast had some pretty cool controllers, and should be relatively easy to implement (Samba De Amigo VB! πŸ˜‰ ).

Heh, but yeah… it should be pretty cool. I’ll probably do a mouse/keyboard for convenience, although we can already use the SNES mouse natively with just a software read (heh, this could allow a PS/2 mouse to be used on Mario Paint on the SNES too). Something I think would be REALLY sweet would be an accelerometer attached to the device, then make a good head mount, and we could have head tracking, but I still haven’t seen or thought of a good head mount (besides LCD glasses w/ emu or VB->VGA). An accelerometer could also be used on a gun controller so we could aim a gun without needing a screen to point at (just so there’s a cursor on the screen to tell us where we’re pointing).

One thing I just thought of… I could make a VB app that allowed you to configure the board for custom settings from the VB (key mappings, sensitivity, etc)… I guess even update the firmware. Now if we just didn’t have all those stupid custom connectors >_<. Anyway... I'll keep you guys updated... to start, I'll probably throw together a quick analog test for the PS2 controller with rumble tonight, then maybe a keyboard/mouse for fun. DogP

That’s pretty sweet, DogP!

I think you and KR155E covered all the “wacky ideas” I could come up with πŸ˜› except maybe:

A) It could be used with a regular VB pad to remap the buttons (and maybe make Mario Clash playable, finally :-P)

B) It could be used to implement the idea I just posted to the Wiki: http://www.vr32.de/modules/dokuwiki/doku.php?id=analog_control

C) Mattel/PAX Power Glove!!!!1111one πŸ˜‰

On a related note, have you ever tried hooking a PSX pad directly to the link port? It’s one of the many things I’m sure is possible but have never found the time to do. πŸ˜› It wouldn’t require a uC, so it might be more accessable to the average user.

Again, nice job!

Yup… that’s how I’m doing it… the first 16 bits are emulating the VB key map for backwards compatibility, then if the system keeps clocking, the next 16 bits are the raw digital bits from the PS2 pad, then the next 32 bits are the analog sticks, then the next 96 bits are the pressure sensitive buttons. Of course it requires a software read to do that… any existing stuff that uses a hardware read will just see it as a normal VB pad.

I got some functions written last night that allow me to easily integrate this, basically as easily as vbReadPad(). Just call handle_ps2_ctrl(&controller); and it fills the controller struct with the native data (so you can do controller.native&K_STA for the standard VB stuff), along with the PS2 digital, analog, etc. There’s also a rumble value (small motor on/off and large motor speed) which you can set, and that function will control the rumble.

Anyway, I haven’t gotten a chance to get a video of it, but I’ll probably post one later tonight.

BTW, would anyone else be interested in this? I could easily make a small PCB with this and a small connector on it, which accessories could be plugged into. It’d probably involve cutting your controller cord and wiring this inline, and maybe having a small plastic box that either sits in the middle of the cord, or attaches to the end of the controller, plug end, or ferrite ring.

The parts are pretty cheap, and the PCB would be small, so it really wouldn’t cost much… I’d consider doing it just for myself, but if nobody else is willing to cut their controller cords to wire this in, I’d probably just keep my hand-made proto. It’d be really cool if we could get some homebrew going with this… IMO there’s really a lot of potential with it (new gamepads/joysticks, keyboards, mice, etc).

Key remapping could be done with this, since I’d probably make it so the entire controller is piped through the uC, selectable w/ a switch… that way it’d be really easy to connect (all VB controller pins go to uC, some I/O goes to VB pad, others go to accessories for PS2 controller, mouse, etc). Then this would give you expansion by flipping the switch, and not take anything away.

I’ve never tried connecting a PSX pad to the link port… it may be possible, I dunno. I figured there’s lots of ways to get a new controller on the VB, but I picked this one since IMO it’s only really good if it’s backward compatible w/ commercial games, and adds new functionality.

DogP

Sweet! Great minds think alike. πŸ˜‰

I’m curious about how you send data to the uC, though.

And yes, I would be interrested in having a PCB layout for this. What make/model of uC are you using? If it’s a PIC, maybe I could just adapt the code/circuit to the 16F877A sample I have lying around.

BTW, you should think about adding this and all your other projects to the wiki πŸ˜€

Okay… I posted the video to YouTube: http://www.youtube.com/watch?v=6cWpbAxbKDk . The video quality isn’t great, but hopefully you get the idea. The first part shows it playing Red Alarm, the second part is my homebrew app showing the rumble. The large rumble intensity is the Left Analog stick value, and the small rumble is enabled w/ start and disabled with select (the small motor is either on or off). I couldn’t get a good video of the app, so I took some still shots and put them at the end, but you have to use your imagination to be able to read it (stupid YouTube compression :P)… it basically just displays all the values related to the controller. You can download it here: http://home.comcast.net/~virtual.boy/VB/ps2_controller.VB , although it doesn’t do any good since the emus don’t support software read anyway (with a regular controller plugged in, native still gets updated).

I’m using the Parallax Propeller uC… it’s really a great chip. It can do a whole lot, and with 8 cores, I can have multiple simple “processes” running in parallel, with access to common RAM. In this application, I have one core running the PS2 controller code, one responding to the VB, and one converting the PS2 controller data to VB “native” data. There’s a pretty good community of users as well, and lots of example code.

About talking _to_ the uC… I’m doing it by sending clocks while the latch is high. The uC counts the number of clocks, which gets translated into data. It’s very inefficient, but works without causing any problems for a real VB controller, since a real controller doesn’t clock out any data until the latch goes low. I have 8 levels of intensity for the large rumble motor, and if it’s an odd number of clocks, the small motor runs. So, I have 17 clocks under the latch for full rumble with both motors.

Since the pins are software controlled, I can send data using the latch pin as a data bit and of course the clock pin as the clock… but that doesn’t work well during controller reads or for compatibilty since arbitrary latch changes would confuse when it should be clocking out data (I’m sure something could be figured out, but it’s not a simple scheme like the current). That’s how I’d do the firmware updates, custom key maps, etc. though (I could have it enable that mode by doing 30 clocks under the latch or something).

And yeah… I should add them to the Wiki… just like I should update my website… but yeah… you get the idea πŸ˜‰ .

DogP

Just wanted to post this in case anyone’s interested… it’s the VB library to work w/ this hardware: http://home.comcast.net/~virtual.boy/VB/ps2_lib.c . It can also be useful as an example for doing software controller reads, which I don’t know of any others available.

DogP

Just in case anyone is interested… I added in the ability for this to do PWM to give analog control in native digital games (press the direction proportional to the analog value). I expected marginal results, and that’s pretty much what I got.

Some games work okay and give pretty good control without any major flaws (Vertical Force, Space Squash), others kinda crappy (Wario Land, Mario Clash, Mario’s Tennis)… basically the animations make it look pretty stupid as (W,M)ario rattles across the screen. Other games have bad flaws (Insmouse, Red Alarm) where the repeating analog when the joystick is only partially pressed causes multiple actions (running fast down the hall or multiple strafes)… properly used the repeat could be useful (more presses for more analog rather than more pressed time for more analog)… the analog flight control of RA isn’t that good anyway though, although the analog aiming in Insmouse is okay.

DogP

Not sure if anyone cares, but i played around with this a little more and have Wii accessories (Nunchuck/Classic Controller) working. I forgot about the Classic Controller, but the configuration works great for the VB. I also didn’t realize that the Nunchuck actually has a 3 axis accelerometer… it seems like any Wii game I play just has you shake the nunchuck, so I figured it had some sort of shake sensor. So, I may be able to do some cool stuff with that.

DogP

Okay… if this isn’t cool, I don’t know what is: http://www.youtube.com/watch?v=WkRTIhf2O1A πŸ™‚ . First, it’s using the 3-axis accelerometer on the Nunchuck to compute pitch and roll, which controls the ship/plane, and up/down on the analog stick controls zoom.

The second part of the video shows the VB Controller emulation w/ the Classic Controller. You should be able to see this video better than the last, since I hooked it up to my TV adapter, which I connected to my new (old) projector (although my camera/tape seems to be glitchy). Playing a giant VB on the wall is pretty sweet πŸ˜‰ .

DogP

I would say that you have a pretty firm grasp on what is cool… πŸ˜‰

(Except that that camera/tape is definitely NOT cool! πŸ˜› )

Also, PENTUPLE-POST FTW! πŸ˜›

Any plans to try a “Wii Motion Plus” attachment? Of course, it’s just a little box, so it would probably have to be attached to a VB pad or some other controller – or to a head-mounted VB – to be very useful. I haven’t heard what specifically it adds in the way of sensors, though.

As an addendum to my “PS[1/2] controller and link port” question: Would it be possible to do software i2c on the link port enough to talk to these Wii accessories with no Propeller?

*/me goes to refresh his knowledge of the protocol*

EDIT: Okay, here’s what I found out:

I2C uses two open-drain lines: SCL (clock) and SDA (data) and the link port only has one (COMCNT) which means some external hardware is required (a 3v3 source would be needed, in any case) but it still seems doable, especially since there are no strict clock rate requirements.

EDIT: Okay, nevermind…

I just went over the docs again and only the COMCNT pin can be directly written/read. But, the controller port should work.

  • This reply was modified 14 years, 11 months ago by RunnerPack.
  • This reply was modified 14 years, 11 months ago by RunnerPack.

Yeah, I had no idea the tape was messing up until I tried to play it back… but I’m too lazy to re-record everything :/ . I’ll definitely get a Wii MotionPlus once they start selling them… I believe it adds a gyro, so rotation on the horizontal axis (yaw) can be determined (a 3-axis accelerometer can only detect pitch and roll from the x,y,z readings).

I don’t know about doing i2c directly on the VB… it may be possible with some extra hardware, but it’d take some thinking. You’d need both outputs and inputs connected to the lines since you have to output data and the clock, as well as being able to read the actual value (emulating open drain). I personally don’t like i2c because there’s lots of weird stuff (open drain, start/stop/ack bits, clock stretching, typically slow clock, etc). It’s not just a simple clocked interface like SPI where there’s a master that controls the bus to talk to a slave, with dedicated Rx and Tx lines. Even if you could get the VB to do something somewhat compatible, it may not work w/ the Wii controllers, since I’ve read several posts of people trying to talk to them, and getting strange readings due to timing. I think they said the chip used can handle VCC=5V, so that would make it a little easier.

DogP

Well, I can always use a microcontroller, I was just trying to come up with something cheap and simple so that we can get some analog controls into the hands of the community.

I’m trying to get a nunchuk cheap on ebay. If anyone here is also looking, please don’t outbid a*****m on a nunchuk! (or my black silicone case) πŸ˜‰ There’s plenty of them on there!

 

Write a reply

You must be logged in to reply to this topic.