Feature

Hands of Time

Arduino-Based Panel Meter Clock

Steve Jay

Issue 51, October 2021

This article includes additional downloadable resources.
Please log in to access.

Log in

An amazing “arch retro” (fake) analogue panel meter clock with Wemos D1 mini digital core.

We’re spoilt for choice these days with all sorts of fancy clocks and displays to tell us the time. Sure, some may have bells and whistles to display the weather, have built-in alarms, etc., but we’re sure they don’t have the character and charm that this retro-looking timepiece has.

With its steampunk appearance, analogue display and electronics internals, we just had to know more about this spectacular build. Steve was happy to share his project with us, and has even included the details to make one for yourself.

It’s really kind of you for sharing your project with our readers, Steve. Before we dive into learning more about your clock, please tell our readers a little about yourself.

I’ve been into electronics to some degree since I was a teenager in the mid/late 70s. It was always an adjunct to my music, from repairing cables to building or modifying several guitar and bass amps. So yeah, I’m mostly a low grade “analogue kid.”

However, my first ever microcontroller was a Baby 2650, as published in Electronics Australia. I can’t remember how much it cost but it wasn’t cheap and the best I could get out of it was assembly code to make it count to 10, and even that was buggy. It kind of put me off micros until my first drum machine but, by then I wasn’t game to pull apart $500 or $1000 machines to see how they ticked. So I became digital user, rather than a digital maker.

A short career in electronics and a long career in broadcasting (audio technical producer) later, and I was made redundant with enough super to retire stupidly young and got into 3D printing in 2017. The “Santa Claus Machine!”. In an effort to understand them better, I started fiddling with Arduino. The clock is the result of all of that. My life’s work, you might say :-)

We’re sure you have many of our readers reminiscing about low-level programming in assembler language. So, it was music that got you into electronics?

Yes, Rock’n’roll made me do it. I’m a guitarist and bassist and music amplification has always been insanely expensive. I stumbled across the original ETI article about the ETI480 50/100 watt amplifier module, and bless, as a wet behind the ears teen, I thought I could build one of those cheaper than a Marshall. I laugh. I never actually successfully built an amp good enough for pro work until the late eighties. A MOSFET 150 watt bass amp. I had had a succession of worn out tube amps for guitar and they taught me 2 things in electronics, don’t brush your hand across plate voltage and don’t use unmatched “bottles”. I destroyed a classic Aussie Strauss head to learn the second.

Ouch! That’s a painful and costly lesson. We just love your clock build. What inspired you to make it?

I’d seen a similar clock on Arduino Playground that used big, industrial, square, corner pivot meters. I wanted something even more retro, perhaps even steam punk. So I searched around on eBay and found these replica “antiques”, which have a look like an old Tassy electricity meter but fit into a conventional panel meter hole set. They’re typically about $40 each from China now, but at the time, I picked up a dozen for $9 each, seeing an opportunity for a market stall item.

SO45 0-300VAC Round Analog Dial Panel Voltmeter from 'yopretty' on eBay.

And, Christmas 2019 was coming up. Dad used to be a civil engineer with Tasmania’s railways (as well as an avid home woodworker and handyman) and was significantly impressed with my 3D printers. I wanted to make something that he could appreciate for its practicality, design and his engineering connections, as well as something that was a bit fun. He is the reason I followed what we now call a STEM pathway. He was blown away by it, of course. Sadly, he passed 2 months after receiving it, so I inherited it back. I’d also made him a desk lamp the year before, which my sister still has.

We imagine your Dad would have just loved it. What parts does it use and how does it work?

It uses surprisingly few parts. The meters, of course, two push buttons, 4 LEDs, a number of resistors, a pair of polyester capacitors to filter the micro’s PWM meter drive and a Wemos D1 mini with a proto hat to handle the few connections.

The idea was to make a complete anachronism, a clock that looked like it was designed by Nikola Tesla on a commission from Sir Arthur Conan Doyle. A housing that hid the digital core inside, so masterfully, that you’d never know without opening it up. It doesn’t even use an RTC module because I wanted it to have some natural drift, just like a real, analogue clock. The whole thing also needs a USB cable and a USB mains adapter for power.

The code is essentially based on “Blink Without Delay.” Every cycle through the main loop polls millis() and tests if 1000ms have elapsed. If true, it increments seconds, if seconds are greater than 59, it sets them to zero and increments minutes which, in turn, increment hours. It also tests if the 2 modulus of seconds is false (0) and turns the right LED on for even seconds and off for odd seconds, also doing a toggle on the right hand LED as the hours change from 12 to 1.

It also tests if the millis() counter has reset, doing nothing until next cycle. This overcomes the dreaded hang. For some reason or other, it still hangs about once every 2 months. I like this, because it’s part of the whole. Heath Robinson joke.

The top pushbutton sets the hours when you hold it in, including the PM light, so it’s 24 steps for full cycle. The bottom button sets the minutes with 60 steps for a full cycle.

The meters are 50µA FSD (once the 300v AC ballast resistor and diode were removed, at least) and are driven by basic PWM. The D1 can have PWM out on most of its GPIOs and, being an ESP8266, is still quite compatible with basic Arduino code.

Yeah, I said 4 LEDs. While I had the meters apart to remove the ballast circuit, I glued 2 white LEDs near the needle gland for backlight, and laser printed then glued the hours and minutes graticules onto the original meter faces, before putting them back together.

Why did you choose the Wemos D1 Mini?

The D1 is just so versatile! I had a few on hand from another project, and thought the web server features possibly might be a good feature later on. Again, in keeping with the steampunk “prank” factor, station only, and just for setting time, and maybe an alarm. Having more flexibility on its GPIOs than an Atmel based board, it also had potential for a neater wiring layout. Although, looking at the internals for the first time since I’d built it… let’s say that, if I’d set up an outside broadcast point like that in my working life, I’d have been sacked! :-)

We’re all guilty of doing some quick and dirty wiring to get a project up and running instead of taking the time with neat wiring and connections. How did you go about designing the panel graticules?

The panel meters were setup to measure 300v AC and needed a lot of work. While I had them apart to remove the ballast circuit, I had to measure the needle swing angle between 0 and FSD, get a fairly tight measure of the graticule radius and work out how many degrees per hour. The measurements were tricky and hard to do without damaging the needle. You can’t just stick a protractor in there. I had to get my vernier caliper not quite touching the needle at its pivot and measure out to the scale, then calculate the arc from the chord. I hadn’t done that since grade 10 level 3 maths in 1977! I love the internet :D

I’m a bit neuro-diverse and never got my head fully around FreeCAD or even Fusion 360, but OpenSCAD “sings” for me. I designed the scale in OpenSCAD, exporting it as an SVG, a free, text coded CAD software that has a C like syntax.

The new graticule was printed onto copier paper and super-glued to the panel.

Brilliant! Do we assume you also used OpenSCAD to design your 3D printed enclosure?

Yes, the enclosure is also designed in OpenSCAD. It was an attempt at creating an old school, 1970s project case like I could never afford as a kid. The sort of metal ones that had a grey front and back panel as part of the tray and a hood that slipped over the top in black. I went with 3D Fillies copper for the chassis and… argh, the hood failed, using up the last of my black, Christmas was looming and it was going to be my wife and my gift to Dad. It’s copper, painted black. I had to get it in the post that day! (I live in Melbourne, but I’m originally from Tasmania.)

I’m very happy with the steampunk look. The layer lines and colours just look so industrial and like something moulded in an old fashioned machine shop.

The design is essentially two cubes. One is differenced with cubes and cylinders to create the chassis, the other is differenced with a large cube’s small cube (for the USB cable that powers it) and hulled cylinders for the side vents. It has conical model feet modelled on the rubber feet you can buy from Jaycar or Altronics, etc.

It took about 8 hours to print on my delta printer.

It has come up really well, and nice save getting the paint and paintbrush out to save time. We also noticed some 3D printed gears in one of the photos. Are they part of the clock?

That was built up from test gears I made while calibrating my second 3D printer, a clone of a Sinus T1 delta. It was a nasty, $150 kit that took an age to calibrate, but has turned out to be my most reliable printer. The cheapest one. Go figure.

Meanwhile my “highly recommended” most popular brand, $550 printer clogs hot ends because I can’t get enough drive off the proprietary Melzi board to run the extruder.

Anyway, Dad was a civil engineer and home woodworker, so he was fascinated by my printing and custom designs. So I would always take him an interesting print when I travelled down to Hobart to visit. That main photo of the clock was taken just after Dad died. His clock, with the gears on top, sitting on his favourite antique Huon pine dresser.

The clock would be a nice reminder of your Dad every time you look at it, and obviously, a reminder of your own engineering prowess too. What design challenges did you need to overcome?

The biggest one was measuring up for the new graticule, without damaging the meter while it was semi disassembled, but calibrating the PWM values was time consuming because the hour steps are slightly different to the minute steps because of tolerance variations. Neither meter full scales at 1023 for analogOutput(). The rest was really quite basic Arduino code.

My programming attempts began on the old TasNet mainframes that senior secondary students could access via dumb terminal, so I look at the simplest, straightest route to a desired feature. This is, I reckon, especially important for microcontrollers, too. Don’t try to do too much in the main loop or you’ll choke the poor thing.

Good advice. If, like us, our readers fall in love with your project and want to build one for themselves, do you have a wiring diagram and build files?

Yes. Feel free to include.

The details are also on my GitHub https://github.com/crunchysteve/YAPMC.

Thank you, Steve. If you were to start over, what things would you do differently?

For the steampunk effect, the meters I chose are a great look but they’re not exactly easy to read from a distance, so it does clock duty on my desk these days, since dad passed. Still, I’m not sure I’d choose an easier to read meter, either. It adds to the cheeky prank parody and the Heath Robinson nature.

Also, if time pressure hadn’t been such a problem with the build, I’d have spent more time on a wiring loom. The current one is a “rats nest” of Dupont wires and the prototype hat, and I’m having a struggle figuring out the component values as a result.

The next versions, if I ever get enough gadgets together for a market stall, will probably eliminate the hat, which is only used to distribute power and ground to the lights, and meters.

The production housing won’t need the plugged hole between the pushbuttons, either. The design process was to make more brackets and holes as I thought of potential feature then time paired back the scope drastically. :D

We’re getting the idea that you don’t take life too seriously Steve, which we admire. We got a chuckle out of the profile picture you sent also. Thank you so much for sharing your project with our readers.

Steve is quite the artist from the looks

The Build:

Build notes

Wemos D1 mini

I have used an ESP8266 in the form of a D1 mini, which is powered by a generic USB wall plug.

Any Arduino or compatible board should be usable in this project with little or no modification to the code, other than pin definitions in pins.h. Of course, your mileage may vary.

The hat on the Wemos D1 mini is used for splitting the 5V rail to the backlight LEDs and ground to the same, as well as ground to the meters and indicator LEDs.

Parts Required:JaycarAltronics
1 x Wemos D1 Mini or EquivalentXC3802Z6441
1 x D1 Mini Prototyping Hat--
2 x Coloured LEDs (Orange or choice of colour)ZD0119Z0804
2 x White LEDs (For panel meter backlights)ZD0195Z0876E
2 x 50µA Panel Meters See text 
2 x 33kΩ 1/4W Resistors*RR0608R7594
2 x 470Ω 1/4W Resistors*RR0564R7550
2 x 270Ω 1/4W Resistors*RR0556R7039
2 x 4.7nF (0.0047µF) Polyester Capacitors*RG5047R2710B
2 x SPST Momentary N.O. PushbuttonsSP0711S1060C

Parts Required:

* Quantity required, may only be sold in packs. Hookup wire and cable ties also required.

Panel meters

The panel meters I used were from eBay. Search for "Voltmeter SO-45 AC 0-300V Round Analog Dial Panel Meter.". Other panel meters can be used, but resistor and filter capacitor values will need to be changed.

Wiring

  • The hours and minutes display via PWM on the pair of panel meters, driven via PWM on pins D6 (minutes) and D7 (hours).
  • Seconds and AM/PM are marked by an LED on pin D5 (seconds, optional, off for odd value, on for even value), and D8 (AM/PM)
  • Minutes and hours advance via momentary pushbuttons (or two-way momentary switch) connected to pins D3 (minutes) and D4 (hours)
  • The meter backlights are simply hardwired (on all the time) to 5V

Arduino IDE

The Arduino IDE needs semi-manual installation of the board extension.

Possible Improvements

The meter backlights could possibly be connected via pins D1 and D2, brightness managed via an LDR on A0, as well as potentially dimming the backlight significantly after 10PM via PWM. Note: Working hardwired, not yet tested with LDR on analog port.

An alarm function could be added by using D0 as a setMode button and sacrificing flashing seconds on D5 to be used to send a tone to a buzzer instead. This may be added to a later version, but is not immediately supported in this version. There are insufficient pins on the D1 mini to have flashing seconds as well as an alarm function, but other boards, such as a NodeMCU ESP8266, typical ESP32 boards and most Arduino, will have sufficient pins to have a full feature set.

Configuration by internal wireless AP and web server including configuration of connection to home wifi. The alarm function could also be managed from this feature, as well as simply from the front panel. NTP time management configurable in above web-based configuration feature.