MAC Layer Design for Network-Enabled Visible Light Communication Systems Compliant with IEEE 802.15.7

The design and implementation of medium access control (MAC) layer for network-enabled visible light communication (VLC) system is presented in this paper. The point-to-point link was chosen because of its simple in configuration as well as implementation. Whereas the FPGA Zybo Zynq-7000 is employed for prototyping the hardware of VLC system because of it serve a Linux operating system (OS), i.e. Xillinux. Our MAC layer has been realized in Python programming and running above the Zynq-7000 processor. The designed MAC Layer is adapted from IEEE 802.15.7 standard, specifically for delivering and receiving the MAC frames from the coordinator to the device or vice versa, wrapping the IP packets and unwrapping the MAC Frames with MAC headers and trailers, and performing the error detection in which the cyclic redundant check 16 (CRC-16) was selected. According to the functionality test, our proposed VLC system can perform to send the multimedia contents (video and image) as well as data packet for internet accessing purpose like a wireless fidelity (Wi-Fi) connectivity. Thus, it can be concluded that the implemented MAC layer has met the functionality specifications referred to the IEEE 802.15.7 standard. We also provide the Pseudo-code of designed MAC layer and its Python script (source-code) implementation that can be found in the Appendix section.


Introduction
Recently, the visible light communication (VLC) is being developed to be proposed as an alternative to wireless communications.The VLC can substitute the role of longrange radio frequency (RF) because it can't reach a veryclosed area [1].Moreover, the VLC is harmless for human skin health, when the other optical wireless communication technologies: Infra-Red (IR) and Ultra-Violet (UV) have the higher health risks.Since the lighting infrastructure of residential homes has already available, thus the VLC is easier and cheaper in terms of the implementation factor compared to the RF that require a specific base station [2].
The presentation on VLC that best known and impressive to the worldwide public was introduced by Prof. Harald Haas (founder of pure-LiFi) in 2011 entitled "Wireless data from every bulb," at the TEDx forums [3].In the last presentation, Prof. Haas demonstrates the high-quality video broadcast via light emitting diode (LED) bulb in which the distance between the transmitter and receiver at the close range (several centimeters).Nevertheless, it has proven that this technological breakthrough can be a viable alternative communication for the future.In other hand, this potential VLC offers will be very interesting if not only used for broadcast, but also can exchange the network packet wirelessly.Thus, the users can be linking their devices to the internet like a wireless-fidelity (Wi-Fi) connectivity via lighting infrastructure.This current technology called as light fidelity (Li-Fi) [4].
The Li-Fi system is a concatenation of the certain hardware and software components that work together to perform network-enabled functions with the visible light medium that contains physical (PHY) layer and medium access control (MAC) layer in which the PHY/MAC protocol has been released by the IEEE standard, namely 802.15.7 [5].The MAC layer serves to set the communication flow of the developed system, thus it will possible to set the data exchanging with various schemes such as depicted in Figure 1.There are three link topologies referred to IEEE 802.15.7, i.e. 1) peer-to-peer (P2P), this topology contains two devices, one as a coordinator and the other device as a client in which both of them communicate in two ways (bidirectional): downlink, from the coordinator to the client, and uplink acts a vice-versa.The implementation of P2P can be done by halfduplex mode: downlink and uplink are worked alternately (similar to the mechanism of handheld transceiver radio/HT) as well as full-duplex mode (similar to the modern phone mechanism, including a smartphone).
Next is a star topology that similar to P2P topology, but used more than one clients in the optical network.In this topology, the coordinator can communicate with all clients and functioned as the central controller in an optical network communication [6].
The third topology is the broadcast that has similarity to the star topology but a one-way link only: from the coordinator to many clients (unidirectional).In this topology, each client in the optical network is received the transmitted data.This topology can be chosen if the VLC system intends for a broadcasting scheme, such as promotion media that applied in the modern market, data showers application in the conference halls area, etc.In this paper, we present the MAC layer design for network-enabled indoor VLC implementation to give facility on data exchange the "transmission control protocol-internet protocol" (TCP/IP) packets.In this work, we used P2P topology as illustrated in Figure 2. The P2P consists of two nodes yang that can communicate/data exchange among others data in which if one of the nodes connected to the internet (as an example), then another node will be able to access the internet also through a network link.The P2P topology was chosen with the reason of simple mechanism and easy realization because of it has only one device and one coordinator.While the MAC layer with star topology is too hard in design and also its implementation, even to this time, there are many challenges to develop it.It occurs because each client in the optical network is communicating in the bidirectional mode as well as all of them have activated at the same time [8].We designed the overall VLC system based on Field-Processor-Gate-Arrays (FPGA) instead of general microcontroller usability to ensure that the wireless network connection is relatively high-speed.For prototyping purpose, the Zybo Zynq-7000 development board was chosen because of its complete offered features that include the various peripherals like Ethernet, universal serial bus (USB), general purpose input/output (GPIO), video graphics array (VGA), and universal asynchronous receiver-transmitter (UART).Furthermore, the Zybo Zynq-7000 supports a Linux operating system (OS) where one of them is Xillinux.In this work, the MAC layer has been realized in Python script that written by Xillinux.In another word, the MAC layer software is proceed on ARM-based processor-as software system-on-chip (S/W SoC), thus we don't need a complicated hardware system-onchip (H/W SoC) implementation in FPGA and the system test, like modelSIM simulation is not required also.
The study on MAC layer (as currently defined by IEEE 802.15.7) in specifically for real-world VLC applications is one of the attractive things that concerned to date.The MAC layer handles all access to the PHY layer and liable for several principal tasks in VLC system include mobility and security supports, flicker mitigation supports, association and disassociation of client device supports, etc.The main difference between this works to among mentioned papers is contents substance, especially in area focus.We designed the MAC layer only to perform the following task 1) delivery and receiving of MAC frames from the host to the client or vice versa; 2) undertake the process of IP packet wrapping and unwrapping the MAC frame with MAC header and trailer referred to the IEEE 802.15.7 standard; 3) exercise the error checker.Whereas the method for evaluating its system performance, we only used the functional test data whether the designed MAC layer can execute well the assigned tasks or not.It means without more comprehensive measurements like throughput, delay, power consumption, etc.The study that nearly corresponding with this work has been presented by V. Mariappan et al, they designed the PHY/MAC on Arduino microcontroller to enable internet infrastructure connectivity utilizing VLC [17].However, it is lack of the discussion of achieved data from the performance test.
This paper is organized as follows: In Section 2, we discuss the previous work to deliver the readers in understanding the whole VLC system and provide an illustration for the next section, then introduce the designed MAC protocol referred from IEEE 802.15.7 and describe how it performs.Section 3 is devoted the MAC functionality test and presents the VLC demonstration.Finally, Section 4 concludes our work.

Overview of Proposed System
Figure 3 conceives the typical application of our VLC platform referred to Figure 2 that dedicated for personal area network in indoor environment.The aim of the proposed system is to provide a free-access to the users in data sharing, thus they can distribute everything related to the multimedia contents like video, image, audio, and texts.Further, the internet browsing (both for downlink and uplink purpose) can be performed.Our VLC system is composed of three main parts: i) coordinator (host), ii) client (user), and visible light channel.In this work, the coordinator is not bypassed directly to the router but being employed the personal computer (PC) that attached to the internet.Therefore, it has a role as internet-connected host PC.

Figure 3. The primary application of proposed VLC system for a short-range personal area network
In order to appropriate with the working principle of the proposed system as shown in Figure 3, we develop the entirety system that divided into two sections, just like depicted in Figure 4, that is 1) digital section consists of MAC layer that accommodates the communication path setting, the packaging of sent data, and un-packaging of received data.Then the digital block performed to convert the bit streams into analog signals or vice-versa.2) Analog section functioned as an analog signal processing consists of switch LED driver [18], trans-impedance amplifier (TIA) [19], pre-amplifier (pre-Amp), Op-Amp comparator, and a transistor switch.The main topic to be completed in this paper is MAC layer design, it is pointed-out in blue-colored block.In this work, the PHY layer development is not focused to comply the IEEE 802.15.7 standard, thus a UART peripheral was chosen with the reason of its simple implementation and no synchronization required [20].To generate the UART communication, we used the Vivado 201.1.For connecting the PC to our system (via Zybo board), we used the Ethernet wire.There is no need to manually configure because the Ethernet connection has been already activated in Zybo.In this work, the on-off keying (OOK) was employed as the modulation.

MAC Layer Design
In line with the brief explanation in Section 1 about the targeted functionalities, following are the designed MAC layer in the data frame form, which consists of three components, i.e. i) MHR or MAC header that consist of frame control, sequence number, address information, and security related information; ii) MSDU or MAC service data unit that consist of frame payload; the end component is iii) MFR or MAC footer that consist of frame check sequence (FCS).The structure of designed MAC frame referred to the IEEE 802.15.7 standard [5].Figure 6 shows the structure of implemented MAC framework in which each field comprises the several components, namely frame control field, sequence number, destination VLC personal area network (VPAN) identifier field, destination address field, source VPAN identifier field, source address field, auxiliary security header field, frame payload field, and FCS field.The frame control field has a length of two octets and comprises one of the frame type information as well as the addressing field.Below the rule of MAC frame setting that carried-out in this work.
(i) Frame version: set to 0b00 (ii) Reserved: set to 0b00000 (iii) Frame type: selected to 0b01 because only MAC frame data type is required (iv) Security enabled: designed MAC layer without protection, set to 0b0.(v) Frame pending: set to 0b0 (vi) ACK request: set to 0b0 (vii) Destination and Source address: designed MAC layer with source address and destination address containing 16-bit short address to prepare system if multiple user developments is being held.Thus, set to 0b01.
The sequence number field has a length of 1 octet and specify the sequence number data.In this work, we used only for 1 client (user) then the sequence number is set to 0b0.
The destination VPAN field has a length of 2 octets and set with a unique value, that is 0xFF00, to be sent to the intended recipient frame.This field is only used if the destination addressing mode is set to 0b10 and 0b11.While the destination address field is set with a unique value of 0x0101.
The source VPAN identifier field has a length of 2 octet and specifies the unique VPAN identifier of the sender frame, in this work is set to 0x00FF.This field is only used if the source addressing mode is not set to "0".The source address field has a length of 2 octets or 8 octets and specifies the value of the source addressing mode subfield on frame control field.This field is only used if the source addressing mode subfield is set with 0b10 or 0b11.In this work, we set with a unique value that is 0x1010.
The auxiliary security header field is used to specify the information required for security and also the security enabled to "1".In this work, we don't used this setting, so this auxiliary security header field is set to 0b01.Whereas the frame payload field has a variable length and holds data information from the open systems interconnection (OSI) layer which is over of the MAC layer.The last field is FCS field that has a 2 octets of length and comprises error checker that is used for error detection of the MAC frame.

Cyclic Redundant Check (CRC)
The CRC-16 chosen to detect the erroneous packets from the MAC layer protocols.The CRC code uses 16 redundant bits [21] and has a length 2 octets, it can be solved by using standard polynomials generator as expressed in Equation 1.

MAC Flowcharts
In this subsection, we describe the flowchart of designed MAC layer.According to the declared tasks that stated in Introduction chapter, the MAC layer is divided into three systems only.The wrapping process is to combine data sent with MHR and MFR, while the unwrapping process does the opposite process.The detecting an error using CRC-16 is done using the library that has been provided in Xillinux.Figure 7 is a flowchart of sending data from the host to the client.The data delivery starts from the socket declaration.Afterwards, the data (IP packet data) is obtained and then sent to the serial port.The process is repeated with the while loop true.Whereas Figure 8 is a flowchart of receiving data from the client to the host.The reception begins with the creation of a serial port handler then receives the data (MAC frame data) and finally sent to the socket.The process is repeated with the while loop true.The unwrapping process has been clearly done after the MAC frame is received.As illustrated in Figure 10, in this process, the headers and footers within the MAC frame are removed and the CRC is recalculated.If the CRC result before the calculation is not the same as the after it is sent, it detects an error occur.Otherwise, it is not detected as an error.

MAC Layer Implementation
In summary of the subsection 2.3, the system is built from the main function.The IP packet is retrieved from the socket then wrapped it into the MAC frame.Afterwards, it is sent through the serials port.Upon reaching the destination target (both for the host or the client), the unwrapping proses of the MAC frame is done.Thus, it becomes an IP packet.The error detection also being done simultaneously.The next process, the IP packet inserted to the upper layer via socket.
Table 1 is the "program name" in Python script of following parts: i) the main function (Packet_transfer_pure.py),ii) specific process of wrapping the IP packets (MACWrap) and iii) unwrapping the MAC frame (MACUnwrap).We utilized the available library in Xillinux to realize iv) the CRC-16 calculation for error checker and written in python script.It has been done by following setting: setup.pythen replaced by CRC16.py.
Then to run the implemented scripts in Xillinux, we must call it by the command prompt or cmd.exe.
Below the MAC source code implementation in the form of Pseudo-code.Whereas the realized Python language can be shown in Appendix.

Functional Tests
In order to meet the qualifies of VLC demonstration, in this work, the IP address and MAC setting are an arbitrary as long as its consistent usage across in all components (as illustrated in Figure 2).Whereas the domain name servers used the Google's public, namely 8.8.8.8 in which it offers certain performance advantages [22].
The first step that should be carried-out is prepare the OS, including: booting up, running the Python script, and loading the standard GUI interface as visualized in Figure 11.

Figure 11. Xillinux display on the PC monitor
In order to verify the designed MAC layer, we integrate the whole system of VLC (Figure 5).We used three PCs: 1) to display the received data packets (PC Client-1), 2) to see the display of sent data packets (PC Host), 3) to view the received files (PC Client-2) that appear from the photograph.The VGA cable and LAN wire from the PC Client-2 are connected to the VGA-and Ethernet-port of Zybo board receiver respectively, while the PC Host does the same step but linked to the Zybo board transmitter.The phosphorus white LED is installed in the desk-lamp and the Zybo as well as the analog circuits are packed in the specific box then faced directly to the LED (line-of-sight optical channel).In this experiment, we don't incorporate the IR for uplink.Thus, we connect the client to the host directly without optics (by wire).the examination for the designed MAC layer is only cover three tasks: delivery and reception of MAC frame, wrapping the IP packet and unwrapping the MAC frame, and error detection utilizes CRC-16.The test case is to check-out whether the MAC layer can perform well as expected or not.
In this work, the testing is done by "ping" at the client side in which it is addressed to 192.168.137.20,precisely as depicted in the network setting (pointed-out in Figure 2).The "ping" cab is entirely done as visualized in Figure 13.

Figure 13. The command prompt in pinging IP address
From the test results as visualized in Figure 14 and Figure 15, it can be shown that the designed MAC layer is successfully capable of delivery MAC packets from the PC Host to the PC Client and vice versa evidenced by the words of the request process "receiving packet 74 bytes" later "sending serial…" "receiving serial 74 bytes" later "consuming packet…" sequentially.The number 74 of bytes indicate the packet size in which the value is random.The next test is wrapping and unwrapping mechanism that also performed by "Ping".Figure 16 and Figure 17 depict that the process is already successful.The 103 bytes also indicates the packet size in which its value depends on received packet.It can be shown from Figure 17(a), there is a frame with data packet which contain the packet contents (random characters = abcdefghijk … fghif), the header 00100022FF0000FF010110100 and the footer F092.On the next line, the IP packet successfully unwrapped evidenced by the absence of the header as well as the footer as marked in a red-line as shown in Figure 17(b).The process is done at many times.The last examination is the CRC-16 acts as error checker in which there are two conditions of testing: when there is error and no error occur.The method is to print the IP packets and MAC packets at the command prompt.Thus, it can be shown whether the CRC-16 is running correctly.Figure 18(a) visualizes the results when there is an error in delivering or receiving MAC Frame, the order of "packet valid" statements is initial and ending while the statement "packet invalid" is located in the center of the screenshot.Figure 18(b) visualizes the results viewed from the command prompt, there is a reply at the beginning and ending in which the request time-out is located at the center.For two evidences, it can be concluded that the error detection works well when there is an error.In this case, two packets is not received from four sent packets (50% loss).

Figure 19. A photograph of command prompt when
there is not error occur Figure 19 visualizes the obtained results, if there is no error occurs during the process (all statements issued by "packet valid"), the "ping" will manage to get a reply from the four requests.It can be concluded that the error detection using CRC-16 also works well when there is no error.In this case, all of four packets is received from four sent packets (0% loss).

Conclusion
In this paper, the designed MAC layer for networkenabled VLC has been successfully tested and met the functionality specifications referring the IEEE 802.15.7 standard such as support the generate network between the transmitter to the receiver (delivery-reception as well as wrapping-unwarpping the IP/MAC packets) and error detection (we used the CRC-16).The evaluation other than "ping" cab, also has been done by share the multimedia contents (video with 360p and small pixels image) and lowspeed internet browsing.The MAC layer is programmed on the processing system using a FPGA Zybo Zynq-7000.In other words, it is implemented as S/W SoC.

Figure 1 .
Figure 1.Network topologies defined in IEEE 802.15.7 standard and its example the frame structure usage in different topologies, reproduced from [7]

Figure 2 .
Figure 2. Point-to-point topology that consists of two nodes and address setting (Internet protocol, MAC, and domain name server)

[ 9 ]
. G.J. Blinowski described the risk occurs on PHY-level security from possible attacks (data snooping, signal jamming, and data modification) and also briefly analyze the MAC-level security mechanism [10].N-T.Le and Y.M. Jang proposed the enhancement of MAC layer of IEEE 802.15.7 for VLC broadcast service [11].B. Tomas et al proposed the MAC model for vehicular VLC application [12].Y. Jia presented the MAC layer implementation referred to IEEE 802.3 standard that supports full-duplex communication [13].The other related topic is carried-out by H. Guo et al that implements MAC controller in H/W of FPGA [14].Later, A. Musa, et al analyzed the IEEE 802.15.7 protocol focused on the contention-access period part [15].P. Shams et al explored comprehensive the MAC layer performance of IEEE 802.15.7 standard, involve several parameters: throughput, delay, power consumption, and its probability profile (collision, transmission, access and packet discard) [16].

Figure 4 .
Figure 4. Block diagram of the overall VLC system

Figure 6 .
Figure 6.MAC frame structure that used this work, reproduced from [5]

Figure 7 .Figure 8 .
Figure 7. Flowchart for delivery the MAC frame

Figure 9
Figure9is a flowchart for wrapping process that has been clearly done after the host and the client receives the IP packets.The IP packets are wrapped with the created headers as well as trailers, where the header consists of frame control, addressing field, auxiliary address field and then the footer is the result of the CRC-16 calculations that computed by Equation 1.

Figure 9 .
Figure 9. Flowchart for wrapping the IP packet

Figure 10 .
Figure 10.Flowchart for unwrapping the MAC frame and error detection using CRC-16

EAI
Endorsed Transactions on Energy Web and Information Technology 07 2017 -10 2017 | Volume 4 | Issue 14 | e5 MAC Layer Design for Network-Enabled Visible Light Communications Compliant with IEEE 802.15.7

Function
MAC Frame From Serial MACUnwrap(MACFrame) Sent to Socket end End Main Program

Figure 12 . 2 EAI
Figure 12.A photograph of MAC layer functional test When the Xillinux OS has been run-up, subsequently the functionality test for the designed MAC layer can be observed as visualized in Figure 12.As stated in Section 1,

Figure 14 .Figure 15 .
Figure 14.A photograph of the PC monitor connected to the Host (PC Host)

Figure 16 .Figure 17 .
Figure 16.A photograph of the PC monitor connected to the Host (PC Client -1)

Figure 18 .
Figure 18.A photograph of: (a) the PC monitor connected to the Client (PC Host); (b) command prompt the error is existed

Figure 20
Figure 20 looks the experimental setup in which the arrangement is same with the setting as shows in Figure 12.When the functional tasks of the designed MAC layer are carefully tested, actually the VLC system can be demonstrated immediately to share the multimedia contents like video, audio, texts, or image.Due to the space limitations of the paper's illustration, we zoomed out (the orientation center is marked in red dotted-line) the photo and specifically brought to Figure 12. Figure 21(a) visualized the successful image transfer without compresses and extraction, it means that the received file is identical with the transmitted.Figure 21(b) evidences the fruitfulness of video streaming without buffer occurs, it means that the video can stream in a real-time.To access the video, we should enter the URL in web browser address bar just like standard structure, such as: http://192[dot]168[dot]1[dot]1/stream[dot]mp4.Then the internet browsing via LED bulb also has been demonstrated with bit-rate speed of 11 kbps only, as depicted in Figure 20(c).It is caused by the limitation of AFE bandwidth in which we do not discuss it.The overall VLC demo proves that the designed MAC layer truly works well as predicted.

•Figure 5 .
Figure 5.The position of the designed MAC layer within the whole VLC system

Table 1 .
The functions and descriptions of the designed MAC layer in Python script