EP 034 Arduino Clocks with Keith Hoare
Transcript From our conversation about Arduino Clocks:
Mike:
Well, Keith, thanks so much for being willing to talk on the show. I really appreciate it. Thanks for coming.
Keith:
That’s fine. Yeah.
Mike:
I was checking out the project you were working on, that five minute clock, I was just really impressed about it and I wanted to learn more about it and that’s why I reached out and see if we could talk maybe on the show about your clock. You want to tell us a little bit about it? Maybe give us some background on the five minute clock, why you built it, how it came to be.
Keith:Yeah, it was quite interesting. Do you remember the new LEDs that came out with the filaments in them?
Mike:
Yes, I do. And looking at your clock actually made me think about it more. So you’re talking about the LED light bulbs that look like kind of old age light bulbs.
Keith:That’s right. Little long strips of light.
Mike:
Yes. And my parents got them, I don’t know, three years ago or something like that in their kitchen. And I thought those lights look so cool. They’re just fancy looking. But at the time I didn’t realize they were LEDs. I didn’t quite get that.
Keith:
Yeah. They’re actually 70 volt LEDs. The original ones they brought out.
Mike:
Wow. 70 volt LEDs. That’s crazy.
Keith:
Yeah. And it’s multiple LEDs in it. They’re all strong together in a line. But the actual driver that they use was pretty poor in the way that the drivers weren’t hooked to the lets. So the early ones used to get them blow out. I had a few that had blown out for me. I thought the lets can’t have gone. So I took them apart and found that the actual burnout was the electronics in the bottom and not the LED strips.
Mike:
Okay. So the filament itself was fine.
Keith:
The filaments were fine. Yeah.
Mike:
Interesting. All right.
Keith:
It took a while to realize there were 70 volts I can assure you. Because I was putting more and more voltage in this and I thought this can’t be right, this can’t. And then they fired up at about 65, 70 volts, they didn’t. So I thought I’ve got to be able to use these, I’m not going to chuck them away. Generating 70 volts was quite easy, particularly with a processor, because all you do is you square wave into a transformer. You just get a 909 transformer, square wave in either side of it, and you’ll get your voltage out the other side. So it was easy enough to get the 70 volts, a couple of transistors would take the top voltage and that was it. I got them working. So I thought I’ve got to be able to do something with these.
Keith:
I first came up with a seven segment display. I thought this is really good. So I built one or two seven segment clocks with them and they were really bright. I mean, unbelievably bright. I had to turn them down to about 10 or 15% of the true light output because they light up the room, literally, when you did it. Talk about a nightlight, you’d come into the room in the middle of the night and it would be like daylight from this little clock ticking away in a corner. Then I had an idea that I’d like to create a new type of clock, new, nice for looking clock. So I then arranged them in the 12 positions of a clock using the two bars in each line. So I was using the inner bars for the hours and for the minutes, both bars.
Mike:
Okay. So like a traditional analog clock kind of set up.
Keith:
That’s right.
Mike:
Okay. Yeah. 12 o’clock, 15,30. Okay. Got you. All right. And then each line you had two filaments for each hand, essentially, I guess.
Keith:
That’s right.
Mike:
Yes. For each clock position. Okay.
Keith:
Yeah. So then I built one, but I built it as a skeleton, if you could imagine it. In other words, I just virtually made a 3d print with my 3d printer, arranged them around as a skeleton, but it took an awful lot of wiring. Because of course every LED had to be wired separately into the multiplex. So it took a bit of a while to get that. I thought this can’t be right, this can’t. So I designed the printed circuit board to do it. So I laid it out in a printed circuit board, but the clocks are quite huge really when you think. They’re about 200 [inaudible 00:04:26] in diameter.
Mike:
Oh wow. Yeah. That’s pretty big.
Keith:
Yeah. So it was a bit over the top, really. So I started looking around in the electronic suppliers and nobody supplied these filaments. You just couldn’t buy them. As soon as you bought filaments in anything, you ended up with a filament bulbs. But I found a supplier in China, which actually makes them. And of course they made all different voltages. They made 70 volt ones, they made 12 volt ones, three volt ones, and all sorts, and they did different colors.
Mike:
Oh, cool.
Keith:
I though this is brilliant. I designed a do-it-yourself one really for the hobbyist using the three volt filaments, which gave me effectively a clock face of about 140 mil, which was quite nice. It had another advantage as well. It’s that if you share multiplex through an [inaudible 00:05:27] into that amount or less, what do you do? You do away with all the drivers and you also do away with the resistors, you don’t need any.
Keith:
And when you consider this, there’s only ever three filaments lit at any time and they’re not all lit on the same multiplex. So that’s how I arranged it. I arranged it in such a way that I wouldn’t multiplex a bank if I’m not using a light, which sounds peculiar. But the whole point is multiplex normally, if you’ve got a seven segment display, you multiplex each digit, flash them on one after the other backwards and forwards so they all look as though they’re on.
Mike:
Right.
Keith:
But in my case, I didn’t need to do that because I only ever had three lights on at any given time. So the ones that had the banks of multiplex that I didn’t use, I never multiplexed. It’s what we call sacrificial multiplexing. In other words, only multiplex what you want to display and forget the rest.
Mike:
Okay. Yeah. I think I’m following that. And just for folks listening, when we’re talking about multiplexing, it’s the idea that programmatically, you can use one input to drive lots of different outputs, right? That’s basically the idea and it’s allowing you to assign different outputs to that one input?
Keith:
I suppose the easiest way is if you said, if you connected all the annotes together, and you took all the cathotes and you powered each cathote individually, you would only light that one [inaudible 00:07:08]. Although it was tied to one annote at the top.
Mike:
Yep.
Keith:
So if you start sequentially lighting them and go faster and faster, as soon as you get to a certain speed, they all look as though they’re on, but you’re only using the same amount of power as if you have one on.
Mike:
Okay. Yep. I follow what you’re saying.
Keith:
So you reduce the actual overall current consumption of the light bank, but you still get an equal amount of light out.
Mike:
Okay.
Keith:
But the [inaudible 00:07:38]’s also like to be flashed, they don’t like to be on continuously as well. They’re a typical electronic device which prefers an odd pulse and then let itself cool down again and then another pulse and let itself cool down. So it does have that advantage as well, multiplexing.
Mike:
That’s really neat.
Keith:
It also means, if you look at the five minute clock, I’ve got 47 individual LEDs that are going to be lit by the end Arduino. And you couldn’t do that because you won’t have enough outputs on the Arduino to do that. So what you actually do is you take one bank of six drive outputs and you arrange the LED arrangements as banks of six. So effectively, by powering any of those six, you can light up to six LEDs from each output. And then all you have to do is you then start to power the cathotes below to light the individual light LEDs out of six. Because you take those six to separate cathotes and you take all the other six to separate cathotes as well.
Keith:
So you get to the point where you can actually control one single LED on its own from the Arduino just using two banks. But there’s also another sneaky way. It’s because if you know, to write to a port in an Arduino, you write each individual output. But you can get away with it by using what they call a decimal write. So if you say, “Write B11-11110,” you can actually write to six ports all at the same time. So you don’t have to write to them individually. That one I don’t know if you know about.
Mike:
Yeah, no, I’m familiar with that. Using the Arduino I don’t necessarily use those commands, but if I’m ever just writing code for the 328 without the Arduino IDE, just writing to an entire bank of outputs or GPI or whatever. So I am familiar with being able to turn them all on at once in one call or off or whatever order you want in that bank.
Keith:
True, which is great for multiplexing because you don’t want to waste time writing to each LH output. And then switching on your cathote and lighting them up. This way you can write as one quick bank, straight into it, line them, then put them back off again.
Mike:
I don’t even think I was familiar with that Arduino command so I’m going to have to check that out. It’s a decimal, is what it is?
Keith:
Yes. You just say, just write to B, the first two digits after that, the two numbers after that, you always write once. And then the next six after that actually are the port outputs.
Mike:
Oh, okay.
Keith:
That’s from pin 13 coming back on yourself. Pin 13, 12, 11, 10, 9, 8. So you come back six, so you can write to those six in one go.
Mike:
Okay. That’s really cool. Yeah. Because if I understand correctly, the pins on the micro controller that the Arduino uses, they’re organized into different banks. I think there’s maybe three different banks in total?
Keith:
That’s correct. Yeah.
Mike:
Yeah. So that’s pretty neat. That’s cool. I know you’ve been saying five minute clock and when I first was looking at your five minute clock, I wasn’t quite sure what that meant. It made more sense when I saw your clock in action, because it is a digital analog clock. And I’m just curious how, if you could explain that feature of it. Because when somebody says five minute clock, I wasn’t sure what it meant, but like I said, when you see the clock, it makes more sense.
Keith:
Right. We’ve only got 12 pounds that we can light up. Therefore we can only step in five minute steps round the clock face. So every five minutes, the minute one will jump up to the next number. And then the next five minutes it’ll jump onto the next. But a lot of people say, “Well, that’s okay just as a general clock, but I want to be more accurate.” So what I do is put four little lets in the middle in a little triangle, a little square in the middle. Now, as you jump to the first five minutes, those lets start to light up one at a time for the four minutes and then they go off and he jumps to the next one. And then they start to like up for them, and it’s one at a time, then jumps to the next one. So it’s a five minute clock feature because it jumps in five main ones, but it actually shows you the minutes in the middle.
Mike:
And on your website, it’s www.5minuteclock.uk if you’re listening, definitely go check out the website. Because Keith has an example of the clock kind of sped up in action so you can see how it plays out and it’s really clear how it’s happening. So if you’re listening, you can think of an analog clock. It’s got an hour hand and a minute hand and you can imagine the hour hand is going to be the shorter, there’s two filaments in a row that make up the clock hands. And so the hour hand’s going to be just one filament lit up and then the minute hand goes around with two filaments, right? And the two filaments move. But then in the center, like Keith was saying, there’s four LEDs and then so for each minute, one lights up and kind of goes in sequence. Anyway, if you go to the website, he’s got a GIF set up so you can kind of watch it play out. And it’s just a really neat movement. And definitely it’s easier to read the minutes than it is on just a traditional analog clock. Because it’s pretty exact. It’s like, “Hey, it’s 16 after five or whatever.
Keith:
It goes a little bit further as well. If you know the outer LEDs depict the hours, each one of those just goes on and off slightly as each second goes round. So those dim and come back up again, one at a time, all around the outside and then the minute steps on in the middle and then it starts again and goes around in the outside.
Mike:
Oh see, I didn’t think I realized that. All right.
Keith:
Yeah. There’s another page. If you actually go to the website, there’s one that shows the displays of it doing all these different features. One page. And it shows those little seconds going round on the outside and then stepping on the minute in the middle.
Mike:
That’s so cool.
Keith:
But it goes even further because it is actually a 24 hour clock, not a 12 hour. Because it’s an alarm clock as well. So when you actually set it up, when you step in the hours round, you can have one button on one side. If you press it, you step in the hours round to set the time. When it gets to 12 hours, at 1300 hours, the bar goes to the outside and steps around on the outside, goes back round till it gets to 24 hours, then goes back to the inner one. So you can actually set the exact time, which is very important because as an alarm clock, it’s a 24 hour alarm clock. So if you set it for 7:30 in the morning, it will go off at 7:30 every morning. It won’t go off like an ordinary analog that would go off every 12 hours. It goes off every 24 hours.
Mike:
That’s awesome. Do you have a [inaudible 00:15:21] buzzer built in?
Keith:
Yeah.
Mike:
Okay.
Keith:
Yeah, it [inaudible 00:15:24]. And it also flashes its display to let you know.
Mike:
Okay.
Keith:
That you’ve got to the alarm and there’s a little light right slap bang in the middle that tells you if you have armed the alarm or not. So there’s a little light that lights up right in the middle.
Mike:
That’s nice. And so this is a nightlight in the sense that the clock itself, its ability to tell time, those filaments are what is the nightlight itself, right?
Keith:
Yes.
Mike:
Got you. Okay. That’s really cool. Now, when you were developing this, what kind of Arduino were you using?
Keith:
I started really on the [inaudible 00:16:01]. But now we use the nano in it.
Mike:
Okay.
Keith:
As a construction, I’ve done all the board and everything, all you do is you just drop the nano in and it works.
Mike:
Oh, nice.
Keith:
That’s it.
Mike:
Okay.
Keith:
You’ve got two resistors, one capacitor, and your Arduino, nano. That’s it. After you put your [inaudible 00:16:23] in.
Mike:
And for telling the time, are you using a realtime clock or another micro controller?
Keith:
Yes. No, we use the clock that has a battery so that if you unplug the clock, it will remember the time for 12 months at least and you can plug it in at any time, it’ll come back on again. And because it works on the USB, you can just plug it into the USB of your computer or plug it into the USB on the wall socket or just use any adapter and just plug it in anywhere. Just works.
Mike:
Oh, that’s nice. So if the power goes out, once the power comes back on, it’s going to go back to the time.
Keith:
It just comes back to the same time.
Mike:
Oh man. Geez. Where I live, the power goes out all the time. It’s like, I just got this schedule, the power goes out. Okay, I’ve got to do the stove, the coffee machine, the microwave, all the other clocks. You know what I mean? No joy there with no little batteries in.
Keith:
No. It remembers it all. It does. No problems at all. And it also remembers what time you set the alarm for as well.
Mike:
Okay. Nice.
Keith:
Because I write the code into the EPROM of the Arduino. So any settings that you set, it remembers how you like it. Because you can have a few things, if you don’t want the outer lights on, you can press a button and say I don’t want those on and you can just put them off and just leave the bars on. And you can dim it and brighten it because you’ve got another button at the back, you just press it and it goes dimer and dimer and dimmer or press it more and it goes brighter and brighter and brighter. So you can actually set the light adjustment.
Mike:
Oh, that’s really fun.
Keith:
It has got everything, this clock. You would not believe. And I’ve also got an adapter, I’m nearly finished programming, which has been a bit of [inaudible 00:18:15] to tell you the truth, but it’s for the atom time, the atomic time.
Mike:
Oh wow. Neat.
Keith:
So it will read the atomic time and it will actually write into your clock. So even your clock then won’t go out of sync.
Mike:
Oh, that’ll be fantastic.
Keith:
And I’ll tell you something, that is one real program to write, to actually sync into the atom clock is unbelievably difficult.
Mike:
Is it?
Keith:
People have tried and failed. I’ve done it with 12 instructions I think.
Mike:
And you just use an Arduino code then for it?
Keith:
Arduino code. But I’m using two of the Interox.
Mike:
How long have you been working on the clock?
Keith:
I started probably about 15 months ago. I built my first one. But I’ve developed from then with it. You do need a 3d printer because the problem with the filaments is that they’re an all round light, the [inaudible 00:19:15], it’s not just light at the front. So if you just put the filaments in, the light spreads to the others so they always look as though they’re on. So I designed a little filament assembly to put the filaments in. One, to stop them breaking, but another thing is it gives them sides so they don’t spread the light to the side till comes to the front. So things like that I had to develop really and get around it.
Mike:
Okay. I see. So it looks like a distinct line as opposed to them all.
Keith:
Yes. Because you’ll find that one set of light would make the others’ side glow, particularly at night when it’s dark. And it doesn’t look right. You want it to look crisp, the numbers.
Mike:
Are the filaments hard to work with? Do they bend or not? Are they rigid?
Keith:
That is a big problem. The elements and the fittings that you see, unless you see the modern ones, it’s like flexible filaments. They tend to be quite long ones. But the short filaments are actually on rigid plastic. And you can break them very easily. You’ve got to be careful with them. Really have. This is why, in some ways, I made the filament holder for them and the filament holder actually holds them nice and rigid.
Mike:
That’s cool. Now you have developed kits for these, right? And you’ve got them available for sale or do you have any available? I know I was reading, it looked like you had sold out. Do you still have some available?
Keith:
Every time I get any kits, they go the next morning. I think we have some available. The printer circuit boards I’ve got available and the programmed Arduinos, they’re available. They’re okay. The other bits, like the filaments, I keep buying like a couple thousand from China, and because they go quite quickly, I always supply an extra filament because you can guarantee you’ll break one when you start fiddling with them. So I always throw an extra filament in just in case.
Mike:
And is the kit like a solder? It seemed like you had a couple different options. So it’s a kit you get, and then you solder it together? And you 3d print the parts? Is that how it works?
Keith:
I’ve offered it in two ways. I offer a bare bones one where you build it all yourself, but I’ll make the plastic parts on my 3d printer or you can make the casing parts yourself. Because you can house it in anything you want to house it in. I’ve seen people house it inside the kitchen cabinets. In that little glass at the front. So they just bought the printed circuit board. So I sell the printed circuit board as a board with the parts on the board to go with it. In other words, the filament holders, and the little bracket to hold the tiny clock at the back. And there’s a little disc in the middle that has five holes that you drop in the middle. And that separates the little lights for the minutes and the alarm time in the middle. You saw all the listings on the website and I’ve now got instructions on the websites as well, how to build it. I don’t know if you’ve seen that, with a circuit diagram and everything.
Mike:
Okay, nice. Yeah. I did see some of that stuff. And for plugging it in, I know part of it seemed like you really mentioned on the website that it’s got a pretty low current draw if I’m not mistaken, is that right?
Keith:
About 40 millionths.
Mike:
Okay. So to plug this in, it’s a USB cable? Is that how you’re powering it? Is that right?
Keith:
Yes.
Mike:
So a USB cable to like a traditional wall charger you might use to recharge a phone or something like that.
Keith:
Yeah. That or a computer. Any USB socket. Even the wall sockets that you get with USB in them there.
Mike:
Right. Yeah. Those are starting to pop up more. I wish I had those in my house. I got an old house though. Some of my house still has two prong sockets. Of course you’re in the UK, I’m sure it’s a bit different there with the sockets you use. But still, that’s pretty handy. That’s nice. And for people listening, you got to check out the clock because it just looks really unique. It’s a really unique, cool looking clock. And I could totally understand why somebody would want to mount it in a kitchen cabinet because it’s got a really classy and modern kind of thing all in one I guess is one way to explain it. So I don’t know. It’s been really neat learning about these, Keith. Is there anything else you’d like to say about the clock?
Keith:
I don’t think so really. People may question why I have an inverter in the back. I don’t let you plug the USB straight into the Arduino, although it actually will work plugging straight into the Arduino, because it’s drawing its five volts from the Arduino five volt output. I use the inverter really because the Arduino doesn’t really like five volts into it. It’s not stable. It isn’t. And you don’t get a good five volts out of some of these charger adapters and such things.
Mike:
Right. So you’re using the five volt pin to power the source then? Is that what it is?
Keith:
That’s right. So I actually take the voltage up to 10 volts and then feed the 10 volts into the Arduino, that was intentional to keep the Arduino stable and also to allow you to have quite a variation of voltage of your power in. Because if it’s only like 4.5, 4.6 volts from your adapter or whatever, or a little bit over five volts, won’t make any difference. It will stabilize itself through that little stabilizing inverter in the back. So that’s why that’s there. People may say, “Why you putting that there?” Because you could do it from the Arduino, but you can’t really. It’s not a stable way of doing it.
Mike:
How was it programming the clock? Was it difficult or hard? Just not necessarily the atomic part, but the rest of it. It sounds like you’ve got some background experience in software development.
Keith:
I used to program microprocessors. So I’m used to pneumonics and machine code. That’s how I always used to program, particularly pneumonics.I never really went up to the C level because to tell you the truth, the actual memory in the process of things wouldn’t have been large enough at the time when I was programming them. Because it’s lazy programming once you get to C and things like that. They called it lazy programming because you’ve got unlimited memory. It doesn’t matter how good the assembler is on such things, it’ll still work anyway. Whereas you just couldn’t do that on the early processors. You’d just run out of space, you’d have no room.
Mike:
Right? So how was then the transition to using Arduino?
Keith:
I found it was quite easy. There’s a few things I’m still learning, actually, some of the tricks you can do on it, which your actual programs have been very useful for that. Just to give a basics of certain operations, of certain instructions, which I would normally never go. I have go-to instructions and things like that in pneumonics and such things where it would be frowned upon to go to in the Arduino and things like that. But in your sub routines, they’re a pretty standard jump to a sub routine, they come back out of it. That’s pretty easy, standard stuff. I understand that side of it.
Mike:
That’s cool. It must have been fun to build it. It’s such a fun looking clock. So that’s cool.
Keith:
It takes about 30% of the Arduino memory.
Mike:
Does it?
Keith:
Yeah. It’s quite a big program. It’s surprising how big it is. Because you get silly things. Like say you got to the time where the minute hand overlayed the hour hand.
Mike:
Right.
Keith:
What you attempt to do is get the hour hand to glow brighter. So you’ve got to tell the Arduino, just in case that gets in there, don’t switch the hour hand on, leave it off. Otherwise you get a brightness difference.
Mike:
Right. I see.
Keith:
And another trick, I don’t if you’ve noticed, when you see the clock, it’s actually steps at the 25 to the hour time and not on the hour. So at 25 to the hour, the hour hand will step.
Mike:
Okay.
Keith:
The reason is, is that when you look at it, as you come down the clock on the half hour, you come in five past, 10 past, 20 past six. As soon as you get to the 25, the 35, it’s then 25 to 7:25, 20 to seven, quarter to seven. So what happens is the hour hand moves on. So it moves on at the 35 minute and not at the hour.
Mike:
That’s interesting.
Keith:
Just the odd ball things like that.
Mike:
Right. I know. Trying to code that up and figure it out. That’s cool.
Keith:
It’s hard to do that. Yeah. A lot of people can’t even write to a tiny clock, because you’ve got to write the time to the tiny clock.
Mike:
Right.
Keith:
You’re setting up the time.
Mike:
Right. And the tiny clock, I was looking at your schematic. I haven’t worked with the tiny clock before, is it just like a specific type of realtime clock essentially is what that is?
Keith:
It is a real time clock, but it runs on that special bus that comes out of the Arduino.
Mike:
The I2C bus?
Keith:
Yeah. The I2C bus.
Mike:
Okay.
Keith:
And people find it’s very difficult to write to, to understand how to write to it. But there is a way of doing it, a very simple way of doing it. It has at the top of the clock, it’s got the days, it’s got the months, and years, everything in it. And it’s got a bit of spare [inaudible 00:29:38] prompt that you can use in it.
Mike:
Oh, that’s nice.
Keith:
Yeah. So you’ve got a bit of an overflow there if you want to use it.
Mike:
So for anybody out there listening, who’s thinking about tinking around with this stuff. Any thoughts for them?
Keith:
Do it. It’s good fun. I’ve done a seven segment clock, they look good. It all works, it’s really stable. And if you’re using the three volt filaments, you’ve got no real voltage problems as well coming from the Arduino, the Arduino can drive it quite happily. They don’t get hot, they don’t overload, they don’t do anything. So you’ve got no external drivers, even if you’re not used to multiplex and then using [inaudible 00:30:20] with modernation, be careful about driving from the Arduino because you’ll soon get to the 40 millionths on your output of the Arduino pin. And 40 millionths, although the filaments will take it, they don’t like taking it at five volts, because they’re actually a three volt device. So you risk then actually going into overload. And if that, they’ll really just start drawing the power from the Arduino, then you could actually damage your output then.
Mike:
Got you.
Keith:
Yeah. So be a bit careful. Keep using it as a pulse with moderation, then it’s fine.
Mike:
That’s awesome. Keith, thank you so much for your time. I really appreciate it. This has been fun.
Keith:
It’s no problem.


Excellent as always!
Thanks Steve!
Could not access his website: fiveminuteclock.uk
Sorry Keith, the transcript had didn’t include the character “5”.
See here: http://www.5minuteclock.uk/
Thanks for letting us know!