Tested on:Raspberry Pi 2; Raspberry Pi B+; Python 2.7; Raspbian pre Jessie
Prerequisites:Raspberry Pi with Raspbian Jessie and internet connection (see steps 1-7 in the Introduction)
Hardware:8 LEDs and fitting resistors
9 jumper cables
Soldering equipment, stripe board
1

Building a simple LED display

Sometimes, it’s very comfortable to have the possibility to display simple numerical values on the Raspberry Pi without attaching a screen.
The display presented in this tutorial is cheap, easily assembled, supports binary and decimal counting and can be used to display things like signal strength, data transmission, internal states and similar.

Circuit Diagram
Here is the circuit diagram for a simple 8-LED display. It’s important to select the resistors by the chosen LEDs type- use a LED calculator if unsure. From the top, the LEDs are connected to the Raspberry Pi pins 10, 11, 15, 16, 32, 33, 35 and 36 in BOARD numbering.

LED display Breadboard

The breadboard circuit of the LED display

LED display assembled
This is the LED display, assembled on a stripe board. The pin connectors were soldered to the bottom to keep the top clean. Sugru is perfect for isolating the bottom.

LED Display top and bottom

LED Display top and bottom

Usage
The display is useful to represent simple data like signal strength or wifi data transmission. For accessing a wide array of values, the display could either show a decimal number <= 8 or a binary number <= 255. Download the script with

and execute it with

Code explained
Interestingly, GPIO.output not only accepts a single pin to trigger, but a list of pins as well:

The only difficutly is converting a decimal number to a pin list representing its binary value. First, transform the number to a bitstring:

Then, select only the pins which have a 1 in the bitstring with

and pins being

The complete script
Click on Full Script to show all of the code.

Count binary
Here is a little demonstration of the LED display in action:

Links
LED resistance calculator: http://ledcalc.com/
Sugru Website: http://www.sugru.com

Knight of Pi

Johannes Bergs aka Knight of Pi. Diploma in Bioinformatics, some Webdesign and Python coding then. Living in the beautiful city of Vienna.

One Comment

  1. hi, that’s grate
    i make this project, but not work for long time. after some minutes program stopped.

Comment

Time limit is exhausted. Please reload CAPTCHA.