# An Implementation of Hardware-Accelerated Serial Interface of IoT Gateway for Enabling Machine-Type Communication: A Case Study of Networking IR Controllable Home Appliances

Authors: Wen-Chung Tsai; Shi-Xiang Zhu; Nien-Ting Huang; Mao-Lun Chiang
Journal: Journal of Computer Networks and Communications
 (2019)

---

## Abstract

In this paper, we propose an implementation of machine-type communications by combining a novel hardware-accelerated serial interface and a conventional Internet of things (IoT) gateway. Even all home appliances with an infrared (IR) remote controller can be operated through the Internet. In the future, application paradigms will transfer from human-type communications to machine-type communications to provide services such as health care and smart-home control systems. Therefore, commercial IoT gateways are required for intranet-Internet bridging of various wireless access services. Home appliances that are currently used or will foreseeably be used in the future lack network capabilities but can be controlled by an IR remote controller. Accordingly, to leverage existing IR control capabilities, we implemented a smart-home control system, which enables an IR signal to be remotely controlled to emit through the Internet. The implemented system provides a hardware-accelerated serial interface to sample IR signals—including extremely high-frequency signals—and includes a hardware-based data compression mechanism able to reduce the size of oversampled data and save flash memory space. A more intelligent control style can thus be realized by leveraging existing home appliances for the smart-homes of the future.


---

## Body

## 1. Introduction

The technology pertaining to machine-type communications over cellular network technologies such as Wi-Fi (802.11) and 4G-LTE (Long-Term Evolution) for Internet of things (IoT) control is promising. To meet different IoT application requirements, the Institute of Electrical and Electronics Engineers (IEEE) [1] and 3rd Generation Partnership Project (3GPP) [2] have started to consider IoT application issues, mainly involving the functional architecture and service requirements for machine type (MT) [3] and machine-to-machine (M2M) [4] applications. As expected, various devices, equipment, and machines are required to connect to the Internet; research challenges must be addressed both in academia and for industry [5]. In the M2M paradigm, machine-type communications can achieve a more intelligent home control system for future lifestyles, compared with other communications. A feasible system is to enable household appliances to be remotely controlled through the Internet, thus affording an integrated smart-home control system. Home appliances that are currently used or will foreseeably be used in the future lack network capability but can be controlled by infrared (IR) remote controllers. Therefore, this paper proposes a solution and a system to provide conventional home appliances with networking capabilities.IR signal protocols and standards such as the Infrared Data Association (IrDA) standards [6, 7] play a notable role in the control of home appliances such as televisions and air conditioners, which are equipped with IR remote controllers. Therefore, we designed an IoT home gateway to enable control of home appliances through a machine-type communication by leveraging existing IR approaches. The implemented smart-home control system can be remotely controlled by network devices such as sensor nodes or smartphones over the Internet. Relevant research [8–11] has supported similar ideas but implemented the ideas by using ZigBee or Bluetooth as a network interface; however, the implemented systems cannot connect to the Internet because of the lack of Internet protocol support. Shinde et al. [12] proposed that IR signals could be controlled through GSM (Global System for Mobile Communications; 2G telecommunication technology) networks; compared with our implementation, however, the controlled target is merely a lamp connecting to an Arduino board.Currently, commercial IoT gateways support various wireless services between intranet and Internet applications. However, home appliances are commonly controlled by IR remote controllers and do not support wireless interfaces such as Wi-Fi and Bluetooth. To bridge wire or IR signals to the Internet, a possible solution is to utilize general-purpose input/output (GPIO) interfaces controlled by a microprocessor (μP) of an IoT gateway. However, most IoT gateway μPs are equipped with a single low-performance core, meaning that the receiving and emitting of signals through the μP causes additional computational burden. This may thus lead to a technical problem that could cause operational failures owing to substandard μP performance. The IR signal emitted by our implemented IoT home gateway is likely different from that emitted by the original IR remote controller. Therefore, further study to identify feasible solutions to the signal mismatch problem would be worthwhile. In contrast to existing products, IR signals emitted by an IR remote controller can be captured by our IoT home gateway. To sufficiently minimize the distortion of the recorded signal, the source IR signal input to the IoT home gateway is sampled by a hardware-accelerated serial interface with an extremely high sampling frequency. Accordingly, a hardware and software codesign based on a field-programmable gate array (FPGA) was implemented [13] in lieu of conventional software-based implementations [14]. None of the aforementioned studies has optimized mechanisms for storing captured data. We considered that designing a data compression system is imperative. We thus implemented a data compression scheme that can reduce the large size of captured data caused by the extremely high sampling frequency of our hardware-accelerated serial interface.The rest of this paper is organized as follows: In Section2, we provide the background of IR signals. Section 3 introduces our design methodology, including an application scenario, and a hardware and software architecture implemented in an FPGA-embedded system. Section 4 presents a data compression and decompression scheme specifically designed for processing IR signals. Section 5 presents experimental results with performance analyses. Section 6 provides demonstrations of controls for implemented IoT-type home appliances. Finally, Section 7 presents conclusions.


## 2. Background

In this section, we introduce characteristics, protocols, relevant studies, and application problems related to IR signals. The descriptions in this section follow on from those in the work of Tsai et al. [15].


### 2.1. Protocols for IR Signals

For IR signal use, various protocols have been defined by different manufacturers, with notable protocols being specified by NEC, SONY, Philips (RC5/RC6), Toshiba, and Sharp. Consider, for example, the NEC protocol [16], which is illustrated in Figure 1. In this protocol, a frame (namely, a packet) consists of a leader code, two 8 bit custom codes (Custom Code, Custom Code’), two 8 bit data codes (Data Code, Data Core¯), and a stop bit. The leader code contains a high-level signal 9 ms in length and a low-level signal 4.5 ms in length (Figure 1). The second 8 bit custom code is bit inverse to the first 8 bit custom code for the purpose of data integrity checks used by the signal receiver; this also applies to data code pairs. According to an alternative system, the custom code and data code can be extended from 8 to 16 bits to carry more information in a frame when no data integrity check is required in the applied communication environment.Figure 1
IR signal protocol by NEC.The waveform in Figure1 is coupled with an adopted signal carrier, as presented in Figure 2. For the application of IR signals for remote appliance control, the carrier frequency used could range from 20 to 80 kHz. As illustrated in Figure 2, the carrier frequency applied by the NEC IR protocol is 38 kHz (i.e., cycle time = 26.3 μs) and the duty cycle factor is one of three.Figure 2
Pulse cycle of signal carrier of NEC protocol.Figure3 shows the partial waveform in Figure 1 coupled with an applied 38 kHz signal carrier. The 13.5 ms leader code contains a 9 ms pulse and a 4.5 ms space. The pulse waveform is identical to that of the 38 kHz signal carrier, and the space is a waveform with a low-level signal. A logical 0 represents a 1.125 ms signal waveform consisting of a 0.56 ms pulse and a 0.56 ms space, whereas a logical 1 represents a 2.25 ms signal waveform consisting of a 0.56 ms pulse and a 1.69 ms space. Therefore, an IR remote controller cannot control another home appliance using dissimilar protocols or different carrier frequencies.Figure 3
Waveform formats of leader code and logical data of NEC protocol.


### 2.2. IR Signal Measured by Logic Analyzer

The IoT gateway was implemented using ZEROPLUS Technology [17]. We used a logic analyzer (LA) provided by ZEROPLUS to measure signals emitted by three IR remote controllers, as illustrated in Figure 4. The carrier (e.g., 38 kHz of NEC) of each IR signal was decoded to display logical data (i.e., data 0 or data 1). Similarly, Nakamichi et al. [18] proposed an IrRC-Logger that can help users analyze recorded IR signals, and Lin and Min [19] attempted to decode IR signals by using a microcontrol unit.Figure 4
IR signals of (a) Terasic evaluation board, (b) SONY television, and (c) IRIS ceiling light.
(a)
(b)
(c)Figure4(a) depicts an LA-captured IR signal transmitted from a remote controller implemented on an FPGA evaluation board produced by Terasic Inc. [20]. As revealed in the figure, the LA provides a protocol decoding function that distinguishes between different sections of header, custom, and data codes for the captured logical data. In addition, the signal’s waveform is similar to that in the protocol defined by NEC. Figure 4(b) illustrates the IR signal emitted by a SONY television remote controller. The SONY protocol is relatively simple compared with that of NEC. Furthermore, an identical signal pattern (i.e., frame) is repeated four times in the waveform. We consider that the repeats are used to increase the probability of functional operation such that the television’s remote controller successfully works. This is because when the IR signal is subjected to noise interference, the television can functionally react to the applied control even if only one of the four frames is correctly received. Figure 4(c) presents a signal captured from a ceiling light produced by IRIS Co. [21]. Compared with NEC and SONY, IRIS is not a particularly famous company; information about its proprietary protocol is not easily accessible for the public. The figure reveals an identical frame repeating three times. The frame format observed for IRIS is more complex than that for either NEC or SONY.


### 2.3. Issues Leading to IR Signal Duplication Failure

We noted several causes of distortion between recorded signals and source signals, which are outlined as follows:(1)
Signal carriers with different frequencies: most IR remote controllers of home appliances apply the carrier frequency of 38 kHz as defined by NEC. However, for SONY, the carrier frequency is 40 kHz; for RCA, it is 56 kHz; and for certain applications, it may be as high as 80 kHz. Because an IR remote controller uses a fixed carrier frequency, it cannot control other appliances using different carrier frequencies, even if the frame format complies with the same protocol. Therefore, Vento et al. [22] presented an IR direct-sequence spread spectrum (WIR-DSSS) system that adjusts the applied carrier frequency for different applications.(2)
Different outcomes from pressing a button: operations for pressing a button to generate a pulse can be distinguished into several categories. For an inching operation, for example, a user presses an IR remote controller button, which sends out only one frame each time. For a continuative operation, the remote controller continues to emit IR signals until the button is released. Most television remote controllers use inching operations, and major air-conditioning controls use continuative operations.(3)
Repeat launching of identical signals: IR signal emitters are low-cost devices and cannot generate high-quality signals. In addition, the signals could be subject to noise and other interference. To avoid the possibility of such errors and disturbances, common IR remote controllers emit a predefined number of repeated signals to increase opportunities for receiving at least one correct frame and completing a successful operation.(4)
Outcomes depending on duration of button press: the duration of a button press can prompt one of several possible functions. For example, pressing a button for less than 1 s turns off the targeted machine’s monitor. However, constantly pressing the same button for more than 5 s causes the machine to shut down entirely.(5)
Encrypted signals for security purposes: IR signal data could be encrypted for interests such as privacy protection, antiattack, or antiplagiarism. The methods applied could be as follows: (1) Each time one button is pressed, the emitted frames are not equal but follow a changing rule known to both the sender and receiver or (2) the emitted frames are equal but coupled with different carriers negotiated by the sender and receiver.


### 2.4. Case Study of a HITACHI Air Conditioner

We used an LA to log the signal data of a HITACHI air conditioner’s remote controller, as shown in Figure5(a). We observed that the characteristic of the IR signal emitted by the HITACHI IR remote controller was unusual, as illustrated in Figure 6(a), compared with the signals in Figure 4. We noted that the length of the signal was especially long (Figure 6(a)), signifying a failure to duplicate IR signals using a commercially recordable universal remote control (URC), as shown in Figure 5(b). Figure 6(b) illustrates that signals recorded by recordable URCs or other devices proposed in [23] could be inadequate; some essential signals were missing, as indicated by the read box in the figure. We determined the cause of the missing signals to be storage memory limitations. Hua et al. [24] provided a solution whereby additional IR signal data can be sent to a server and stored in a corresponding database (e.g., an SQL database). However, this occupies more network bandwidth to store or restore IR signal data. In massive machine-type-communication paradigms [25], less narrow bandwidth requirements are a definite design target for each IoT device.Figure 5
IR remote controllers of (a) HITACHI air conditioner, (b) recordable URC, and (c) our interface.
(a)
(b)
(c)Figure 6
IR signals for remote controllers of (a) HITACHI air conditioner, (b) recordable URC, and (c) our implemented IoT home gateway.
(a)
(b)
(c)Referring to [26, 27], we believe that a smaller size memory can be used if a system can support data compression, which can reduce the memory space required to store IR data. As shown in Figure 5(c), our implemented system is verifiably practical for real applications. Figure 6(c) reveals that the signal stream generated by our implemented IoT home gateway is identical to the source signal in Figure 6(a). The following sections introduce our design methodology, present the experimental results, and provide demonstrations of real applications.


## 2.1. Protocols for IR Signals

For IR signal use, various protocols have been defined by different manufacturers, with notable protocols being specified by NEC, SONY, Philips (RC5/RC6), Toshiba, and Sharp. Consider, for example, the NEC protocol [16], which is illustrated in Figure 1. In this protocol, a frame (namely, a packet) consists of a leader code, two 8 bit custom codes (Custom Code, Custom Code’), two 8 bit data codes (Data Code, Data Core¯), and a stop bit. The leader code contains a high-level signal 9 ms in length and a low-level signal 4.5 ms in length (Figure 1). The second 8 bit custom code is bit inverse to the first 8 bit custom code for the purpose of data integrity checks used by the signal receiver; this also applies to data code pairs. According to an alternative system, the custom code and data code can be extended from 8 to 16 bits to carry more information in a frame when no data integrity check is required in the applied communication environment.Figure 1
IR signal protocol by NEC.The waveform in Figure1 is coupled with an adopted signal carrier, as presented in Figure 2. For the application of IR signals for remote appliance control, the carrier frequency used could range from 20 to 80 kHz. As illustrated in Figure 2, the carrier frequency applied by the NEC IR protocol is 38 kHz (i.e., cycle time = 26.3 μs) and the duty cycle factor is one of three.Figure 2
Pulse cycle of signal carrier of NEC protocol.Figure3 shows the partial waveform in Figure 1 coupled with an applied 38 kHz signal carrier. The 13.5 ms leader code contains a 9 ms pulse and a 4.5 ms space. The pulse waveform is identical to that of the 38 kHz signal carrier, and the space is a waveform with a low-level signal. A logical 0 represents a 1.125 ms signal waveform consisting of a 0.56 ms pulse and a 0.56 ms space, whereas a logical 1 represents a 2.25 ms signal waveform consisting of a 0.56 ms pulse and a 1.69 ms space. Therefore, an IR remote controller cannot control another home appliance using dissimilar protocols or different carrier frequencies.Figure 3
Waveform formats of leader code and logical data of NEC protocol.


## 2.2. IR Signal Measured by Logic Analyzer

The IoT gateway was implemented using ZEROPLUS Technology [17]. We used a logic analyzer (LA) provided by ZEROPLUS to measure signals emitted by three IR remote controllers, as illustrated in Figure 4. The carrier (e.g., 38 kHz of NEC) of each IR signal was decoded to display logical data (i.e., data 0 or data 1). Similarly, Nakamichi et al. [18] proposed an IrRC-Logger that can help users analyze recorded IR signals, and Lin and Min [19] attempted to decode IR signals by using a microcontrol unit.Figure 4
IR signals of (a) Terasic evaluation board, (b) SONY television, and (c) IRIS ceiling light.
(a)
(b)
(c)Figure4(a) depicts an LA-captured IR signal transmitted from a remote controller implemented on an FPGA evaluation board produced by Terasic Inc. [20]. As revealed in the figure, the LA provides a protocol decoding function that distinguishes between different sections of header, custom, and data codes for the captured logical data. In addition, the signal’s waveform is similar to that in the protocol defined by NEC. Figure 4(b) illustrates the IR signal emitted by a SONY television remote controller. The SONY protocol is relatively simple compared with that of NEC. Furthermore, an identical signal pattern (i.e., frame) is repeated four times in the waveform. We consider that the repeats are used to increase the probability of functional operation such that the television’s remote controller successfully works. This is because when the IR signal is subjected to noise interference, the television can functionally react to the applied control even if only one of the four frames is correctly received. Figure 4(c) presents a signal captured from a ceiling light produced by IRIS Co. [21]. Compared with NEC and SONY, IRIS is not a particularly famous company; information about its proprietary protocol is not easily accessible for the public. The figure reveals an identical frame repeating three times. The frame format observed for IRIS is more complex than that for either NEC or SONY.


## 2.3. Issues Leading to IR Signal Duplication Failure

We noted several causes of distortion between recorded signals and source signals, which are outlined as follows:(1)
Signal carriers with different frequencies: most IR remote controllers of home appliances apply the carrier frequency of 38 kHz as defined by NEC. However, for SONY, the carrier frequency is 40 kHz; for RCA, it is 56 kHz; and for certain applications, it may be as high as 80 kHz. Because an IR remote controller uses a fixed carrier frequency, it cannot control other appliances using different carrier frequencies, even if the frame format complies with the same protocol. Therefore, Vento et al. [22] presented an IR direct-sequence spread spectrum (WIR-DSSS) system that adjusts the applied carrier frequency for different applications.(2)
Different outcomes from pressing a button: operations for pressing a button to generate a pulse can be distinguished into several categories. For an inching operation, for example, a user presses an IR remote controller button, which sends out only one frame each time. For a continuative operation, the remote controller continues to emit IR signals until the button is released. Most television remote controllers use inching operations, and major air-conditioning controls use continuative operations.(3)
Repeat launching of identical signals: IR signal emitters are low-cost devices and cannot generate high-quality signals. In addition, the signals could be subject to noise and other interference. To avoid the possibility of such errors and disturbances, common IR remote controllers emit a predefined number of repeated signals to increase opportunities for receiving at least one correct frame and completing a successful operation.(4)
Outcomes depending on duration of button press: the duration of a button press can prompt one of several possible functions. For example, pressing a button for less than 1 s turns off the targeted machine’s monitor. However, constantly pressing the same button for more than 5 s causes the machine to shut down entirely.(5)
Encrypted signals for security purposes: IR signal data could be encrypted for interests such as privacy protection, antiattack, or antiplagiarism. The methods applied could be as follows: (1) Each time one button is pressed, the emitted frames are not equal but follow a changing rule known to both the sender and receiver or (2) the emitted frames are equal but coupled with different carriers negotiated by the sender and receiver.


## 2.4. Case Study of a HITACHI Air Conditioner

We used an LA to log the signal data of a HITACHI air conditioner’s remote controller, as shown in Figure5(a). We observed that the characteristic of the IR signal emitted by the HITACHI IR remote controller was unusual, as illustrated in Figure 6(a), compared with the signals in Figure 4. We noted that the length of the signal was especially long (Figure 6(a)), signifying a failure to duplicate IR signals using a commercially recordable universal remote control (URC), as shown in Figure 5(b). Figure 6(b) illustrates that signals recorded by recordable URCs or other devices proposed in [23] could be inadequate; some essential signals were missing, as indicated by the read box in the figure. We determined the cause of the missing signals to be storage memory limitations. Hua et al. [24] provided a solution whereby additional IR signal data can be sent to a server and stored in a corresponding database (e.g., an SQL database). However, this occupies more network bandwidth to store or restore IR signal data. In massive machine-type-communication paradigms [25], less narrow bandwidth requirements are a definite design target for each IoT device.Figure 5
IR remote controllers of (a) HITACHI air conditioner, (b) recordable URC, and (c) our interface.
(a)
(b)
(c)Figure 6
IR signals for remote controllers of (a) HITACHI air conditioner, (b) recordable URC, and (c) our implemented IoT home gateway.
(a)
(b)
(c)Referring to [26, 27], we believe that a smaller size memory can be used if a system can support data compression, which can reduce the memory space required to store IR data. As shown in Figure 5(c), our implemented system is verifiably practical for real applications. Figure 6(c) reveals that the signal stream generated by our implemented IoT home gateway is identical to the source signal in Figure 6(a). The following sections introduce our design methodology, present the experimental results, and provide demonstrations of real applications.


## 3. Design Methodology

IoT is a promising technology for smart control of home appliances. Therefore, this study implemented an FPGA-based hardware-accelerated IoT home gateway that can be remotely controlled by network devices with the Internet. The proposed design methodology is provided in this section.


### 3.1. Application Scenario

Figure7 illustrates the application scenario for the proposed gateway system. The system includes a network device such as a smartphone.Figure 7
Application scenario.First, the IoT home gateway can be set to operate in the study mode to record the specified IR signal emitted by pressing an IR remote controller button for a home appliance. The user can then use a smartphone to choose a prerecorded signal. The control message is subsequently transmitted to the IoT home gateway through the wireless network. Finally, the IoT home gateway emits a prerecorded IR signal to control the targeted home appliance. As shown in Figure7, we used an LA provided by ZEROPLUS Technology [17] for signal analyses and error debugging during the development phase. The two operating modes are described in detail:(1)
Study mode: the IoT home gateway operates in the study mode to record the IR signal emitted by a remote controller. The IR signal is sampled at an extremely high frequency to avoid distortion. Because successive logical data bits might have identical values (e.g., 000 or 11111) owing to the high sampling frequency, data compression must be implemented to lower the memory storage capacity.(2)
User mode: a network operates in the user mode to remotely control the IoT home gateway, restoring a selected IR signal and then emitting it to the targeted home appliance. Because the data stored in the memory are compressed, a decompression process must be executed before the IR signal is emitted to the target home appliance.


### 3.2. System Architecture

Theoretically, if the emitted signal is identical to the received signal, then the targeted device can be controlled from our implemented IoT home gateway instead of using the original IR remote controller. However, due to limitations in signal processing speed and memory storage size, problems involving mismatches between the emitted signal and its original source may exist. When a mismatch (i.e., signal distortion) exceeds the system’s tolerance range, the operation can fail. To achieve distortion-free replication, we implemented a system architecture (Figure8) that can subject signals to real-time processing.Figure 8
Implemented system architecture.In the FPGA design, a phase-locked loop (PLL) can be programmed to operate at up to 50 MHz, which can latch the control signals of most devices. Received signals are processed through a hardware and software codesign approach, and generated signals are emitted to the target device to be controlled. The signal processing flow includes several phases—namely, IR receiver, signal sampling, hardware data compression, hardware input buffer, data storage (flash), hardware output buffer, hardware data decompression, signal encoding, and IR emitter—implemented on an FPGA embedded system development board (Figure9) [13]. Compared with the systems designed in [28] or [29] on a PC, our implemented system can be optimized as a small embedded system to reduce manufacturing cost and power consumption allowing for further mass production.Figure 9
FPGA development board (reproduced from Tsai et al. [15] (under the Creative Commons Attribution License/public domain)).


### 3.3. Signal Processing

As depicted in Figure2, the carrier frequency of the NEC protocol is 38 kHz. A high-voltage IR signal pulse has a length of 8.77 μs (denoted as data 1), whereas a low-voltage IR signal pulse has a length of 17.53 μs (denoted as data 0); this is a special duty cycle composition compared with the general factor of 50/50%. Accordingly, to capture changes in the signal’s voltage level, the sampling frequency should be at least double the operating frequency of the source signal. Therefore, to capture the 8.77 μs data 1, a clock cycle less shorter than 8.77 μs ensures that at least one positive or negative clock edge is within 8.77 μs to latch data 1 (i.e., high voltages). Equation (1) presents the minimal sampling frequency (Min.SF) required for sampling the source signal (SRC_SIGN) presented in Figure 10:(1)Min.SF=1MinLoLV, LoHVHz,where LoLV is the length of low voltage and LoVH is the length of high voltage (in seconds). MinLoLV, LoHV represents the minimal value between LoLV and LoVH. For the IR signal of the NEC protocol (Figure 2), LoVL = 8.77 μs and LoVH = 17.53 μs; thus, MinLoLV, LoHV equals 8.77 μs, and Min.SF equals 114 kHz (=1/8.77 μs).Figure 10
IR signal sampling with 200 kHz sampling frequency.In practice, using a low sampling frequency can cause more distortions of captured signals compared with the source signals. As illustrated in Figure10, CAP_SIGN is a captured signal sampled by positive edges of a 200 kHz (≥114 kHz) sample clock (CLK_200K) from the source signal (SRC_SIGN). The lengths of both pulses (i.e., high voltage) of SRC_SIGN are equal to 8.77 μs. However, the length of the first pulse of CAP_SIGN is 5 μs (one cycle of CLK_200K), and the length of the second pulse of CAP_SIGN is 10 μs (two cycles of CLK_200K). Accordingly, equation (2) presents the potential maximal distortion rate (Max.DR) of the captured signal (CAP_SIGN) compared with the source signal (SRC_SIGN):(2)Max.DR=TMax.DFTMin.SF%,where TMax.DF is the cycle time of Min.SF (i.e., TMin.SF=1/Min.SF) and TMax.DF is the cycle time of the maximal distortion frequency, which is presented in the following equation:(3)TMax.DF=Maxn×TApp.SF−TMin.SF,n+1×TApp.SF−TMin.SF,where App.SF is the applied sampling frequency. Thus, TApp.SF is the cycle time for App.SF. In our design, the sample clock for the applied sampling frequency is generated by a PLL module programmed by a microprocessor, as illustrated in Figure 8. The value n is an integer that meets the following condition:(4)n∗TApp.SF≤TMin.SF≤n+1∗TApp.SF.Consider, for example, the formats illustrated in Figure2; TMin.SF is 8.77 μs and App.SF of the applied sample clock (i.e., CLK_200K) is 200 kHz. Thus, TApp.SF equals 5 μs. Accordingly, if n = 1, for equation (4), i.e., 1 ∗ 5 μs ≤ 8.77 μs ≤ (1 + 1) ∗ 5 μs, then T (Max.DF) = 3.77 μs (=Max (3.77 μs, 1.23 μs) = Max (|1 × 5 μs − 8.77 μs|, |(1 + 1) × 5 μs − 8.77 μs|)). Finally, Max.DR = 42.99% (=3.77 μs/8.77 μs), which is excessively above the tolerance of most electronic products. Finally, Figure 10 demonstrates the captured data (CAP_DATA), namely, 7 bit 0010011.To decrease distortion, an alternative 400 kHz (≥114 kHz) sample clock (CLK_400K) can be applied to latch that source signal (SRC_SIGN), as illustrated in Figure11. T(App.SF) = 2.5 μs (=1/400 kHz); thus, n can increase to 3 (from 1) as per equation (3), yielding 3 ∗ 2.5 μs ≤ 8.77 μs ≤ (3 + 1) ∗ 2.5 μs. Accordingly, Max.DR decreases to 14.48% (=1.27 μs/8.77 μs = (8.77 μs – 7.5 μs)/8.77 μs), which is smaller than the 42.99% by CLK_200K. However, a 14.48% distortion is still excessively high for most electronic products to tolerate. Finally, Figure 11 demonstrates the captured data (CAP_DATA) to be 14 bit 00111000011110, the length of which is double that of the 7 bit 0010011 by CLK_400K. Increasing the sampling frequency appears to reduce the distortion rate. However, the bits of captured data increase accordingly, necessitating more storage capacity, and this can be improved in the system we designed, as mentioned in Section 4.Figure 11
IR signal sampling at 400 kHz sampling frequency.


## 3.1. Application Scenario

Figure7 illustrates the application scenario for the proposed gateway system. The system includes a network device such as a smartphone.Figure 7
Application scenario.First, the IoT home gateway can be set to operate in the study mode to record the specified IR signal emitted by pressing an IR remote controller button for a home appliance. The user can then use a smartphone to choose a prerecorded signal. The control message is subsequently transmitted to the IoT home gateway through the wireless network. Finally, the IoT home gateway emits a prerecorded IR signal to control the targeted home appliance. As shown in Figure7, we used an LA provided by ZEROPLUS Technology [17] for signal analyses and error debugging during the development phase. The two operating modes are described in detail:(1)
Study mode: the IoT home gateway operates in the study mode to record the IR signal emitted by a remote controller. The IR signal is sampled at an extremely high frequency to avoid distortion. Because successive logical data bits might have identical values (e.g., 000 or 11111) owing to the high sampling frequency, data compression must be implemented to lower the memory storage capacity.(2)
User mode: a network operates in the user mode to remotely control the IoT home gateway, restoring a selected IR signal and then emitting it to the targeted home appliance. Because the data stored in the memory are compressed, a decompression process must be executed before the IR signal is emitted to the target home appliance.


## 3.2. System Architecture

Theoretically, if the emitted signal is identical to the received signal, then the targeted device can be controlled from our implemented IoT home gateway instead of using the original IR remote controller. However, due to limitations in signal processing speed and memory storage size, problems involving mismatches between the emitted signal and its original source may exist. When a mismatch (i.e., signal distortion) exceeds the system’s tolerance range, the operation can fail. To achieve distortion-free replication, we implemented a system architecture (Figure8) that can subject signals to real-time processing.Figure 8
Implemented system architecture.In the FPGA design, a phase-locked loop (PLL) can be programmed to operate at up to 50 MHz, which can latch the control signals of most devices. Received signals are processed through a hardware and software codesign approach, and generated signals are emitted to the target device to be controlled. The signal processing flow includes several phases—namely, IR receiver, signal sampling, hardware data compression, hardware input buffer, data storage (flash), hardware output buffer, hardware data decompression, signal encoding, and IR emitter—implemented on an FPGA embedded system development board (Figure9) [13]. Compared with the systems designed in [28] or [29] on a PC, our implemented system can be optimized as a small embedded system to reduce manufacturing cost and power consumption allowing for further mass production.Figure 9
FPGA development board (reproduced from Tsai et al. [15] (under the Creative Commons Attribution License/public domain)).


## 3.3. Signal Processing

As depicted in Figure2, the carrier frequency of the NEC protocol is 38 kHz. A high-voltage IR signal pulse has a length of 8.77 μs (denoted as data 1), whereas a low-voltage IR signal pulse has a length of 17.53 μs (denoted as data 0); this is a special duty cycle composition compared with the general factor of 50/50%. Accordingly, to capture changes in the signal’s voltage level, the sampling frequency should be at least double the operating frequency of the source signal. Therefore, to capture the 8.77 μs data 1, a clock cycle less shorter than 8.77 μs ensures that at least one positive or negative clock edge is within 8.77 μs to latch data 1 (i.e., high voltages). Equation (1) presents the minimal sampling frequency (Min.SF) required for sampling the source signal (SRC_SIGN) presented in Figure 10:(1)Min.SF=1MinLoLV, LoHVHz,where LoLV is the length of low voltage and LoVH is the length of high voltage (in seconds). MinLoLV, LoHV represents the minimal value between LoLV and LoVH. For the IR signal of the NEC protocol (Figure 2), LoVL = 8.77 μs and LoVH = 17.53 μs; thus, MinLoLV, LoHV equals 8.77 μs, and Min.SF equals 114 kHz (=1/8.77 μs).Figure 10
IR signal sampling with 200 kHz sampling frequency.In practice, using a low sampling frequency can cause more distortions of captured signals compared with the source signals. As illustrated in Figure10, CAP_SIGN is a captured signal sampled by positive edges of a 200 kHz (≥114 kHz) sample clock (CLK_200K) from the source signal (SRC_SIGN). The lengths of both pulses (i.e., high voltage) of SRC_SIGN are equal to 8.77 μs. However, the length of the first pulse of CAP_SIGN is 5 μs (one cycle of CLK_200K), and the length of the second pulse of CAP_SIGN is 10 μs (two cycles of CLK_200K). Accordingly, equation (2) presents the potential maximal distortion rate (Max.DR) of the captured signal (CAP_SIGN) compared with the source signal (SRC_SIGN):(2)Max.DR=TMax.DFTMin.SF%,where TMax.DF is the cycle time of Min.SF (i.e., TMin.SF=1/Min.SF) and TMax.DF is the cycle time of the maximal distortion frequency, which is presented in the following equation:(3)TMax.DF=Maxn×TApp.SF−TMin.SF,n+1×TApp.SF−TMin.SF,where App.SF is the applied sampling frequency. Thus, TApp.SF is the cycle time for App.SF. In our design, the sample clock for the applied sampling frequency is generated by a PLL module programmed by a microprocessor, as illustrated in Figure 8. The value n is an integer that meets the following condition:(4)n∗TApp.SF≤TMin.SF≤n+1∗TApp.SF.Consider, for example, the formats illustrated in Figure2; TMin.SF is 8.77 μs and App.SF of the applied sample clock (i.e., CLK_200K) is 200 kHz. Thus, TApp.SF equals 5 μs. Accordingly, if n = 1, for equation (4), i.e., 1 ∗ 5 μs ≤ 8.77 μs ≤ (1 + 1) ∗ 5 μs, then T (Max.DF) = 3.77 μs (=Max (3.77 μs, 1.23 μs) = Max (|1 × 5 μs − 8.77 μs|, |(1 + 1) × 5 μs − 8.77 μs|)). Finally, Max.DR = 42.99% (=3.77 μs/8.77 μs), which is excessively above the tolerance of most electronic products. Finally, Figure 10 demonstrates the captured data (CAP_DATA), namely, 7 bit 0010011.To decrease distortion, an alternative 400 kHz (≥114 kHz) sample clock (CLK_400K) can be applied to latch that source signal (SRC_SIGN), as illustrated in Figure11. T(App.SF) = 2.5 μs (=1/400 kHz); thus, n can increase to 3 (from 1) as per equation (3), yielding 3 ∗ 2.5 μs ≤ 8.77 μs ≤ (3 + 1) ∗ 2.5 μs. Accordingly, Max.DR decreases to 14.48% (=1.27 μs/8.77 μs = (8.77 μs – 7.5 μs)/8.77 μs), which is smaller than the 42.99% by CLK_200K. However, a 14.48% distortion is still excessively high for most electronic products to tolerate. Finally, Figure 11 demonstrates the captured data (CAP_DATA) to be 14 bit 00111000011110, the length of which is double that of the 7 bit 0010011 by CLK_400K. Increasing the sampling frequency appears to reduce the distortion rate. However, the bits of captured data increase accordingly, necessitating more storage capacity, and this can be improved in the system we designed, as mentioned in Section 4.Figure 11
IR signal sampling at 400 kHz sampling frequency.


## 4. Data Compression and Decompression

To reduce memory capacity requirements, this section introduces our proposed data compression and decompression mechanism specifically designed for processing IR signals.


### 4.1. Properties of IR Signals

As presented in Figure8, the IR signal sampled by the signal-sampling module is recorded as serial logical data numbers, such as 00000011111111100000011111111100011110001111. Some data 0s or data 1s sequentially and repeatedly appear in the serial logical numbers. When the sampling rate increases, the number of contiguous data 0s or data 1s also increases. The data distribution in the serial logical numbers could change depending on the applied IR protocol. Referring to the system implemented in [30], we developed an IR signal data compression and decompression scheme that can analyze the received IR signal and accordingly change the data recording format. The proposed IR signal data compression and decompression scheme can efficiently reduce the size of data to be stored. Consequently, the flash memory can store more IR signals to provide more alternative functions; alternatively, the system can be equipped with a smaller flash memory to reduce production cost. The proposed IR signal data compression and decompression scheme involves two major processing steps, which are introduced in detail in the following sections.


### 4.2. Data Compression Rate

To evaluate the performance of the proposed scheme, we defined a data compression rate and a space-saving rate as follows:(5)DCr=SDuCDu,where DCr is the data compression rate, SDu is the number of source data units, and CDu is the number of compressed data units.(6)SSr=1−1DCr×100%,where SSr is the space-saving rate, which represents the efficiency of data compression for reducing the use of memory capacity.


### 4.3. Level 1 Data Compression

Level 1 data compression (L1DC) is essentially a hardware-based logic design that can calculate the numbers of sequential data 0s and the number of sequential data 1s online and in real time. For example, suppose the source data pattern is as follows:(i)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (source data pattern)After L1DC processing, the compressed data pattern is as follows:(i)
[21, 8, 7, 7, 21, 7, 8, 7, 21, 7, 21, 7, 7, 8, 6, 7, 21] (L1DC data pattern)Therefore, the numbers of data units of these two data patterns are 191 and 17, respectively. Each data unit can be recorded by 8 bits (1 byte is the minimal addressable data unit in most computers). Thus, storage memory can be reduced from 191 bytes to 17 bytes to achieve a DCr of 11.24, as shown in equation (5), and an SSr of 91.10%, as shown in equation (6).


### 4.4. Level 2 Data Compression

Our system applies an LA to latch the NEC IR signal, as shown in Figure4(a). The IR signal is recorded in the LA memory to be analyzed that 7 numbers of continuous data 0 or data 1 frequently appear in the logged data pattern using such a sampling rate. Because the IR signal is an asynchronous and 1 bit serial interface, in practice, more 1 bit signal sampling (7 + 1 = 8) or less 1 bit sampling (7 – 1 = 6) is possible.(i)
[21,8, 7, 7, 21, 7, 8, 7, 21, 7, 21, 7, 7, 8, 6, 7, 21] (L1DC data pattern)Accordingly, it is feasible to capitalize on the error tolerance margin caused by more sampling (data 8) or less sampling (data 6) and then to replace both data 8 and data 6 with data 7:(i)
[21,7, 7, 7, 21, 7, 7, 7, 21, 7, 21, 7, 7, 7, 7, 7, 21] (middle processing data pattern)Here, some data 6 and data 8 are replaced by data 7 in the proposed level 2 data compression (L2DC) scheme. Next, L2DC counts the number of sequential data 7s and replaces the recording format with a pair of L2DC compression flags (0), followed by several sequential data 7s:(i)
[21,0, 3, 21, 0, 3, 21, 7, 21, 0, 5, 21] (L2DC data pattern)We observe that the numbers of data units for these two data patterns are 17 and 12, respectively. Thus, the storage memory can decrease from 17 to 12 bytes to achieve a DCr of 1.42, as presented in equation (5), and an SSr of 29.41%, as presented in equation (6). Figure 12 depicts the operating flow of L2DC, in which a counter calculates the sequential numbers of data 7s. The counter increases by one (+1) when the input data continues to be data 7; otherwise, an L2DC compression flag (0) followed by the counter number is output. Moreover, other data or a single data 7 is output directly. In Figure 12, to explain the operating flow of L2DC, we consider data 7 as an example. In practice, L2DC is processed by the microprocessor in the architecture illustrated in Figure 8; thus, it is a software-based and offline data compression mechanism. In our implementation, L2DC first fetches the data pattern from the SDRAM (Figure 9) generated by L1DC (hardware-based data compression mechanism); subsequently, it scans the L1DC data pattern to determine which data number appears most. After processing (Figure 12), a smaller size of L2DC data pattern will store in the flash memory (Figure 9).Figure 12
Example of operating flow of changing L1DC data pattern to L2DC data pattern.


### 4.5. Level 2 and Level 1 Data Decompression Schemes

As shown in Figure13, input IR source data are compressed using L1DC or L2DC and then stored in the flash memory. Next, one of the stored data items is fetched by commands transmitted remotely through a network and then processed using level 2 data decompression (L2DD) or level 1 data decompression (L1DD). Finally, an IR signal is emitted by recovering the compressed data stored in the flash memory. The operating flow of L2DD is just the reverse of the operating flow of L2DC. The operating flow of L1DD is the same as that of L1DC. Therefore, we briefly introduce only the L2DD and L1DD operating flows, as presented in Figure 13.Figure 13
Operating flow of data compression and decompression.


### 4.6. Lossless and Lossy Data Compression and Decompression Schemes

To further increase the data compression rate, our system includes software-based lossy L2DC/L2DD data compression and decompression schemes. Alternatively, users can disable L2DC (L2DD is disabled dependently) and simply compress data with hardware-based L1DC/L1DD, which can achieve lossless compression without computational overhead for the system microprocessor. In particular, both the lossy and lossless compression schemes implemented in our system can successfully control home appliances, as observed in experiments and demonstrations that are discussed in the following sections.


## 4.1. Properties of IR Signals

As presented in Figure8, the IR signal sampled by the signal-sampling module is recorded as serial logical data numbers, such as 00000011111111100000011111111100011110001111. Some data 0s or data 1s sequentially and repeatedly appear in the serial logical numbers. When the sampling rate increases, the number of contiguous data 0s or data 1s also increases. The data distribution in the serial logical numbers could change depending on the applied IR protocol. Referring to the system implemented in [30], we developed an IR signal data compression and decompression scheme that can analyze the received IR signal and accordingly change the data recording format. The proposed IR signal data compression and decompression scheme can efficiently reduce the size of data to be stored. Consequently, the flash memory can store more IR signals to provide more alternative functions; alternatively, the system can be equipped with a smaller flash memory to reduce production cost. The proposed IR signal data compression and decompression scheme involves two major processing steps, which are introduced in detail in the following sections.


## 4.2. Data Compression Rate

To evaluate the performance of the proposed scheme, we defined a data compression rate and a space-saving rate as follows:(5)DCr=SDuCDu,where DCr is the data compression rate, SDu is the number of source data units, and CDu is the number of compressed data units.(6)SSr=1−1DCr×100%,where SSr is the space-saving rate, which represents the efficiency of data compression for reducing the use of memory capacity.


## 4.3. Level 1 Data Compression

Level 1 data compression (L1DC) is essentially a hardware-based logic design that can calculate the numbers of sequential data 0s and the number of sequential data 1s online and in real time. For example, suppose the source data pattern is as follows:(i)
[0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 1, 1, 1, 1, 1, 1, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] (source data pattern)After L1DC processing, the compressed data pattern is as follows:(i)
[21, 8, 7, 7, 21, 7, 8, 7, 21, 7, 21, 7, 7, 8, 6, 7, 21] (L1DC data pattern)Therefore, the numbers of data units of these two data patterns are 191 and 17, respectively. Each data unit can be recorded by 8 bits (1 byte is the minimal addressable data unit in most computers). Thus, storage memory can be reduced from 191 bytes to 17 bytes to achieve a DCr of 11.24, as shown in equation (5), and an SSr of 91.10%, as shown in equation (6).


## 4.4. Level 2 Data Compression

Our system applies an LA to latch the NEC IR signal, as shown in Figure4(a). The IR signal is recorded in the LA memory to be analyzed that 7 numbers of continuous data 0 or data 1 frequently appear in the logged data pattern using such a sampling rate. Because the IR signal is an asynchronous and 1 bit serial interface, in practice, more 1 bit signal sampling (7 + 1 = 8) or less 1 bit sampling (7 – 1 = 6) is possible.(i)
[21,8, 7, 7, 21, 7, 8, 7, 21, 7, 21, 7, 7, 8, 6, 7, 21] (L1DC data pattern)Accordingly, it is feasible to capitalize on the error tolerance margin caused by more sampling (data 8) or less sampling (data 6) and then to replace both data 8 and data 6 with data 7:(i)
[21,7, 7, 7, 21, 7, 7, 7, 21, 7, 21, 7, 7, 7, 7, 7, 21] (middle processing data pattern)Here, some data 6 and data 8 are replaced by data 7 in the proposed level 2 data compression (L2DC) scheme. Next, L2DC counts the number of sequential data 7s and replaces the recording format with a pair of L2DC compression flags (0), followed by several sequential data 7s:(i)
[21,0, 3, 21, 0, 3, 21, 7, 21, 0, 5, 21] (L2DC data pattern)We observe that the numbers of data units for these two data patterns are 17 and 12, respectively. Thus, the storage memory can decrease from 17 to 12 bytes to achieve a DCr of 1.42, as presented in equation (5), and an SSr of 29.41%, as presented in equation (6). Figure 12 depicts the operating flow of L2DC, in which a counter calculates the sequential numbers of data 7s. The counter increases by one (+1) when the input data continues to be data 7; otherwise, an L2DC compression flag (0) followed by the counter number is output. Moreover, other data or a single data 7 is output directly. In Figure 12, to explain the operating flow of L2DC, we consider data 7 as an example. In practice, L2DC is processed by the microprocessor in the architecture illustrated in Figure 8; thus, it is a software-based and offline data compression mechanism. In our implementation, L2DC first fetches the data pattern from the SDRAM (Figure 9) generated by L1DC (hardware-based data compression mechanism); subsequently, it scans the L1DC data pattern to determine which data number appears most. After processing (Figure 12), a smaller size of L2DC data pattern will store in the flash memory (Figure 9).Figure 12
Example of operating flow of changing L1DC data pattern to L2DC data pattern.


## 4.5. Level 2 and Level 1 Data Decompression Schemes

As shown in Figure13, input IR source data are compressed using L1DC or L2DC and then stored in the flash memory. Next, one of the stored data items is fetched by commands transmitted remotely through a network and then processed using level 2 data decompression (L2DD) or level 1 data decompression (L1DD). Finally, an IR signal is emitted by recovering the compressed data stored in the flash memory. The operating flow of L2DD is just the reverse of the operating flow of L2DC. The operating flow of L1DD is the same as that of L1DC. Therefore, we briefly introduce only the L2DD and L1DD operating flows, as presented in Figure 13.Figure 13
Operating flow of data compression and decompression.


## 4.6. Lossless and Lossy Data Compression and Decompression Schemes

To further increase the data compression rate, our system includes software-based lossy L2DC/L2DD data compression and decompression schemes. Alternatively, users can disable L2DC (L2DD is disabled dependently) and simply compress data with hardware-based L1DC/L1DD, which can achieve lossless compression without computational overhead for the system microprocessor. In particular, both the lossy and lossless compression schemes implemented in our system can successfully control home appliances, as observed in experiments and demonstrations that are discussed in the following sections.


## 5. Experimental Results

In this section, we focus on IR signal processing in accordance with the NEC protocol, which is commonly used for home appliance control and was applied in [11]. We recorded the signals emitted by the IR remote controller for the applied Terasic evaluation board [20]. IR signal data supporting the findings of this study are included in supplementary information files (named “IR_signal_data.zip” [31] and “IR_signal_analyses.pdf” [32]). We tested the play, mute, and channel change buttons. IR signals were captured by our implemented home gateway and simultaneously forwarded then to LA (Figure 7). Performance analyses are discussed in the following subsections.


### 5.1. IR Signal ofPlay Button

As illustrated in Figure14(a), the signal carrier of 38 kHz was decoded and converted to logical data format of NEC protocol (Figures 2 and 3). Subsequently, IR signal source data were sampled at 12 kHz and recorded by the LA (channel A0). The initial portion of the signal had a length of approximately 9 ms at a low voltage (marked as red), followed by a length of approximately 4.5 ms at a high voltage, indicating the leader code (i.e., Header) of the NEC IR protocol. At the end of the signal, the stop bit (30.94 to 48.94 ms of low voltage) of the NEC protocol (Figure 1) is not presented herein to reduce the waveform length in order to enable readers to more clearly identify the major characteristics of the signal.Figure 14
IR signals of (a) source data and (b) recovered data associated with play button.
(a)
(b)In our experiment, the source data length was 881 bytes, L1DC compressed data length was 68 bytes, and L2DC compressed data length was 43 bytes. Consequently, our proposed data compression scheme achieved a DCr of 20.49 and an SSr of 95.12%. As seen in Figure14(b) (for channel A1), the recovered data strongly resembled the source data and the proposed system was thus effective in controlling the targeted IR controllable device.


### 5.2. IR Signal ofMute Button

As shown in Figure15(a) (channel A0), in our experiment, the source data length was 915 bytes, L1DC compressed data length was 68 bytes, and L2DC compressed data length was 42 bytes. Consequently, the DCr increased to 21.79 and the SSr was enhanced to 95.41%. As shown in Figure 15(b) (channel A1), the recovered IR signal also was effective.Figure 15
IR signals of (a) source data and (b) recovered data associated with mute button.
(a)
(b)


### 5.3. IR Signal of Channel Change Button

As presented in Figure16(a) (channel A0), in our experiment, the source data length was 938 bytes, L1DC compressed data length was 68 bytes, and L2DC compressed data length was 43 bytes. Consequently, the DCr was approximately 21.81 and the SSr was enhanced to 95.42%. As shown in Figure 16(b) (channel A1), the recovered IR signal works functionally.Figure 16
IR signals of (a) source data and (b) recovered data associated with channel change button.
(a)
(b)Overall, Figure17 summarizes the performance of our proposed data compression and decompression schemes, in terms of DCr and SSr, in processing signals from play, mute, and channel change buttons on the IR remote controller. Furthermore, the sampling frequency could be increased to reduce its signal distortion rate, and both DCr and SSr could increase accordingly.Figure 17
Performance comparisons in terms of (a) DCr and (b) SSr forplay, mute, and channel change buttons, respectively.
(a)
(b)


## 5.1. IR Signal ofPlay Button

As illustrated in Figure14(a), the signal carrier of 38 kHz was decoded and converted to logical data format of NEC protocol (Figures 2 and 3). Subsequently, IR signal source data were sampled at 12 kHz and recorded by the LA (channel A0). The initial portion of the signal had a length of approximately 9 ms at a low voltage (marked as red), followed by a length of approximately 4.5 ms at a high voltage, indicating the leader code (i.e., Header) of the NEC IR protocol. At the end of the signal, the stop bit (30.94 to 48.94 ms of low voltage) of the NEC protocol (Figure 1) is not presented herein to reduce the waveform length in order to enable readers to more clearly identify the major characteristics of the signal.Figure 14
IR signals of (a) source data and (b) recovered data associated with play button.
(a)
(b)In our experiment, the source data length was 881 bytes, L1DC compressed data length was 68 bytes, and L2DC compressed data length was 43 bytes. Consequently, our proposed data compression scheme achieved a DCr of 20.49 and an SSr of 95.12%. As seen in Figure14(b) (for channel A1), the recovered data strongly resembled the source data and the proposed system was thus effective in controlling the targeted IR controllable device.


## 5.2. IR Signal ofMute Button

As shown in Figure15(a) (channel A0), in our experiment, the source data length was 915 bytes, L1DC compressed data length was 68 bytes, and L2DC compressed data length was 42 bytes. Consequently, the DCr increased to 21.79 and the SSr was enhanced to 95.41%. As shown in Figure 15(b) (channel A1), the recovered IR signal also was effective.Figure 15
IR signals of (a) source data and (b) recovered data associated with mute button.
(a)
(b)


## 5.3. IR Signal of Channel Change Button

As presented in Figure16(a) (channel A0), in our experiment, the source data length was 938 bytes, L1DC compressed data length was 68 bytes, and L2DC compressed data length was 43 bytes. Consequently, the DCr was approximately 21.81 and the SSr was enhanced to 95.42%. As shown in Figure 16(b) (channel A1), the recovered IR signal works functionally.Figure 16
IR signals of (a) source data and (b) recovered data associated with channel change button.
(a)
(b)Overall, Figure17 summarizes the performance of our proposed data compression and decompression schemes, in terms of DCr and SSr, in processing signals from play, mute, and channel change buttons on the IR remote controller. Furthermore, the sampling frequency could be increased to reduce its signal distortion rate, and both DCr and SSr could increase accordingly.Figure 17
Performance comparisons in terms of (a) DCr and (b) SSr forplay, mute, and channel change buttons, respectively.
(a)
(b)


## 6. Application Demonstrations

To validate the practicability of our proposed IoT home gateway that can enable machine-type communication control for conventional IR controllable equipment (and other types of equipment), we applied it to control several home appliances. We determined that the home appliances could be successfully controlled by our interface through cellular networks. Figure18 depicts the home appliances tested, including a liquid crystal display (LCD) projector, a DVD player, a ceiling fan, a music box, a window-type air conditioner, and a split-type air conditioner. Several video links [33–36] are provided to demonstrate the operations and practicability of our implemented IoT home gateway.Figure 18
Application demonstrations of (a) LCD projector, (b) DVD player, (c) ceiling fan, (d) music box, (e) window-type air conditioner, and (f) split-type air conditioner (Figure18 is reproduced from Tsai et al. [15] (under the Creative Commons Attribution License/public domain)).
(a)
(b)
(c)
(d)
(e)
(f)


## 7. Conclusion

The main innovations and contributions of this study are outlined as follows:(1)
To solve problems of duplicating IR signals exiting IoT gateways, the contribution is to implement a hardware-accelerated serial interface to an IoT gateway (to replace the conventional software-based GPIO interface)(2)
To minimize distortion of the recorded signals, the source IR signal input to the IoT home gateway is sampled by the hardware-accelerated serial interface at an extremely high sampling frequency(3)
Accordingly, the innovation of this study is that a level 1 hardware-based data compression mechanism was implemented to losslessly reduce size of oversampled data in real time to save flash memory space(4)
Moreover, a level 2 software-based compression mechanism was implemented to additionally reduce the size of data compressed by the level 1 compression methodWe determined that at least six home appliances could be remotely controlled through networks by using our IoT home gateway. Thus, the proposed gateway bridges the use of IR signals and network access to enable machine-type communications and thus constitutes a promising control style that can be leveraged in existing home appliances or in future smart-home systems. Experiments demonstrated that the proposed gateway can achieve signal duplication with almost no distortion and the required memory capacity for storing data is smaller than that for existing designs.



---

*Source: 1506237-2019-04-03.xml*