# Analysis of Low Cost Communication Technologies for V2I Applications
## 3 Materials and Methods
### Algorithms  
After checking the communication technologies and microprocessors, the next step is to continue with the assembly of the device and the development of the algorithm.  
The chosen microprocessor determined the programming language and the communication technology determined the connection bus. The algorithm languages and the interfaces are shown in Table 2.  
Working with two different microprocessors increased the difficulty of the task. They use different programming languages and work with different clock speeds, which made their synchronization harder.  
The following paragraphs give an explanation of the control algorithms through flow diagrams in Figures 4 and 5. The algorithm code is available in the Appendix A.  
* ZigBee: There were two roles. The RSU was responsible for supporting the network and was the coordinator. Meanwhile, the client was the OBU (router or end device in XBee devices).  
\begin{table}
\begin{tabular}{c c c c c c c} \hline \hline
**Technologies 1** & **WiFi** & **LoRa** & **ZigBee** & **Z-Wave** & **Bluetooth** & **nRF24** \\ \hline Frequency Band & 2.4–5 GHz & 868 MHz & 2.4 GHz & 1 GHz & 2.4 GHz & 2.4 GHz \\ Protocol & 802.11 b/g/n/ac & LoRaWan & 802.15.4 & 802.15.4 & 802.15.1 & 802.15.4 \\ Data Rate & Until 867 MB/s & 50 Kb/s & 250 Kb/s & 100 Kb/s & Until 2 Mb/s & Until 2 MB/s \\ Distance(m) & **Until 1000** & **Until 5000** & **Until 1000** & **Until 30** & **Until 1000** & **Until 1000** \\ Bus & Embedded/SPI & USB/SPI & UART & UART & SPI & SPI \\ Network available 2 & Yes & Yes & Yes & Yes & No & Yes \\ \hline \hline \end{tabular}  
* The colors show if the performance is suitable for our needs. Green = fit, red = unfit. 2 Possibilities for a network with more than one node, for instance, point to multipoint.  
\end{table}
Table 1: Comparison between different communication technologies.  
\begin{table}
\begin{tabular}{c c c c c c} \hline \hline  & \multicolumn{2}{c}{**ZigBee**} & \multicolumn{2}{c}{**WiFi**} & \multicolumn{2}{c}{**nRF24l01+**} \\ \hline  & **Arduino** & **Raspberry** & **Arduino** & **Raspberry Pi** & **Arduino** & **Raspberry** \\ \hline
**Language** & C++ (Arduino) & Python & C++ (Arduino) & Python & C++ (Arduino) & Python \\ \hline
**Interfaz** & UART Adaptor & USB & Embedded & Embedded & SPI & SPI \\ \hline \hline \end{tabular}
\end{table}
Table 2: Comparison of the programming languages and connection BUS.  
The RSU sent a message to the OBU when it was in its range. Then the OBU received it and sent back a reception check, which let the RSU change the message.  
* Wi-Fi: In this case, the communication mode \"Wi-Fi Direct\" was used. It is a new method, which allows communication between devices without a gateway. In this way, the RSU (Arduino) set the communication channel with the client (OBU, Raspberry). Contrasting Figure 5 with Figure 4, both diagrams are different in the way that they establish the connection to send messages in any direction. While in the ZigBee, the network was made up  
Figure 4: Flow diagram of the algorithm implemented for XBee device with ZigBee protocol.  
Figure 5: Flow diagram for the algorithm implemented for Wi-Fi.  
with an active coordinator. With Wi-Fi, the client had to send a message to the coordinator which was supporting the network.  
* nRF24L01+: In these modules, if the network was not wide, it was not necessary to define roles. Otherwise, one of the modules must be the coordinator of the network. The operation diagram of this module is the same as Figure 4.