# Research on Secure Debugging Interaction of Sensor Nodes Based on Visible Light Communication
## 4 System Downlink: Transmission Efficiency Improvement
### Channel Coding: Overlap DH-PIM  
With respect to the channel coding, the minimum width of light slot pulse is limited by sensing latency, and the transmission time is extended. For this, we attempt to reduce the number of slots representing one DH-PIM symbol. By experiment, we found that ambient light sensor cannot measure a short-duration light pulse and output a lower value than actual value due to the sensing latency. We leverage this find to mark a new flashlight half-on state from the On/Off state. Further, we propose the overlap DH-PIM (ODH-PIM) by introducing a flashlight half-on state. DH-PIM is an isochronous pulse time modulation in which data is encoded as discrete slots between adjacent pulses. A symbol that encodes \(M\) bits of data is represented by k low power slots and followed by one constant power slot, where \(0\leq\) k \(\leq\) (L/2) \(-\) 1 and L = 2M. For example, the number \"0100\" has four low power slots and one constant power slot. The binary data \"1011\" is a radix-minus-one complement of 0100 which has four slots of low power and two slots pulse of constant power. If M = 4, a symbol of the DH-PIM contains four bits of data, but the ODH-PIM can compress 8 bits of data into one symbol because two data can overlap. As shown in Figure 4, the data \"1011\" was overlapped with the data \"0101\", and they share the front four low power slots. Because different data have different slots, when two data are overlapped together for modulation, the flashlight half-on state plays the role to differentiate them. As shown in Figure 4, after representing the contents of two data, a slot is introduced as an order flag. If the order flag is a constant power slot, the data with less slot precedes the other one. If the order flag is a slot of flashlight half-on state, it indicates that the order of the two data needs to be changed. Then, there are four cases of the reverse flag to determine which data needs to calculate complement.  
\begin{table}
\begin{tabular}{c c c} \hline \hline
**Pattern** & **Value** & **Segment Size and Number of Groups** \\ \hline Pattern 1 & 00 & -’ - \\ Pattern 2 & 01 & 4 bit, 1 group \\ Pattern 3 & 10 & 8 bits, 2 groups \\ Pattern 4 & 11 & 8 bits, 2 groups \\ \hline \hline \end{tabular}
\end{table}
Table 1: Four different patterns.  
Figure 3: Pattern 2–4 diagram and compression example.  
Figure 2: Operand sequence compression coding format.  
At the beginning of downlink transmission, a start signal is sent to the sensor node from the smartphone by flashlight, and it is also used to synchronize two devices. During code transmission period, the node as a receiver guarantees the integrity of the frame by countering non-low power slots (flashlight on and half-on state), because the integrated frame has the same slots (five slots for ODH-PIM). Once the node detects a wrong number of non-low power slots in a received frame, it will turn on local LED to tell the smartphone that a frame error happened and requires it to retransmit the frame. During downlink transmission, the smartphone also activates the camera to receive the frame error message and then retransmit the corresponding frame.