This is only a preview of the March 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 drooling engineers – Part 25
I
’m sure you are familiar with the
age-old adage that goes something
along the lines of: ‘Unexpectedly
pleasurable events boost dopamine
release, which causes your internal
clock to run faster’. Of course, you
may be more familiar with the modern
version: ‘Time files when you’re having
fun’. Whoever said this certainly knew
what they were talking about because
I’m currently having so much fun that
I don’t have any free time left at all;
for example...
Hello XIAO BLE Sense
In an earlier Cool Beans column (PE,
July 2020), I introduced the Seeeduino
XIAO microcontroller development
board (https://bit.ly/3ckK31c). Costing only around US$5 and the size of a
small postage stamp, this 14-pin beauty
boasts a 32-bit Arm Cortex-M0+ processor running at 48MHz with 256KB
of Flash memory and 32KB of SRAM.
I love this this little rascal. I used my
first XIAO to power my 12x12 Pingpong Ball Array, and I’ve employed
these little scamps on numerous projects since. In a later Cool Beans (PE,
January 2021), I augmented the XIAO
in the Ping-pong Ball Array with one of
Adafruit’s 9DOF (nine degrees of freedom) Fusion breakout boards (BOBs)
(https://bit.ly/3dP8EwU). This allowed
Fig.1. XIAO BLE Sense.
40
me to ‘roll’ a ball around the array
by detecting the amount of tilt.
Well, I just heard that the guys
and gals at Seeed have introduced
P itc h A x is
the XIAO BLE development board,
( T ilt)
which is the same formfactor as
the original XIAO while includR o ll A x is
ing Bluetooth capability and in(C o c k )
Y a w A x is
corporating an onboard Bluetooth
(P a n )
antenna (https://bit.ly/34tp6SV).
Costing only around US$10, this
little scamp is based on the Nordic
nRF52840, 32-bit ARM Cortex-M4
Fig.2. Panning, tilting, and cocking nomenclature.
processor with floating-point unit
(FPU) running at 64MHz with 2MB of
super that you will squeal with delight
Flash memory and 256KB of RAM.
when you see it.’
But wait! – there’s more, because
Fortuitously, this provides the perthey’ve also introduced the XIAO BLE
fect point for us to ponder our nomenSense (https://bit.ly/33c4zkX). Costing
clature. When I say ‘pan’ and ‘tilt,’ I’m
only around US$15, this little rapscalusing the terminology associated with
lion is based on the same processor as
the devices upon which movie and telethe XIAO BLE, but it also includes an
vision cameras are mounted. These panonboard microphone and onboard 6DOF
and-tilt heads allow the camera to be roinertial measurement unit (IMU), which
tated in a horizontal plane (pan) or in a
itself boasts a 3-axis accelerometer and
vertical plane (tilt). Similarly, our robot
3-axis gyroscope (Fig.1).
head will be able to pan from side to
Do you remember how I said earlier
side and/or tilt forward and backward.
that I’m currently having so much fun
The thing is, our robot head is also
that I don’t have any free time availgoing to support rotation around a third
able? Well, as proof of this, the chaps
axis, which would be called the roll axis
and chapesses at Seeed kindly offered to
in an aeronautical context (Fig.2). Our
send me some XIAO BLE Sense boards
panning motion corresponds to the yaw
to play with, but I regretfully felt honaxis and our tilting motion corresponds
our-bound to decline because I simply
to the pitch axis, but what term should
don’t have the time to do them justice.
we use to reflect the roll axis?
You wouldn’t believe how much time
I can spend – some may say ‘waste’
Panning, tilting, and cocking
(thank you mother for your continued
As you may recall, we left my previous
support) – cogitating and ruminating
column (PE, February 2022) on someon this sort of thing. We can’t use ‘tilt’
thing of a cliff-hanger with respect to
because we’re already employing that
the progress we’re making on our curto represent leaning forward or backrent project to create an animatronic
ward. We might consider ‘lean,’ but that
robot head with the ability to pan, tilt
could also be interpreted as leaning forand cock, along with two eyes that can
ward or backward. I could be tempted
themselves pan and tilt on an individto use ‘roll,’ but we are also planning
ual basis.
on supporting pan-and-tilt with our roJust to make sure we’re all tap-dancing
bot’s eyes, and – when someone is said
to the same skirl of the bagpipes – and
to ‘roll their eyes’ – this typically inas I noted when closing the aforemenvolves them briefly turning their eyes
tioned column – ‘When I say we, I mean
upward (albeit oftentimes combined
me and my friend Steve Manley. And
with an arcing motion), which could
when I say, all of the progress we’ve been
be confused with our tilting movement.
making, I really mean all of the progUltimately, I settled on ‘cock’ because
ress Steve has been making, because
‘cocking your head’ means to turn the
he’s storming ahead with something so
Practical Electronics | March | 2022
of time, this MCU will be
used to drive the 16-channel servo control board seen
at the back of the wooden
platform. In turn, this control board will be used to
drive the two pan-and-tilt
mechanisms mounted on
the grey platform seen in
the rear of Fig.3.
Compound operators
Fig.3. The current state of play with respect to my testbench.
top of the head down to the left or right
such that one of the ears moves closer
to its associated shoulder. Having said
this, I’m not proud (have you seen the
way I dress?) and I’m open to suggestions, so please feel free to drop me an
email if you can think of anything that’s
more appropriate.
A tempting teaser
A couple of months ago, when Steve
and I originally commenced to ponder
the problem of creating an animatronic
robot head, I decided to forge ahead with
a simple testbench that I could throw
together quickly and easily (Fig.3). Unfortunately, quickly and easily has translated into slow and painful due to my
being so easily distrac... Squirrel! Be this
as it may, we will contrast and compare
my humble creation (I pride myself on
my humility) with Steve’s far superior
offering later in this column.
The shallow grey platform (which is
made from spray-painted wood) in the
foreground of Fig.3 is used to hold the
multi-axis joysticks we introduced in
a previous column (PE, January 2022).
Each of these joysticks contains three
10kΩ potentiometers (pots). The first
pot changes its resistance in response to
a forward-backward motion of the joystick, the second to a left-right motion,
and the third to a twisting clockwiseanticlockwise motion. Each joystick also
has a pushbutton on the top.
Practical Electronics | March | 2022
The small prototyping board between
the joysticks is used as a staging point
to gather all the wires from the pots and
pushbuttons before handing them over
to the microcontroller unit (MCU). This
board also carries three small toggle
switches and a 6-channel LogiSwitch
LS119-P integrated circuit (IC) presented in a 14-pin dual in-line (DIL)
package (https://bit.ly/3sNyDhC). In addition to debouncing the three toggle
switches, this chip is also used to debounce the two pushbutton switches
on the joysticks.
The wooden platform in the middle
of Fig.3 carries one of the blue prototyping boards Steve and I conceived
as part of our 10-character, 21-segment
Victorian display project (PE, August
2021). At the moment, this board carries
only a Teensy 3.6 MCU, which boasts a
32-bit 180MHz Arm Cortex-M4F processor with 58 input/output (I/O) pins (25
of which can act as analogue inputs if
required), 1MB of Flash memory, and
256KB of RAM (https://bit.ly/3FNic8E).
The reason I’m using a Teensy 3.6 to
drive my prototype – as opposed to a
Seeeduino XIAO, for example – is that
it has more pins. And the reason I’m
using this standalone processor– as opposed to the sophisticated control board
with which Steve is working – is that
it’s easier to wrap our brains around and
I want you to be able to replicate what
I’m doing if you so desire. In the fullness
In the sketches (programs)
we’ve perused and pondered in previous columns,
we’ve predominantly restricted ourselves to using
the simple ‘=’ assignment
operator. For example, if we
wanted to add 3 to an integer variable called a, we’ve
employed a statement like
the following: a = a + 3;
A more concise way of
saying exactly the same
thing is to use a compound
assignment operator as follows: a += 3;
Compound assignment
operators provide a shorter syntax for assigning the
result of an arithmetic or
bitwise operation. We’ve not
used these before because they can be
confusing the first time you see them, but
you soon get used to them and they can
help streamline the look of your code.
You will see these compound assignment operators in the sketches discussed
later in this column. In the meantime, a
summary is provided in Fig.4.
Bouncy wouncy
Let’s return to consider the two pushbutton switches on the top of the joysticks and the three toggle switches on
the small prototyping board mounted
between the joysticks. The thing about
switches – including toggle switches
and pushbutton switches – is that they
‘bounce’ when they change state from
off to on, or vice versa (Fig.5).
O perat i o n
S t andard
A ssi g nm ent
Co m po und
A ssi g nm ent
a + = b ;
A d d itio n
a = a + b ;
S u b tr a c tio n
a = a - b ;
a -= b ;
M u ltip lic a tio n
a = a * b ;
a *= b ;
D iv is io n
a = a / b ;
a /= b ;
M o d u lo
a = a %
b ;
a % = b ;
B itw is e A N D
a = a & b ;
a & = b ;
B itw is e O R
a = a | b ;
a |= b ;
B itw is e X O R
a = a ^ b ;
a ^ = b ;
S h ift L e ft
a = a < < b ;
a < < = b ;
S h ift R ig h t
a = a > > b ;
a > > = b ;
Fig.4. Summary of compound
assignment operators in C.
41
V D D
M a k e
1
B re a k
V O U T
N O
V O U T
0
Fig.5. SPST toggle switch with a
pull-up resistor.
The symbol we are using for the switch
in Fig.5 indicates a normally open (NO)
single-pole, single-throw (SPST) toggle
switch. In this example, one side of the
switch, which we might think of as being
the input, is connected to ground (0V),
while the other side, which we might
think of as being the output, is connected to VDD (+ve) via a pull-up resistor. When the switch is in its inactive
or open state, VOUT is pulled to a logic 1
by the pull-up resistor. When the switch
is in its active or closed state, VOUT is
connected to logic 0 (ground).
Having the input to the switch connected to ground coupled with a pullup resistor on its output is a common
scenario and it’s the way we will be
doing things throughout this project.
It’s worth noting, however, that an alternative approach would be to connect
the input of the switch to VDD (+ve) and
connect its output to ground via a pulldown resistor. In this case, an inactive/
open switch would result in VOUT being
0, while an active/closed switch would
result in VOUT being 1.
If I were doing this sort of thing using
discrete pull-up or pull-down resistors,
I would typically employ 10kΩ components, but anything between 1kΩ and
10kΩ will suffice.
The main thing to note for the purposes of these discussions is that when we
close the switch (we also use the term
‘make’ as in ‘make the connection’), the
spring-loaded mechanical contact inside
the switch may bounce back and forth
between 0 and 1 values multiple times
before finally settling into a 0 state. Similarly, when we subsequently re-open the
switch (we also use the term ‘break’ as
in ‘break the connection’), the contact
may once again bounce back and forth
between 1 and 0 values multiple times
before eventually settling on a 1.
How many?
It’s easy to say things like ‘multiple times’
as we did in the previous section, but
what does this actually mean? Well, in
practice, this can be anything between
1 and 100+ bounces depending on the
switch. The specific number of bounces
can vary every time we use the switch
and, just to increase the fun and frivolity, the average number can change depending on environmental conditions
(humidity, temperature) and it can evolve
over time as the switch ages.
Just for giggles and grins, I pulled an
SPST toggle switch out of my box of bits
and soldered two short flying leads onto
its terminals. I then connected one terminal to ground and the other to digital
I/O pin 14 on my Teensy 3.6.
For reasons that will become clear in
a moment, I wanted to test the state of
my switch for a period of more than 6.2
milliseconds (ms), so I targeted 10ms
as being a nice round number. The first
thing I did was create a simple sketch
that (a) saves the start time in microseconds (µs), (b) loops around performing a
specified number of digital reads on the
MCU pin connected to the switch, (c)
saves the end time in µs, (d) calculates
the total time (end time – start time)
spent executing the loop, and (e) displays this total time on the serial monitor. The first time I did this, I set the
loop count to 10,000, which gave me a
total time of 1,112µs (1.112ms). Based on
this, I boosted the loop count to 100,000,
which gave me a total time of 11,120µs
(11.12ms), which is more than the 10ms
I was looking for. If you wish, you can
download this code (file CB-Mar22-01.
txt) from the March 2022 page of the PE
website (https://bit.ly/3oouhbl).
Next, I used the intelligence acquired
from my first program to create a modified
version that counts the number of times
the switch bounces (file CB-Mar22-02.
txt). (If you keep your eyes open, you’ll
observe the use of the compound assignment statement numBounces += 1; in
this sketch). This new program starts off
by reading the initial on/off state of the
switch in the setup() function. When
we get to the loop() function, we stooge
around waiting for the switch to transition to its complementary off/on state,
which tells us that the switch has been
activated or deactivated. This is the point
that we start to loop around 100,000
times (which we know is more than
10ms) counting the number of bounces.
After reporting the results to the Serial
I/O window, we do the whole thing over
and over again (Fig.6).
In this example, with this switch,
the act of closing (making) the switch
resulted in the most bounces (17, 27,
23, 19...), while opening (breaking) the
switch generated fewer bounces (1, 3,
3, 1...). Having said this, I played with
the switch more than is shown here,
and closing the switch sometimes resulted in as few as 10 bounces while
opening the switch generated as many
as 7 bounces on one occasion.
How long?
How long does this bouncing persist? This
is a tricky one because different people
will tell you different things. When I was
starting my career, for example, a more
experienced engineer told me that any
bouncing was sure to have finished by
1ms after the switch was first activated.
He was wrong. A couple of years ago,
one of my chums – embedded systems
guru Jack Ganssle – pulled a selection of
20+ switches of various shapes and sizes
out of his spare parts box and evaluated
them on his workbench. Jack reported that
the average bounce duration was 1.6ms,
while the worst-case duration was 6.2ms
(hence my checking for more than 10ms
in my experiments above).
It’s one thing when a non-critical
system like the pushbutton on a TV
remote control bounces, causing you
to advance multiple channels instead
of one, as annoying as that may be. It’s
quite another matter if you are trying to
save the world and the ‘advance one day’
button on your time machine bounces
like a ping-pong ball. For this reason,
people working on mission-critical or
safety-critical systems commonly design
things to wait for 20ms after the final
bounce (to ensure that was indeed the
final bounce) before doing anything rash.
Cheap and cheesy
Fig.6. Counting the number of bounces on an SPST toggle switch.
42
As I noted earlier, in the case of my
robot head testbench, I’m using a LogiSwitch LS119-P device to debounce
my toggle and pushbutton switches.
We’ve discussed these ICs on a couple
of previous occasions (PE, April 2019
and March 2020).
But what would we do if we didn’t
have one of these chips to hand? Well,
Practical Electronics | March | 2022
One approach is to create our
program in such a way that it
cycles around a master loop once
(a )
every millisecond, for example.
1 2 - b its u n u s e d
2 0 b its ( ‘c o u n t’ to 2 0 )
At the beginning of this loop, we
can check the state of our switches
(b ) 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1 1
and perform any switch-related ac(c ) 0 0 0 0 0 0 0 0 0 0 0 0 1 1 1 1 1 1 1 1 1 1 0 1 0 1 0 1 0 1 0 1
tions if they’ve transitioned from
(d ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0
inactive to active, or vice versa,
after which we may perform any
(e ) 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1 0 1 0 1 0
non-switch-related actions. The
way in which we might impleFig.7. Debouncing with a 32-bit unsigned integer ment something like this was inas a shift register.
troduced in excruciating detail in
our Dump the delay() discussions (PE,
we could debounce the signal coming
December 2020).
from the switch in hardware using a resistor-capacitor (RC) delay circuit, for
example (PE, April 2019). AlternativeFor some, counters captivate
ly, we could debounce the signal from
Taking the aforementioned loop as a startthe switch in software running on our
ing point, and assuming once again that
MCU. In this case, we could (and we
we are working with a single switch for
do) replace our discrete pull-up resistor
simplicity, a common software switch
by declaring this MCU input as being of
debounce technique involves the use of
type INPUT_PULLUP, which causes an
a counter, which we initialise to coninternal pull-up resistor to be applied
tain a count of zero. Suppose our switch
to this pin.
starts off in its inactive (logic 1) state
There are myriad techniques for hanas seen by the MCU, which means we
dling switch bounce in software. Some of
are waiting for the switch to transition
them even work. For the sake of simplicto its active (logic 0) state. In this case,
ity, let’s assume we are working with a
every time we cycle round our loop and
single switch, although everything we’re
we see a 0 on the switch, we increment
going to discuss can easily be scaled to
(add one to) the counter. By comparihandle multi-switch scenarios.
son, every time we see a 1 on the switch,
If we assume that our switch starts
we reset the counter to zero. Thus, it’s
off in its inactive state, and that all our
only when the counter reaches a value
program is required to do is wait for this
of 20 in decimal (0x14 in hexadecimal)
switch to be activated and then cause
that we know our switch has been in a
something to happen, we might opt for
stable 0 state for 20ms.
a cheap and cheesy approach. In this
Once the switch is in its active (logic
case, all we really need to do is loop
0) state and we’ve performed any assoaround waiting for the switch to tranciated actions, we start looking for it
sition from its inactive to active state,
to return to its inactive (logic 1) state.
after which we do whatever it is that
In this case, we increment the counter
needs to be done.
every time we cycle round our loop and
What about if our system is in an
we see a 1 on the switch, and we reset
electrically noisy environment where
the counter to zero every time we see a 0
the MCU’s input may experience an ocon the switch. Thus, it’s only when the
casional glitch in the form of a spike,
counter reaches a value of 20 in deciwhich could be perceived as being a
mal that we know our switch has been
transition to the switch’s active state?
in a stable 1 state for 20ms.
In this case, we can start by looping
You can look at a simple sketch that does
around waiting for the first transition,
all of this (file CB-Mar22-03.txt). (Once
and then wait some amount of time –
again, observe the use of the compound
say 20ms – before checking the state of
assignment statement Counter += 1;).
the switch again. If the switch is still
Also observe that we defined our
active, we can do whatever it is that we
Counter as being an integer variable
want to do. Alternatively, if the switch
of type int. We’ve discussed the size
has returned to being inactive, then we
of integers – including the fact that
return to looping around waiting for the
they may vary depending on the type
start of the real transition.
of MCU – in earlier Tips and Tricks colIn reality, of course, our lives are rarely
umns (PE, August and September 2020).
so simple. It’s more often the case that
In the case of a Teensy 3.6, an integer is
we have multiple switches and that our
a 32-bit quantity (it’s 16-bits in an Arprogram has lots of things to do in addiduino Uno).
tion to checking the states of these little
Since the maximum count we are lookrascals. It may also be that we wish to
ing for in this example is 20, if we were
perform one set of actions when a switch
working with a small, resource-limited
is activated and a different set of actions
MCU, we might decide to declare our
when that switch is deactivated.
counter as being an 8-bit signed integer,
3 1
2 4
2 3
1 6
1 5
8
Practical Electronics | March | 2022
7
0
which can represent values in the range
−128 to +127, or an 8-bit unsigned integer, which can represent values in the
range 0 to 255. The reasons we are using
a 32-bit integer – which is overkill with
respect to the size of the numbers it can
represent – in this sketch are twofold:
(a) we aren’t resource limited and (b)
MCUs function most efficiently when
working with their native integer size.
For others, shift registers satisfy
I certainly wouldn’t cast aspersions at
those who favor counters as their software switch debounce mechanism of
choice, but neither would I count myself
one of their number (no pun intended).
For myself, the radiance of my smile
falls on the subtle simplicity of a shift
register-based scenario (we introduced
the concept of shift registers in the June
2021 Tips and Tricks column). Once
again, let’s assume that we are working
with a single switch, in which case we
will need only one shift register.
As we see (file CB-Mar22-04.txt), this
new sketch uses the same loop technique
as our previous program. Instead of using
a counter, however, we employ a 32-bit
unsigned integer (type uint32_t) in
the role of a shift register. In fact, we
need only 20 bits to count to 20, so the
12 most-significant bits (MSBs) remain
unused (Fig.7a).
Suppose our switch starts off in its
inactive (logic 1) state as seen by the
MCU, which means we are waiting for
the switch to transition to its active (logic
0) state. In this case, we will initialise
the 20 least-significant bits (LSBs) in our
shift register to contain 1s, while the 12
MSBs will be loaded with 0s (Fig.7b).
In certain respects, things are simpler than with the counter technique
because all we have to do at the start
of each loop is shift the contents of the
register one bit to the left, load (via a
bitwise OR (‘|’) operation) the current
value on the switch into the LSB (that
is, bit 0), and use a mask (via a bitwise
AND (‘&’) operation) to clear the 12
MSBs to 0. (We introduced logical bitwise operations in our PE March 2021
Tips and Tricks column.) We achieve
all this using three statements, each
of which employs a compound assignment as follows:
ShiftReg <<= 1;
ShiftReg|= digitalRead(PinSw);
ShiftReg &= SR_MASK;
To a large extent, we don’t care what’s
happening on the switch because this
technique is great at filtering out noise
spikes and suchlike. For example, suppose the switch starts to go active and
commences by bouncing five times.
Assuming – purely for the sake of these
43
Fig.8. In this traditional
implementation, the
pan and tilt motions are
mechanically isolated.
Fig.9. The two servos controlling one SMAD eye. (Image source: Steve Manley)
discussions – that each bounce takes a
millisecond, this would appear in the
shift register as illustrated in Fig.7c. This
doesn’t affect us at all. We just keep on
cycling around our loop until the 20 LSBs
of the shift register all contain 0s. Coupled with the fact that we’re forcing the
12 MSBs to 0, this equates to 0x00000000
in hexadecimal (Fig.7d), which informs
us that our switch has been in a stable 0
state for 20ms.
Once the switch has arrived in its active
(logic 0) state and we’ve performed any
associated actions, we start looking for
it to return to its inactive (logic 1) state.
In this case, we might be tempted to start
by initialising the shift register with all
0s, but we don’t need to do this because
it already contains all 0s from when we
were waiting for the switch to be activated (Fig.7d).
The shift register will continue to contain all 0s as long as the switch remains
active. Now, suppose the switch starts to
go inactive and commences by bouncing
three times. Assuming once again that
each bounce takes a millisecond, this
would appear in the shift register as illustrated in Fig.7e. This time, we just
keep on cycling around our loop until
the 12 MSBs of the shift register contain
0s and the 20 LSBs of the shift register
contain 1s. This equates to 0x000FFFFF
in hexadecimal (Fig.7b), which informs
us that our switch has been in a stable 1
state for 20ms. (I don’t know about you,
but I feel like singing ‘Tra-la!’)
Did you realise that…
It’s easy for beginners – and professionals, for that matter – to forget that anything we can implement in software can
be realised in hardware, and vice versa.
On this basis, it just struck me that it is
perhaps worth pointing out that both the
counter- and shift register-based software
debounce techniques presented above
could also be implemented in hardware
(how do you think the aforementioned
LogiSwitch ICs perform their magic?).
Feast your orbs
Fig.10. Steve’s super-spiffy control console (Image source: Steve Manley)
44
I fear we are once again approaching the
end of the column. Before we go, however, I want to give you a sneak peak at
some of the things Steve has been working on with regard to his ‘official’ (full
Monty) animatronic head.
Let’s start by returning to the two panand-tilt mechanisms I’m using on my
progressively parsimonious prototyping
platform – the ones we saw mounted on
the small wooden platform at the rear of
Fig.3. These are Mini Pan-Tilt Kits with
Micro Servos from Adafruit (https://bit.
ly/3f4FjjC). Each of these mechanisms will
carry one of the SMAD (Steve and Max’s
Awesome Display) boards we’ve been discussing in our Cool Beans columns for
Practical Electronics | March | 2022
the past couple of months. The point is
that these are implemented in the same
way as every pan-and-tilt mechanism
I’ve ever seen, with the two motions
mechanically isolated from each other.
In this case, the tilt servo sub-assembly
is mounted on top of the pan servo subassembly (Fig.8).
This is where things get interesting.
There are many cases in the history of
technology where seasoned professionals professed that something couldn’t be
done. Being unaware of this, however,
their inexperienced junior counterparts
ambled off and did it anyway.
This is not to imply that Steve is my
junior in any way, you understand. It’s
just that he’s never worked with a servodriven pan-and-tilt mechanism before.
Thus, when I first described the sort of
motion we were looking for, with each
eye being able to pan and tilt on an individual basis, Steve came up with an implementation of such awesome cunning
that it brings a tear of joy to my naturally
panning and tilting eye (Fig.9).
This image shows a view of one of the
SMAD eyes from the back of the robot’s
head. The interesting thing is the way in
which Steve is using two servos attached
to the main 3D printed frame to drive a
universal joint attached to the eye. And
the amazing thing is the way in which the
pan and tilt motions manage to remain
isolated from each other.
Steve created an animation showing
this in action and he kindly allowed me
GET T
LATES HE
T CO
OF OU PY
R
TEACH
-IN SE
RIES
AVAIL
AB
NOW! LE
to post it to my Cool Beans Blog channel
on YouTube (https://bit.ly/3GcVTJK). I’ve
shown this animation – along with another video of the real assembly working
– to several of my engineering friends,
and we all agree that we’ve never seen
anything like it before.
Last, but certainly not least, let’s return
to the platform holding my joysticks in
the foreground of Fig.3 and the wooden
platform carrying my microcontroller
and servo control board in the middle
of Fig.3. Now compare and contrast this
with Steve’s equivalent (Fig.10).
Steve fabricated this enclosure on his
3D printer, and it has to be acknowledged
that it looks much more professional
than my humble offering. The large red
board inside this enclosure is one of the
control boards Steve developed to drive
our Victorian displays. As described in
a previous column (PE, July 2021), this
board boasts myriad capabilities, including supporting infrared (IR) control and
the ability to make the tricolor LEDs on
the SMADs respond to sound.
Next month
We will be exploring both my and Steve’s
animatronic offerings in more detail in
Want to build your own amazing Pingpong Ball Array or SMAD? All the details
are in previous Cool Beans columns,
starting in March 2020.
my next column. Until then, as always,
I welcome your captivating comments,
thought-provoking questions, and insightful suggestions.
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
Order direct from
Electron Publishing
PRICE £8.99
(includes P&P to UK if ordered direct from us)
EE
FR -ROM
CD
ELECTRONICS
TEACH-IN 9
£8.99
FROM THE PUBLISHERS OF
GET TESTING!
Electronic test equipment and measuring
techniques, plus eight projects to build
FREE
CD-ROM
TWO TEACH
-INs
FOR THE PRICE
OF ONE
• Multimeters and a multimeter checker
• Oscilloscopes plus a scope calibrator
• AC Millivoltmeters with a range extender
• Digital measurements plus a logic probe
• Frequency measurements and a signal generator
• Component measurements plus a semiconductor
junction tester
PIC n’ Mix
Including Practical Digital Signal Processing
PLUS...
YOUR GUIDE TO THE BBC MICROBIT
Teach-In 9
Teach-In 9 – Get Testing!
A LOW-COST ARM-BASED SINGLE-BOARD
COMPUTER
Get Testing
Three Microchip
PICkit 4 Debugger
Guides
Files for:
PIC n’ Mix
PLUS
Teach-In 2 -Using
PIC Microcontrollers.
In PDF format
This series of articles provides a broad-based introduction to choosing and using a wide range
of test gear, how to get the best out of each item and the pitfalls to avoid. It provides hints
and tips on using, and – just as importantly – interpreting the results that you get. The series
deals with familiar test gear as well as equipment designed for more specialised applications.
The articles have been designed to have the broadest possible appeal and are applicable to all branches of electronics. The
series crosses the boundaries of analogue and digital electronics with applications that span the full range of electronics – from
a single-stage transistor amplifier to the most sophisticated microcontroller system. There really is something for everyone!
Each part includes a simple but useful practical test gear project that will build into a handy gadget that will either
extend the features, ranges and usability of an existing item of test equipment or that will serve as a stand-alone
instrument. We’ve kept the cost of these projects as low as possible, and most of them can be built for less than £10
(including components, enclosure and circuit board).
© 2018 Wimborne Publishing Ltd.
www.epemag.com
Teach In 9 Cover.indd 1
01/08/2018 19:56
PLUS! You will receive the software for the PIC n’ Mix series of articles and the full Teach-In 2 book – Using PIC Microcontrollers – A practical introduction – in PDF format. Also included are Microchip’s MPLAB ICD 4 In-Circuit Debugger User’s Guide; MPLAB PICkit 4 In-Circuit Debugger Quick Start Guide; and MPLAB PICkit4 Debugger User’s Guide.
ORDER YOUR COPY TODAY: www.electronpublishing.com
Practical Electronics | March | 2022
45
|