Files
DD3-Lora-Bridge-Raspi-Debugger/README.md

2.1 KiB

DD3 LoRa Bridge Raspi Debugger

Headless Raspberry Pi Zero W project:

  • WiFi client or fallback AP (serial / serialserial)
  • Web portal (http://192.168.4.1/ in AP mode)
  • ESP32 USB serial bridge with live SSE stream and daily log files (/home/pi/xxx_YYYY-MM-DD_HH-MM-SS.log)
  • Stable symlink to active log (/home/pi/xxx.log)
  • RTC boot restore + NTP sync + RTC write-back
  • Autostart via systemd

Current State

Current implementation status:

  • Boot flow restores system time from RTC (hwclock -s) before starting logging.
  • If WLAN + internet is unavailable, AP fallback starts on wlan0:
    • SSID: serial
    • Password: serialserial
    • AP IP: 192.168.4.1/24
    • DHCP range: 192.168.4.10 to 192.168.4.200
  • Web portal is available on port 80:
    • / WiFi scan + connect UI
    • /serial live serial console (SSE via /events/serial)
  • ESP32 serial bridge:
    • Auto-detects /dev/ttyUSB*, /dev/ttyACM*, /dev/serial/by-id/*
    • Reconnects automatically on unplug/replug
    • Daily log rollover at midnight with datetime filename
  • Once internet is available, NTP sync runs and writes corrected time back to RTC (hwclock -w).

Runtime check commands:

systemctl status serial-bridge
journalctl -u serial-bridge -f
ip a show wlan0
ls -l /home/pi/xxx.log /home/pi/xxx_*.log
sudo hwclock -r

RTC GPIO Wiring (Raspberry Pi Zero W)

Use I2C1 pins on the 40-pin header:

RTC module pin Raspberry Pi pin BCM GPIO Notes
VCC Pin 1 3V3 Use 3.3V
GND Pin 6 GND Common ground
SDA Pin 3 GPIO2 (SDA1) I2C data
SCL Pin 5 GPIO3 (SCL1) I2C clock

Minimal pin marker (header top):

Pin 1 (3V3)   Pin 2 (5V)
Pin 3 (SDA1)  Pin 4 (5V)
Pin 5 (SCL1)  Pin 6 (GND)

Enable I2C + RTC overlay (example DS3231):

sudo raspi-config nonint do_i2c 0
echo 'dtoverlay=i2c-rtc,ds3231' | sudo tee -a /boot/firmware/config.txt
sudo reboot

Verify:

ls -l /dev/rtc0
sudo i2cdetect -y 1
sudo hwclock -r

Quick install (on Raspberry Pi)

chmod +x install.sh
sudo ./install.sh

Then reboot:

sudo reboot