Done!

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.

Posted in Uncategorized | Leave a comment

Getting rid of the voltage supervisor (for the wrong reasons)

One thing I neglected to mention is that I followed the instructions here: http://blog.psten.de/post/fuel-for-the-stellaris-rocket to stop the launchpad resetting when the 5v supply dropped. This was because when I was experimenting with a large duty cycle for the SMPS the current draw from the inductor was enough to wobble the 5V rail enough to reset the chip. I don’t think I actually needed to do this – it shouldn’t reset now I’ve lowered the duty cycle.

Another thing is that I decided to drop to just 2 47 ohm resisistors in series for each tube as they really were too dim. I strongly suspect I’m now drawing more than the supposed 500mA maximum for a USB device, but only by a little bit, and I’ll be powering it with an old iphone charger that can handle it.

Posted in Uncategorized | Leave a comment

Wrestling with interrupts

I’ve put all my code so far on github (https://github.com/JamesGlanville/project0). Part of the reason for choosing to use the launchpad was to experiment with it – my thoughts are that it is a very nice board, but the documentation is very poor. I’ve therefore commented my code, and tried to make it as clear as possible, because there are a few things (i2c, PWM, interrupts) that are very common, and took quite a lot of searching to get right. The current state of the code is that is does everything except get the initial time from the DS1307 via i2c because I don’t have the chip yet. However, the interrupt to process the 1Hz signal the ds1307 gives is working. (The plan is to get the initial time, then count the ticks since then to get the current time.)

Posted in Uncategorized | Leave a comment

Mini switch mode power supply

So I got the inductors in the post today, and had to work out how to fit all the boost circuitry into as little space as possible. I decided to make a little cylinder of parts, and heatshrink the lot, then I could cram it next to the multiplexing layer on the pcb. It was pretty easy to make, and I’ll be making a few more of these for various uses. The four wires are 5V, 0V, switching signal, and high voltage output. I’m using open loop control, and I get a stable 50V output – it’s weird that you can feel a tingle if you touch it, and it’s only powered by usb. The parts used were:

2.2mH inductor
Mosfet – CSD18532KCS, but practically any will do if they can handle 60V and can be driven from a logic level.
1 high voltage capacitor – I used a 300uF 300V capacitor, you need one >60V and >50uF.
1 low voltage capacitor – I used a 220uF 16V capacitor
diode – I just used a random IN4001 one I had lying around

The circuit is the same as the ice tube clock (http://www.ladyada.net/make/icetube/design.html)

So here is what I have so far (you can just about see the end of the high voltage capacitor in the background. It’s powered only by usb, and displays 18:11:11 at all times. Now I just need to add the ds1307 when it arrives and write a little code.

Posted in Uncategorized | Leave a comment

Clock #2

So I finished my first VFD clock, and wanted another. I found a great deal on some single-digit IV-3 tubes on ebay (24 for less than £10), so I decided to make a similar clock but with these tubes. Once again, I wanted to spend as little money as possible, so here were the parts I was going to use:

6 IV-3 tubes (£2.50 total)
MAX6921 VFD driver (free sample)
CSD18533KCS MOSFET for SMPS (free sample)
DS1307 clock module (http://www.ebay.co.uk/itm/170794819927) (£1.50, probably just as cheap as battery+ds1307+battery holder)
2.2mH inductor (http://www.ebay.co.uk/itm/300555952472 80p)
Stellaris launchpad LM4F120 (£5)
Various bits of wire/perfboard/passive components (junk drawer – free.)

All in all, about £10, which seems quite reasonable.

Right now I can set all the digits with the firmware I wrote for the launchpad. I’m waiting for the inductor in the post, so right now i’m using the high voltage power from my previous vfd clock. I’m also waiting for the ds1307 module, so it can’t keep time, but I feel like I’m mostly there. I can’t imagine anyone will copy my design exactly, but here are a few thoughts/pointers/why I’m building this the way I am:

I needed to multiplex the tubes so I could control them easily. This is really simple to do, you just connect all the wires that correspond to a segment together, and connect all the 0V filament wires for the tubes. Then you just selectively power on one grid, and display whatever you want by controlling the segment wires. This reduces the number of wires to: 8 segment wires (counting the full stop), 6 grids, ground, and 6 +ve filament wires. The filaments need a small amount of current flowing through them – I’m using about 30mA. This is estimated from an old russian datasheet I found. I’m powering them each through 141 ohms from 5V (I only had 47ohm high-wattage resistors in that range, so the duct-taped blob labelled in the picture is an array of 47ohm resistors in series.) Now there are just 8 segment wires, 6 grids, ground and 5V – much more manageable.

I’m using the MAX6921 vfd driver again, because it’s really easy to use. I wanted to start building this late at night without any etchant or fine enough milling bits, so I decided to go for the tried and tested method of supergluing the chip onto perfboard on its back, then adding a load of fiddly interconnects to turn the chip into a manageable size. I only needed 20 pins (14 to vfd, 5v, +40V, ground, DIN, LOAD,CLK), so I didn’t bother connecting all of the pins of the max6921. This picture shows the idea: (the top pcb has the max6921 glued to the back, and the solder blobs along the edges correspond to various pins on the 6921)

At this point, I had a module that just needed a 5v supply, a high voltage for the tubes (~40V), and some communication over the DIN, LOAD and CLK pins. Time for the brain of the clock. I decided to use the stellaris launchpad because I bought a couple cheaply ages ago and they can be powered by microusb, have a load of processing power, and their 3.3V running voltage is just about big enough to run the max6921. Not only can they be powered by usb, they have usb comms, so I can set the time by just plugging the clock into my pc. This I’ll do by just flashing a firmware with a hardcoded time, the same thing I do with my iv-18 clock – it’s a straightforward thing I only need to do twice a year for DST, then let the DS1307 keep time. The code is just a modified version of the project0 project that comes with the stellaris software. I haven’t used one of these things before, but I quite like the launchpad already. My code is here: project0. I’ll put all of it in a git repo when I’m done.

So, a TODO list:

Wire up the SMPS, and set up PID control using pwm and a potential divider to measure the voltage – easy wiring, should be simple code.

Wire up the DS1307 module, and write the code to set/check the time.

Build a case. I can’t decide whether to 3d print one (dead easy) or craft one out of wood (better looking, much more lengthy process)

Posted in Uncategorized | Leave a comment

Finished :)

I’ve finished the clock now, I mounted it to a wooden base with copper loops, secured from underneath with hot glue. I opted in the end for a DS1307 powered clock, hence the little button battery held cunningly to the bottom left. I couldn’t decide the best way to write the firmware, as reading the ds1307 takes a little too long, so it disturbs the persistence of vision effect. It therefore updates the time every minute or so, which looks a lot better.

Code is here: https://github.com/JamesGlanville/VFD

The code is a bit rubbish, as the wires on the VFD are attached semi-randomly to pins on the MAX6921, so there’s a nasty bit of magic code to work out which segments are which.

 

The digits are really clear in real life, it is just hard to photograph.

Posted in Uncategorized | 5 Comments

SMPS boost converter complete

I finally got around to rewinding an old inductor, to get a 1.7mH inductor. I used the same schematic as the mintyboost more or less, though I used a STP55NF06 mosfet (had one lying around). I also had to pull down the switching signal from the MCU with a 4.7k resistor. Without it, the inductor heated up massively, and I couldn’t figure out why the MCU wasn’t pulling the pin down to ground properly. Ah well, it works. In hindsight, that was probably the reason the original 0.2mH inductor wasn’t working, but ah well, winding hundreds of turns of copper around a tiny bobbin is fun.

I’ll probably add a ds1307 for timekeeping, since I found one in my parts box. There’s a nice empty bit of space on the bottom right of the clock for it.

Using capacitors as spacers for the power rails has been really useful – the two copper wires running horizontal behind and above the tube are suspended at either end from small electrolytic capacitors. I went for a 600uF cap for the 40V rail, much bigger than necessary, but it does make the clock “warm up” slowly, and power off gently, whereas with a smaller one it was much more abrupt.

Posted in Uncategorized | Leave a comment

Mostly done

I’ve almost finished the clock now, it keeps time to a few minutes a day using the cheap 8mhz oscillator I have attached to the atmega168, but I haven’t yet decided which of these to do:

  • Add real time clock (Have the chip, need crystal/switches for setting time)
  • Add cheap transceiver and set time from pc remotely.
  • Use as usb-clock, so pc pushes time updates every so often over a ftdi cable.
I also need to make a switch mode power supply for powering the tubes, at the moment I have 4 9v batteries in series, which works very well.
Anyway, here it is, just needing a few tweaks, and a wooden plinth to mount it to.
All credit to ladyada for the ice tube clock, for which I stole most of the schematics.
One nice take on the design I liked was soldering the max6921 deadbug style right to the end of the tube, because then the combined module only needed 3 control wires, 5v, ground, and 36V.
Posted in Uncategorized | Leave a comment

Designing a free-form VFD IV-18 clock

I thought this was really cool:

(via http://dangerousprototypes.com/2012/10/10/freeform-nixie-clock/)

I therefore needed to build my own, but wanted a more practical clock (you have to wait for the nixie to flash out all the numbers on this one). I’m therefore going for a VFD clock, much like adafruit’s famous ice tube clock:

(via http://www.ladyada.net/make/icetube/)

I need to wait until I get home to start building it, but my basic design plan is:

  • Flat piece of wood for the base, with bevelled edges (as cool as the totally freeform one is, my clock will be smaller, and very light, and I want it to stay put on my desk without breaking)
  • Instead of using a RTC, I’m going for using a NRF24L01+ RF module, with my desktop pc pushing the time periodically to it. While a RTC would be fine, it means I’d have to program a time-setting interface, clutter it with buttons, and still have to deal with eventual time drift. The RF modules are cheap (about £1), and I’ll be using them around the house for wireless control anyway, so I want a bridge to my pc. I don’t know how much drift arduino internal clocks have, but as long as they can keep time for a few minutes, that’ll be good enough.
  • I’m trying not to spend much money on this at all. I got the tube for £5 (http://www.ebay.co.uk/itm/150826784263), the MAX6921 VFD driver as a free sample, and I probably have enough stuff lying around to build it.
Going for the RF module design instead of the RTC has these tradeoffs:
  • + Never have to set the time, the pc is always correct.
  • + I don’t need to program a time-setting interface.
  • + Fewer parts, one RF module vs RTC chip, crystal, capacitors, battery backup
  • - I need software running on the pc, on the arduino attached to my pc, as well as the clock.
Still, I think it’ll be worthwhile. More to follow when I start building this thing.
Posted in Uncategorized | 2 Comments