Recently, a Maplins kit of all sorts of LED segment displays and a LCD screen came into my possession, a fairly interesting array of components are in this bag, so I started to play around with them as there was no instruction manual.
Here’s the kit if anyone’s interested in picking one up:
Counting Devices on the Local Network and Displaying Them on Our Display:
So, with little knowledge of the GPIO ports or their correlation with raspbian’s gpio command line utility, I rigged up the 7-segment display to my Pi with the use of a breadboard and a gpio breakout cable, here’s a similar kit available from Adafruit: https://www.adafruit.com/products/914
Here’s my notes from plugging in the 7 segment display:
And here’s the final product:

(ignore the random transistor)
You can power either the 3rd pin or the 8th pin, depending on aesthetics, as you can see I chose the 8th pin. Remember to use a ±330ohm transistor between the 3.3v power pin and the 8/3 pin on the 7 segment display or you’ll blow it!
Now for the software side:
You’ll want to install the python Raspberry Pi GPIO command line utility via the following method:
apt-get update && apt-get install python-rpi.gpio arp-scan
Once this is finished, you can run the below (very simple, I just threw it together) bash script (use sudo!) which will show the number of devices on your network on your 7 segment display!
for i in 6 7 8 9 10 11 12 13; do gpio write $i 1; done while true; do case $arp in 1 ) if [ "$arp" = "1" ] then for i in 7 9; do gpio write $i 0; done else echo "" fi ;; 2 ) if [ "$arp" = "2" ] then for i in 8 9 10 11 12; do gpio write $i 0; done else echo "" fi ;; 3 ) if [ "$arp" = "3" ] then for i in 7 8 9 11 12; do gpio write $i 0; done else echo "" fi ;; 4 ) if [ "$arp" = "4" ] then for i in 7 9 12 13; do gpio write $i 0; done else echo "" fi ;; 5 ) if [ "$arp" = "5" ] then for i in 7 8 11 12 13; do gpio write $i 0; done else echo "" fi ;; 6 ) if [ "$arp" = "6" ] then for i in 7 10 11 12 13; do gpio write $i 0; done else echo "" fi ;; 7 ) if [ "$arp" = "7" ] then for i in 7 8 9; do gpio write $i 0; done else echo "" fi ;; 8 ) if [ "$arp" = "8" ] then for i in 7 8 9 10 11 12 13; do gpio write $i 0; done else echo "" fi ;; 9 ) if [ "$arp" = "9" ] then for i in 7 8 9 12 13; do gpio write $i 0; done else echo "" fi ;; 10 ) if [ "$arp" > "9" ] then for i in 12; do gpio write $i 0; sleep 0.5; gpio write $i 1; done else echo "" fi ;; esac arp=$(expr `arp-scan -l | wc -l` - 5 &) sleep 30 for i in 6; do gpio write $i 1 sleep 0.5 gpio write $i 0 sleep 0.5 gpio write $i 1 sleep 0.5 gpio write $i 0 sleep 0.5 gpio write $i 1 sleep 0.5 gpio write $i 0 for i in 6 7 8 9 10 11 12 13; do gpio write $i 1; done done done
