# Wireless Home Assistive System for Severely Disabled People
## 2 Materials and Methods
### Morse Code Translator (MCT)
\begin{array}{ll}\mathrm{IF}\;\mathrm{e_{T}}\;\mathrm{is}\;\mathrm{LN},& \mathrm{then}\;\mathrm{\epsilon^{\prime}_{T}}\;\mathrm{is}\;\mathrm{LN}.\\ \mathrm{IF}\;\mathrm{e_{T}}\;\mathrm{is}\;\mathrm{SN},&\mathrm{then}\;\mathrm{ \epsilon^{\prime}_{T}}\;\mathrm{is}\;\mathrm{SN}.\\ \mathrm{IF}\;\mathrm{e_{T}}\;\mathrm{is}\;\mathrm{ZE},&\mathrm{then}\;\mathrm{ \epsilon^{\prime}_{T}}\;\mathrm{is}\;\mathrm{ZE}.\\ \mathrm{IF}\;\mathrm{e_{T}}\;\mathrm{is}\;\mathrm{SP},&\mathrm{then}\;\mathrm{ \epsilon^{\prime}_{T}}\;\mathrm{is}\;\mathrm{SP}.\\ \mathrm{IF}\;\mathrm{e_{T}}\;\mathrm{is}\;\mathrm{LP},&\mathrm{then}\;\mathrm{ \epsilon^{\prime}_{T}}\;\mathrm{is}\;\mathrm{LP}.\end{array}  \tag{3}\]  
**Step 3. ** The output variable (\(\mathrm{\epsilon^{\prime}_{T}}\)) of the fuzzy algorithm block is calculated by the center of gravity method and can be defined as Equation (4)  
\[\mathrm{\epsilon^{\prime}_{T}}=\frac{\sum\limits_{i=1}^{n}W_{i}B_{i}}{\sum \limits_{i=1}^{n}W_{i}} \tag{4}\]  
Figure 4: Fuzzy recognition algorithm of MCT for a single switch, (**a**) the flow chart of fuzzy Morse codes recognition in MCT; (**b**) the membership function of fuzzification; (**c**) the membership function of defuzzification. where \(W_{i}\) is the membership grade e of the i-th premise in the fuzzy inference rules shown as conditional expression (3), and B\({}_{i}\) is the center value of the i-th conclusion in the inference rule. The range of the defuzzifier is from B\({}_{1}\) to B\({}_{5}\) (Figure 4c). **Step 4. ** The predictive output (y\({}_{\text{T}}\)) is revised by y\({}_{\text{T-1}}\) and \(e_{\text{T}}^{\prime}\), as shown in Equation (5)  
\[y_{\text{T}}=y_{\text{T-1}}+e_{\text{T}}^{\prime}. \tag{5}\]  
T\({}_{\text{TK}}\) is regarded as the threshold value of the recognition function (R\({}_{\text{TK}}\)) for the next time, and it is twice of y\({}_{\text{T-1}}\). By repeating steps 1-4, the system can automatically adjust the threshold value (T\({}_{\text{TK}}\)) by following the typing speed variation of the user. Similarly, the same recognition procedure for long or short silence intervals between Morse code tones is finished through the four steps mentioned above. MCT has four kinds of output modes: ACAT input mode, keyboard mode, mouse mode, and pad mode, respectively. MCT basically adopts the standard code sets established (Appendix A) by the Morse 2000 working group that defines the corresponding Morse codes of the alphanumeric characters, symbols, functional commands, and instructions to switch between different function modes. In ACAT mode, MCT can send a confirm command to select the option on the recursive scanning keyboard interface in the environment of the ACAT system. In keyboard mode, MCT plays the role of the keyboard that allows the user to input characters, symbols, and functional commands via a single switch. The user inputs appropriate Morse codes according to the keyboard mode table of Appendix A. The fuzzy recognition program inside MCT can identify the corresponding alphanumeric character (e.g., a-z, 0-9), symbol ($/,... ) or function key (Tab, Caps Lock, Ctrl, Alt, Shift, Enter,... ). Then, this output is transmitted to the computer, smartphone, or tablet via a USB or USB On-The-Go (USB OTG) interface. In addition, MCT can recognize the input of composite keys as well. In mouse mode, the eight directions of mouse movement, mouse button operations (left click, right click, and double left click), and mouse drag function are shown in the mouse mode table of Appendix A. MCT enables the user to access the full functions of the mouse through the input of four Morse code elements at most. In pad mode, MCT plays the role of the function keys of a portable device that allow the user to input music player function commands to operate the portable device, such as \"home\", \"play\", \"stop\", \"up volume\", \"down volume\", etc.