# Theremin? Bleh! Therebone? Yeah! (Part 2)Theremin? Bleh! Therebone? Yeah! (Part 2)

On the hunt for the soon-to-be-legendary therebone.

Clive 'Max' Maxfield

March 22, 2023

Image courtesy of Clive "Max" Maxfield

In Part 1 of this three-part mega mini-series, I explained how it came to pass that I’m currently writing a series of "Arduino Bootcamp" columns for the electronics and computing hobbyist magazine, Practical Electronics, in the UK. Also discussed was the origination of the idea to create a trombone equivalent of a theremin, which we are calling a therebone.

The target for this course is anyone who wants to learn how microcontrollers work, but with a special focus on retired engineers who know electronics in general but never got to play with microcontrollers. We’re using the Arduino Uno as our platform because (a) it’s relatively simple to understand and (b) there are so many additional resources (sensors, shields, example code, YouTube videos…) available.

Now, you may be of the opinion that there are already loads of beginner’s courses for the Arduino. Does the world really need one more? Well, my experience is that different instructors come at things from a different perspective, and I like to think that I bring something special to the party.

We kicked off with some simple experiments featuring discrete light-emitting diodes (LEDs) because this allowed us to introduce a bunch of fundamental concepts.

Experiments using individual LEDs.

For example, in circuit (a), using the Arduino’s digitalWrite() function to drive the pin HIGH turns the LED On, while driving the pin LOW turns it Off, all of which is reasonably intuitive for beginners.

By comparison, things work the other way around in circuit (b); that is, driving the pin HIGH turns the LED Off, while driving the pin LOW turns it On, all of which leads us to question exactly what we mean by HIGH and LOW and On and Off in the first place.

Actually, there are so many layers to this particular metaphorical onion that I was prompted to write a special column to delve into the various levels of abstraction (see "Arduino 0s and 1s, LOW and HIGH, False and True, and Other Stuff").

Circuit (c), which involves using a single pin to control two LEDs (when one is On, the other is Off), helps hammer the various points home, while circuit (d) serves to emphasize the fact that the ordering of a LED and its associated current-limiting resistor isn’t important (at least, it’s not important in the context of what we’re doing here).

If the truth be told, the number of experiments we could devise using discrete LEDs is virtually unlimited. For example, I was sorely tempted to create some example programs based on a CD4017 integrated circuit (IC). This is a decade counter with ten outputs numbered 0 to 9. When you reset it, output 0 goes high (logic 1) and all the other outputs go low (logic 0). Each time you clock it, the current output goes low and the next output goes high. We could use this to drive the anodes of ten discrete LEDs (since only one LED can be active at a time, we would require only a single current-limiting resistor on the common cathode).

However, I resisted the temptation because I wanted to do something a little different, which was to create a suite of experiments based on common cathode 7-segment displays. We started with a single digit as illustrated below.

Using the Arduino to drive a single digit common cathode 7-segment display.

What? You want to say you think my diagrams are awesome? You’re making me blush (don’t stop!). I must admit that I’m rather proud of these little beauties, which I create using Microsoft Visio.

So, what can we do with a single digit? Well, for one thing, in the fullness of time, we’re going to create a simple clock. This was inspired by the single digit BLUB Nixie tube clock created by my friend Dalibor Farny, who handcrafts his own Nixie tubes from scratch (you can read more about this in my column on "Retro-Futuristic-Steampunk Technologies").

Single-digit BLUB Nixie clock.

This little scamp flashes two digits in quick succession to represent the hour, waits for a brief pause, and then flashes two more digits in quick succession to represent the minute. It then waits for a slightly longer pause, after which it does the whole thing all over again. You can also get it to display the date in terms of DD-MM-YY or MM-DD-YY or YY-MM-DD.

Implementing this clock using our 7-segment display will involve all sorts of things, like using momentary push buttons to implement a menu system to set the date and time and to select the display format to be used for the date and…

We can also add a real-time clock (RTC), and then augment our circuit with an alarm function using a piezo buzzer (or play a tune on a small loudspeaker), and…

We can subsequently extend our clock to use two digits and then four digits. Of course, the Arduino Uno doesn’t have sufficient pins to allow us to drive more than one 7-segment display directly. This will lead us to explore a variety of different techniques to drive multiple displays, including using binary coded decimal (BCD) decoder ICs, shift register ICs, multiplexing, and… the list goes on.

As an aside, as part of all this, I wrote a column on the "Mysteries of the Ancients: Binary Coded Decimal (BCD)." I’m rather proud of this one. So much so, in fact, that I feel moved to make the somewhat bold claim that, even if you're a logic guru, if you don't learn something that’s new to you in this column, then my name isn't Max the Magnificent!

However, all these clock projects are a long way in our future. We are currently at the stage where we’ve only just wired-up our 7-segment display up and got it working. First we had to decide which segments we wished to use to represent the numerical digits 0 through 9, and to then create a corresponding look-up table we called DigitSegs[]. We then played around generating and displaying random numbers between 0 and 9, after which we created a program to repeatedly count from 0 to 9.

Associating segments with numerical digits and alpha characters.

Just to add a bit of panache, we also created a look-up table called HelloSegs[], which we now use to display a cheery “HELLO” message when our programs first run.

In my next column, we will discuss the various experiments and sensors that lead inexorably (some may say inexplicably) to the creation of our soon-to-be-legendary therebone. Until then, as always, I welcome your comments, questions, and suggestions.