Serial Studio and LTE modem HUAWEI K5161H

Overview

This project demonstrates how to use Serial Studio to visualize signal quality data from a LTE modem HUAWEI K5161H.

Serial Studio

Three methods of sending data are described:

The examples are implemented on OS Archlinux, in which Serial Studio can be:

Data from HUAWEI K5161H can be get by url API http://192.168.9.1/api/device/signal
Python was used to receive, process and generate data frames.


Method 1 - Virtual Serial Port

Create Virtual Serial Port

  1. Install socat
    sudo pacman -S socat
    
  2. 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
    
  3. You can check the operation of the virtul serial ports by reading the file /tmp/ttyV0
    cat /tmp/ttyV0
    
    and writing data to the file /tmp/ttyV1
    echo 100 > /tmp/ttyV1
    
  4. Install python-pyserial
    sudo pacman -S python-pyserial
    
  5. Run a Python script lte_serial.py to process data and send it to the virtual serial port /tmp/ttyV1
    python lte_serial.py
    

Serial Studio configuration for Virtual Serial Port

  • Run Serial Studio
  • Select DEVICE SETUP → I/O Interface: Serial Port
  • Select FRAME PARSING → Parse via JSON Project File
  • Select Project filelte.json
  • Manually enter COM Port/tmp/ttyV0 and press Enter
  • Select Baud Rate → 9600
  • Click Connect in upper right corner

After get first frame of data Serial Studio will automatic open dashboard with plots.

Screenshot Virtual Serial Port


Method 2 - MQTT

Prepare MQTT broker

  1. Install MQTT broker Mosquitto
    sudo pacman -S mosquitto
    
  2. Run MQTT broker with default settings
    mosquitto --verbose
    
  3. You can check MQTT broker by sending data
    mosquitto_pub -m "abcd,100,50,75,89" -t "lte"
    
  4. Install Python client library for MQTT - paho
    sudo pacman -S python-paho-mqtt
    
  5. Run a Python script lte_mqtt.py to process and send data to the MQTT broker
    python lte_mqtt.py
    

Serial Studio Configuration for MQTT

  • Run Serial Studio
  • Select FRAME PARSING → Parse via JSON Project File
  • Select Project filelte.json
  • Click MQTT in the top bar
  • Set Host → 127.0.0.1
  • Set Port → 1883
  • Set Topic → lte
  • Select Mode → Subscriber
  • Set Keep Alive → 600
  • Click Connect

After get first frame of data Serial Studio will automatic open dashboard with plots.

Screenshot MQTT


Method 3 - UDP Socket

Solution with UDP Socket looks much simpler than other.

Run a Python script lte_udp.py to process data and send it to the UDP Socket

python lte_udp.py

Serial Studio Configuration for UDP Socket

  • Run Serial Studio
  • Select DEVICE SETUP → I/O Interface: Network Socket
  • Select FRAME PARSING → Parse via JSON Project File
  • Select Project filelte.json
  • Select Socket type → UDP
  • Set Remote address → 127.0.0.1
  • Set Local port → 5005
  • Click Connect in upper right corner

After get first frame of data Serial Studio will automatic open dashboard with plots.

Screenshot UDP