Linear Clock
I'll be showing you here another full design project, from idea to design to prototype. The object of our desire today is a linear clock, that is, one that has numerals arranged in a line rather than in a circle, and it'll fit very nicely into many homes and workplaces.
This is a working design process and this instructable will document the whole of it from beginning to end. I hope one day to market and produce the clock, but all the plans and parts are available to download or take from here, in case you'd prefer to do it yourself, or you can make an improved version.
The actual build (starting at step 3) shows an easy to make version, that uses a set of simple parts, and this is my prototype clock. It's the clock I assembled as a proof of concept. It's simple enough that you can probably put it together in an evening if you have the right bits, and substantial and useful enough to be worth spending time on. It uses easy to find parts, doesn't destroy them in the process, and doesn't require anything that's special. It is also forgiving of sloppy production.
Step 15 introduces a few experiments with refinements, and settles on a design. This is really an instructable about design and prototyping. I think that's interesting, so maybe you do too!
Design Considerations and Background
I like an analogue clock. For telling the time (I mean, as opposed to seeing how long to boil an egg) I think an analogue face more satisfyingly describes the nature of time. The experience of time is such an elastic and personal thing, and an analogue face is more open to interpretation.
The are almost always round, however, and for designers, the clock is usually a fairly abstract graphical exercise in styling. I have always been interested in different analogues for time, other than the round face with the sweeping pointers erupting from a central spindle. I like the idea that time can be measured with another kind of metamorphosis is appealing. Maybe an object will change shape over the course of a day, or a balloon will be against the ceiling in the morning and gradually sink throughout the day. Make it fall past a scale drawn on the wall and you have a rather elaborate clock. Do without the scale on the wall, and the assembly still tells the time, but it is harder to be precise, and what metric exactly the device is showing becomes less obvious. Sand timers and water clocks are the most common non-conventional clocks. They suffer from a lack of precision in reading.
Development - How It's Supposed to Go
I gave myself a brief featuring the following MUSTs:
- Low power - ideally no trailing wires / battery
- Cheap enough to fit into a mainstream boutique's retail price range.
- Same mechanism able to run horizontally or vertically.
- Silent when not moving.
- Lightweight - does not require special wall fixings.
- Aesthetically neutral - open to styling and colour/material choices
I hummed and hawwed for so long, and eventually settled on a fairly simple mechanical design that uses a small solenoid as a latch to regulate the turning of a spring-loaded, snail-shaped cam. This would be the driving input to the gear train that moves the indicators.
The timing source itself was to be made from a quartz clock movement - the part that sends a pulse every second. There are lots of fancy-dan electronic solutions for this, with realtime clock ICs and radio clocks and things, but I went for a simple approach. This keeps initial costs down, and is much more within my own sphere of understanding.
The clock would be battery powered to avoid trailing wires, and this is another reason for choosing a largely spring-driven system - so that high draw sections (solenoid / motors) are mostly turned off, and just needs a pulse every minute.
This is complex to manufacture however, so the design in this instructable is a simplified version using a microprocessor to drive some stepper motors.
Skip to step 15 to see what happened once I'd finished the prototype.
The Final Design
It also doesn't look odd. I'm looking to make it complement a mainstream contemporary home, so it uses the colours and materials that are found there. The shape is unusual though, and brings to mind the illuminated slot and roving indicator of a manual radio tuning dial. In it's vertical form it makes me think of barometers or thermometers or other scientific equipment that makes it into the home.
Horizontally, it could stand alone hung on a wall, or more like, be used as a shelve or mantle-piece replacement. Turned vertically it is harder to place because we human beans are a lot less tuned to looking up and down than we are to looking from side to side. Vertically it needs a more sparse setting with a wall that's got a lot of vertical space available.
Prototype Version - Introduction and Parts List
The purpose of this prototype is to get something working as quickly as possible. Building the prototype will give me some good ideas about the complexity of the build and the length of time required. This in turn gives me some pointers about how many different versions I have time to test.
This is how I made my prototype, and the things you'll need to cobble this together. I used this set of pieces because it's what I came across first. Other kinds will certainly work too.
Chassis:
- I used foam core board (sometimes called kappaboard) to make my prototype. It's light, glues easily, and is stiff and strong. It's also easy to cut and not messy. Corrugated cardboard will also work handsomely.
The running gear:
- 2x Curtain rails - I got a PVC one from John Lewis' for £7 ($11). You need two pieces, each as long as you want your clock to be. My prototype was 62.5cm long because I used a 125cm curtain rail sawn in two.
- 4x sewing machine bobbins for the driving wheels - plastic ones are easier to work with, and cheaper.
- 2x Pulleys for the non-driving end of the clock - I used these little pulley blocks I had, but sewing machine bobbins would be just as good probably.
- Thread that is thick enough to be controllable, some thin elastic cord, some bits of balsa sheet or other light, thin, strong sheet that will slide OK in the channel of the curtain rail.
The brains:
- Arduino with Adafruit Motorshield - This is definitely overkill, and I used this simply because I already had it and it works admirably. The stepping circuit on it's own is not complicated and if you have an Arduino compatible board that isn't otherwise gainfully employed, then it's quite easy to whip up a circuit using L293 ICs on breadboard that will drive a couple of stepper motors. Look at Tom Igoe's stepper pages, for circuits for driving steppers from an arduino. However, what the Motorshield gives is a good quality library that allows you to turn the motors off entirely. The simpler circuit does not do this so easily.
- The logic/timing part of the code would be the same for all versions, but the interfacing code will be a little different.
- Any Arduino compatible board will work fine as far as I know.
- 2x Stepper motors. I tested this will some dead cheap little steppers (referred to here) that have almost no torque and only 20 steps per revolution. I paid next to nothing for them. I also made a version with some good quality NEMA17 steppers with 400 steps per revolution. I paid about £14 for each of those and they weighed a pound each. I ended up using the cheap small steppers.
- In the Arduino code, modify the value "stepsPerRevolution" to reflect the kind of motor you have.
- You'll also need a 6-9v DC power supply to run your microprocessor (arduino) when it's not tethered to the PC.
Tools:
- Knives mostly. Foamcore has a tendency to "crumb" if you don't have a really sharp knife, so use a fresh, long blade and always make sure the blade is moving through the foamcore using a sawing, or slicing action rather than cleaving or chopping.
- Adhesives - I've used anything I had around. Superglue, hot melt glue, contact adhesive and gummed brown paper tape.
- Soldering stuff, or screw terminals, and wire.
Prototype Version - Assemble the Chassis
Stick the edges of the track onto the faces of the board for best results. Before glueing, make sure the tracks are straight, and bend them straight if they aren't. Also cut some rectangles to fit in between the rails, to help them stay straight and to allow you to put some clamps (ie elastic bands) around while the glue dries. Run your beads of glue along the card edges so as not to melt the foam too much.
Prototype Version - Driving Bobbins
Figure out a way to mount the bobbins directly to the shaft of your stepper. I was lucky because my stepper has a little brass collar that fits exactly into the bobbin, and centres it right away. I filled the core with hot melt glue and jammed it on. Epoxy putty would be a solution for a stronger bond. Remember to leave a little gap between the body of the motor and the bobbin so it turns freely - the thickness of a couple of sheets of paper would be enough, and you can draw a target on the paper to help centre the bobbins.
Wind a piece of thread a fair bit longer than your clock onto each bobbin, in opposite directions, keep the ends safe with a bit of blu tack. You'll trim them to length later.
Prototype Version - Mounting Motors
The thread will travel all the way down the slot, wrap around another idler wheel at the end, and then come back up and get wound onto the opposite side of the bobbin stack.
You'd be right to spot that this is a complicated way of making a loop. If you have something with teeth (chain, timing belts) and the associated sprocketry, then you could use it instead. I experimented with bead chain (like for winding roller blinds), but it was a little heavy and inflexible for these little stepper motors that I'm using.
So make a bracket to hold the motors. Mine are small, and light, so are just friction-fit into two holes. This has the benefit of leaving a bit of wiggle room, but has the problem of being easily pulled out of position by other forces (ie dropping it on the floor). Use a knife with a long blade and a sawing action to cut intricate or internal shapes in foamcore board.
Prototype Version - Idlers
The position of the return side of the thread isn't that important, except that it needs to have an unobstructed path through the whole length of the clock, and be able to cleanly wind around the take up bobbin. I had to cut a few sections of my internal supports out to clear the path.
The angle I have these little pulley sheaves at is nothing special. It might seem nice to have your thread loops travelling through both channels in the rail, one up and one down. Well, it would be nice, you're right, but it'll also be a pain, and there is no advantage gained.
Prototype Clock - Carriage and Indicators
Eventually you'll cut a couple of bits of cardboard or something to use as the pointers.
Now, the next bit is good, but needs a bit of skill and judgement.
Prototype Clock - Threading!
To compensate for this variation (which is not big, but big enough to cause a problem), the two sides of the thread loop are joined by a piece of elastic. This puts enough tension on the thread to keep it in the groove while it's at it's most loose, and has enough stretch to take the strain when it's tight.
This is fiddly, and I did it like in the pictures:
- Make sure there is one full loops-worth of thread on each bobbin. That is, each bobbin should have enough thread to stretch from the bobbin, round the idler, then up to the other bobbin. Trim the thread so both sides are the same length.
- Wind half of the thread back onto the bobbin. Leave the ends stretched out through there normal route - the ends should meet at the idler.
- Hold both ends in pinched fingers and move them along the length of the clock, winding the thread on and off the power bobbins, feeling how much difference in tension there is between the extremes and the centre of the travel. This will give you an idea of how tight your elastic can be. If there's hardly any difference (thin thread, or no overlap), then you don't need to leave much slack. If there's lots of difference (thick thread/cord, lots of overlap) then you'll need plenty of slack.
- Tie inch long loops in both ends of the thread. The two pieces of thread should no longer meet. Cut a piece of elastic long enough to bridge the gap between both loops and tie a knot in one end.
- Tie one end of the elastic to the thread coming up from the idler (from the takeup bobbin).
- Move the thread through the clock again to see where the loose loop of thread needs to be tied to the elastic. Tie a knot in the elastic, and then loop the thread onto it. I hedged my bets (in the photos) by making a couple of knots so I could try different tensions easily.
- The knot in the elastic should be enough of a kink to engage with the slot you cut in your little carriage. You could glue it if you wanted, but I found that once the knot was tucked into the channel, it stayed put anyway.
Prototype Version - Electronic Bits
It's straightforward. I made some extension cables with some 4-pin headers because the steppers I have happen to already have little connectors fitted, and the wires on them are tiny and fragile anyway.
I can't give a good introduction to steppers here (not just because I don't know much about it myself), but roughly put: Each stepper has two coils in it, and pulsing these two coils in a particular sequence and polarity (four steps) makes the rotor turn in a particular direction. The two coils are separate in a bipolar stepper like I'm using, so I have four wires coming out of the motor. (Actually I have five, because these are weird, but I just cut one of them.) The exact motors I have here are the very same kind described in outstanding detail in this brilliant instructable.
Two of the wires will be connected to one of the coils, and the other two will be connected to the other coil. Use a multimeter to check for continuity to figure out which. Then connect one pair to output terminal 1 and 2 of one of the motorshield ports, and the other pair to 4 and 5. Unless you know the pinouts of your stepper, you might have got it right, or you might have the polarity of one of the coils switched. http://digital.ni.com/public.nsf/allkb/0AEE7B9AD4B3E04186256ACE005D833B has a little guide about it.
To test the program without having to wait a minute between each physical tick, change the millisPerSecond value in the program to 200 - this will run five times faster than usual. You can also change stepSize which will modify how many steps the motor takes per tick.
Prototype Version - Software
The code:
There is an internal time representation, consisting of three ints: currentSeconds, currentMinutes and currentHours. This time is pre-set at start up and incremented while the program runs.
The main loop of the program makes a note of the start time, then continuously checks the current time to see if it's 1000 milliseconds later or not. If it is, then it increments the internal clock time (doTick()) and hits a procedure to change the position of the indicators on the clock (renderTime()).
The procedure doTick() deals with incrementing seconds into minutes, and minutes into hours, and resetting those values when necessary.
The procedure renderTime() deals with converting the time in H:M:S into positions on the clock face, or more correctly, positions of the stepper. The program has a concept of the current position of the indicators (preset on startup at 00:00 - the far left position), and uses this initial start position to decide whether to move the stepper forwards or backwards.
Using the internal time keeping of the Arduino is fairly dodgy ground (see this instructable for a good run down on why, and a possible solution). There's lots of ways round this if it's important: The main Arduino pages have a few ways to make it accurate, as well as stuff about using the Time library. I went for a more simple solution, given that it's a prototype (yes, that is my excuse for every time I make a hack).
I am using the AFMotor library for driving the steppers, because I am using the Adafruit motorshield. If you run the steppers through another circuit, you can probably use the regular Arduino stepper libraries with minimal code chopping. If you download the code, the file should be saved with a .pde on the end. Not sure how to change the filename on instructables!
Downloads
Prototype Clock - Software Adaptations
Your stepper motors will be different to mine. To adapt it to your particular stepper motor, you should:
1. Change the statements that declare the motors:
AF_Stepper hourHand(20, 1); // hours
AF_Stepper minuteHand(20, 2); // minutes
at the top, and change the 20 to however many steps your particular motors take to do a full revolution. 200 steps is popular (1.8 degrees per step). If you have no documentation about your stepper, then experimentation is the only way forward, I'm sure you can figure out a way of doing it.
2. Change the stepsPerClock statement:
int stepsPerClock = 592;
This might be complicated, because it depends on the length of your clock, the number of steps per revolution of your motor and the diameter of your bobbins. There is a mathematical way of working it out, but I just measured how far 100 steps moved the carriage, then used that to calculate the total number of steps required to move the full length of the clock. Also remember that you need a bit of space for the carriage, so it doesn't fall out the end of the channel at either end.
3. Change the current time:
The start time is hard-coded in this version. The next version will allow you to increment the time with some buttons attached to the arduino.
int currentSeconds = 0;
int currentMinutes = 55;
int currentHours = 11;
means it's going to set itself to five-to-twelve once it's turned on. Again, there are smarter ways of doing this in the final version, but for this one, this is enough.
I usually set it for a minute in the future, then upload to the arduino and press reset when it's dead on. The pointers are a bit wobbly to notice a minute here or there anyway.
You should manually rewind the indicators back to zero when you reset or turn it on.
4. Change the speed of time!
For testing purposes, I run it five times real-time by setting the line to
int const millisPerSecond = 200;
Real time is 1000 milliseconds per second, so change it to 1000 when you actually want to keep time with it!
Prototype Clock - Indicators and Faces and Finish!!
Well, I know it won't be quite that easy, but _that's the theory_!
Print or draw a face, and stick a couple of lightweight cardstock pointers on, and hay presto! Make sure the hands aren't level, or they'll catch on each other as they pass.
At this point you can also tidy it all up and stick some extra bits on so it'll stand up on a surface or can be hung up. I'm sure it'd be easy enough to make up a case for it too, with the electronics tucked away inside.
Towards a Production Model - Reality Check
After building the prototype, I looked a bit askance at the extra complexity required by the production model, and decided that that particular battle was one for another day. I decided to make a more realistic prototype to test a few other mechanisms.
I sawed a 2-metre aluminium curtain rail into two pieces to use for this version. I figured the metal would be more stable, given the longer length. In practice, it didn't make a significant difference. The painted surface was smoother and harder, so there is less friction, but there are parts that are not painted, and the transition between the two zones is rough, and a right pain to try and file smooth. I'm not sure there's much benefit to using the metal, particularly if it's going to be enclosed anyway.
Refinement #1 - Bead Chain Loops
Thing is, the blinds only come with one sprocket, so I modelled another, and had a few 3D printed, along with a couple of brackets, and some little carriages to run in the slots of the rails. I used http://www.shapeways.com for my prints, but I've included the STLs here if you'd like them. In an earlier stage of the project I did make a couple of sprockets from balsa. They actually worked ok, but were predictably irregular.
Actually really pleased with this set up, they look great and were completely snag-free (hurray!). As I suspected though, they were too heavy for these little motors to move. With a more torquey motor these would be ideal, and I suspect I might end up using them. Certainly the neatest solution.
Refinement #2. Thread and a Friction Drive
As with the pulleys, the gears were bought from Rapid. The brass tubes were K&S Metals products, bought from the local hobby shop.
I added a couple of little plastic guides cut from sheet polystyrene to keep the thread in line with the gears.
All very nice, and did work, but unfortunately very touchy. Being friction-driven there's lots of room for slippage of the drive on the thread. There's too many variables that can change over the lifetime of the clock, even if it could be properly tuned to begin with. There are things I can do to improve that a little (use a grippier thread), but it'll never be quite good enough. I suspect any friction drive will have this same problem.
Refinement #3 - the Revenge of the Double Bobbin Technique
It is still not as simple and as "closed-loop" as the bead chain system, but it is quiet and importantly, it works with these small steppers, which means it is light and cheap. Design is about compromise, and these iterations are the whole point of making prototypes. It is very rare indeed that designs drawn out on paper turn into perfect physical objects without a whole lot of shoehorning.
Finished Article
Finessing
- A few inches of stripboard.
- Wire to make links.
- Headers to allow the pins on your motorshield to be plugged-into.
- 3x push-to-make switches and an LED (I used these right-angle tactile switches, and a sideways-looking LED because I knew this would be operated from the edge).
Downloads
Pointers
A problem with using a simple bent-card pointer is that it's very hard to keep it bent at the correct angle - it wants to unfold, and when it does it catches on the other pointer when they pass by each other.
I made some new pointers and super-glued some pieces of solid wire onto them, so they stuck out at right angles, like prongs. Then I secured them to the carriage by using a couple of pieces of the grippy plastic hooks from some command strip. This turned out to hold the thread and the wires pretty securely, and once in, I could lightly bend the wires to position the pointers almost perfectly.
Appraisal and Next Steps!
Low power - ideally no trailing wires / battery: Failed on this one. This current design uses an arduino and stepper motors. The microprocessor on it's own can run ok on batteries for a little while, but with the steppers, it's only going to be good for a week I guess. I am accepting this solution however, because it occurred to me that wires don't necessarily have to be the black plastic hanging out of a wall wart. I anticipate a mains powered version of this clock in production would have a thin wire with a nice fibre woven sleeve, or a flat cable, like a speaker cable. Batteries is still the dream of course, but it's for a non microprocessor/stepper combination I think.
Cheap enough to fit into a mainstream boutique's retail price range: SUCCESS! I think anyway. In response to a reader's comment, I totted up the cost of a hypothetical version of this clock using a simplified electronic design (ie discrete driver circuit) and it came out at about $40. This could also be significantly reduced if parts were bought in bulk. The design isn't very complicated to build so labour wouldn't be too much. The case is not factored into that price however, and depending on fit and finish, it could conceivably be very expensive. Also packaging should be thought about.
Anyway, say $60 cost = $120 wholesale = $200+ retail. That's not too bad. If I sold just direct then I could keep costs down.
Same mechanism able to run horizontally or vertically: SUCCESS! This does not rely or use gravity in any stage, and the carriages and indicators are lightweight, so there is no impediment to running this clock in either orientation.
Silent when not moving: SUCCESS! The motors are completely powered down between movements so there should be no buzzing or humming that might otherwise get amplified by the case/wall. When it does move, it makes a noise from the carriages rattling in their grooves, but some patches of felt might help that.
Lightweight - does not require special wall fixings: SUCCESS! Actually shot myself in the foot a bit by upgrading to using aluminium rails for this version. It's heavier and doesn't really add anything. Even so, still not too heavy to hang on a normal picture hook. Of course a wooden case will change that, but even those need not be prohibitively strongly built. I am leaning more to recommending that this clock sits on a surface anyway (like on a mantlepiece or across the top of a bookshelf).
Aesthetically neutral - open to styling and colour/material choices: SUCCESS. The reason I put this requirement in was so that I wouldn't produce some mechanism that was weird looking, or awkward to house. Basically insisting that the clock can be cased in whatever I like, rather than having to have a big hole in the top for a wheel to pop out, or a space below for a pendulum or something. I copped out a bit here by not having a case to show, but I think it's clear that any kind of case would fit fine around this mechanism.
I'm happy with it, and it's ticking away on my desk as we speak.
There are a few extra modifications that are required to make this a product:
Changes:
- Use an endless loop of toothed / beaded chain instead of the double spools thread. This makes the diameter of the driving spool constant (the thread doesn't "layer") and have loose parts and tight parts. There is still slack to deal with, since the cord may stretch a little over it's lifetime, but a much shorter spring or piece of elastic can deal with that.
- Use a discrete stepper driving circuit instead of the the Adafruit motorshield. The motorshield is very versatile, but overkill for what I need it for. I can probably make a more simple circuit using just the L293Ds and a couple of transistors, and that'll be a lot cheaper. Teamed with a less general-purpose version of the arduino, this will save a whole lot of money.
- A indicator position detector at one end to allow it to self-calibrate on startup.
- A better time source. There's a hundred different ways of doing this, but it's likely to be the time keeping IC from a quartz clock.
Those will be the tasks to focus on. Some will be for product quality, others are for cost. There's no point in having a perfect machine if it costs too much!
Thanks for reading my instructable! I'd love to see if anybody else tries something like this, and I hope this 'ible has been some help. Even if you don't follow the design I have gone with, it might be helpful to see what avenues have been already explored, and I hope the design process itself has been interesting.
Happy new year!