This is only a preview of the August 2024 issue of Practical Electronics. You can view 0 of the 72 pages in the full issue. Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
Articles in this series:
|
Max’s Cool Beans
By Max the Magnificent
Arduino Bootcamp – Part 20
let’s start this column with what
they call a ‘pop quiz’ in the US
(this means an unexpected test; it’s
nothing to do with pop music, thank
goodness). The way we currently have
our clock working, we always display
the most-significant (left-hand) digit,
even if it’s a 0 (Fig.1a). Suppose we
decided to suppress this leading 0 and
instead display a blank (Fig.1b). Can
you think of a way to implement this in
our latest and greatest program from our
previous column (PE, July 2024) using
the minimum number of modifications?
Dazed and confused?
With respect to the 7404 and 7408
integrated circuits (ICs) we introduced
in our previous column, I received
several emails from dazed and confused
readers asking about the extra letters
marked on the packages, which should
read something like SN74LS04N and
SN74LS08N. For one stalwart fellow,
it was the ‘N’ that threw him into a tizwoz. ‘Have I ended up with the wrong
ones?,’ he pleaded, plaintively.
Let’s start with the first two letters,
which are shown as ‘SN’ here. These
refer to the manufacturer, which is
Texas Instruments (TI) in this case –
under TI’s part numbering scheme, ‘SN’
stands for ‘Semiconductor Network’. The
‘74’ portion of the moniker indicates
commercial components that operate
over a temperature range of 0°C to +70°C.
If this were 64, it would indicate an
industrial component (–40°C to +85°C),
while 54 would signify a military
component (–55°C to +125°C).
(a) Display leading 0
(b) Blank leading 0
Fig.1. Do we want a leading 0?
52
There are many different
families of these components.
Top view
I suggested the LS (‘LowSide
Power Schottky’) family
To other
views
because they are cheap and
rails and
breadboard
cheerful and do the job. My
a
k
k
second choice would have
16V 100µF
a = anode (+ve)
From
Electrolytic
been the HC (‘High-Speed
k = cathode (-ve) Capacitor
Arduino
CMOS’) family because these
are more tolerant with respect
to the voltages on their input Fig.2. Adding a 16V 100µF electrolytic capacitor.
signals. On the other hand,
ohms (kiloohms or kΩ, meaning 103),
they are less tolerant of static, and they
may be a tad more expensive. Some
or millions of ohms (megaohms or MΩ,
hobbyist kits offer both LS and HC types
meaning 106).
– see: https://bit.ly/44JMZRa
By comparison, in the case of
The 04 and 08 reflect the types of logic
capacitors, their values (capacitances) are
functions (the 04 contains six NOT gates;
measured in units of farads (F). The term
the 08 boasts four 2-input AND gates).
‘farad’ was originally coined by Latimer
You can peruse and ponder the entire list
Clark and Charles Bright in honour of
of available functions on the interweb
the English scientist Michael Faraday.
at: https://bit.ly/3wON1L3
We typically deal with capacitors having
Last, but certainly not least, the final
small values measured in millifarads
character (or characters) indicates the
(mF, meaning 10 –3), microfarads (µF,
package type, where N tells us that our
meaning 10–6), nanofarads (nF, meaning
devices are presented in plastic dual
10–9), and picofarads (pF, meaning 10–12).
in-line packages (PDIPs).
Why am I waffling on about this now?
If you wish to delve deeper, a handyWell…
dandy Interpreting TI Logic Part Numbers
document is available for your perusing
Smoothing things out
pleasure at: https://bit.ly/3ylkYn3
As I mentioned at the end of our last
column, I ran into a WTW (‘what
Little and large
the what?’) problem with one of my
There used to be a British comedy duo
breadboards. During the process of
called Little and Large. Straight man
diagnosing this problem, I did what I
Syd Little (born Cyril John Mead) and
should have done much earlier, which is
comic Eddie Large (born Edward Hugh
to add a 16V 100µF electrolytic capacitor
McGinnis) became household names
straddling the power and ground rails
in the late 1970s and the 1980s. The
on the breadboard as close as possible to
reason they just popped into my mind
the point where the power and ground
is that we tend to deal with very small
wires arrive from the Arduino (Fig.2).
and very large values with respect to
This type of capacitor looks like a
electronic components (just call me the
small soda can with two legs. It’s a
‘Sovereign of Segues’).
polarised component (ie, a part with
Take resistors, for example. The values
polarity), which means it can be correctly
(resistances) of these little scamps are
connected into the circuit in only one
measured in units of ohms (symbol
orientation. The longer lead is the anode,
Ω). These are named after the German
which is connected to the more positive
physicist Georg Simon Ohm, who studied
rail (the +5V rail, in our case). The shorter
the relationship between voltage, current
lead is the cathode, which is connected
and resistance (and often forgotten,
to the more negative rail (the 0V rail, in
temperature). We typically deal with
our case). The cathode side of the can is
resistors having large values measured
also marked with a minus sign to give
in hundreds of ohms, thousands of
us a clue. You can obtain these devices
16v100uF
J
ust for giggles and grins,
Practical Electronics | August | 2024
100nF Ceramic Capacitor
Top view
Side view
104
7404
Fig.3. Adding an 0.1µF (100nF) ceramic
capacitor to the breadboard.
from any electronic component supplier,
including Amazon – see, for example:
https://bit.ly/44LzpNa
The 100µF is the device’s capacitive
value read as ‘100 microfarads’. The 16V
is its rated value, which means it isn’t
capable of handling more than 16V. I
picked 16V because (a) it provides nice
headroom over our 5V supply and (b) it’s
a commonly available value. It would
be perfectly OK to use a higher rated
component like 25V or 50V if that’s what
you have available. However, a higher
voltage rating typically means a physically
larger or more expensive part, often both.
This capacitor is used to filter out any
electrical noise from the power source,
which is the Arduino in our case. It
can also help to smooth out any power
dips caused by components switching
and drawing extra current. This isn’t
a mission-critical component for our
existing circuit, but I’ve decided to add
one anyway.
No coupling allowed
As you may recall, the terms ‘currentlimiting,’ ‘pull-up,’ and ‘pull-down’
are simply qualifiers we add to
resistors to remind ourselves as to the
functions we’re using them to perform
(the physical devices we use are the
same). Similarly, ceramic capacitors
can be employed for a wide variety
of tasks, including acting in ‘bypass’
and ‘decoupling’ roles. Although these
serve different purposes, many people
use the terms ‘bypass capacitor’ and
‘decoupling capacitor’ interchangeably.
A ‘bypass capacitor’ is usually applied
between the power and ground pins of an
IC. It provides a low-impedance path to
steer voltage spikes and high-frequency
noise to ground, thereby ‘bypassing’ the
IC. (This noise can come from the power
supply or other parts of the circuit or
external sources).
The term ‘coupling’ refers to the
undesired transfer of electrical energy
between subsystems. For example, when
Practical Electronics | August | 2024
digital logic devices – like our 7404
and 7408 chips – are switching, they
can pull the supply rail voltage down
by introducing a momentary (transient)
current load. This can affect nearby
devices, which are ‘coupled’ via their
power and ground pins. To prevent
this, a ‘decoupling capacitor’ is usually
applied between the power and ground
pins of the IC (the same as the bypass
capacitor). In this case, we can think
of the capacitor as acting like a small,
localised energy reservoir (a miniature
battery, if you will), holding the voltage
steady long enough for the main supply
to catch up.
It’s a good idea to add decoupling/
bypass capacitors in the form of
ceramic components to our circuits.
If you are unsure as to the number(s)
and value(s) of these capacitors, you
should check the data sheets for the
specific manufacturers’ parts you are
using. Having said this, a good rule of
thumb is one 0.1µF (100nF) capacitor
per IC. This should be positioned as
close to the IC’s power pin(s) as possible,
connecting this pin to the ground plane
in the case of a printed circuit board
(PCB), or to the ground rail in the case of
a breadboard (Fig.3). Ceramic capacitors
aren’t polarised, so we can connect them
either way round.
Why haven’t I mentioned these before?
Well, our current circuit involves only
two chips containing combinatorial
functions that are less susceptible to
noise and voltage dips on the power rail.
Things will become more ‘interesting’
when we start to use chips containing
sequential (clocked) elements, such
as shift registers, for example. Having
said this, it’s good to get into the habit
of adding these capacitors as a matter
of course, so that’s what we are going
to do. You can get ceramic capacitor
kits containing multiple values – see:
https://bit.ly/4bEAUiv
One thing that can trip beginners
up is that the values printed on these
components are not particularly
intuitive, so do your best to not get
them mixed up. What we are looking
for is components that say ‘104’ (if
we are lucky) as illustrated in Fig.3.
What does this mean? I was hoping
you wouldn’t ask. It means 10 x 10 to
the fourth power (10 x 104) = 100,000
measured in picofarads (pF), which
equates to 100nF or 0.1µF (now, you try
explaining this to someone).
I’ve added all the capacitors
mentioned here into the latest and
greatest incarnation drawing of our
prototyping platform (file CB-Aug2401.pdf). And, as usual, all the files
mentioned in this column are available
from the August 2024 page of the PE
website: https://bit.ly/pe-downloads
Mea culpa
I have something to share with you –
mea culpa – which means ‘through
my fault’ in Latin, and is used to mean
‘it was my fault’ or ‘I apologise.’ So,
why am I apologising? Well, I came to
realise that I sort of threw you in at the
‘deep end’ in our previous column. I
presented you with the schematic and
layout for our new 2:4 decoder without
any accompanying assembly and test
instructions... yup, mea culpa
Throughout this series, I’ve enjoined
you to take things one step at a time. I
should have followed my own advice
when it came to the addition of the
decoder. ‘It’s just two jellybean logic
chips,’ I thought. ‘I can do this in my
sleep,’ I thought. ‘What could possibly
go wrong?’ I thought.
So, you can only imagine my surprise
when I first ran the program with the
circuit featuring our new decoder and…
it didn’t work. Even worse, it didn’t
work in a very unintuitive way. That’s
when I started to worry about how you
were getting on at your end.
After a lot of messing around trying to
diagnose the issue, eventually resorting
to having a video call with my chum, Joe
Farr, it turned out there was a problem
with the internals of my breadboard in
the area where I’d added my 7404 and
7408 chips (sometimes one is tempted
to wonder if Gremlins truly are naught
but a myth).
When I eventually come to remove all
the components from this breadboard at
some stage in the future, I’m going to pry
the back off and look inside to locate the
problem. However, since I was pushed
for time, and since I knew that everything
apart from the decoder was operating
as expected, I simply reconstructed
the decoder portion of the circuit on a
separate half-size breadboard (Fig.4).
As you can imagine, I was just a little
less cocky this second time around,
causing me to implement the decoder
in a more staged way, as discussed later
in this column.
That’s shocking!
Before we plunge into the fray with
gusto and abandon (and aplomb, of
course), we should remind ourselves
that semiconductor devices like lightemitting diodes (LEDs), transistors and
ICs can be fatally affected by static
electricity in the form of electrostatic
discharge (ESD). If you happen to build
up a static charge (by walking across a
carpet in your stocking feet, for example)
and you generate a spark, although
there’s not much current, that spark can
be as high as 35,000V, which can give
any semiconductor device with which
it comes into contact a very ‘bad hair’
day indeed.
53
Fig.4. Working system with the 2:4 decoder on the half-size breadboard at the bottom.
As I said deep in the mists of time
when we started Part 1 of this Arduino
Bootcamp series (PE, January 2023):
‘To prevent any such unfortunate
occurrence, may I make so bold as to
suggest you invest in an anti-static
mat (https://amzn.to/3g1YH4A) and an
anti-static wrist strap (https://amzn.
to/3WYZ9Bu). Both typically come
with crocodile clips (a.k.a. alligator
clips in the US), which you can pull
off to reveal banana plugs. My preferred
modus operandi is to plug these banana
plugs into an anti-static grounding plug
(https://amzn.to/3hDIcML), which is –
in turn – plugged into a wall socket or
a power strip.’
With respect to the anti-static mat,
get the largest one you can that fits
your workspace (and your budget).
Also, and this bit is very important, if
you are working with static-sensitive
components (diodes, transistors, ICs…),
then do not waste your money on a
blue or grey ‘Heat-Resistant Silicone
Work Mat’ (like this one: https://bit.
ly/4bMwYfw). I know the description
includes the words ‘anti-static,’ but this
54
is naught but ‘click bait.’ Silicone is an
electrical insulator, but anti-static mats
must be able to conduct static build-up
away to ground. A giveaway clue is that
there is no way to connect these mats
to ground!
Testing times
If you don’t already own a digital
multimeter, now would be a really good
time to invest in one. You have two main
options in the form of hand-ranging or
auto-ranging products. There are more
pros and cons to this decision than you
might suppose, but the accuracy will be
the same in both cases.
For the purposes of this column, we
will simply note that a hand-ranging
multimeter takes a little longer to set
up because you first need to select the
desired range. This can be a little tricky
for beginners to wrap their brains around.
Suppose our hand-ranging multimeter
indicates support for the 2V, 20V and
200V DC voltage ranges, for example (I
can no longer remember why multimeter
manufacturers use these arcane values).
The 2V setting will measure voltages
up to 2V, the 20V setting will measure
voltages up to 20V, and so on. Now
suppose we wish to measure a signal
that we know can vary only between 0V
and 5V, like the signals generated by our
Arduino Uno, for example. In this case,
we would select the 20V range because
this is the closest to the values we want
to measure while still being higher
than the values we want to measure. If
we were to select the 200V range, this
would still measure our signal, but with
less precision.
By comparison, in the case of an autoranging multimeter, the setup is faster
because all we need to do is select the
DC voltage option. However, this type of
multimeter will take longer to make the
reading because it first needs to decide
on the most appropriate range.
For what we are doing here, which will
include verifying our power connections
and monitoring the states on our logic
signals, I would suggest buying a cheapand-cheerful hand-ranging device, such as
the ULTRICS Digital Multimeter, which is
available for only £9.99 from Amazon at
the time of writing: https://bit.ly/4dMDu7V
Practical Electronics | August | 2024
One very important point
+5V
when you opt for a costa
conscious offering like this is
k
to use it only for low-voltage
680Ω
and low-current work, say up
Probe
to 40V and a couple of amps.
680Ω
Don’t use it for mains or highera = anode
a
voltage applications. I’m in no
k = cathode
way impugning the purveyors
k
0V (GND)
of these products, but why take
any chances?
Fig.5. Logic tester.
If you decide to delve deeper
into electronics, then at some stage in the future you may
decide to invest in more sophisticated equipment, for example,
an oscilloscope. I was just about to say that, since you are
reading this Arduino Bootcamp column, you probably don’t
have a tool like this in your collection. But then it struck
me that you could be an analogue hero dipping your toes
in the digital waters for the first time, in which case (a) you
may indeed have an oscilloscope and (b) welcome to the
digital world; come on in, the water’s fine.
That’s logical
One very useful tool for the sort of work we’re currently
doing is a logic probe, which can be used to detect and reflect
our logic 0 (0V) and logic 1 (5V) states. These are cheap,
cheerful and extremely useful. You can buy one already
built, like the Laser 5263 for £16.44 (https://bit.ly/4aqwo6h)
or the JDXFENG for £3.99 (https://bit.ly/3wSHovd), or you
might even opt for a DIY soldering kit version for £8.75
(https://bit.ly/3yv5D3e).
I decided a logic probe would be helpful in tracking down
my own problem, but I can’t remember where I put mine, and
I didn’t want to wait for one to be delivered (or spend any
money on one, for that matter), so I decided to whip up a little
something with what I had to hand. In a crunchy nutshell,
we are talking about using a small breadboard (or part of our
existing breadboard), two LEDs, two resistors, and a multicore jumper wire. We will use items from the various kits
we purchased in Part 1 of this epic saga (PE, January 2023).
A schematic is shown in Fig.5.
The reason I selected red and yellow LEDs is that the ones
in my kit both claim forward voltage drops of 2V. I would
Top View
a
a
Side View
k
k
k
a
10
15
k
From other
breadboards
1
5
P1
P2
P3
20
P4
Fig.6. Six logic probes.
Practical Electronics | August | 2024
J I H G F
J I H G F
E D C B
E D C B A
a = anode
a
k = cathode
25
P5
30
P6
Components from Part 1
LEDs (assorted colours)
https://amzn.to/3E7VAQE
Resistors (assorted values)
https://amzn.to/3O4RvBt
Solderless breadboard
https://amzn.to/3O2L3e8
Multicore jumper wires (male-male) https://amzn.to/3O4hnxk
Components from Part 2
7-segment display(s)
https://amzn.to/3Afm8yu
Components from Part 5
Momentary pushbutton switches
https://amzn.to/3Tk7Q87
Components from Part 6
Passive piezoelectric buzzer
https://amzn.to/3KmxjcX
Components for Part 9
SW-18010P vibration switch
https://bit.ly/46SfDA4
Components for Part 10
Breadboard mounting trimpots
https://bit.ly/3QAuz04
Components for Part 12
Light-Dependent Resistor
https://bit.ly/3S2430m
Components for Part 13
BC337 NPN Transistor
https://bit.ly/40xAgyS
Components for Part 14
HC-SR04 Ultrasonic Sensor
https://bit.ly/49AMBq4
Components for Part 15
Real-Time Clock (RTC)
https://bit.ly/3S9OjHl
Components for Part 18
Long tailed (0.1-inch pitch)
header pins
https://bit.ly/3U1Vp2z
Components for Part 19
Prototyping boards
Kit of popular SN74LS00 chips
https://bit.ly/3UMkcZ1
https://bit.ly/3wqgzyv
Components for Part 20
16V 100µF electrolytic capacitors https://bit.ly/44LzpNa
Ceramic capacitors (assorted values) https://bit.ly/4bEAUiv
have preferred to use red and green devices, but my green
LEDs are noted as having a forward voltage drop of 3V.
Let’s assume we leave the end of our probe waving in the
air. In this case, once we’ve accounted for the two 2V voltage
drops, we are left with 5V – 2V – 2V = 1V to power both LEDs.
I’ve decided to use 680Ω resistors (with blue-grey-brown
bands). Since there are two of them in series (one after the
other), the total resistance is 1,360Ω. Using Ohm’s law of V
= I × R, from which we derive I = V / R, we know our current
(I) will be 1V / 1,360Ω = ~0.7mA. What this means is that
both of our LEDs will glow very dimly indeed.
Now suppose we connect the flying end of our logic probe to
+5V. This could be our power supply rail or an output from one
of our digital ICs that’s currently driving a logic 1 value. In this
case, we will have 5V on both sides of our yellow LED, which
therefore won’t do anything at all. By comparison, our red LED
now has the full 5V across it (and one 680Ω resistor). Removing
this LED’s 2V voltage drop gives 5V – 2V = 3V. Since all the
current is now flowing through a single resistor, this current
will be 3V / 680Ω = ~4.4mA, which means the red LED will
glow with a respectable brightness without hurting our eyes.
Similarly, if we connect the flying end of our logic probe
to +0V (this could be the ground rail or an output from one
of our digital ICs that’s currently driving a logic 0 value, our
red LED will be disabled and our yellow LED (which we are
pretending is green) will glow like a champion.
As I previously mentioned, we could implement our
logic probe on an unused portion of one of our existing
55
4
Connection
5
No connection
&
s0
s0
s0
→ U1.5
→ U2.13
→ U2.5
y2
s1
s1
s1
→ U1.1
→ U2.1
→ U2.4
To
Transistors
U1.6
U1.6
→ U2.9
→ U2.2
11
U1.2
U1.2
→ U2.10
→ U2.12
6
y3
U2_2
1
From
Arduino
&
U2_1
5
s0
Pin 10
1
2
U1_1
s1
Pin 11
2
6
U1_3
12
13
&
3
y1
U2_4
10
U1 = 7404
U2 = 7408
9
(a) Schematic
&
U2_3
8
y0
U2.8 →
U2.11 →
U2.3 →
U2.6 →
y0
y1
y2
y3
(b) Wiring List
Fig.7. Schematic and wiring list for 2:4 decoder.
breadboards. However, if we have a
spare board available – preferably a
half-size board – then it might be better
to employ this because it will be useful
for other projects in the future. You can
lay this out however you wish, but one
possibility is shown in Fig.6.
Yes, I know, I got a bit carried away
(LEDs… what can I say?). In the
discussions below, you will be able
to get by with a single logic probe, but
more will be better, and they’ll always
come in handy in the future.
Note that, although I show the power
and ground wires feeding our probe board
as coming from our other breadboards,
we could use a separate +5V supply if
we wished. The important point here
is that all the breadboards and power
supplies must share (be connected to) the
same ground (I’ll explain the rationale
behind this next month).
One point to go along with our
philosophy of taking things step-bystep is to start by building only probe
P1. Once you’ve added the components
as shown, power things up and observe
that both LEDs associated with P1 glow
faintly. Next, plug the probe into the
lower power rail and check that the red
LED glows brightly while the yellow LED
the breadboard (along with all their
wiring), and we’ll do it all again from
the beginning.
Even if your decoder worked from
the get-go (pat yourself on the back),
you may still find these discussions to
be instructive.
We start by returning to our 2:4
decoder schematic (Fig.7a) and using
it to create a wiring list (Fig.7b). If you
have a photocopier or a scanner handy,
it would be a good idea to make a couple
of copies of Fig.7.
The first check is to make sure our
wiring list matches our schematic. Take
a colored pencil and highlight a section
of wire (not the whole wire) in the
schematic, like the bit that goes from s0
to U1.5 (IC1, pin 5), and then highlight
the corresponding line in the wiring list.
Do this for all the wire segments in the
schematic. When you’ve finished, all
the wires in the schematic and all the
lines in the list should be highlighted.
If anything remains unhighlighted, we
have a problem that needs to be resolved
before we proceed further.
Before we do anything else, we want to
deactivate our 7-segment displays to (a)
make sure they don’t flicker annoyingly
and (b) make sure we don’t have multiple
is completely off. Finally, plug the probe
into the lower ground rail and check that
the yellow LED glows brightly while the
red LED is completely off.
If any of this doesn’t work as stated,
start by using your multimeter to verify
that you have 5V between the anode (a)
of the yellow LED and the cathode (k)
of the red LED. Next, check that you
have both LEDs plugged in the right
way round (compare the schematic
to your breadboard layout). If all else
fails, try swapping out the
LEDs (they could be bad…
100nF Ceramic
remember ESD).
Capacitors
Once you have your first
probe working (bravo!), build as
many as you wish, one at a time,
testing each one as you add it
to your breadboard, and then
proceed to the next section.
7408
14
(5V)
8
7404
What we should have done
1
7
So, finally we come to what
(0V)
we should have done the
U1 = 7404
first-time round. If you are
U2 = 7408
having problems with your
From Arduino
11 (s1) 10 (s0)
2:4 decoder, then I know this
is going to hurt, but let’s power
everything down, remove the Fig.9. Add the ICs along with their power and ground
7404 and 7408 chips from connections and ceramic capacitors.
To Displays
D3
y3
D2
D1
y2 y1
D0
y0
From 2:4 Decoder
(eventually)
Fig.8. Disable the displays.
56
Listing 2a. Simple test of 2:4 decoder.
Practical Electronics | August | 2024
Time
(a) Order of display
(b) All off
Fig.10. Test values.
displays active simultaneously because
we know that’s a bad idea. So, connect
the ends of the y0, y1, y2 and y3 wires
into the lower ground rail (the blue 0V
rail) as illustrated in Fig.8. These are the
wires connected to the resistors that drive
the bases of our transistors. Connecting
them to 0V will turn the transistors off,
thereby disabling the displays.
Next, power everything up and verify
that the green and blue LEDs straddling
the power and ground rails at the top of
the breadboard light up.
Now, set your multimeter to the 20V DC
range, and then use its probes to check
the voltage across the power and ground
rails. As a ‘rule-of-thumb,’ I typically
apply the black probe first. Start with the
pair of rails at the bottom of the board
and then the pair at the top of the board.
Ideally, you should see a 5V (meaning
+5V) value, but the Arduino’s supply
isn’t ferociously robust, so you may have
a slightly lower reading. In my case, I’m
seeing 4.87V, as shown in Fig.4. If your
reading is substantially lower than this –
say 4.5V, for example – then you have a
problem, possibly even a bad breadboard,
which is what happened to me.
If you get a negative reading like
–5V, then this probably means you’ve
applied your probes the wrong way
round. Your red probe should be on
the power rail and your black probe
should be on the ground rail. If the
reading continues to show negative,
then check the probe connections at the
multimeter end. The black wire should
be plugged into the ‘COM’ (common)
port and the red wire should be plugged
into the ‘VΩmA’ port.
Now, power everything down again,
add the 7404 and 7408 ICs to the
breadboard, and connect their power
and ground pins as shown in Fig.9.
Remember that the ‘dimple’ at one end
of the package is used to determine
which end is which. In this case, both of
our chips use pin 14 for power and pin
7 for ground, but every IC is different,
so you should always consult the data
sheets for any chips you are using. While
we’re at it, let’s also add the two 0.1µF
ceramic capacitors we discussed earlier.
We’ll mount these as close to each IC’s
power pin as possible.
Feel the power!
Re-apply the power, and then check the
voltage across pins 7 and 14 of the 7404. I
mean this literally – apply the black probe
to pin 7 and the red probe to pin 14. Once
again, this should reflect a voltage of ~5V.
Next, verify that the voltage across pins 7
and 14 of the 7408 is the same ~5V.
Testing, testing
This is where things get interesting. All
we are going to do is repeatedly write the
values 0, 1, 2 and 3 to the displays D0,
D1, D2 and D3, respectively. Remember
that we can have only one display active
at a time. Also, since we want to be able
to see what’s happening, we’ll set things
up so each value will be on for one second
and off for three seconds.
Let’s start by creating a simple test
program (file CB-Aug24-02.txt). I’ve based
this on the latest and greatest program from
the previous issue, but I’ve stripped out
anything extraneous to what we’re trying
to do here. As an example, our loop()
function is now as shown in Listing 2a.
With respect to the f o r ( ) loop
established on Line 63, the iDisp control
variable repeatedly counts from 0 to 3.
We start by turning all our display
segments off (Line 63). Then we set the
values on our s0 and s1 signals (Lines
66 and 67). We derive these signals from
the current value of iDisp (we discussed
this last month). Next, we activate the
segments associated with the current
digit we wish to display (Line 68).
Once again, we use the current value of
Fig.11. Using logic probes to make sure everything works.
Practical Electronics | August | 2024
57
Online resources
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.
Listing 4a. Modifying the DigitSegs[] array.
To be honest, digital multimeters aren’t great for monitoring
logic signals, but we can use them ‘at a pinch.’ You might
be surprised to learn that analogue multimeters (or analogue
voltmeters) are much more useful here. Given a choice,
however, we will be better off using the simple logic probes
we created earlier.
iDisp to select the segments. Finally, we pause for a delay of
ON_OFF_TIME, which I’ve set to 1000 milliseconds (1 second).
All of this means that when we run our program,
the sequence presented on our displays will appear
as shown in Fig.10a.
Well, the sequence would appear as shown in
Fig.10a except for two small points (I’m reminded
of Black Adder telling Baldrick, ‘It’s a cunning plan
with one tiny flaw’). Can you spot the tiny flaws in
our case? You’re correct: (a) we haven’t wired up our
2:4 decoder yet and (b) we’ve forcibly deactivated all
our displays as per Fig.8. So, when we first run our
program, the output will be as illustrated in Fig.10b.
Check that the two purple s1 and s0 wires are
connected as shown in Fig.9. That is, one end of
the s1 wire should be connected to the Arduino’s
digital pin 11, while the other end is connected to
U1.1. Similarly, one end of the s0 wire should be
connected to the Arduino’s digital pin 19, while
the other end is connected to U1.5.
We know that our s1 and s0 signals should be
repeatedly going through the sequence 00, 01, 10
and 11. If we think about this another way, s0
will be going through the sequence 0, 1, 0, 1 (off
for a second, on for a second, ...) while s1 will be
going through the sequence 0, 0, 1, 1 (off for two
seconds, on for two seconds, …).
Assuming your multimeter is still set to 20V in
the DC range, place the black probe on U1.7 (that’s
pin 7 of the 7404) and the red probe on U1.5. Since
pin 5 is connected to signal s0 from the Arduino,
you should see your multimeter display showing
0V, 5V, 0V, 5V. If not, re-check that the other end
of the purple wire is plugged into pin 10 on the
Arduino. If it is, try swapping the wire for a new one.
Once you’ve confirmed that you are seeing what
you expect, highlight the s0 → U1.5 track segment
in a new copy of Fig.7 (or use the old copy and
mark it with a different colour). Do this both in the
schematic (Fig.7a) and the wiring list (Fig.7b). Keep
on doing this with every new segment as it’s verified.
Leave the black probe on pin 7 and move the
red probe to pin 1, which is connected to signal
s1 from the Arduino. Now the multimeter display
should show 0V, 0V, 5V, 5V. If not, re-check that
the other end of the purple wire is plugged into pin
11 on the Arduino. If it is, try swapping the wire. Listing 4b. Modifying the loop() function.
58
Practical Electronics | August | 2024
If you created only one probe, connect it to U1.5 and watch
do is modify our program to replace a 0 with a blank on
the LEDs flash yellow, red, yellow, red, then connect it to U1.1
display D3. As always, there are numerous ways to do
and watch the LEDs flash yellow, yellow, red, red. If you created
this. The approach I opted to use works as follows (file
two probes, you can monitor both signals simultaneously.
CB-Aug24-04.txt).
Now, let’s perform our first test on U2 (the 7408). Add a
First, as illustrated in Listing 4a, I modified the instantiation
wire to connect U1.5 (s0) to U2.5 and use one of your logic
of our DigitSegs[] array on Line 31 by increasing its size
probes to verify that you are still seeing the yellow, red, yellow,
from NUM_DIGITS (ten elements that are indexed from 0
red pattern on U2.5 (if not, check both ends are plugged into
to 9) to NUM_DIGITS+1 (eleven elements that are indexed
the right holes in the breadboard and/or swap out the wire).
from 0 to 10). This new element, which corresponds to all
Add another wire to connect U1.1 (s1) to U2.4 and use one
our segments being off, appears on Line 44. We can access
of your logic probes to verify that you are still seeing the
this using DigitSegs[10] in our code. We could have
yellow, yellow, red, red pattern on U2.4.
specified this directly as B00000000, but I decided to use
U2.4 and U2.5 are inputs to one of the AND gates in U2. If
our existing ALL_SEGS_OFF definition.
everything looks good, connect a probe to the output of this
Next, we need to add a simple test just before we display the
AND gate, which is U2.6. In this case, you should be seeing
digits. This test is shown on Lines 93 and 94 of Listing 4b. If the
yellow, yellow, yellow, red.
digit to be displayed on display D3 is 0, we replace this with
This is the good part. Disconnect the end of the green y3
NUM_DIGITS, which is defined as being 10. This will cause
wire from the ground rail (Fig.8) and connect it to U2.6.
the call to DisplaySegs() on Line 102 to display our blank.
Display D3 should present blank, blank, blank, 3. That is, it
should be off for three seconds and then display the number
Next time
3 for one second and then repeat.
I know you’re as tired of hearing me say this as I am of
OK, now you know the drill. Use a similar process to bring
saying it, but in our next column we honest-to-goodness
up the remaining displays, one at a time. I only hope you
are going to start using a BCD-to7-segment decoder in our
will be as happy as I was once everything starts to work as
clock. As always, until that frabjous time comes (next
planned (Fig.11)
month, I pomise!), I welcome your comments, questions
All that remains now is to reload the program that uses our
and suggestions.
2:4 decoder to control the displays and show the time (file
CB-Aug24-03.txt).
Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor of all he
And finally…
surveys at CliveMaxfield.com – the go-to site for the latest and greatest
I hope you haven’t forgotten our
in technological geekdom.
pop quiz from the beginning of
Comments or questions? Email Max at: max<at>CliveMaxfield.com
this column. What we want to
STEWART OF READING
17A King Street, Mortimer, near Reading, RG7 3RS
Telephone: 0118 933 1111 Fax: 0118 933 2375
USED ELECTRONIC TEST EQUIPMENT
Check website www.stewart-of-reading.co.uk
Fluke/Philips PM3092 Oscilloscope
2+2 Channel 200MHz Delay TB,
Autoset etc – £250
LAMBDA GENESYS
LAMBDA GENESYS
IFR 2025
IFR 2948B
IFR 6843
R&S APN62
Agilent 8712ET
HP8903A/B
HP8757D
HP3325A
HP3561A
HP6032A
HP6622A
HP6624A
HP6632B
HP6644A
HP6654A
HP8341A
HP83630A
HP83624A
HP8484A
HP8560E
HP8563A
HP8566B
HP8662A
Marconi 2022E
Marconi 2024
Marconi 2030
Marconi 2023A
PSU GEN100-15 100V 15A Boxed As New
£400
PSU GEN50-30 50V 30A
£400
Signal Generator 9kHz – 2.51GHz Opt 04/11
£900
Communication Service Monitor Opts 03/25 Avionics
POA
Microwave Systems Analyser 10MHz – 20GHz
POA
Syn Function Generator 1Hz – 260kHz
£295
RF Network Analyser 300kHz – 1300MHz
POA
Audio Analyser
£750 – £950
Scaler Network Analyser
POA
Synthesised Function Generator
£195
Dynamic Signal Analyser
£650
PSU 0-60V 0-50A 1000W
£750
PSU 0-20V 4A Twice or 0-50V 2A Twice
£350
PSU 4 Outputs
£400
PSU 0-20V 0-5A
£195
PSU 0-60V 3.5A
£400
PSU 0-60V 0-9A
£500
Synthesised Sweep Generator 10MHz – 20GHz
£2,000
Synthesised Sweeper 10MHz – 26.5 GHz
POA
Synthesised Sweeper 2 – 20GHz
POA
Power Sensor 0.01-18GHz 3nW-10µW
£75
Spectrum Analyser Synthesised 30Hz – 2.9GHz
£1,750
Spectrum Analyser Synthesised 9kHz – 22GHz
£2,250
Spectrum Analsyer 100Hz – 22GHz
£1,200
RF Generator 10kHz – 1280MHz
£750
Synthesised AM/FM Signal Generator 10kHz – 1.01GHz
£325
Synthesised Signal Generator 9kHz – 2.4GHz
£800
Synthesised Signal Generator 10kHz – 1.35GHz
£750
Signal Generator 9kHz – 1.2GHz
£700
HP/Agilent HP 34401A Digital
Multimeter 6½ Digit £325 – £375
HP 54600B Oscilloscope
Analogue/Digital Dual Trace 100MHz
Only £75, with accessories £125
(ALL PRICES PLUS CARRIAGE & VAT)
Please check availability before ordering or calling in
HP33120A
HP53131A
HP53131A
Audio Precision
Datron 4708
Druck DPI 515
Datron 1081
ENI 325LA
Keithley 228
Time 9818
Practical Electronics | August | 2024
Marconi 2305
Marconi 2440
Marconi 2945/A/B
Marconi 2955
Marconi 2955A
Marconi 2955B
Marconi 6200
Marconi 6200A
Marconi 6200B
Marconi 6960B
Tektronix TDS3052B
Tektronix TDS3032
Tektronix TDS3012
Tektronix 2430A
Tektronix 2465B
Farnell AP60/50
Farnell XA35/2T
Farnell AP100-90
Farnell LF1
Racal 1991
Racal 2101
Racal 9300
Racal 9300B
Solartron 7150/PLUS
Solatron 1253
Solartron SI 1255
Tasakago TM035-2
Thurlby PL320QMD
Thurlby TG210
Modulation Meter
£250
Counter 20GHz
£295
Communications Test Set Various Options
POA
Radio Communications Test Set
£595
Radio Communications Test Set
£725
Radio Communications Test Set
£800
Microwave Test Set
£1,500
Microwave Test Set 10MHz – 20GHz
£1,950
Microwave Test Set
£2,300
Power Meter with 6910 sensor
£295
Oscilloscope 500MHz 2.5GS/s
£1,250
Oscilloscope 300MHz 2.5GS/s
£995
Oscilloscope 2 Channel 100MHz 1.25GS/s
£450
Oscilloscope Dual Trace 150MHz 100MS/s
£350
Oscilloscope 4 Channel 400MHz
£600
PSU 0-60V 0-50A 1kW Switch Mode
£300
PSU 0-35V 0-2A Twice Digital
£75
Power Supply 100V 90A
£900
Sine/Sq Oscillator 10Hz – 1MHz
£45
Counter/Timer 160MHz 9 Digit
£150
Counter 20GHz LED
£295
True RMS Millivoltmeter 5Hz – 20MHz etc
£45
As 9300
£75
6½ Digit DMM True RMS IEEE
£65/£75
Gain Phase Analyser 1mHz – 20kHz
£600
HF Frequency Response Analyser
POA
PSU 0-35V 0-2A 2 Meters
£30
PSU 0-30V 0-2A Twice
£160 – £200
Function Generator 0.002-2MHz TTL etc Kenwood Badged
£65
Function Generator 100 microHz – 15MHz
Universal Counter 3GHz Boxed unused
Universal Counter 225MHz
SYS2712 Audio Analyser – in original box
Autocal Multifunction Standard
Pressure Calibrator/Controller
Autocal Standards Multimeter
RF Power Amplifier 250kHz – 150MHz 25W 50dB
Voltage/Current Source
DC Current & Voltage Calibrator
£350
£600
£350
POA
POA
£400
POA
POA
POA
POA
Marconi 2955B Radio
Communications Test Set – £800
59
|