"OrbDuino" serial gaming device to USB HID shield!

Well, it looks like this has finally come to fruition; pretty simple device basically built after RancidBacon's fantastic page here, but with the addition of a 9-pin serial port, some DIP switches, and a Max233CPP chip to handle the serial to the device itself.

This is meant to resurrect old serial gaming devices. I built it in particular to breathe new life into the SpaceTec SpaceOrb 360, which is now defunct as a gaming device (I resurrected it once with HidSporb, an XP driver, but this was a chance to implement the HID driver in hardware).

The happy news is, it works! I'm deeply indebted to RancidBacon's page, which had the outline for the circuit. Eagle files, the supporting library, and ludicrously detailed build instructions (I wanted Orb fans who'd never used a soldering iron to give it a try) are at the project page http://orbduino.sourceforge.net. It successfully represents the SpaceOrb (or SpaceBall 4000, or Magellan SpaceMouse) as a 6-axis 16-button device (with goodies like chording, sensitivity curves, etc), plus mouse and keyboard which can be mapped, so it can work in any game supporting a mouse and keyboard... it may even work on USB-friendly consoles, but I don't have one to try. It seems to work with Windows and Linux as just a plain old HID device, which was the goal!

The basic idea is that the DIP switches control whether the on-board serial chip talks to the gaming device or not (so you turn the switches off to program the Arduino, unplug the arduino, plug the shield HID port into the computer and the DB9 into the gaming device, and turn the switches on; you can turn them on selectively to try and use the port for debugging device communication, but Weird Things happen if both USB ports are plugged in simultaneously).

Unfortunately I can't get it to compile with Arduino 0017 (I think because of the usbavr .S files, which sounds like should be fixed with 0018), but it worked with 0016; I played through Quake 4 and Fable using a desktop SpaceBall 4000FLX+mouse, as well as faffing about with Left4Dead (as a joystick) and Google Earth.

Build as you want, and if you're lazy (like me) I had Seeed Studio prototype it and built a few kits (Board only, sold out atm and a few kits, which I'll refresh if they sell out). The design is pretty basic and unfortunately puts some leads where they may hit components on the regular Arduino, so either put some tape over those (which is what I did) or use a lower-profile board like the Seeduino (haven't tried that yet but it should work).

I haven't tried it with other serial gaming devices, since I don't have access, but it should probably work... not the most elegant, but it's a first project, so I'm still proud of it--besides, what other projects will let me blow up zombies? If I had more time, I might try and do something more elegant with an Avropendous-DIP style chip (are they still going?), but this works great with the stock Arduino, which makes me happy.

Hi,
Been following birdman and you for years. Great stuff and a fantastic journey. I have a SpaceOrb and a Spaceball 4000 to get cracking.
Need a little help if you can.

I Ordered and built the OrbDuino kit and mated it to Arduino Duemilanove ATMega328. Running Arduino 0018 on Vista32

Fails during compiling when I upload Basicjoystick sketch

C:....\arduino-0018\arduino-0018\libraries\SpaceOrb/usbdrv.h:307: error: expected identifier or '(' before string constant

C:...\arduino-0018\arduino-0018\libraries\SpaceOrb/usbdrv.h:315: error: expected identifier or '(' before string constant

Example sketch (blink) loads fine.

Thoughts on what I can do about this are appreciated! Thanks.

Maybe I am misunderstanding what this is for: What does this do or give you that you couldn't get with an FTDI serial to USB cable (or chipset)? Is it meant to act as a "man-in-the-middle" to monitor the communications, as well as allow the use of the controller with the Arduino only (not necessarily to connect the controller to the PC)?

I know what the controllers are (I've been playing with VR since the early 1990s); I own a Spaceball (original version, not the later 4000), and I also own an Ascension Flock of Birds (two sensor, RS232/485 version) - I am more interested in connecting them to a current PC with only USB for VR/AR/teleoperation research.

If its for allow the Arduino to interpret and use the commands they send, then ok - cool; maybe something like that could be useful for quite a lot of things (I also have some old large serial graphics tablets with magnetic mouse input devices; meant for CAD use).

Sounds interesting!

cr0sh2:

What does this do or give you that you couldn't get with an FTDI serial to USB cable (or chipset)?

Simple: A usb hot-pluggable hid device. It's essentially a driver implemented in hardware instead of software.

In other words, instead of plugging in the spaceball and having to set your computer up to understand what a spaceball is, you plug a (SpaceOrb360, SpaceBall4000, etc) into this, and this into the computer, and the computer's hid stack says "Aha, I see a six-axis 16-button game controller, a keyboard, and a mouse have been connected"; it doesn't have to know anything about SpaceOrbs, their communications protocol, etc; as far as the computer is concerned, you just have a generic gaming device/mouse/keyboard.

Primarily it's oriented towards gaming (I've successfully played FPS games like Left4Dead or Descent as well as strategy games with it), and a lot of the emulation (binding axes to mouse axes, or saying "if you push far enough in the +y direction, press and hold the W key") came from that requirement. And I have to say, playing Descent again with a desk-mounted spaceball is... well, confusing as hell to be honest. But you could certainly bind axes and buttons to mouse/keyboard events and use it for CAD programs (particularly if they're flexible enough to respond to generic HID devices with axes and buttons).

You can also fly around Google Earth with it, which is cool.

The basic idea is really very flexible... I'm currently trying to make another adapter for my old Thrustmaster FCS/WCS/Rudder pedals...

Papa-J: Thanks! I'll respond directly, but the short form (as you've noticed) is that you need either Arduino 0016 or the new version of the library for Arduino 0018 which I just fixed yesterday. Sorry for the slow responses on both... I forgot the "check if you wish to be notified" button and wasn't monitoring this thread.

Simple: A usb hot-pluggable hid device. It's essentially a driver implemented in hardware instead of software.

Now I understand - this is cool!

Now I want one for my Flock of Birds!

Hey, tough i've been lurking the forum for a year by now, this time i decided to post about this usbdrv project.

Im trying also to get my home made joystick to work, but got a detail that is driving me crazy.

I got a classic arcade control with switches, so i want to play my roms with my current keyboard configurations.

As i want to use Arrow UP, DOWN, LEFT, RIGHT, i added to the usbKeyboard.h the definitions from HID Keyboard / Keypad reference:

#define KEY_UP      82
#define KEY_DOWN    81
#define KEY_LEFT    80
#define KEY_RIGHT   79
#define KEY_SHIFT   225

Used correct F_CPU for my ArduinoDuemilanove atmega328 (16MHZ), it compiles, and executes. Buuut.

When i press any button, which generates Arrow Up, Down, Left, or Right, or key "r" or "t", i can see it is working, open notepad, and can type with my joystick + buttons.

The trouble is that it types tooo fast. So, instead of a classic "im keeping pushed left arrow" i get "hundreds of rapid pushing left arrow".

Like old turbo feature on nintendo pads... The trouble here is i dont seem to be able to fix it.

In the main() i've put a counter, so i loose some cpu cycles, but what happens is that left key gets pushed and released very fast every xxx seconds (depends on how many cpu cycles i lose).

So, does any1 has any idea or suggestion? I want to generate "i keep pushed left arrow" or "i keep pushed right arrow" like when you play your roms on your keyboard... not the "very fast typing left arrow over and over".

Any help will be appreciated. I had to let it out of my chest.

Regards

Hmm. Is the problem that you have sent a make code and are not breaking it (ie are you seeing autorepeat? If you push the button does it act like a keyboard and print a character, pause, and then spam them out?) or are you sending a "make/break" code every time you loop?

They keyboard is weird... if you send a "W is pressed" message, say, the computer assumes the key stays pressed until you send another keyboard packet without a "W" in it. To send just a single keypress, you send two reports, one with the key pressed and then immediately send a second empty keyboard report (or at least a keyboard report without that key).

Hard to tell from here but it almost sounds like you're doing that somehow (like every time you loop you're sending two packets, one with the key and a second packet without it, so you get that spam). Sorry so vague--been a long time since looking at that code., but I feel like I did have some trouble with that at some point, since I have a comment in my code saying "This stops endlessly repeating keystrokes"... I was forgetting to send the "key no longer pressed" report t and thus it was auto-repeating. But it sounds like you're having it repeat faster than auto-repeat, which sounds to me like you're sending the "key no longer pressed" report every time.

Not sure that was helpful; let me know if it made sense!

Hmm. Is the problem that you have sent a make code and are not breaking it (ie are you seeing autorepeat? If you push the button does it act like a keyboard and print a character, pause, and then spam them out?) or are you sending a "make/break" code every time you loop?

Ok, you described it perfectly, make/break every loop that is whats happening.

i've seen the

// This stops endlessly repeating keystrokes:
    memset(reportBuffer, 0, sizeof(reportBuffer));      
    usbSetInterrupt(reportBuffer, sizeof(reportBuffer));

in the usbkeyboard.h file, but it doesnt makes sense to me. Can you remember if i have to send the keyboard up arrow with some Modifier so it works / behaves like any keyboard?

Thanks for the time :slight_smile:

Can you remember if i have to send the keyboard up arrow with some Modifier so it works / behaves like any keyboard?

I can't remember for sure, but I'm pretty certain you don't have to; the arrow keysymbols shouldn't require a modifier. You might try just commenting out that second report and just seeing what happens... it may not be exactly what you want, but I bet it's closer!

Ok, im giving it a try, for sure the behaviour is somewhat... different.

Gonna try sending the keystroke and then a null keystroke, see what happens.

wow. thanks for keeping the faith on all of this. i pray to some day have the money and time to leverage such work to resurrect my collection of various 3d input devices. that i paid too much for. back in the day. and which are all serial. curse 3dxn! :-}