Skip to content

Visual internet connection monitor for Google WiFi running OpenWrt. Real-time LED color indicators based on latency: green (fast), yellow (medium), red (slow), black (offline).

Notifications You must be signed in to change notification settings

emahdij/google-wifi-openwrt-internet-led

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

1 Commit
 
 
 
 

Repository files navigation

Internet LED Monitor for OpenWrt

A simple script that turns your Google WiFi LED into a real-time internet connection monitor.

What it does: Checks your internet latency every 30 seconds and changes the LED color accordingly. Green = fast, yellow = medium, red = slow, dim black = no connection.

Why?

Because I wanted to see my internet quality at a glance without opening a terminal. Plus, it looks cool.

LED Colors

Color What it means
🟢 Green Fast connection (configurable, default 0-250ms)
🟡 Yellow Medium (default 250-500ms)
🟠 Orange Slow (default 500-1000ms)
🔴 Red Very slow (1000ms+)
Dim black No internet

The LED blinks when there's network traffic. If it's solid, something's wrong (no connection or LED error).

Installation

1. Copy to your router

scp internet_connection_led.sh root@192.168.1.1:/usr/bin/
ssh root@192.168.1.1
chmod +x /usr/bin/internet_connection_led.sh

2. Test it

/usr/bin/internet_connection_led.sh

You should see the LED change color based on your connection. Press Ctrl+C to stop.

3. Make it run on startup

Create an init.d service:

cat > /etc/init.d/internet_led << 'EOF'
#!/bin/sh /etc/rc.common

START=99
STOP=10
USE_PROCD=1

start_service() {
    procd_open_instance
    procd_set_param command /usr/bin/internet_connection_led.sh
    procd_set_param respawn
    procd_close_instance
}
EOF

chmod +x /etc/init.d/internet_led
/etc/init.d/internet_led enable
/etc/init.d/internet_led start

Configuration

Edit these variables at the top of the script:

CHECK_INTERVAL=30  # How often to check (seconds)
TEST_URLS="https://www.google.com https://1.1.1.1 https://www.cloudflare.com"
DEBUG=0  # Set to 1 to enable debug logs

# Color thresholds (milliseconds)
EXCELLENT_MAX=250  # 0-250ms: Green
GOOD_MAX=500       # 250-500ms: Green → Yellow
MEDIUM_MAX=1000    # 500-1000ms: Yellow → Orange
# 1000ms+: Orange → Red

Example: If you have a slower connection and want green up to 500ms:

EXCELLENT_MAX=500
GOOD_MAX=1000
MEDIUM_MAX=2000

How it works

  1. Tests connection to multiple URLs (google.com, 1.1.1.1, cloudflare.com)
  2. Measures latency using curl's built-in timer
  3. Calculates a smooth color gradient based on latency
  4. Sets LED color + makes it blink on network activity

Customization

Change LED paths

If your device uses different LED paths, edit lines 5-7:

LED_RED="/sys/class/leds/LED0_Red"
LED_GREEN="/sys/class/leds/LED0_Green"
LED_BLUE="/sys/class/leds/LED0_Blue"

Find your LED paths:

ls /sys/class/leds/

Troubleshooting

LED doesn't change?

  • Check LED paths: ls /sys/class/leds/
  • Look for errors: logread | grep "ERROR.*Internet LED"
  • Enable debug: Set DEBUG=1 in the script

Showing "no connection" but internet works?

  • Test URLs might be blocked
  • Change TEST_URLS to sites you can reach

LED shows wrong color?

  • Check actual latency: ping 1.1.1.1
  • Compare with script logs: logread | grep "Internet LED"

Debug Mode

The script logs everything when DEBUG=1:

logread -f | grep "Internet LED"

You'll see:

  • Which URLs it's testing
  • HTTP response codes
  • Calculated latency
  • Color mappings
  • Any errors

Features

  • ✅ Dynamic color gradient (not fixed buckets)
  • ✅ Blinking LED shows network activity
  • ✅ Multiple URL fallbacks
  • ✅ Exponential backoff on failures
  • ✅ Proper cleanup on exit
  • ✅ Error detection and handling
  • ✅ Works on old busybox systems

Technical Details

  • Uses curl's %{time_total} for accurate timing
  • Falls back to wget if curl fails
  • Measures full request time (DNS + TCP + TLS + HTTP)
  • LED trigger order matters: set trigger before brightness
  • Validates LED paths at startup

About

Visual internet connection monitor for Google WiFi running OpenWrt. Real-time LED color indicators based on latency: green (fast), yellow (medium), red (slow), black (offline).

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages