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.
Because I wanted to see my internet quality at a glance without opening a terminal. Plus, it looks cool.
| 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).
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/usr/bin/internet_connection_led.shYou should see the LED change color based on your connection. Press Ctrl+C to stop.
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 startEdit 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 → RedExample: If you have a slower connection and want green up to 500ms:
EXCELLENT_MAX=500
GOOD_MAX=1000
MEDIUM_MAX=2000- Tests connection to multiple URLs (google.com, 1.1.1.1, cloudflare.com)
- Measures latency using curl's built-in timer
- Calculates a smooth color gradient based on latency
- Sets LED color + makes it blink on network activity
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/LED doesn't change?
- Check LED paths:
ls /sys/class/leds/ - Look for errors:
logread | grep "ERROR.*Internet LED" - Enable debug: Set
DEBUG=1in the script
Showing "no connection" but internet works?
- Test URLs might be blocked
- Change
TEST_URLSto sites you can reach
LED shows wrong color?
- Check actual latency:
ping 1.1.1.1 - Compare with script logs:
logread | grep "Internet LED"
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
- ✅ 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
- 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