Brain-computer interfaces have existed for decades now, but the vast majority are either invasive to use or are closed source, making it nearly impossible to see what is happening at a deeper level. To address both of these problems, the creator of this project, who goes by the name “Hut,” set out to build his own version of a myoelectric neural interface, referred to as the PsyLink, which leverages the naturally-occurring electrical impulses within muscles to generate keypresses.
The goal was to make a device that could also surpass the maximum typing rate of around 120 words per minute, assist people who might not have full use of their hands such as in the case of arthritis or injury, and to generally fit a futuristic, cyberpunk theme. He documented his entire journey in great detail, along with each prototype iteration, here in this blog.
After taking the time to research EMG designs and some already existing projects, Hut came to the conclusion that he would need a microcontroller to gather signals and perform analysis on them. He then went with an Arduino Nano 33 BLE Sense due to its onboard Bluetooth connectivity, larger ADC, and TensorFlow Lite support for taking advantage of embedded machine learning technologies. His very first prototype consisted of two pieces of aluminum foil with wires emanating from them whose signals were then passed to the ADC.
This design was then upgraded slightly to use more electrodes for a greater range of muscles that could be targeted. For filtering out noisy signals, Hut decided to go with Fourier transformations, which took 64 samples, eliminated anything outside of the desired frequency range, and then reported them via serial.
With the minimum viable product (MVP) now completed, Hut decided to incorporate machine learning onto the Nano 33 BLE Sense with the use of TensorFlow Lite. His plan was as follows: start the device, begin a recording while pressing the desired key, move your arm in that same direction, then end the recording and optionally repeat the entire process as many times as needed. Once all of the 10,000 samples, spanning three directional labels, had been gathered, the model was trained for 100 epochs, which resulted in an accuracy of around 96%.
The next few iterations of the PsyLink were primarily centered around gathering more data, getting cleaner signals to pass to the neural network, and making the whole device wireless. To accomplish the first two items in the list, Hut included a custom OP-AMP circuit for the purpose of filtering out excess noise and an analog multiplexer for attaching multiple electrodes together on a single PCB.
The “brain” portion of the device was consolidated onto a single PCB containing an Arduino, a few passive components for power management, and headers for connecting the external electrode boards.
Once the hardware had been completed, Hut decided to make a custom user interface for viewing and interacting with the large amount of data within the system. The top of the application lists some general information about the status of the device, such as its Bluetooth address, number of samples recorded, and if it is connected or not. The center then gives a pleasant visual readout of each incoming signal from the analog pins for debugging purposes. Finally, the menu allows for recordings to be added/managed and for the neural network to be retrained/loaded.
This project is still undergoing constant improvements, but even in its current state, the PsyLink works quite well at inferring which key the user wishes to press simply from a muscle contracting. For more information about the project, you can visit its page here or watch this demo video.