Skip to content

Use bluetooth joysticks with your MSX computer

License

Notifications You must be signed in to change notification settings

herraa1/msx-joyblue-v2

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

21 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Bluetooth controller adapter for MSX (msx-joyblue) v2

Connect Bluetooth controllers to MSX computers

Introduction

The msx-joyblue is an adapter that allows connecting Bluetooth controllers to MSX General Purpose I/O Interfaces (aka joystick ports).

The adapter is based on the unijoysticle2 and bluepad32 projects, both owned by Ricardo Quesada.

The main features of the msx-joyblue v2 adapter are:

  • small size
  • made of widely available electronic components
  • uses SMD components, so good soldering skills are needed to build the adapter
  • emulates up to two MSX joysticks
  • attaches to MSX computers using female standard DE9 connectors
  • formally requires an external USB power supply as the adapter draws slightly more current than two MSX general purpose I/O interfaces can officially provide
  • optionally, can be powered using MSX general purpose I/O interfaces without an external power supply if your MSX can safely supply enough current
  • builtin leds provide information about the operation of the adapter

The msx-joyblue v2 adapter uses an ESP32-WROOM-32E chip to convert the Bluetooth controller actions to the MSX joystick standard signalling.

A two-sided printed circuit board (PCB) is used to put together all components:

  • The ESP32-WROOM-32E bluetooth MCU chip
  • A CH340C USB to UART chip, to make it easy to upgrade firmware on the ESP32 chip
  • A pair of S8050 NPN transistors to control the boot and enable signals of the ESP32 from the CH340C
  • An AMS1117-3.3 regulator to convert the 5V from either the USB port or joystick ports to the 3.3V required by the ESP32 chip
  • Four 74LS03 quad 2-input NAND gates with open collectors to completely mimic the standard MSX joystick behavior
  • A pair of PTC fuses to minimize damage to the MSX computer in case something goes wrong with the board
  • Several additional required components (diodes, leds, resistors, ceramic capacitors and an electrolytic capacitor)
  • PH2.0 connectors are used to connect cable extensions
  • A 2.0 pitch I2C header is added for future extensions
  • Jumpers are provided to enable different power options
  • A slider switch is used to enable powering the adapter from the MSX side
  • Three momentary push buttons are used to reset the board, swap joysticks or change the operation mode

Connection to the MSX general purpose I/O interfaces is implemented using DE9 joystick extension cables with a female DE9 connector on one side and a loose end on the other side. The MSX joystick extension cable loose end is wired according to the following pinout mapping.

MSX joystick connector pinout, from controller plug side
MSX side pin Cable color (may vary) Signal
5 Brown +5v
4 Orange RIGHT
3 Grey LEFT
2 Black DOWN
1 Red UP
6 Green TRIG1
7 White TRIG2
8 Blue STROBE
9 Yellow GND

Warning

The msx-joyblue v2 adapter uses a different pin order on the PH2.0 header than the msx-joyblue v1 adapter.

Make sure you respect the correct pin order for msx-joyblue-v2.

Recommended Build

Please, use msx-joyblue-v2 Build2c for making new boards.

You can find ready to order PCBs at the PCBWay community site.

PCB from PCBWay

Bill Of Materials (BoM)

The Build2c adapter implements the following changes since Build2b:

  • move capacitor C3 and resistor R1 closer to the ESP32 EN pin
  • change C3 from 10uF to 22uF to give extra ramp up time to the 3V3 power rail
msx-joyblue-v2 Build2c PCBs front and rear
msx-joyblue-v2 Build2c populated PCB

Build2b

Note

Build2b was never fabricated and has been marked obsolete. Use the recommended build instead.

The Build2b is similar to Build2 but changes slightly some silkscreen text and graphics.

Build2

Note

Build2 has been marked obsolete. Use the recommended build instead.

The Build2 adapter mimics completely the standard MSX joystick behavior:

  • When pin8 is HIGH, the adapter puts all stick and triggers signals in high impedance mode irrespective of their status (as if stick and triggers were not hold in the standard MSX joystick schematic), which become HIGH on the MSX side via the MSX PSG related circuitry pull-ups (matching the expected behavior)
  • When pin8 is LOW
    • if a stick direction or trigger is hold, the corresponding signal is pulled down to GND causing it to be LOW (matching the expected behavior)
    • if a stick direction or trigger is not hold, the corresponding signal is put in high impedance mode, which becomes HIGH on the MSX side via the MSX PSG related circuitry pull-ups (matching the expected behavior)

This build uses discrete logic components to honor the pin8 signaling (four 74LS03DR quad 2-input positive-nand gates with open collector outputs) and uses open collector outputs which makes the adapter safer 1 than the standard MSX joystick schematic depicted in the MSX Technical Data Book, as it avoids a series of undesired conditions that can lead to bus contention/short circuits.

msx-joyblue-v2 Build2 first prototype msx-joyblue-v2 Build2 first prototype within acrylic case

The msx-joyblue v2 adapter firmware uses Ricardo Quesada bluepad32 library to drive Bluetooth controllers. A small modification to the library that enables support for MSX computers has been already commited to the main branch.

See bluepad32 documentation for supported Bluetooth controllers.

A simple yet functional acrylic enclosure design is included.

Powering the msx-joyblue adapter

The msx-joyblue adapter uses about ~107mA when operating, while a single MSX general purpose I/O interface is capable of delivering up to 50mA according to the MSX standard 2. That means that even using two MSX general purpose I/O interfaces (50mA + 50mA = 100mA) we are slightly over (107mA) the max current specification for the MSX general purpose I/O interfaces.

Thus, the safest way to power the msx-joyblue adapter is by powering it via the USB mini connector of the board using an external 5V USB power supply. The board automatically powers up when using the USB mini connector without enabling any switch.

Nevertheless, even if the MSX especification puts such a low limit on the current that can be drawn from a general purpose I/O interface, real MSX hardware usually can safely deliver enough current for the msx-joyblue adapter to work correctly without harming our beloved classic computers.

Taking that into account, the msx-joyblue adapter has been enabled to be optionally powered by the MSX general purpose I/O interfaces port 1 and port 2.

To enable powering the msx-joyblue adapter from Port 1 and/or Port 2, the switch SW5 JOY PWR must be first turned on by sliding the switch handle to the right.

Note

A 1N5819 SMD Schottky diode D3 is used to avoid leaking current from the msx-joyblue adapter to the MSX in case the msx-joyblue adapter is powered by USB while the JOY PWR switch is ON. Another 1N5819 SMD Schottky diode D2 prevents backpowering the USB side from the MSX side. And two Positive Temperature Coeficient (PTC) resettable fuses F1 and F2 of 50mA each protect the MSX general purpose I/O interfaces port 1 and port 2 from excess of current in case something goes horribly wrong on the msx-joyblue adapter side.

To power the msx-joyblue adapter using the MSX general purpose I/O interfaces we must first understand how the PTC protections on the msx-joyblue adapter are implemented.

The selected PTCs are rated for 50mA which is the so called Hold Current (the maximum current that can flow in normal operation). There is also the Trip Current (the minimum current necessary for the PTC to move to high-resistance state) which for the selected PTCs is around 100mA. Those thresholds are dependent on temperature and voltage. And to make things more undeterministic, the behavior of the PTC when current is between those thresholds is undefined (it may trip or not).

In normal operation and for a room temperature of around 25 degrees Celsius, the selected PTCs in practice never trip below 75mA.

Note

Depending on the exact PTCs installed, the trip current may be slightly different and the adapter may trip at a different point. Unless you buy the PTCs from a reliable source, it is very difficult to know the exact PTC specifications.

Remember that the PTCs are provided as a safeguard in case something goes really wrong on the adapter, not to act as an exact current limiter to strictly comply with the 50mA per-port MSX specification.

So if our MSX computer can safely provide more than 50mA on each MSX general purpose I/O interface (which is usually the case), we can connect both Port 1 and Port 2 to the MSX computer and turn on the SW5 JOY PWR switch to power the msx-joyblue adapter. Note that we need to connect both ports even if we use just one Bluetooth gamepad, just to meet the power requirements.

Two jumpers JP2 and JP3 can be used to bypass the PTC protections for Port 1 and Port 2 respectively.

Warning

Bypassing the PTC protections may damage your MSX computer. Do not bypass the PTC protections unless you known what you are doing.

By closing JP2 (and/or JP3) and if our MSX computer can safely provide more than 100mA on a single MSX general purpose I/O interface, we can connect Port 1 (or Port 2) to the MSX computer and turn on the SW5 JOY PWR switch to power the msx-joyblue adapter using a single joystick port.

In summary, we can use the following options to power the msx-joyblue adapter (from safest to less safe):

  • via the board USB mini conector
    • leave open jumpers JP2 and JP3
    • turn off the SW5 JOY PWR switch
    • connect a 5V USB power supply to the board USB mini connector
  • via two MSX general purpose I/O interfaces, if your MSX can safely provide slightly more than 50mA on each MSX general purpose I/O interface
    • leave open jumpers JP2 and JP3
    • turn on the SW5 JOY PWR switch
    • connect both Port 1 and Port 2 to the MSX general purpose I/O interfaces
  • via one MSX general purpose I/O interface, if your MSX can safely provide more than 100mA on each MSX general purpose I/O interface
    • close jumpers JP2 and/or JP3
    • turn on the SW5 JOY PWR switch
    • connect Port 1 or Port 2 to a MSX general purpose I/O interface

Switches and Buttons

Switch State Description
JOYPWR Off power from MSX computer via joystick port(s) is off (except logic gates)
JOYPWR On board electronics get power from MSX computer via joystick port(s)

Note

If you plug a +5V USB power supply to the USB mini connector, the adapter will turn on unconditionally irrespective of the JOYPWR switch position.

Button Description
MODE change the operation mode of the connected gamepad between "basic mode" and "twin stick mode"
SWAP swap connected gamepads between MSX joystick ports
RESET restart the firmware, gamepads get disconnected

LED indicators

LED State Indication
POWER Off board is not receiving 3V3 power
POWER Solid Red board is receiving 3V3 power
Port1 Off no gamepad is controlling Port 1
Port1 Solid Green a connected gamepad is controlling Port 1
Port1 Blinking Green Every 1sec, PTCs are tripping, see Troubleshooting
Port2 Off no gamepad is controlling Port 2
Port2 Solid Green a connected gamepad is controlling Port 2
BT DISC Off Bluetooth discovery is off, no new connections are accepted, existing connections (if any) stay on
BT DISC Solid Blue Bluetooth discovery is on, new connections are accepted, both "connects" and "re-connects" are accepted

See also the Unijoysticle user guide, keeping in mind that led colors are slightly different.

Troubleshooting

Q: Just after powering the board POWER led is solid red, Port2 and BT DISC leds are off and the Port1 led is solid green, but the adapter does not work

A: Press the reset button to reinitialize the adapter, the BT DISC led should go solid blue shortly, when the adapter is ready.

Q: I did the reset, but now the Port1 led blinks every second, the BT DISC led is off and the Port2 is solid green but the adapter does not work

A: The PTC fuses are tripping preventing the adapter to properly work. See the Powering the msx-joyblue adapter section: use a USB power supply or install the fuse bypass jumpers.

Q: The BT DISC led went off, what happened?

A: You either have 2 gamepads already connected or have turned on the Twin Stick mode.

This can happen too if the PTC fuses are tripping (see previous question).

Q: My Wiimote does not connect

A: If the adapter was previously connected, try pushing any Wiimote button until the Wiimote connects. If that does not work, open the battery compartment and press the red SYNC button to pair the Wiimote with the adapter.

Compatibility Tests

Model Adapter PCB v2 Build2 Adapter PCB v2 Build2c
Sony MSX HB-101P OK OK
Sony MSX HB-501F OK OK
Toshiba MSX HX-10 OK OK
Philips MSX2 VG-8235 OK OK
Panasonic MSX2+ FS-A1WSX OK OK
Omega MSX2+ OK OK
MSXVR OK OK

Build Instructions

Follow these Build instructions in order to assemble the msx-joyblue v2 adapter.

References

Ricardo Quesada bluepad32 library

Ricardo Quesada Unijoysticle2 project

MSX general purpose I/O interface

Image Sources

Footnotes

  1. https://www.msx.org/wiki/Joystick/joypad_controller (see "Undesired Conditions")

  2. https://www.msx.org/wiki/General_Purpose_port

About

Use bluetooth joysticks with your MSX computer

Topics

Resources

License

Stars

Watchers

Forks

Languages