Introduction: SpaceBall 4000 Serial to USB Adapter
The SpaceBall 4000 (equivalent to the 5000FLX, but not the 5000) is a serial-based 3D mouse with 12 buttons that you can buy on ebay for under $20. These are nice for doing 3D graphics design, as you can move models along three axes and rotate them just by moving a ball. I recently made a Chrome extension that lets you use it in TinkerCAD, for instance. Or you can use it as a six-axis 12-button joystick (the adapter has a switchable mode that lets you activate that mode) in games like Descent.
I will show how for $5 you can build a USB adapter for the SpaceBall that makes it emulate most of the functionality of a much newer SpaceMouse Pro, so you can use it with the latest 3DConnexion drivers.
Parts for project:
- STM32F103C8T6 minimum development board: either a black pill like this one ($1.90 shipped) or a blue pill like this one ($1.94 shipped); if you use the blue pill, you will probably need to solder an extra resistor (probably 1.8K); if you use the black pill, there is a potential (but it didn't happen when I tried it with the SP3232 board) that you will have some power supply problems and will need to solder a wire directly to a diode on the board.
- An SP3232 TTL to RS232 DB9 male board like this one (ebay $3.09).
- USB to UART adapter for loading the bootloader on the development board. If you have one sitting around, you can use an Arduino for this, or one of the many USB to UART adapters on aliexpress for around $1
- soldering iron
- computer for running the Arduino IDE.
Step 1: Load Bootloader and Prepare Arduino Environment
Follows steps 1 and 2 in this Instructable to load the bootloader on the board and prepare the Arduino IDE for the board (you can skip the GameControllers library, though).
If you have a blue pill, measure the resistance between PA12 and 3.3V. If it's significantly more than 1.5K, put a resistor between these two pins to parallel the existing resistance and bring it down to 1.5K. If you measured 10K, you should put a 1.8K resistor in. (Note that some boards that have the blue pill layout are black in color. The way to tell them apart is that the blue pill layout includes a 5V line.)
Step 2: Connect Serial Board
Make the following connections between the RS232 adapter and the pill:
- VCC - V3
- GND - G
- TXD - A10
- RXD - A9
- RTS - B11
Connect the SpaceBall to the RS232 adapter. Plug the pill into a USB port. Wait a few seconds. If all goes well, the SpaceBall will emit two beeps. This shows that the electrical connections are good. If you have trouble, see the "What to do if it's underpowered?" step.
Step 3: Load the Sketch Onto the Board
Load my Mouse3D sketch into Arduino. If you have a Blue Pill, edit the LED line to be PC13 instead of the Black Pill's PB12.
Plug the pill into your computer.
Go to Tools | Board and scroll down to select Generic STM32F103C series.
Press the Upload (right arrow) button in the Arduino IDE.
That's all. You now have an adapter. Unplug it and plug it back in to use it. I recommend you download the latest 3D Connexion drivers for it. Your adapter makes the device pretend to be a SpaceMouse Pro, except that it's missing the last three of the SpaceMouse Pro's buttons.
You can also run the SpaceBall as a generic USB joystick (calibrate with Win-R joy.cpl on Windows). To switch to USB joystick mode, press the 4, 5, 6 and 2 buttons at the same time. To switch back to SpaceMouse Pro, either reset the adapter (unplug and re-plug, or press the reset button on it) or press the 4, 5, 6 and 1 buttons.
Step 4: What to Do If It's Underpowered?
If you're unlucky, you may find that the SpaceBall 4000 is underpowered and either doesn't beep initially. Another symptom is sending button presses (you can view them with joy.cpl on Windows) but not ball movement.
In that case, you want to change the power supply to the UART-to-RS232 converter board from 3.3V to 5V. If your STM32 board has a 5V pin (blue pills have it), that's easy: just connect that to the converter board's VCC instead of 3.3V. If the board doesn't have a 5V pin (black pills don't have it), you'll need to solder the power line to the diode on the board.
1 year ago
Hi, I made a case for the adapter: https://www.thingiverse.com/thing:4947020
Sadly, it doesn't seem to work with the current 3DXWare 10.7.0 (the older ones are incompatible with Big Sur), the control panel reports "No device found".
This is the USB report:
Vendor ID:0x046d(Logitech Inc.)
Speed:Up to 12 Mb/s
Location ID:0x14340000 / 9
Current Available (mA):500
Current Required (mA):100
Extra Operating Current (mA):0
2 years ago
For anybody with problems in setting up Arduino and compiling, I now released a .bin file you can upload: https://github.com/arpruss/mouse3d_stm32f1/releases/
To upload it, follow the instructions for installing a bootloader, but instead of the bootloader, just install the .bin file: https://www.instructables.com/id/Gamecube-Controll...
Note that if you already have a bootloader, it will be overwritten by the .bin file, and if you want to make changes in Arduino, you'll need the bootloader.
Reply 2 years ago
Flashed the .bin file successfully but when I connect the device (hp Spaceball 5000 FLX-A) it doesn't make the two beeps (it does when I connect via FTDI USB Adapter) but instead a constant chirp noise.. The device is recognized in the device manager and I could install 3DxWare but it doesn't work.. Also in joy.cpl I cannot even get button presses.. Is the device underpowered?
Reply 2 years ago
I am thinking that either some wiring is wrong or it's underpowered.
Reply 2 years ago
Okay, I have no soldering iron (need to buy one) so everything is only plugged maybe there is a contact problem.. My black pill looks exactly like the one on the last picture (with the 5V marked) so I tried to glue the VCC to the diode (with hot glue) but it just behaves the same.. Also I tried your tutorial with 3d.exe and USB/IP but there I always get "Error Cannot Confirm P20" after "Initializing Serial Connection" in a loop (here it beeps 2 times on every try..).. Will buy a soldering iron (have TS100 in mind) but anyway would love to know why the software only solution doesn't work for me..
Question 2 years ago on Step 4
Looks like everything went well programming the ST-Board.
However, my Spaceball is not recognized (and not beeping).
I'm using a 4-Pin RS232/TTL adapter (VCC, GND, RX,TX) and cannot connect RTS to B11.
Could this be the reason ? (I already tried to supply 5V to the Ball with no success).
Is it possible to grab RTS/CTS directly from the Max3232 (maybe pins 9+10) ?
And another Question: i see, you also seem to have attached CTS to the ST-Board, but to which pin ?
Answer 2 years ago
I don't think CTS matters. But it is crucial that pins 4 and 7 on the RS232 plug be producing about 9V. Check with a voltmeter. That's where the Spacemouse gets its power.
If you can connect RTS, that should do the job. But for that you may need to use an adapter board based on the CP chip.
With the Max3232, you might be able to adapt this circuit: https://os.mbed.com/teams/OpenMoCo/code/SpaceBall/wiki/Serial-Connection
Though I think it would be a good idea to connect Pin 11 on Max3232 to B11 on the ST board instead of to ground. I don't know if that will work or not, or just blow something up.
Also, there are lots of fake Max3232 chips out there, and these are likely to overheat and fry if you use them. I had that happen first time I tried it.
Reply 2 years ago
Hmmm, looks like my adapter is somehow differently wired, also no 9V on 7+4.
Looking at the standard wirings https://www.mikrocontroller.net/attachment/209014/Max3232.png pin4+7 are not connected at all. Got to try the same adapter you have or try to add external power.
Question 3 years ago on Step 3
Sorry if I'm missing something here, but I don't see where to download the arduino sketch?
Answer 3 years ago
Weird, I thought it was there. I added the link. And for your reference it's: https://github.com/arpruss/mouse3d_stm32f1
Reply 3 years ago
That's great, thanks.
Question 3 years ago
This is fantastic! Do you have any idea how the Spaceball 2003 would work with this or if the protocols between the 2003 and the 4000 are completely different?
Answer 3 years ago
If memory serves, the protocols are similar but not close enough to work without some changes to the code. http://spacemice.org/pdf/SpaceBall_2003-3003_Protocol.pdf