08/11/2017 at 09:07 •
Initial Arduino driver perfboard circuit:
Once I had one module working with the Arduino, I quickly decided the Arduino wasn’t very nice to look at. I decided I would go for a minimalist layout, with just the atmega, using its internal oscillator and talking to a dedicated battery-backed RTC. The ATmega would use its internal 8MHz oscillator so I programmed the fuses to that effect. The next step was to ditch the arduino bootloader (which didn’t work well with the internal oscillator) and get a real AVR programmer, which i did on ebay for the measly sum of $4.
After soldering 3 large modules to the Arduino (note the data bus on top) Small modules not installed yet
I then did the same for the smaller 2 display modules, with a slightly different chip enable configuration. With this I managed to address all 20 characters individually. Debugging a layout with that many wires was not easy, given that they are all on the same bus, so one thing going wrong in the bus means either they all fail, or only some chips work (if the failure is in a chip or digit select line or a bad solder joint/short). Add to it that the displays show nothing if the data is invalid, it was tricky to know what went wrong.Making sure all the characters are all usable
I first had it running keeping rough time using the ATmega’s internal 8MHz oscillator, but it would drift extremely quickly, as is expected of a “+/-2% RC oscillator”. Still it was nice to finally see the displays doing something semi-useful by themselves after all those years in the parts bucket.Showing (very drifty) time for the first time! Now let's switch to words.
This is when I received my two DS1307 RTC modules from ebay. First, I dutifully let the smoke out of the first one by swapping power and ground wires. Happy that I had ordered two of them, i proceeded with the other. The strange part is the battery arrived installed in the RTC already, and they had square wave output turned on, which drained the battery much faster for no reason! I promptly turned it off. Mounting it to the breadboard was a bit annoying, since I wanted it in the back, but with the battery slot accessible. I ended up using some of the pins as standoffs, and some double sided tape. I don’t need it to be too sturdy anyway.
I made good use of Akafugu’s i2c RTC library for talking to the RTC, setting and querying the time. The read functions populates a simple struct that the program can then access. I use a big array of strings to represent text, that I read directly from the actual hour/minute value.
During development I was powering this contraption from my computer’s usb port through the tinyusb isp programmer, which worked wonderfully. Once I switched to a usb charger brick as a power source, I started having some really strange issues. It would suddenly stop refreshing the displayed time, and I would have to unplug and plug it back in, and it would work well for another few hours. I was told that bad power could cause lockups of the chip, so I sourced some caps to add filtering and smoothing between VCC and ground (an electrolytic and a ceramic cap, like most of the Atmel design notes prescribe).This is what the board looks after I mounted the RTC and the filter caps.
It’s a bit messy: I used 30AWG single strand wire that I soldered using a fine metcal tip and tweezers. The fancy automatic stripper tool I got earlier proved to be very useful and enjoyable to use, stripping multiple wires at one with the same length.
My best friend during this project.
The extremely poor quality of the breadboard I used did not help, with pads lifting way too easily if a bit too much heat was applied, and a solder sucker used at the same time.
Makin' it pretty
I wanted a good looking case for it, so I headed out to makercase and designed a t-slot box to cut with the laser I have at work. It’s all made from 1/4” acrylic, but because I wanted transparent red and could only get ⅛” at Tap Plastics, I cut another piece of transparent ⅛” to sandwich with the already-cut case. I also added holes for the power wire and a rectangular cutout for a toggle switch I’ll use to enable daylight savings time, all because I was lazy and didn’t include programming buttons for hours/minutes. (I set the time by programming the device with code that sets the correct date/time in the RTC at bootup, then I flash my regular code). I might revisit and add a minute +/- button eventually, since even with the RTC it drifts a little bit. (minutes over months) but the inherent fuzziness makes it fine anyway.
I chose to display the minutes, with “to” or “past” and the hour on the bottom. The clock updates every five minutes.
I also had some issues with some times of the day not fitting in the display (“TWENTYFIVE TO ELEVEN” was the longest string) so I used “>” and “<” for “PAST” and “TO”. (as seen in the code)
I decided against displaying AM or PM, since that particular display module cannot display a dot alongside a character, and I didn’t want to add an extra LED.With lots of light you can see through. It looks quite dark and very readable in person with normal lighting. Swapping clear and tinted layers makes a difference too. Power and DST toggle
The code is all available in the files section. Unfortunately I do not have a schematic but most of it can be figured out from the code as well and pretty much follows the schematic. Any pins not actually connected to the atmega were either left floating or strapped to their proper logic level according to the datasheet.
04/17/2017 at 08:46 •
Some years ago at the tremendously awesome De Anza electronics flea market, I came upon brand new in-bag DL2416 and DL3416 displays. (two and three of them respectively). They look amazing by themselves, with all their retro goodness. (datasheets linked in the project page, and in the source zip)
They have built in decoders, so they know how to display ASCII data you send. The tricky part is they have quite a few pins to interface, being parallel (back then everything was).
They went into a bin for a few years, until I rediscovered them, and decided to do something with them. Given the total numbers of characters I had available (12 big, 8 small) a word clock seemed fun and would fit without having to scroll the text. Note: the datasheets are still preliminary! Hope they don't change unexpectedly.
- 4 chip enables
- 2 digit select
- 7 data bits
- 1 write bit
Cursor select/enable, blanking, and clear were strapped to their correct states. This was my initial reaction:
I started by prototyping on a breadboard, but the amount of wires was way too cumbersome and the connections way too unreliable to be sustainable. I also eschewed shift registers, since an ATmega368/Arduino had enough pins to drive it directly. I did the development on an Arduino to start with.
Once I was satisfied that all the segments on the large modules worked (by drawing ‘0’ and ‘*’ alternately as fast as possible and also counting up in hex as fast as possible for good measure) I started building the perfboard circuit, without really thinking of the layout too much at first.
The nice part is that the data, blanking, write, and digit select pins can all be driven from the same bus from the mcu. The only part that changes is which chip enable (4 per chip, 2 active high and 2 active low) pins are tied to which of the ATmega’s 2 gpios.
I went for the reference design from the datasheet, except I would forego the 4th module, and make it work with 2 extra small ones (which only have 2 chip enables, both active low, unfortunately).
Now we're getting somewhere...