Design and Development of Multi-Transceiver Lorafi Board consisting LoRa and ESP8266-Wifi Communication Module

The advancement of Micro-Electro-Mechanical-Systems (MEMS), microcontroller technologies and the idea of Internet of Things (IoT) motivates the development of wireless modules (e.g. WiFi, Bluetooth, Zigbee, and LoRa) that are small and affordable. This paper aims to provide detailed information on the development of the LoRaFi board. The LoRaFi 1.0 is a multi-protocol communication board developed by Centre of Excellence for Advanced Sensor Technology (CEASTech). The board was developed for but not limited to monitor the indoor air quality. The board comprises two different wireless communication modules namely, Long-range technology (LoRa) and WiFi (using ESP8266). The board can be configured to communicate either using LoRa or WiFi or both. The board has been tested and the wireless communication operates successfully. Apart from LoRa, WiFi enables data to be forwarded to the cloud/server where the data can be stored for further data analysis. This helps provide users with real-time information on their smartphones or other applications. In the future, researchers will conduct tests to investigate the communication link quality. Newer version with reduced board size and additional wireless communication module will be developed in the future as to increase board flexibility and widen the range of applications that can use the board.


Introduction
The increasing demand for better quality of life has inspired the academician and industrial communities known as Internet of Things (IoT). The possible interaction between living (e.g. human, livestock) and non-living things (e.g. cars, house, and building) through wireless network communication opens a door to the development of new and advance applications. By integrating sensing and actuation features to the developed device or system with artificial intelligent enable the creation of smart environments that is applicable for various application domains such as in healthcare, environment [1]  This paper aims to provide detail information on the design and development of the LoRaFi board starting from the design concept until the fabrication of the final product. The rest of this paper was arranged as follows: Section 2 provides the LoRaFi development stage. Section 3 and 4 elaborates the LoRaFi board architecture and specification. Section 5 provides result obtained from simple test conducted to investigate the operation of the wireless communication. Section 6 describes the development of database and mobile application. Lastly, the future works is included in Section 7.

LoRaFi Design and Development
The summary of design and development of LoRaFi board is provided in the flow chart (refer figure  2). At first, block diagram of components required for the board from brainstorming session was roughly drawn. Next, the circuitry design was done using circuit drawing software (OrCAD PSpice). Upon successful compilation, the circuit was built on a prototyping board (breadboard). The board was tested per units (power, sensors, wireless module, and communication) and also as a complete board. When the board works successfully, the next step is to transform the circuitry from drawing to printed circuit board (PCB). There is a number of software available for PCB drawing such as OrCAD PCB Designer, Altium and others. In this research, OrCAD PCB Designer was chosen because it is software that is used by the etching department. Apart from that, there are various features that need to be noted such as board size/dimension, number of PCB layer, track size, through hole or surface mount component and others. Therefore, using the same software will help reduced the editing and synchronization time. The LoRaFi board was designed as two layers PCB with dimension of 5×7cm. The board contains combinations of through-hole and surface mount components. Therefore, components and tracks need to be carefully placed as to not overlap with each other.

LoRaFi Board Architecture
The LoRaFi board developed for but not limited to monitor the indoor air quality. The LoRaFi architecture shown in figure 3 can be divided into several parts that are interconnected and related to each other. The LoRaFi architecture includes Central Processing Unit (CPU), wireless communication module, communication with computer or other microcontroller, power source, and sensors and actuators. The components on the LoRaFi board is shown and labelled as in figure 4.

Power Source
The LoRaFi board can be powered up by an external power supply or rechargeable 3.7V LiPo battery. The external power supply can be supplied from mini USB (plug into the mini USB header) or AC-to-DC adapter (plug into the DC jack). However, only one external power supply (either the mini USB or the DC jack) can be connected at a time. Meanwhile, the rechargeable battery can be used together with either DC jack or mini USB. A power switch (SW2) is provided to select between the external and the battery power for the board. In case of both external power and battery connected, the battery

Wireless Module Power Source
Rechargeable battery

1234567890''""
MUCET 2017 IOP Publishing IOP Conf. Series: Materials Science and Engineering 318 (2018) 012051 doi:10.1088/1757-899X/318/1/012051 will be charged through the built-in battery charger. The LoRa and WiFi operate at 3.3V while the Arduino ProMini (a.k.a. ProMini) circuit operating voltage ranges from 3.3V up to 5V. Therefore, a level shifter is required in order to enable the communication between ProMini with LoRa and WiFi. The sub-section 3.2.1 provides further information on the level shifter on the LoRaFi board.

Microcontroller
Microcontroller is required especially for smart artificial system. There are various microcontrollers available in the market that varies in terms of resources, processing capabilities, speed and storage. For LoRaFi board, a microcontroller from Arduino known as ProMini [4] was used. The microcontroller on the ProMini is a microcontroller based on the ATmega328. The ATmega328 has 32kB of flash memory for storing code (of which 0.5kB is used for the bootloader). Besides that, the microcontroller also has 2kB of SRAM and 1kBs of EEPROM that can be read and written with the EEPROM library.

Level Shifter TTL.
A level shifter is needed to step down the voltage from 5V to 3.3V when ProMini wants to send data to LoRa via Serial Peripheral Interface (SPI) communication link. Likewise, the ESP module also needs TTL when it wants to communicate with the ProMini via serial communication. However, there is no TTL required when LoRa or ESP wants to send data to ProMini.

Sensors and Actuators
The LoRaFi board has ports designated for different sensors which is humidity and temperature sensor, particle sensor and volatile organic compound (VOC). The following sub-sections described each of the sensors. Besides that, the LoRaFi board is also equipped with a port for an actuator. The pins configuration for the DHT11, particle sensor and VOC sensor is provided in Table 1. The port dedicated for the sensors was previously depicted in figure 4.  figure 5(a). Other sensors that have similar specification to DHT11 can be used alternatively.

Particle
Sensor. The particle sensor tested with the LoRaFi board is a particle sensor developed by SHINYEI Corporation (PPD42NS model [5]). The port for the particle sensor was labelled as PS in figure 4. The particle sensor shown in figure 5(b) creates digital (Lo pulse) output to Particulate Matters (PM). The Lo Pulse Occupancy (LPO) time is in proportion to PM concentration. The output from "P1" is for minimum particle size of 1 micro meter and larger.

Volatile Organic Compound (VOC).
Volatile organic compounds (VOCs) are chemicals that can easily evaporate into the air such as ethanol, benzene and etc. TGS sensor (from Figaro) can be used to measure VOCs in the air. The TGS is a 3.3V analog sensor that has 4 pins as shown in figure 5(c).

3.3.4.
Actuator. Actuator receives instruction from the microcontroller to perform a specific mechanical action. The LoRaFi board is equipped with a port for actuator, labelled as ACT (refer figure 4). The actuator is supplied with 5V power supply and connected to ProMini through digital

Communication with Computer or other Microcontroller
The ProMini can be programmed using Arduino IDE. The ESP module also can be externally programmed via external port (refer figure 4). . These pins are dedicated specifically for LoRa thus these pins cannot be used for other application. The advantage of the SPI communication is that additional devices that support SPI communication such as Secure Digital (SD) card can be added (perhaps for the next development board).

Serial Communication.
Serial pins (TX0 and RX1) of the ProMini are shared between FTDI programmer and ESP module. A selector switch (SW1) is included on the board to disconnect the ESP module from the ProMini while uploading program to ProMini via FTDI programmer. Before uploading the program, the selector switch (SW1) needs to be toggled to "PROG". When done uploading, the SW1 must be toggled to "RUN" so that ESP can operate correctly. In addition, the ESP module can be configured as Access Point (AP), client or as both. It also supports basic TCP/IP, UDP, GET, POST, and Webserver applications.

Wireless Communication
There are two different wireless communication modules onboard which are LoRa and WiFi as shown in figure 6. LoRaFi board can be configured as either transmitter, receiver or as both interchangeably. In addition, UFL connector (antenna) is also provided on the board so external antenna can be attached for the LoRa module. ESP7S have port for antenna unlike ESP12E. The following sections will further elaborate on the communication protocols used for the LoRaFi board.

Wireless Communications
The LoRaFi board comprised of two different wireless communication modules namely LoRa and WiFi. The LoRa communication was achieved by using LoRa module while WiFi communication was achieved by using either ESP12E or ESP7S module. The board can be configured to communicate using only LoRa or WiFi or both. Figure 7 shows the example of LoRaFi network. The WiFi allows data to be sent to the cloud/server where data can be stored for further data analysis and/or providing users with real-time information on their smart phones. In this research, for testing purposes, the transmitter (also known as end device) is configured to operate using LoRa. The receiver, on the other hand, receives data from the transmitter via LoRa and forwarded the received data to the cloud via WiFi. The data can be viewed using internet browsers.

LoRa from Semtech
The LoRa 868/915MHz module used for the LoRaFi board is shown in figure 6(a). The LoRa module was integrated with SX1272 chip that supports different modulations such as FSK, GFSK, MSK, GMSK, LoRa and OOK modulation. By using the SEMTECH's patented LoRa modulation technique, the SX1272 able to achieve a sensitivity of over -137dBm using a low cost crystal [3]. Besides that, by using the LoRa modulation scheme, the transceiver is capable of achieving significantly longer range than existing systems based on FSK or OOK modulation [3]. LoRa employs spread spectrum. The spread spectrum modulation bandwidth (BW), spreading factor (SF) and error correction rate (CR) can be manipulated to achieve maximum flexibility. Table 2 shows some of the available transmission quality configuration for LoRa. Throughput and range depend on the BW, SF and CR. BW is the physical bandwidth for RF modulation and there are three main bandwidth value specified by SEMTECH which is 125kHz, 250kHz and 500kHz. Referring to Table 2, larger signal bandwidth permits higher effective data rate, therefore the transmission time reduced at the tradeoff for reduced sensitivity. Another benefit of the spread modulation is that each spreading factor is orthogonal, thus multiple transmitted signals can occupy the same channel without interfering. This also permits simple coexistence with existing FSK based systems [3].  Equation (1) and (2) shows the RSSI value calculation in FSK/OOK mode. Similarly, Equation (3) is the formula for RSSI in LoRa mode. Apart from that, the formula in Equation (4) can be used to calculate the signal strength of the received packet [3].

WiFi-ESP8266
The ESP module was developed by Ai-Thinker and two different processors available namely ESP8266 [6] and ESP32. ESP8266 is a popular platform for IoT applications relying on WiFi, while ESP32 is the newly developed processor that adds a CPU core, faster WiFi, Bluetooth 4.2, and various I/O. The comparison between ESP-12E, -2F and -07S is given in Table 3. The series available for ESP8266-based module are ESP-01S, -07S, -12E, -12F and -12S, whereas the series available for ESP32-based module is ESP-32S. The ESP8266 core processor module is integrated with Tensilica L106 ultra-low power 32-bit microcomputer (MCU), with 16-bit compact mode, supports 80MHz frequency and 160MHz, and the RTOS support. It supports standard IEEE802.11b/g/n protocol and a complete TCP/IP protocol stack. There are two different version of ESP that can be used for the LoRaFi board which is ESP12E or ESP7S as previously shown in figure 6(b) and figure 6(c).

Wireless Communication Test
Simple test was conducted to investigate the wireless communication between two LoRa modules. In order to perform this test, two LoRaFi nodes are required. One node is set as transmitter while the other node is set as receiver. Both nodes are set to operate using the configuration shown in figure 8. The transmitter programmed to transmit string (e.g. Hello). On the other hand, the receiver was connected to computer via serial communication. Thus, data received by the receiver can be viewed via serial monitor available in Arduino IDE as shown in figure 9.  Figure 9. Data received by receiver and displayed on the serial monitor

Database and Mobile Application
The LoRaFi board able to receive real time data but the data need to be somehow stored for further processing. One way to do that is by having the gateway uploading the received data to the cloud. The data that is stored in the cloud can then be retrieved for data analytics, real-time display on website, alarm or notifications and for mobile application. Data fetched from the cloud by the developed mobile application will provide user with real time information. The mobile application in this research was developed using the open source Android MIT app 2 Inventor.

Conclusion and Future Works
The LoRaFi board developed can be used to measure ambient temperature, humidity, and volatile in the air. However, the sensors are replaceable with other sensor that have similar number of pins and power requirement. At present, the LoRaFi board can be purchased from Cytron Malaysia website using the following link: https://www.cytron.com.my/p-lorafi. In the future, developer will work on reducing the size of the board in order to widen the application and increase the flexibility of the board.