What All the Howling’s For

Story so far: Key components are working; hot plate made from steel block and lamp made from . . . lamp?                                                    

TL;DR: My Clock tells the time to my Arduino which tells it to my LCD Display. The technical lingo for this communication system is . . . curious. Clocks work by counting how many times a crystal vibrates, your dog can hear the crystal vibrating and hates you because of it.

There’s just three more bits of this build to tackle – the Clock/Display, the housing, and the code. This post will cover the Clock/Display – that’s why I listed it first. I’ll start by saying that the terminology for how the Clock and Display get wired up is one of the more curious examples of engineers anthropomorphising their hardware, presumably in lieu of friends (as per this entire blog series). The picture should make it clear what I’m talking about.

A model for “I2C” communication. Arduino “master” can communicate with its “slaves”, the Clock and the Display, through the red data line.

Yep, we don’t just have a controller and its peripherals, we have a master and its slaves. I regularly think about how that ever became the accepted nomenclature and am yet to make it past the incredulity of asking “How’d It Get So Scandalous?”. But Stay Woke, there’s a few examples of leaving these terms behind, most notably, the Python programming language now refers to “parents” and “workers” instead. Personally, I don’t see anything inherently egregious about the terminology, I just find it incredibly strange that those terms were the ones that stuck. It’s also worth pointing out that any brands that have changed their vernacular seem to have done so as a result of the same single court case in Los Angeles. So, while it’s easy to assume that complaints are a result of forcing the wrong context onto the situation, the aforementioned single court case may be a result of a single particularly flagrant use of the terms.
The rest of the story is oh so very L.A. too. I put it to you that nowhere else on the planet would a complaint centred on an African American person feeling offended at the use of the term slave be countered by a complaint centred on a person involved in “the BDSM sub-culture”, who feels offended that someone feels offended at the use of the term slave (presumably outside of certain contexts). But that’s what happened. Among other things.

So, anyway, how that circuit works – the Arduino master shouts the address of the slave Clock down the red “data” line to tell it to listen up, and then asks it for the time. The Clock obliges and sends the time over the data line to the Arduino master’s address. The Arduino master then shouts the address of the slave Display down the data line to tell it to listen up, and then tells it to display the time. The Display obliges.
The blue “clock” line is just used to keep everyone in sync and has nothing in particular to do with the actual Clock, or anything I feel like writing about, really.

Aside: The Display is blindingly bright and so it will be asleep most of the time. Subsequently, I made a touch sensitive button to wake the Display, but I don’t think I could write anything about it that I would ever want to read. So, I won’t write anything about it.

There is one more vastly interesting topic that has a place in this blog post, however, and that’s the Clock itself. How does it know what time it is? The method below is true for pretty much any clock that has a battery or other electric source1 (including your phone1, watch1 and microwave).

The functional part of the Clock is a little tiny quartz tuning fork. A tuning fork is just a tool that vibrates at a specific frequency when you hit it – when it vibrates at a specific frequency, that creates a sound of a specific pitch.
The quartz tuning fork in your battery-powered watches and phone is set at a frequency of or above 32,768 Hz – too high of a pitch for you to hear (also too long of a number for you to read, I’ll say 32K from now on). This makes sense, I mean, if I wanted to hear my phone make a high-pitched whine all day, I’d call my girlfriend, am I right fellahs? Ha. Got ‘em. Nah that’s a joke, I don’t uh have one of those, like, you know, a girlfriend, or whatever.

Notably though, that frequency (32K) is about the same as an average dog whistle, so keep that in mind the next time your dog seems a little restless – your watch is like a very whiny fly buzzing around their ears1. This is another classic pitfall of anthropomorphising things – forgetting that humans and animals perceive the world very differently. I still wouldn’t worry too much about it though, I can’t imagine the noise is very loud. It is certainly audible, though, otherwise we wouldn’t have bothered to design these things to vibrate at a frequency we can’t hear.

“Artist’s” impression of a dog being bothered by a particularly irritating vivified watch. For commissions email contact@calebhalfpenny.com. 😉

Anyway, the important part about these quartz crystals isn’t that they make sound, it’s that with each vibration, they also generate a small pulse of electricity. Since this pulse of electricity happens every vibration, and we know there’s 32K vibrations every second, we know we need a circuit that adds one second to the time for every 32K pulses we put into it. If that sounds like a fun thing to learn about, you can go search for info on “edge-triggered flip flops” – be warned though, despite their name, they’re no day at the beach. Unless you already have a grasp on binary signals2.
So all we do is give the Clock a starting time, AKA setting your watch, and start it. It’ll then count from 0 up to 32K over and over again, and every time it returns to 0, it’ll add a second on to the time. Then there’s a whole mess of gears and/or circuitry that keeps track of how to display that as minutes and hours. Truly though all the Clock is doing is counting how many seconds have passed since the time it was set. And THAT’S THAT.

Except for the most interesting part! When we hit a tuning fork, the noise eventually fades to nothing. A similar thing happens with our electrical pulse from our quartz tuning fork. So, we need to keep hitting it. Except we don’t. We don’t hit it at all. We actually zap it with some electricity because in a similar way to how our quartz crystal produces electricity as it vibrates, zapping it with electricity makes it vibrate.
So, we start by zapping the crystal with electricity to make it vibrate, this gives us the regular pulses of electricity that we’re after to keep track of the time. The clever bit is that we also tap off a little bit of that electricity and amplify it, then zap the crystal with our amplified electricity to keep it vibrating at the right frequency. If the ability to understand a quartz crystal clock circuit was the only thing that came from my engineering degree, it’d probably still be worth the fees. These circuits are what make me tick. Ha. Got ‘em. Nah that’s a joke, I don’t uh have one of those, like, you know, a way to pay off university debt, or whatever.

Left: Here’s one I made earlier. An uncovered quartz clock from an old phone of mine. Pretty cool.
Right: A very questionable illustration of the time-keeping circuit. When a small electric pulse is given to the amplifier by the quartz, the amplifier allows a large pulse through from the battery to sustain oscillation of the quartz.


The concept related to quartz producing electricity as it vibrates is called piezoelectricity3. Pronounce that literally however you want to whenever you say it out loud, just do it with conviction. That’s what everyone else seems to do. Resonance also has a pretty big role to play in all this. It’s a cool thing.

That’s about it, now we have a circuit where the Clock is constantly counting the seconds and telling the Arduino the time, and the Arduino is constantly telling the LCD Display to display that time, but the Display can’t actually do that unless I touch a button to wake the Display.
Also, if you lose your dog whistle, hold your watch up to a microphone4. Also, also, don’t kink-shame.

  1. Except that I make a lot of reference to the 32 KHz type of crystals. These are very common, but for something like a phone or a smartwatch, the crystals actually vibrate at a much higher frequency. Generally, this means the tuning fork can be made smaller, leaving more space for an extra camera lens or something that can be marketed better. The rule of thumb that I have completely made up is that if you can reasonably say that something is a computer, it probably doesn’t use a 32KHz crystal (and a dog probably can’t hear it).
  2. Each flip flop changes state only at the rising edge of its input. This way, each flip flop outputs electrical pulses at half the frequency of the input. Halve 32,768 Hz fifteen times and you get a frequency of 1Hz – or the frequency of a clock’s second hand.
  3. Piezoelectricity isn’t my forte, but, as I understand it, the crystals get designed so that some inner structures are positive and some are negative. To the outside world these charges balance out so we don’t get something like a battery or a metal. But if we deform the crystal (by hitting it or electrocuting it), these inner structures shuffle around a bit such that the charges are imbalanced in some areas – electricity is made. I think.
  4. This won’t actually work. Microphones are typically designed to only pick up signals that humans can hear and even then they often miss the higher frequencies. I only say this so you don’t think your dog is being deafened by a person holding a microphone in their left hand.

Leave a comment

Create a website or blog at WordPress.com

Up ↑