This is only a preview of the October 2022 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
|
Max’s Cool Beans
By Max the Magnificent
Flashing LEDs and other engineering temptations – Part 32
A
long, long time ago in a place
had copious quantities of 741 operational
amplifiers (op amps) and classic 555 timers.
My panel had two axes of motion: left/right
and up/down. Working back from the servo
motors, I employed 555 timers that were
pulse-width modulated at 50Hz. These
were controlled using four light-dependent
resistors (LDRs) mounted in the corners
of a cross, which was itself mounted on
the steerable panel. If the panel was not
pointing directly at a light source (eg, the
Sun), a shadow was cast on one or more
of the LDRs, causing comparator circuits
provided by the 741 op amps to generate
corresponding pulse-width information.
The idea was for the panel to move until
none of the LDRs were in shadow and each
pair of LDRs received the same amount of
light, thereby indicating that the panel was
Message in a bottle
pointing towards the light source. This is a
Just saying their name brings so many songs
long time ago now and I’m relying on my
to mind: Roxanne, Walking on the Moon,
memory from 1989 (to find my notes from
Message in a Bottle... The reason all this
that time would require a serious amount
comes to mind is that I just received a mesof digging). One thing I remember is using
sage from a reader who we’ll call Andrew
several resistance decade boxes to fine
(because that’s his name). (Did you see
tune the system. I also distinctly rememwhat I did there? Just call me the ‘King
ber that, when I switched the system on
of Segue.’) In his message, Andrew—who
for the first time, the panel moved across
is employed as a design and technology
and upwards, paused, and then started to
technician at a high school in Leominster,
hunt slightly (I was using only proportional
Herefordshire – spake as follows:
‘P’ control with no integral ‘I’ and no dif‘Hi Max, I read with great interest the
ferential ’D’). It took me a few seconds to
part of your Cool Beans column discussing
realise that the panel had moved to look
servo motors in the August 2022 issue of
at a fluorescent light mounted in the ceilPractical Electronics. This took me back to
ing. I subsequently made a ‘light wand,’
1989 when I was studying for my HND in
which was basically an incandescent reElectronics and Computer Technology at
flector lamp on the end of a stick. When I
what was then Birmingham Polytechnic.
came to demonstrate my project, I moved
I constructed a steerable solar panel using
around the room, the panel followed my
model servo motors given to me by my
wand, and the lecturer who assessed my
lecturer. They were very similar to those
project really liked it. Thank you for your
shown in your article. In those days, we
great article and I look forward
to the next one. Take care and
best wishes, Andrew Moore.’
Well, if Andrew liked the
August issue of PE, I hope
the September issue featuring the amazing computeraided-design (CAD) drawings
created by my friend Steve
Manley showing the insides
of a servo (accompanied by
our discussions of torque and
gear trains and gear ratios)
Fig.1. Pan-and-tilt using two micro servos (Image: Adafruit) took his breath away.
far, far away when I was sporting
a much younger man’s clothes, I
was fortunate enough to see the Police
play in Leeds (when I say ‘Police,’ I
mean the band, not the West Yorkshire
constabulary, although I’m sure they are
a fine bunch of people). The Police’s
music was very different to anything
else at that time, being a unique style
of rock influenced by punk, reggae,
and jazz. Although there were only
three members of the group – Sting
(lead vocals, bass guitar), Andy Summers (guitar), and Stewart Copeland
(drums, percussion) – they managed to
completely fill the sound space.
50
Not 1, 2, or 3, but 4!
Speaking of the August and September
issues, in the former we created a simple
circuit and sketch (program) that caused
our micro servo to sweep back and forth;
in the latter, we extended this sketch to
cause the servo to respond to turning a
potentiometer (pot).
As you may recall from previous columns, when Steve and I first started out
on our animatronic noggin project, I purchased a couple of preassembled Panand-Tilt Kits from Adafruit (https://bit.
ly/3cEYPoL). These little scamps feature
two SG-90 or SG-92 micro servos that are
similar to the one we’ve been playing with
(Fig.1). Using these servos, we can cause
the assembly to pan from side-to-side and
tilt up-and-down.
We also purchased some super-tasty
JH-D400X-R4 4-axis joysticks, for which
there are lots of suppliers on platforms like
Amazon (https://amzn.to/3RXl61d). For the
purposes of these discussions, however,
I decided to splash the cash for a couple
of miniature KY-023 joystick breakout
modules (https://amzn.to/3crXO38). In
addition to +5V and 0V (ground, or GND)
connections, these little rascals have X, Y,
and SW (‘switch’) outputs (Fig.2).
This month, we’re going to use an Arduino Uno to read the X/Y values from
these joysticks and use them to control
the servos on our pan-and-tilt assemblies.
Since we are using a lot of flying leads,
along with a breadboard to ‘glue’ everything together, the result is a bit of a rat’s
Fig.2. KY-023 joystick (Image: AZ-Delivery)
Practical Electronics | October | 2022
Fig.3. Test setup (joysticks at the front, pan-and-tilt
assemblies at the back).
nest (Fig.3), but that’s all part of the fun
of prototyping.
The program itself is just a slightly
modified version of the code we discussed in my previous column (PE, September 2022). Instead of having a single
analogue input connected to a single pot,
we now have four of each. And instead of
a single servo, we now have four of the
little ragamuffins. The core of the code is
shown in Fig.4.
First, we read all four of the values
from our pots. Next, we use the Arduino’s map() function to map the 0 to
1023 values from our pots onto the corresponding 0 to 180 values required by
our servos. We then write these mapped
values to the servos, wait for 15 milliseconds to give the servos time to respond,
and then return to the beginning and do it
all again. If you wish, you can download
the full program to peruse and ponder at
your leisure from (file CB-Oct22-01.txt)
from the October 2022 page of the PE
website (https://bit.ly/3oouhbl).
Oops!
To be honest, I’m usually a little cavalier
when it comes to connecting together things
like our servos and potentiometers. By
this I mean that I don’t spend a lot of time
agonising over which of the X/Y joystick
wires is connected to which of the analogue inputs. For example, if I move the
joystick to the left or right and the servo
assembly tilts forward or backward, or if
I move the joystick forward or backward
and the servo assembly pans to the left
or right, then it’s a matter of moments to
swap the two analogue input pin assignments associated with this pot in the code.
Similarly, if I move a joystick to the left
and the corresponding pan servo moves to
the right, or if I push a joystick backward
and the corresponding tilt servo leans forward, and either of these is opposite to
Practical Electronics | October | 2022
Fig.4. Main servo code control loop.
the action I wish to see, it’s easy to fix this
in the code. There are two obvious ways
to do this. The first is to subtract the 0 to
1023 value read from the pot from 1023
prior to calling the map() function; the
second is to subtract the 0 to 180 value
generated by the map() function from 180.
Thanks for the memories
These days, when it comes to the memory
subsystems we use in our computers and
other electronic devices, we have become
spoiled by all of the features and functions
offered by semiconductor technologies.
The options available to design engineers
used to be much more limited. Although
it is certainly possible to create memories
using technologies like relays or vacuum
tubes, the cost, power consumption and
physical footprint of each bit soon makes
your eyes water.
To get around this, the ancients came
up with a captivating cornucopia of cunning concepts, such as the acoustic mercury delay line, which was invented by
William Shockley in 1942, and first deployed in radar applications. Later, in the
mid-1940s, J Presper Eckert developed the
technology for use as memory in computers such as the EDVAC and the UNIVAC
I. The idea was to use a piezoelectric
transmitter to inject pulses at one end of
a thin tube filled with mercury, and to
use a piezoelectric receiver at the other
end of the tube to detect the presence (or
absence) of pulses after they had propagated across the tube. Individual pulses
could be added into, or deleted from, the
train as it was fed back into the transmitter. Although this may sound a tad ‘Heath
Robinson,’ once the technology had matured, around 1,000 bits could be stored
in a 5-foot-long delay line, which was
jolly exciting at the time. Although these
mercury delay lines were rather revolutionary, they had several disadvantages,
not least that mercury is toxic. But the
biggest issue was the fact that they offered only sequential access to the data
they contained, which means the system
had to sit around twiddling its metaphorical thumbs waiting for the portion of the
pulse train of interest to pass by.
Towards the end of the 1940s and the
beginning of the 1950s, a new kid came
to memory town in the form of tiny magnetic cores. The easiest way to wrap your
brain around this is by means of a diagram (Fig.5).
There’s much more to this than meets
the eye, but it’s simple enough if we don’t
dive into the weeds. Suppose we have a
single core on a single wire. If we pass a
pulse of current through the wire, and if
that pulse is of sufficient strength, then
we can magnetise the core in a certain
way. We might consider this to represent
a logic 1. If we later pass a similar pulse
down the wire but in the opposite direction, we can flip the magnetic field in the
core, and we might consider this to represent a logic 0.
Using a single wire is limiting because
any cores on that wire will be magnetised
in the same direction. However, suppose
Fig.5. 4x4 magnetic core memory (Source:
Tetromino/Wikipedia)
51
we thread two wires through our core and
apply pulses of current through both wires,
where the current values in each wire are
just a tad over half the value required to
magnetise the core. This is the point where
Fig.5. starts to make sense. If we send our
half-power pulses through wires X1 and
Y1, only the core at the intersection of
these two wires will be affected.
One thing to note is that Fig.5 represents a 4x4 = 16 array of 1-bit words. In
this context, it’s common to call the array a
‘plane’. If we wanted to have 8-bit words,
then we would replicate this plane eight
times (we can visualise these planes as
being stacked on top of each other, which
was a common way of doing things in the
real world).
One advantage of a magnetic core store
is that it’s non-volatile, which means it
retains its data when power is removed
from the system. Another advantage is
that it’s a form of random-access memory
(RAM), which means we can randomly
access any part of the memory as and
when we want to.
One disadvantage of this form of memory
is that it we have to write to it in order to
read it, resulting in what we call a ‘destructive read.’ Take our core located at
the intersection of wires X1 and Y1, for
example. If we want to know whether it
contains a 0 or a 1, we would inject current
pulses corresponding to a 1 and observe
the pulse value coming out on the sense
wire (S), which would vary depending on
whether the core originally contained a 0
or a 1. Unfortunately, if the original value
were a 0, we would have just overwritten
it with a 1, which means we would now
have to re-write the 0.
Although it may seem a bit ‘clunky’ now,
magnetic core store was the predominant
form of RAM for around 20 years between
1955 and 1975. Also, ‘clunky’ really isn’t
the right word, because the cores could
be teeny-tiny—like 1mm in diameter—
with hair-fine insulated wires weaving
their way back and forth.
There are several reasons why I’m waffling on about this here. The first is that a
couple of days ago as I pen these words,
I found myself escorting a friend and his
son who were visiting Huntsville to the
US Space and Rocket Center here in town
(https://bit.ly/3PXdCcA). One of the exhibits is the core store memory from the
Saturn 5’s Launch Vehicle Digital Computer (LVDC), where the Saturn 5 is the
rocket that got us to the moon.
Just the next day, by some strange quirk
of fate, I ran across an interesting article on IEEE Spectrum about The Birth
of Random Access Memory (https://bit.
ly/3zj3RyM). And then, just to add a big
dollop of emblematical whipped cream
on top of my allegorical cake, I was introduced to the Core64, which is an incredibly tasty interactive core memory
52
Fig.6. Lixie displays (Source: Connor Nishijima)
electronic kit (https://bit.ly/3JdGNpH).
Suffice it to say that I really, really want
one of these!
What? Analogue? Again?
As I’ve mentioned on occasion, I’m a
digital logic design engineer at heart. I
find the wibbly-wobbly nature of analogue electronics in general, and analogue
signal processing (ASP) in particular, to
be a tad disconcerting. This makes it all
the stranger that analogue topics keep on
sneaking their way into my Cool Beans
columns. In PE May 2022, for example,
we introduced a low-cost, open-source,
not-for-profit cutting-edge analogue computer called The Analog Thing (THAT)
(https://bit.ly/3vPcm3Z). Just a month
later, in PE June 2022, we discussed the
days when analogue ruled and digital
drooled, the rise of digital, the current
resurgence of analogue in the form of
analogue machine learning (AML) inference engines, and the Audio Weaver
analogue audio design tool.
The reason I feel moved to mention this
is that, although a magnetic core store may
appear to be a digital beast as seen from
the outside world, the electronics used
to drive signals into the cores and read
data back out again are predominantly
analogue in nature. They involve a lot
of analogue pulse shaping, amplifying,
conditioning, detecting and processing.
Retro display technologies
It’s no secret that I am enamored by retro
display technologies; also, by modern
reincarnations thereof. One such technology is embodied by the Lixie displays (https://bit.ly/3vtSmDD) created
by Connor Nishijima (Fig.6).
Each Lixie is composed of 10 sheets of
acrylic, where each sheet is laser etched
with a numeral from 0 to 9. There are two
tricolour WS2812 light-emitting diodes
(LEDs) under each sheet, allowing you to
select the colour of each digit and even
use a mix of colours if you wish. These
bodacious beauties are substantial in size
(each one is about 60mm wide and 100mm
tall) and visible from a great distance.
The style of the font is reminiscent of
that used in old Nixie tubes, which isn’t
surprising because Connor told me that
he dismantled an old, non-functioning
tube, placed its cathode filaments on a
scanner, and used the resulting scans as
the basis for his characters. He originally
started with single lines, but eventually
decided that a dual line rendition was
aesthetically more pleasing. I agree.
I’m not sure who invented the original
incarnation of these displays deep in the
mists of time, but my friend Steve Leibson maintains a website devoted to the
HP9825 desktop computer (https://bit.
ly/3JkZs3c). As part of this site, Steve
covers topics like the first digital voltmeters (DVMs) and the birth of test automation (https://bit.ly/3oE1qSL). This is
where I discovered that an engineer called
Andrew Kay formed a company called
Non-Linear Systems (NLS) and created
the first DVM in 1952.
Reading further, we discover that ‘The
first NLS DVM also used a new type of
digital display based on stacks of edge-lit,
engraved Lucite plates. Each stack (representing one digit) consisted of 11 plates arranged so that they recede from the viewer.
Ten of the stacked plates have a numeral
deeply engraved on it (digits 0 through 9).
The eleventh plate has a decimal-point. A
small ‘grain-of-wheat’ incandescent lamp
located along the edge of each plate illuminates the associated plate from the edge.
If the lamp is lit, its light travels down the
plate, which acts as a light pipe. Eventually, the light strikes the plate’s engraved
character. The deep groove of the engraving interrupts the light as it travels down
the Lucite plate and scatters it towards the
front of the instrument where an operator sees the engraved numeral light up.’
I’m not sure if Andrew invented this form
of display himself, but this is the earliest
record I’ve found.
Practical Electronics | October | 2022
Excuse me while I change
As I mentioned in my previous column
(PE, September 2022), On Wednesday, 7
September, I will be giving the keynote
presentation at the FPGA Forum in Norway
(www.fpga-forum.no). The day before, I’ll
be giving a guest lecture at the Norwegian
University of Science and Technology
(NTNU) (www.ntnu.edu).
Due to the vagaries of the print publishing world, including concepts like
‘shelf life,’ the October 2022 issue of PE
that you are currently reading will start
hitting the stores and dropping through
subscribers’ letter boxes in the UK during
the first full week in September.
Thus, remembering that Norway is an
hour ahead of the UK, if you find yourself reading this column between 7:00am
and 9:00am on Tuesday, 6 September,
then – as you read – I will be prancing
around on stage presenting. What this
means is that (a) we may be linked by
cosmic forces beyond the understanding of mortal man and (b) it’s your turn
to buy the first round of drinks should
we ever meet in the flesh.
When giving a presentation, it’s important to have an overall ‘theme’ to provide a framework upon which to hang
the talk’s topics, otherwise the audience might think I was just waffling on
about whatever popped into my mind
(as if). In the case of my presentation to
the students, my overarching theme is
going to be that of ‘Change,’ including
how much things have changed in my
own lifetime. I plan on starting with a
quote by the Ancient Greek philosopher
Heraclitus of Ephesus (535-475 BC), who
famously said, ‘The only constant in life
is change.’ However, since I don’t wish
to appear dogmatic, I’ll also reference a
philosopher of our own time, Bon Jovi,
who informed us in his 2010 song that
‘The more things change, the more they
stay the same.’ (Actually, this sentiment
was first coined in 1849 by French writer
Jean-Baptiste Alphonse Karr.) I don’t
know about you, but I think combining these two points of view leaves me
reasonably confident that I’ve covered
most eventualities.
One of the aspects of change I’m going
to discuss is display technologies. And
one of the display types I’m going to discuss is Lixies, along with their precursor
technologies. As part of this, I’m going to
have a single Lixie sitting on the desk in
front of me performing a simple count
sequence, commencing at 0, counting up
to 9, and returning to 0 to start all over
again. Of course, ‘simple’ is in the eye of
the beholder; we’re going to have to include at least a few special effects.
Fabulous FX
The term ‘special effects’ (often abbreviated as SFX, SPFX, F/X, or simply FX)
Practical Electronics | October | 2022
is typically used to refer to illusions or
visual tricks used in the film, television,
theatre, video game and simulator industries to simulate the imagined events in a
story or virtual world. I feel it’s unfair for
those folks to commandeer this term and
have all the fun, so I often describe the
‘twiddly bits’ I add to my display code
as being special effects (FX) (sue me).
In this case, unusually for me, I decided that subtlety was the order of the
day. As a result, I determined to use only
two effects when counting up from 0 to
9, and three effects when cycling back
from 9 to 0 (Fig.7).
A high-level transition takes place
every second. The first option is to perform what I think of as being a ‘sharp’
transition, which basically means turning
the old number off and turning the new
number on at the same time, then waiting a second before doing it all again. The
second option is a ‘fade’ effect, in which
we gradually fade from the current digit
to the new digit. I’m currently employing 30 fade steps spanning a fade time
of 800 milliseconds (ms), which means
the new value remains steady for 200ms
before the next fade commences, but everything is parameterised and therefore
easy to change.
Both sharp and fade effects can be
used while counting up from 0 to 9 and
when cycling back from 9 to 0. In this
latter case, I’ve also decided to provide
an additional ‘cascade’ effect, whereby
we hold at 9 for half a second (500ms)
and then spend the next 500ms rapidly
counting down from 9 to 0.
My plan is to allow my Lixie to perform its magic throughout my presentation. At the end, we’ll see how observant
the students were (how many different
effects they spotted). We’re going to commence with Sharp transitions both up
and down. After 10 cycles, we’ll keep
the sharp transitions while counting up
and switch to cascade transitions when
returning from 9 to 0. Following 10 of
these cycles, we’ll switch to fade transitions both up and down. Finally, we’ll
keep the fade transitions while counting up and switch to cascade transitions
when returning from 9 to 0. At this point,
we’ll switch to a new colour (or colours)
and do the whole thing again.
We aren’t going to go through this code
in depth here, but there are a couple of
points worth noting. For example, after
defining a bunch of parameters, like
the total cycle time (1,000ms, aka 1s),
the total Fade time (800ms), and the
9
8
7
6
D ow n F X
- S h a rp
- F a d e
- C a s c a d e
U p F X
- S h a rp
- F a d e
3
4
5
2
1
0
Fig.7. Summary of Lixie effects.
total cascade time (500ms), we use the
typedef and enum keywords to define
an enumerated type called EffectType
that has three members: SHARP, FADE,
and CASCADE (enumerations, structures,
and type definitions were introduced in
PE, December 2020). Later, we create a
two-dimensional array called Effects
that groups pairs of effects (the left-hand
entry of a pair is the effect to be used
while counting from 0 to 9; the righthand entry when returning from 9 to 0).
EffectType Effects[][] =
{
{SHARP, SHARP},
{SHARP, CASCADE},
{FADE, FADE},
{FADE, CASCADE}
};
This program also makes use of some utility functions – GetRed(), GetGreen(),
GetBlue(), and BuildColor() – along
with a CrossFade() function that we
introduced for use with my 12x12 pingpong ball array in PE, October 2020.
To be honest, remembering that I don’t
count programming among my skills,
I’m jolly happy with my nested control
scheme with the counting at the lowest
level, selecting a new pair of effects in the
middle level, and choosing a new colour
combo at the highest level. To achieve
all of this we employ the modulo % operator, the use of which we discussed in
excruciating detail in PE, March 2021.
If you wish, you can download the full
program (file CB-Oct22-02.txt) from the
October 2022 page of the PE website.
Next time
Well, that’s all we have time for this
month. In my next column we’ll... but
no! I want this to be as much a surprise
for you as it will be for me. Until next
time, have a good one!
Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor
of all he surveys at CliveMaxfield.com – the go-to site for the
latest and greatest in technological geekdom.
Comments or questions? Email Max at: max<at>CliveMaxfield.com
53
|