Game

The outline of the game is as follows.
When there is a phone request, the LEDs of two ports light up in the same color. These represent the caller and the receiver.
When you connect the ports of the same color using a USB cable, the connection is successful. This means you have successfully processed the request.
The objective is to process as many phone requests as possible within the time limit.
-> The more requests you process, the higher your score becomes.
Requests disappear after a while.
You can use any number of USB cables at the same time.

Game Screen

The game screen displays instructions on how to play and a panel corresponding to the controller. I worked hard to create it, but since most players play by looking at the LEDs on the controller, the game screen might not actually have been necessary.

Controller

The controller consists of 24 USB ports, 24 LEDs (each USB port and LED are arranged as a pair), and one button.
The USB connectors are Type-A. Therefore, when connecting connectors to each other, USB cables with Type-A connectors on both ends are required, but these are not normally available. USB has standards, and connections are based on a host-device relationship. Type-A is normally used on the host side, so if one end is Type-A, the other end is usually the device side, such as Type-B or micro Type-B. It is not normal for both ends to be Type-A. However, such cables can be found easily on sites such as AliExpress. Another reason I chose Type-A connectors is that they have a specific orientation; the frustration of trying to plug one in and failing because it is upside down also contributes to the difficulty. The button is used for actions such as starting the game.

Why Can the Controller Detect Connections?

This controller detects when connectors are connected to each other. At first glance, this seems easy to implement. But is it really? How do you think this controller is implemented? Imagining and predicting how something works is very important in making things.
The requirements this controller needs to satisfy are listed below.
  • It can tell that a connector is not connected to another connector.
  • It can tell that a connector is connected to another connector.
  • If a connector is connected, it can identify the number of the connector it is connected to.

Unless these three requirements are satisfied, this controller cannot be implemented.

If we think about it simply, when a cable is connected, two points become electrically connected, so it may seem possible to implement this function by detecting that. However, doing so would require a huge matrix switch, probably. This is not very realistic. Complex wiring makes creation and modification difficult, which increases the difficulty of the project. In the first place, I feel like there would not be enough microcontroller I/O pins.

So, What Do I Do?

We loosen the previous requirements a little.
  • It is enough to be able to detect whether two specified ports are connected.
    It is not necessary to detect connections between those two ports and any other ports.
  • These two ports can be changed dynamically.
Even under these conditions, the game seems sufficiently achievable.
To implement this, I used an FPGA. The reasons are as follows.
  • The direction of the I/O can be changed dynamically.
  • There is a reasonable number of I/O pins.
Also, with simple electrical continuity, we cannot tell which port is connected, so I adopted a method of sending the port number using serial communication. The ability to use as many serial communication channels as needed was also a reason for choosing an FPGA. In other words, the specification is as follows.
A USB port consists of four wires, and one of them is used as a communication line. The communication line has either an INPUT or OUTPUT direction, and this direction can be switched dynamically.
  • In OUTPUT mode, the port continuously sends its own port number via serial communication.
  • In INPUT mode, the port waits to receive data via serial communication....
Read more »