Jun24 Int
Jun24 Int
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Teach-In 2024 Audio Out
Topics in digital signal Using LED displays with the ESP32 Mechanical
processing – ADCs SoC microcontroller switches in audio
WIN!
Microchip
Curiosity HPC
Development
Board Loudspeaker
WIN! Test Jig
Heart Rate
Sensor Module
Teach-In 2024
Learn to use
the ESP32
PLUS!
Techno Talk – Program that! Jun 2024 £5.99
06
Cool Beans – Arduino: 7-segment display delights
Net Work – GaN USB chargers, solid-state EV battery 9 772632 573030
Key Features
• Up to two I3C interface (12.5 MHz, 1.0–3.6V operation)
• I2C, SPI and UART communication interfaces
• Up to two multiple voltage domains
Electronics Contents
Projects and Circuits
Wi-Fi Time Source for GPS Clocks by Tim Blythman 15
The Raspberry Pi Pico W can be used as a substitute for GPS modules in existing time
keeping designs, for when you can’t get a reliable GPS signal. It gets the time from an
internet NTP server via Wi-Fi and is accurate to a fraction of a second.
Heart Rate Sensor Module by Jim Rowe 24
This small RF amplifier has two outputs with individually selectable gains. This makes
it suitable to add to a signal generator to provide a higher output level, or for better
drive strength, or ‘fanning it out’ to multiple other pieces of equipment and more.
Loudspeaker Test Jig by Phil Prosser 28
Use your PC’s sound card to measure loudspeaker performance, inductors, capacitors
and complex impedances. With this Jig and appropriate software, measuring and
tweaking crossovers, cabinets and speakers is easy.
Setting up and using Room EQ Wizard by Phil Prosser 40
This accompanying article for the Speaker Test Jig explains how to set up and use the
freely-available Room EQ Wizard (REW) or Speaker Workshop software to help you
design and tweak loudspeakers.
The Wireless for the Warrior books are a the introduction of VHF FM and
source of reference for the history and hermetically sealed equipment.
development of radio communication
equipment used by the British Army Volume 3 covers army receivers from
from the very early days of wireless up 1932 to the late 1960s. The book not
to the 1960s. only describes receivers specifically
designed for the British Army, but also
The books are very detailed and include the Royal Navy and RAF. Also covered:
circuit diagrams, technical specifications special receivers, direction finding
and alignment data, technical receivers, Canadian and Australian
development history, complete station Army receivers, commercial receivers
lists and vehicle fitting instructions. adopted by the Army, and Army Welfare
broadcast receivers.
Volume 1 and Volume 2 cover
transmitters and transceivers used Volume 4 covers clandestine, agent or ‘spy’
between 1932-1948. An era that starts radio equipment, sets which were used by
with positive steps taken to formulate special forces, partisans, resistance, ‘stay
and develop a new series of wireless sets behind’ organisations, Australian Coast
that offered great improvements over Watchers and the diplomatic service. Plus,
obsolete World War I pattern equipment. selected associated power sources, RDF and
The other end of this timeframe saw intercept receivers, bugs and radar beacons.
01202 087631
Circuit Surgery MitchElectronics Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out
Demodulation in the Our new series on electronics Designing LTspice 17.1 and Frequency A new series on learning electronics Designing LTspice 24 update and Digital input and output with Designing Topics in digital signal Analogue input and output with Designing Topics in digital signal Using LED displays with the ESP32 Mechanical
superheterodyne receiver basics for beginners: op amps discrete buffers Response Analysis with the ESP32 SoC microcontroller discrete buffers Frequency Response Analysis the ESP32 SoC microcontroller discrete buffers processing – sampling the ESP32 SoC microcontroller discrete buffers processing – ADCs SoC microcontroller switches in audio
Digital
WIN! Tame the Volume Control WIN!
Microchip
Microchip
current surge! Potentiometer Curiosity HPC
PIC-IoT WG
Development
Development
Board Loudspeaker
Board Active Mains WIN! Test Jig
WIN!
Soft Starter WIN!
Microchip
PIC32MK MCJ
Curiosity Pro
Development
‘Swiss Army Knife’ Dual RF Amplifier
Advanc Building the Active Board GPS-Disciplined Heart Rate
ed SM Basic RF Automated Test Bench Oscillator
D Test Mains Soft Starter Sensor Module
Tweeze Signal
rs Mastering
Generator WIN!
the UVM-30A
Teach-In 2024 Microchip
Explorer 8 Wi-Fi Time Source
Learn to use the ESP32
Development UV Sensor for GPS Clocks
Superb Active Kit
WIN!
Subwoofer MitchElectronics
New learning series! Teach-In 2024 Teach-In 2024 Teach-In 2024
Op amps Advanced SMD Learn to use Silicon Chirp Learn to use Learn to use
and sensors Test Tweeze the ESP32 Build your own the ESP32 Songbird: an ideal the ESP32
rs
pet cricket beginner’s project
PLUS! PLUS! PLUS! PLUS! PLUS!
Feb 2024 £5.99 Mar 2024 £5.99 Techno Talk – Wait! What? Really? Apr 2024 £5.99 May 2024 £5.99 Jun 2024 £5.99
Techno Talk – Cheeky chiplets 02
Techno Talk – The Wibbly-Wobbly World of Quantum 03 04 Techno Talk – One step closer to a dystopian abyss? 05
Techno Talk – Program that! 06
Cool Beans – Arduino: ultrasound adventures Cool Beans – Arduino: expanding breadboard designs Cool Beans – Arduino: expanding the 7-segment display Cool Beans – Arduino: 7-segment display delights Cool Beans – Arduino: 7-segment display delights
Net Work – Cheap and cheerful workshop tools 9 772632 573030
Net Work – Cookies, privacy and online advertising 9 772632 573030 Net Work – Label printers, smart home devices and SMRs 9 772632 573030
Net Work – Electric cars, Moon-shot missions and more 9 772632 573030
Net Work – GaN USB chargers, solid-state EV battery 9 772632 573030
[Link] @practicalelec practicalelectronics [Link] @practicalelec practicalelectronics [Link] @practicalelec practicalelectronics [Link] @practicalelec practicalelectronics [Link] @practicalelec practicalelectronics
Take out a one-year subscription and save more than £10 over the year.
Even better – save over £1 per issue if you subscribe for two years – a total saving of £26.
Electronics
Rest of the World £46.99 (Airmail)
1 Year: UK £59.99, Europe £69.99 (Airmail),
Rest of the World £84.99 (Airmail)
Subscriptions start with the next available issue. We accept Card Ex. Date ......................................
MasterCard or Visa.
Name ............................................................................................
(For past issues see the Back Issues page.)
Address ........................................................................................
9 771030 266001
$1150* NZ $1290
05
INC GST
INC GST
Australia’s
International Airsho
All the newest tech
in Avalon Airpor
w
t
• Combined subscriptions include both the printed magazine and online access.
Wideband
• Prices are in Australian dollars (AUD) unless otherwise specified. Fuel Mixture Display;
• Prices listed are for everywhere in the world except Australia and New Zealand. April to June 2023
View [Link]/Shop/SubRates for a full list of current prices.
• Price estimates are just that and should only be used as a guide, we primarily
take payment in the form of Australian dollars.
Silicon Chirp;
April 2023
Try our Online Subscription – now with PDF downloads!
An online issue is perfect for those who don’t want too much Advanced SMD
clutter around the house and is the same price worldwide. Test Tweezers;
Issues can be viewed online, or downloaded as a PDF. February & March 2023
Electronics Editorial
Editorial offices
Practical Electronics Tel 01273 777619 Test your speakers!
Electron Publishing Limited Mob 07973 518682 Of all the elements in a Hi-Fi set up, the loudspeaker is the most
1 Buckingham Road Fax 01202 843233
Brighton Email pe@[Link] difficult to test. Amplifiers, preamplifiers and power amplifiers
East Sussex BN1 3RA Web [Link] may contain dozens, perhaps even hundreds of components,
Advertisement offices
but they have a signal output that is straightforward to check
Practical Electronics Adverts Tel 01273 777619 electronically. The big problem with speakers is that their
1 Buckingham Road Mob 07973 518682 output is essentially mechanical – sound – which is not easy to
Brighton Email pe@[Link]
East Sussex BN1 3RA analyse. Yes, the ultimate arbiters of speakers are your ears, but
that is – by definition – a somewhat subjective approach, and
Editor Matt Pulzer
General Manager Louisa Pulzer
you certainly can’t ‘see’ what is going on in terms of frequencies,
Digital subscriptions Stewart Kearn Tel 01202 880299 phase and levels. Add to this the fact that loudspeakers are far
Online Editor Alan Winstanley
Web Systems Kris Thain
and away the least ideal link in the audio chain, with distortion
Publisher Matt Pulzer and non-linearity levels that would make an amplifier designer
faint, and you have a real test and measurement problem. But
Print subscriptions
Practical Electronics Subscriptions
it doesn’t stop there. Imagine if it mattered where you placed
PO Box 6337 an amplifier or CD player; that the sound changed dramatically
Bournemouth BH1 9EH Tel 01202 087631 if your amp was set up next to or away from the wall. Sounds
United Kingdom Email pesubs@[Link]
a little daft, but that is exactly what happens with speakers – it
Technical enquiries really does matter where they are positioned.
We regret technical enquiries cannot be answered over the
telephone. We are unable to offer any advice on the use, purchase,
repair or modification of commercial equipment or the incorporation All of this is a rather longwinded way of saying that testing
or modification of designs published in the magazine. We cannot speakers is challenging; so difficult that many of us don’t bother.
provide data or answer queries on articles or projects that are
more than five years old. Now though, there is a really nice solution. This month, we have
an excellent project that combines analogue electronics, your PC’s
Questions about articles or projects should be sent to the editor
by email: pe@[Link]
sound card and some free software to give you all the data you
need to really understand your loudspeakers. The Loudspeaker
Projects and circuits Test Jig is an audiophile’s dream come true – recommended!
All reasonable precautions are taken to ensure that the advice and
data given to readers is reliable. We cannot, however, guarantee
it and we cannot accept legal responsibility for it. The battle for semiconductor supremacy
A number of projects and circuits published in Practical Electronics
I’m a little late to this next item, a very readable 2022 book
employ voltages that can be lethal. You should not build, test, called Chip War, by Chris Miller. It sat on my to-read pile for
modify or renovate any item of mains-powered equipment unless over a year, but having finally got around to it I enjoyed it so
you fully understand the safety aspects involved and you use an
RCD (GFCI) adaptor. much that I thought I’d pass on the recommendation. Chip
War is a fascinating account of the rise (and in some cases
Component supplies fall) of semiconductor giants; from the original start-ups in the
We do not supply electronic components or kits for building the
projects featured, these can be supplied by advertisers. We US (Silicon Valley) to the current domination by Taiwanese
advise readers to check that all parts are still available before company TSMC and Dutch lithography leader ASML. It’s a
commencing any project in a back-dated issue.
truly fascinating story that is far from over, and I’m sure you
Advertisements will enjoy it. It reminded me a little of the wonderful three-part
Although the proprietors and staff of Practical Electronics take documentary, Triumph of the Nerds, which did a superb job of
reasonable precautions to protect the interests of readers by
ensuring as far as practicable that advertisements are bona fide, explaining the history of the PC. You can find it on the Internet
the magazine and its publishers cannot give any undertakings and I’m sure you will enjoy that too.
in respect of statements or claims made by advertisers, whether
these advertisements are printed as part of the magazine, or in
inserts. The Publishers regret that under no circumstances will Matt Pulzer
the magazine accept liability for non-receipt of goods ordered, or
for late delivery, or for faults in manufacture.
Publisher
Transmitters/bugs/telephone equipment
We advise readers that certain items of radio transmitting and
telephone equipment which may be advertised in our pages
cannot be legally used in the UK. Readers should check the law
before buying any transmitting or telephone equipment, as a fine,
confiscation of equipment and/or imprisonment can result from
illegal use or ownership. The laws vary from country to country;
readers should check local laws.
With the introduction of the latest programmable devices, I think we’ve finally reached my WTW
(‘what the what’) moment. I’m going back to playing with 8-bit microprocessors. It’s time for
younger engineers to take the strain. Good luck!
O
ver the course of my career, the late 1970s saw the introduction of The first FPGAs
I’ve met many engineers who programable array logic (PAL) devices in The company Xilinx was founded in
have experienced problems which the AND array was programmable 1984. A year later it introduced the first
adapting to new technologies. For exam- while the OR array was fixed. field-programmable gate array (FPGA).
ple, people who were experts designing PLDs enjoyed a variety of program- I think of the programmable fabric in
circuits using valves (vacuum tubes) but ming technologies. For ‘antifuse’, desired FPGAs as little ‘islands’ of configurable
who simply couldn’t wrap their brains connections could be selectively added logic in a ‘sea’ of configurable intercon-
around circuits based on transistors. (‘grown’). By comparison, for ‘fusible nect. The first of these devices was the
I can understand this because I have links’, unwanted connections could be XC2064, which contained an 8x8 = 64
the same problem the other way round removed (‘blown’). In both cases, this was array of configurable logic blocks, each
– that is, I have no problem deciphering achieved by applying higher-than-usual boasting two 3-input lookup tables (LUTs).
or designing a transistor-based circuit, voltages and currents to the device’s pins. The configuration was implemented us-
but a tube-based schematic conveys as When designing printed circuit boards ing SRAM cells, which required loading
much information to my brain as would (PCBs), we used PLDs for all sorts of from an external source when the board
a wall of ancient Egyptian hieroglyphics. things, including implementing look- was powered up. Once again, this pre-
What I found harder to comprehend up tables, creating simple finite state dated any FPGA-specific programming
was older engineers who had blackbelts machines (FSMs), and gathering a lot of tools, so the configuration had to be cap-
when it came to designing digital logic ‘glue logic’ functions into a single device. tured as a text file by hand.
with transistors, but who found the con- We also included them in the design to ‘Well, these devices will never catch
cept of digital integrated circuits (ICs) provide a way to fix unforeseen board- on,’ I remember thinking to myself, there-
– even jellybean logic like 7400-series level problems – it was a lot easier to by proving I’m no clairvoyant (although
TTL and 4000-series CMOS – to be be- swap out a socketed PLD than it was I’m sure I could play one on TV).
yond their comprehension. to cut tracks and add components and
I wonder if anything like this will one patch wires to the main board. And then it was now
day happen to me. Will a new technol- As well as a bunch of smaller players,
ogy arise in my lifetime that causes me The ‘Dark Ages’ of design tools there are two FPGA behemoths in the
to say WTW (‘what the what’)? It’s hard for young engineers to under- industry – Altera (founded in 1983, pur-
Now that think about it, I have seen stand how little we used to have in the chased by Intel in 2015, and spun off as
the origination and evolution of one such way of design tools. For PLDs, we cap- a wholly-owned Intel subsidiary in early
technology – that of programmable logic. tured the desired functionality using 2024) and Xilinx (which was acquired
I remember the early days with nostalgia pencil and paper, either as truth tables by AMD in 2022). Over the past 40 years,
(which isn’t what it used to be). or schematics for logical functions, state this duo has evolved FPGAs and their
diagrams for state machines, or tabular design tools beyond all expectation and
The first PLDs representations for look-up tables. – in my case – comprehension. For ex-
When ICs like the 7400-series first ap- Next, we hand-created a text program- ample, AMD recently announced their
peared on the market in the mid-1960s, ming file, which required knowledge of Versal AI Edge Series Gen 2 SoC FPGAs
they took the world of digital design by the device manufacturer’s proprietary file for artificial intelligence (AI)-driven em-
storm. The only downside was that any format and an intimate understanding of bedded systems at ‘the edge’ (ie, where
functions they contained were ‘frozen in the device’s internal architecture. Then the internet meets the real world).
silicon,’ as it were. What was required we used this text file in conjunction with In addition to millions of look-up tables,
was a device that could be purchased a manufacturer-specific programming de- the programmable fabric includes thou-
off-the-shelf and then configured (pro- vice to configure the device as required. sands of digital signal processing (DSP)
grammed) by digital design engineers to It wasn’t until the early 1980s that functions and megabits of Block RAM
implement custom functions as required. industry standard file formats and pro- functions. Also, in addition to a bunch
Early programmable ICs first appeared gramming tools started to appear on of artificial intelligence (AI) engines,
in the early 1970s. These were generically the scene. I’m thinking of things like there are eight 64-bit Arm Cortex-A78AE
referred to as programmable logic devices the file format proposed by the Joint Application Processors and ten 32-bit
(PLDs). The first PLDs were programma- Electron Tube Engineering Council Arm Cortex-R52 real-time processors,
ble read-only memories (PROMs), which (JETEC), as was, along with names plus external memory and communi-
can be visualised as a fixed array of AND like PAL Assembler (PALASM), cations interfaces, all implemented on
functions driving a programmable array Advanced Boolean Expression Language a single monolithic silicon chip.
of OR functions. These were followed (ABEL), Common Universal Tool for I think we’ve reached my WTW mo-
in 1975 by programmable logic arrays Programmable Logic (CUPL), and – my ment. I’m going back to playing with 8-bit
(PLAs), in which both the AND and OR favorite – Automated Map and Zap of microprocessors. It’s time for younger
arrays could be programmed. In turn, Equations (AMAZE). engineers to take the strain. Good luck!
Worth
Its layout and external connections offer evaluate and support the Microchip PIC18 Q84
unparalleled access to the Core Independent Family, the first PIC18 microcontroller family
Peripherals (CIPs) available on many newer
8-bit PIC MCUs. These CIPs enable the user $61.99 that can be used to transmit and receive
data through a CAN FD bus. Accompanied
to integrate various system functions onto a (approx £48.99) by an extensive array of CIPs that handle
single MCU, simplifying the design and keeping
system power consumption and BOM cost low. each a variety of tasks without requiring CPU
intervention, Microchip’s PIC18 Q84 family
cuts both time and cost when connecting
This board provides flexibility for experimentation systems to a CAN FD network.
through an application header with ground (GND)
and supply voltage (VDD) connections. It also includes a It also includes the following features:
set of indication LEDs, pushbutton switches, and a variable • Accommodates 40- and 28-pin 8-bit microcontrollers.
potentiometer. Additionally, it features two mikroBUS headers to • Fully compatible with the MPLAB Code Configurator and
accommodate a variety of plug-in Click Boards that can be used MPLAB X v3.05 or later
Free-to-enter competition
Microchip Microchip
Win a Microchip DM164136
Curiosity HPC
Development
Board
I
t’s now almost 30 years since the up, though the older USB Micro jack still
universal serial bus first appeared puts in an appearance. At one time, a
in home desktop computers. The USB mains adaptor was bundled with
computer industry’s launch of USB in mobile phones and tablets and inevitably
1996 brought with it the prospect of we finished up with spare ones knocking
Windows ‘plug and play’ that would around, prime candidates for the e-waste
dispense with bothersome and bulky recycling bin. Now, mains adaptors
serial and parallel ports, supposedly are gradually being omitted as makers
making it easy for home computer users assume we already own one. Apple had
to install peripherals without needing previously gone its own way, as would
expert computer knowledge. That was be expected, introducing the ‘Lightning’
the theory, anyway. connector for the iPhone but, to reduce
Early USB technology also heralded a electronic waste, the EU has ordered
new simplicity in connecting devices to Apple to change to the now universally This rechargeable LED camping lantern
isn’t short of features, including an A-type
a PC. Computer users welcomed slender adopted USB-C port by the end of 2024.
powerbank outlet. It has a built-in A-type
new USB 1.1 leads and they liked the idea USB lead for recharging.
that USB devices were hot-swappable, You can bank on it
with no need to power down and re-boot Apart from using mains adaptors for the side offering high-power bidirectional
a PC. As product design evolved, USB charging, a glut of powerbanks is now charging, but you’d never know without
leads also provided a 5V power source widely available; rechargeable batteries checking the user manual.
for smaller peripherals, eliminating the that are very handy for on-the-go charging Some present-day users express
need for separate mains adaptors. or for powering devices in inaccessible disbelief that A-type ports still even
The ubiquitous ‘flat-style’ USB A-type locations. Some gadgets now double as exist, because they use end-to-end USB-C
plug would eventually appear in all powerbanks themselves, offering a USB types on their devices and chargers.
manner of consumer electronics, not A-type or C-type port (or both) to charge It’s possible that legacy A-type ports
just personal computers. Inevitably, a cellphone or other gizmo. I have an LED will gradually be replaced with USB-C
higher speeds and miniaturisation saw lantern and even USB hand warmers that connectors, especially as higher power
smaller USB connector types introduced do this. With Chinese manufacturers awash products come to market, but for most
that we’ve all become familiar with. The with Li-ion batteries and LEDs, the camping people there’s plenty of life left in the
original boxy-shaped B-type plug was light shown above right is typical of what’s old A-type port.
soon superseded by the USB Mini, Micro on offer today – apart from containing an While we’re talking about USB, here’s
and finally the rounded-rectangle USB-C LED spotlight, a dimmable LED work light a reminder about USB data transmission
type connector that is in widespread use and a red flashing beacon, an A-type port rates themselves: legacy blue-colour
today. A typical USB A-type to USB-C provides a powerbank function, and an LED USB ports are USB 3.0 (5 Gbps) or
charger lead is shown below. battery level meter is thrown in for good 3.1 (sometimes marked SS or SS10 –
The traditional 5V USB A-type socket measure. Having to cycle the power buttons Superspeed 10 Gbps), while ports marked
still appears on many mains chargers, and repeatedly to reach the desired function SS20 or Superspeed 20 can operate up
they power everything from rechargeable is a nuisance, but it’s hard to know how to 20 Gbps. The colour of the plastic
lanterns to Bluetooth speakers, ear buds, much more tech they can cram into it for substrate found inside USB A-type ports
portable radios and handheld vacuum the money. A palm-sized dome light, also
cleaners. Currently, rechargeable devices shown, offers a spotlight, a warm and cool
mostly use a USB-C type port for charging white light, a flashing red beacon, LED
level meter, magnetic mounts and hooks,
and a USB 5200mAh powerbank.
Some USB chargers offer almost every
power port ever made, and it starts to get
a bit much when a powerbank bristles
with USB A-type, USB Micro, USB-C and
iPhone Lightning ports for good measure.
Things get more complicated still when
you learn that many USB-C ports can now
act both as power inputs (for charging up
powerbanks) and outputs (to power other
A typical high power USB charging lead devices) – the 20,000mAh power bank This palm-size camping light also has a
showing A-type and USB-C plugs. shown opposite has a mystery USB-C on USB A-type powerbank port.
This neat USB charging lead is rated at USB monitor on an A-Type powerbank port Shown in use charging a smartphone,
3.1A and has an LED indicator. showing ‘PD’ in action – 9V from a USB port. with power and PD displayed.
Power crazed
The UK has spent £13bn on a faltering
smart meter programme to monitor
electricity demand, with four million
of them still not working properly, if at
all. A smart meter fault-finding checker
is listed at: [Link]
Britain is also trying to swerve a
looming energy crunch by building more
gas-fired power stations, and proposals
made by energy company RWE to build a Seen in happier times, Killingholme ‘A’ power station was built during the 1990s ‘dash
new Combined Cycle Gas Turbine (CCGT) for [North Sea] gas’ but demolished just 25 years later. (Photo: author)
Terrington
Components
• Project boxes designed and manufactured in the UK.
• Many of our enclosures used on former Maplin projects.
• Unique designs and sizes, including square, long and deep
variaaons of our screwed lid enclosures.
• Sub-miniature sizes down to 23mm x 16mm, ideal for
IoT devices.
MADE IN BRITAIN
E
ver since GPS modules have over its 50-year existence), a common hand, Wi-Fi signals are usually avail-
been affordable for the hobbyist, external interface has been estab- able indoors.
we have used them as accurate lished. In fact, the VK2828U7G5LF The actual hardware of the 2019 unit
time sources. While GPS (and other GPS module that we use for many is simply a D1 Mini Wi-Fi ESP8266
similar satellite systems) has revo- projects can receive signals from GPS, microcontroller module. The module
lutionised navigation and mapping, GLONASS and Galileo satellites. is programmed with firmware to con-
it also provides easy global access to For the purposes of this article, nect to a Wi-Fi network and update an
highly accurate time sources. we’ll use GPS as an encompassing internal clock from the internet using
Each GPS satellite is equipped with term for all the different navigation NTP (network time protocol).
two atomic clocks, and they trans- satellite systems. However, note that This time is then used to gener-
mit a very accurate time signal every some of these systems are not truly ate ‘sentences’ to communicate that
second. We have used that signal for global, as the satellites do not usually time. A 1PPS signal is also generated,
many projects to date, including the provide coverage at high latitudes although this signal will not have the
recent, very popular GPS Analogue (close to the poles). precision of an actual GPS module.
Clock Driver from September 2023.
While GPS was the first GNSS Previous GPS Time Source Pico W update
(global navigation satellite system), In the April 2019 issue of PE, we This project is an update of the orig-
there are now several more, includ- published the Clayton’s GPS Time inal Clayton’s GPS but using a Rasp-
ing the Russian GLONASS, European Source. As the name hints, it doesn’t berry Pi Pico W instead of a D1 Mini.
Galileo and Chinese Beidou systems. actually use any GPS technology, but While we could have refactored the
The Indian Regional Navigation rather it can be used as a source of same code for the Pico W GPS, there
Satellite System (IRNSS) and Japa- GPS-like time signals when an actual are several reasons why we did not.
nese Quasi-Zenith Satellite System GPS signal is unavailable. It’s often We have had many suggestions for
(QZSS) are designed to improve posi- recommended as a replacement for a improvements over the last five years,
tioning on a national scale, with the GPS module in clock projects. so it made sense to incorporate them
QZSS also benefiting Australia as the The motivation for this concept was where possible.
satellites’ orbits bring them over us. driven by many clocks being used We’ve chosen to use the C SDK
While they use subtly differing indoors, where very weak GPS sig- as we found that it gave us better
technologies (even GPS has evolved nals are hard to receive. On the other access to low-level functions and
programs run more quickly. Some
of the new features were possible
What projects does it work with? (and much easier to implement) due
New GPS-Synchronised Analogue Clock Practical Electronics, September 2023 to aspects of the C SDK and its soft-
GPS-Synchronised Analogue Clock Practical Electronics, February 2018 ware libraries.
High-Visibility 6-Digit LED GPS Clock Practical Electronics, January 2017 – There is no doubt that the Pico
February 2017 W is very well priced, making it an
6-Digit GPS-Locked Clock Practical Electronics, May – June 2011 attractive option when the module is
all or most of the hardware required.
Fig.1: the pins on the Pico W that can be used for the Wi-Fi Time Source are shown in the dashed red box. Pin 1 (GP0) is
the closest UART TX pin to the USB end of its PCB and is also near the relevant power pins. You probably won’t need all
the connections shown here for most clock projects (see Figs.3-6); three or four connections are often sufficient.
Pin 1: serial NMEA data; pin 2: 1PPS signal; pin 3: ground; pin 36: 3.3V; pin 37: 3.3V enable (active high); pin 38:
ground; pin 39: 1.8V to 5.5V in; pin 40: USB supply.
Most people will simply need to versions before 1.4.0 did not sup- as the second rolls over, the data is
connect a supply between the VSYS port the Pico W and later versions sent, and the 1PPS signal is pulsed.
and GND pins. But note that there is might differ. This means that the NMEA data
a diode between VUSB and VSYS, so As we noted, the Pico W has two and 1PPS pulses are delivered with
if a USB cable is connected, it might processor cores. One of these (the sec- minimal jitter. Providing the output
feed into VSYS, particularly if VSYS ond core) is programmed to do noth- as the second rolls over means that
is less than the 5V from USB. ing more than generate the NMEA the fractional data can be ignored,
Unless you can be sure that you data and 1PPS pulses. This is cru- simplifying the code slightly, both
won’t connect anything to VSYS cial as we found that the D1 Mini (as for us and potentially for any device
while power is applied to VUSB used in the 2019 Time Source) would receiving that data.
(for example, via the USB socket), occasionally block (be busy and not The other core has the vital role of
the safest option will be to connect be able to run other parts of its pro- periodically getting an accurate value
the incoming supply to VSYS via a gram) during Wi-Fi operations. for the time and collecting the other
schottky diode, which will prevent By setting up one core to do the data that is needed. One of these is a
current from passing from VBUS into critical activity, the Wi-Fi Time Source ‘validity’ flag, equivalent to the GPS
your supply. can continue to operate, even in the ‘satellite lock’ that should always be
Given that most people will use the extreme event that one of its proces- checked to ensure that valid data is
USB port to program, configure and sor core crashes entirely. This core being received.
test the Pico W, the easiest solution can even reset the Time Source under The Pico W implements an inter-
is to disconnect the USB cable before some conditions. nal 64-bit counter with microsecond
connecting to the target circuit. In When a reset happens, some data is resolution. This counts up from zero
that case, direct connections to the stored in RAM to preserve the current when the processor starts or is reset.
Pico W pins will be fine. time across the reset. This is possible The documentation jokes that (in
Later on, we’ll also show you how as RAM remains powered during the the vein of the Y2K or Millennium
to connect the Wi-Fi Time Source to soft reset process. Bug) this will eventually cause a year
some of our recent clocks. We saw very occasional crashes 5851444 bug.
(and reset recovery) when the Time Such bugs typically occur when a
Software development Source had been active for long peri- counter rolls over beyond its maxi-
The Raspberry Pi C SDK is still evolv- ods, but this should not be an issue mum value. While we are not too con-
ing, especially the parts of it that deal for operation with the recent GPS cerned about this particular counter,
with the Wi-Fi features of the Pico W. clocks, as the Time Source should it always pays to to be aware of these
But it is well documented, and inter- only be powered long enough to set potential ‘gotchas’.
est is sufficient that the online com- the time, after which it is powered off. The main role of the software run-
munity is also very helpful. This second processor core looks at ning on the first core is to fetch an
So, we ran into some minor dif- the current time and calculates what accurate timestamp from the NTP
ficulties during development, but the time will be when the next sec- servers. This timestamp is com-
we managed to work around them. ond rolls over. It then prepares all its pared with the current value of the
We used version 1.5.0 of the SDK; data to suit this next second. As soon 64-bit counter, and an offset is used
to calculate the actual time (at any the Time Source is powering up cor- Programming the Pico W
time) by simply adding the current rectly. It can also flash once, twice It makes sense first to program the
value of the 64-bit counter. or three times per second. One flash Pico W and check that it is working
The RP2040 processor in the Pico means it is connected to a Wi-Fi net- as expected. Hold the BOOTSEL but-
W has an internal real-time clock work, while two flashes indicate that ton on the Pico W and plug it into
peripheral, but this only has a resolu- the time is considered to be correct. your computer. A USB drive named
tion of one second, so we can’t really Three flashes occur when both those ‘RPI-RP2’ should appear. Copy the
use this to keep time accurately. How- conditions are true. NEW_CLAYTONS_1.UF2 file to it;
ever, we set it and use it in places In general, the time is correct if an after a second or so, the LED should
where it is accurate enough, such as NTP update has been received in the come on.
reporting time in human-readable last few hours, although this limit can You can then use a serial monitor
form on the configuration interface. be adjusted. program to access the menu. We use
The first core also provides a vir- The crystal oscillator which is used TeraTerm on Windows, while mini-
tual USB serial port that is used to on the Pico W has a 30ppm (parts per com can be used on Linux systems.
print an interactive menu with the million) tolerance, meaning it could Open the Pico W’s virtual serial port
help of a serial terminal program. drift by up to one second every eight to access the interactive menu.
This can be seen in Screen 1; we’ll hours. However, in practice, we saw Ensure that your terminal program
look more closely at the options later. NTP adjustments up to 200ms, so uses CR or CR+LF as its line ending.
The menu allows up to eight we’re confident that the time will be Since it is a virtual serial port, the
SSIDs (Wi-Fi networks) to be set. accurate within half a second with baud rate is unimportant, and any
The software will automatically the default settings. baud rate setting should work.
cycle through these networks until it
successfully connects to one. It will Time is [Link] on 14/02/2023. NTP OK. Last updated 0 minutes ago.
attempt to reconnect if the connec-
tion is lost. WiFi Status: Connected with IP: [Link]
Since many applications of the Menu:
1 : Scan networks
Time Source depend on it only being 2 : Show saved
turned on briefly (to save draining 3n : Delete SSID (n from saved list)
battery power), the initial behaviour 4n : Set SSID (n from scan list)
is to perform a network scan to ensure 5 : Manual SSID
6n : Set Password (n from saved list)
that the first attempted connection is 7 : Test saved
to an available network. 8 : Save to flash
The virtual serial port also pro- 9 : Set Country Code (currently XX)
A : Set IPAPI URL ([Link]/line?fields=lat,lon)
duces status information, mainly B : Set Latitude (−27.467899 = 27°28’4”S)
concerning the Wi-Fi status and time C : Set Longitude (153.032501 = 153°1’57”E)
since the last NTP update. One of the D : Set baudrate (9600 baud)
menu options allows the NMEA data E : Set Talker (currently GP)
F : Set NTP validity timeout (200 min)
to be dumped to the virtual serial port G : Set NTP server ([Link] [[Link]])
for easy debugging. H : Set default year (2022)
The first core is also responsible I : Turn debug on (currently off)
for controlling the Pico W’s inbuilt J : Reboot Clayton’s Pico W GPS Time Source
LED, which is set up to flash useful
Screen 1: many options are available to configure the Wi-Fi Time Source. At a
status indications. minimum, you will probably need to use commands 1, 4, 7, 8 and 9 to set the
The LED is switched on solid when country code and connect to your Wi-Fi networks to operate it with our GPS
power is applied, indicating that clocks. Other commands could come in handy depending on your application.
Fig.3: connecting to the New GPS-Synchronised Analogue Clock using the 3V3_EN pin on the Pico W makes the most
efficient use of the Pico W’s onboard boost regulator, bypassing the Clock’s own boost regulator (the Pico W is shown
larger than life size in Figs.3-6 for clarity). In this case, you could omit IC3, L1 and the two 10μF capacitors.
Fig.4: how to connect the Time Source to the GPS-synchronised Analogue Clock Driver from 2018. This also bypasses the
Clock’s onboard regulator to power the Pico W. Note that we have not tested this configuration.
often faster and occasionally longer if would come on and start flashing at most (and the clock should
it does not connect to the Wi-Fi net- the same rate as the Clock LED. After start ticking), so if it continues flash-
work immediately. This should be a few more seconds, the LED on the ing for longer than that, you should
the same with most Clocks that use Time Source would turn off, show- investigate.
the Time Source. ing that the Clock has obtained the In general, we found that if the
After powering on the Clock with correct time and powered down the data displayed on the USB serial
the Time Source connected, the Clock Time Source. terminal appeared correct, the Time
would flash its LED once or twice, Generally, the Clock LED should Source would work correctly when
after which the Time Source’s LED also turn off after half an hour at connected to the Clock.
Fig.5: connections to a 2017 Nixie Clock (not a PE project). LK1 (which chooses between a 3.3V and 5V supply for the
connected module) should be set to the 5V position. Still, this design is not powered by a battery, so efficiency is less critical.
Fig.6: the High Visibility 6-Digit LED GPS Clock uses the same header pinout as the Nixie Clock, so the wiring is much the
same, as is the choice to set LK1 to the 5V position.
EE
LATES HE
T COP
TEACH-IN 9
FROM THE PUBLISHERS OF
Y
OF
TEACH OUR
-IN SE
Electron Publishing GET TESTING!
Electronic test equipment and measuring
FREE
CD-ROM
TWO TEACH
-INs
RIES
techniques, plus eight projects to build FOR THE PRICE
OF ONE
AVAILA
• Multimeters and a multimeter checker
• Oscilloscopes plus a scope calibrator
BL PRICE £8.99
• AC Millivoltmeters with a range extender
NOW! E
• Digital measurements plus a logic probe
• Frequency measurements and a signal generator
• Component measurements plus a semiconductor
junction tester
PLUS...
YOUR GUIDE TO THE BBC MICROBIT
A LOW-COST ARM-BASED SINGLE-BOARD
COMPUTER
Teach-In 9
Get Testing
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 © 2018 Wimborne Publishing Ltd.
[Link]
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
Teach In 9 [Link] 1 01/08/2018 19:56
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).
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 Debug-
ger User’s Guide; MPLAB PICkit 4 In-Circuit Debugger Quick Start Guide; and MPLAB PICkit4 Debugger User’s Guide.
Heart Rate
Sensor Module
This kit features an Analog Devices AD8232 heart rate monitor
front-end IC which forms the ‘heart’ of this module. It provides a
low-cost way to monitor the operation of the heart via an Arduino
MCU or similar. It comes complete with a matching three-electrode
lead; a pack of additional electrode pads is also available.
E
lectrocardiograms (ECG) – even breathing. All of these things can with a colour-coded three-electrode
are medical tools for measuring have a demonstrable effect on the heart’s cable and a set of matching adhesive
and recording the tiny voltages ECG waveform. Being able to show this sensor electrode pads. Search for
produced on the skin due to heart mus- easily, safely and at a low cost is a bonus. ‘AD8232 Heart Monitor’ – amazon.
cle activity. By attaching two, three or To adapt an Arduino Uno module [Link] currently has this for under £10.
more electrodes or ‘leads’ to the skin for sampling the low-level signals Additional adhesive electrode pads
of your wrists, ankle or chest, a profes- picked up by ECG electrodes, in 2016, are sold separately.
sional ECG costing upwards of several I designed a small ‘front-end shield’
thousand pounds can record ECG wave- that plugged into the Arduino. It pro- Inside the AD8232
forms to allow a GP or cardiac specialist vided a high-gain (1000/2000 times) Analog Devices describe the AD8232
to check your heart’s health. differential amplifier plus a three-pole as a ‘Heart Rate Monitor Front End’,
In the October 2016 issue of Practi- low pass filter to reduce the sampler’s or an ‘integrated signal conditioning
cal Electronics, we described an Ardu- susceptibility to 50Hz hum. block for ECG and other biopotential
ino-based USB Electrocardiogram proj- The heart rate sensor module we’re measurement applications’.
ect which allowed you to do all of this discussing in this article is basically a A simplified version of the circuitry
using a Windows-based laptop PC. The much-improved version of the front- inside the AD8232 is shown in Fig.1. As
project was not intended for use in med- end shield in our project, compressed you can see, it includes an instrumen-
ical diagnosis, but simply for use in into a single 4mm-square 20-lead SMD tation amplifier (InstA) to process the
exploring the way your body works. It chip: the Analog Devices AD8232. incoming low-level ECG signals, plus
can be fun, as well as educational. This is a very impressive device, as three further op amps: A1, A2 and A3.
You can monitor changes to your you’ll soon see. A1 provides low-pass and high-pass
heart under various conditions, as it The AD8232 comes on a module filtering plus additional gain. A3 is used
is affected by many things, including from multiple online sources, which to buffer the half-supply reference volt-
emotions, mental and physical activity combines the AD8232-based module age, ensuring that the main amplifier
InstA can handle the full signal swing.
A2 is used to drive the right-leg elec-
trode lead (RLD) with an inverted ver-
sion of any common-mode signal pres-
ent in the inputs to the instrumentation
amplifier, InstA. This improves the com-
mon-mode rejection of the system, giv-
ing a significantly cleaner reproduction
of the ECG signal.
There are also two comparators, C1
and C2, used to provide ‘lead-off’ sig-
nals if either of the main electrodes is
not in good contact with the skin of the
wrists or arms.
The result of this complexity inside
the AD8232 chip is that when its
inputs are connected to electrodes
attached to the skin of a human body,
The Heart Rate Monitor ‘kit’ comes with
everything shown. While it’s called a kit, and it’s provided with suitable support
the module is already assembled. circuitry, it gives a clean analogue ECG
output signal.
Fig.1: a simplified block diagram of the AD8232 IC. It’s Fig.3: the typical electrode placements on the human
described as a single-lead ECG front-end and implements body. Note the orientation of the person is such that their
various low- and high-pass filters using internal op amps. face is looking out of the page.
The module circuit power, respectively; pin 3 is the ECG IC1 also connects to LED1 via a 1kΩ
Fig.2 shows the full circuit of the signal output, while pins 4 and 5 pro- series resistor. This allows the LED to
AD8232-based module. There’s very vide the ‘lead-off’ error signals. be used to monitor the heartbeat visu-
little in it apart from the AD8232 chip Pin 6 of CON3 is a logic input that ally. But if this is not required, the LED
and a handful of passive components. allows the AD8232 to be placed in shut- can be disabled simply by cutting the
It all fits on a small PCB measuring 30 down (standby) mode to save power PCB track between the two pads of LK1.
× 35mm, including the mini 3.5mm when ECG readings are not needed. It LED1 is on the module PCB at upper
TRS jack socket used to connect the is normally pulled high by a 10kΩ resis- left, in the centre of the printed ‘heart’
three-electrode lead. tor, so all that is required to place it in symbol. LK1 is visible just to the left of
Connectors CON1 and CON2 provide standby mode is to pull it low. the ‘heart’, above the connections for
alternative connections for the input The rated current drain of the AD8232 CON3. The latter is fitted underneath
electrodes: CON2 is the 3.5mm input chip is less than 250μA in operating the PCB, ready to connect to a bread-
jack and CON1 is just a set of three holes mode, dropping to less than 500nA board or another PCB.
in the PCB to receive a 3-pin SIL header. (0.5μA) in shutdown/standby mode.
CON3 is a 6-pin SIL header that provides So the module is suitable for battery- Electrode placement
all the power and output connections. powered portable use. Fig.3 shows two of the suggested place-
As the labels suggest, pins 1 and 2 of As well as being taken to pin 3 of ments of the three electrodes with this
CON3 are used for ground and +3.3V CON3, the ECG output from pin 10 of kind of ECG sensor.
Fig.2: the full circuit of the heart rate monitor module. Apart from IC1 and LED1 the circuit consists of a small number of
passive components. The module also features alternative input connectors (CON1 and CON2) for the electrodes.
Trying it out
I connected the Jaycar XC3784 mod-
ule up to an Arduino Uno, as shown
in Fig.4, then connected the Uno to a
PC via a USB cable. After that, I started
the Arduino IDE (v1.8.19), opened
the AD8232_heart_monitor_basic.ino
sketch, verified and compiled it.
Next, I connected the plug on the
end of the electrode cable into the
3.5mm jack on the module and fitted
the red electrode to my right wrist, the
green electrode to my left wrist, and
the yellow electrode to my right leg
just behind the knee.
The next step was to upload the
compiled sketch to the Arduino, after
which it began running, with the little
‘heartbeat’ LED on the module blink-
ing away cheerfully. When I opened
the IDE’s Serial Monitor tool, I was
Fig.6: a heart rate plot taken using the sample software and the Arduino IDE’s greeted by a scrolling list of numeric
built-in Serial Plotter. samples of my ECG waveform.
LOUDSPEAKER
TEST JIG
Use your PC’s sound card
to measure loudspeaker
performance, inductors, capacitors
and complex impedances. With
this Jig and appropriate software, measuring and
tweaking crossovers, cabinets and speakers is easy.
W
hen designing or building through an inflection at this frequency, ‘Room EQ Wizard’ (REW, Windows/
loudspeakers, you need a from about +55° degrees to -55°. Mac) or the old but good ‘Speaker
good microphone and test It is possible to make this sort of plot Workshop’ (Windows only). Both
setup and the ability to measure the using an oscilloscope and graph paper, are available for free.
impedance of the loudspeaker driver but your PC and sound card can make ● A measurement microphone
and crossover parts. You can do this this sort of measurement in seconds with ● The Loudspeaker Test Jig, which
at home with our Loudspeaker Test Jig, our Test Jig. Eric Wallin is credited with includes:
without breaking the bank. originating the basic concept of the ‘Wal- – An audio power amplifier of a
It is an interface to your PC, allow- lin Jig’, shown in Fig.2. It is the de facto few watts
ing you to measure complex imped- standard for PC-based speaker testing. – A microphone preamplifier
ances, which is important when build- It uses the left output channel of the – A reference resistor of a few watts
ing crossovers. This is one job where sound card output to drive a signal capacity that is ‘calibrated’
even the best multimeter doesn’t help, through a reference resistor and the – A switching arrangement
as impedance is frequency dependent, device under test (DUT). The left input
with real and imaginary components. channel measures the voltage across It is also very useful to have:
The Test Jig also connects to a micro- both the reference and DUT, while the ● A monitor output for the audio input
phone for analysing loudspeakers. right input channel measures the volt- to the Test Jig, allowing both moni-
Fig.1 is the impedance and phase age across the DUT alone. toring and regular use of the sound
plot of a 12-inch (305mm) driver, a PA For a complete test setup, you need: card when not testing
bass-mid with a resonant frequency ● A PC or Mac with a sound card ● An oscilloscope to monitor the
of 60Hz. The dotted phase line goes ● Test software. We recommend microphone signal on the front panel
Fig.2: the basic arrangement for measuring impedance. Conventionally, the power amplifier and microphone
preamplifier are standalone devices, wired to the ‘Wallin Jig’. Our new design incorporates everything you need into
one, handy, compact unit.
Sadly, it hasn’t been upgraded allow these programs to work. We have build an excellent measurement mic
since about 2001. Even though it gives kept it as simple as practical. It would very cheaply indeed, which will be the
a warning message on startup, this be possible to add more switching for subject of an upcoming project.
remains a brilliant tool and is worth attenuators and reference resistors, but
checking out. The last version is V1.06 as we will show in the ‘how to use this’ Circuit description
and is available from the download article, they would be gilding the lily The full circuit is shown in Fig.3, and
page at: [Link] and make it harder to use than neces- it has five main sections: the power
These programs perform measure- sary. You could easily add more switch- amplifier, microphone preamplifier,
ments in slightly different ways but ing externally if you wish. input buffer, switching and power sup-
ultimately deliver similar results. REW ply, shown as shaded areas.
uses a swept sinewave to make mea- Microphone selection While some of these sections con-
surements, while Speaker Workshop As for the microphone, you need a nect to each other, besides the power
uses a noise pulse. Both programs per- measurement microphone. The Shure supply, they primarily operate as inde-
form Fourier transforms and compare SM58 has a shaped frequency response pendent blocks. The power amplifier
the reference to the measured signals to and is unsuitable for this job. At the is used to drive the loudspeaker being
calculate either the speaker frequency low end, you can buy a Behringer tested, while the microphone pream-
response or the impedance of the DUT. ECM8000 for about £30 or a Dayton plifier picks up the radiated sound
Our Loudspeaker Test Jig provides Audio EMM6 with calibration data for and converts it to a signal that can be
the amplification and switching to about £80. Alternatively, it is easy to analysed. The input buffer allows the
We run it from dual half-wave rec- rectifier BR1 are used since we don’t your speaker to the output binding
tified 15V AC to get positive and neg- have a centre-tapped transformer posts to perform listening tests as you
ative rails of about ±20V from the 15V (few plugpacks have a centre tap as it develop it. We have set the gain to about
AC plugpack. This is cheeky, but we requires a 3-pin connector). 10 (set by the ratios of the 9.1kW and
only need a couple of watts at most. This power amplifier will provide 1kW resistors), which is low but enough
Note that only half the diodes in bridge sufficient output to allow you to wire for our purposes.
The signal is AC-coupled to IC3’s binding posts. The 1W/220nF Zobel heatsink is available from Altronics, but
input via a pair of back-to-back 22µF network ensures stability. if you can’t find that, a folded piece of
electrolytic capacitors to remove any We mount the LM1875 on a heat- aluminium would work just fine.
DC bias. The output goes straight to sink to ensure that the IC has adequate Interestingly, the Altronics heatsink
CON4, which is wired to a pair of cooling if you do extended testing. This we bought had one hole in the middle,
Construction
Construction is fairly easy, although,
for designs like this, we like to load the
power supply section first and check
the voltage rails. Once that checks out,
you can power it down and fit all the
remaining parts with the confidence
that a power supply fault won’t fry
them at switch-on!
The Loudspeaker Test Jig is built on
a 99.5 × 189.5mm double-sided PCB
coded 04106231, available from the
PE PCB Service.
34
To build the power supply section,
fit all the resistors and diodes in that
you can ignore them as the parts are and rear panels. Once prepared, they All the holes have been kept circular
not polarised. fit perfectly, allowing you to secure the for easy construction, except the power
The two 47µF capacitors all the way board using 4G screws through the rear connector hole, which will require a
on the left side of the Mic Preamp sec- panel into the RCA sockets. little filing.
tion can operate with 48V DC phantom Our recommended case is very tidy, If you choose one of the larger ABS
power applied, so we must use at a min- but it is not the cheapest. If you want plastic cases, you could spread things
imum 50V-rated electrolytic devices a more cost-effective solution, any out a bit and run flying leads from the
and orient them with their longer pos- case over about 220mm wide, 130mm power, input and output connectors to
itive lead to the right as shown. If you deep and more than 60mm high will the rear panel. However, since the front
will never use phantom power, you work. You could consider using plastic panel connectors are all wired, you could
could instead use polarised electrolyt- instrument cases like Altronics H0476 still mount the PCB right up against the
ics with a much lower voltage rating. or H0482; however, you will need to rear panel to avoid extra wiring.
With the PCB assembled, we can adapt Figs.6 and 7 to fit the different- We labelled our panel using Dymo
move on to wiring it up so it can go ly-sized panels. stickers, as shown in Photo 1. We printed
in the case. The PCB can be secured via spac- labels in small text on 10mm-wide tape
ers and screws through the provided and used tweezers to place the labels
Case preparation mounting holes if you are not using on the panel. Most of the switches are
The PCB slides into the second slot up the recommended case. self-explanatory, but our experience
from the bottom in the recommended Mark and drill the front and rear pan- is that we will have forgotten what
extruded aluminium case. Use the pro- els. Be careful to choose the right side does what in a year or two. So label-
vided drilling drawings, Figs.6 and 7, of the panel, as the pre-drilled screw ling is a good idea and makes the box
to cut the required holes in the front holes are countersunk on the outside. look better.
With the case panels prepared, Fig.9 shows the details. We soldered ●
Two 200mm-long leads with two
mount the front panel hardware. We to this using plenty of flux. It is used wires for:
used dual binding posts for the speaker for measuring the time alignment of – The amplifier output (CON4). Ide-
connections, although you could save speaker drivers. ally, use two lengths of light-duty
a little money by using captive-head hookup wire.
binding posts. Whatever you choose, Wiring it up – The Mic Gain switch (CON7)
make sure they can act as both bind- Cabling for the Loudspeaker Test Jig ●
One 150mm-long lead with three
ing posts and banana sockets, as that is made easy by using plugs on the wires for the Microphone input
is really handy in use. end of the leads connected to the front (CON2).
After mounting the binding posts, panel, as shown in Fig.8. You need to
follow with the three switches, then make up the following flying leads, Label these at the plug end so you will
the XLR microphone socket. Watch all using wires stripped from ribbon know what header they plug onto later.
your selection, as some XLR connec- cable or light-duty figure-8, except the Also make sure you mark pin 1 on each
tors are pretty deep and the mounting ground lead: lead; we used pieces of leftover heat-
hole locations vary. ● Four 150mm-long leads with two shrink to mark pin 1. You could use a
The last ‘fiddly bit’ is the micro- wires for: marker pen, but be aware that the mark-
phone monitor output. We had very lit- – The Mic output monitor post ing could become less distinct with
tle space and wanted a test output for (CON3) time and handling.
hooking an oscilloscope probe, similar – The Output Attenuation switch Wire up the board to the front panel
to the calibration post on many oscil- (CON5) connectors and controls, as shown in
loscopes. We made ours from a 25mm – The Mode switch (CON6) Fig.8. The best way to do this is:
M3 screw by cutting the head off with – The sense wires for the Amp Out- ● Solder the CON9 ground wires to the
a hacksaw, filing each end flat, then put and DUT (CON8) black pins on the banana sockets/
drilling a 1.5mm hole through the flat ● O ne lead from medium-duty binding posts. Jumper across them
parts using a PCB drill. That worked a hookup wire for the ground con- at the banana socket to ‘double up’
treat, as shown. nection (CON9). the ground wiring.
● Measure your 10W reference resis-
tor with the best precision you can.
Mark the reading on the resistor,
so you don’t forget the resistance.
Securely bend the leads around the
red posts of the ‘Amp’ and ‘DUT’
headers and solder them.
● Solder pin 1 of CON4 to the red ter-
minal of the AMP banana socket.
Pin 2 goes to ground.
● Solder pin 1 of CON8 to the red ter-
minal of the DUT banana socket and
pin 2 to the red terminal of the AMP
banana socket.
● Solder the CON5 wires across the
top two pins of the Atten switch on
the front panel.
● Solder the CON6 wires across the
top two pins of the Mode switch on
the front panel.
Photo 3: label the plugs and wire so that you don’t get them mixed up when ● Solder the CON7 wires across the
plugging them into the PCB headers. This photo also shows more clearly how top two pins of the Mic Gain switch
the reference resistor is connected. on the front panel.
Sysblocks
www.fl[Link]
SETTING UP AND USING
ROOM EQ WIZARD
This accompanying article for the Speaker Test Jig explains how to set up
and use the freely-available Room EQ Wizard (REW) or Speaker Workshop
software to help you design and tweak loudspeakers.
F
irst off, you don’t need the input and output here; usually, you
Loudspeaker Test Jig described in
By Phil Prosser would use the default sound input
this issue to use Room EQ Wizard and output devices.
or Speaker Workshop to design and
test loudspeakers and drivers, but it Final testing and setting up REW Calibrating your sound card
makes it a lot easier. We assume you have your computer 1. Set the Loudspeaker Test Jig to ‘com-
This article will describe setting up set up and your sound card properly ponent test’ and make sure there is
and using REW (and later, Speaker installed. Importantly, make sure you nothing connected to the Speaker
Workshop) assuming you have built have the sample rate set and no effects and DUT connectors.
the Loudspeaker Test Jig. If you hav- turned on. Also check that you do not 2. Make sure the Loudspeaker Test Jig
en’t, you can still follow these proce- have ‘monitor recordings’ set. attenuator is switched out.
dures; you just need to rig up a micro- The critical steps to getting the Loud- 3. In REW, open the preferences pull-
phone preamp, power amplifier, test speaker Test Jig operational with the down and open the preferences tab.
resistor and some other bits and pieces REW software are provided here. There 4. Click on ‘Calibrate soundcard’.
to perform similar functions. are many resources on the internet for Note that by using the ‘Compo-
Essentially, what you need (and this program, and its full details are nent’ test mode, the 10W refer-
the Jig provides) for measuring driver well beyond the scope of this article. ence resistor acts as the loopback
impedance is to have your computer’s Still, let’s get it up and running. mentioned in the text box that
sound card feeding a power amplifier After installing and launching will pop up.
that drives the device under test (DUT) REW, to set it up, open the prefer- 5. Click Next, and a text box will
via a well-characterised 10W or similar ences pulldown and then the prefer- appear providing instructions. Fol-
power resistor. Both ends of that resis- ences tab – see Screen 1. Select your low them.
tor then connect to the two
sound card inputs.
For driver and speaker
frequency response plots,
you instead need a cali-
brated microphone and
microphone preamp com-
bination that gives a flat
response feeding into one
of your sound card’s inputs
while the output(s) drive
the DUT via a small power
amplifier. The Jig also does
that if you have a cali-
brated microphone (we’ll
describe an inexpensive
one in an upcoming issue).
Using it
To measure an impedance
1. Set your Loudspeaker Test Jig to
‘component’ test and make sure
there is nothing connected to the
Speaker and DUT connectors and
that the Attenuator is out.
2. Click ‘Measure’ in the top left cor- Screen 4: calibration with our 10W test resistor is complete, and the result
ner of the main REW screen. almost exactly matches what our Low Ohms Meter reads.
3. Click ‘Impedance’ in the top left of
the screen, as shown in Screen 3. To measure speaker frequency response frequencies, and consider running
4. Click Start once you have con- 1. If you are testing a tweeter, put a the sweep from, say, 500Hz up.
nected your unknown impedance high-value non-polarised capaci- 2. Set your Loudspeaker Test Jig to
across the DUT terminals. tor in series to protect it from low ‘speaker’ test.
Screen 8: an impedance plot of the 10W calibration resistor in Speaker Workshop. It’s a bit noisier than the equivalent
REW plot, but it demonstrates that the measurement system is accurate from about 5Hz to over 20kHz. Note that this plot
was made as part of the verification process of the Loudspeaker Test Jig.
- up to 50MS/s
- resolution up to 12bit
- Lowest power consumption
- Smallest and lightest
- 7 in 1: Oscilloscope, FFT, X/Y,
Recorder, Logic Analyzer, Protocol
Screen 7: to use Speaker Workshop with the Test Jig, you must create a ‘driver’ decoder, Signal generator
instance and set some critical parameters.
I
n the last month’s part of our Teach-In series, we
introduced the ESP32’s ADC and DAC. We showed you how About Teach-In
to read analogue voltages and interface analogue sensors. Our latest Teach-In series is about using the popular ESP32
We also introduced the ESP32’s Analogue Plotter as a means module as a basis for learning electronics and coding. We
of visualising voltage changes over time. Plus, we explained will be making no assumptions about your coding ability
the principle of pulse-width modulation (PWM) and how this or your previous experience of electronics. If you know one
but not the other, you have come to the right place. On
is used to generate (pseudo) analogue output voltages and
the other hand, if you happen to be a complete newbie
waveforms. Coding Workshop introduced the decimal, binary, there’s no need to worry because the series will take a
octal and hexadecimal number systems. Our Teach-in project progressive hands-on approach. There will be plenty of
featured the design, construction and coding of a simple tester time to build up your knowledge and plenty of opportunity
for 1.5V batteries. to test things out along the way.
The learning objectives for this fourth part of our series are We’ve not included too much basic theory because this
to know how to: can be easily found elsewhere, including several of our
n Configure and use matrix and seven-segment LED displays previous Teach-In series, see:
n Interface a motion sensor. [Link]
n Generate and use random numbers. [Link]
Earch month, there’ll be projects and challenges to help you
Seven-segment LED displays check and develop your understanding of the topics covered.
Seven-segment LED displays provide you with a simple,
low-cost method of displaying numbers and a limited range is similar but the anodes and cathodes have been interchanged.
of basic text characters. They comprise seven (or sometimes The important difference between these two configurations is
eight) individual LEDs arranged as shown in Fig.4.1. Note that that the polarity of the common connection changes according
the segments are lettered in sequence from the top, moving to the display type. A common-cathode connection is returned
clockwise around the display and ending with the centre to the common negative rail (usually GND) whereas a common-
segment. Each of the segments, labelled ‘a’ to ‘g’, are individually
addressable, which means that you can choose to illuminate
one or all of them by applying a small current of typically 5
to 15mA to the segment required. In some displays an extra
decimal point (referred to as ‘d.p.’ or ‘DP’) is also present.
Seven-segment displays are commonly available in various
sizes and may be either common-cathode or common-anode
types depending on which LED connections are linked together.
Thus, for example, the common-cathode display shown in
Fig.4.3(a) has nine connections, of which eight are used for the
anodes of the individual
segments (including the
decimal point), with a
ninth connection common
shared by the cathodes. The
arrangement in Fig.4.3(b)
Sample code for driving the seven- display held for a period defined by
segment display is shown below in delayTime(). Note that the time delay
Listing 4.1. This code simply displays is initialised to one second (1000ms) at
each number from 1 to (1)0 with the the beginning of the code.
Using seven-segment display modules Fig.4.6 Breadboard wiring for the ESP32 and common-cathode seven-segment display.
If you’ve checked out our simple seven-
segment counter, you might want to with Fig.4.6 you will see just how much left-most digits) and seconds (the two
interface more than one display and neater this is. The display module uses right-most digits). To ensure accuracy
be wondering if there’s a better way of a serial interface to the ESP32 based of the timing, we’ve decided not to
doing things. The answer is, of course, on a cTM1637 driver chip. This device use the ESP32’s delay() function.
yes there is! does all the hard work, leaving you to Instead, we will be using the ESP32’s
If you need multiple seven-segment concentrate on getting the best out of it. real-time clock (RTC). To make use of
displays with the segments addressed Since we have four digits to play with, the TMD1637 and the ESP32’s RTC
along the lines of our previous example, we will use them to develop a timer that we will need to include two library
then this can quickly become extremely produces a display of minutes (the two routines in our code. If you refer to
cumbersome – just imagine interfacing
a counter/timer with 10 or 12 seven- Listing 4.2 Minutes and seconds counter using a TM1637 serial interface
segment displays! Furthermore, if you and the ESP32’s RTC
have more than two seven-segment /* Minutes and seconds counter using ESP32 RTC,
displays you will start to run out TM1637 driver and LED display. Time initialised
of GPIO pins. Fortunately, there’s a to [Link] for use with a 4-digit LED display. */
simple solution based on one or more
external driver devices. These are often #include <ESP32Time.h>
packaged along with a two-, four-, or #include <TM1637Display.h>
eight-digit display and require only four #define CLK 22 // GPIO22 to CLK on the TM1637
connections to the ESP32, as shown in #define DIO 23 // GPIO23 to DIO on the TM1637
Fig.4.7. So, having shown you a rather
// Set up RTC and display
clumsy method of interfacing a seven-
ESP32Time rtc(3600); // Seconds offset for GMT+1
segment display to the ESP32 let’s now TM1637Display display = TM1637Display(CLK, DIO);
move on to a much-improved way of
interfacing a multi-digit display. void setup() {
In the arrangement shown in Fig.4.7 [Link]();
just four connections are needed to [Link](7); // Set display brightness
drive a total of 30 display segments. The [Link](1609459200); // Set RTC to Jan 2021 [Link]
connections required are: VCC to the }
ESP32’s +5V supply, DIO to D23 on the
ESP32, CLK to D22 on the ESP32, and void loop() {
int time;
last, but not least, GND to GND.
struct tm timeinfo = [Link]();
time = ([Link]() * 100) + ([Link]());
4-digit display implementation [Link](time, 0b11100000, true, 4, 0);
The required breadboard wiring for delay(1000); // Wait one second
checking out a 4-digit display module }
is shown in Fig.4.8. If you compare this
long randomValue;
All of our stock is RoHS compliant and CE
void setup() { approved. Visit our well stocked shop for
[Link](9600); all of your requirements or order on-line.
// Uncomment next line to use a random seed
// randomSeed(analogRead(0));
} We can help and advise with your enquiry,
from design to construction.
void loop() {
randomValue = random(1, 10);
[Link](randomValue);
[Link](“ “); 3D Printing • Cable • CCTV • Connectors • Components •
delay(1000); Enclosures • Fans • Fuses • Hardware • Lamps • LED’s •
} Leads • Loudspeakers • Panel Meters • PCB Production •
Power Supplies • Relays • Resistors • Semiconductors •
Soldering Irons • Switches • Test Equipment • Transformers
and so much more…
Monday to Friday 08:30 - 17.00, Saturday 08:30 - 15:30
long randomValue;
long randomValue;
void setup() {
[Link](9600);
// Uncomment next line to use a random seed
// randomSeed(analogRead(0));
}
void loop() {
randomValue = random(0, 2);
if (randomValue == 1) {
[Link](“HEADS “);
} else {
[Link](“TAILS “);
}
delay(1000);
}
Gotcha!
If you find that the Serial Monitor displays gobbledygook
instead of a series of meaningful values, you should first
check that you have set a baud rate that matches the speed
that you’ve specified in your code. Our previous two
examples operate at 9600 baud. To work correctly this must
match the value that you have set in the Serial Monitor.
will produce HEADS. Once again, you will need to run the
Serial Monitor to check the results.
Using matrix LED displays Fig.4.9 Basic arrangement of an 8×8 LED matrix display.
Having experimented with seven-segment displays let’s now
move on to a different and more flexible type of LED display Fig.4.10 shows how a typical 8×8 LED matrix display appears
based on a matrix of individual LEDs. The most common types when the following LEDs are addressed:
of small LED matrix display are based on an 8×8 LED array,
as shown in Fig.4.9. R1/C3, R1/C4, R1/C5, R1/C6, R2/C2, R2/C3, R2/C6,
To reduce the number of connections between the display’s R2/C7, R3/C7, R4/C6, R4/C7, R5/C5, R5/C6, R6/C4,
64 LEDs and the outside world, the diodes are arranged in R6/C5, R8/C4, R8/C5.
an array of eight rows (R1 to R8) and eight columns (C1
to C8). With this configuration individual diodes can be In case this is beginning to look overcomplicated, the problem of
addressed by referencing the rows and columns in which addressing the necessary LED to display a particular set of text
they are placed. In Fig.4.9 we’ve shown how two of the characters is solved for you. You just need to use the right library!
LEDs (referenced by R3/C5 and R5/C3) can be illuminated The interface to an LED matrix display is usually based on
by a current of typically 5 to 15mA. a de facto standard known as Serial Peripheral Interface (SPI).
SPI supports serial communication between a ‘master’ (the
ESP32) and a ‘slave’ (the matrix display).
Practical Project
Gotcha! This month’s Practical Project takes the form of a dice roller
ESP32 development boards usually have SPI pins pre-
which comprises an ESP32, an 8×8 LED matrix display and a
assigned along the lines shown in Table 4.1. If you are
using a different type of platform for developing your low-cost motion sensor (see Fig.4.12).
application and plan on using SPI then it is important to
check the pin assignment before use.
+
matrix displays
/* Text display using an ESP32 and four 8 x 8 Large matrix displays can use a very large number of
matrix LED displays */ individual LED. For example, if four 8×8 displays are
cascaded there will be a total of 256 LEDs present. If each
// Include the library files of these LEDs is illuminated simultaneously (unlikely but
#include <MD_Parola.h> not impossible) and if each is fed with a current of 10mA
#include <MD_MAX72xx.h> the total load on the ESP32 power supply will amount to
#include <SPI.h> more than 2.5A. This can easily exceed the capability of
a standard USB port.
// Uncomment depending on display type
#define HARDWARE_TYPE MD_MAX72XX::FC16_HW
// #define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW Note, that once again, you may need to locate and download
the first two of these library files from within the Arduino IDE.
// Define display and I/O pins Fig.4.13 shows the interconnection of an LED matrix
#define MAX_DEVICES 4 display, motion sensor and ESP32. We’ve not shown a
#define CS_PIN 5 full wiring diagram this time because the arrangement is
MD_Parola Display = MD_Parola(HARDWARE_TYPE, straightforward, and you will doubtless have had plenty
CS_PIN, MAX_DEVICES); of experience with our two previous examples. Note that
if the motion sensor has an analogue output (as well as a
void setup() { digital output) this can be ignored. The dice roller code is
// Intialise the display
shown in Listing 4.3.
[Link]();
[Link](0);
[Link](); Displaying text messages
} LED matrix displays can be easily cascaded to produce larger
static and scrolling text displays. The arrangement in Fig.4.14
void loop() { and code in Listing 4.4 shows how this can be done but note
[Link](PA_CENTER); that the code must be changed to indicate the number of 8×8
[Link](“ON AIR”); displays that are present. This requires the following change
delay(2000); to Listing 4.3:
}
#define MAX_DEVICES 4
instead of:
#define MAX_DEVICES 1
Teach-In Challenge
This month’s Teach-In Challenge involves extending the
hardware and modifying the code in Listing 4.4 to produce
a door entry indicator which will display the messages
Fig.4.14 Arrangement for cascading multiple matrix displays. ‘WAIT’ or ‘ENTER’ depending on the state of a push button
When physical movement is detected by the motion sensor switch connected to one of the ESP32’s digital inputs. If
(a slight tap is usually enough) this produces a change of logic you need help interfacing the switches look back at Part
level on the DO pin and this in turn is used to break out of 2 of our series.
the while() loop in Listing 4.3. Note that we need to include
three libraries at the beginning of the code. This is done with Next month
the aid of the following lines: In Part 5 next month, we will introduce temperature and
humidity sensing, delving into the popular 1-wire and I2C
#include <MD_Parola.h> // To write text to the display interface standards, and explain how low-cost LCD displays
can be added to your ESP32 projects. Coding Workshop will
#include <MD_MAX72xx.h> // To use the MAX72xx driver deal with mathematics operators and functions, and our
Practical Project will feature a useful digital temperature and
#include <SPI.h> // To use the SPI interface humidity monitor.
TEACH-IN 3 TEACH-IN 5
£7.99
huge range of subjects that will interest everyone involved 15 design and build circuit projects for newcomers or JUMP START
CIRCUIT SURGERY
in electronics – from newcomers to the hobby and i The how and why of circuit design those following courses in school and colleges. 15 design and build circuit projects
dedicated to newcomers or those
PRACTICALLY SPEAKING
students to experienced constructors and professionals.
following courses in schools and
PIC ‘N MIx
Surgery, EPE/PE’s regular clinic dealing with readers’ Powered Charger n Versatile Theft Alarm n Spooky
i Over 40 different circuit ideas
Starting out with PIC microcontrollers
t
W
1
TWO TEACH-INs FOR
Elec
©
TWO TEACH-INs FOR
THE PRICE OF ONE! THE PRICE OF ONE !
The second section – Practically Speaking – i The free CD-ROM provides
a broad-based introduction
to electronics
n Egg Timer n Signal Injector Probe n Simple Radio Provides
a practi
cal
to PIC
introduction llers
Plus:
MikroElektro
Microchip pe
L-Tek PoSco
nika,
The free CD-ROM provides a
practical introduction to PIC
8 Inter
active ledge
and logo, Techno
ip name of Microchip
Technol
Microch
ip
.09 software
PLUS
The Microch arks s. © 2013
Your Know
016-02
ed tradem countrie 1. MCCD1
register and other d. Issue
in the USAAll rights reserve
d 1
In 2 - [Link]
A BROAD-BASED INTRODUCTION TO CD
ELECTRONICS
TEACH-IN 4
FROM THE PUBLISHERS OF
Electronics Manual, worth £29.95. The Manual i Over 800 PDF pages
What a Bargain!!
if not, open double-click
and
Explorer f
[Link]
[Link].u
Downloa [Link]
[Link]
BA SE .epe mag
k
© Wimbor
Audio Out – an
£8.99 £8.99
D CD
DV
and Circuit Surgery
The Teach-In 6 CD-
TEACH-IN 6 analogue expert’s take
TEACH-IN 7 by Ian Bell – ‘State TEACH-IN 8
FROM THE PUBLISHERS OF FROM THE PUBLISHERS OF
FREE
CD-ROM
ROM also contains all on specialist circuits
SOFTWARE
FOR
the techniques of
• Pi ClASS – SPECifiC lEARninG AimS • Learn with ‘TINA’ – modern CAD software • Microcontrollers – understand control operations
• PYthon QuiCkStARt – SPECifiC PRoGRAmminG toPiCS • Five projects to build: Pre-amp, Headphone Amp,
readers and circuit the files for:
• Communications – connect to PCs and other Arduinos
• Pi woRld – ACCESSoRiES, BookS EtC Tone Control, VU-meter, High Performance Audio Power Amp
project building.
• homE BAkinG – follow-uP ACtivitiES
nM
icrochip MPLAB
RE FOR
SERIES SOFTWA 7
CH-IN
THE TEA
Smartscope software.
building PIC-based projects
Teach In 6 [Link] 1 02/03/2015 [Link] Teach In 7 Cover VERSION 3 [Link] 1 07/04/2016 08:25 Teach In 8 [Link] 1 04/04/2017 12:24
O
-M-Goodness gracious me. with him. For example, while he was
My head is buzzing with so many helping me debug the wiring issue we Top view
a
ideas that I don’t know whether I’m discussed in our previous column (PE,
Side view
coming or going. I have myriad topics I want May 2024), Joe idly dropped into the k
to waffle about, but where to start waffling? conversation the fact that he usually a = anode
powers his breadboards using a different k = cathode a k
More power! scheme to the one we’ve adopted.
I’ve said it before, and I’ll say it again – We will look at this scheme in a Soldered joints
0.1-inch pitch header
one of the great things about electronics moment, but – before we go there – Joe pin pair
is that there’s always more than one way also mentioned that if he ever needs to
to do something. I’ve said it before, and perform some breadboard-related activity Fig.2. Constructing LED assemblies.
I’ll say it again (did someone just say that more than one time, he usually creates
or is it déjà vu all over again?) – one of a breakout board (BOB) or something a mix of +12V and –12V for the analogue
the pains with electronics is that there’s similar. He then makes a bunch of these portions of his circuits, along with +5V
usually so many ways of doing things and pops them in a drawer for later use. and +3.3V for the digital sections, he uses
that it can be hard to know what to do Another trick Joe employs is to put a different coloured LEDs (and different
for the best. Sometimes your best bet is label on the front of the drawer saying values of current-limiting resistors) for
to flip a coin and allow fate to decide what’s inside. I’m reminded of the each voltage.
your course. ‘Brilliant!’ adverts from Guinness – see: It’s a bit ironic that – although we are
Over the course of this series, we’ve [Link] working with solderless breadboards –
developed a way of powering our I’m sure you are muttering, ‘That’s we find ourselves needing to do a bit of
breadboards that involves using two obvious,’ to yourself under your breath. soldering, but ‘it’s a funny old world and
light-emitting diodes (LEDs) to provide Well, that’s as maybe, but it’s amazing no mistake,’ as they say (we talked about
us with a high level of confidence that how many of us – your humble narrator soldering, along with Alan Winstanley’s
our power and ground rails are intact included – are convinced we will always handy-dandy Basic Soldering Handbook,
and working as expected. remember where we put things, only to in PE, March 2024).
I’m not going to rehash everything discover that we are deluding ourselves Now let’s turn our attention to our spiffy
we’ve done in excruciating detail now when the time comes. new power plan (Fig.3). Remember that
(I’ll save that for later). What I will do is In the case of any LEDs used to verify I always prefer to have my breadboards
say that you can remind yourself of our the presence of power on his breadboards, oriented such that the red power rail is
current setup by downloading an image Joe mounts them and their associated at the top (always doing things the same
of the latest and greatest incarnation current-limiting resistors on a pair of way helps cut down on errors involving
of our dual breadboard platform (file 0.1-inch-pitch header pins. You can mistakenly connecting things to the
[Link]). As usual, all the files purchase these pins in strips and then wrong rails). In all these examples, we’re
mentioned in this column are available snip off the number you need. The ones bringing 5V (red wire) and 0V (black wire)
from the June 2024 page of the PE website: we need here are long tailed on both from the Arduino into the bottom right-
[Link] sides (Fig.1). The conducting terminals hand corner of the breadboard. Also, we’re
I’ve made mention of my friend Joe are 6.25mm on each side with 2.5mm of including jumpers in the middle of the
Farr on multiple occasions. Joe has a plastic in the middle, so 15mm in all. You power and ground rails just in case we
vast amount of practical knowledge. I can find them all over the place, including happen to find ourselves working with
learn something new whenever I chat Amazon, see: [Link] a split-rail board.
Joe always associates the current- The way we’ve been doing things thus
limiting resistor with the LED’s anode far is illustrated in Fig.3a. In this case,
terminal, thereby making it easy to we link the bottom and top sets of power
remember what’s what when plugging and ground rails using the red and black
them into the power and ground rails. wires on the left-hand side of the board.
I’ve replicated Joe’s scheme with the By locating our green and blue LEDs on
green and blue LEDs we’ve been using, the right-hand side of the board, we verify
along with their 680Ω (blue-grey-brown) that all the rails are intact. As I know from
current-limiting resistors (Fig.2). experience, it’s very frustrating to spend
Since we know all the experiments in time debugging a non-existent problem,
this series are based on the 5V supplied only to discover that one’s breadboard
by our Arduino Uno, we need do no more. isn’t fully powered up in the way one
Fig.1. Long-tailed 0.1-inch pitch header pins. In Joe’s case, as his projects often include thinks it is.
D3 D2 D1 D0 5 10 9 1 2 4 6 7
DP G F E D C B A
From 3 3 3 3
(a) Original scheme
Arduino
C C C C
B B B B
E E E E
13 12 11 10 9 8 7 6 5 4 3 2
to refresh our minds as to the (B) control inputs and connect these to
concept of binary-coded decimal the Arduino, as shown in the schematic.
(b) One alternative
From
Arduino
(BCD), after which we were to Yes, of course, I’ve updated our master
investigate various deployments diagram to reflect this new setup (file
of BCD-to-7-segment decoders [Link]).
in our clock prototype.
I’m afraid I fibbed. I hang Super software
my head in shame. I shall All we need now is some super software to
chastise myself soundly later. drive our new setup. I just forked (copied)
The problem is that I can’t hold the final program from our previous
myself back any longer. When column and made a few modifications.
we were all a lot younger than we There’s nothing we haven’t seen before,
are today, we commenced our but there are a few subtleties that will
Arduino Bootcamp experiments make it worth our while to peek at some
From
(c) Better alternative
Arduino using only a single 7-segment of the bits and pieces.
display. I’m sure that you, like As a reminder, we are multiplexing our
Fig.3. Alternative power scenarios. me, look back on those halcyon four displays, which means only one will
days with fond nostalgia. be active at a time. The main reason for
Now that we have our snappy new More recently (PE, May 2024), we doing this is that we currently have only
LED assemblies from Fig.2, one possible upped our game to use a dual-display enough pins on our Arduino to control
scenario is to use one of these assemblies configuration, pushing ourselves to one set of A, B, C, D, E, F, G, DP segments
as illustrated in Fig.3b. By placing this ‘Boldly go,’ as Captain James Tiberius at a time. Also, we’ve selected our 150Ω
single LED assembly in the upper right- Kirk might say. current-limiting resistors to supply the
hand corner of the board, we again verify And now? Well, as the eponymous maximum current (20mA) that the display
that all the rails are intact. character in Dirk Gently’s Holistic segments are rated for. The Arduino’s
A final alternative is to add additional Detective Agency once proclaimed: pins would be uncomfortable providing
red and black wires to link the bottom and ‘Let’s think the unthinkable. Let’s do more than this amount of current for an
top set of power and ground rails on the the undoable. Let us prepare to grapple extended period, so activating two or
right-hand side of the board (Fig.3c). This with the ineffable itself and see if we may more displays simultaneously would be
redundancy provides increased reliability not eff it after all.’ Yes, you are correct, the opposite of a good idea.
on the off chance that one of our wires it’s time for us to tentatively dip our toes In one respect, it’s meaningless to think
becomes disconnected or one of our rails into the quad-display waters. of our four displays in terms of ‘least-
goes open circuit for some reason. We really From a hardware perspective, this is significant’ and ‘most-significant’ because
require only one LED assembly, but I’ve simply an extension of what we’ve done we aren’t using them to display a single
used two (one either side of the jumpers before. We already had two 7-segment numerical value per se. Having said this,
in the middle of the upper rails) because… displays that we called D0 and D1. We’re for the purposes of our program, we’re
well, (a) they are different colours and (b) going to add two more that we’ll call D2 going to consider D0 and D3 as being the
two LEDs are inherently more fun than one. and D3 (Fig.4). Similarly, we were already least- and most-significant, respectively.
Of course, we don’t have to change our using eight of the digital outputs (pins 2 For reasons that will become apparent
existing setup now. This is just something through 9) on our Arduino Uno to drive when we delve into the code, we are going
for us to remember for future projects. eight 150Ω current-limiting resistors. The to activate the displays in the order D0,
Having said that, I’ve gone ahead and other sides of the resistors were connected D1, D2, and D3. Suppose, for example,
modified our master diagram anyway to the anode (segment) terminals on we wish to display a time like 6:24. In
(file [Link]). displays D0 and D1, so we need to extend our HH:MM format, we will include a
these wires to also drive displays D2 and leading 0 and present this as 06 24 (Fig.5).
I can’t hold back! D3. Finally, we need to add two more OK, now let’s look at our new program
In closing our previous column, I more BC377 NPN transistors, along with 1kΩ (file [Link]). We’ll start with
than hinted that this month we were going current-limiting resistors on their base the definitions as shown in Listing 4a.
reasons why it made sense to declare we’ve used before, on Line 78 we’ve
the pins used to control the transistors added a new 4-element array called
individually. These reasons included our dispData[]. We are going to use this
having only two displays, coupled with array to store the four 0 to 9 values we
Time
the way in which we decided to present wish to present on our D0, D1, D2 and
values on these displays. D3 displays.
In our new program, In addition to the We’ve seen the statements in Lines
8-element PinsSegs[] array, to which 80 to 89 in our previous program.
we’ve assigned the numbers of the pins However, on Lines 92 to 95, we now
used to drive the display segments, we’ve enter our HH:MM values into our
added a 4-element PinsTrans[] array, dispData[] array. The combination
Fig.5. Order of display. to which we’ve assigned the pins used of our PinsTrans[] and dispData[]
to drive our transistors. arrays allows us to create the for()
In addition to NUM_SEGS (the number Remember that the elements in our loop on Lines 98 to 104.
of segments on each display) and NUM_ PinsTrans[] array are numbered 0, 1, This loop cycles through the four
DIGITS (the number of digits, 0 to 9, 2 and 3, which is the order in which displays in the order D0, D1, D2 and
that we wish to display), we’ve added we’ve assigned the pins used to drive D3. Each time round the loop, on Line
NUM_DISPLAYS (the number of displays, the transistors associated with displays 100 we activate the segments we wish
D0 to D3, we’re now using). D0, D1, D2 and D3, respectively. to display (we’ll return to this in a
Similarly, in addition to SEG_ON and The setup() function is easy peasy moment), on Line 101 we activate the
SEG_OFF, to which we’ve assigned the lemon squeezy (Listing 4c). We start transistor associated with the current
HIGH and LOW values required to activate by initialising our real-time clock display, on Line 102 we wait for our
and deactivate the segments on our on Line 58. On Lines 66 to 69 we ON_OFF_TIME delay, which is currently
common-cathode displays, respectively, use a for() loop to define the pins set to 10 (milliseconds), and on Line 103
we’ve added TRAN_ON and TRAN_OFF, driving our segments as being of type we deactivate the transistor associated
to which we’ve assigned the HIGH and OUTPUT. Then, on Line 70, we call with the current display.
LOW values required to activate and our DisplaySegs() function to turn Line 100 might cause your brain to
deactivate the NPN transistors we’re all the segments off. We’ve seen this stumble a bit. The way to read this is
using, respectively. before in previous programs. like peeling an onion but the other way
Next, let’s turn our attention to our pin New to this program is the fact that, round. That is, we start with the deepest
declarations and assignments (Listing 4b). since we’ve now declared the pins layer and work our way out. Thus, we
In our previous column, there were several controlling our transistors as an array, start with our ‘call’ to dispData[iData],
we can use another for() loop which returns an integer containing the
on Lines 59 to 63 to declare each 0 to 9 value we wish to present on the
pin as being of type OUTPUT and current display. We then use this value
to then deactivate that transistor. in our ‘call’ to DigitSegs[], which
The reason I inserted this before returns a byte containing the segment
our original for() loop is to on/off values we need to use. We then
ensure all the transistors are pass this byte into the call to our trusty
turned off as soon as possible. DisplaySegs() function.
Finally, let’s turn our attention Another way to think about this – and
to the loop() function (Listing another way we could have implemented
4d). After declaring the same it – would be to break everything out
Listing 4b. Pin assignments. hour and minute variables into individual steps as follows:
D0
D1
(a) Two displays
40ms
Period (P) = 40ms
10 30 Frequency (f) = 25Hz
D0
D1
D2
D3
A B C D E
E D C B A
A B C D E
I H G F
F G H
F G H
I
J
J
J
J
60 55 5 1 1 5 55 60
Next time…
On the bright side, our existing clock
works like a charm. On the downside,
we’ve used all 12 of our digital pins –
eight to control the display segments
and four to control the transistors (we
aren’t touching pins 0 and 1 because
these are used by the Arduino to
communicate with our host computer).
This means we have no pins spare to of binary-coded decimal (BCD) and clock (otherwise my name’s not Max
add additional functionality (sad face). then investigate various deployments the Magnificent). Until next time, have
But turn that frown upside down of BCD-to-7-segment decoders in our a good one!
into a smile because we have some
cunning tricks up our sleeves (watch Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor
carefully – at no time will my hands of all he surveys at [Link] – the go-to site for the
leave the ends of my arms). In our next latest and greatest in technological geekdom.
column, we really and truly are going
Comments or questions? Email Max at: max@[Link]
to refresh our minds as to the concept
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 [Link]
Fluke/Philips PM3092 Oscilloscope HP 54600B Oscilloscope
(ALL PRICES PLUS CARRIAGE & VAT)
2+2 Channel 200MHz Delay TB, Analogue/Digital Dual Trace 100MHz
Autoset etc – £250 Please check availability before ordering or calling in
Only £75, with accessories £125
LAMBDA GENESYS PSU GEN100-15 100V 15A Boxed As New £400 Marconi 2305 Modulation Meter £250
LAMBDA GENESYS PSU GEN50-30 50V 30A £400 Marconi 2440 Counter 20GHz £295
IFR 2025 Signal Generator 9kHz – 2.51GHz Opt 04/11 £900 Marconi 2945/A/B Communications Test Set Various Options POA
IFR 2948B Communication Service Monitor Opts 03/25 Avionics POA Marconi 2955 Radio Communications Test Set £595
IFR 6843 Microwave Systems Analyser 10MHz – 20GHz POA Marconi 2955A Radio Communications Test Set £725
R&S APN62 Syn Function Generator 1Hz – 260kHz £295 Marconi 2955B Radio Communications Test Set £800
Agilent 8712ET RF Network Analyser 300kHz – 1300MHz POA Marconi 6200 Microwave Test Set £1,500
HP8903A/B Audio Analyser £750 – £950 Marconi 6200A Microwave Test Set 10MHz – 20GHz £1,950
HP8757D Scaler Network Analyser POA Marconi 6200B Microwave Test Set £2,300
HP3325A Synthesised Function Generator £195 Marconi 6960B Power Meter with 6910 sensor £295
HP3561A Dynamic Signal Analyser £650 Tektronix TDS3052B Oscilloscope 500MHz 2.5GS/s £1,250
HP6032A PSU 0-60V 0-50A 1000W £750 Tektronix TDS3032 Oscilloscope 300MHz 2.5GS/s £995
HP6622A PSU 0-20V 4A Twice or 0-50V 2A Twice £350 Tektronix TDS3012 Oscilloscope 2 Channel 100MHz 1.25GS/s £450
HP6624A PSU 4 Outputs £400 Tektronix 2430A Oscilloscope Dual Trace 150MHz 100MS/s £350
HP6632B PSU 0-20V 0-5A £195 Tektronix 2465B Oscilloscope 4 Channel 400MHz £600
HP6644A PSU 0-60V 3.5A £400 Farnell AP60/50 PSU 0-60V 0-50A 1kW Switch Mode £300
HP6654A PSU 0-60V 0-9A £500 Farnell XA35/2T PSU 0-35V 0-2A Twice Digital £75
HP8341A Synthesised Sweep Generator 10MHz – 20GHz £2,000 Farnell AP100-90 Power Supply 100V 90A £900
HP83630A Synthesised Sweeper 10MHz – 26.5 GHz POA Farnell LF1 Sine/Sq Oscillator 10Hz – 1MHz £45
HP83624A Synthesised Sweeper 2 – 20GHz POA Racal 1991 Counter/Timer 160MHz 9 Digit £150
HP8484A Power Sensor 0.01-18GHz 3nW-10µW £75 Racal 2101 Counter 20GHz LED £295
HP8560E Spectrum Analyser Synthesised 30Hz – 2.9GHz £1,750 Racal 9300 True RMS Millivoltmeter 5Hz – 20MHz etc £45
HP8563A Spectrum Analyser Synthesised 9kHz – 22GHz £2,250 Racal 9300B As 9300 £75
HP8566B Spectrum Analsyer 100Hz – 22GHz £1,200 Solartron 7150/PLUS 6½ Digit DMM True RMS IEEE £65/£75
HP8662A RF Generator 10kHz – 1280MHz £750 Solatron 1253 Gain Phase Analyser 1mHz – 20kHz £600
Marconi 2022E Synthesised AM/FM Signal Generator 10kHz – 1.01GHz £325 Solartron SI 1255 HF Frequency Response Analyser POA
Marconi 2024 Synthesised Signal Generator 9kHz – 2.4GHz £800 Tasakago TM035-2 PSU 0-35V 0-2A 2 Meters £30
Marconi 2030 Synthesised Signal Generator 10kHz – 1.35GHz £750 Thurlby PL320QMD PSU 0-30V 0-2A Twice £160 – £200
Marconi 2023A Signal Generator 9kHz – 1.2GHz £700 Thurlby TG210 Function Generator 0.002-2MHz TTL etc Kenwood Badged £65
OUT
L R
By Jake Rothman
Switching in audio equipment – Part 1
S
witching is the most basic
function in electronics, beginning
with the old-fashioned knife
switch (Fig.1) from which the circuit
symbol is derived today. However, audio
systems require specialised switching
of very small signals, with no added
noise, clicks or distortion. There are
also psychological aspects to audio
switching, such as how the mechanical
aspect of the switch feels to the user.
Mechanical noise is also very important;
a switch that emitted a loud mechanical
clunk, for example, would not be Fig.2. In audio it’s considered ‘much Fig.3. This old cassette deck has the
acceptable in a recording environment. worse’ if a switch gets knocked to off, mains switch actuated by a mechanical
There is also the whole area of so I prefer a switch orientation such that rod to keep it away from the sensitive
ergonomics or the science of control- down is always on. playback head.
surface design to consider. Well- as shown in Fig.2. This is in contrast to I always front mount the mains switch
designed switch positioning is vital to most other electronic equipment (such and have always used it to switch both the
avoid mistakes in operation, such as the as a bench power supply) which you live and the neutral – which nowadays
output of a radio station inadvertently wouldn’t want to turn on accidentally; it is a mandated safety requirement. This
being turned off. In addition to this, is ‘up’ for on. It doesn’t stop there; audio needs a double pole (DP) switch, such
music technology and Hi-Fi equipment mains wiring from the input power socket as the rocker switch shown in Fig.4. The
also has to satisfy the artistic needs of to the front panel switch mustn’t emit two pairs of wires going to and from the
creative people. (In my experience these hum into the sensitive circuitry. Some switch need to be twisted tightly and
people seem to have what I call a wider Hi-Fi designers obviate this by putting moved away from sensitive circuit areas
‘dynamic arm envelope’ – they are the mains wiring and switch at the back to reduce magnetic emissions. These
are much more likely to accidentality and use a mechanical rod to couple the wires should also be run along the corner
knock switches! Usually, at the worst front panel button (Fig.3). This is difficult of the metal box for partial electrostatic
possible time.) for home and small batch construction screening. In Orfoton moving-coil pick-
since custom mouldings and specialist up pre-amplifiers, the mains wiring is
Power switching. mechanical items are needed. There is enclosed in a copper tube for screening.
Even mains power switching has an also the travesty of rear-mounted mains I’ve used this idea, employing short
aspect that is almost unique to audio. The switches, great (not!) when the unit is lengths of micro-bore central heating
switch position is often down for ‘on’, mounted in a rack against a wall. pipe. In low-cost equipment, hum (and
DPDT
switch
Fig.1. It’s horror movie time. The old-fashioned knife switch would Fig.4. Mains switches need to be carefully wired to prevent hum
today be called a ‘wiping contact single-pole double-throw (SPDT) emissions to the rest of the circuit. Note how wires to the black
switch’ and would be considered irredeemably ‘non-compliant’ by DPDT switch on the left are twisted and placed into the top
any health and safety inspector; and they’d be right! corner of the enclosure.
Neutral 0V
S1b
Fig.7. (right)There Input
op amp
must be no DC R
R = Pull-down resistors C = DC blocking capacitor
Snubber network on signal lines to 1MΩ film types 100nF to 22 µF depending
10nF, 250V (Y capacitor)
100Ω, 0.5W be switched or 100kΩ tantalum 0V on input impedance of
22kΩ electrolytic output op amp
clicks will result.
safety compliance legal problems) are mechanical noise due to the less abrupt circuit designers go to great lengths to
side stepped by buying in external DC transition. A ‘snappy’ sprung pair of isolate DC by using coupling capacitors
‘wall-wart’ power supplies. contacts is shown in Fig.6. and pull-down resistors on every input
and output, as shown in Fig.7. Electronic
Switch pops Electrical vs electronic and relay switching has the additional
Power switches need to be well mains switching problem of the control signal breaking
suppressed to avoid generating audible These days, a solid-state power switch, through, giving the possibility of more
pops and clicks. This is caused by arcing such as a zero-crossing triac circuit can clicks and thumps.
when switching inductive loads, such as be used for mains switching. These can
transformers, generating electromagnetic give click-free performance and allow Latching vs momentary
interference. RC snubber networks cheap (low-current, momentary, push) Audio engineers like to be able to see
across each contact are usually necessary switches to be used rather than a clunky what position a switch is in, and they
to reduce arcing and subsequent noise. latching mechanical type. The problem is like it to stay there, even after power
In-line mains EMI (electromagnetic that the UK Health and Safety Executive loss, which means they have a strong
interference, not the British record (and others) do not consider silicon to preference for latching-type switches.
company) filters and voltage-dependent offer proper safety isolation because Momentary push switches should only
resistors (VDRs) normally complete the semiconductors fail short circuit, so an be used for doorbells! For audio, switches
job, as shown in Fig.5. additional mechanical switch is still ought to have an accompanying LED and
Switches employing built-in mains needed. (Electronic signal switching, mechanical ‘memory’. Unfortunately,
neon indicators can also generate strange as opposed to mains switching, using latching mechanisms add mechanical
EMI noises from flickering as they age. FETs is a whole subject in itself, which complexity, cost and lower reliability,
To avoid the complexity of a mains- we will come to later.) meaning they fail sooner. A lifetime of
powered power-on indicator LED, it’s 25,000 operations is typical for a good
always simplest to add the LED to the Clicks quality switch. Consumer latching types
DC side of the power supply. When switching audio there must be no last about 10,000 cycles, making the
DC present on the signal or a click will switch the shortest-life component in
Quick-make, quick-break be generated. Even a few millivolts of most audio systems.
Some power switches are designed to DC offset or capacitor charge is going The most cost-effective switch in the
switch quickly regardless of how slowly to cause an equal voltage pulse when world is the ‘tact’ switch used in car
they are moved. They have a spring switching occurs. It will also have very key fobs. I use one in my Stylophone
mechanism which defines the switching fast rise and fall times creating a lot Theremin for the sound trigger with
time. This is important for some power of audio bandwidth high frequency a big moulded springy plastic button
applications, but I don’t think it matters signals, which are clearly audible as a on top. (Fig.8) After testing lots
that much for audio. The slow ones characteristic ‘click’. This is the bane of switches with differing torque
tend to make fewer clicks and less of audio signal switching and audio ratings/actuation pressures we found
Fig.6. Close-up of switch contacts showing hysteresis-curved Fig.8. Momentary tact switch; these are used for the trigger
spring mechanism to ensure snappy action. Ideally, the contacts button on the Stylophone Theremin. They are very cheap and
should be gold plated to reduce oxide build up. available with different push-to-operate force options.
Contact material
For low-level audio signals (<100mA, down to µV
levels), gold-plated contacts ensure low distortion
since gold does not oxidise. It has to be reasonably
thick (5µm) or it may wear off when switching high Fig.12. The 1,000,000-cycle EAO pushbuttons are Swiss made with a
currents, which will ‘burn’ the gold off the contacts. price to match, but they give your front panels that Star Trek console look.
Silver-plated contacts are the next best and can be used These industrial-type switches are made by several companies. Most are
for high level (>1V) audio signals. In the presence of illuminated, often by odd filament bulbs, such as T5.5 types.
atmospheric pollution, such as from wood burners,
diesel engines and cigarette smoke, black sulphide may form shown in Fig.12, have an NO and NC pair of contacts in each
on silver contacts giving rise to crackles and distortion. These section. These can be joined together to make a changeover
contacts need to be cleaned with a contact cleaner such as switch, as shown in Fig.13.
Kontakt 60, then lubricated with Servisol or Kontakt 10 Super.
Some switches have self-wiping contacts which maintain good Make before break (MBM), break before
conductivity so long as they are moved regularly. Alps-style make (BBM)
pushbuttons (the manufacturer, not the mountain range), slider MBM and BBM are not fancy food fads, but defined forms of
and rotary types have this feature. Toggle switches, rockers and switching action. Most switches break from one contact before
pushbuttons generally don’t and thus have shorter lives. they move onto the next, thereby maintaining isolation – a
switching action called ‘break before make’ or ‘BBM’, as shown
Poles, ways and odd acronyms in Fig.14. Occasionally, on some switches with sliding contacts
If a switch has two switch positions then it is often described it can still be joined to the previous contact as it moves to the
as a ‘changeover’ (C/O or CO) switch or ‘double throw’ (DT). next one. This is achieved by making the wiper wider than the
I suspect this is a throwback to the old knife switch design spacing between the contacts. This is called ‘make before break’
(Fig.1). Two-section changeover switches are often called (MBB), or shorting contact. MBB can be a useful property in audio
‘double-pole, double-throw’ or DPDT, these are the most switching, providing a seamless transition from one signal source
common types in audio systems. A classic circuit is the effect to another, often with less chance of generating a click. MBB is
in/out switch used on guitar pedals shown in Fig.9. It’s also also useful if you want to avoid big steps, intermittently down to
useful for the motor direction reversing, channel-flip or phase- zero between switch positions with multiple resistive steps, such
change circuit shown in Fig.10. It can be used as a left/right as switched attenuators. The Fender Stratocaster guitar pick-up
channel flip. It’s easy to wire up, as shown in Fig.11. Lighting switch was originally a three position MBB switch. Guitarists
designers and electricians know them as an ‘intermediate soon realised they could move the switch to get unusual sounding
switch’, often used on stair landings. phase cancellations in the ‘intermediate’ positions (Fig.15). Fender
responded by making the switch have five positions.
Normally closed (NC), normally
open (NO)
NC
No, we’re not talking about provincial 1 2
British tea rooms; normally closed (NC) 1 NC 3 NO
Lamp
and normally open (NO) are standard A B 3 4
NO
switch nomenclature referring to the 4 NO 2 NC
default switching position. A lot of A B
pushbuttons, such as the Eao types
Lamp, typically rated
at 50mA, 24V
Normal NC 2
Input 1 1
Output 1
3 4 =
Flip
NO
Configuration to create a changeover switch
Flip
Output 2
Fig.11. (right) Rear of a DPDT toggle switch
Input 2
wired for ‘phase flip’ action. Note the Fig.13. EAO pushbuttons (see Fig.12)
Normal characteristic ‘cross over’ wiring. The two and similar switches often have two sets
wires coming in go to the cross wires and of contacts per section. One is normally
Fig.10. (above) The phase flip circuit the two wires coming out are taken from the closed (NC) and one is normally open
which switches over two lines. It could be centre tags. Electricians use an ‘X’ symbol to (NO). The NC and NO contacts change
used to flip the phase of a loudspeaker. denote an intermediate switch pattern. over when the button is pressed.
Fig.15. MBB moving contact in as their 7211 shown in Fig.18) that Right
transition joining two switch positions looks like a centre off type and has a
in a Fender-style lever switch. very versatile (but confusing) contact
arrangement, as shown in Fig.19. This
Toggles is called an ON-ON-ON switch. These
Miniature toggle switches are the most can be used to give an interesting set of
popular switching device for small- series parallel variations of pick-ups in
Left
production audio equipment because electric guitars.
they are the simplest to use. One thing to
watch out for is that the position of the Biased operation
closed contacts is usually the opposite Toggle switches can also come with a
to lever (or dolly as it is correctly called), momentary option called ‘biased’, which
as shown in Fig.16. This is not normally means it can be moved to an on position
a problem since the switch can be but springs back when released. It is
turned round if it’s hard-wired. Since possible for the switch to be biased in Fig.19. Contact positions for C&K style
the tags form the internal contacts it can one position and latching in the other. DPDT ON-ON-ON switches.
be assumed if they are gold plated the This would be called an (ON)-OFF-ON
contacts are gold. One of my favourite switch which would be centre-off with add a larger actuator. Sliders need tidy
toggle designs is the Arrow Hart Eaton the brackets denoting the momentary punched rectangular holes, so they
TS6 shown in Fig.17. I’ve had some in or biased position. I used one of these are only suitable for mass production.
continuous operation for 30 years. on a music sequencer where the biased I used them in my recent Stylophone
position is used to increment the next step theremin, as shown in Fig.20.
for tuning the note; centre is off, and ‘on’
cycles through the steps once the notes Next month
ae all tuned. I’ve also employed them In Part 2 next month we have a little
as quick trigger-off-continuous drone more mechanical switching to cover
switches for synths. before we move on to the important
subject of audio ‘silicon switching’.
Slide
These are the cheapest switches for
production audio equipment. They
came to popularity as wave-change
switches in cheap radios. They are often
found in three-position versions, used
Fig.16. On most toggle switches, with the LW/MWFM selection in mind.
when the dolly is up, it’s the bottom It’s easy to see what position they are Fig.20. Slider switches can do a lot for
contact that is closed, and vice versa. in, but they are prone to dirt ingress, low cost. I used these on my price-
Make sure you get this right for PCB- so it’s worth moulding a protective barrier-smashing Stylophone Theremin.
mounted switches. top to stop this and at the same time (Product of the year at NAMM show!)
W
e are looking at various Digital hardware and software con-
Reference(s) and
topics related to digital signal siderations may limit the number of Supplies reference selection
processing (DSP). DSP covers possible values per sample that is practical
Single ended
a wide range of electronics applications in a given DSP system, but the limit (at Digital
Out output code
where signals are manipulated, anal- the point the signal is digitised) is more In ADC
Conv Conversion
ysed, generated, stored or displayed as likely to be determined by the choice of Analogue Gnd start code
input signal
digital data, but originate from, and/or ADC (availability and affordability in the 0V
are output as, real-world signals for in- context of a particular design).
teraction with humans or other parts of ADCs input an analogue signal and
Differential
the physical world. Fig.1 shows the key typically the output is a digital numerical
elements of a generic DSP system with value as a binary integer (whole number In+ Out
Analogue ADC
input signal In–
a signal path from an analogue input value). The number of possible values in Gnd
Conv
111
2N – 1
110
101
100
011
010
001
000
0 1 2 3 4 5 6 7 Input: Vin/LSB 2N – 1
a) Input: Vin/LSB c)
Code
output
1111 An ADC’s output is a digital code which may be directly
1110 available, or via a serial interface. Bipolar ADCs must
1101 output binary values in a signed number format, typically
1100 2s-complement format is used, but consult device datasheets
1011 to be sure of the details.
1010 Something is required to control the start of the conversion
1001
process (the point in time when a sample is taken). This could
be a done via a specific input pin, an on-chip timer/oscillator,
1000
or a command sent over a serial interface. On microcontrollers,
0111
programmable on-chip timers are often used to control sample
0110
timing of on-chip ADCs.
0101
Input: Vin/LSB
110
101
–0.5 LSB
0 1 2 3 4 5 6 7
100
Fig.4. Details of a unipolar mid-tread ADC transfer function. SNR = 6.02×N + 1.76 dB
– FSR) is set by two reference voltages in the ADC circuit – Adding an extra 1 bit of resolution provides about 6dB
the low reference voltage (VRefL) and the high reference voltage improvement in the SNR. This is for an ideal converter; real
essing (VRefH
Topics ), see Fig.4. Often the low reference is ground, but it does
– ADCs converters will add additional noise.
ing Topics – ADCs
not have to be. An N-bit ADC converts analogue input data Thinking about the size of an LSB is useful when designing
into 2N codes. The voltage difference between adjacent codes a system containing ADCs. The resolution used should be
is called the ‘least-significant bit’ (LSB), which is given by: commensurate with the accuracy and SNR requirements of
(𝑉𝑉RefH the system. Too low and the ADC may be the weakest link, but
𝐿𝐿𝐿𝐿𝐿𝐿 (𝑉𝑉RefH − 𝑉𝑉−RefL ) )
𝑉𝑉RefL
𝐿𝐿𝐿𝐿𝐿𝐿 == & 2 & if it is much higher than necessary you may be wasting your
2 money. Table 1 helps provide an idea of the size of 1 LSB by
For example, if a 12-bit ADC has VRefL = 0 and VRefH = 5V then expressing it as a percentage or parts per million of full input
the LSB is given by: range and as a voltage for an ADC with a 5V range. The SNR
due to the quantisation error is also given.
LSB 5 5 5 5 = 1.22mV
LSB = =12 2=12 = 4096
= 1.22mV
2 4096 Offset and gain errors
The transfer functions shown in Fig.3 and Fig.4 have the first Zero-scale error is the difference between the actual and ideal
transition 0.5 LSB above the bottom end of the FSR and the final transition voltage to the first code, as shown in the example
transition 1.5 LSB below the top of the FSR. This is a common in Fig.6 where the error is about +1.75 LSB. As with many
approach and is referred to as a ‘mid-tread’ transfer function ADC characteristics, this error is usually expressed in terms
because the point in the middle of the FSR at (VRefL – VRefH)/2 of LSBs rather than absolute voltage values since this is better
(input = 4 in Fig.4) coincides with a flat part of staircase (the for making comparisons between ADCs. ADCs may have a
tread if it were a real staircase). Shifting the transfer function constant DC offset error – a fixed DC error across the entire
0.5 LSB results in a mid-riser transfer function, which has a conversion range. If there are no other sources of error then the
code transition at the middle of the FSR. ADC datasheets often offset error and zero-scale error will be the same (as in Fig.6).
have diagrams like Fig.4 which explain the device’s specific However, in general this is not guaranteed.
transfer function. You may see the LSB defined as: range/(2N – 1), In Fig.4 we saw a comparison between the ideal straight
which may be valid for some transfer functions. line transfer function and the actual step by step function of
111 111
110 110
101 101
100 100
011 011
010 010
001 001
000 000
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7
VRefL VRefH VRefL Input: Vin/LSB VRefH
Input: Vin/LSB
Offset error and Transfer function Ideal transfer function
zero-scale error with offset error
Fig.6. Example of ADC zero-scale and offset errors. Fig.7. ADC full-scale and gain errors.
a perfect ADC with a limited number of bits. Fig.7 shows an Monotonicity and missing codes
ADC in which the slope of this ideal line, as extrapolated from The errors we have considered so far (offset and full scale) do
the staircase, is different from what it should be; that is, the not cause any deviation from a uniform ‘staircase’ which could
ADC has a gain error. An effect of gain error is that the input be represented by an ideal straight line. In general, ADCs do
voltage at which the transition to the largest output code will not have such perfect straight-line transfer functions. Errors
be wrong, as shown in Fig.7. which cause deviations from this are called nonlinearities.
The full-scale error of an ADC is the difference between the Before looking at nonlinearities in general we will define
actual and ideal final code transition voltage. The ADC transfer a couple of special cases, which represent relatively large
function in Fig.6 only has full-scale error, but a real device may anomalies in the transfer function.
have a zero-scale error as well. If an ADC has no nonlinearities Fig.8 shows an ADC transfer function with a missing code. A
and no zero-scale error, or if the offset is removed by shifting the missing code means that the ADC never outputs some digital
transfer function accordingly, the resulting full-scale error will code values, whatever input is applied. This looks very dramatic
be related to only the error in gain (slope of the ideal transfer in Fig.5 but would seem less so with more bits. If your design
function). Thus gain error for an ADC can be defined as uses an ADC with a few more bits than you really need then
missing codes will probably not be a problem. ADCs may be
Gain Error = Full Scale Error – Zero Scale Error guaranteed to have no missing codes – this will usually be
stated on the datasheet.
Like offset error, this definition may be problematic if the ADC Ideally, increasing the input voltage to an ADC will either
has significant nonlinearities around the final transition voltage. not change the output code or produce a higher code value.
If increasing the input voltage produces a lower code value
at any point over the ADC’s input range then the converter is
Code Code 011 is missing. Output
output jumps straight from 010 to 100. said to be ‘non-monotonic’. This is illustrated in Fig.9. ADC
datasheets will usually state if a device is guaranteed to be
111 monotonic. Monotonicity is particularly important if the ADC
is part of a feedback loop since non-monotonicity can lead to
110 instability of the loop (oscillations).
101 Linearity
Two key parameters for characterising the quality of an ADC’s
transfer function are differential non-linearity (DNL) and
100
integral non-linearity (INL). These indicate how much the
transfer function deviates from a straight line. DNL measures
011
the difference between the ideal and actual code widths. The
code width is the range of voltage for which a particular code
010 is output by the ADC – it is the width of each ‘tread’ in the
staircase transfer function. Ideally, the code width is 1 LSB,
001 which corresponds with a DNL of 0. Other code widths have
non-zero DNLs, for example, if the code with is 1.5 LSB the
000 DNL is +0.5.
0 1 2 3 4 5 6 7 DNL and INL are illustrated in Fig.10 which shows an ADC
VRefL Input: Vin/LSB VRefH
transfer function with significant nonlinearity. INL measures
the accumulation of error as one moves through the converter’s
Fig.8. ADC transfer function with a missing code.
codes (the sum of INL’s from the first code to the current code). A
111 111
DNL = +0.25
110 110
DNL = +0.5
101 101
DNL = 0
100 100
DNL = 0
011 011
DNL = –0.25 Bit DNL in LSB INL in LSB
1 –0.5 –0.5
010 2 –0.25 –0.75
010 DNL = 3 0 –0.75
–0.5
4 0 –0.75
001 001
000 000
0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 8
VRefL Actual transfer function Ideal straight line Input: Vin/LSB VRefH
VRefL Input: Vin/LSB VRefH is not a straight line. transfer function
Fig.9. Non-monotonic ADC transfer function. Fig.10. Nonlinear ADC transfer function showing DNL and INL values.
missing code has a DNL of −1.0. The transfer function in Fig.10 The relative importance of absolute accuracy (measuring
does not have any zero-scale or full-scale errors – these are the actual input voltage) and linearity (avoiding distortions
usually corrected before DNL and INL are calculated to provide in the sampled signal) depends on the type of application.
more meaningful linearity values. The maximum positive and In applications where absolute ADC accuracy is important
negative DNL and INL values may be given on the datasheet. it is common to include some form of calibration process
For more than a few bits it is not practical to list all values but (eg, in software, and sometimes on-chip) and possibly
graphs of DNL and INL against digital code may be provided. temperature compensation.
Teach-In 8 CD-ROM EE
FR -ROM
CD
ELECTRONICS
£8.99
SERIES
FOR
THE TEACH-IN
8
This CD-ROM version of the exciting and popular Teach-In 8 series INTRODUCING THE ARDUINO
• Hardware – learn about components and circuits
has been designed for electronics enthusiasts who want to get to • Programming – powerful integrated development system
• Microcontrollers – understand control operations
SOFTWARE
The CD-ROM contains the software for both the Teach-In 8 and PICkit 3 series.
PCBs for most recent PE/EPE constructional projects are available. From the July 2013 issue onwards, PCBs with eight-digit codes
have silk screen overlays and, where applicable, are double-sided, have plated-through holes, and solder mask. They are similar to
photos in the project articles. Earlier PCBs are likely to be more basic and may not include silk screen overlay, be single-sided, lack
plated-through holes and solder mask.
Always check price and availability in the latest issue or online. A large number of older boards are listed for ordering on our website.
In most cases we do not supply kits or components for our projects. For older projects it is important to check the availability
of all components before purchasing PCBs.
Back issues of articles are available – see Back Issues page for details.
All prices include VAT and UK p&p. Add £4 per project for post to Europe; £5 per project outside Europe.
Orders and payment should be sent to:
Practical Electronics, Electron Publishing Ltd
113 Lynwood Drive, Merley, Wimborne, Dorset BH21 1UU
Tel 01202 880299 Email: shop@[Link]
On-line Shop: [Link]
Cheques should be made payable to ‘Practical Electronics’ (Payment in £ sterling only).
NOTE: Most boards are in stock and sent within seven days of receipt of order, please allow up to 28 days delivery if we need to restock.
Practical
Electronics
If you want your advertisements to be seen by the largest readership
at the most economical price then our classified page offers excellent Practical Electronics
value. The rate for semi-display space is £10 (+VAT) per centimetre reaches more UK
high, with a minimum height of 2·5cm. All semi-display adverts have a readers than any other
width of 5.5cm. The prepaid rate for classified adverts is 40p (+VAT) per UK monthly hobby
word (minimum 12 words).
electronics magazine.
Cheques are made payable to ‘Practical Electronics’. VAT must be
Our sales figures prove it.
added. Advertisements with remittance should be sent to: Practical
Electronics, 113 Lynwood Drive, Wimborne, Dorset, BH21 1UU. We have been the leading
Tel 07973518682 Email: pe@[Link] monthly magazine in
BOWOOD ELECTRONICS LTD
For ratesofand
Suppliers further
Electronic information on display and classified advertising
Components this market for the last
please contact our Advertisement
[Link] Manager, Matt Pulzer – see below. twenty-seven years.
Unit 10, Boythorpe Business Park, Dock Walk, Chesterfield,
Derbyshire S40 2QR. Sales: 01246 200 222
Send large letter stamp for Catalogue
ADVERTISING INDEX
CRICKLEWOOD ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . 27 Advertisement offices
ESR ELECTRONIC COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . 47 Matt Pulzer
HAMMOND ELECTRONICS Ltd . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
JPG ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Electron Publishing Ltd
FLOWCODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 39
1 Buckingham Road
MICROCHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cover (ii)
Brighton
PEAK ELECTRONIC DESIGN . . . . . . . . . . . . . . . . . . . . . . Cover (iv) East Sussex BN1 3RA
POLABS D.O.O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 43 Tel 07973 518682
QUASAR ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Email pe@[Link]
SILICON CHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
STEWART OF READING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 57 Web [Link]
TAG-CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 27
TERRINGTON COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 For editorial contact details see page 7.
JPG Electronics
Britannia Maison Mes Amis
Bournemouth BH1 9EH, United Kingdom
Inn
Old Road Remember, we print the date of the last issue
of your current subscription in a box on the
ad
d
Roa
address sheet that comes with your copy.
Old H
orth
tsw
Cha
Morrisons
Sparks
Digital subscribers, please call 01202 880299
Retail & Trade Welcome • Free Parking • Google St View Tour: S40 2RB or visit: [Link]
Published on approximately the first Thursday of each month by Electron Publishing Limited, 1 Buckingham Road, Brighton, East Sussex BN1 3RA. Printed in England by Acorn Web Offset Ltd., Normanton WF6
1TW. Distributed by Seymour, 86 Newman St., London W1T 3EX. Subscriptions UK: £33.99 (6 months); £59.99 (12 months); £114.99 (2 years). EUROPE: airmail service, £38.99 (6 months); £69.99 (12 months);
£129.99 (2 years). REST OF THE WORLD: airmail service, £46.99 (6 months); £84.99 (12 months); £164.99 (2 years). Payments payable to ‘Practical Electronics’, Practical Electronics Subscriptions, PO Box
6337, Bournemouth BH1 9EH, United Kingdom. Email: pesubs@[Link]. PRACTICAL ELECTRONICS is sold subject to the following conditions, namely that it shall not, without the written consent of the
Publishers first having been given, be lent, resold, hired out or otherwise disposed of by way of Trade at more than the recommended selling price shown on the cover, and that it shall not be lent, resold,
hired out or otherwise disposed of in a mutilated condition or in any unauthorised cover by way of Trade or affixed to or as part of any publication or advertising, literary or pictorial matter whatsoever.
nics
The UK
Circuit Surgery Teach-In 2024 ’s pAudio
remieOut
r electr
Topics in digital signal Using LED displays with the
CircESP32
uit
Mechanical
o
in audio nics and
processing – ADCs SoC microcontroller Topics Surgerswitches
y compu
proce
in digit
ssing – al signal
ting ma
Teach
-
Analog In 2024
ker ma
sampli
ng ue inp gazine
WIN! theE SP32 S ut an d ou
Microchip oC microc tput with Audio
Curiosity HPC ontrolle O
Design ut
r in
Development
Board Loudspeaker discrete g
buffers
WIN! Test Jig
Cool B
o Tadelights
Cool Beans – Arduino: 7-segment display lk – One b
eansEV
Net Work – GaN USB chargers, solid-state battery step c 9 772632 573030 r’s pro
Net W
ork – E
– Ardu
ino: 7-s
loser t
o a dy
s to
ject
lectric e gment p ian ab
[Link] @practicalelec c ars practicalelectronics
disp yss?
www.e , Moon la May 2
lectro -shot m y delights 024 £
5.99
npubli issions
shing and
.com more 05
@prac 9 77263
ticale 2 573
lec
030
practi
calele
ctronic
s
You read that right! We now sell the current issue of your favourite electronics
magazine for exactly the same price as in the High Street, but we deliver it
straight to your door – and for UK addresses we pay the postage. No need to
journey into town to queue outside the newsagent. Just go to our website, set
up an account in 30 seconds, order your magazine and we’ll do the rest.
[Link]