This is only a preview of the August 2023 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
Arduino Bootcamp – Part 8
A
re you ready for some fun?
I know I am. As I sit here poised
to start this column, sweat is
careening down my cranium and dripping into my eyes. The problem is
– much like the Norwegian Blue in
Monty Python’s classic Dead Parrot
Sketch – the air conditioning system
in our home is, at present, an ex-air
conditioning system. Since I currently
hang my hat in Huntsville, Alabama in
the US, the temperature in the house
is 86°F (30°C) and the humidity is off
the scale. There’s a nice man who has
been working on the system all day.
He says it should be up and running
shortly (what he doesn’t say is that he’s
poised to relieve me of a big chunk of
my hard-earned moolah, to which I
say, ‘thank goodness for credit cards’).
Rolling the dice
At the end of my previous column, I
left you with some homework. This was
to think of at least three different applications we can implement with our
setup so far, which involves a breadboard with two buttons, a piezoelectric
buzzer, and our 7-segment display, all
connected to an Arduino Uno microcontroller development board.
On the off-chance you are new to the
PE community (in which case, ‘Hello,
it’s great to meet you!’) and you’re
wondering what we’re waffling about,
you can download a copy of our current breadboard layout showing both
Listing 1. Definitions.
50
switches, our buzzer, and our 7-segment display – along with various
pull-up and current-limiting resistors
– coupled with the connections to our
Arduino Uno (file CB-Aug23-01.pdf).
As usual, all of the files mentioned
in this column are available from the
August 2023 page of the PE website at:
https://bit.ly/pe-downloads
Also in my previous column, I said
that I’d start the ball rolling by suggesting one possible application, which
would be to implement a form of electronic dice. Every time we press one of
our buttons, our program will display a
random number from 1 to 6 on our 7-segment display.
Preparing to rock and roll
What we are going to do is create an entirely new program (or ‘sketch’ in the
vernacular of the Arduino community).
Having said this, we will retain some of
the elements of our earlier experiments.
You can peruse and ponder a copy of this
new program (file CB-Aug23-02.txt). We’re
not going to go through the entire program here, but I think it’s worth skimming
through the highlights as follows. We’ll
start with some definitions (Listing 1).
In Lines 1 and 2 we define SEG_ON
and SEG_OFF as being HIGH and LOW
respectively. As you may recall, we
discussed the relationships between 0
and 1, 0V and 5V, LOW and HIGH, and
false and true in an earlier column
(PE, March 2023). Since we are using
a common-cathode display (which we
introduced in PE, February 2023), the
light-emitting diodes (LEDs) forming
the segments on our display turn on
when presented with 5V signals and
turn off when presented with 0V values.
In Lines 3 and 4 we define S W _
PRESSED and SW_RELEASED as being
LOW and HIGH, respectively. Although
this may seem counterintuitive at first,
this is because we are using normally open (NO) momentary pushbutton
switches. In our implementation, the
signals to the Arduino are pulled-up to
5V by means of pull-up resistors (Fig.1).
It’s only when a switch is pressed that
it connects its corresponding signal to
ground (GND, 0V).
5V
10kΩ
10kΩ
A0
A1
S W0
S W1
GND
To the Arduino’s A0 analogue pin
To the Arduino’s A1 analogue pin
Fig.1. Two pushbutton switches.
For the purposes of this experiment,
we are going to employ only switch SW0,
which we will use to inform our program
when we wish to ‘roll’ our virtual dice.
In Line 6 we define NUM_SEGS (the
number of segments on the display, including the decimal point) as being 8.
In Line 7 we define NUM_DIGITS (the
number of digits we wish to display) as
being 10. This is because we have ten
digits in our decimal number system:
0, 1, 2, 3, 4, 5, 6, 7, 8 and 9.
You may be wondering why we are
planning on defining all ten digits when,
for the purposes of this program, we
are planning on displaying only the
digits 1 through 6. There are two reasons. First, this will make things easier
if we ever wish to modify our program
to reflect 7, 8, 9 or 10-sided dice…
and yes, there are such beasts – see:
www.thediceshoponline.com
Second, for reasons we don’t wish
to delve into here, modifying our code
to define only the digits 1 through 6
would be more trouble than it’s worth.
In Lines 9 and 10 we define the minimum and maximum values we wish to
receive when we ‘roll’ our virtual dice.
In Lines 11 and 12 we define two delays
we wish to use before and after the dice
is rolled. In Line 13 we define a bit pattern corresponding to all the segments
being off. In Line 14 we define a bit pattern corresponding to only the middle
segment (like a minus sign) being on to
reflect a ‘ready’ condition, indicating
that the program is ready for the user to
press the switch.
Practical Electronics | August | 2023
Listing 2. (left)
Our original
Click()
function.
Listing 3. (right)
Our upgraded
Click()
function.
We won’t bother going through the
rest of the variable declarations because we’ve seen them all before, like
our PinsSegs[] and DigitSegs[]
arrays. Similarly, we don’t need to revisit our DisplaySegs() function,
which accepts a bit-pattern in the form
of an 8-bit byte and uses this pattern
to turn the corresponding display segments on or off. (All of these were first
introduced in PE, April 2023 and we’ve
been using them ever since.)
One thing we do need to consider is
our Click() function, which we’ve
been using to drive our piezoelectric
buzzer to make an exaggerated ‘click’
sound when we press our pushbutton
switches. The original version of this
function (which we introduced in PE,
June 2023) is shown in Listing 2.
I was just about to start throwing
around terms like ‘square wave’ and
‘mark-space ratio’ when I remembered
that that these might be new to some
readers, so let’s briefly introduce these
concepts as follows.
Our Click() function generates a
‘square wave,’ which is a periodic waveform whose amplitude alternates at a
steady frequency between fixed minimum and maximum values. In this
case, the term ‘mark-space ratio’ refers
to the ratio of the pulse being high (the
‘mark’) and low (the ‘space’). The time
taken to complete a complete cycle (ie,
the time between successive pulses) is
known as the ‘period,’ which equals the
mark plus the space (Fig.2).
Since it’s a ratio, the mark-space ratio
is, of course, unitless. In this example,
we’ve divided each cycle into four equal
portions. If the pulse is high for one of
these portions and low for the other
three, then its mark-space ratio is 1:3
or 25%:75% (Fig.2a). By comparison, if
the pulse is low for one portion and high
for the other three, then its mark-space
ratio is 3:1 or 75%:25% (Fig.2c). And,
of course, if the pulse is high for two
periods and low for two periods, then
its mark-space ratio is 2:2 or 50%:50%.
This is the same as saying 1:1; that is, a
perfect square wave whose mark-space
ratio is ‘unity’ (Fig.2b).
In the original incarnation of our
Click() function, we hard-coded the
number of cycles (5). We also hard-coded the durations of the signal’s mark
and space times as 1ms (millisecond)
each, which means the period (P) is
2ms, which is 0.002s (seconds). Since
frequency (the number of cycles per
second) is calculated as 1/P, this means
the frequency of our signal is 1/0.002s
= 500Hz. As an aside, ‘Hz’ stands for
‘hertz.’ This unit is named after Heinrich Rudolf Hertz (1857–1894), who
was the first person to provide conclusive proof of the existence of electromagnetic waves.
We arrived at the values used in our
original Click() function by trial-anderror. At that time, I invited you to play
around with them to experiment with
different sounds. For the purposes of
our rolling the dice program, we are
going to modify this function, as illustrated in Listing 3.
All we’ve done is parameterise the
number of cycles and the time we use
for both the mark and space delays. The
reason we’ve done this is to allow us
to generate different sounds to indicate
different things.
horizontal LED in our 7-segment display. Remember that we’re using this
to indicate that the program is ready
for the user to press the button.
Next, we call a new WaitForSwitch()
function, after which we call a new
RollTheDice() function. Can you
guess what these functions do!?
Let’s start with the WaitForSwitch()
function, as illustrated in Listing 5.
In Lines 77 through 80 we use a dowhile loop to cycle around waiting
for the switch to be pressed (we introduced this form of loop statement in
PE, March 2023).
In Line 82 we call our DisplaySegs()
function to turn all the segments off.
In Line 83 we call our Click() function with parameters of 5 (the number
of cycles) and 1 (the time to be used for
the mark and space delays). These parameters will result in the same ‘click’
sound we heard before. Finally, in Line
84, we pause for a moment to allow the
user’s eyes to register that something
is about to happen.
Last, but certainly not least, we come
to our RollTheDice() function, as
Listing 4. Our new loop() function.
We’re almost there
We are so close to actually rolling our virtual dice
that I can almost taste it (it’s
yummy!). Let’s take a look
at our new loop()
function, as shown
Frequency (f) = 1/P
P
in Listing 4.
M
S
As we see, we loop
1:3
(a)
around
doing three
(25%:75%)
things. First, we call
M
S
2:2 = 1:1
our DisplaySegs()
(b)
(50%:50%)
function, passing it
M
S
3:1
the READY bit pat(c)
(75%:25%)
tern we previousM = Mark
S = Space
P = Period
ly defined to acFig.2. Square waves and mark-space ratios.
tivate the middle Listing 5. Wait for the switch to be pressed.
Practical Electronics | August | 2023
51
to this switch bounce
problem in PE, June
2023, but we haven’t
included any of this
in our new program.
Why not?
Well, from our previous discussions, we
know that we are assuming that all bouncing has stopped after
8ms. In the case of our
new program, as soon
as we see the first transition on our switch,
Listing 6. Roll the dice and display the result.
we commence the process of rolling the dice
and displaying the result for two secillustrated in Listing 6. In Line 93 we
onds before returning to look at the
generate our random number. We introswitch, by which time we know it will
duced the random() function in earlier
have stopped bouncing.
columns (PE, February and March 2023),
When we generated random numbut it’s worth reminding ourselves that
bers in previous programs, we includthis generates a random integer coned an extra test to ensure that the new
strained by the lower bound (minimum)
number wasn’t the same as the previand upper bound (maximum) values we
ous value. Why didn’t we do that this
provide. The main point to remember is
time? Well, we’re trying to emulate a
that the lower bound value is inclusive
dice, and when we roll a physical dice
(will be included in the possible genit can certainly come up with the same
erated values) while the upper bound
number multiple times in succession.
is exclusive (will be excluded from the
What will happen if, when we press
possible generated values).
the switch, we hold it and don’t reAll this explains why, although we
lease it? We should be able to work this
defined DICE_MIN as 1 and DICE_MAX
out simply by looking at our code. Is
as 6, when we call the random() functhis what we want to happen? Persontion, we set the upper bound value to
ally, I couldn’t care less because it’s
(DICE_MAX + 1). This means that we
not something I expect the user to do.
are essentially calling random(1,7),
More importantly, nothing radical will
which will return a random value behappen if the user does decide to do
tween 1 and 6. This takes a bit of wrapthis. On the other hand, if we were deping one’s brain around, but it’s not
signing a system for real-world use that
too bad.
we wished to be foolproof, we should
In Line 94, we use our newly genconsider, document, and account for
erated random number to retrieve the
every possibility in our code. As Dougcorresponding bit pattern to display
las Adams famously said, ‘A common
that value on the 7-segment display.
mistake that people make when trying
In Line 96 we call our Displayto design something completely foolSegs() function to turn the various
proof is to underestimate the ingenusegments on and off. In Line 97 we call
ity of complete fools.’
our Click() function with parameters
As one final point, did you observe
of 10 (the number of cycles) and 4 (the
how in both the WaitForSwitch()
time to be used for the mark and space
and RollTheDice() functions we first
delays). These parameters will result in
presented the new value on the display
a different sound to the one we heard
(Lines 82 and 96) before generating the
before. Finally, in Line 98, we pause
corresponding sounds (Lines 83 and
to allow the user to observe the result
97)? In reality, everything is happening
from rolling the dice. Once this delay
so fast here that we could easily have
times out, we return control to the main
done things the other way, so, why am
loop() function and do it all again.
I even waffling on about this?
Suffice it to say that I started to think
Points to ponder
about how things happen when you
Before we actually run our new program,
are watching a cricket match and you
there are a couple of points that are well
see the batter hit the ball, followed a
worth pondering. For example, we know
short time later by the sound of the
that when we activate or deactivate
bat meeting the ball. This is, of course,
switches, their contacts can ‘bounce,’
because light travels much faster than
making and breaking connection anysound. Our brains are so accustomed
where from 1 to 100+ times before setto this discrepancy between the arrival
tling into their new state. We spent a
times of visual and audible signals that
lot of time coming up with a solution
52
we don’t even think about it. In fact,
if you asked most people, they would
claim that everything happened at the
same time.
I think it’s safe to say that the fact I
spent any amount of time cogitating and
ruminating over this provides a classic example of how I often overthink
things (‘Obsessive compulsive – moi?’).
Let’s do it!
Are you as excited as your humble narrator? I bet you’re not! Let’s load our program into our Arduino Uno and run it.
It works! Did you ever doubt me? I
don’t know about you, but I think this
actually looks pretty spiffy. So spiffy,
in fact, that I just took a video of it
running on my Arduino-breadboard
combo and uploaded it to YouTube:
https://bit.ly/3PgTg0S
One thing you’ll spot in this video
is that I’ve replaced my two momentary pushbutton switches with limit
switches on flying leads. I did this because I wanted to get as much switch
bounce as possible to ensure that our
programs deal with it appropriately.
We want more!
OK, how about we jazz things up a little
by generating a series of random numbers before settling on the final value?
As a starting point, let’s say we wish
to generate 16 random numbers over a
period of 6 seconds, which means there
will be a delay of 6/16 = 0.375s (375ms)
between values. Since we know that
the same number can come up multiple
times, let’s try blanking the display for
say 100ms between values to visually
delineate identical adjacent values (at
some stage we will need to subtract this
100ms delay from our 375ms delay).
I think implementing this modification is going to be a lot simpler than
you might suppose. Let’s start by adding
three new definitions: NUM_ROLLS (the
number of random values we wish
to generate), which we’ll set to 16;
TIME_PER_ROLL (the total time taken between values), which we’ll set to 375ms;
and TIME_BLANK (the blank period between values), which we’ll set to 100ms.
Now, all that remains is for us to
modify our RollTheDice() function
to generate a series of 15 random values
before finally settling on the 16th value,
as illustrated in Listing 7.
Basically, all we’ve really done is to
wrap the contents of our original function in a for() loop (we introduced this
type of loop construct in PE, February
2023). Inside this loop, we first blank the
display and wait for our TIME_BLANK
delay. Next, we generate and display
our new random value, generate our
sound effect, and pause for a time calculated by subtracting the time taken
Practical Electronics | August | 2023
F
me contemplate adding two more).
In physics and engineering, the term
‘envelope’ in the context of an oscillating signal refers to a curve or
line outlining its extremes. Right
T
from the get-go, I can visualise four
obvious contenders on the envelope
front (Fig.3)
The simplest alternative would
be to just slow the display in a
T
linear fashion (Fig.3a). A slightly
more sophisticated option would
be to have the display change at
a constant speed for some amount of
time, after which it could commence
its linear descent (Fig.3b). We could,
of course, be tempted to tart things up
a tad by replacing the straight-line decline, as seen in Fig.3b, with a curvaceous counterpart, as shown in Fig.3c.
Alternatively, we might contemplate
replacing the convex curve from Fig.3c
with its concave cousin in Fig.3d.
F
F = F requency
T = T ime
T
(a) Option 1
F
(b) Option 2
F
T
(c) Option 3
(d) Option 4
Fig.3. Initial envelope possibilities.
to blank the display from the total time
we budgeted for each roll of the dice.
Once we exit the loop, we pause for our
old PAUSE_AFTER_ROLL delay, which
gives the user time to observe and (if necessary) jot down the final value before
we return control to the main loop and
do it all again. You can, of course, access
this new version of our program (file
CB-Aug23-03.txt). Also, for your delectation and delight, I just videoed this new
version and uploaded it to YouTube, see:
https://bit.ly/3NzpO4X
Over thinking and over engineering
It’s one thing to sketch out the conceptual curves illustrated in Fig.3. However, coming up with actual values is
another kettle of fish, as they say. Why
don’t you take a moment to ponder how
you would set about doing this yourself.
You really didn’t spend much time
pondering, did you? I never even saw
your eyes blink between the previous
paragraph and this one.
Just for giggles and grins, let’s start
by showing you the envelope I ended
up using (Fig.4), and then I’ll describe
the tortuous path that got me there. As
you can see, this isn’t as smooth as one
might hope. There are a couple of discontinuities (especially the point
around 1.75 seconds), but I didn’t
realise that until
I just drew this
figure and I’m not
going to change
things now!
One-armed bandits
How could we add even more pizazz?
Well, what about making our random
numbers change quickly at first, and
then have them start to gradually slow
down before eventually settling on a
final value? I’m thinking of the way classic one-armed bandit machines used to
work; that is, slot machines with three
electromechanical wheels operated by
pulling a long handle (the arm) on one
side. The act of pulling the handle set
the wheels spinning and clicking to
provide a strangely satisfying audiovisual experience. The wheels gradually slowed, stopping one after the
other, building the user’s anticipation.
I must admit that I’d never really
thought about the thinking that went
into this… until now. In our case, we
have only one display (although just visualising one-armed bandits is making
The really interesting point is that
this is somewhat more subtle than I
would have supposed. We kick off at
time 0 with a straight line to around
1.5 seconds, then we have a concave
curve to around 3.5 seconds, at which
point we transition into a convex curve
until our last value, which occurs at a
tad over six seconds.
I was chatting to my chum Joe Farr
about this a few days ago (after I’d generated the data that ultimately led me
to the envelope shown in Fig.4). I explained what I was trying to do with respect to modifying the rate with which
the values change, and then I asked Joe
how he would have done this. He replied that he would have simply ‘guestimated’ a bunch of values and gone
from there.
Do you recall me saying that I often
overthink things? Well, oftentimes I also
overengineer them as well (sometimes
I even amaze myself with the convoluted hoops I end up making myself
jump through). In this case, I have
an application called Camtasia – see:
https://bit.ly/3PfbX5h – which I usually
use to record videos of myself embedded in PowerPoint presentations as
part of creating webinars. In this case,
I recorded myself clapping my hands
trying to replicate the sort of transition
rate I was hoping to see (Fig.5).
If you are interested, you can listen
to the audio recording of this (file
CB-Aug23-04.m4a). I then used the
cursor in Camtasia to read off the time
values for the individual claps, which
I stored in an Excel spreadsheet (file
CB-Aug23-05.xlsx).
F
F = F requency (Hz)
T = T ime (s )
5
4
3
2
1
T
0
0
1
2
3
4
5
6
Fig.4. The actual envelope used.
Listing 7. Generating a series of random values.
Fig.5. Screenshot of Camtasia recording of clapping my hands.
Practical Electronics | August | 2023
53
C lick
Nums
Delta
Times
Renormalised
Times
F req
(Hz)
#01
0.000
0.000
4.29
#02
0.233
0.233
4.29
#03
0.233
0.466
4.29
#04
0.233
0.699
4.29
#05
0.233
0.932
4.29
#06
0.233
1.165
4.29
#07
0.233
1.398
4.29
#08
0.266
1.664
3.76
#09
0.266
1.930
3.76
#10
0.300
2.230
3.33
#11
0.367
2.597
2.72
#12
0.407
3.004
2.46
#13
0.560
3.564
1.79
#14
0.667
4.231
1.50
#15
0.827
5.058
1.21
#16
N/A
6.058
0.00
Fig.6. Summary of spreadsheet values.
My clapping commenced 3.133s into
the recording (prior to this I was performing my limbering-up exercises to
prepare myself for the ordeal). The
first time round, I ran into a bit of a
snag since the cursor ‘auto-clicks’ from
0:00:03;00 to 0:00:03;01 to 0:00:03;02
etc. The first three colon-separated
numbers represent hours, minutes, and
seconds. I initially assumed that the
01, 02, 03 values following the semicolons were hundredths of a second.
However, when I entered these values
into my spread sheet, I observed big
discontinuities at the transitions from
one second to another.
When I looked more closely, I realised
that Camtasia counts from 0:00:03;00 to
0:00:03;29, from whence it transitions
to 0:00:04;00. That is, each second is
divided into 30 parts. This means that,
for my purposes, a value of 0:00:03;15,
for example, equates to 3s plus (1/30 *
15) seconds, which equals 3.5s in all.
If you do happen to look at the spreadsheet (a summary is provided in Fig.6),
you’ll see that I first normalised things
Still wire
with weight
on the end
Helical
spring
Wire
to 0V
Wire to 5V via
pull-up resistor
Fig.7. DIY trembler switch.
54
by subtracting the 3.133 starting
time from all the values. Next,
I calculated the deltas between
values, tweaked these deltas, and
generated renormalised values
from the tweaked deltas (these
are the horizontal time (X) values
used to generate Fig.4).
I also used the tweaked deltas
(which are measured in milliListing 8. Delta times for each roll.
seconds) to generate the vertical
frequency (Y) values used to generate
Fig.4. As we previously noted, it was
TimePerRoll[] array in Line 114 of
only after I actually drew Fig.4 that I
Listing 9.
realised there was some further tweakThis explains why we set the final
ing that could be performed, but by then
value in our TimePerRoll[] array
I’d already written my program and I
to be TIME_BLANK, because this will
decided enough was enough.
result in a delay of (TIME_BLANK –
On the one hand, you might say that
TIME_BLANK) = 0 following the final
this was a lot of expended effort for relaroll of the dice.
tively little result. I would disagree. If I
To be honest, I’m rather proud of the
had taken the easy route, I would never
result. You can access the latest version of
have known about the combination of
this program (file CB-Aug23-06.txt). And,
concave and convex elements forming
once again, I just uploaded a video of
my envelope. Based on past experience,
this new implementation to YouTube
I would say that this knowledge will
at: https://bit.ly/442TpcD
come in handy one day (almost everything I’ve ever learned has proved to
Trembling in anticipation
be useful... eventually).
Do you remember the classic Monty
Python Nudge Nudge Wink Wink sketch
So, what’s the result?
(https://bit.ly/3Xf3ot8)? Did you ever
To benefit from our efforts above, we
play on an old pinball machine? Some
must modify our program. Once again,
rascally players used to lift, tilt, or
the way we’ve architected things means
shake the machine to gain advantage
that this is going to be a lot easier than
if the occasion allowed (a special tilt
you might, at first, suppose.
mechanism was used to detect if the maTo start things off, we will delete our
chine was being lifted, tilted or shaken
TIME_PER_ROLL definition, because we
beyond an acceptable level).
now have individual times associated
The reason I ask these seemingly unwith each digit. As a replacement, we
connected questions is that I was thinkare going to add an array of integers
ing that we might add a ‘nudge nudge’
called TimePerRoll[] containing our
feature to the most recent version of our
Delta Times from Fig.6, as illustrated
program. In order to do this, we could
in Listing 8.
build a DIY ‘trembler switch’, as illusThe reason for setting the final value
trated in Fig.7.
to TIME_BLANK will become apparent
The idea is to have a stiff helical
when we look at the latest and greatest
spring mounted on some sort of base.
version of our RollTheDice() funcThis spring would be connected to 0V.
tion, as illustrated in Listing 9.
Running up the center of the spring
You know those quizzes where you
would be a stiffish wire with a small
are presented with two identical-seemweight attached to the end (a big blob
ing photos, and your task is to spot the
of solder would do). This wire would be
differences between them? Well, can
connected to 5V via a pull-up resistor
you spot the differences between the
(anything from 1kΩ to 10kΩ would work.
RollTheDice()
functions in Listings 7 and 9?
Components from Part 1
Actually, saying
LEDs (assorted colours)
https://amzn.to/3E7VAQE
‘differences’ is a bit
Resistors (assorted values)
https://amzn.to/3O4RvBt
of a red herring beSolderless breadboard
https://amzn.to/3O2L3e8
cause there’s only
Multicore jumper wires (male-male) https://amzn.to/3O4hnxk
one change. The
Components from Part 2
TIME_PER_ROLL
7-segment display(s)
https://amzn.to/3Afm8yu
constant value in
Line 107 in ListComponents from Part 5
ing 7 has been
Momentary pushbutton switches https://amzn.to/3Tk7Q87
replaced with a
Components from Part 6
variable value exPassive piezoelectric buzzer
https://amzn.to/3KmxjcX
tracted from our
Practical Electronics | August | 2023
(‘nudged’) anytime during the PAUSE_AFTER_ROLL
delay, then we could perform one more random roll
(this time we would add a check to make sure this
new random number is not the same as our previous
random value).
How about we all go off and create our own implementation of this? We’ll meet up again next month and
see how well we did and how your solution compares
to mine. Until next time, have a good one!
Online resources
Listing 9. Roll the dice with changing times.
For the purposes of this series, I’m going to assume
that you are already familiar with fundamental
concepts like voltage, current and resistance. If
not, you might want to start by perusing and pondering a short series of articles I penned on these
very topics – see: https://bit.ly/3EguiJh
Similarly, I’ll assume you are no stranger to
solderless breadboards. Having said this, even if
you’ve used these little scamps before, there are
some aspects to them that can trap the unwary,
so may I suggest you feast your orbs on a column
I wrote just for you – see: https://bit.ly/3NZ70uF
Last, but not least, you will find a treasure trove
of resources at the Arduino.cc website, including
example programs and reference documentation.
If you think about it, this would be like adding a third switch to
our existing pushbutton switches in Fig.1. In this case, we could
take the center tap point and feed it to the Arduino’s A2 analogue pin. Banging the table on which this switch resides would
cause the center wire to oscillate. A sufficient shock will cause
the wire to touch the spring,
thereby closing the circuit.
Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor of all he
The way we could make this
surveys at CliveMaxfield.com – the go-to site for the latest and greatest
work is, once our program is
in technological geekdom.
displaying its final value, if
Comments or questions? Email Max at: max<at>CliveMaxfield.com
our trembler switch is triggered
Teach-In 8 CD-ROM
Exploring the Arduino
EE
FR -ROM
CD
ELECTRONICS
TEACH-IN 8
FREE
CD-ROM
SOFTWARE
FOR
THE TEACH-IN
8
SERIES
FROM THE PUBLISHERS OF
This CD-ROM version of the exciting and popular Teach-In 8 series
has been designed for electronics enthusiasts who want to get to
grips with the inexpensive, immensely popular Arduino microcontroller,
as well as coding enthusiasts who want to explore hardware and
interfacing. Teach-In 8 provides a one-stop source of ideas and
practical information.
The Arduino offers a remarkably effective platform for developing a
huge variety of projects; from operating a set of Christmas tree lights
to remotely controlling a robotic vehicle wirelessly or via the Internet.
Teach-In 8 is based around a series of practical projects with plenty of
information for customisation. The projects can be combined together
in many different ways in order to build more complex systems that can
be used to solve a wide variety of home automation and environmental
monitoring problems. The series includes topics such as RF technology,
wireless networking and remote web access.
PLUS: PICs and the PICkit 3 – A beginners guide
The CD-ROM also includes a bonus – an extra 12-part series based around the popular
PIC microcontroller, explaining how to build PIC-based systems.
£8.99
INTRODUCING THE ARDUINO
• Hardware – learn about components and circuits
• Programming – powerful integrated development system
• Microcontrollers – understand control operations
• Communications – connect to PCs and other Arduinos
PLUS...
PIC n’MIX
PICs and the PICkit 3 - A beginners
guide. The why and how to build
PIC-based projects
Teach In 8 Cover.indd 1
04/04/2017 12:24
PRICE
£8.99
Includes P&P to UK if
ordered direct from us
SOFTWARE
The CD-ROM contains the software for both the Teach-In 8 and PICkit 3 series.
ORDER YOUR COPY TODAY!
JUST CALL 01202 880299 OR VISIT www.epemag.com
Practical Electronics | August | 2023
55
|