Introduction: NODEMCU LUA Driving a M5450B7 LED Display Driver IC
The M5450B7 is a 40 Pin DIP LED display driver IC.
It looks rather a beast, but it is relatively easy to control and program.
There are 34 output pins that can have a LED connected to each one.
The device sinks current rather than supplies it so the cathode of the LED needs to be connected to a pin and 5V supplied to the anode. The device also takes care of the current supplied to the LEDs.
The device is usually used to control 4 or 5 digit alpha numeric LED displays, but there are many other things you can do with it.
Here is a simple example of what the device can do.
Step 1: Connecting the Device
The M5450 can be set up on a breadboard or you can construct something similar to what I have done below.
- Connect pin 1 Vss and pin 23 Data Enable to Gnd,
- Connect pin 20 to 5V,
- Connect pin 19 to 5V through a resistor (I used 200 Ohms)
- A 1nF capacitor should be connected to brightness control, pins 19 & 20, to prevent possible oscillations.
- Connect CLOCK IN to D1 of ESP8266
- Connect DATA IN to D2 of ESP8266
I have used a WeMos to drive my board as it has a 5V supply, the device will also run at 3.3V although the LEDs are not as bright. Any ESP8266 should be able to drive the M5450 device.
I also used the PC USB supply to drive the device without any additional power supply.
You can use any of the ESP8266 pins to connect the device, if you change the supplied program accordingly.
Step 2: My Board
The board is quite easy to construct, but there is lots of soldering to do!
Using the rectangular LEDs means that you can group them close together.
Step 3: Software
The device is quite easy to program as it only has 2 inputs - CLOCK IN & DATA IN.
No libraries need to be downloaded or installed to make the device work.
Set D1 & D2 to ouputs on the ESP8266.
You take D1 the clock pin HIGH, put the data (HIGH or LOW) on pin D2 and take the clock pin LOW again. Do this 36 times and the device is programmed. You don't need a timer delay between the 2 clock transitions, the device can keep up with the ESP8266.
for i = 0, 35 do gpio.write(clock,gpio.HIGH) gpio.write(data,buffer[i]) gpio.write(clock,gpio.LOW) end
buffer needs to be set to 1 or HIGH for the device to work.
The device latches when it gets the correct number of data bits and sends the information to the outputs
The diagram (above) shows how the device should be programmed. I am not brilliant with datasheets, but my interpretation of it does work.
Step 4: LUA Program
I have written the program with functions.
random() - Turns on and off random LEDs
chaser() - 3 LEDs light chaser
allOnOff() - Turns all LEDs on and then off
arrayFill() - Loads a pre defined pattern of LEDs into the IC
The 4 examples included are pretty self explanatory.
Step 5: Conclusion
I have tried to show how easy it is to interface devices to the ESP8266.
I originally used my board with an Arduino and wondered if I could drive it with an ESP8266.
You don't need to connect so many LEDs as I have, but your program still needs to send the 36 elements of data to the device.