MM5451 LED display driver connected to Raspeberry Pi
Fig. 1

Connect-Program Raspberry Pi MM5451 LED Display Driver

by Lewis Loflin


Raspberry Pi and a MM5451 LED Display Driver on YouTube

The subject here is connecting the Raspberry Pi to a MM5451 LED display driver. This is written in Python to demonstrate bitwise programming and shift register operation.

Using only two input pins (clock and data) for serial date input produces 35 open drain outputs. The 35 outputs are 15mA sink. The MM5451 comes in a 40 pin DIP package as used here.

Internal current generator eliminates need for external resistors and has continuous brightness control. Wide supply voltage up to 13.2V - inputs TTL level.

MM5452 pin connections.
MM5451 block diagram.

A single pin controls the LED display brightness by setting a reference current through a variable resistor connected to VDD or to a separate supply of 13.2V maximum.

The M5451 are specially designed to operate 4 or 5-digit alphanumeric displays with minimal interface with the display and the data source. Serial data transfer from the data source to the display driver is accomplished with 2 signals, serial data and clock.

Using a format of a leading "1" followed by the 35 data bits allows data transfer without an additional load signal. The 35 data bits are latched after the 36th bit is complete, thus providing non-multiplexed, direct drive to the display(s).

Note: these are open drain outputs that switch to ground when the associated bit is HIGH. Outputs change only if the serial data bits differ from the previous time.

Display brightness is determined by control of the output current LED displays. A 0.001uF capacitor should be connected to brightness control, pin 19, to prevent possible oscillations.

Connecting to Raspberry Pi

Fig. 1 shows the two connections to Raspberry Pi. MM5451 pins 11-18 (Bits 0-7) are connected to a LN516YA common-anode display (schematic). Bit 1 is segment a. 8-LEDs are connected to pins 3-10 - all anodes go to Vcc of 5V. Note no current limiting resistors are required.

Segment code for the LN516YA is stored in array segCode where segCode[0] displays 0, etc. There are two serial shift routines ssrWriteMSB(value) and ssrWriteLSB(value) used based on the viewing angle of the LEDs. Note routines zeroWrite() and pulseCLK().

Within the "for" loop the sequence starts by placing a HIGH (1) in the data pin then sending a clock pulse. Next myCount using a modulus function with 10 is shifted out to the MM5551 then the binary count itself is shift out.

That is only 16-bits but we must have 36 clock cycles before the data will be latched to the 35 output pins. (Bit 36 is not output!) Routine zeroWrite(21) takes care the remaining bits need (I set this to 0s) to enable the internal latch function.

The value of 21 used here is based on 36 - 16 bits used which is 20: the Python for loop counts from zero so it's 20 + 1. This value changes based on bits shifted in.

As the program runs we get a binary count on the LEDs and 0-9 on the display.

#!/usr/bin/env python
# File

# for driving common anode displays
# brightness control eliminates need for resistors
# Vcc 4.75 - 13V

# 7-segment common anode display connected bits 1-8
# 8 LEDs bits 9-16 common anodes

# access to GPIO must be through root
import RPi.GPIO as GPIO
import time

CLK =12
dataBit = 7

GPIO.setup(CLK, GPIO.OUT) # P1 
GPIO.setup(dataBit, GPIO.OUT) # P7 

# Setup IO
GPIO.output(dataBit, 0)
GPIO.output(CLK, 0)

def pulseCLK():
    GPIO.output(CLK, 1)
    GPIO.output(CLK, 0)

# LSB out first!
def ssrWriteLSB(value):
    for  x in range(0,8):
        temp = value & 0x01
        if temp == 0x01:
           GPIO.output(dataBit, 1) # data bit HIGH
           GPIO.output(dataBit, 0) # data bit LOW
        value = value >> 0x01 # shift left
# MSB out first!
def ssrWriteMSB(value):
    for  x in range(0,8):
        temp = value & 0x80
        if temp == 0x80:
           GPIO.output(dataBit, 1) # data bit HIGH
           GPIO.output(dataBit, 0) # data bit LOW
        value = value << 0x01 # shift left

def zeroWrite(num1):
	GPIO.output(dataBit, 0) # data bit HIGH
	for  x in range(0, num1):

GPIO.output(dataBit, 1) # data bit HIGH

# 7-segment display code array
segCode =[ 0b00111111, 0b00000110, 0b01011011, 0b01001111, 
0b01100110, 0b01101101, 0b01111101, 0b00000111, 0b01111111, 
0b01100111 ]

for myCount in range(0, 256):
		# start bit
		GPIO.output(dataBit, 1)
		# the "+ 0x80" turns on DP
		ssrWriteLSB(segCode[myCount % 10]) # MOD myCount
		ssrWriteMSB(myCount) # 8 LEDs binary count 0-255
		zeroWrite(21) # pad remaining bits with 0s

print "Good by!"

Optical Isolation of H-Bridge Motor Controls YouTube
Optical Isolation of H-Bridge Motor Controls

Opto-Couplers Theory and Circuits YouTube
Opto-Isolated Transistor Drivers for Micro-Controllers

All NPN Transistor H-Bridge Motor Control YouTube
All NPN Transistor H-Bridge Motor Control

Pulse-Width Modulation Tutorial YouTube
Pulse-Width Modulation Tutorial

PIC12F683 Microcontroller and Circuits YouTube
PIC12F683 Microcontroller and Circuits