Retro 4-digit LED Display

So I have the 4-digit LED Display, is it possible to connect it to the pi directly or do I need other things like the Arduino?

I have no clue where to start with this ;-)

1 Like

You’ll want to limit the current somewhat, thankfully the retro LED displays don’t need a lot of power (so GPIO power will be plenty to drive it).

We should probably put together a full tutorial… @gadgetoid? ;-)

If I’m not totally mistaken, I actually have a tutorial for just this in the works. It uses some serial-in-parallel-out Shift Registers and a Darlington Array ( ULN2003 if I remember correctly ) so that the display can be driven from 5 pins ( 3 data, 1 power, 1 ground ).

While this is probably the technically correct way of driving it, you can do it by pulling pins up and down with a mess of inline resistors.

Fully-lit and on solid it would use about 140mA on paper, this is more than the Pi is capable of supplying ( 50mA? ).

If you want to be a tutorial test-subject, give me a shout and I’ll see if I haven’t imagined it!

Hit me dude! Happy to help!

Well, I did have a guide in the works… but it’s missing the crucial component; the wiring diagram. Without this it’s pretty useless; although it does have some handy pin-out diagrams for the components.

I might have some good photos of my wiring knocking about that could help- it’s complex, but over-engineering is fun!

1 Like

Ship it!

At the very least I get stuck but then its all about the learning process

Hi Phil!

I see the 140mA has been calculated using the absolute maximum rating of 5mA per segment. Much less is actually enough to make the displays readable, i’m using an average current of 0.4mA per segment and the display is perfectly readable. And in the datasheet they’ve used 1mA per segment to do the brightness measurements.

Perhaps this could be mentioned at the Pimoroni shop product page too, from reading the page people might think that 5mA is required to run the display, while it’s actually the absolute maximum that the display can take before catching on fire or something :smiley:

Cheers :smile:
-Niko

1 Like

Thanks Niko!

Sounds like running directly off the Pi is entirely practical then, is this what you’re doing?

It occurs to me that I forgot that it’s physically possible, but completely undesirable to run all 4 digits simultaneously- so you’d only ever actually be lighting a total of 7 segments ( and decimal ) at once in a multiplexing fashion. So, yeah, it’s well below the Pi’s ability to supply current, but I don’t know anything about sinking it…

( I should caveat everything I say with: I am not an electrical engineer ;) )

I’m running 2 of the retro displays off of 3V3 GPIOs from an ATxmega8E5 chip, but running off of a Pi should function exactly the same. You just need 8 resistors on the anode lines and 12 GPIOs for one display. Adding an extra display doesn’t require extra resistors, and only requires 4 more GPIO lines for sinking current from the extra 4 digits.

On the Pi you can setup the GPIO pins to tolerate a source/sink current of 16mA per pin[1]. As the sink current can be from all 8 segments[2] of a single digit at a time, a single segment current should be 16 / 8 = 2mA. So you’d need to pick the 8 resistors on the display anode lines such, that the current allowed to pass is 2mA. If we assume that the voltage drop is 0.5V at the Pi SOC and 1.6V at the display, you should use (3.3V-0.5V-1.6V) / 0.002A = 600ohm (or higher) resistors on the anodes.

Either way, it’s perfectly possible to run the display off of Pi’s GPIO :)

[1] http://www.scribd.com/doc/101830961/GPIO-Pads-Control2
[2] That’s 7 number segments+1 decimal point segment

Gadgetoid? any news?

Another vote for a tutorial on this, please :-)

found this the other day http://learn.pimoroni.com/driving-a-4-digit-7-segment-display.html

Okay okay! I’m making it a 170pt project! Driven directly off the Pi with 680ohm resistors and no Darlington Arrays or Shift Registers!

Thanks @monkeymademe, thanks @gadgetoid :D

Got it hooked up and working. It all fits on the extended part of the A+ or B+ header, minus the dot which you need an extra pin for.

I’ve used BCM pins 0, 1, 5 and 6 for the Cathodes ( see my pinout diagram for details of where those are ) and pins 12, 13, 19, 16, 26, 20 and 21 for the Anodes.

To drive it, you need to set a Cathode as an output and drive it LOW:

GPIO.setup(0, GPIO.out, initial=GPIO.HIGH)
GPIO.output(0, GPIO.low)

And set an Anode as an output and drive it HIGH:

GPIO.setup(12, GPIO.out, initial=GPIO.LOW)
GPIO.output(12, GPIO.HIGH)

You can set them up easily like so:

for segment in [12, 13, 19, 16, 26, 20, 21]:
    GPIO.setup(segment, GPIO.out, initial=GPIO.LOW)
for digit in [0,1,5,6]:
    GPIO.setup(digit, GPIO.out, initial=GPIO.HIGH)

Then you can map letters as 8-bit binary numbers and display t hem like so:

‘’‘
1 Bottom
2 Top
4 Bottom Left
8 Top Left
16 Middle
32 Top Right
64 Bottom Right
128 Decimal
’’'
letters = {
‘a’: 0b01111110,
‘b’: 0b01111111,
‘c’: 0b00001111,
‘d’: 0b01101111,
‘e’: 0b00011111
}

segments = [12, 13, 19, 16, 26, 20, 21]

def display_letter(letter):
  '''
  Displays a letter represented as
  a single number from 0-255
  '''
  for bit, segment in enumerate(segments):
    if (1<<bit) & letter:
      GPIO.output(segment,1)
    else:
      GPIO.output(segment,0)

display_letter(letters['d'])

And display a digit one at a time like so:

digits = [0,1,5,6]
def display_digit(digit):
  for other in digits:
    GPIO.output(other,1)
  GPIO.output(digit,0)

display_digit(1)

Although there are better ways to do that, depending on what you’re showing and how!

Oh and I used 680ohm resistors, as I had them handy!

can you show us your wiring?

pictures or it did not happen ;-)

Here’s the layout. All of the connections on the left are Anodes ( Segments ) and the 4 on the right are Cathodes ( Digits ).

If you want to run 2 or more, simply copy this layout and bridge all of the Anode connections from one breadboard to another. Each Cathode will need its own pin.

Thanks very much for this, @gadgetoid. I’ve wired this up, with jump leads, but I need to buy some resistors - you used 680 ohm as you had them handy, do you happen to know what would be ideal? (as I’m buying them especially, I may as well buy the ones to match).

Thanks again.

Btw would the Slice of Pi/o work with this?

http://shop.ciseco.co.uk/k002-slice-of-pi-o/

OK, I’m going to go for around 390 ohm, based on this (I know nothing about electronics, but I just plugged in the numbers from the LED data sheet), http://led.linear1.org/1led.wiz?VS=3.3;VF=1.6;ID=5