Close

8 Digits, Controller Board and Clock

A project log for TinyLED Displays

DIY Tiny LED Displays ... need I say more ...

sjm4306sjm4306 06/18/2019 at 17:450 Comments

To start off, thanks to JLCPCB for sponsoring this project as well as providing pcbs to get the ball rolling. JLCPCB Prototype for $2 (Any Color): https://jlcpcb.com

So I designed a new board based on the single digit I made last time but adding 7 more for a total of 8 digits along with decimal points. I figure this would be a pretty flexible display for clocks and calculators. I ended up decreasing the digit size just a tad from the single digit version. Additionally I designed a controller board which sits neatly on the back of the display via 0.1 headers. I opted to use the Atmega32u4 so I could have native hardware USB for programming and debugging along with plenty of IO for future expansion and my go to serial RTC, the DS1302. The boards came out beautifully and hand soldering wasn't as bad I assumed (though I really need to get into solder paste stenciling and reflowing for future boards). No layout errors so everything worked without the need for bodges!

And here's it behind some esd plastic as a diffuser running a counter example. It is very bright without something to diffuse it, but I later added code to allow the five levels of brightness.

Here's a video on the assembly and testing:

Like my pcb word clock project I am multiplexing the display with the help of a timer interrupt automatically to scan the rows, updating the display from a bitmap buffer that the user can write to whenever. I've also added a simple font with numbers and almost all capital letters (certain letters are impossible though given the seven segment arrangement of LEDs).

So things like usual didn't go quite as planned. For starters I opted to use 4 smd 74hc595 serial shift registers for a total of 32 outputs to drive the columns of the 8 digits. I made the silly mistake of assigning them to random pins on the Atmega to make routing easier instead of using the hardware SPI pins. The consequence of this was I had to now bitbang the 32bit SPI each display mux cycle which drastically impacts the maximum refresh rate I can achieve without introducing display flicker. I ended up optimizing the soft SPI routine as much as I could to make the best of the mistake I made. I did find though that updating the display buffer too quickly led to corruption of the image but ~10fps or less seems to run fluidly without issue.

After getting the display working to satisfaction I was able to program a simple clock:

Additionally, I found that my bitbanged library for the DS1302 RTC didn't work at first try. I've used this library that I wrote years ago on all my PIC clock projects without issue but porting it to the Atmega was initially futile. Writes seemed to work correctly, but reading back data only sometime worked (otherwise leading to obviously incorrect, corrupt data). I quickly realized that the PICs clock divide by four cycles per instruction while the Atmega runs one instruction per cycle. So a 16MHz PIC's core actually executes at 4MHz while an Atmega runs full speed. This meant that my library which was tailored to relatively low speed PICs was violating the timing requirements of the DS1302 as the Atmega was blasting the data too quickly. So I just sprinkled some delays into the read RTC function and like magic the RTC started working reliably. Remember kids always read the datasheet (and try to operate within spec).

So now that the display works as a clock what else is next? Well I plan to add an ambient light sensor and improve modulation of the display so it can auto dim. I've also broken out the micro's serial pins so I can easily hook the display up to an esp wireless board to grab info off the internet (like weather, youtube sub count, etc). The sky is the limit, and so far I am very happy with how things have turned out. It definitely is not perfect, but I've learned quite a bit from the mistakes I made in this iteration that I can put to use in future versions.

Discussions