Node-RED-based edge gateway¶
Copyright © Quectel Wireless Solutions Co., Ltd. 2026. All rights reserved.
This project is a Node-RED-based edge gateway built on the Quectel Pi H1 smart single-board computer.
Serving as an edge computing and protocol aggregation node, the Quectel Pi H1 manages edge device connectivity, data collection and aggregation, rule orchestration, and dashboard visualization across the local network. By persisting telemetry to a local database, it establishes a closed-loop "ingest–process–store–visualize" architecture, making it ideal for industrial on-premise environments and edge computing scenarios with strict requirements for real-time performance, reliability, and local deployment.
Development resources¶
Development accessory list¶
Note
The accessory list is for reference only and may vary depending on your development environment. For example, when developing over a remote SSH connection, you can omit the USB hub, and the external display can be replaced as needed.
Accessory name |
Quantity |
Specifications |
|---|---|---|
Quectel Pi H1 smart single-board computer |
2 |
|
Environment Sensor HAT |
1 |
|
USB camera module |
1 |
|
USB-C power adapter |
2 |
|
CPU cooling fan (optional) |
1 |
|
Micro HDMI cable |
2 |
HDMI 2.0; Length: 1 m; Micro-HDMI to standard HDMI cable or Micro-HDMI cable (Type-D male to Type-A male) |
Ethernet cable |
2 |
Length: 1 m; Speed: Gigabit |
Display |
1 |
24-inch HDMI monitor |
Accessory reference images¶
Quick start¶
Development preparation¶
This project adopts a dual-board collaborative architecture: Board A (H1-A) serves as the edge gateway node, responsible for data aggregation, Node-RED orchestration, and dashboard visualization; Board B (H1-B) serves as the on-site acquisition node, equipped with environmental sensors and a camera for data collection.
The Quectel Pi H1 comes pre-installed with Debian 13, so reflashing the OS image is typically not required. Follow the steps below to get started:
Hardware connections¶
Gateway node (H1-A)¶
Complete all hardware connections according to the steps below (step numbers correspond to the callouts in the interface diagram):
Fan connection: Plug the cooling fan cable into the board's FAN header, then fasten both ends of the cooler into the board's dedicated mounting holes.
Display connection: Connect one end of the Micro HDMI cable to the board's Micro HDMI port and the other end to the monitor's HDMI port.
Network connection: Ensure the router is connected to the internet. Connect one end of the Ethernet cable to the board's Gigabit Ethernet port and the other end to an Ethernet port on the router.
Input device connection: Connect input devices such as the USB keyboard, mouse, and OV5693 camera module to the board's USB ports (if using wireless input peripherals, plug the wireless receiver into a USB port on the USB hub).
Power connection: Plug the power adapter into an AC outlet, then connect the USB-C end to the board's power input port (connecting all other peripherals before applying power is recommended).
Acquisition node (H1-B)¶
Network connection
Connect one end of the Ethernet cable to the Gigabit Ethernet port of the board and the other end to a LAN port of the router.
Note
If connecting over Wi-Fi, ensure that both the acquisition node (H1-B) and the gateway node (H1-A) are connected to the same local network (residing on the same subnet).
Jumper cap connection
Make sure the header pins labeled AUTO_POWER_ON at the upper-left corner of the board are shorted with a jumper cap.
Environment sensor expansion board connection
Connect the environment sensor expansion board to the 40-pin header of the board.
Note
Ensure proper sensor pin alignment and orientation: Align Pin 1 of the expansion board (typically marked by a dot or square pad) with Pin 1 of the 40-pin GPIO header on the main board. Orient the expansion board body inward toward the main board and press down firmly and evenly until fully seated. Never misalign pins or reverse the connection.
Camera connection
Connect the USB camera to a USB-A port of the board.
Power connection
Plug the power adapter into an AC outlet, then connect the USB-C end to the board's power input port (labeled POWER IN).
6. Completed connection reference
Project implementation¶
Note
This section is split into the gateway node and the acquisition node for easier deployment.
Gateway node (H1-A)¶
Update package sources
sudo apt update
Install Node-RED
sudo apt install build-essential git curl
bash <(curl -sL https://raw.githubusercontent.com/node-red/linux-installers/master/deb/update-nodejs-and-nodered)
Enable auto-start on boot:
sudo systemctl enable nodered.service
To disable auto-start on boot, run the following commands:
sudo systemctl disable nodered.service
sudo systemctl restart nodered
Install Mosquitto and SQLite3
sudo apt install -y sqlite3 mosquitto mosquitto-clients
Enable auto-start on boot:
sudo systemctl enable --now mosquitto
Create and edit the Mosquitto configuration file:
sudo nano /etc/mosquitto/conf.d/edge-listener.conf
Enter the following configuration, then press Ctrl+O, Enter, and Ctrl+ X to save and exit:
listener 1883 0.0.0.0
allow_anonymous true
Restart the service:
sudo systemctl restart mosquitto
Initialize the SQLite database
The database path used by the Node-RED SQLite node is /home/pi/edge_db/edge.db (replace the username pi with your actual system username).
First, create the directory and initialize the table schema:
mkdir -p ~/edge_db
sqlite3 ~/edge_db/edge.db << 'SQL'
CREATE TABLE IF NOT EXISTS telemetry (
id INTEGER PRIMARY KEY AUTOINCREMENT,
deviceId TEXT NOT NULL,
ts INTEGER,
gatewayTs INTEGER,
temperature REAL,
humidity REAL,
pressure REAL
);
CREATE INDEX IF NOT EXISTS idx_telemetry_device_ts ON telemetry(deviceId, ts);
SQL
Note
The fields written to the database by Node-RED are (deviceId, ts, gatewayTs, temperature, humidity, pressure), and deviceId is obtained by parsing the topic edge/v1/<deviceId>/telemetry.
Access the dashboard
If you use a browser on the desktop of the board, open http://localhost:1880 directly.
To access it from another device, use the hostname or IP address of the board (run hostname -I on it to find the IP address) and open http://
The web interface after login is shown below:
Install the required nodes:
After entering the editor, click the top-right menu, then go to Settings → Palette → Install to open the node installation page. Search for and install the following nodes:
node-red-node-sqlite
node-red-dashboard
Import the Node-RED flow
1)Place the flow.json file under .node-red/lib/flows/.
mkdir -p ~/.node-red/lib/flows
cd ~/.node-red/lib/flows/
2)In the editor, click the top-right menu, select Import → Local, choose flow.json, and click Import.
3)After importing the flow, click Deploy to make it take effect.
Acquisition node (H1-B)¶
The acquisition node is implemented with Python, paho-mqtt, and smbus2, and uses mjpg-streamer to output the MJPEG video stream:
Install base components
sudo apt update
sudo apt install -y git python3-venv v4l-utils cmake build-essential libjpeg-dev
Configure the 40-Pin Header
Enable I2C on the 40-pin header: Run sudo qpi-config 40pin set in the terminal, then reboot the board for the configuration to take effect.
Install mjpg-streamer (for MJPEG video streaming)
Clone the source code and build:
cd ~
git clone https://github.com/jacksonliam/mjpg-streamer.git
cd mjpg-streamer/mjpg-streamer-experimental
make && sudo make install
Obtain the code and create a Python virtual environment
Place the edge_h1_sensor folder from the code package under the user directory /home/pi, then run the following command:
cd ~/edge_h1_sensor
python3 -m venv venv
source venv/bin/activate
Upgrade pip and install OpenCV and paho-mqtt
pip install --upgrade pip opencv-python paho-mqtt
pip install -U smbus2
6. Start the program
Return to the project code directory, activate the Python virtual environment, and run the program:
cd ~/edge_h1_sensor
source venv/bin/activate
# Update the sample code with your actual IP address
sudo -E ~/edge_h1_sensor/venv/bin/python h1_sensor_agent.py
Application demo¶
Node-RED UI¶
Node-RED Flow Editor: http://
Edge gateway dashboard: http://
Database query examples¶
The gateway node writes telemetry data to an SQLite database with the following default configuration:
Database file: /home/pi/edge_db/edge.db.
Table: telemetry.
Fields: deviceId, ts, gatewayTs, temperature, humidity, pressure.
Open the database¶
sqlite3 /home/pi/edge_db/edge.db
List tables and view the table schema¶
.tables
.schema telemetry
View the latest records¶
Replace h1-sensecam-001 with the actual device ID:
SELECT deviceId, ts, gatewayTs, temperature, humidity, pressure
FROM telemetry
WHERE deviceId = 'h1-sensecam-001'
ORDER BY ts DESC
LIMIT 20;
Convert timestamps to human-readable time¶
ts is in milliseconds.
SELECT
deviceId,
datetime(ts/1000, 'unixepoch', 'localtime') AS time_local,
temperature, humidity, pressure
FROM telemetry
WHERE deviceId = 'h1-sensecam-001'
ORDER BY ts DESC
LIMIT 20;
Technical support and contributions¶
If you encounter any issues during use, please submit technical inquiries on the Quectel official forum. Our technical support team will respond promptly.