• 8 Digits, Controller Board and Clock

    sjm430606/18/2019 at 17:45 0 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.

  • 1st Prototype: A Single Lonely Digit!

    sjm430606/18/2019 at 15:48 0 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

    First prototype inspired by the many discrete LED display projects I've seen on Hackaday. Things I've learned for this first trial:- Hand soldering twenty 0603 smd LEDs for a single digit gets to be a tedious pain and alignment is fairly critical or you'll notice wonky segments when they are lit up- Black soldermask (in my case matte) really contrasts well with the LEDs but you need to clean residual flux off really well or it will be readily apparent- Due to the number of IO required to drive each digit individually it isn't very practical to dedicate a controller per digit which increases overall cost, my next iteration will have a couple of digits all multiplexed by a single controller to simplify things- Having 0.1" pins on the sides of the digits is less than ideal as it spaces them further apart and puts them in the wrong orientation on a breadboard.

    So now that I see how good the general idea looks lets expand this project into an entire display for a clock!