So I finished my clock today. I was thinking I’d have to wait for the clock module to arrive from the far east, but an amazing bloke from the cambridge makespace gave me a DS1307 this evening, and it didn’t take long after that to get done. The TLDR first:
Cost me only about £10.
Code is here for the stellaris launchpad: https://github.com/JamesGlanville/project0
3d printed case for now until I can mill a wooden one.
VFD clocks are really fun to make.
Anyway, on to more verbose musings. Firstly I needed to get the DS1307 wired up. I did not have a 32.768khz crystal lying around that I could find, but the launchpad has one onboard that I was not using (I was using the higher frequency one). I very, very carefully heated the solder joints while pulling up the crystal wires, then soldered the DS1307 deadbug style onto the launchpad and wired everything up:
It was pretty simple to wire up, pins 1 and 2 to the crystal (the body of which was soldered to the board so I had no choice where to place the DS1307 and keep short wires to the crystal). Pin 3 to the battery backup (more on this in a sec). 4 to ground, 5 to SDA, 6 to SCL, 7 to SQW, and 8 to +5V. The two 4.7k resistors pull up SDA and SCL to 3.3V. Luckily, although the DS1307 is 5V powered only, it works with 3.3V i2c comms, which saved me the hassle of using a level converter. For the battery, I was using a CR2016 since I had one lying around and it was 3V which I needed. I didn’t have a battery case, so I very carefully soldered wires to the battery, hot glued them for protection, then duct tape the lot into a little bundle:
Now soldering to lithium button cells is not really advisable, but if you want to do it reasonably safely, do this: Sand down a spot on each side to make contact to, and score the area lightly with a knife too for good measure. Take the wires, melt a reasonably big blob of solder onto the end of each, and let cool. Then, place the blob on the sanded area holding the wire. With the hottest soldering iron/setting you have, push down onto the blob for as little time as is possible to make a joint. Then, fan/blow on the battery. I had no problems doing this, and it saved a lot of space vs using a socket.
I 3d printed a case I designed quickly. Ultimately I think I’ll mill/lasercut a prettier case out of wood, but having a 3d printer on my desk (mendelmax 1.5) was by far the quickest option. The stl and scad files are in the git repository FOR REFERENCE ONLY! I made a stupid mistake and put the cutout for the usb cable on the wrong side, and the body was a 4 hour print so I just sawed the case a bit, and added a bit extra to the base to fill up the gap. It works, and you can’t really see the join, but it’s not ideal:
I found the clock skidded around a bit on my desk, so I cut up an old bike inner tube, and superglued it flat on the base. This looks ugly from below, but works excellently and you can’t see it in normal operation:
That’s all there is I think, it was a fun project, and a useful and different little clock to go on my desk. I still have 18 IV-3 tubes with no purpose, and 2 MAX6921, so I suspect I’ll get a third VFD clock at some point. I’ve tried to comment my code as well as I can, since the launchpad is an interesting little board, but the documentation is not great, and hopefully it’ll be a useful example of a few things.