Checkoff

Specs

We built an analog circuit that amplifies the small electrical signals from a muscle into a range readable by the ADC. The circuit has three stages. First, it has an instrumentation amplifier that takes in the differential signal from the electrodes and turns it into a single-sided signal. Next, the single-sided signal is amplified by a sequence of inverting amplifiers. Finally, the signal is rectified into something suitable for the ADC.

Figure 1: A representative flexing signal. The test subject flexed three times.

We used a new peripheral for the STM32L432KC microcontroller, the Analog-to-Digital Converter or ADC. We wrote a new library for this sensor that provides initialization and read functions. The ADC gets the system clock with a prescaler of 8 so that it runs at 10 MHz. This

We reused a previous peripheral, the Serial Peripheral Interface (SPI), to communicate information from the MCU to the FPGA. On the MCU side, the SPI library function sendPlayerData sends 4 characters (upper and lower halves of each of the 12-bit voltages) and asserts a load signal. On the FPGA side, receive_only_SPI reads in the voltages based on the load signal and holds them when load is not asserted.

Figure 2: SPI from the MCU to the FPGA.
D0 - CS, D1 - MOSI, D2 - MISO, D3 - SCK, D4 - LOAD

We use a counter to loop through all 8 pairs of rows (given by abcstate). From 0 to 31, we load in rgb data. From 32 to 24, lat is asserted. From 34 to 36, output enable is asserted to turn off the screen as we move to the next row.At 36, counter resets and abcstate increments.

Single player mode (Figure 3) can be switched to show either player’s data as a bar chart. Multiplayer mode (Figure 4) shows two competing bars, red and blue, to indicate the game progress. In single player mode , a decoder converts the data into chunks. In multiplayer mode, a decoder compares the two voltages and outputs the state of the game. We mux between their outputs (which are really states, but that we call screens) based on a mode switch.

Figure 3: Single player
Figure 4: Multiplayer game

There are additional states that don’t display player data. They read in static .txt files to display more complex shapes, such as words. The victory screen also flashes to grab attention.

Figure 5: Starting sequence, culminating with a GO!
Figure 6: Victory for Player 1