P08027: Wireless Assistive Control System
/public/

Control System

Table of Contents

This section exhaustively discusses the Control System.

DATA PROCESSING & CONTROLLER DESIGN

The controller is the central component of the MSD Wireless Assistive Control System (WACS) project that interfaces the user movement to car movement. The user emulates muscle movements that resemble driving a car. The controller takes these four muscle movements, interprets the user intention and converts it into a format that the car accepts via a wireless communication link. Therefore the controller can be portrayed as a Multiple Input Single Output (MISO) system where four inputs are sent. A single output goes through the wireless transmitter to the RC car. The four inputs are the muscle movements from the user to go forward, backward, turn left and turn right (Fig.1).
Matrix
Figure 1: Basic Controller Block Diagram

The controller is designed in LabView since it supports a better interface for real-time processing than Matlab at low frequencies. The whole program runs in a global while loop from which the only way to escape is by pressing the stop button. The controller is designed on BioRadio 150's visual interface demo (Fig. 2). All the extra features were added later.

Matrix
Figure 2: Entire Controller for MSD WACS

The essential components of the controller are: 1. Digital Filters (FIR) 2. Global Normalization Technique 3. Fail Safe Mode 4. Binary 8 bit conversion 5. Serial Communication link

Data Processing

The BioRadio is connected to the computer via the USB port. In this project COM12 in particular was used for the USB communication. In order to import the component into Labview, the setup in figure 3 was incorporated. The BioRadio block imports raw EMG data that is wirelessly transmitted to the computer. There is a configuration file containing configuration parameters of the BioRadio that can to be downloaded by using the BioRadio Start block. The file contains essential information such as Sampling Rates, Amplifier Gains, which channels were enabled, and the resolution of the data.

Matrix
Figure 3: BioRadio input in Labview

The data from the BioRadio is outlined in an array format. The array comes from the activated channels in sequential order. Figure 4 shows the first 5 channels are used. This is primarily because there is crosstalk between the first activated channel and the second channel in use. In order to circumvent this problem, the data from the BioRadio is connected to the Array Indexing Block (Fig.4). The 0 input activates the first channel, however no data is used from the output. The data from channels 2, 3, 5, and 6 are in the arrays 1, 2, 3, and 4 subsequently. As soon as the data from each channel is separated and the absolute value of the data is taken. It should be noted that the data is collected in an interval of 80ms. So, the data from each channel is an array of information taken in that time frame. The digital filter blocks available in the Labview library were not used. Instead we used other blocks to create our own filter.

Digital Filters

To further remedy the lack of digital filters. The Sum of the elements of the array was divided by the number of elements of that array. This operates as a moving average filter. This in turn acts as an FIR low pass filter. Also the four channels from the left thumb, right thumb, left arm, and right arm are labeled as seen above. At this point, filtered data is ready to be incorporated with the rest of the control algorithm.
Matrix
Figure 4: Global Normalization, and the first half

Control Algorithm

Sequentially following the digital filter, a fail safe was introduced. During the event that the BioRadio is dropping packets (i.e. not properly transmitting data to the computer) while Labview is running, the values after the filter (after the division symbol in figure 4) toggled between (NaN) and 0. The NaN exists because the array size was zero, which then led to a divided by zero in the filter section. This error toggled the values 11111111 and 0000000 at the transmitter end (last block in the frame of figure 5). This created sporadic movements on the RC car when there was a communication error. Therefore, this block was introduced. The block checks if the number of the elements of the array is 0, if it is 0, then a 0 value is sent to the next stage, if not the regular value from the channels are sent to the next stage. The blue, Math Script window is used to find a global max which is used to normalize the incoming data. The block compares each incoming value with value from the previous iteration. If the new value is greater than the previous value, this value is send through the block. Also, each time the Labview program is stopped from running, the Global Max values had to be reset. The True/False block on the top left corner of the Math Script Window, rectifies this problem. The Boolean value from the Stop button is connected to this block, if the stop button is pressed a zero value is set as the Global Max. The contrary implies that a program is running; therefore the regular Global Max is still used. This logic is extended to each of the four channels. Each incoming data is divided by its Global Max (Normalization). At this point the normalized right thumb data is subtracted from the left thumb data (Fig.5). The result is a signal that ranges between -1 and 1; this signal is multiplied by 7 to get a signal between -7 and 7. This logic is replicated to find the difference between front and back data as well. The logic deviates a little after that.
Matrix
Figure 5: Binary Output (Second Half of the Controller Code)

It was noticed that the RC car had limited turn radius. So high end level coding was not necessary for the turns. In order to tackle the direction problems, two new blocks are introduced parallel to each other for the direction (left or right) part of the code at the top. The top block checks if the data is between 1 and 7, if it is; then a value of 7 is sent to the next stage. If it is not true, the parallel block checks if the signal is between -1 and -7, if it is between that range, then a -7 value is sent to the next stage, if that is not true, then a 0 value is transmitted to the subsequent stage. The next stage changes the integer value to binary values. If it is to turn left, then a binary value of 0111 is transmitted, if it is to turn right, then a 1111 value is transmitted, else it transmits a 0000 value indicating a no turn status. The code for the forward and backward motion is a little different. Here, level coding is used. If the car is to turn forward, its range of forward speed is from 0 to 7. If it is to move back, then a range from 0 to -7 values is converted to its binary value. Therefore, the speed value ranges from 0000 to 0111 corresponds to forward motion, if it ranges between 1000 and 1111, then the car is moving back. The result is an 8 bit data packet sent to the car. The first four bits of this 8 bit data represents the direction of the car (if it turns left, right or neither), the next four bits represent the speed of the car (forward or backward with the necessary speed). Thus, the two four bit data is concatenated before transmission, in order for the car to accept the data. Also the true/false block value is the other half of the fail safe implemented. If there are no data packets transmitting, this block ensures that a value of 55 and its complement are sent to the car. This tells the car that there is no data being transmitted and the subsequent data coming in from the receiver on the car should be neglected. The primary purpose of this code segment is to eliminate the possibility of the car interpreting 60Hz noise as instructions for movement. The resulting data from the logic is sent to the PWND block, which is used to access the serial port. The wireless transmitter attached to the serial port sends the data to receiver on the car.