www.NewsDownload.co.uk Page 30

Raspberry Pi Network Connectivity LED

2016-09-12 10:00 By Jason Birch

Indicate the current network connectivity status, to either the local router or the public internet, with an LED.

VIDEO
The video here demonstrates the project which this article describes how to build.

The article breaks the project down into several stages:

  • Hardware
  • Software
  • Install

Hardware
The hardware is simply lighting an LED via a transistor.

LED Status Indicator

Software
The software is a single shell script. The script uses GPIO pin 14 to drive an LED to indicate the network connectivity status. If you want to change to an alternate GPIO pin, all instances of the number 14 must be replaced in the script where they refer to the GPIO, to the alternate GPIO number.

The script performs a simple ping of the specified network address, if the ping fails, the LED indicator is switched off and a re-connection to the network is tried. If the ping succeeds, the LED indicator is switched on.

The script has a line:
sleep 15

Which checks the network for connectivity every 15 seconds, this value can be changed to check more or less frequently.

Install
The script can be run at boot by adding the following cron entry, replace [IP_ADDRESS] with the IP address of your router or a public web site URL:
sudo cp RPiNetUpLED.sh /root/
sudo crontab -e
@reboot ./RPiNetUpLED.sh [IP_ADDRESS]

Tested
 Raspberry Pi (Original)
 Raspberry Pi 2
 Raspberry Pi 3

GIT Source Code Repository
V1.00 2016-09-12 - Raspberry Pi Network Status Indicator.

GIT Repository Here.

Loading...