Tuesday, 28 February 2017

Retro LED Displays

I recently brought some of these rather nice Texas Instruments TIL311 hexadecimal displays from eBay, they are really small but beautiful.  This got me thinking, could I connect one of these displays to a micro:bit.  

TIL311 Displays















Looking at the TIL311 datasheet, I came across the first hurdle.  The TIL311 is a TTL device and needs 5v to work but the micro:bit runs at 3.3v so I needed a level shifter / buffer IC to interface between them, you could probably get away without a level shifter but I aired on the safe side. I chose the 74HCT244N but I used a 74HC244N as this is what I had in stock.


The TIL311 has a 4-bit data input A,B,C,D  which I connected to pins 0,1,2 & 8 on the micro:bit via a 74HCT244N and used separate 5v supply for the display.  To figure out how to display 0 to 9 I looked at the truth table for a 7490 decade counter and then replicated this in Python by turning the outputs on and off.



















The finished project






My rather noddy Python code, I'm sure there must be a neater way of doing this.


  1. from microbit import *
  2. pins = [pin0, pin1, pin2, pin8]
  3. while True:
  4.     0#
  5.     pin0.write_digital(0)
  6.     pin1.write_digital(0)
  7.     pin2.write_digital(0)
  8.     pin8.write_digital(0)
  9.     1#
  10.     pin0.write_digital(1)
  11.     pin1.write_digital(0)
  12.     pin2.write_digital(0)
  13.     pin8.write_digital(0)
  14.     sleep(500)
  15.     2#
  16.     pin0.write_digital(0)
  17.     pin1.write_digital(1)
  18.     pin2.write_digital(0)
  19.     pin8.write_digital(0)
  20.     sleep(500)
  21.     3#
  22.     pin0.write_digital(1)
  23.     pin1.write_digital(1)
  24.     pin2.write_digital(0)
  25.     pin8.write_digital(0)
  26.     sleep(500)
  27.     4#
  28.     pin0.write_digital(0)
  29.     pin1.write_digital(0)
  30.     pin2.write_digital(1)
  31.     pin8.write_digital(0)
  32.     sleep(500)
  33.     5#
  34.     pin0.write_digital(1)
  35.     pin1.write_digital(0)
  36.     pin2.write_digital(1)
  37.     pin8.write_digital(0)
  38.     sleep(500)
  39.     6#
  40.     pin0.write_digital(0)
  41.     pin1.write_digital(1)
  42.     pin2.write_digital(1)
  43.     pin8.write_digital(0)
  44.     sleep(500)
  45.     7#
  46.     pin0.write_digital(1)
  47.     pin1.write_digital(1)
  48.     pin2.write_digital(1)
  49.     pin8.write_digital(0)
  50.     sleep(500)
  51.     8#
  52.     pin0.write_digital(0)
  53.     pin1.write_digital(0)
  54.     pin2.write_digital(0)
  55.     pin8.write_digital(1)
  56.     sleep(500)
  57.     9#
  58.     pin0.write_digital(1)
  59.     pin1.write_digital(0)
  60.     pin2.write_digital(0)
  61.     pin8.write_digital(1)
  62.     sleep(500)