I finally got round to finishing the improved version of my earlier pong clock which used two single colour 16×24 led modules with a built in controller. This version can display 3 colours and has several different modes to the earlier version and also it can display scrolling graphics from the popular retro game, pac-man. I’m calling this an arcade game clock as the main mode is pong and is inspired by old late 70’s and early 80’s arcade machine games. The case I originally was going to use got damaged but I’ve managed to put the prototype into an Ikea deep photo frame instead.
Now on to the electronics and in particular the LED modules I used. They are kind of standard but nothing like you would typically find on ebay however the firmware can be adapted to work with standard HUB75 1/8 scan modules. Unlike the modules used in the previous clock they do not have a built in controller and all multiplexing etc has to be done in software.
The LED modules used for the project
Now forgive me for this section being rather lengthy but the LED modules I used were salvaged and not completely standard. They are outdoor LED modules and unlike newer LED modules that use a single LED with seperate red, green and blue LED chips in them this uses individual LED’s for each colour tightly spaced together. This is the norm for high brightness outdoor displays as typically each module is just one part of a much larger display that will be viewed at a distance. Close up they don’t work so well compared to the single LED types. But I got them for nothing so I thought I’d see how they work and if they can be used for anything. The capacitors have domed tops as well suggesting that they have overheated or are poor quality. Due to this the modules cannot be sold and the capacitors are not easily replaced. I’ve been playing with the modules for 2 years and they have been fine though.
RGB LED modules that are sizes 16×32, 32×32 and 32×64 use a common interface standard HUB75. This isn’t a very well documented standard and there are some variations in how the displays are scanned. Data sheets and timing diagrams are almost always required from the manufacturer unless they way they work can be reverse engineered or figured out by trial and error. There are also HUB08 and HUB12 panels which also have virtually no documentation. Typically I’ve found that these are for single and dual colour modules and work on 1/4 scanning. The modules I have used are actually HUB75 RGB compatible but only two LED colours are used. As you can guess they have no datasheet.
Doing some research common scan rates are 1/4, 1/8 and 1/16. This means the number of lines that are lit at any one time. For a 16×32 LED matrix a 1/4 scan display will have a 4 lines lit at once and is favoured for outdoor modules due to the faster scanning and therefore higher brightnesses can be achieved. The disadvantage is high power consumption. 1/8 scan displays have 2 lines lit at any one time and 1/16 modules only have one lit at any one time. 1/16 scan is the slowest rate but least power hungry and is typically used for single colour modules. As you can see 1/8 scan is a nice balance between power consumption and brightness.
Now to explain further the displays are split into two halves of 8×32 LED’s. For a 1/8 scan module lines 1 & 9 will be scanned then lines 2 & 10 until lines 8 & 16 are reached then the process repeats. There are separate data pins for each half (in a colour module typically labelled R1,G1,B1 & R2,G2,B2) but the latch, clock and enable lines are common to both halves. Most addressing of the lines are sent to the display in Binary Coded Decimal so for a 16×32 LED matrix the address lines will be labelled A,B,C as the display controller will only need to count from 0-7 so only 3 lines are needed.
This is a easy way to tell what type of panel you have. 1/4 scan displays will only have A & B address lines, 1/8 will have A,B & C and then finally 1/16 scan modules will have 4 address lines labelled A,B,C & D. Larger 32 line tall displays will have a fifth address line, E. There is a caveat here though as some modules clock the data in differently. Some scan it in a zig-zag pattern across the display e.g the first 8 bits are line 1 then the next 8 bits are line 8 then it jumps back up to line 1 for the next 8 bits. Others scan a whole line of 32 LED’s then move on to the next line. Another caveat is the output enable pin can be either active low or active high.
Update: I’m now aware of HUB75B standard panels that have 3 address lines (16×32) and use 1/4 scan but scan the data in a zigzag (snake) pattern rather than row by row. These seem to be the new standard and a modified library has been made for such displays. See here https://forum.arduino.cc/index.php?topic=503416.0 and here https://forum.arduino.cc/index.php?topic=310346.0 if you have one of these newer displays.
So you can see that the HUBxx standards are only loose standards and documentation is hard to find. I used the Adafruit RGBmatrixPanel library which works with 1/8 scan HUB75 modules. This library is obviously designed to drive RGB modules but it worked fine with my modules simply by connecting R1 and R2 as you would normally Y1 and Y2 to G1 and G2 and then leave the pins on the arduino for B1 and B2 unconnected. On my modules I would send green if I wanted it to display yellow; this is simply because what would be green LED’s on the module are actually yellow.
Finally, HUBxx standard modules use a 16 pin header. Mine does not although it is electrically compatible. Fortunately the pinout was shown on the matrix’s PCB of what goes where. Some lines were labelled different such as CLR (underlined to indicate active low) is actually output enable, typically labelled just OE on other modules.
The controller board
I used an ATMega2560 for this project as the matrixes require a lot of RAM. 1.5Kb to be precise for double buffer mode which is recommended otherwise the display will be very flickery. Add another 1kb of SRAM for your code and you have run out of SRAM on your Arduino uno. Also the program takes up 41kB of flash space so it’s unsuitable for a basic Arduino. You could try other microcontrollers such as the ATmega644PU or ATmega 1280 but this hasn’t been tested and the code will need to be adapted. Some of the display driver is written in assembly language and only supports ATmega328 and 1280/2560.
I used a cheap Arduino 2560 pro clone board as soldering the bare mega2560 onto a custom PCB would have been a nightmare. This was the simplest and cheapest option rather than designing my own PCB. The clone board was soldered to a matrix board and required components added such as the DC-DC converter. I didn’t use the onboard regulator on the pro board as it just got too hot. I used a switching 7805 drop in replacement regulator instead. The controller also supports an optional seven segment display that comes on when the main module is turned off. In my code this is done automatically between 11pm and 6am and can be turned on and off by pushbuttons.
Unfortunately I didn’t make a schematic as the connections are shown in the code and this project, for now is just a one-off. The 7 segment display is a common anode type and uses PNP transistors on the digit pins. 82 ohm resistors were used for the current limiting resistors. If you want to learn how the seven segment displays are multiplexed, check out this article.
The case
Originally I had purchased a 3.75″ deep photo frame to house the project but that got broken. Instead I used an Ikea frame and made it deeper by adding some self adhesive trunking onto the rear. I then mounted the electronics onto a plastic plate and then screwed that to the frame. I then used the original back cover to fit over the exposed PCB. A 3A 12V AC adaptor provides power to the clock. I will possibly re-case it if the clock is going to be used as intended or maybe keep as something to mess around with. Maybe even get a proper RGB matrix and modify it accordingly.
The source code & demo video
Here is the source code which is a heavily modified mish mash of various snippets of code from various incarnations of the pong clock. Credits listed in the code.
Finally here is a video of it working.
please sir, how can I do this project using DMD led display instead of using the
module you’re using.. how about 4in 1 display that uses max7219 as its driver, please help.
Hi,
the Max7219 uses a completely different library and also it is in itself a matrix controller chip. This program does all the multiplexing and display control in software where the Max7219 does this internally; it just needs to be sent the data to be displayed.
It would need significant changes to the code, practically a re-write from scratch. Take a look at my other pong clock project; that should be easier to adapt to a Max7219 but again it would need all the functions to be re-written depending on which library you use.
To be honest, the cost of the Max7219 chips and the LED modules would be much more than a colour HUB75 compatible module which are cheaply available. Just make sure it’s 1/8 scan and compatible with the adafruit library if you get one. There’s quite a few on ebay – you will need the 16×32 pixel version. Also if you buy that display you could connect up the blue and alter the colours displayed in the code. It’s set via the call set.matrixcolour333(7,3,0) where the numbers correspond to Red, Green and Blue with a brightness level from 1-7 (0 is off)
In the above example this sets red to maximum brightness and green to about half. Blue is set to off as it isn’t connected. Note that what would normally be green in the code is yellow due to the modules I used.
Hope this helps
Thanks sir for your concerns and quick
response to my question, please sir I really
love this project and I want to build it for
my self. the display HUB75 is not available
in where I am, what is available is 4in1 dot
matrix display using max7219, I know using
4 in 1 max7219 display I can connect it
together to achieve 16×32 display. please can
you modified the code for me for me to be
able to build this project on max7219
display, please sir help. thanks.
Hi it’s not that simple really. It would need a complete rewrite of most of the code and I don’t have any max7219 modules to test it with. It would take a lot of work to do and I don’t know if I could do it in a reasonable amount of time if at all. I only work on my electronics every now and then so don’t get much time. This took around 3 years off and on to put together. Maybe I could make another version but that would be in the far future if I did. I’ve enough clocks now lol. I will be putting some of the modules used for this project on eBay at some point depending on if people want one of my clocks or not. I’m doing more things now as I’m furloughed from work due to the lockdown and can finish some projects I started ages ago. I’m finishing a scrolling message board that uses the same hub75 modules at the moment. They may end up on eBay too.
However that being said, take a look at this version which uses modules with a built in controller. https://www.adrian-smith31.co.uk/blog/2018/12/mono-pong-clock/ it’s slightly cut down and does not display the animations. The modules for that may be easier to get where you are. They are sure electronics 24×16 modules using the ht1632 controller. The project is based on nicks clock and he made a smaller version that uses max7219 modules if you want to take a look how his code works https://123led.wordpress.com/mini-led-clock/
thanks, sir please can I have your WhatsApp number for better chat. thanks, but were can I get the hub75 compatible display. is it that hard to make it Max7219 compatible? in term of rewriting the code.?.
eBay is best to get the displays but if you get one make sure it’s compatible with the adafruit library. Such as this one https://www.ebay.co.uk/itm/263676913009
As for making a max7219 version, hard to say what it needs but it’s beyond my expertise at the moment. As I mentioned above it will need a lot of code rewrite.
I’m not that experienced in c++ yet. Not enough to tackle writing something like this from scratch. Programming & software is not something I do every day so I forget how to do things. Nick in the link in my previous post wrote the original code for the pong clock and he does have a cut down version running on a max7219 based display. You would have to take a look at his code and see how he is doing it and adapting it to your needs.
Also with a proper hub75 matrix rather than the oddball modules I used you could make a better version that has much more colours. Unless you are ok with a single colour version.
I don’t think I’ll be much more help in converting the code for a different type of display as I don’t know where to start myself.
thanks sir I really appreciate your efforts in making me a great and competent engineer, thanks for your quick responses, if I buy this one https://
http://www.ebay.co.uk/itm/263676913009
will this code works for me? No sir how about DMD P10 DISPLAY 16X32 module led display can you modify your cod to work on it?
That one I linked on eBay will work, yes and you will be able to use blue as well. I can only make 3 colours with the modules I used but with that module you will be able to mix red green and blue with 7 brightness levels for each primary colour to make a nice looking display with lots of colours. In my first post I put en example of how to change the colours. If you use it as is you will get a mix of red green and yellow.
The P10 modules tend to be 1/4 scan as they are intended for outdoor use with the larger “pixel” pitch. This library used in my project needs 1/8 scan with straight row by row scan pattern. You can tell by seeing how many address lines the module has. 1/4 has just A&B and 1/8 will have A,B & C. As I mentioned in my article there’s some loose HUBxx standards that are not documented well. If you do get a module make sure it comes with a data sheet. Otherwise a bit of reverse engineering will be required. That’s how I figured out mine. As well as address line differences some use active low for enable and some active high. The way the displays are scanned varies too. I’ve tried to explain the scan pattern in the article but with an unknown module it’s going to be trial and error with no guarantees it will work. I suggest you do a bit of research on how these modules work to better understand what I mean.
Someone did modify the adafruit library to work with such displays as that will be the only major change. Just swap the adafruitmatrix.cpp and .h files with the modified ones and then change the setup constructor in the main.cpp / .ino file then it should be good to go. It had lots of configuration options to cater for different scan patterns etc. I think I’ve a copy of it on my pc, I’ll look later. Part of that library is written in assembly for speed particularly the bit that writes to the microcontroller ports and I know nothing about assembly.
***Update***
That library I mentioned I may have is actually for the Rasperry Pi not Arduino. If you want to check it out which is worth doing as he explains how the displays work quite well the link is here. https://github.com/hzeller/rpi-rgb-led-matrix
But for this project there’s too many variations of these 16×32 HUBxx modules so to make life easier I’d just get a module that is known to work. If you don’t have much experience in programming you are really going to have a hard time trying to get another type of display to work. I can’t really do it for you. The DMD P10 display is just a generic name, is this a RGB module or dual colour or just single red colour?
However, if you do want to try something else check out these links that may be helpful:
https://forum.arduino.cc/index.php?topic=503416.0
https://www.sparkfun.com/news/2650
https://forum.arduino.cc/index.php?topic=310346.0
Digging around there are also 1/4 scan displays with 3 address lines which are gaining popularity. These are known as HUB75B standard. The data is scanned in a zigzag pattern (see last link, page 2 for explanation) rather than row by row. There’s a link where you can download the modified library but as I mentioned depending on the display you buy this may or may not work.
These new 1/4 scan modules seem to becoming more popular now as they have a higher brightness. But the older 1/8 scan modules are still available on ebay or from Adafruit directly.
please sir can I have your Whatsapp number
I don’t know how much more I can help, I’ve written quite detailed responses above and I can’t write a modified version for you. I can only point you in the right direction and this project is a bit of an oddball thing I cobbled together out of scrap parts. It’s not intended to be a tutorial in any way shape or form. It’s just an example of what I’ve made released open source for others to modify or use as is.
I don’t really want to give out my personal number but if you check out the links I gave you etc this should help you. As I mentioned before you will have a hard time with this if you are not an experienced programmer. It’s quite complex however getting the right type of display module will make it much easier.
You could also post on the Arduino forums as there’s a large community that will be able to help. You won’t find anyone to write a modified version for you though. That’s something you would have to do yourself; that’s the fun part of electronics and programming. Best way to learn is figure it out yourself.