An FPGA-based EMG Communication Device Xianglong Wang, Qiushu Chen, Matthew Elissa, Bharath B. Sathiyamoorthy University of Michigan, Ann Arbor E-mail address: micw@umich.edu Abstract — Unfortunate situations, such as trauma, stroke, or an aneurysm, can render a fully cognizant person unable to communicate verbally or physically his or her wishes. In such a scenario, it is incredibly important to have an alternative method communication between the patient and the hospital staff and even the patient’s family. This paper will introduce a device that allows for EMG based binary code communication. The device will be able to communicate on three levels. First, it employs a physical logic-gate communication circuit. Second, it sends 8-bit strings to a computer program that outputs simple messages. Third, it allows the computer program to access the computer operating system to interface with other programs. Keywords — electromyography, EMG, FPGA, LabVIEW, communication system, communication device I. INTRODUCTION People who suffer from speech-impairing conditions such as trauma, stroke, or aneurysm may find themselves in a hospital situation without the ability to communicate either verbally or physically with their caretakers. This creates drastic issues concerning power of attorney and other medical decisions as well as smaller issues like requesting nurse aid. However, in many cases, patients may still retain function of specific muscle groups. The device presented in this report takes advantage of these voluntary muscle groups and creates a system that enables the patient to communicate by specifically activating these muscle groups. In order to achieve this, the first objective was to design an interface that could isolate and condition specific EMG signals from two separate muscle groups (right and left flexor carpi radialis). The second objective was to analyze and convert these analog signals into digital signals. Once this has been achieved, our device allowed for patient communication on three levels: a 2-bit physical communication system, an 8bit input to receive stored message outputs, and the same 8-bit input to interface outside the program with the operating system of the computer. II. EXPERIMENTAL SETUP To accomplish the objectives, we designed a four-level hierarchy structure for organizing the system. (Fig. 1) The first level of the system is signal acquisition and modification. Two channels of EMG signals are captured by the electrodes placed on muscles. The acquired signals go through the conditioning circuit to be amplified and filtered. The LabVIEW VI takes the amplified signal and converts it to digital signal: “1” a valid reflex and “0” otherwise. The digital signal is outputted from the DAQ board. The second level of the system is hardware control. The Fig. 1 Flow Chart of the Device FPGA board will recognize the signal as inputted from either of the two channels and store it as a digital “1” or “0” in an 8bit register. In one mode, two signals will be used to control four LEDs through a decoder. The FPGA board can also process and send an 8-bit signal to the LabVIEW to accomplish LabVIEW and operating system control. The third and fourth levels of the system are LabVIEW and operating system control. The signal received by LabVIEW will enter a case structure and find the corresponding command to execute. The command can either be within the LabVIEW, or through a batch file to the operating system. A. Gathering the EMG signal Electrodes were attached to the forearms of the subject to gather EMG signals from both right and left arms. The electrodes were placed to isolate the EMG activity of the flexor carpi radialis. One electrode was placed on the flexor carpi radialis. The other was placed on the tendons of the brachioradialis. Just deep to the tendons were supinator muscles in the forearm that would serve as non-activated EMG signals for our differential amplifier. Ground electrodes were placed on the posterior side of both wrists, on top of the distal radioulnar joint. This electrode placement was observed to be the most efficacious placement in order to receive clear, specific signals. The setup is shown in Fig. 2. B. Conditioning Circuit The EMG signals were each fed through a conditioning circuit which consisted of a differential amplifier, a high pass filter and a low pass filter. The differential amplifier used was an AD620 set with an amplification of 20. Next was the high pass filter. The larger problem in our signal was a wandering baseline, so the high pass filter was place immediately after the differential amplifier. The high pass filter was a LM741 operational amplifier with a gain of 10 and a cut-off frequency of 70Hz. Then the signal was passed through a similar LM741 operational amplifier set to be a low pass filter with a gain of 3 and a cut-off frequency of 150Hz. The Bode plots for both filters can be seen in Fig. 3. Fig. 2 Setup of EMG Signal Acquisition DAQ board. The outputs of the FPGA board are two digital outputs to the decoder and one digital output to the DAQ board. Valid digital “1” signals from the DAQ board go through the input channels of the FPGA and become synchronized and shortened to a length of one clock cycle. Then the signals are recognized by different channels, pushing either a “0” or a “1” into the 8-bit shift register. Then the FPGA works at two different modes, switched by an on-board switch. In physical decoder control mode, the FPGA outputs the two least significant bits from the shift register and uses these two signals to control a four-LED array, which indicates four different messages. In the meanwhile, the SSD display on the FPGA board will display “help”. In computer control mode, the FPGA will output a sequence of 9 bits (a “1” header following by the content in the shift register) to the DAQ board at a 20 Hz scan rate. The signals will be used for future signal processing. The current content of the shift register is displayed on both the SSD display and the LEDs on the FPGA board. E. Decoder and LED Array The decoder takes two bits from the FPGA board and converts it into four different messages. The truth table of the decoder is given by: i1 0 0 1 1 i0 0 1 0 1 d3 0 0 0 1 d2 0 0 1 0 d1 0 1 0 0 d0 1 0 0 0 Table 1: Truth Table of Decoder Fig. 3 Bode Plot of Band-pass Filter in Conditioning Circuit C. LabVIEW A/D Conversion EMG signals are fairly irregular and fluctuating. Therefore, to identify a “valid” signal of muscle flex, the EMG signal must be processed. The signal should also be converted into a digital signal, since FPGA is a programmable logic circuit board and takes digital input. Our LabVIEW A/D Conversion VI used a 500 Hz sampling rate. It first computed the root-mean square (RMS) value of the signal from 25 samples prior to the current sample to eliminate the fluctuation. Then the value was compared with a pre-set threshold to determine the current digital output. A 55-65 Hz band-stop filter is used when taking in the signal to eliminate wandering noise and wire noise. (VI size too large to fit on the report: please see the attached VI.) D. FPGA Logic FPGA is a programmable logic circuit board. The inputs of the FPGA are two down-regulated digital outputs from the Then we can map the logic equations as: d0=i1’i0’; d1=i1’i0; d2=i1i0’; d3=i1i0. The schematics of this 2×4 decoder are given by Fig. 4 and Fig. 5: in Fig. 4, every AND/NOT gate is replaced by the transistor circuit in Fig.5 since there is no logic gates available. The d0, d1, d2, d3 are directly connected to LEDs. Fig. 4 Decoder Schematics Please refer to the attached VI file for the block diagram. III. RESULTS We were able to make the whole system able to achieve our objectives. Fig. 7 shows the final prototype of our project: NOT AND Fig. 5 NOT Gate and AND Gate F. LabVIEW Control and Operating System Control The LabVIEW receives an 8-bit signal (originally 9 bit, but the header 1 is useless) from the FPGA board. This is the control signal of LabVIEW. The first level of LabVIEW control is controlling the output within the LabVIEW. A correlation between the 8-bit signals between commonly used expressions was established (see Fig. 6). Using the LabVIEW control, the patient will be capable of performing greetings, answering yes-or-no questions, and describing the level of their pain by numbers. Fig. 6 Correlation between signals and messages The second level of LabVIEW control is interfacing with the operating system. We designed two major functions under this context. By interfacing a command prompt in LabVIEW, our system is capable of opening / close music player to satisfy need for entertainment. A decryption function is also included. LabVIEW will call a Java-based RSA encryption system using command prompt and a batch file when the correct private key for RSA encryption is present. The LabVIEW will also open the file after encryption. Otherwise LabVIEW will warn the user that they have the wrong key. Fig. 7 Final Prototype The following two pictures (fig. 8, fig. 9) are taken during a test for LabVIEW control. Fig. 8 Acquisition of an EMG Signal in LabVIEW Chart 1 to 3: EMG signal, RMS-valued signal, Digital signal output medical report with our system. It is noticeable that even just using 8 bits now, our system is capable of further sophistication and performing more complex operation. The major sources of errors are mostly eliminated in breadboard, in LabVIEW and during digitization. This consists of white noise from the tissues, wire noise and wandering noise. However, one point that is reflected in the testing part needs our attention: we did not recognize one (out of 20) intended reflex. For the sake of accuracy, we selected a higher level of threshold in digitization. We have to put in more time, to find a balance between lowering the threshold level and increasing the potential error rate. V. APPLICATION Our system can be used in families or hospitals, especially for hospitals with centralized nurse stations. With the decoder Since the outcomes of our projects can be classified as mode, a buzzer is potentially added to warn the nurse about either as expected (correct output) or not as expected urgent needs from the patient so that the nurse can arrive on (incorrect output), we designed several tests for our system: button-simulated FPGA program test (using button to simulate time. Our system also provides an innovative and easy way for the patients to communicate with nurses. With an on-board signals from the LabVIEW), LabVIEW-FPGA signal display, there is no need for the nurse to hold a computer to let acquisition test (use actual EMG to test A/D conversion and the patient read what he/she has inputted. With a reset button FPGA) and FPGA-LabVIEW signal sending/recognition test and a send button, it becomes much easier for patients to (send the signal from FPGA and see the corresponding output in LabVIEW). Our design only failed to acquire a digital input double-check so that they will not make critical mistakes in communicating. Also, FPGA-based design can be easily one time in the LabVIEW-FPGA signal acquisition test (out converted into IC chip design, so it is mass-production ready. of 20). Therefore, our design is very stable and reliable. There are a few points that our system can improve. First, IV. DISCUSSION AND CONCLUSION the weight of the wires might be too heavy for a patient for the current design. Lighter, thinner wires should be used to relieve In conclusion, our system acquires EMG signal from both arms, recognizes them as digital signal “1” or “0” respectively, patients’ burden if available. Also, the power of our design is stores the signal in an 8-bit binary string, and achieve different not fully explored. Eight bits can form 256 different kinds of messages, but our system has used less than 1/8 of them. With kinds of communication. more built-in functions, our design will be more powerful. With our system, three levels of EMG-based communication are achieved. First of all, based on a logicACKNOWLEDGMENT gate-based LED subsystem, patients can call for specific help The authors would like to thank University of Michigan, simply by sending a two-bit signal and lighting up LED in Ann Arbor’s Biomedical Engineering Department for funding nurse station corresponding to urgent help requirements. for this project. We would also like to thank Instructor Dr. Fan Secondly, operating on 8-bit signal, face-to-face and Graduate Student Patrick Ingram for offering help with communication between nurse and patient is facilitated with this project. our LabVIEW based communication function. Thirdly, interacting with computer OS is also achieved. Patients are able to open/close music player, decrypt files to check their Fig. 9 LabVIEW Output Control