# Democratization of PV Micro-Generation System Monitoring Based on Narrowband-IoT
## 3 IoT Monitoring Solution  
### General Architecture  
The proposed system uses a FiPy development board as the main hardware. FiPy is a low-cost ESP-32 development board produced by Pycom manufacturer, which includes WiFi, Bluetooth, LoRa, Sigfox and dual LTE-M (CAT M1 and NBIoT) technologies. This platform allows us to test different communication technologies excluding any hardware modification. Table 2 summarizes the most relevant technical features of these boards [49]. Pycom is programmed in MicroPython language [50]. For this purpose, it is necessary to use Pymakr, which is an Integrated Development Environment (IDE) plugin for popular code editors, such as Atom and Visual Studio Code. Pymakr thus makes the development of IoT edge devices running microPython easier [51]. Although it is possible to program FiPy via Pybytes, Visual Studio Code is an IDE widely used for this purpose. With regard to the code developed by the authors, Figure 1 shows the structure and main blocks of such code schematically. Firstly, the sensors are configured and set, the FiPy microcontroller being able to collect data from such sensors. Secondly, a reading process of data from the sensors is carried out, and subsequently, the corresponding message is sent via LTE \begin{table}
\begin{tabular}{l} \hline \hline
**CPU** \\ - Xtensa® dual-core 32-bit LX6 microprocessor(s), up to 600 DMIPS \\ - Hardware floating point acceleration \\ - Python multi–threading \\ - An extra ULP–copro processor that can monitor GPIOs, the ADC channels and control most of the internal peripherals during deep–sleep mode while only consuming 25 \(\mu\)A. \\ \hline
**Networks** \\ - WiFi (1 km range) \\ - BLE \\ - Cellular LTE-CAT M1/NB1 (Total world–wide support) \\ - LoRa \\ - Sigfox \\ \hline
**Memory** \\ - RAM: 520 kB + 4 MB \\ - External flash: 8 MB \\ - GPIO: Up to 22 \\ - Hardware floating point acceleration \\ - Python multi–threading \\ \hline
**Interfaces** \\ - 2 \(\times\)UART, 2 \(\times\) SPI, I2C, micro SD card \\ - Analog channels: 8 (12–bit ADC), 2 (8–bit DAC) \\ - Timers: 2 of 64 bit with PWM with up to 16 channels \\ - DMA on all peripherals \\ - GPIO: up to 22 \\ \hline
**Hash/Encryption** \\ - SHA, MD5, DES, AES \\ \hline
**RTC** \\ - Running at 32 kHz \\ \hline
**Range** \\ - Node range: up to 50 km \\ \hline
**Power** \\ - Voltage Input: 3.3 V–5.5 V \\ - 3v3 output capable of sourcing up to 400 mA \\ \hline
**Size** \\ - 55 mm \(\times\) 20 mm \(\times\) 3.5 mm (excluding headers) \\ \hline \hline \end{tabular}
\end{table} 
Table 2: FiPy specifications. including the gathered data. It is then necessary to verify if the device is connected to the Pybytes platform. Indeed, eventual disconnections were detected during the testing, and a reconnection process was included in the following terms: Once the connection is verified, the message can be sent to the platform via LTE. This process is repeated with one-minute sample time during the total of sunlight daily hours. FiPy is set on deep-sleep under low sunlight conditions, in line with other contributions [52]. Pybytes is a free cloud-based device management platform for all Pycom development boards and modules. It provides a mobile app, allowing us to manage devices directly from a smartphone. It is possible to change the priority of the used networks: WiFi, Bluetooth and LPWAN networks. Pybytes also provides an easy to use dashboard to quickly create an application that sends data to the platform and allows us to choose among different types of data visualization. That dashboard updates automatically, and subsequently, the user can visualize current status of the devices and received data in real time. It is also possible to integrate Pybytes with a Cloud provider: AWS, Microsoft Azure, Webhooks and Google Cloud. A recent infrastructure based on Pycom development board FiPy and sensor shield Pysense to collect and send data to the remote cloud over Wi-Fi and Long Range (LoRa)  
Figure 1: Flow diagram for the microcontroller.