Proposal of Speed-Up Method for Pulse Type of Digital Switch and Expansion of Application Scope to them

In this study, we will propose a method to fasten processing time and a calibration function for the practical use of pulsed digital switches. In recent years, with the aging of the population, there is a need for a universal design that allows anyone to easily operate electrical products. To the aim, a pulse-type of digital switches have been developed that allow the switch type and number of switches to be easily changed. However, the switch has two problems that the processing time is relatively long and the response time becomes longer as the number of switches increases. Further, since the output of the negative logic sensor module is the opposite of that of positive logic module, there is a problem that ON / OFF malfunctions when the negative logic sensor module is attached. In our study, in order to solve these problems, the processing time is shortened and calibration functions are added, and their validities are verified. As a result, compared to the conventional method, the processing time is shortened from 15 [ms] to 1 [ms] in this study. All switches work correctly with a simple calibration, even if we don't know in advance whether the switches will work with positive or negative logic. Thus, we will solve the problems of the conventional method and realize an input device that is easier for users to use.


Introduction
In recent years, electrical equipment has been diversified, and various input devices have been used accordingly. For example, switch input, voice input, motion input, etc. In particular, electrical appliances with many functions have many switches. There are various types of switches such as push switches, touch switches, and sensor switches. The push switch has a simple structure, and the switch can be operated by pressing a button. It has a sense of tactile and is used in many applications. For example, it is used for TV remote controls and keyboards. Since a touch switch operates only by touching the touch panel, the user does not need to press it. Therefore, it is often used in devices used by an unspecified number of people, such as bank ATMs. In this way, the optimum switch type of the device is selected according to the purpose of use. However, many input devices cannot be used equally by everyone. For example, elderly people without hand power cannot master push buttons. They prefer touch type of switch. To solve this problem, a pulse type of digital switch (1) has been developed. It can easily change the switch type. The method has the features that the switch type and the number of switches can be easily changed by the user's customization. This method outputs a pulse to the switch and measures the delay time in the rise of the pulse. The ON / OFF of the switch is determined by the delay time. This allows the same algorithm to operate even if the switch types are different. Each switch operates independently. The ON / OFF status of each switch is detected sequentially. As a result, the status of many switches can be determined even in a noisy environment, and multiple switches can be detected at the same time. However, compared to the conventional touch panel switches (2,3) , the processing time for one switch is relatively long, and there is a problem that the response time becomes longer according as the number of switches increases. Further, in the sensor module of negative logic, since the output is opposite to that of positive logic, there is a problem that ON / OFF malfunctions.
In this study, we shorten the processing time and add a calibration function for the purpose of practical use of pulse type of digital switch. By shortening the processing time, it is possible to increase the number of switches without considering the processing time. In addition, All switches work correctly with a simple calibration, even if we don't know in advance whether the switches will work with positive or negative logic. Thus, we will solve the problems of the conventional method and realize an input device that is easier for users to use.

Pulse Detection Type Switch
The pulse type of digital switch determines the ON / OFF state of a switch by detecting delay time of rise of pulse caused by RC circuit. Figure 1 shows the circuit of pulse type of digital switch. In the detection part of Fig. 1(A), let the upper node of the resistor R is (a) and the lower node is (b). A pulse is sent to node (a) and a waveform is received at node (b). The ON / OFF state of switch is determined based on the delay time of rise of pulse waveform of node (b). In addition, Fig. 1(B) shows the circuit of switch parts. We can get many types of switches by changing the switch from a touch switch to a push switch and a sensor switch. In OFF state, the pulse waveform of the node (a) is the same as that of the node (b) because the switch is not connected to RC circuit. On the other hand, in ON state, since the switch is connected to ground, the rise time of the pulse waveform of node (b) is delayed by RC circuit as compared with the pulse waveform of node (a). Figure 2 shows the waveforms of node (a) and node (b) when the switch is ON. Set the threshold voltage to be Vth as shown in the lower waveform of Fig. 2. Assuming that the time until the voltage reaches Vth is T, T = 0 when the switch is OFF, because there is no delay. On the other hand, when the switch is ON, there is a delay in the rise of pulse. In our study, T> 10 [ms]. Thus, the pulse type of digital switch can determine the state of switch by using delay time.

Delay Time Measurement
The flowchart of the delay time measurement is shown in FIG. The details are as follows. ① Change the output signal of I/O port (a) from LOW to HIGH in Fig. 1 (A). At this time, the counter n = 0 is set. ② Read the waveform of node (b) of I / O port in Fig. 1(A). ③ If the amplitude of node (b) is less than Vth, the counter value increases by one. n = n + 1 ④ Repeat ② and ③ until the time reaches W. When the time reaches W, the output of node (a) is set to LOW.
The delay time T is calculated based on the value of n.

Speed-Up
If there is no delay in the rise of the pulse, the switch is off. Therefore, if there is no delay time, it is considered to be off at that point, and the measurement can be omitted. Figure 4 shows a flowchart that uses this idea to reduce the processing time. The details will be described below. ① Change the output signal of I/O port (a) from LOW to HIGH in Fig. 1 (A). At this time, the counter n = 0 is set. In this way, when there is no delay in the pulse of the node (b) as compared with the node (a), the processing time can be shortened.

Calibration Function
A flowchart of the calibration function is shown in Fig. 5, and the details are described below. ① Measure the delay time in Chapter 2.2. ② Repeat ① 10 times. ③ Get the average delay time. ④ Set the threshold value Tth based on average delay time.
The ON / OFF state is judged based on this threshold value. In this study, the calibration state is regarded as the OFF state, and the delay time of the received waveform is set to be Toff. When the delay time T changes significantly from the set threshold value Tth, that state is regarded as the ON state. That is, |Toff-T| > Tth. In this way, the ON / OFF state is determined from the change in the delay time.

Detection Algorithm
The flowchart of the detection algorithm is shown in Fig. 7, and the details are described below. ① When the reset button is pressed, all states are reset. If it is not pressed, go to ③. ② The calibration mentioned in Chapter 2.4 is executed. The state when the reset button is pressed is regarded as the OFF state, the delay time Toff is measured, and the threshold value Tth is set. ③ Get delay time T. ④ If the delay time T changes significantly from the threshold value Tth, the state is ON. if | Toff-T |> Tth, then ON state. ⑤ The result is sent to PC

Verification of Speed-Up
In this experiment, in order to verify the speed-up, the sending pulse waveform and the processing time are obtained when the switch is off. The amplitude of the pulse is 5 [V], 8 switches are connected to each Expander, and Arduino is used to measure the processing time. Since the device detects each state of port, each port sends pulse sequentially as shown in Fig. 8. As a result, the processing time increases in proportion to the increase of the number of Expanders.
The measurement time is shortened based on the speed-up model in Chapter 2.3. Fig. 9 (A) shows the waveform of normal measurement, and Fig. 9 (B) shows that of high-speed measurement. As a result, the pulse width of normal measurement is about 15 [ms], while that of high-speed measurement is about 1 [ms], so it can be seen that the pulse width is greatly shortened. Table 1 shows the processing time of normal measurement. As a result, the processing time per a connected Expander is about 115 [ms]. Since an Expander is connected to eight switch units, the processing time of an unit is approximately 14.4 [ms]. Table 2 shows the processing time of normal measurement. As a result, the processing time per a connected Expander is about 8.2 [ms]. Since an Expander is connected to eight

Verification of Calibration Function
As explained in Chapter 2.4, let the delay time in the OFF state be Toff and let the threshold value be Tth, the case where the delay time T satisfies the following conditions is judged as the ON state: | Toff --T | > Tth.
In order to confirm this validity, a pulse was sent to the experimental circuit shown in Fig. 10, the received pulse was gotten, and the delay time was measured. In this experiment, Tth = 5 [ms].
At first, the state of positive logic switch was confirmed. The result is shown in Fig. 11. Figure 11  Next, the state of negative logic switch was confirmed. The result is shown in Fig. 12. Figure 12(A) shows the waveform when the switch is OFF, Toff = 7 [ms]. From Figure 12(B), T = 0 [ms]. Therefore, | Toff-T | = 7 [ms], and it exceeds the threshold value Th(= 5 [ms]), so it is determined to be ON state. In this way, the state of ON/OFF has been correctly judged in both positive logic and negative logic.

Conclusions
In this study, aiming at the practical use of pulse-type of digital switches, we speeded up the processing time and added a calibration function.
When there is no delay of pulse waveform, it is not necessary to measure the delay time. By the use of this, the processing time is shortened. In the case of the conventional method, it takes about 15 [ms] for detecting ON/OFF of each switch, so when the number of switches is N, it takes N × 15 [ms]. However, due to the speedup of this study, the processing time per switch unit without delay is about 1 [ms], and even when the number of switches is N, it was N × 1 [ms]. Assuming actual application, the number of switches that can be turned on at the same time is 1 to 3, and the other switches are OFF. Therefore, this speedup is very effective according as the number of switches increase. Furthermore, with the addition of the calibration function, the method can correctly recognize ON / OFF state without knowing the positive and negative logic of switch.
As a result, in this study, we improved the problems of conventional pulse type of digital switch and realized an input device that is easier for users to use.