The Photonicat 2 includes two important hardware features that require software support:
- LCD Display - GC9307 SPI LCD (172x320 pixels) showing system status
- Cooling Fan - PWM-controlled fan for thermal management
This document explains how to enable these features with vanilla OpenWrt.
📖 For comprehensive configuration guide: See guides/06-SCREEN_AND_FAN_DETAILED.md for complete documentation including all display configuration options, data keys, element types, color schemes, configuration examples, and detailed fan control options.
- Controller: GC9307 SPI LCD
- Resolution: 172x320 pixels
- Interface: SPI (SPI1)
- GPIO Pins:
- RST (Reset): GPIO 122
- DC (Data/Command): GPIO 121
- CS (Chip Select): GPIO 13
- Backlight: PWM-controlled (PWM2)
- Rotation: 180 degrees
The LCD is defined in the device tree (rk3576-photonicat2.dts):
- SPI1 interface configuration
- PWM backlight control
- GPIO pin assignments
The display is driven by pcat2_mini_display, a Go-based application that:
- Renders system information to the LCD
- Shows real-time stats (CPU, memory, network, battery)
- Displays 5G modem status and signal strength
- Shows SMS messages
- Provides customizable screens
- HTTP API for remote control
Repository: https://github.com/photonicat/photonicat2_mini_display
Add this to your configs/pcat2_custom.config:
# LCD Display Application (includes required kernel modules)
CONFIG_PACKAGE_pcat2-display-mini=y
CONFIG_PACKAGE_kmod-fb=y CONFIG_PACKAGE_kmod-fb-sys-fops=y
CONFIG_PACKAGE_kmod-backlight=y
### Building with Display Support
#### Option 1: Automatic Build (Recommended)
If you use the `./build.sh` script provided in this repository, the display package is **automatically copied** to the build environment, and the `configs/pcat2_custom.config` file already enables it.
Simply run:
```bash
./build.sh
If you are building manually without the wrapper script:
-
Copy the display package to OpenWrt build:
# From your OpenWrt build root mkdir -p package/custom cp -r /path/to/photonicat2-support/packages/pcat2-display-mini package/custom/ -
Enable in menuconfig:
make menuconfig # Navigate to: Utilities → pcat2-display-mini # Press 'Y' to build into firmware or 'M' for module
-
Or add to your config file:
CONFIG_PACKAGE_pcat2-display-mini=y -
Rebuild:
make -j$(nproc)
If you've already flashed OpenWrt without the display package:
-
On the device, install Go runtime (if not already in firmware):
opkg update opkg install golang
-
Build and install manually:
# Clone display application git clone https://github.com/photonicat/photonicat2_mini_display cd photonicat2_mini_display # Build for ARM64 GOOS=linux GOARCH=arm64 go build -o photonicat2_mini_display # Install cp photonicat2_mini_display /usr/bin/ chmod +x /usr/bin/photonicat2_mini_display # Copy assets mkdir -p /usr/share/pcat2_mini_display cp -r assets /usr/share/pcat2_mini_display/ cp config.json /etc/pcat2_mini_display-config.json # Install init script (from photonicat2-support/packages/) # ... or create systemd service
The display is highly customizable via config.json:
- Update intervals: Control how often data is refreshed
- Display pages: Choose which information screens to show
- Colors and themes: Customize appearance
- API endpoints: Configure data sources
- Screen timeout: Battery vs AC power settings
- SMS display: Enable/disable SMS notifications
Configuration file: /etc/pcat2_mini_display-config.json
Example customizations:
{
"displayPages": ["system", "network", "battery", "modem"],
"updateIntervals": {
"system": 2,
"battery": 1,
"network": 2
},
"screenTimeout": {
"onBattery": 60,
"onDC": 86400
}
}The display application provides an HTTP API (default: port 8080):
- View current stats:
http://device-ip:8080/api/status - Control display:
http://device-ip:8080/api/control - Upload custom graphics:
http://device-ip:8080/api/upload
- Type: PWM-controlled cooling fan
- Interface: PWM1 (channel 0)
- Control: Automatic thermal management via kernel
The fan is configured in the device tree:
- PWM1 interface
- Thermal zone bindings
- Cooling device integration
The RK3576 SoC includes thermal zones with automatic fan control:
- Thermal zones: CPU, GPU, NPU temperature monitoring
- Cooling levels: Fan speed adjusts based on temperature
- Thresholds: Defined in device tree
Add these to your configs/pcat2_custom.config:
# PWM support for fan
CONFIG_PACKAGE_kmod-pwm=y
CONFIG_PACKAGE_kmod-pwm-rockchip=y
# Thermal management
CONFIG_PACKAGE_kmod-thermal=y
CONFIG_PACKAGE_kmod-hwmon-core=y
The fan is automatically controlled by the kernel thermal management:
- Temperature sensors monitor SoC temperature
- Fan speed increases as temperature rises
- No manual configuration needed
For custom fan control:
-
Check fan PWM device:
ls /sys/class/pwm/
-
Control fan speed manually:
# Enable PWM echo 0 > /sys/class/pwm/pwmchip0/export # Set period (in nanoseconds) echo 25000 > /sys/class/pwm/pwmchip0/pwm0/period # Set duty cycle (0-25000 for speed control) echo 12500 > /sys/class/pwm/pwmchip0/pwm0/duty_cycle # 50% speed # Enable echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
-
Monitor temperatures:
# View all thermal zones cat /sys/class/thermal/thermal_zone*/temp # View specific zone cat /sys/class/thermal/thermal_zone0/temp
Create a fan control script in /etc/init.d/fan-control:
#!/bin/sh /etc/rc.common
START=99
start() {
# Set fan to automatic mode
echo 0 > /sys/class/pwm/pwmchip0/export 2>/dev/null
echo 25000 > /sys/class/pwm/pwmchip0/pwm0/period
echo 1 > /sys/class/pwm/pwmchip0/pwm0/enable
}-
Check SPI device:
ls /dev/spidev* # Should show: /dev/spidev1.0
-
Check display service:
/etc/init.d/pcat2-display-mini status
-
View logs:
logread | grep display
-
Check PWM device:
ls /sys/class/pwm/
-
Monitor fan activity:
watch -n 1 'cat /sys/class/pwm/pwmchip0/pwm0/duty_cycle' -
Stress test to trigger fan:
# Install stress tool opkg install stress-ng # Run CPU stress stress-ng --cpu 8 --timeout 60s # Monitor temperature watch -n 1 'cat /sys/class/thermal/thermal_zone0/temp'
Check SPI module:
lsmod | grep spi
# Should show: spi_rockchip, spidevManually load modules:
modprobe spi-rockchip
modprobe spidevCheck device tree:
ls /sys/firmware/devicetree/base/spi*/Verify backlight:
ls /sys/class/backlight/
echo 255 > /sys/class/backlight/backlight/brightnessCheck PWM module:
lsmod | grep pwm
# Should show: pwm-rockchipManually load PWM:
modprobe pwm-rockchipCheck thermal zones:
ls /sys/class/thermal/thermal_zone*/
cat /sys/class/thermal/thermal_zone*/typeCheck logs:
logread -f | grep pcat2Run manually for debugging:
/etc/init.d/pcat2-display-mini stop
/usr/bin/photonicat2_mini_display -config /etc/pcat2_mini_display-config.jsonTo automatically include display and fan support in your build:
- Update
build.shto copy display package (already done in wrapper) - Add required kernel modules to your config file
- Include init scripts in files/ directory
- Build and flash the complete image
- Display Application: https://github.com/photonicat/photonicat2_mini_display
- Display Documentation: See application README for full API and customization
- Device Tree:
photonicat2-support/device-tree/rk3576-photonicat2.dts - Kernel Modules: Official OpenWrt kernel documentation
- Change default ports in config
- Use firewall rules to restrict access
- Disable SMS features if not needed
- Review the code before use in production
- ✅ LCD: Supported via device tree + pcat2-display-mini application
- ✅ Fan: Supported via device tree + automatic thermal management
- ✅ Customizable: Both can be fully customized
- ✅ Vanilla OpenWrt: Works with official OpenWrt + minimal patches