examples/LTE modem/README.md
This project shows how to use Serial Studio to visualize signal quality data from a HUAWEI K5161H LTE modem.
Three methods of sending data are described:
The examples were built on Arch Linux, where you can:
Run Serial Studio from AppImage.
Install it from the Arch User Repository (AUR) manually or with an AUR helper like yay:
yay -S serial-studio-bin
Build it with cmake.
Data from the HUAWEI K5161H is pulled from the URL API http://192.168.9.1/api/device/signal. Python is used to receive, process, and generate data frames. All three scripts read the API with the requests library:
sudo pacman -S python-requests
Each frame carries five values, matching the datasets in LTE Modem.ssproj: cell ID, RSRQ (dB), RSRP (dBm), RSSI (dBm), and SINR (dB). The serial and UDP scripts wrap each frame in the project's /* and */ start and end sequences.
<a name="method_1"></a>
Install socat:
sudo pacman -S socat
Create a linked pair of virtual serial ports, ttyV0 for listening and ttyV1 for sending data:
socat -d -d pty,rawer,echo=0,link=/tmp/ttyV0,b9600 pty,rawer,echo=0,link=/tmp/ttyV1,b9600
Test the virtual serial ports by reading from /tmp/ttyV0:
cat /tmp/ttyV0
and writing data to /tmp/ttyV1:
echo 100 > /tmp/ttyV1
Install python-pyserial:
sudo pacman -S python-pyserial
Run the Python script lte_serial.py to process data and send it to /tmp/ttyV1:
python lte_serial.py
LTE Modem.ssproj./tmp/ttyV0 and press Enter.After the first frame of data arrives, Serial Studio opens the dashboard with plots automatically.
<a name="method_2"></a>
Install the MQTT broker Mosquitto:
sudo pacman -S mosquitto
Run the MQTT broker with default settings:
mosquitto --verbose
Test the broker by sending data:
mosquitto_pub -m "abcd,100,50,75,89" -t "lte"
Install the Python MQTT client library, paho:
sudo pacman -S python-paho-mqtt
Run the Python script lte_mqtt.py to process data and send it to the broker:
python lte_mqtt.py
LTE Modem.ssproj.After the first frame of data arrives, Serial Studio opens the dashboard with plots automatically.
<a name="method_3"></a>
The UDP socket approach is simpler than the others.
Run the Python script lte_udp.py to process data and send it to the UDP socket:
python lte_udp.py
LTE Modem.ssproj.After the first frame of data arrives, Serial Studio opens the dashboard with plots automatically.