0% found this document useful (0 votes)
413 views76 pages

Jun24 Int

The June 2024 issue of Practical Electronics features various projects and articles, including a Wi-Fi time source for GPS clocks and a heart rate sensor module. It introduces the PIC18-Q20 family of microcontrollers with advanced communication interfaces and highlights a Teach-In series on using the ESP32. Additionally, the magazine includes regular columns on technology and electronics, along with opportunities to win development boards and test jigs.

Uploaded by

navaltronica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
413 views76 pages

Jun24 Int

The June 2024 issue of Practical Electronics features various projects and articles, including a Wi-Fi time source for GPS clocks and a heart rate sensor module. It introduces the PIC18-Q20 family of microcontrollers with advanced communication interfaces and highlights a Teach-In series on using the ESP32. Additionally, the magazine includes regular columns on technology and electronics, along with opportunities to win development boards and test jigs.

Uploaded by

navaltronica
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 76

Practical

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

Wi-Fi Time Source


for GPS Clocks

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

[Link] @practicalelec practicalelectronics


Flexible Communication with I3C® and I2C
Compatibility
With the Versatile PIC18-Q20 Family of MCUs
The PIC18-Q20 family of microcontrollers (MCUs) offers configurable peripherals, advanced communication
interfaces and supports multiple voltage domains for embedded systems containing several sensors.
These MCUs are equipped with I3C® modules that have a fast communication rate, a high-speed 10-bit
Analog-to-Digital Converter with Computation (ADCC), capacitive touch sensing and an 8-bit signal routing
port to interconnect digital peripherals. This product family easily interfaces across multiple voltage
domains without external components, supporting 1V operation for I3C communication. The MCUs are
well-suited as a I3C-to-I2C communication bridge or a companion MCU for larger IoT systems to perform
housekeeping functions for an extensive range of space-sensitive applications and markets including IoT,
computing, consumer, medical, wearables, touch sensing and memory management applications.

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

The Microchip name and logo and the Microchip logo


are registered trademarks of Microchip Technology
Incorporated in the U.S.A. and other countries. All other
trademarks are the property of their registered owners.
© 2024 Microchip Technology Inc. All rights reserved.
[Link]/q20 MEC2550A-UK-01-24
Practical
Volume 53. No. 6
June 2024
ISSN 2632 573X

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.

Series, Features and Columns


Techno Talk by Max The Magnificent 8
Program that!
Net Work by Alan Winstanley 10
Reports on USB-type chargers, including Power Delivery (PD) rapid charging and GaN
devices. Plus, a new EV with a long-range, fast-charging solid-state battery from China.

Teach-In 2024 – Learn electronics with the ESP32 by Mike Tooley 44


Part 4 – Using LED displays
Max’s Cool Beans by Max The Magnificent 52
Arduino Bootcamp – Part 18
Audio Out by Jake Rothman 58
Switching in audio equipment – Part 1
Circuit Surgery by Ian Bell 63
Topics in digital signal processing – ADCs

Regulars and Services


Wireless for the Warrior 2
Subscribe to Practical Electronics and save money 4
NEW! Practical Electronics back issues DOWNLOADS – 2022 now available! 6
Reader services – Editorial and Advertising Departments 7
Editorial 7
Test your speakers!
Exclusive Microchip reader offer 9
Win a Microchip Curiosity HPC Development Board
PE Teach-In 9 23
Teach-In bundle – what a bargain! 51
PE Teach-In 8 67
Made in the UK. Practical Electronics PCB Service 68
PCBs for Practical Electronics projects
Written in Britain, Australia, Classified ads and Advertiser index 71
the US and Ireland.
Next month! – highlights of our next issue of Practical Electronics 72
Read everywhere.
© Electron Publishing Limited 2024
Copyright in all drawings, photographs, articles,
technical designs, software and intellectual property
published in Practical Electronics is fully protected,
and reproduction or imitation in whole or in part are
expressly forbidden.
The July 2024 issue of Practical Electronics will be
published on Thursday, 6 June 2024 – see page 72.

Practical Electronics | June | 2024 1


WIRELESS FOR
THE WARRIOR
by LOUIS MEULSTEE
THE DEFINITIVE TECHNICAL HISTORY OF RADIO
COMMUNICATION EQUIPMENT IN THE BRITISH ARMY

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.

ORDER YOURS TODAY!


JUST CALL 01202 880299 OR VISIT [Link]
All prices include 20% VAT. Free UK mainland delivery on orders over £60.
Quasar Electronics Limited Postage & Packing Options (Up to 1Kg gross weight): UK Standard 2-5 Day
PO Box 6935, Bishops Stortford Delivery - £4.95 : UK Mainland Next Day Delivery - £9.95 : Please order online
CM23 4WP, United Kingdom if you reside outside the UK (our website will calculate postage for you).
Payment: We accept all major credit/debit cards. Make UK cheques/PO’s
payable to Quasar Electronics Limited and include P&P detailed above.
Tel: 01279 467799 !! Order online for reduced price postage and fast despatch !!
E-mail: sales@[Link] Please visit our online shop now for full details of over 1000 electronic kits,
Web: [Link] projects, modules and publications. Discounts for bulk quantities.

Solutions for Home, Education & Industry Since 1993

NEW! Mr Robot Kit Digitally Controlled FM Radio Kit


A fun, wearable electronic Build your
gadget that you can pin to your own mod-
clothes. Easy to solder begin- ern, high
ners kit. Two flashing bicolour quality FM
LEDs resemble the eyes. 65 x receiver
40 x 15 mm. CR2032 battery project with
powered (not included). excellent
Order Code: WSL108 - 6.68 sensitivity
powered
LED Electronic Dice Kit by a simple
Still popular! A must-build 9V PP3
soldering kit for all beginners. battery (not included. Auto-seeking button. 4
Dice slowly rolls to stop on a station presets. Volume control. Excellent
Great Brands - Official Main Dealer random number when the learning project for schools and colleges.
push button is released. 9V Order Code: WSAH194 - £20.39
battery (not included). Ideal
Electronic Kits & Modules for educational courses. Wide Audio Analyser Display Kit
We have a massive selection of self- selection of component types.
assembly electronic kits and pre- Order Code: MK109 - £7.08
assembled modules. Please see the full
range on our website or call for details. 3 Channel RGB LED Light Organ Kit

LED Buddy / LED Tester Kit


Hold any
type of
LED to Small, compact LCD display, ideal for panel
the con- mounting. Give your homemade audio gear
tact pads 3 outputs react to different sound frequen- a high-tech look. Upgrade existing equip-
to see it's cies. On-board microphone picks up sur- ment. Provides Peak Power, RMS Power,
polarity, rounding sound or music and drives the low, Mean dB, Peak dB, Linear Audio Spectrum
forward voltage & the recommended series mid & high frequency outputs. Connect 12- And 1/3 Octave Audio Spectrum. Auto /
resistor value. Adjustable target current & 24Vdc RGB or separate colour LED strips or Manual range selection. Peak-hold function.
forward voltage. Great design aid. LEDs (not included). Master & separate Speaker impedance selection.
Order Code: WSMI198 - £16.66 channel sensitivity adjustment. 1.25 A max. Order Code: K8098 - £38.39
per channel. Panel mountable facia 127 x
12-in-1 Solar Hydraulic Construction Kit 44mm. Terminal block or jack power supply Electronic Component Tester Kit
Solar & hydraulic connection. Control knobs included. Build your
powered robot Order Code: WSL209 - £14.10 own versa-
can be trans- tile compo-
formed into twelve Signal Generator Kit nent test-
different animals Sine wave, triangle, square er. Shows
and mechanical wave and integrator value and
robots (monkey, (selectable through jumper) pin layout
T-Rex, scorpion, with 0 - 100Vrms adjustable infor-
excavator, etc). Moves easily. Provides great output level. 1kHz (approx.) mation for
interaction with kids. Teaches the benefit of fixed signal frequency. 9V resistors
alternative energy. Aged 14+. battery (not included). (0.1 Ohm
Order Code: KSR17 - £29.95. Order Code: resolution,
WSAH105 - £6.12 max. 50M Ohm), coils (0.01mH - 20H), ca-
Stereo Ultrasonic Bat Detector Kit pacitors (28p - 100mF), diodes, BJT, JFET,
Bidirectional DC Motor Speed Controller E-IGBT, D-IGBT, E-MOS & D-MOS.
Control the Order Code: WSMI8115 - £44.15
speed of most
common DC LCD Oscilloscope Educational Kit
motors (rated Build your own
up to LCD oscillo-
28Vdc/5A) scope with this
from fully OFF exciting new
to fully ON in kit. Learn how
both direc- to read signals.
Educational & fun kit converts high frequen- tions. Single potentiometer controls speed & See the elec-
cy sounds (20 - 90kHz) normally impercepti- direction. Screw terminal block connectors. tronic signals
ble to humans like bat signals into audible PCB: 90x42mm. Not suitable for use with you learn about
noise. Can also help detect failures in ma- lead acid batteries! displayed on your own LCD oscilloscope.
chines, engines, etc. Stereo feature adds the Kit Order Code: 3166KT - £19.96 Despite the low cost, this oscilloscope kit
possibility to pinpoint the source. Frequency Assembled Order Code: AS3166 - £29.95 has a lot of features found on expensive
range 20-90kHz. 3.5mm jack output. units like signal markers, frequency, dB, true
129x60x40mm. Requires 3x AA batteries RMS readouts and more. A powerful auto-
and stereo headphones (not included). Card Sales setup function will get you going in a flash!
Order Code: WSAK8118 - £20.39 & Enquiries Order Code: WSEDU08 - £48.54
Practical
Electronics
UK readers SAVE £1 on every issue

SUBSCRIBE NOW! Practical


Electronics
The UK’s premier electronics and computing maker magazine
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Practical
Electronics
The UK’s premier electronics and computing maker magazine

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.

Overseas rates represent exceptional value


You also: • Avoid any cover price increase for the duration of your subscription
• Get your magazine delivered to your door each month
• Guarantee a copy, even if your local newsagent sells out
Order by: • Phone or post with a cheque, postal order or credit card
• Or order online at: [Link]

Practical SUBSCRIPTION ORDER FORM


 6 Months:.UK £33.99, Europe £38.99 (Airmail),

Electronics
Rest of the World £46.99 (Airmail)
 1 Year: UK £59.99, Europe £69.99 (Airmail),
Rest of the World £84.99 (Airmail)

SUBSCRIPTION PRICES  2 Years: UK £114.99, Europe £129.99 (Airmail),


Rest of the World £164.99 (Airmail)
Subscriptions for delivery direct to any address in: To: Practical Electronics Subscriptions
PO Box 6337
UK: 6-months £33.99, 12-months £59.99, 24-months £114.99 Bournemouth BH1 9EH
Europe Airmail: 6-months £38.99, 12-months £69.99, United Kingdom
24-months £129.99 Tel: 01202 087631
Email: pesubs@[Link]
Rest Of The World Airmail: 6-months £46.99, 12-months
£84.99, 24-months £164.99 I enclose payment of £ ..............
(cheque/PO in £ sterling only)
Cheques (in £ sterling only) payable to Practical Electronics payable to Practical Electronics
and sent to: Practical Electronics Subscriptions, PO Box 6337,
 Please charge my Visa/Mastercard
Bournemouth BH1 9EH, United Kingdom
My card number is: .......................................................................
Tel: 01202 087631 Please print clearly, and check that you have the number correct
Email: pesubs@[Link]
Card Security Code .................. Valid From Date........................
Also via our online shop at: [Link] (The last 3 digits on or just under the signature strip)

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 ........................................................................................

Post code .................................. Tel. ...........................................


DIGITAL SUBSCRIPTIONS
Electronic subscriptions are available from £29.99 for 12 months, Email ............................................................................................
more details at: [Link] Subscriptions start with the next available issue.

4 Practical Electronics | June | 2024


Subscribe to The VERY BEST DIY
Projects!
MAY 2023
ISSN 1030-2662

9 771030 266001
$1150* NZ $1290
05

INC GST
INC GST

Melbourne Exhibition Centre,


May 10-11

Australia’s
International Airsho
All the newest tech
in Avalon Airpor
w
t

Australia’s top electronics magazine


Silicon Chip is one of the best DIY electronics magazines in the Published in
world. Each month is filled with a variety of projects that you can build Silicon Chip
yourself, along with features on a wide range of topics from in-depth
electronics articles to general tech overviews.

Print Combined Online


$100 $110 $50
The History of Computer
6 months ≈₤53 ≈₤59 ≈₤27 Memory; Jan-Feb 2023
≈€62 ≈€68 ≈€31
$195 $215 $95
1 year ≈₤105 ≈₤115 ≈₤51
≈€120 ≈€132 ≈€58
Raspberry Pi Pico W
$380 $415 $185 BackPack; January 2023
2 years ≈₤205 ≈₤223 ≈₤100
≈€234 ≈€255 ≈€114

• 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

To start your subscription go to


[Link]/Shop/Subscribe
DOWNLOAD YOUR PE/EPE BACK ISSUES
COMPLETE-YEAR collections – all 12 issues for each year!
From just £5.95 each
VOL 28 – January to December 1999 – £5.95 VOL 40 – January to December 2011 – £12.95
VOL 29 – January to December 2000 – £6.95 VOL 41 – January to December 2012 – £14.95
VOL 30 – January to December 2001 – £7.95 VOL 42 – January to December 2013 – £15.95
VOL 31 – January to December 2002 – £7.95 VOL 43 – January to December 2014 – £16.95
VOL 32 – January to December 2003 – £7.95 VOL 44 – January to December 2015 – £17.95
VOL 33 – January to December 2004 – £7.95 VOL 45 – January to December 2016 – £19.95
VOL 34 – January to December 2005 – £8.95 VOL 46 – January to December 2017 – £22.95
VOL 35 – January to December 2006 – £8.95 VOL 47 – January to December 2018 – £27.95
VOL 36 – January to December 2007 – £8.95 VOL 48 – January to December 2019 – £27.95
VOL 37 – January to December 2008 – £8.95 VOL 49 – January to December 2020 – £29.95
VOL 38 – January to December 2009 – £10.95 VOL 50 – January to December 2021 – £32.95
VOL 39 – January to December 2010 – £11.95 VOL 51 – January to December 2022 – £34.95 – NEW!

FIVE-YEAR collections – 60 issues!


From just £14.95 each
PE2832: Jan 99 to Dec 03 – £14.95 PE3842: Jan 09 to Dec 13 – £33.95
PE2933: Jan 00 to Dec 04 – £14.95 PE3943: Jan 10 to Dec 14 – £33.95
PE3034: Jan 01 to Dec 05 – £14.95 PE4044: Jan 11 to Dec 15 – £33.95
PE3135: Jan 02 to Dec 06 – £14.95 PE4145: Jan 12 to Dec 16 – £35.95
PE3236: Jan 03 to Dec 07 – £14.95 PE4246: Jan 13 to Dec 17 – £37.95
PE3337: Jan 04 to Dec 08 – £14.95 PE4347: Jan 14 to Dec 18 – £38.95
PE3438: Jan 05 to Dec 09 – £19.95 PE4448: Jan 15 to Dec 19 – £39.95
PE3539: Jan 06 to Dec 10 – £25.95 PE4549: Jan 16 to Dec 20 – £42.95
PE3640: Jan 07 to Dec 11 – £25.95 PE4650: Jan 17 to Dec 21 – £44.95 – NEW!
PE3741: Jan 08 to Dec 12 – £25.95

20 YEARS OF PE! PE2832: Jan 99 to Dec 03


PLUS!
AMAZING BUNDLE OFFER PE3337: Jan 04 to Dec 08
Every issue from 1999 – 2018 PLUS!

240 magazines for just


PE3842: Jan 09 to Dec 13
PLUS!
£59.95 PE3447: Jan 14 to Dec 18

Do you have the 15-year bundle?


Upgrade to the new 20-year bundle for just £14.95 with: PE15to20

Download your collections at: [Link]


Practical
Volume 53. No. 6
June 2024
ISSN 2632 573X

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.

Practical Electronics | June | 2024 7


Program that! Techno Talk
Max the Magnificent

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!

8 Practical Electronics | June | 2024


Exclusive offer

Win a Microchip Curiosity


HPC Development Board
Practical Electronics is offering its readers the chance to win in application development. All connections to the mikroBUS
a Microchip Curiosity HPC Development Board (DM164136) – headers, LEDs, switches and potentiometer are labelled with
and even if you don’t win, receive a 15%-off voucher, plus free the microcontroller port name for ease of programming. The full
shipping for one of these products. pin breakout of the microcontroller is provided to expand the
flexibility of the Curiosity HPC Development Board.
Curiosity HPC is the perfect platform to harness
the power of modern 8-bit PIC microcontrollers. The Curiosity HPC Development Board can also

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

How to enter February 2024 winner


For your chance to win a Microchip Curiosity HPC Jason Parsons
Development Board or receive a 15%-off voucher,
including free shipping, enter your details in the
online entry form at:
[Link]

Closing date Jason won a


The closing date for this offer is 31 May 2024
Microchip PIC-IoT WG Development Board

Practical Electronics | June | 2024 9


Net Work
Alan Winstanley
This month the use of USB-type chargers is considered, including an explanation of Power Delivery
(PD) rapid charging, GaN-based chargers and other features to look out for. A new EV with a long-
range, fast-charging solid-state battery could also be heading our way from China.

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.

10 Practical Electronics | June | 2024


The non-descript USB-C port on the side USB charging ports are increasingly A ‘dumb’ 5V charger built into a touch-
of this 20,000mAh powerbank provides found on domestic mains wall outlets. operated bedside light. Silicone rubber dust
bidirectional rapid charging. ([Link]) covers are a good idea, available separately.
is fast becoming irrelevant – instead of users at the moment. Laptop users need To meet the need for faster charging times
blue, each one on my laptop is black! The even higher ratings, with up to 240W and higher power, intelligent electronics
latest USB 4 standard sees data transfer becoming available as new technical is used to overcome the limitations of
rates of up to 40 Gbps and, looking ahead, standards are agreed, remembering that the legacy 5V rail, which originally only
readers can expect to see all manner these utilise USB-C type connectors supplied up to a couple of watts for 5V
of confusion arising from the use of instead of the clunky DC power jacks plug-and-play devices. Power delivery
USB-C and USB 4 cables. As computer we’ve used for decades (as shown in Net (PD) standards offer fast charging through
manufacturer Lenovo reminds us, they Work, September 2023). a USB-C port, as PD-compatible products
are not interchangeable, and you can read A basic ‘dumb’ 5V switched-mode supply can interact to raise the voltage and current,
more on this at: [Link] might be limited to, say, 2A or less, but thereby reducing the charging time. Spec
using them to charge modern high-power sheets show how a typical PD power
Express power delivery devices can take an inordinately long time.
Still on the theme of USB-type power USB chargers rated at 5V, 2-2.4A (P = IV,
supplies, users of modern smartphones so 10-12W) also find their way into 13A
and laptops increasingly focus on a mains wall outlets and power strips. Basic
charger’s wattage and the time taken to 5V A-type ports even appear in bedside
recharge. Mains chargers with power lights, offering overnight phone charging.
ratings approaching 100W or more are I use silicone rubber port covers, available
marketed, though, judging by Amazon’s from AliExpress for next to nothing, to
range, 30-40W chargers are more likely stop debris falling in or shorting out the
a cost-effective choice for many mobile USB outlet.
This tiny USB-C inline monitor fits a
USB-C plug so you can keep an eye on
charging progress.

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.

1455 extruded enclosures


Learn more: new
[Link]/1455 square
profiles
uksales@[Link]
01256 812812

Practical Electronics | June | 2024 11


attracted to a compact ‘Nexode Mini them are plain wacky or weird microcars
30W’ (maximum) type made by Ugreen. and, happily, most will stay put in China
It has fold-away mains pins – a good idea where sales of EVs and NEVs (tiny
when travelling – and the specification Neighbourhood Electric Vehicles) have
is typical of rapid chargers, switching gone through the roof. Even smartphone
intelligently between 5V, 9V, 15V and makers are getting in on the act: Xiaomi
20V and supporting PD3.0, QC3 and has just launched the $30-42,000 SU7
other protocols. This entry-level model luxury sedan range – call it up at:
costs just £13, however it only has a [Link]
single USB-C port. A suitably rated good- BYD – Build Your Dreams – produces
quality USB cable should be used. It some thirty EV models according to the
feels solid and well made, and unlike database, selling three million last year
many anonymous imported types I was in China alone. In mainland Europe,
This Ugreen USB PD-compatible charger pleased to see a proper EU Certificate the EV market faces uncertain times as
uses GaN semiconductors for compact of Conformity included, so everything private buyers shun costly EVs and hang
size and greater efficiency. It has a seems traceable as it should be. Another on to their petrol and hybrids cars. As
USB-C port and the mains pins fold flat Ugreen model has both an A-type and USB the market evolves, major brands like
for portability. C-type port, and other versions rated up BYD will slug it out with Tesla for market
charger can offer 5V, 9V, 12V and maybe to 160W are sold, priced at about £100. share, perhaps with US import tariffs
15V and 20V output voltages, all from This compactness of this charger is imposed to throttle sales of Chinese
a single USB port. With power levels down to the use of GaN (gallium nitride) EVs in America.
exceeding 100W and even reaching 240W, power semiconductors rather than silicon. Some EV brands mentioned in previous
uprated USB cables with appropriate It’s claimed that GaN is as reliable as columns have since fallen on hard times.
current ratings become necessary to get the silicon, and as GaN is more efficient Highly regarded Polestar is losing Volvo’s
most from the system. Some fast-charge and can operate at higher temperatures, financial backing and Geely (who also
leads even have a built-in LED. a greater power density means less own Volvo) will take over. In the May
The technicalities of power delivery heatsinking and cooling are needed, 2022 issue, I described Fisker’s green,
are beyond the scope of this column, so a smaller but more powerful charger recycled electric SUV credentials – so far
but PD can be observed in action using can be manufactured. When choosing a in 2024, Fisker has sold just 207 cars in
digital monitors that are cheaply available mains charger, a GaN type would make the UK. (BYD sold 1,278, about the same
online. A larger USB monitor is shown in a good choice today and would likely be number as Polestar, but Tesla sold nearly
the photo on the previous page that fits future proof too. ten times more, 11,768.) According to
an A-type socket and displays the output GaN semiconductors are most often Fleet News, Fisker is slashing prices by
on 7-segment displays. No longer is a used in industrial power electronics, £14,000 to shift unsold stocks, but buyers
USB rail clamped at 5V – by connecting and more background can be found will have to accept that Fisker’s after-sales
my smartphone to a PD-compatible on the Texas Instruments website at: service, support and warranty claims will
powerbank, I saw the 5V supply rail [Link] be severely restricted. This is symptomatic
jump to 9V at nearly 1.5A before settling The physics and merits of GaN power of the turmoil facing the EV sector: I’m
down until charging was complete. A devices themselves are detailed in an reminded of DeLorean’s failed efforts to
typical smartphone can be fully charged academic paper, GaN-based power device: build a futuristic car in 1980s Northern
in 90 minutes or less, this way. physics, reliability and perspectives Ireland, but we’ve seen nothing yet, as
Suppliers such as AliExpress offer hosted on the HAL (Hyper Articles more new brands and developments are
scores of USB monitors and higher power en Ligne) Open Science website at: coming over the horizon.
connecting leads, which can be handy [Link]
for checking a device’s charging status at Solid-state Survivor
a glance. The photos above also show a The direction of travel An emerging Chinese brand, IM Motors,
tiny add-on USB-C inline monitor against Depending on one’s lifestyle, there’s (Innovation in Motion) is an EV joint
a 50p piece for size comparison, which no doubt that electric vehicles are the venture created to beat Tesla head on,
shows wattage and a ‘PD’ icon when perfect solution for some motorists, but and it’s launched a market first: the IM
charging a phone and power delivery is their impracticalities and drawbacks L6 is a mid-size saloon that they claim
operating. These cost just a few pounds are well known. It’s
from Temu or AliExpress. been suggested that
A detailed summary of USB PD more British motorists,
protocols can be found on Wikipedia deterred by the huge
at: [Link] list prices, will likely
Quick Charge or ‘QC’ is an alternative sign up to car dealer
fast-charging protocol used on some subscription plans (or
devices, and other proprietary systems ‘renting them’ as it’s also
are also available. With so many factors called), instead of buying
to think about, it’s easy to see the outright and risking huge
appeal of wireless charging instead of depreciation and repair
grappling with fragile cables, and these bills afterwards.
contactless charging pads are increasingly A Chinese database
commonplace at home and in the car. tells me that nearly 400
(four hundred) different
GaN is the answer battery electric vehicles A teaser shot of the first EV mass produced with a solid-
The latest crop of mains chargers now and about 170 hybrids state battery. The mid-size IM L6 saloon may be exported
caters for fast charging, and I was are on sale there. Some of under the MG brand, sources say.

12 Practical Electronics | June | 2024


is powered by the first mass-produced,
ultra-fast charging ternary lithium NMC
(nickel-cobalt-manganate) battery. The
solid-electrolyte battery promises greater
safety and a far longer range, along with
very fast charging times. The same battery
platform may also be licensed to Audi
for forthcoming new EVs, and one can
also expect to see much rivalry with
BYD’s ‘blade’ battery. However, there’s
a big ‘gotcha’ to be wary of: while ranges
of up to 1,000km/ 600 miles are quoted,
these are so-called CLTC values – China
The IM L6 interior has an expanse of three screens; early PR shots suggest its steering
Light-Duty Vehicle Test Cycle figures. In
wheel is more like a yoke or control column.
other words, they are inflated over likely
real-world ranges to make them look plant – one that reclaims ‘waste’ heat to Appallingly, this included Killingholme
more appealing. An insightful YouTube drive a steam turbine and generate more ‘A’, a power station I adopted courtesy of
video explains why CLTC figures should electricity – would include piping waste National Power when the station was quite
be treated with a large pinch of salt – see: carbon dioxide into abandoned undersea new, when researching my mini-series
[Link] gas caverns, in a race to achieve ‘net ‘From Pipelines to Pylons’ in the August
At the time of writing, IM’s website zero’. The plans won’t be signed off by and September 1999 issues of Everyday
has suddenly, and annoyingly, 404’d the Department for Energy Security and Practical Electronics. You can see the
the English pages and images related to Net Zero (yes, there is such a thing) until damage being inflicted on YouTube; note
the L6, but I had managed to nab some the year 2027, RWE states. This means the larger 0.9GW neighbouring CCGT
on the Chinese section. The L6 has Tesla that the new power station is about half station lies demolished behind – see:
Y-like rear quarters and a futuristic- a decade away and new gas pipelines [Link]
looking cockpit carrying full-width and transmission towers (pylons) will Until new energy sources such as SMRs
dash displays. The reason that this new also be needed. (small modular reactors) come on stream,
model is significant, though, is that IM This stopgap measure wouldn’t be so other measures may be needed to throttle
Motors is part-owned by SAIC (Shanghai bad except that, in the same locality, demand and match it to the available
Automotive), who also own the former 1.5GW of modern gas-fired power stations supply pool. This may include ‘surge
British brand MG Cars, known for keenly were bulldozed in recent years simply pricing’ or ‘time of use’ tariffs, effectively
priced EVs. When they reach our shores, because they couldn’t make any money. penalising users for consuming energy
IM’s solid-state battery vehicles will
reportedly be branded as mid-range MGs
for sales in Europe and North America. If
true, interesting times are ahead!

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

[Link] | sales@[Link] | Tel: 01553 636999

Practical Electronics | June | 2024 13


The tech uses advanced AI and weighing
sensors to recognise and charge buyers
when they add goods to their shopping
basket, and when exiting the store their
account is charged automatically, but
many customers also wanted to see
a rolling tally of their purchases and
browse the store for offers, like the rest
of us do. The stores are therefore being
redesigned with smart ‘Dash’ shopping
carts being introduced instead. Amazon
has closed several UK retail stores, but
the remainder will retain Just Walk Out
for the time being. Attempts by rival
supermarkets to use similar technology
have not caught on and are never likely
An artist’s concept design of NASA’s Lunar Terrain Vehicle. (Image: NASA).
to, probably being better used in busy
at peak times. Disingenuous industry and would allow them to quickly adjust locations such as grab-and-go cafés,
double-speak says that consumers will prices, according to demand.’ says The Grocer magazine. Amazon has
be able to celebrate ‘saving money’ by In theory, customer data could be also terminated by mutual agreement
using energy off-peak instead. uploaded wirelessly every 30 minutes, the acquisition of iRobot, makers of the
There’s no denying that smart meters but often they transmit daily or even Roomba robotic vacuum cleaner, blaming
and energy-saving measures are desirable monthly instead. I think it’s only a matter European regulatory problems.
and appreciated by many consumers, of time before the industry joins up NASA has short-listed three bidders
but I wrote some years ago that smart some dots to match available renewable tasked with designing the next-generation
meters, themselves a market-controlling energy (wind, solar) against demand, lunar terrain vehicle. The rover would be
concept originating from within the EU, and customers will then be penalised for used by astronauts as part of the Artemis
could ultimately be used as a tool against turning on the cooker or electric heater programme and will enable them to
homeowners to influence their power on calm, cloudy, wintry days. But you explore the South Pole and perform
usage. Paraphrasing Britain’s Energy could still turn everything off – think of scientific experiments further afield
Saving Trust, that says the ‘time of use all the money you’d save! than they could on foot. In between
pricing... adjusts the price of energy in real manned missions, the rover could be
time, depending on demand. In homes, Other news driven autonomously, with the winning
second generation SMETS2 smart meters Amazon US is discontinuing its cashier- contractor being allowed to perform
automatically send updates to energy less ‘Just Walk Out’ shopping technology commercial tasks, controlling the
suppliers about household energy use at used in Amazon Fresh stores in America unmanned rover remotely from Earth.
regular intervals.... so energy companies (see Net Work, May 2021). A very good A movie trailer is offered by NASA at:
can see exactly how much energy its insight into the amazing technology is [Link]
customers are using throughout the day, presented at: [Link] NASA has also been directed to devise
a ‘moon time zone’ by 2026, called
Co-ordinated Lunar Time (LTC). The
White House order would establish a
unified time standard at, and around,
celestial bodies other than Earth, and
NASA would work via standards bodies
to establish LTC in conjunction with
international agreements.
Last, this month, if you’ve ever needed
data on legacy components such as old
chips or transistors, or old computer
software, one site worth keeping in mind
is [Link], a resource containing
7.5 million pages of data maintained in
an old-school file-area fashion for speed
and ease of mirroring. One such mirror is
hosted by the University of Kent, where
archives of software, component data,
test equipment and more will be found.
There is even an FTP server for good
measure – see: [Link]
That’s all for this month’s Net Work
– remember the above web links are ready-
made for you to click on at our advert-free
website at: [Link]

The author can be reached at:


An Amazon smart ‘Dash’ shopping cart – Amazon Fresh stores are dropping ‘Just alan@[Link]
Walk Out’ cashier-less AI technology in favour of smart shopping carts.

14 Practical Electronics | June | 2024


Wi-Fi
Time Source for GPS Clocks
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.
Project by Tim Blythman

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.

Practical Electronics | June | 2024 15


This approximation will never be
Wi-Fi Time Source Features good enough for navigation purposes.
n Delivers NMEA 0183 data simulating a GPS time source Still, it is usually sufficient to deter-
n Adjustable baud rate mine a timezone, which is ideal for
n 3.3V logic levels work with 3.3V and 5V systems those clocks that use GPS location
n Synthesised 1PPS signal data for this purpose.
n Gets the time from NTP servers via Wi-Fi For example, the High Visibility
n Generates estimated latitude and longitude based on IP address 6-Digit LED GPS Clock from January
n Can also output fixed dummy coordinates and February 2017 uses location data
to set the time zone and daylight sav-
n Can scan for up to eight Wi-Fi networks (SSIDs)
ings rules automatically.
n Configurable via virtual USB serial port, independent of data stream
With most of our GPS projects using
n Uses a compact and low-cost Raspberry Pi Pico W module
the GPS signal for clock timekeeping,
n Integrated buck/boost converter runs efficiently from 1.8-5.5V the Wi-Fi Time Source is well-suited
n Crystal oscillator offers better than 30ppm accuracy between updates for use with indoor clocks, where they
n Draws 50mA, or up to 100mA during Wi-Fi transmissions (3.0V supply) may not have a view of the sky and
thus to a GPS signal, but can easily be
connected to a Wi-Fi network.
Indeed, it is cheaper than the GPS using GGA. So this data is entirely
module it can replace. But particu- adequate for driving those clocks. Hardware
lar features of its RP2040 microcon- The Wi-Fi Time Source hardware is
troller helped us to create the Wi-Fi NMEA sentences minimal. The dashed box in Fig.1
Time Source. Practically all GPS modules deliver shows the pinout of the Pico W after
For example, it can implement a data generally in accordance with it has been programmed. The remain-
virtual USB serial port, meaning that the NMEA 0183 standard. The stan- der of Fig.1 shows the full map of all
the configuration menu is separate dard actually specifies 4800 baud the pins with their features.
from the NMEA data stream (National serial data using a balanced signal As you can see, we’ve kept all
Marine Electronics Association). Due complying with the RS-422 electri- the useful pins at one end. It would
to the nature of the serial port on the cal standard. have been nice to be able to shorten
D1 Mini, these were shared on the The newer NMEA 2000 standard the board by cutting off unnecessary
Clayton’s GPS, so using the configura- uses a CAN bus network at 250kiB section. Unfortunately, the entire
tion menu interrupted the data stream. per second. The full contents of this board is needed and it can’t be made
The Pico W also implements a standard are not publicly available, much smaller, especially as the Wi-Fi
virtual USB drive for flash memory so the simpler NMEA 0183 is still antenna is at the end opposite the
programming. Some people had dif- widely used, since it is well known USB connector.
ficulty uploading to the flash mem- and understood. The power pins are fixed on the
ory to the D1 Mini for various rea- Most receivers nowadays use right-hand side, near the USB con-
sons. For example, it requires either single-­ended logic-level signals (typ- nector. These are pin 40 (VBUS), pin
a dedicated programming application ically 3.3V) with baud rates of 9600 39 (VSYS) and pin 38 (GND). There
or the Arduino IDE for programming. or even higher. Many modules also are actually several GND pins (see
On the other hand, the Pico W can offer a 1PPS (pulse per second) signal Fig.1), but pins 3 and 38 are closest
be flashed by just about any computer that is synchronised to the satellite to the other important pins.
with a USB port. The process is as atomic clocks. Pin 37 (3V3_EN) is an input to the
simple as copying the file to the vir- The serial data consists of lines of regulator on the Pico W; this is kept
tual USB drive. ASCII characters called sentences. high by a 100kW resistor but can be
The RP2040 processor on the Pico For our purposes, each sentence is pulled low to shut down the regula-
W has two cores, so one can be ded- marked at the start by a ‘$’ character, tor and thus power off the Pico W.
icated to sending out the NMEA data followed by two characters that iden- Pin 1 (GP0) is the source of the gen-
and not be blocked by activity on the tify the ‘talker’. This is typically ‘GP’ erated NMEA serial data, which idles
other core, which handles the config- for GPS systems, although we have at a 3.3V logic high level.
uration and Wi-Fi connections. seen some modules that use ‘GN’ The Pico W’s hardware UART (uni-
The Pico W also has an onboard where data from multiple satellite versal asynchronous receiver/trans-
switchmode regulator that’s more systems are combined. mitter) peripherals are only available
efficient than the linear regulator The next three characters iden- on specific pins. This pin was chosen
found on the D1 Mini. Some readers tify the type of message, followed by as it is the UART TX pin closest to the
reported problems powering the D1 sentence-­specific data and a check- USB connector and the power pins.
Mini, so it is a welcome upgrade. It sum code to provide a degree of pro- We selected the adjacent pin 2 (GP1)
not only reduces the current require- tection against corrupted data. for the 1PPS output; it could have
ment at higher supply voltages but The most common sentences that been any of the remaining GPIO pins.
also enables operation from supplies encode the time also contain loca- We’ve shown the 3.3V output only
as low as 1.8V. tion data, so the Wi-Fi Time Source because it might be handy if you need
Just like the earlier time source, can produce dummy location data or a regulated 3.3V supply for your proj-
the Wi-Fi Time Source emits three even use an IP address geolocation ect. The regulator on the Pico W can
NMEA sentences: ‘RMC’ (recom- data service to generate an approxi- deliver up to 2A, although some of
mended minimum data for GPS), mate location. In any case, it’s a good that is used by the Pico W.
‘GGA’ (Fix information) and ‘GSA’ idea to generate such data in case the Fig.2 shows the power circuitry of
(satellite data). receiving device expects there to be the Pico W and will help you decide
Most of our GPS clock designs only valid data in this location, even if it how to connect the Wi-Fi Time Source
use the RMC sentence, with some also is not used. in your circuit.

16 Practical Electronics | June | 2024


Pins used for the Wi-Fi Time Source

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

Practical Electronics | June | 2024 17


Fig.2: the power supply circuit of the Pico W, shown here in case you wish to adapt the Wi-Fi Time Source to a different
application. For example, consider adding a diode feeding into VSYS to prevent VBUS power from feeding into your
power supply if a USB cable is connected.

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.

18 Practical Electronics | June | 2024


Table 1 – Wi-Fi Time Source configuration commands Basic setup
Comm. Function Notes All commands should be followed by
Enter. The Pico W implements coun-
1 Scan networks and Channel and authentication are also listed. try codes to ensure that the correct
display a list in order The number shown in column n is used for (legal) Wi-Fi channels are used for
of decreasing RSSI Command 4. communication. The default ‘XX’ set-
2 Show the current The list is active but may not reflect the ting is a subset that is safe worldwide
network list contents in flash memory unless a save has but does not allow the use of some
Wi-Fi channels. So it should work
been completed.
but might not be optimal.
3n Delete item n from It’s a good idea to set this to your
the list shown by country. Use command 9 (followed
Command 2 by Enter) and enter a two-letter coun-
try code (AU, NZ, US, UK... and so
4n Add network n from Also prompts for a password. If all slots are
on), then save the settings with com-
Command 1 full, an error is printed and you will need to mand 8 and reboot the Pico W with
use Command 3 to free a slot. the J command.
5 Enter a network Editor’s note: the codes should
name manually be in the alpha-2 format, see:
[Link]
6n Enter the password Shouldn’t need to be used unless you need to
Reconnect to the Pico W if neces-
for a network, using change a password. sary; TeraTerm will usually perform
n from the list shown this automatically.
by Command 2 Now use menu option 1 to run a
7 Test networks in Scans through the list and attempts to Wi-Fi scan; this should complete
the list connect to each network in turn. This can within a second or so. The networks
are listed in order of RSSI (signal
take a while and success is only reported if
strength), so you should find your
an IP address is obtained. SSID near the top.
8 Save all settings to It’s a good idea to reboot after this to ensure Note that commands listed with
flash memory that all settings are reloaded correctly. an n suffix take a second numeric
argument. For example, if your net-
9 Set two-letter Only loaded on boot, so reboot after setting
work appears first (next to number 0),
country code this and using Command 8 to save. enter command 40. You will then be
A Set IP to lat/lon API This should return two lines of text with prompted for the password for this
URL decimal latitude on one line and longitude on network; type it in and press Enter.
the next. Set URL to blank to disable. You can enter multiple networks
without rescanning. If your network
B Set default latitude Enter in the decimal format.
doesn’t appear, use command 5 to
C Set default longitude Enter in the decimal format. enter the name manually, and you
D Set NMEA baud rate The default is 9600, but any rate between 300 will then be prompted for the pass-
and 921600 can be used. word too.
Command 6 on its own is used to
E Set Talker code The default is ‘GP’, but it can be any two change or set a password if, for exam-
characters. ‘GP’ works for all our clocks. ple, you have entered it incorrectly.
F Set NTP validity The longest period for which the time can be Then try command 7 to test the
timeout in minutes considered valid without a (typically hourly) saved networks. You should see a
message saying ‘Connected with IP’,
NTP update, from 60min to 50000min (about
followed by an IP address for each
a month). SSID. If not, try again. If you get an
G Set NTP server URL The default is ‘[Link]’, which ‘Auth failed (password?)’ message,
automatically redirects to a geographically the password entered may not be
nearby server. Others can be used, such as correct; you can use command 6 to
‘[Link]’. The IP address may not be re-enter it.
The serial port will print updates
correct until a network is connected.
around every 15 seconds if nothing
H Set default year The year used at boot when no other time has been entered on the serial port –
data is available, from 1970 to 4095.. this is done to prevent any updates
I Toggle debugging Can be used to check and debug the NMEA from interfering with your configu-
NMEA data output to data. This setting is saved in case you need ration process.
If all is well, use command 8 to
USB serial port this data to always be available on the USB
save the settings to flash and reboot
serial port. again to ensure that the settings are
J Reboot Pico W It’s recommended to reboot after saving loaded. This is necessary as some
settings to ensure that all settings are parameters can only be set once,
reloaded at boot time. If you hold the and the easiest way around this is to
BOOTSEL button while rebooting, you can use reboot the device.
This should be the minimal
this method to enter bootloader mode.
amount needed to set up the Wi-Fi

Practical Electronics | June | 2024 19


----------------------------------- Time is [Link] on 13/02/2023. NO NTP.
Command 1 Connect failed
----------------------------------- Connecting to 0 AndroidAP4AA0
1 Skip IPAPI fetch, no WiFi.
Scanning
Scan complete ****
Scanned network list: NTP adjustment: 11953
n SSID RSSI Chan Auth ****
0 AndroidAP4AA0 −44 1 PASS Connected with IP: [Link]
1 APV Admin Only −65 3 PASS Time is [Link] on 13/02/2023. NTP OK. Last updated 0 minutes ago.
2 APHV Conference −66 3 PASS IPAPI start.
3 TPW4G_ZeB426 −82 11 PASS Headers of 170 bytes report 18 bytes of content.
4 WiFi-5E5EE1 −84 8 PASS Received 18 bytes.
5 NTGR_4E0C −93 11 PASS HTTP finished:200
----------------------------------- OK
Command 43 Lat/Lon=−27.467899,153.032501
----------------------------------- Time is [Link] on 13/02/2023. NTP OK. Last updated 0 minutes ago.
43 Time is [Link] on 13/02/2023. NTP OK. Last updated 0 minutes ago.
2 TPW4G_ZeB426 Time is [Link] on 13/02/2023. NTP OK. Last updated 0 minutes ago.
Added OK Time is [Link] on 13/02/2023. NTP OK. Last updated 1 minutes ago.
Enter password. Time is [Link] on 13/02/2023. NTP OK. Last updated 1 minutes ago.
PASSWORD Time is [Link] on 13/02/2023. NTP OK. Last updated 1 minutes ago.
password saved. Time is [Link] on 13/02/2023. NTP OK. Last updated 1 minutes ago.
----------------------------------- Time is [Link] on 13/02/2023. NTP OK. Last updated 2 minutes ago.
Command 2 Time is [Link] on 13/02/2023. NTP OK. Last updated 2 minutes ago.
-----------------------------------
2 Screen 3: the last few lines on this screen (using the TeraTerm serial terminal
Saved network list: program) show that the Wi-Fi Time Source has connected to Wi-Fi and updated
0 AndroidAP4AA0
1 Tim
its time from NTP servers. The previous lines are typical of what might be seen
2 TPW4G_ZeB426 on a normal startup.
-----------------------------------
Command 32
----------------------------------- different. If you have a PC program the Advanced GPS Computer from
32 that can process GPS data, you can une/July 2022, so we’ll assume you
SSID deleted. use it to verify the data. are using the Wi-Fi Time Source with
Saved network list: one of our GPS clocks.
0 AndroidAP44A0
1 Tim Connecting it to a clock We have instructions below on
----------------------------------- The Wi-Fi Time Source could feasibly using the Time Source with some
Command 7 connect to just about any system that GPS clock projects we have pub-
-----------------------------------
expects logic level NMEA 0183 data; lished over the last ten years. Table
7
Testing networks. however, its lack of accurate speed 2 also summarises how this Time
0 AndroidAP4AA0 and location data means it is not the Source can replace some common
>connected with IP:[Link] best choice in some cases. GPS modules.
1 Tim
>SSID not found
We don’t recommend using it as the Note that these connections may
2 Networks tested, 1 OK source for our GPS-based frequency not be optimal, especially for clocks
references; the 1PPS signal provided that run on batteries. You might want
Screen 2 (right): this edited screen by this time source is not intended to to experiment with alternative con-
dump shows the output of some of the have the necessary precision. figurations. The suggested wiring for
more complex commands. Note that It’s not going to be much use as a the recent battery-powered clocks is
these commands have been issued navigational aid either, ruling out different to Table 2 for that reason.
in the order shown, to add and then
remove an SSID. Commands 3 and 4
$GPRMC,050215.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3F
require a second parameter which is a
$GPGGA,050215.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*78
number printed by commands 2 and 1 $GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
(respectively) issued prior. $GPRMC,050216.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3C
$GPGGA,050216.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7B
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
Time Source to work with most of our $GPRMC,050217.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3D
clocks. A detailed list of commands, $GPGGA,050217.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7A
$GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
along with their use and purpose, is $GPRMC,050218.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*32
shown in Table 1. $GPGGA,050218.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*75
Screen 2 shows the typical $GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
responses to the more common and $GPRMC,050219.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*33
$GPGGA,050219.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*74
complex commands. Most other com- $GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
mands require a simple response $GPRMC,050220.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*39
and will report a message if there is $GPGGA,050220.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7E
a problem. $GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
$GPRMC,050221.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*38
Screen 3 shows the typical progres- $GPGGA,050221.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7F
sion at startup, although events may $GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
not occur in this order. You might $GPRMC,050222.000,A,2728.0004,S,15301.0057,E,0.00,000.00,130223,,,*3B
$GPGGA,050222.000,2728.0004,S,15301.0057,E,1,04,1.0,0.0,M,0.0,M,,*7C
also see a much larger NTP adjust- $GPGSA,A,3,,,,,,,,,,,,,1.00,1.00,1.00,*2F
ment; that is normal.
You can toggle the printing of GPS Screen 4: the I command sends GPS sentences to the virtual serial terminal
sentences over the USB serial port by so that you can confirm the data being produced. This setting can be saved to
using the I command. Screen 4 shows flash, so the GPS data continues to be sent to the USB virtual serial port even
this; naturally, your data might be after it reboots.

20 Practical Electronics | June | 2024


The problem is that the Wi-Fi Time pins of the ICSP header is ideal for
Source has a higher current demand this purpose.
than most GPS modules, and the Note that we’ve used a header pin
circuitry sometimes cannot provide for this connection, so power can
enough current to drive it. be disconnected when we connect
to the USB socket for programming.
This prevents 5V from the USB cable
New GPS-Synchronised Ana- being fed into the battery.
logue Clock – September 2023 With just these three wires, the
The most recent GPS-synchronised Pico W would run continuously. So
clock was published in September 2023. the green wire connects the 3V3_EN
Like many of our recent GPS proj- pin to pin 7 of IC1 on the Clock PCB.
ects, it uses the VK2828U7G5LF GPS This pin is usually used to control the
module. In fact, we recommend this Clock’s boost regulator. This connects
module as a replacement for all the underneath the PCB, as shown in the
previous GPS modules we have used photo, since it is easier to connect to
in clock projects. the corresponding pad. is down to 2V, the lower limit of the
The VK2828U7G5LF has six con- This scheme bypasses the boost Clock. By that stage, there wasn’t
nections, but you only need four for regulator on the New GPS-Syn- enough voltage to power the blue
the Time Source. The connections are chronised Analogue Clock, which is LED on the Clock, but everything else
all fairly straightforward, although possible as the Pico W has its own worked as expected.
they don’t all connect to the GPS buck/boost regulator. That also means The photos show the Time Source
module header – see Fig.3. that if you are building the Clock connected via short wires and then
The black and blue wires are con- board from scratch, you can leave off mounted on the ICs using a pad of dou-
nected to the obvious points on the the boost regulator IC and its associ- ble-sided tape. Note how the Pico W’s
GPS module header. The red wire ated components. Wi-Fi antenna is clear of the PCB below.
feeds power directly from the battery With this arrangement, the Pico W The Wi-Fi Time Source typically
to the Pico W’s VSYS pin; one of the will power up even when the battery takes about 25 seconds to ‘get a fix’,

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.

Practical Electronics | June | 2024 21


The Wi-Fi Time Source
wired to the New GPS-
Synchronised Analogue
Clock from 2023. To
save battery power,
the boost regulator
on the clock PCB is
bypassed; in fact,
those onboard
components could
be left off entirely.
The photo at
upper left shows
the green wire
connecting directly to pin
7 of IC1 on the reverse of
the PCB.

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.

22 Practical Electronics | June | 2024


Table 2 – Time Source pin mapping compared to GPS modules the 5V position, since the Pico W will
happily work with 5V at its VSYS input.
Pico W VK2828 EM408 Notes
If you have problems after connect-
Pin 1 GP0 (NMEA TxD(4, blue) Tx(4) ing the Time Source to one of the other
data) clocks, it is most likely a power prob-
Pin 2 GP1 (1PPS) 1PPS (6, white) Not connected Not needed for lem. Check that the 3V3_OUT pin is near
most applications 3.3V. If not, the circuit may not be able
to supply enough current for the Pico W.
Pin 3/38 GND GND (2, black) GND(2)
Pin 39 VSYS VCC (5, red) V+(5) Or another source Conclusion
of 1.8V to 5.5V The Pico W board provides helpful
Pin 40 VBUS Not connected Not connected features in roles like this, such as its
integrated buck-boost power supply,
Not needed EN (1, yellow) EN (1) dedicated USB peripheral allowing a
Not needed RxD (3, green) RX(3) separate configuration console and
good software support.
The Wi-Fi Time Source is a natural
GPS-synchronised Analogue GPS clocks from 2017 progression of the original Clayton’s
Clock Driver – February 2018 All the earlier GPS clocks we published GPS Time Source from 2019 and is sim-
The GPS-synchronised Analogue used external power supplies, so they ilarly simple and well-priced. The Pico
Clock Driver from February 2018 also should not have any problems due to W variant adds extra features, partic-
recommended the VK2828U7G5LF the limitations of a battery supply. ularly the ability to connect automati-
GPS module. Note that we have not Fig.5 and Fig.6 show how to con- cally to one of several Wi-Fi networks.
tested this arrangement or any of the nect the Wi-Fi Time Source to the At the time of writing, Bluetooth
following arrangements with clocks 6-Digit Retro Nixie Clock Mk.2 and support is in its early (beta) stages, so
before 2022. High Visibility 6-Digit LED GPS we will investigate if it is possible to
Here we propose a variation that Clock, respectively. add a Bluetooth interface for configu-
will avoid a small amount of ineffi- Note that both use the same header ration. This would be very handy for
ciency by also bypassing the Clock pinout for connections to their respec- updating settings as it would remove
Driver’s boost regulator. Since the tive GPS modules, corresponding to the need to connect a USB cable.
Pico W can work from voltages down the connections shown in Table 2.
to 1.8V at VSYS, we take 3V directly For efficiency reasons, the GPS power Reproduced by arrangement with
from the input of the boost regulator, supply voltage link for these projects SILICON CHIP magazine 2024.
(LK1 for both projects) should be set to [Link]
as shown in Fig.4.

EE

Order direct from ELECTRONICS


FR -ROM
GET T CD
£8.99

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

(includes P&P to UK if ordered direct from us) PIC n’ Mix


Including Practical Digital Signal Processing

PLUS...
YOUR GUIDE TO THE BBC MICROBIT
A LOW-COST ARM-BASED SINGLE-BOARD
COMPUTER

Teach-In 9
Get Testing

Teach-In 9 – Get Testing! Three Microchip


PICkit 4 Debugger
Guides
Files for:
PIC n’ Mix

PLUS
Teach-In 2 -Using
PIC Microcontrollers.
In PDF format

This series of articles provides a broad-based introduction to choosing and using a wide range © 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.

ORDER YOUR COPY TODAY: [Link]

Practical Electronics | June | 2024 23


Using Electronic Modules with Jim Rowe

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.

24 Practical Electronics | June | 2024


Reproduced by arrangement with
SILICON CHIP magazine 2024.
[Link]

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.

Practical Electronics | June | 2024 25


If you want to try using the LO- and
LO+ pins, these can be connected to the
Uno’s IO11 and IO10 pins (green and
purple wires). And if you envisage want-
ing to make use of the SDN pin (pin 6)
to save power, this can be connected to
the Uno’s D8 pin (not shown in Fig.4).
It’s also relatively easy to connect
the module to an Arduino Nano, as
shown in Fig.5. Note that the connec-
tions shown in both Fig.4 and Fig.5 are
those expected by the sketches I found
to put the module to use. Other config-
urations are possible as long as the soft-
ware is adapted to match.

Fig.4 (above): the connection diagram for the heart rate


Firmware and software
monitor module to an Arduino Uno or similar. I couldn’t find sketches or PC software
on my vendor’s (Jaycar) website for use
with this module, but after searching the
internet, I found references on Spark-
fun’s website to a simple sketch called,
Heart_Rate_Display.ino, available to
download from: [Link]
sparkfun/AD8232_Heart_Rate_Monitor
This sketch was written by Casey
Kuhns at SparkFun Electronics and
seems to have been written originally
for the Mini Arduino Pro. It simply
Fig.5: the connection diagram to an Arduino Nano. sends numeric samples of the ECG sig-
nal back to the PC, where they can be
displayed as a listing in the Arduino
On the left, the RA (right arm) elec- to the right, it can be placed in the cen- IDE’s Serial Monitor.
trode is positioned near the right wrist, tre, just above the navel. If you have a recent IDE version
the LA (left arm) electrode near the left (v1.6.6 or later), you can display them
wrist and the RL (right leg) driving elec- Connecting it to an Arduino as a waveform using the Serial Plotter
trode is above the right knee. However, It’s pretty easy to connect the AD8232 tool instead.
another suitable position is just above Heart Monitor module to an Arduino To try out the module and kit with
the right ankle. like the standard Uno or one of the many an Arduino Uno, I adapted the Kuhns/
On the right is another way of achiev- compatibles, as shown in Fig.4. The SparkFun sketch to make it work with
ing much the same result. Here the RA GND and +3.3V pins on CON3 connect the Uno. The adapted sketch is called
and LA electrodes are placed just above to the corresponding pins on the Uno, as AD8232_heart_monitor_basic.ino
the armpit on each side, while the RL shown by the grey and red wires, while and is available for download from
electrode is placed on the abdomen just the OUTPUT pin connects to the A0 pin the June 2024 page of the PE website:
below the rib cage. Although it’s shown of the Uno (blue wire). [Link]

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.

26 Practical Electronics | June | 2024


Of course, it is not easy to deduce
much from a scrolling list of numbers, Your heart and its electrical activity
so I closed the Serial Monitor tool Most people know that your heart is basically a pump that pushes your blood
and opened up the Serial Plotter tool around your body via its blood vessel ‘plumbing’ – the arteries and veins. The
instead. This gave a waveform that was typical human adult heart is about the size of a clenched fist and weighs about
a lot easier to interpret, although there 300g. It’s located near the centre of your chest and pumps about once per second.
was a fair bit of noise present. So I tried The pumping action is triggered mainly by a nerve centre inside the heart, called
moving the electrode positions a few the sino-atrial (SA) node. Each pumping cycle is initiated by a nerve impulse that
times and kept checking the result. starts at the SA node and spreads down through the heart via preset pathways.
The plot shown in Fig.6 is about the The heart comprises millions of bundles of microscopic muscle cells, which
best I could get, and as you can see, contract when triggered. The muscle cells are electrically polarised, like tiny elec-
there’s still a fair bit of noise between trolytic capacitors (positive outside, negative inside). As the trigger pulse from the
the main QRS spikes, almost obscur- SA node passes through them, they depolarise briefly and contract.
ing the smaller P and T bumps. So with each beat of the heart, a ‘wave’ of depolarisation sweeps from the top
of the heart to the bottom. Weak voltages produced by this wave appear on the
Conclusion outside surface of your skin, and can be picked up using electrodes strapped to
Although I think some of this noise your wrists, ankles and the front of your chest. It’s these voltages (about 1mV
could be removed by further exper- peak-to-peak) that are captured and recorded as an electrocardiogram or ‘ECG’.
imenting with electrode placement, The actual shape and amplitude of the ECG waveform depend upon the individ-
I also gained the impression that ual being examined and the positioning of the electrodes, but the general shape
some of it was being picked up by the is shown in the adjacent graph.
AD8232 module itself and the wiring The initial ‘P’ wave is due to the heart’s atria (upper input chambers) depolar-
between it and the Arduino. ising, while the relatively larger and narrower ‘QRS complex’ section is due to the
I suspect that, for the best results, much stronger ventricles (lower output
it would be a good idea to place the chambers) depolarising. Finally, the ‘T’
module and the Arduino inside an wave is due to the repolarisation of the
earthed metal box. ventricles, ready for another cycle.
The AD8232 module and accom- Doctors can evaluate several heart
panying electrode kit provide an easy problems by measuring the timing of
way to check your heart rate. If you get these wave components and their rel-
one, I suggest you also get one or two ative heights. They can also diagnose
of the packs of extra electrode pads, problems by seeing how wave compo-
since the pads are only suitable for a nents change with the various standard
single use. electrode and lead connections.

Your best bet since MAPLIN


Chock-a-Block with Stock
Visit: [Link]
Or phone our friendly knowledgeable staff on 020 8452 0161
Components • Audio • Video • Connectors • Cables
Arduino • Test Equipment etc, etc
JTAG Connector Plugs Directly into PCB!!
No Header! No Brainer!

Our patented range of Plug-of-Nails™ spring-pin cables plug directly


into a tiny footprint of pads and locating holes in your PCB, eliminating
the need for a mating header. Save Cost & Space on Every PCB!!
Solutions for: PIC . dsPIC . ARM . MSP430 . Atmel . Generic JTAG . Altera
Xilinx . BDM . C2000 . SPY-BI-WIRE . SPI / IIC . Altium Mini-HDMI . & More
Visit our Shop, Call or Buy online at:
[Link]
Visit our shop at:
[Link]
020 8452 0161 40-42 Cricklewood Broadway
London NW2 3ET
Tag-Connector footprints as small as 0.02 sq. inch (0.13 sq cm)

Practical Electronics | June | 2024 27


Author and Designer: Phil Prosser

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

Two handy features this design provides


Features and Specifications are floating power for the Test Jig to avoid
— Measures loudspeaker driver frequency and phase responses earth-loop-induced hum and switchable
— Measures loudspeaker relative SPL (absolute SPL possible with external
gain on the input and microphone to
calibration sources) allow for ‘near field’ and ‘far field’ tests.
— Time alignment of loudspeaker drivers in combination with an oscilloscope
Software support
— Measures the impedance of loudspeakers, crossover networks The software does the heavy lifting in
— Measures the value of capacitors, inductors (μH to mH range) and resistors this design. The most current program
— Incorporates a microphone preamplifier and small power amp that can be used is ‘Room EQ Wizard’
— Frequency range: 10Hz to 20kHz (depending on your sound card) (REW), currently in development and
— Power output; about 5W peak into 8Ω (not continuous due to power available at: [Link] –
supply limitations) we tested V5.20.13. For Mac users, this
— Amplifier gain: switchable between +14dB and +34dB is a good option. We’ll focus on this pro-
gram as it is the most actively supported.
— Common-mode rejection ratio (CMRR): >60dB on prototype (20Hz to
A surprising but excellent option
20kHz)
for Windows users is ‘Speaker Work-
— THD+N: <0.01% across the audio range
shop’, which has been around for over
— 50/100Hz hum: more than 100dB below full-scale 20 years. It is dedicated to designing
— Microphone phantom power: 48V, selectable via header on PCB and building loudspeakers and, among
— Power supply: 15V AC @ 1.2A from a plugpack (no mains wiring) other things, can measure Thiele-Small
parameters accurately and simply.

28 Practical Electronics | June | 2024


Fig.1: the magnitude and phase of the impedance of a loudspeaker bass driver in free air. You can see the high impedance
peak close to 80W at 60Hz and the rapid change in phase around there.

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

Practical Electronics | June | 2024 29


Loudspeaker Test Jig
sound card’s outputs to be monitored attenuation for the sense input and available and requires minimal parts
while one is fed to the power amplifier. switchable gain for the amplifier. to work. It needs to be able to drive a
The switching section determines loudspeaker at a modest volume and
whether the output of the mic preamp or Power amplifier be tolerant of abuse, which can happen
sense input is fed to the computer sound We don’t need a substantial power with this sort of equipment. You would
card’s inputs. It also provides switchable amplifier; the LM1875 IC is commonly never short the amplifier, would you?

30 Practical Electronics | June | 2024


Fig.3: the complete circuit diagram of the Test Jig with shaded boxes showing the separate sections. The Power
Amplifier drives a loudspeaker while the Microphone Preamplifier picks up the resulting sound and amplifies it to
send it to the sound card. The Speaker Measurement section is essentially a buffer, while the Switching section lets
you perform various tests without disconnecting and reconnecting many leads.

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.

Practical Electronics | June | 2024 31


Parts List – Loudspeaker Test Jig
1 double-sided PCB coded 04106231, 99.5 × 189.5mm 1 LM317 adjustable positive linear regulator, TO-220
1 Hammond 220×103×53mm black aluminium (REG3)
instrument case [element14 9287892, 1 LM337 adj. negative linear regulator, TO-220 (REG4)
Mouser 546-1455N2201BK, Digi-Key HM1732-ND] 2 BC559 100mA 30V PNP transistors, TO-92 (Q1, Q2)
1 15V AC plugpack (rated at least 1.2A) [Jaycar MP3021] 4 6.8V 1W zener diodes (ZD1-ZD4)
3 2A 5V DC coil DPDT PCB-mounting telecom relays 1 400V 4A SIL bridge rectifier (BR1)
(RLY1-RLY3) [Altronics S4128B] [eg, KBL404; Altronics Z0076A]
4 5mm-long, 2mm inner diameter ferrite beads (FB1-FB4) 8 1N4004 400V 1A diodes (D2, D3, D22, D23, D26-D29)
2 PCB-mounting M205 fuse clips (F1) 7 1N4148 75V 200mA signal diodes
1 2.1mm or 2.5mm inner diameter PCB-mounting DC (D4, D6-D9, D11, D12)
barrel socket, to suit plugpack (CON1) 4 BAT85 30V 200mA schottky diodes
1 stereo right-angle PCB-mounting RCA socket, above/ (D5, D10, D15, D16)
below (CON2) [Altronics P0210] Capacitors
1 dual stereo vertical PCB-mounting RCA socket (CON3) 4 2200μF 25V low-ESR radial electro, 7.5mm pitch
[Altronics P0214] [Altronics R6204; Jaycar RE6330]
7 2-way 2.54mm right-angle polarised headers with 3 470μF 25V radial electrolytic, 5mm pitch
matching plugs (CON4-CON9, CON12) [Altronics R5164; Jaycar RE6326]
[Altronics P5512 + P5472 + P5470A × 2] 2 220μF 63V radial electrolytic, 5mm pitch
1 3-way 2.54mm right-angle polarised header with [Altronics R5148; Jaycar RE6348]
matching plug (CON11) 1 220μF 16V radial electrolytic, 3.5mm pitch
[Altronics P5513 + P5473 + P5470A × 2] [Altronics R5143; Jaycar RE6312]
1 2-pin header with jumper shunt (LK1) 3 100μF 50V radial electrolytic, 5mm pitch
1 3-pin header with jumper shunt (JP1) [Altronics R6127; Jaycar RE6346]
2 8-pin DIL sockets (optional; for IC1 and IC2) 9 47μF 50V low-ESR radial electrolytic, 3.5mm pitch
2 dual panel-mount red/black binding posts with banana [Altronics R6107; Jaycar RE6344]
sockets [Altronics P9257A] 2 22μF 50V low-ESR radial electrolytic, 2.5mm pitch
3 SPDT solder tail panel-mount toggle switches with [Altronics R6077; Jaycar RE6342]
locking mechanism [Altronics S1311] 2 22μF 50V non-polarised radial electrolytic, 3.5mm pitch
1 panel-mount 3-pin XLR socket for microphone (CON10) [Altronics R6570A; Jaycar RY6816]
[Altronics P0903] 5 10μF 50V low-ESR radial electrolytic, 2.5mm pitch
Hardware and wire [Altronics R6067; Jaycar RE6075]
1 2A 250V M205 fast-blow fuse (F1) 1 220nF 63V MKT polyester
1 84×24×28mm low-profile PCB-mounting heatsink 12 100nF 63V MKT polyester
[Altronics H0668] 2 1nF 63V MKT polyester
3 16×22mm TO-220 PCB-mounting heatsinks 1 680pF 50V NP0/C0G or YSP radial ceramic
[Altronics H0650] 2 100pF 50V NP0/C0G or SL radial ceramic
5 TO-220 insulating kits (washers + bushes) 2 22pF 50V NP0/C0G radial ceramic
[Altronics H7210, set of four] Resistors (all ¼W 1% axial unless otherwise stated)
1 M3 × 25mm panhead machine screw 4 47kW
6 M3 × 16mm panhead machine screws 6 22kW
6 M3 shakeproof washers 1 12kW
6 M3 flat washers 2 10kW
4 M3 hex nuts 3 9.1kW
2 fibre or Nylon washer, 3mm inner diameter 2 6.8kW 0.5W or 0.6W 1%
[Jaycar HP0148] 2 4.7kW
2 4G × 12mm countersunk head machine screws 2 3.3kW
[Bunnings 2420062] 2 2.7kW
1 150mm length of 3-wire jumper cable 1 2.2kW
1 300mm length of green light-duty hookup wire 1 1.2kW
1 1m length of light-duty figure-8 twin lead or ribbon 6 1kW
Reproduced by arrangement with
cable SILICON CHIP magazine 2024.
1 910W [Link]
1 200mm length of 3mm diameter black heatshrink 2 390W
tubing 1 330W
Semiconductors 3 240W
2 NE5532 dual low-noise op amps, DIP-8 (IC1, IC2) 9 100W
1 LM1875T 20W audio amplifier, TO-220-5 (IC3) 2 10W
[Jaycar ZL3755] 1 10W 5W 5% non-inductive
1 LM317HV high-voltage adjustable linear regulator, [Altronics R0323; Jaycar RR3250]
TO-220 (REG1) [Altronics Z0545] 1 1W 1W 5%

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,

32 Practical Electronics | June | 2024


but their specification has two holes, combination of half of (100W + 1.2kW) detectable roll-off at 20Hz. The outputs
and our design accommodates that. and (10kW + 10kW) forming the voltage are also AC-coupled and have 100W
If yours only comes with one hole as divider for gain. series resistors for stability and safety.
well, you will need to drill a 3mm hole Gain is controlled by the 2.7kW resis- A jumper on JP1 can feed either the
10mm to the left of the centre. tors in series with the NE5532 outputs, left or right channel to the input of the
combined with the 10kW resistors to the power amplifier.
Microphone preamp positive rail and the 1.2kW and 100W
This basic design is pretty standard resistors. A 20dB gain step is imple- Switching section
across the audio industry. It includes mented by switching RLY3 across the This section does two main things in
a tweak by Douglas Self, described in 1.2kW resistor. the Loudspeaker Test Jig. It switches
his books, whereby the input transistors The gain on the low setting can be one of the sound card’s input channels
are included in the operational ampli- calculated as: between the output of the microphone
fier feedback loop. This significantly preamplifier and a ‘DUT Sense’ input.
reduces the resulting distortion. 1 + (2.7kΩ ÷ (10kΩ || [(1.2kΩ + 100Ω) ÷ 2])) It also allows you to select a gain of 1×
The microphone preamplifier is sim- = 1 + (2700Ω ÷ 610Ω) or 0.1× for both the ‘DUT Sense’ signal
ply an AC-coupled balanced amplifier = 5.42 times gain (+14.7dB) and ‘Amp Out Sense’ signal.
with switchable gain. If you switch off When ‘DUT Sense’ is selected as the
the phantom power, this becomes a On the high setting, it is: signal source, the power amplifier gain
simple balanced input. That is handy is automatically cut from 10× to 1× by
to remember if you want to probe a 1 + (2.7kΩ ÷ (10kΩ || [100Ω ÷ 2])) switching in a 910W/100W resistive
circuit using the Loudspeaker Test Jig. = 1 + (2700Ω ÷ 49.8Ω) attenuator in its input signal path. This
RF is filtered out of the input signals = 55.2 times gain (+34.8dB) is so that when testing components a
by series ferrite beads and an RC low- signal of only a few hundred millivolts
pass filter comprising 10W resistors The input buffer is applied to them. That allows you to
and 680pF and 1nF capacitors. 48V The Loudspeaker Test Jig includes a measure the impedance of tweeters
phantom power, if selected, is applied simple op-amp-based buffer to ensure without over-driving them.
via 6.8kW resistors, with a 1kW/100µF that your sound card output is presented Despite this, if you are testing tweeter
low-pass filter before them to remove with a high impedance, while also pro- responses, always put a 20-100µF
any supply noise. Pairs of back-to-back viding a monitor output to drive an capacitor in series with the tweeter to
zener diodes protect the rest of the amplifier or other equipment. You can avoid over-driving it at low frequencies.
circuitry from any voltage spikes that even use this output to drive an active When testing loudspeaker frequency
might be picked up. crossover for testing active speakers. responses, though, you need more vol-
The two balanced signals are then fed The input includes protection ume. Therefore, with the 10× gain pro-
to the bases of PNP transistors Q1 and against RF noise with ferrite beads vided in the amplifier, it delivers a cou-
Q2, which are within the feedback loop and 100pF capacitors to ground, while ple of volts RMS (depending on where
of low-noise op amps IC1a and IC1b, schottky clamp diodes protect the op you set your sound card volume). This
providing the amplification as follows. amp from voltage spikes on the input. will be loud enough to get good fre-
Pins 2 and 3 of IC1a must be at essen- The signals are AC-coupled to the quency response plots.
tially the same voltage, enforced by neg- op amp inputs via 22µF non-polarised
ative feedback from this op amp. The capacitors with 47kW DC bias resistors, Power supply
current through transistors Q1 and Q2 forming a high-pass filter with a -3dB The power supply for the Loudspeaker
will be essentially the same, and within point of 0.15Hz. So there will be no Test Jig is minimalist to keep cost,
the tolerance of transistor matching,
their emitter voltages will be the same.
From a DC perspective, the output
will be close to 0V as IC1b inverts the
signal from IC1a, creating differential
feedback to the transistors. The transis-
tor bases are AC-coupled to the input
and DC-biased to ground, so their emit-
ters will be pulled up to about 0.6V
by the 10kW emitter resistors and the
2.7kW op amp feedback resistors.
Q1 and Q2 will each pass about 1mA,
which will primarily flow through the
4.7kW collector resistors, resulting in
pins 2 and 3 of IC1a being about 4V
above the negative rail.
The AC input is a differential voltage
between the bases of Q1 and Q2. The
emitters of Q1 and Q2 are the feedback
point, via the 2.7kW resistors. As the Fig.4: it’s best to fit the power
input is differential, the 100W resistor supply components as shown here,
(and 1.2kW if the contacts of relay RLY3 then power it up and verify that all
are not shorting it out) see the total dif- the supply rails are correct before
ferential voltage; the midpoint of these installing the remaining parts. That
can be seen as a ‘virtual zero point’. way, if there is a fault, it likely
So the gain is defined by the 2.7kW won’t blow anything up.
feedback resistors with the parallel

Practical Electronics | June | 2024 33


Photo 1: an complexity and size down. We use a
exterior view of single 15V AC plugpack to power the
the completed unit. As mentioned earlier, dual half-
front panel
assembly.
wave rectification via BR1 provides the
Dymo labels split rails to drive the power amplifier.
will help you to This avoids the need for any fancy
remember what voltage inverting IC or the use of a sin-
each switch gle-rail topology for the whole Test Jig.
and terminal It does mean that our supply rails are
does down the 50Hz half-wave rectified, with resul-
track! tant ripple challenges. So we have dou-
bled down on the filter capacitors and
used two 2200µF capacitors per rail,
which in a standard application, would
be overkill. In this case, a couple of
pounds worth of extra capacitors saves
on using a dual-winding transformer.
Fig.5: once With 4400µF per rail, there will only
you’ve tested
be a couple of volts ripple on the rails
the power
supply, you during higher-power tests.
can fit all the The small-signal circuitry needs
components as clean power, so we have added
shown here. LM317/337 regulators generating reg-
Ensure all ulated rails at nominally ±12V. These
the TO-220 are textbook circuits.
devices are Generating the 48V phantom power
insulated from rail for the measurement microphone is
their heatsinks a little more interesting. We use a volt-
and watch the
age doubler circuit that steals energy
polarity of the
ICs, diodes and from the positive unfiltered rail via
electrolytic diode D3 charging the 220µF capaci-
capacitors. Two tor at its cathode on negative voltage
of the 22µF swings at the plugpack tip, then dump-
electrolytics ing its charge into the other 220µF
are non- capacitor via D2 on positive swings.
polarised The second 220µF capacitor ‘sits on
types (near top of’ the main unfiltered rail, result-
the lower-left ing in close to 70V DC at the cathode of
corner), so
D2 when it is unloaded. This is dropped
no polarity
markings are to 48V by an LM317HV adjustable reg-
shown. ulator. You could use a normal LM317,
provided you never short its output to
ground. In typical operation, its output
goes via a 1kW resistor, so there is no
chance of that happening in daily use.
The current drawn from the 48V rail
is never more than 14mA, so the 220µF
capacitors are more than sufficient to
keep ripple below 1V.
We placed heatsinks on all regulators,
but didn’t notice them getting that warm.
If you want to save a little expense, you
might get away without using them.

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

34 Practical Electronics | June | 2024


section, as shown in Fig.4. Be careful
with the orientation of the diodes as
they vary. Follow with the MKT and
electrolytic capacitors in this section
(watching the polarity of the electrolyt-
ics), then the rectifier, fuse holder and
connectors. Install a 2A fuse.
Finally, attach the regulators to the
heatsinks with a TO-220 insulator kit
on each. Don’t tighten the screws until
you have inserted the regulators with
their heatsinks into the PCB. Then you
can solder the heatsink mounting pins
along with the regulator pins.

Testing the power supply


Plug in the 15V AC plugpack and check
the unregulated rails by measuring the
voltages on pins 3 and 5 of the LM1875
IC relative to GND (there is a GND test
point at upper left in the Audio Input
Buffer section). These voltages ought
to be 18-24V DC. If they measure low,
check the AC voltage and verify that
the bridge rectifier has been installed
the right way around. Also check the
capacitor orientations.
Assuming that’s OK, measure the
±12V rails at pin 2 of the LM317 (REG3)
and pin 3 of the LM337 (REG4). These
ought to be within 1V. If not, verify that Fig.6: drill the front panel supplied with the recommended case as shown here,
the regulators are in the right spots, making sure the pre-drilled countersunk screw holes face outwards.
the correct resistors have been used
and the diodes are oriented properly.
There should always be 1.25V between
the ADJ and OUT pins of the LM3X7s.
Next, check that the 48V rail is within
3V (ie, 45-51V). This is accessible on
pin 2 of the LM317HV. If it is off, ver-
ify that the input voltage on its pin 3 is
well above 48V. Also check the resistor
values around this regulator and that
the capacitors and diodes are the right
way around.

Finishing off the PCB


Now that we know the power supply
is working, remove power and fit all
the remaining parts, as shown in Fig.5.
As usual, start with the lower-profile
components by mounting the resis-
tors, diodes, relays, NE5532 ICs and
right-angle headers first. Then move on
to the larger parts, including the capac-
itors and RCA sockets.
As with the regulators, loosely attach
the LM1875 to the large heatsink and
use an insulating kit. Insert the IC into
its pads and solder the heatsink to the
board. The solder pins will require some
effort to get hot enough, but they do work
(it is not screwed to the PCB). Once it
is held in place securely, tighten up the
IC mounting screw and solder its leads.
Note that there are two bipolar
(non-polarised) electrolytic capacitors Fig.7: drill the rear panel as shown here, again paying attention to which side
right next to CON2, as we don’t know has the holes countersunk. For the rectangular hole, you can drill an 11mm
if an input will have a DC offset. They hole and then file the corners out. Otherwise, you can drill out the dotted hole
have polarity marks on the PCB, but marked in red which only leaves enough room for the plug sleeve.

Practical Electronics | June | 2024 35


Fig.8: use this diagram and Photos to wire up the front panel. By using polarised header plugs, the whole assembly
can be disconnected from the main board, making assembly and disassembly easier.

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.

Photo 2: heatshrink tubing and cable


ties keep the front panel wiring
manageable. Note the 10W reference
resistor soldered across the binding
post terminals.

Fig.9: filing and drilling an M3


stud makes a convenient place to
attach a test probe. However, you
could devise your own scheme
if you prefer; a loop of tinned
copper wire would be sufficient.

36 Practical Electronics | June | 2024


The assembled PCB, ready to be wired up to the front panel via eight right-angle polarised headers. That makes plugging
and unplugging easier when it is mounted in the instrument case.

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.

Practical Electronics | June | 2024 37


Photo 4: the rear panel is held to Testing, calibration and usage
the case by the four corner screws, With the unit now assembled and
while the PCB is held to the working, the next step will be to
rear panel by the two install the software, set it up and ver-
screws that go into the ify that it’s working as expected. As
RCA socket plastic the ‘REW’ software is not tied to this
housings. hardware, we have those instructions
in a small separate article starting on
page 40.
You will need a computer with a
reasonably good sound card that has
stereo analogue inputs and outputs to
hook up to the Loudspeaker Test Jig. If
your computer lacks those, consider
building our very high-quality exter-
nal USB SuperCodec, described in the
September to November 2021 issues.
That unit is capable of simultane-
ous 192kHz, 24-bit recording and play-
back and has a rated THD figure of just
0.0001% (-120dB) and a THD+N figure
● 
Solder pin 1 of CON3 to the Mic position. This should be close to the of 0.0005% (-106dB) for playback and
Monitor post. Fold the ground wire amplitude of your test signal (about 0.00063% (-105dB) for recording. You
back and insulate it. 200mV RMS). don’t need a sound card with such high
● Solder pin 1 of CON2 to the ground Next, ensure you have the phantom quality for speaker testing, but it cer-
pin of your XLR, pin 2 to hot (+) and power enabled by putting a shorting tainly doesn’t hurt!
pin 3 to cold (−). block on LK1 and check that you have Whatever sound card you use, go
48V ±3V on the hot and cold pins of into your operating system’s settings
These should all now plug in neatly to CON2. Plug in your test microphone and ensure it is the active device for
the PCB. Use a couple of tie wraps/cable and check for a signal on pin 1 of CON3 recording and playback. In recent ver-
ties to secure the wiring after checking and your Mic test point on the front sions of Windows, you can do that by
that it all works. You are now ready to panel. If you have trouble, check that: right-clicking the speaker icon in the
test it properly! ● There is about 10.3V across the 10kW screen’s lower right-hand corner and
Once wired up, the front panel will resistors connected to the emitters of selecting ‘Open Sound settings’.
look something like Photos 2 and 3. Q1 and Q2 (both above and to the If your sound card’s sockets are
Assembly to the rear panel just left of Q1). 3.5mm jack sockets, you can use 3.5mm
involves sliding the board into the case ● There is about 3.7V across the 4.7kW jack plug to twin RCA plug cables to
and using two 4G screws to secure the resistors at the collectors of Q1 and connect them to the Input and Output
RCA connectors to the rear panel, as Q2 (next to D7 and D8), and that sockets on the Loudspeaker Testing Jig.
shown in Photo 4. these voltages are the same. If the sound card has RCA sockets, like
● Pin 1 of IC2 is close to 0V. the SuperCodec, use twin RCA to RCA
Operational testing leads instead. Then, connect the Mon-
It’s best to plug the front panel into the If any of these are wildly off, verify the itor outputs to your amplifier inputs
PCB before inserting the PCB into the component values and orientations in with a twin RCA to RCA lead.
case for testing, as you can’t probe the these areas; check for short circuits and When ready, turn to page 40 for the
test points on the PCB once it is in the that you have used the right transistors. final testing procedure.
case. When you’ve verified it’s all work-
ing correctly, you can slide the PCB in
and then attach the front panel.
Set the jumper for the input you
expect to use for testing on JP1. With-
out this, the power amp will not get a
signal, although most programs seem to
drive both outputs with the test signal.
Apply a signal to the input (CON3a
left and right) of 200mV RMS at about
1kHz. A buffered version of this sig-
nal should appear at CON3b. Toggle
each switch and check that you hear
the relays click. If not, check that you
have used the correct relays and that
the diodes are the right way around.
Set the ‘Speaker/Comp’ switch to
Speaker. Monitor the Amp Out at pin
1 of CON4 and check that you see an
amplified version of the input signal at
about 2V RMS. Switch the ‘Speaker/ A real-world application of the
Comp’ switch at CON6 and check that Jig: measuring the frequency
the output is attenuated in the ‘Comp’ response of a bookshelf speaker.

38 Practical Electronics | June | 2024


Sysblocks
Sysblocks
Sysblocks
Flowcode A4 Advert EPE 25 01 24 [Link] 1 31/01/2024 [Link]

Sysblocks

Create highly functional electronic systems using PIC32 technology to


manipulate
Create analogue signals
highly functional using
electronic Flowcode
systems 10.1
using and technology
PIC32 Sysblocks. to
Fantasticsignals
manipulate analogue for digital audio
using applications.
Flowcode 10.1 and Sysblocks.
Create highly functional electronic systems using PIC32 technology to
Fantastic for digital audio applications.
manipulate analogue signals using Flowcode 10.1 and Sysblocks.
Flowcode Pro, PIC32 pack with Sysblocks board, cables and accessories bundle £610 + VAT
Fantastic for digital audio applications.
Flowcode
Create with
highly
Flowcode PIC32 pack with
with Sysblocks
functional
Pro, PIC32 pack Sysblocks board,
electronic cables and
systems
board, cables and accessories
using bundle
PIC32bundle
accessories £330 ++ VAT
technology
£610 VAT
to
manipulate
Flowcode with 10%analogue
PIC32 packfor
off signals
withPE
Sysblocks
readersusing
board, Flowcode
cables
using 10.1 andbundle
and accessories
code: PESYS10 Sysblocks.
£330 + VAT
Flowcode Pro, PIC32 pack with Sysblocks board, cables and accessories bundle £610 + VAT
Fantastic for digital audio applications.
10% off for PE readers using code: PESYS10
Flowcode with PIC32 pack with Sysblocks board, cables and accessories bundle £330 + VAT
Flowcode 10.1 with more than 20 microcontroller targets including
10% off for PE readers using code: PESYS10
Flowcode
ArduinoPro,Uno,
PIC32PIC18877,
pack with Sysblocks board, cablesisand accessories bundle £610 + VAT
Flowcode 10.1 with moreRPI2B, and
than 20 ESP32 now
microcontroller freetargets
for hobbyists.
including
Flowcode with PIC32 pack with Sysblocks board, cables and accessories bundle £330 + VAT
Arduino Uno, PIC18877, RPI2B, and ESP32 is now free for hobbyists.
Flowcode 10.1 with more than 20 microcontroller targets including
+44 (0) 10% off 252
for PE readers using code: PESYS10
sales@[Link]
Arduino Uno,1422
PIC18877, 380RPI2B, and ESP32 is now free for hobbyists.
+44 (0) 1422 252 380 sales@[Link]
www.fl[Link]
Flowcode 10.1 with more than 20 microcontroller targets including
+44 (0) 1422www.fl[Link]
252 380 sales@[Link]
Arduino Uno, PIC18877, RPI2B, and ESP32 is now free for hobbyists.
www.fl[Link]
+44 (0) 1422 252 380 sales@[Link]

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).

Screen 1: the REW


Preferences dialog. Check
that the input and output
devices and sampling rate
settings are set correctly.

40 Practical Electronics | June | 2024


6. Click Next and check that you have
levels that are about right. You
should find that with about 200mV
RMS output, you see a measured
signal in the region of -10dB on the
loopback test. Sound cards vary in
sensitivity, so your voltages may
vary somewhat from ours.
7. Then click Next until the measure-
ment sweep is made. You will get
a graph similar to that in Screen 2.
8.  On the tab for the measurement
you just made, add any notes you
need. Then click the disk symbol
on the measurement and save this
file somewhere sensible.
9. Now press Alt+Tab to switch back
to the preferences screen and click Screen 2: this shows the frequency response REW has calculated for the
on ‘Make Cal File’, which is below measurement system, including the computer sound card.
the ‘Calibrate Sound Card’ button.
10. Navigate to where you saved the
previous measurement. Select ‘all
files’ from the pulldown ‘files of
type’ and then select your calibra-
tion measurement. Click ‘Save’.
11. Your sound card is now calibrated.

Calibrating the Test Jig


1. Set your Loudspeaker Test Jig to
‘component’ test and ensure there
is nothing connected to the Speaker
and DUT connectors and that the
Attenuator is out.
2. You only need to do this on the
first measurement you make. Click
‘Measure’ in the top left corner of
the main REW screen (Screen 3).
If you have not calibrated the SPL,
you will get a message box; you can
ignore it for now.
3. Now enter your sense resistor value
in the Rsense box at the right of
this window.
4. Click on ‘Open Circuit Cal’ and
follow the instructions. Save the Screen 3: you make impedance and frequency response measurements using
file along with your others. Do the this screen in the REW software.
same for ‘Short Circuit Cal’ and use
a known resistor value for ‘Refer-
ence Cal’.
5. You can now measure an imped-
ance. A window similar to that
shown in Screen 4 will pop up.
Screen 5 shows the measured
impedance of a subwoofer.

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.

Practical Electronics | June | 2024 41


3. 
Connect your speaker across the 5. Set the attenuator on or off depend- 7. The system will run a sweep and
Speaker terminals. ing on the level you intend to test at. you will hear the chirp.
4. Plug your microphone in and set 6. Click Measurement again, and this 8. Check that the levels are reasonable.
the microphone gain as required. time select ‘SPL’. If necessary, adjust the sound card
output level, the microphone gain
switch and the output Attenuator
for the Loudspeaker Test Jig. You
will find that once you are set up
for testing, these don’t change often.
9. Watch the levels; if the outputs or
inputs clip, you will get odd results.
If this happens, investigate the
cause and correct it.
10. You will see the result pop up in a
window similar to that in Screen 6,
a very rough plot of a speaker done
on our workbench.
11. You can change the smoothing set-
ting, show a waterfall plot, show
distortion and a range of other plots
from this measurement, which is
Screen 5: a measurement of the impedance of a subwoofer taken using REW pretty impressive.
and our Test Jig. It gives a nice smooth plot that shows resonance peaks at about
31Hz and 72Hz (driver/box) plus 850Hz and 2.5kHz (cone breakup). Tips
● The room will play havoc with far-
field measurements. If you do this
in a room, you will never get a 20Hz
to 20kHz plot without all sorts of
peaks and dips. Just accept this.
● You will need to apply smoothing
to get a plot anything like what you
see in Hi-Fi magazines, as that is
what they do.
● Testing outside is good; the ground
is always there, though. This will
generate ‘ground bounce’, which is
perfectly natural, and you need to
work around this unless you point
your speaker up and hang your
microphone from a ladder. Yes, we
have done this!
Screen 6: a frequency response plot of a wide-range driver made using REW. From here, we recommend that
This sort of information is invaluable in speaker design and tweaking. you explore some of the excellent

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.

42 Practical Electronics | June | 2024


resources on the Internet for these Audio’ is a good place to start find-
programs. REW is more active, but ing like-minded people.
Speaker Workshop has a strong fol- Reproduced by arrangement with
lowing. The DIY audio community SILICON CHIP magazine 2024.
has several quite active groups. ‘DIY [Link]

How to get Speaker Workshop up and running


If you want to try out Speaker Workshop, read relevant parts of the ‘unofficial
manual’ on the download page at: [Link]
Ignore the ‘failed to update system registry’ warning on startup. You must
[Link]/epe
set up a project:
1. Create a new file by clicking on ‘File’ then ‘New’.
2. This program works by adding resources to the ‘system’. Resources might
be an enclosure, driver or network.
3. You need to add a driver at minimum. To do this, open the ‘Resource’ menu
and select ‘New’ then ‘Driver’. You need to select this to make measure-
ments – see Screen 7.
To calibrate the system:
1. From the ‘Options’ menu, select ‘Calibrate’.
2. Make sure there are no leads connected to the Amp and DUT jumpers on
the Test Jig.
3. Switch the Jig to ‘Comp’ and switch the measurement attenuator out. In this
position, both sound card channels measure the amplified output.
4. Click ‘Test’ on the channel difference box. Follow the instructions to run the
calibration, finishing with ‘OK’ to accept it.
After calibration, look at the bottom left of the screen. This shows the digital
values read in the calibration. The maximum must always be less than ±32768
and ideally in the 10,000-20,000 region. Adjust your PC’s output level and Jig - USB - PWM
attenuator setting until you get sensible readings. We generally find that an - Ethernet - Encoders
output level in the region of 40% works well. - Web server - LCD
To set the Reference, open the ‘Options’ menu, then the ‘Preferences’ tab. - Modbus - Analog inputs
- CNC (Mach3/4)
Click on the ‘Impedance’ tab and type the exact resistance of your reference - IO
- Compact PLC
resistor in the Impedance Jig definition box.
To make an impedance test:
1. Connect your DUT between the DUT and ground terminals.
2. Select the driver we created earlier. It will become highlighted in blue.
3. Open the ‘Measure’ menu and click on ‘Impedance’.
4. Once the measurement is complete, check that the values at the lower left
of the screen are reasonable. You should see a window pop up with the
measurement, as shown in Screen 8. Our Low Ohms Meter measured this
resistor as 10.09W.
5. If the impedance plot is very fuzzy, check that you are not clipping the sound - up to 256 - up to 32
microsteps
card or amplifier. - 50 V / 6 A
microsteps
- 30 V / 2.5 A
To make a speaker frequency response test: - USB configuration
- Isolated
1. Switch the Jig to SPKR.
2. Switch the attenuator next to the DUT connector in.
3. Connect a driver to the AMP output, not the DUT output. PoScope Mega1+
4. Plug in your test microphone and place it close to your speaker.
5. Click on the driver icon you created and then select the ‘Measure’ pulldown, PoScope Mega50
select the ‘Frequency response’ tab, then ‘Nearfield’.
6. You should get a reasonably clean frequency response. It will have more
noise than one from REW and may need smoothing. If the frequency response
graph is very fuzzy, check that you are not clipping the sound card or amplifier.

- 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.

Practical Electronics | June | 2024 43


Teach-In 2024
Learn electronics with
the ESP32 by Mike Tooley
Part 4 – Using LED displays

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)

Fig.4.1 Segment labelling


in a typical seven-segment Fig.4.2 Hexadecimal numbers displayed using a seven-segment
LED display. LED display.

44 Practical Electronics | June | 2024


Gotcha!
Seven-segment displays come in two basic types: common-anode and common-
cathode types. Since they are outwardly identical it’s important to ensure that
you are using the correct type.

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.

Listing 4.1 Seven-segment LED counter


/* Counter based on a single common // 5 => a,c,d,f,g
cathode seven-segment LED display */ digitalWrite(a, HIGH);
digitalWrite(b, LOW);
// Assign display segments to GPIO pins digitalWrite(c, HIGH);
int a = 22; digitalWrite(d, HIGH);
int b = 23; digitalWrite(e, LOW);
int c = 18; digitalWrite(f, HIGH);
int d = 17; digitalWrite(g, HIGH);
int e = 16; delay(delayTime);
Fig.4.3 Common-cathode and common- int f = 21; // 6 => a,c,d,e,f,g
anode LED displays. int g = 19; digitalWrite(a, HIGH);
digitalWrite(b, LOW);
anode connection is invariably taken to
// Set delay between counts digitalWrite(c, HIGH);
the common positive rail (usually VCC). int delayTime = 1000; // 1 second digitalWrite(d, HIGH);
digitalWrite(e, HIGH);
Check it out! void setup() { digitalWrite(f, HIGH);
To interface a single seven-segment // Initialise GPIO pins as outputs digitalWrite(g, HIGH);
display to an ESP32 you will need eight pinMode(a, OUTPUT); // Segment a delay(delayTime);
connections, but an extra connection will pinMode(b, OUTPUT); // Segment b // 7 => a,b,c
be required if you are using the decimal pinMode(c, OUTPUT); // Segment c digitalWrite(a, HIGH);
point. Fig.4.4 shows how this is done pinMode(d, OUTPUT); // Segment d digitalWrite(b, HIGH);
using a common-cathode display. Seven pinMode(e, OUTPUT); // Segment e digitalWrite(c, HIGH);
pinMode(f, OUTPUT); // Segment f digitalWrite(d, LOW);
series resistors (R1 to R7) each of 330Ω
pinMode(g, OUTPUT); // Segment g digitalWrite(e, LOW);
are used to limit the individual segment } digitalWrite(f, LOW);
currents to a few mA. Note that when all digitalWrite(g, LOW);
the segments are illuminated you will void loop() { // Repeat forever delay(delayTime);
need to be aware of the total load on the // 1 => b,c // 8 => a,b,c,d,e,f,g
ESP32 and its power source. In the case digitalWrite(a, LOW); digitalWrite(a, HIGH);
of battery-operated equipment, you may digitalWrite(b, HIGH); digitalWrite(b, HIGH);
find it necessary to limit the individual digitalWrite(c, HIGH); digitalWrite(c, HIGH);
segment currents to less than about 10mA. digitalWrite(d, LOW); digitalWrite(d, HIGH);
A series resistance of 330Ω should suffice digitalWrite(e, LOW); digitalWrite(e, HIGH);
digitalWrite(f, LOW); digitalWrite(f, HIGH);
for most low-power applications yet still
digitalWrite(g, LOW); digitalWrite(g, HIGH);
produce a reasonably bright display. delay(delayTime); delay(delayTime);
Typical display connections for a // 2 => a,b,d,e,g // 9 => a,b,c,d,f,g
common-cathode seven-segment display digitalWrite(a, HIGH); digitalWrite(a, HIGH);
are shown in Fig.4.5. Note that there digitalWrite(b, HIGH); digitalWrite(b, HIGH);
are two 0V pins. These are the common digitalWrite(c, LOW); digitalWrite(c, HIGH);
connections, and they will normally digitalWrite(d, HIGH); digitalWrite(d, HIGH);
be taken to GND. Fig.4.6 shows the digitalWrite(e, HIGH); digitalWrite(e, LOW);
breadboard wiring. digitalWrite(f, LOW); digitalWrite(f, HIGH);
digitalWrite(g, HIGH); digitalWrite(g, HIGH);
delay(delayTime); delay(delayTime);
// 3 => a,b,c,d,g // 0 => a,b,c,d,e,f
digitalWrite(a, HIGH); digitalWrite(a, HIGH);
digitalWrite(b, HIGH); digitalWrite(b, HIGH);
digitalWrite(c, HIGH); digitalWrite(c, HIGH);
digitalWrite(d, HIGH); digitalWrite(d, HIGH);
digitalWrite(e, LOW); digitalWrite(e, HIGH);
digitalWrite(f, LOW); digitalWrite(f, HIGH);
digitalWrite(g, HIGH); digitalWrite(g, LOW);
delay(delayTime); delay(delayTime);
// 4 => b,c,f,g }
digitalWrite(a, LOW);
digitalWrite(b, HIGH);
digitalWrite(c, HIGH);
digitalWrite(d, LOW);
digitalWrite(e, LOW);
digitalWrite(f, HIGH);
Fig.4.4 Interfacing an individual seven- digitalWrite(g, HIGH);
segment LED display to an ESP32. delay(delayTime);

Practical Electronics | June | 2024 45


Fig.4.5 Typical pin connections for
a common-cathode seven-segment
LED display.
We’ve liberally commented the code in
Listing 4.1 to make it easy to follow. Note
that, as with all our code examples, we’ve
not attempted to oversimplify the code nor
present it in minimal form. Instead, we’ve
tried to make it as clear and unambiguous
as possible. As you become more proficient
with coding you will undoubtedly be able
to improve on our efforts and produce
something more compact.

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

46 Practical Electronics | June | 2024


Listing A – code fragment
ESR Electronic Components Ltd
// Generate random numbers in the range 1 to 9

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

Fig.4.7 Interfacing a 4-digit seven-segment LED display module


to an ESP32.
Station Road
Listing 4.2 you will see the two lines of code that do this: Cullercoats
North Shields
Tyne & Wear
#include <ESP32Time.h> // To use the ESP32’s RTC NE30 4PQ
Tel: 0191 2514363 sales@[Link] [Link]
#include <TM1637Display.h> // To use the TM1637
nature and the voltage read from an unconnected analogue pin
If you don’t have these library files installed they can be quickly will also be random. So, to seed the random number generator
and easily downloaded from within the Arduino IDE. Just from the voltage present on analogue input A0 you would just
search for the file that you need using the Library Manager. need to add the following line of code:

Coding Workshop randomSeed(analogRead(0));


For applications such as games and password generators
you might sometimes find that you need to generate random Listing A shows a fragment of code that will allow you to
numbers. Unfortunately, this can be something of a problem check this for yourself. Note that when you’ve successfully
in a microcomputer environment where nothing occurs that compiled and uploaded the code you will need to start the
can ever be described as truly random. To meet this need the Serial Monitor after execution to see the values produced.
ESP32’s C++ language includes the random() function. that Now for a second example (Listing B) using the random()
generates values that although not truly random in a strict function in the form of a random HEADS and TAILS generator.
mathematical sese can at least be considered to be usefully This time we are only interested in random numbers in the
‘pseudo random’. Let’s suppose that you need a random range 0 and 1, where 0 will display a TAILS result, and 1
integer in the range 1 (minimum) to 9
(maximum). The following line of code
would do the trick:

randomValue = random(1, 10);

Note that we would need to have


previously defined randomValue as a
variable using a line of the form:

long randomValue;

To improve the randomness of the values


returned from random() it’s possible to
change the seed that’s used by the function
(otherwise the random number generator
will always use the same seed value).
There’s a rather neat way of doing this.
The noise present on any of the ESP32’s
analogue inputs is inherently random in Fig.4.8 Breadboard wiring for the ESP32 and 4-digit seven-segment LED display module.

Practical Electronics | June | 2024 47


Listing B – code fragment

// Coin toss producing random HEADS and TAILs

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).

Gotcha! The Serial Peripheral Interface (SPI)


The maximum random value generated by random() is
SPI is a communication standard that’s used to interface
one less than the function’s second parameter. For example,
to generate six different random numbers in the range 1 one or more peripheral devices (known as ‘slaves’) to a
to 6 (for example, the faces on dice) the function would microprocessor
need to be random(1, 7) not random(1, 6). This may or microcontroller
sound obvious but it is often forgotten. (referred to as the
‘master’). A wide

Table 4.1 ESP32 SPI implementation

VSPI pin HSPI pin


Designation Function Direction
number number

SCLK Serial clock Output from ESP32 18 14


MOSI Master output/slave input Output from ESP32 23 13
MISO Master input/slave output Input to ESP32 19 12
CS Chip select Output from ESP32 5 15
GND Ground Common GND GND Fig.4.10 An 8×8 LED matrix display.

48 Practical Electronics | June | 2024


Fig.4.11 Using SPI to interface a single 8×8 Fig.4.13 Circuit arrangement for the dice roller.
LED matrix display to an ESP32.

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.

Listing 4.3 Dice roller code


variety of SPI-compatible devices are available, and we
will be introducing several of them in this Teach-In series. /* Dice roller based on 8x8 LED matrix display
and motion sensor */
They include displays (both LED and LCD types), ADCs and
#include <MD_Parola.h>
DACs, as well as temperature sensors, accelerometers and #include <MD_MAX72xx.h>
GPIO expansion chips. The SPI bus is capable of operating #include <SPI.h>
at high speed over short distances and it normally requires
a four-wire connection with a chip select (CS) connection // Uncomment depending on display type
dedicated to each peripheral SPI device. // #define HARDWARE_TYPE MD_MAX72XX::FC16_HW
The SPI bus is a synchronous (serial clocked) interface #define HARDWARE_TYPE MD_MAX72XX::GENERIC_HW
capable of supporting data transfer in both directions, master
to slave and slave to master, at the same time – this is referred // Define display and I/O pins
to as ‘full duplex’ operation. The ESP32’s SPI implementation #define MAX_DEVICES 1
#define CS_PIN 5
uses four signal wires (plus ground). These are listed in Table
const int sensorPin = 17;
4.1 together with the pin connections conventionally used on MD_Parola Display = MD_Parola(HARDWARE_TYPE,
ESP32 development boards. CS_PIN, MAX_DEVICES);
The ESP32 is capable of handling four peripheral
devices connected using the SPI bus with two reserved for void setup() {
communicating with the built-in flash memory. This leaves two [Link]();
independent SPI channel for your use, VSPI and HSPI and each [Link](0);
of these can drive up to a maximum of three external slaves. [Link]();
The method of interfacing a single 8×8 LED matrix display to randomSeed(analogRead(27)); // Seed from noise
an ESP32 via SPI is shown in Fig.4.11. Here, five connections are on pin 27
}
needed to drive a total of 64 LED. The connections required are:
void loop() {
VCC to +5V supply for the ESP32 // Wait for input from the motion sensor
DIN to D23 on the ESP32 int sensorState = digitalRead(sensorPin);
CLK to D18 on the ESP32 int lastSensorState;
CS to D5 on the ESP32 while (sensorState == lastSensorState) {
GND to GND for the ESP32 (don’t forget this one!). sensorState = digitalRead(sensorPin);
[Link](false);
[Link](PA_CENTER);
Gotcha! [Link](“?”);
If you are connecting multiple SPI peripherals it is essential }
to ensure that each device has a unique chip select (CS)
connection. Failure to observe this precaution will yield // We have movement so roll it
unpredictable results. for (int i = 0; i < 10; i++) {
[Link](true);
[Link](PA_CENTER);
[Link](“?”);
delay(50);
[Link](false);
[Link](PA_CENTER);
[Link](“?”);
delay(50);
}

// And then display the result


[Link](PA_CENTER);
[Link](String(random(1, 7)));
delay(2000);
lastSensorState = sensorState;
Fig.4.12 A low-cost motion sensor. }

Practical Electronics | June | 2024 49


Listing 4.4 Text message display using four 8×8 LED
Gotcha!

+
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.

Fig.4.15 Text display produced by Listing 4.4.

50 Practical Electronics | June | 2024


ETI BUNDLE (1) Teach-In 3, 4 and 5 – all on CD-ROM – only £18.95
ELECTRONICS TEACH-IN 3 – CD-ROM ELECTRONICS TEACH-IN 5 – CD-ROM
ELECTRONICS ELECTRONICS
EE M EE M
FR -RO FR -RO £8.99

Mike & Richard Tooley CD


JUMP START CD

TEACH-IN 3 TEACH-IN 5
£7.99

Mike & Richard Tooley


The three sections of the Teach-In 3 CD-ROM cover a
FROM THE PUBLISHERS OF

FROM THE PUBLISHERS OF

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

The projects are: n Moisture Detector n Quiz


colleges
i The techniques of electronic
project construction PRACTICALLY SPEAKING
The first section (80 pages) is dedicated to Circuit INGENUITY UNLIMITED Machine n Battery Voltage Checker n Solar- The techniques of project construction

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

queries on circuit design problems – from voltage nics


Teach-
In FREE Circuits n Frost Alarm n Mini Christmas Lights n FREE M
ro TEACH-IN 1 CD-ROM bo
rne
Pu blishing Ltd 20
10 CD-RO
TEACH-IN 2
regulation to using SPICE circuit simulation software. iPod Speaker n Logic Probe n DC Motor Controller
im

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

Receiver n Temperature Alarm.


microcontro software

covers hands-on aspects of electronics construction.


ws
for Windo

n Program i A complete stand-alone


CD ROM
This CD
should
start
y, if not
microcontrollers
Simulatio [Link]
Circuit d version) tutorial in 11 parts plus free
8 TINA (Limite ramming double-click
In 2 Plus MikroElektronika,
CODE V3
PIC Prog n)
software nicsorne Teach-

Again, a whole range of subjects, from soldering to


8 FLOW d versio
Ele©ctro Publishing
Ltd
dsPIC are Microchip and L-Tek PoScope
Software Quizzes to Test
(Limite PIC and rated
2013 Wimb MPLAB, logy Incorpo ogy

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

avoiding problems with static electricity and identifying


Inc.
3 [Link]
29/07/201

d 1
In 2 - [Link]

components is covered. Finally, our collection of


Teach
Teach In 5 [Link] 1 29/07/2013 [Link]
Teach In 3 [Link] 1 06/05/2010 [Link]

PIC’n’ Mix – starting out with the popular range of PIC


Ingenuity Unlimited circuits provides over 40 circuit designs submitted by readers. microcontrollers and Practically Speaking – tips and techniques for project construction.
The CD-ROM also contains the complete Electronics Teach-In 1 book, which
provides a broad-based introduction to electronics in PDF form, plus interactive 29/04/20
10 [Link]
The CD-ROM also contains:
quizzes to test your knowledge and TINA circuit simulation software (a limited n Complete Teach-In 2 book, a practical introduction to PIC microprocessors
n MikroElektronika, Microchip and L-Tek PoScope software.
dd 1

version – plus a specially written TINA Tutorial).


CD [Link]

The Teach-In 1 series covers everything from electric current through to


microprocessors and microcontrollers, and each part includes demonstration circuits
to build on breadboards or to simulate on your PC.

ELECTRONICS TEACH-IN 4 – CD-ROM Three Teach-ins for the great price of


ELECTRONICS £18.95
EE M
FR -RO £8.99

A BROAD-BASED INTRODUCTION TO CD

ELECTRONICS
TEACH-IN 4
FROM THE PUBLISHERS OF

Mike & Richard Tooley FREE

PLUS you also get the contents of the


CD-RO
M
A BROAD-BASED WORT

The Teach-In 4 CD-ROM covers three of the most


H
£29.9
INTRODuCTION TO ELECTRONICS 5

important electronics units that are currently studied in


free CD-ROM from each issue...
i An eleven part tutorial
i uses inexpensive circuit

many schools and colleges. These include, Edexcel


simulation software

BTEC level 2 awards and the electronics units of the


... so that’s another TWO Teach-Ins and
FREE M
CD-RO

Diploma in Engineering, Level 2. THE MODERN ELECTRONICS MANuAL


The essential reference
The CD-ROM also contains the full Modern
The Full Modern Electronics Manual!
work for everyone
studying electronics

Electronics Manual, worth £29.95. The Manual i Over 800 PDF pages

contains over 800 pages of electronics theory,


i In-depth theory
i Extensive data tables
autorun,
should
This software in Windows

What a Bargain!!
if not, open double-click
and
Explorer f
[Link]

projects, data, assembly instructions and web links.


This CD-ROM
requires
and web links
UAL
Reader™
Adobe® from
dable Free

[Link].u
Downloa [Link]
[Link]

BA SE .epe mag
k

A package of exceptional value that will appeal


www ne Publishi
ng Ltd.
2011

© Wimbor

to anyone interested in learning about electronics – Teach In 4 [Link] 1 14/11/2011 [Link]

hobbyists, students or professionals.

ETI BUNDLE (2) Teach-In 6, 7 and 8 – all on CD-ROM – only £18.95


ELECTRONICS TEACH-IN 6 – CD-ROM ELECTRONICS TEACH-IN 7 – CD-ROM ELECTRONICS TEACH-IN 8 – CD-ROM
A COMPREHENSIVE GUIDE TO RASPBERRY Pi DISCRETE LINEAR CIRCUIT DESIGN INTRODUCING THE ARDUINO
Mike & Richard Tooley Mike & Richard Tooley Mike & Richard Tooley
Teach-In 6 contains an exciting series of articles that Teach-In 7 is a complete introduction to the design of Hardware: learn about components and circuits
provides a complete introduction to the Raspberry analogue electronic circuits. It is ideal for everyone Programming: powerful integrated development system
Pi, the low cost computer that has taken the educa- interested in electronics as a hobby and for those Microcontrollers: understand control operations
tion and computing world by storm. studying technology at schools and colleges. The Communications: connect to PCs and other Arduinos.
This latest book in our Teach-In series will appeal CD-ROM also contains all the circuit software for Teach-In 8 is an exciting series designed for
to electronics enthusiasts and computer buffs who the course, plus demo CAD software for use with the electronics enthusiasts who want to get to grips with
want to get to grips with the Raspberry Pi. Teach-In series. the inexpensive, popular Arduino microcontroller, as
n Discrete Linear Circuit Design well as coding enthusiasts who want to explore
Teach-In 6 is for anyone searching for ideas to use n Understand linear circuit design
their Pi, or who has an idea for a project but doesn’t hardware and interfacing. It will provide a one-stop
n Learn with ‘TINA’ – modern CAD software source of ideas and practical information.
know how to turn it into reality. This book will prove n Design simple, but elegant circuits
invaluable for anyone fascinated by the revolutionary nF  ive projects to build: The Arduino offers a truly effective platform for
Pi. It covers: i) Pre-amp developing a huge variety of projects; from operating
n Pi programming ii) Headphone Amp a set of Christmas tree lights to remotely controlling a
n Pi hardware iii) Tone Control robotic vehicle through wireless or the Internet.
n Pi communications iv) VU-meter Teach-In 8 is based around a series of practical
n Pi Projects v) High Performance Audio Power Amp. projects with plenty of information for customisation.
n Pi Class
n Python Quickstart This book also includes PIC n’ Mix: ‘PICs and the
PLUS PICkit 3 – A Beginners
n Pi World E
guide’ by Mike O’Keefe FCRDE-ROM
EE M

n ...and much more!


ELECTRONICS ELECTRONICS ELECTRONICS
EE OM
FR -R FR -RO £8.99

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

Machines part 1 and 2’.


THE TEACH-
IN 8
FROM THE PUBLISHERS OF SERIES

the necessary software RASPBERRY Pi ®


DISCRETE LINEAR CIRCUIT DESIGN
A ComPREhEnSivE GuidE to RASPBERRY Pi
Practically Speaking – • Understand linear circuit design
The CD-ROM includes
INTRODUCING THE ARDUINO
for the series, so that
• Hardware – learn about components and circuits
• Pi PRojECt – SomEthinG to Build • Design simple, but elegant circuits • Programming – powerful integrated development system

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

designers can get FREE


DVD-R
ALL THE
OM
SOFTWA
RE
FREE M
-RO
n Teach-In 8
started quickly and
N6
TEACH-I
FOR THE RRY Pi CD CIRCUIT
RASPBE ALL THE

nM
 icrochip MPLAB
RE FOR
SERIES SOFTWA 7
CH-IN
THE TEA

easily with the projects


SERIES

IDE XC8 8-bit compiler


and ideas covered. PluS
Pi B+ uPdAtE
intERfACE – a series of
ten Pi related features
PLUS...
AUDIO OUT
An analogue expert’s take
n PICkit 3 User Guide PLUS...
n Lab-Nation
on specialist circuits
REviEwS – optically PIC n’MIX
isolated AdC and i/o PRACTICALLY SPEAKING PICs and the PICkit 3 - A beginners
The techniques of project guide. The why and how to build
interface boards

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

ORDER YOUR BUNDLE TODAY!


JUST CALL 01202 880299 – OR VISIT [Link]
Max’s Cool Beans
By Max the Magnificent

Arduino Bootcamp – Part 18

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.

52 Practical Electronics | June | 2024


Display segments
Connection No connection Ground (0V)
and pin numbers

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

Arduino pin numbers

Fig.4. Upping our game to use four 7-segment displays.

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.

Practical Electronics | June | 2024 53


Listing 4a. Definitions.

Listing 4c. Our new setup() function.

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:

54 Practical Electronics | June | 2024


20ms
Period (P) = 20ms
10 10 Frequency (f) = 50Hz

D0

D1
(a) Two displays

40ms
Period (P) = 40ms
10 30 Frequency (f) = 25Hz
D0

D1

D2

D3

(b) Four displays

Fig.6. The origin of our flicker problem.

Since each display is on for 10ms and off for


10ms, this means each has a repeating cycle time,
or period (P), of 20ms. In turn, this means each
display is turning on and off with a frequency
(f), which is 1/P. Remembering that frequency is
specified in hertz (Hz), which is the number of
cycles per second, then our frequency = 1000/20
= 50Hz (Fig.6a).
The problem is that we are still using the same
ON_OFF_TIME value of 10 in our new program
(Line 18 in Listing 4a). Now that we are using
four displays, this means each display is on for
10ms and off for 30ms. In turn, this means each
display has a period of 40ms and a frequency of
25Hz. Hence the flicker (Fig.6b).
First, I tried changing ON_OFF_TIME to 5, thereby
Listing 4d. Our new loop() function. returning us to having a flicker-free frequency of
50Hz. Eventually, however, I decided to use an
int tmpInt = dispData[iDisp]; ON_OFF_TIME value of 2, resulting in each display having a
byte tmpByte = DigitSegs[tmpInt]); period of 8ms and a frequency of 125Hz.
DisplaySegs(tmpByte); The current situation is very tasty (Fig.7). Of course, since
each display is now on for only 25% of the time, it’s only a
This step-by-step approach is the way we would have done quarter as bright as a full-on display. However, this would
things earlier in this series because it can be easier for really become apparent only if we had a full-on display for
beginners to understand, but (a) we are beginners no more comparison. As we discussed in last month’s column, the
and (b) the approach we are now using is more concise. In human eye has a wide dynamic range coupled with a non-
fact, at some stage you may be surprised to discover yourself linear response to brightness. The result is that our four
living in ‘opposite world’ where you find the step-by-step displays still appear to be reasonably bright. Even better, in
approach to be tedious and annoying, while the concise a future column, we will discuss an alternative approach to
construct turns out to be easier on the eye and faster to boost our brightness.
parse and comprehend.
Online resources
How does it look?
For the purposes of this series, I’m going to assume
I’m glad you asked. It doesn’t look very good. The digits are
that you are already familiar with fundamental con-
flickering horribly. Fortunately, I was expecting this to happen.
cepts like voltage, current and resistance. If not, you
Actually, I was hoping it would, thereby providing a ‘teachable
might want to start by perusing and pondering a short
moment,’ as it were.
series of articles I penned on these very topics – see:
At one stage in our previous column, we started to display
[Link]
the digits 4 and 2 on two displays. We defined ON_OFF_TIME
Similarly, I’ll assume you are no stranger to solder-
as being 1000 (that’s 1000 milliseconds (ms) or 1 second (s)).
less breadboards. Having said this, even if you’ve used
Then we looped around displaying the 4 on the first display
these little scamps before, there are some aspects to
for ON_OFF_TIME followed by the 2 on the second display
them that can trap the unwary, so may I suggest you
for ON_OFF_TIME.
feast your orbs on a column I wrote just for you – see:
Next, we changed the value of ON_OFF_TIME to be 100 (that’s
[Link]
1/10 of a second). This allowed us to see both digits at the
Last, but not least, you will find a treasure trove of
same time but with an annoying flicker. Finally, we changed
resources at the [Link] website, including exam-
ON_OFF_TIME to be 10 (that’s 1/100 of a second), resulting in
ple programs and reference documentation.
both digits being on with no discernable flicker.

Practical Electronics | June | 2024 55


An alternative approach is to replicate
our final design in a more robust and
comelier manner. With respect to the
‘more robust’ part, we could purchase
some solderable breadboards with
the look-and-feel of our solderless
breadboards. There are various vendors
of these boards, each offering their own
interpretation, but the main terminal
holes and power rails are typically to be
found in the expected locations (Fig.8).
Observe the way in which the power
and ground rails are split at the left-
and right-hand sides on the back side
of the board. This allows us to use
multiple power supplies (eg, 5V and
3.3V) and/or multiple grounds (eg,
separate analogue and digital grounds)
if so required. Alternatively, these can
be connected using jumper wires.
One example is the large single
Fig.7. It’s alive! It’s alive! universal solderable breadboard from
Treedix ([Link] But
You are thinking out loud again. I can we may wish to create a more permanent what about something like our clock
almost hear you muttering, ‘What’s that little and robust implementation. One option project, which currently employs two
board in the upper right-hand corner where is to use a free schematic capture and breadboards? Fear not, because the guys
our eight 150Ω current-limiting resistors layout program to design our own and gals at Treedix have us covered with
used to be?’ I have to say I’m impressed custom printed circuit board (PCB) their large dual universal solderable
that you spotted that. All will be revealed and then have it fabricated somewhere. breadboard – see: [Link]
in next month’s column. Meanwhile… There are lots of tools and fabs out there, What about the wiring? Thus far,
but that’s a whole different ballgame. we’ve been using multicore jumper
Just one more thing… (This could be a topic for one or more wires to make our connections.
We still have more to do, but once Cool Beans columns in the future. If you However, as we see in Fig.7, this isn’t
we’ve finally finished evolving and would be interested in something like an approach we would wish to use
experimenting with our prototype clock, this, please email me to let me know.) on something we wanted to display

Components from Part 1


60 55 5 1 1 5 55 60 LEDs (assorted colours) [Link]
E D C B A

A B C D E
E D C B A

A B C D E

Resistors (assorted values) [Link]


Solderless breadboard [Link]
Multicore jumper wires (male-male) [Link]
I H G F

I H G F

F G H

F G H

Components from Part 2


7-segment display(s) [Link]
I

I
J
J

J
J

60 55 5 1 1 5 55 60

Components from Part 5


(a) Front (component and wire) side (b) Back (power and ground) side
Momentary pushbutton switches [Link]
Components from Part 6
Fig.8. Generic example of a solderable breadboard.
Passive piezoelectric buzzer [Link]
Components for Part 9
SW-18010P vibration switch [Link]
Components for Part 10
Breadboard mounting trimpots [Link]
Components for Part 12
Light-Dependent Resistor [Link]
Components for Part 13
BC337 NPN Transistor [Link]
Components for Part 14
HC-SR04 Ultrasonic Sensor [Link]
Components for Part 15
Real-Time Clock (RTC) [Link]
Components for Part 18
Long tailed (0.1-inch pitch) [Link]
header pins
Fig.9. Kit of pre-stripped, pre-formed, solid core jumper wires.

56 Practical Electronics | June | 2024


Fig.10. An example of an old project
using solid core jumper wires.

to family and friends. One approach


is to splash the cash for a kit of pre-
stripped, pre-formed, solid core jumper
wires (Fig.9). You can find these on
Amazon – see: [Link]
A lot of the time you’ll need to cut them
down and bend them around a bit, but
the result can be quite pleasing to the eye.
For example, consider a portion of one of
my old projects from yesteryear (Fig.10).

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

HP33120A Function Generator 100 microHz – 15MHz £350


HP53131A Universal Counter 3GHz Boxed unused £600
HP53131A Universal Counter 225MHz £350
Audio Precision SYS2712 Audio Analyser – in original box POA
Datron 4708 Autocal Multifunction Standard POA
Druck DPI 515 Pressure Calibrator/Controller £400
Datron 1081 Autocal Standards Multimeter POA
ENI 325LA RF Power Amplifier 250kHz – 150MHz 25W 50dB POA
HP/Agilent HP 34401A Digital Keithley 228 Voltage/Current Source POA Marconi 2955B Radio
Multimeter 6½ Digit £325 – £375 Time 9818 DC Current & Voltage Calibrator POA Communications Test Set – £800

Practical Electronics | June | 2024 57


AUDIO AUDIO OUT

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.

58 Practical Electronics | June | 2024


Fig.5. (left)To
Snubber network Channel select
10nF, 250V (Y capacitor)
prevent loud Input switch: changeover
channel 1 or SPDT Output
100Ω, 0.5W cracks when C op amp
turning off mains C Output

S1a power, snubber Input


Fuse Transformer op amp
Live networks can be R

Mains DPST used across the R


switch Input
input
VDR
switch contacts. channel 2
C
0V

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.

Practical Electronics | June | 2024 59


S1a S1b
DPDT Input Processor Output DPDT
Input eg, fuzz Output
In In
Out Out
Bypass line

Dotted line denotes switch


sections mechanically linked

Fig.9. The classic ‘hard-bypass’ circuit for switching in


and out a signal processor or effect.
a combination of switch and moulding that gave a
‘musical feel’ at minimal cost.

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.

60 Practical Electronics | June | 2024


Fig.18. C&K were the original
manufacturers of some of the best
miniature toggle switches. You can
Fig.14. Make before break (MBB) contact. spot them from their distinctive dark
Fig.17. I use these Arrow TS6 toggles red mouldings that don’t melt. This is
in top-quality studio gear. They are now a 7211 PCB-mount right-angle toggle
made by Eaton/Hart. switch, many of which I installed in
RTS intercom belt-packs used in the
Centre-off TV industry. Note the unthreaded bush
You can get toggle switches with three – no nut is needed, just big plated-
positions, the middle one is centre off, through PCB holes.
described as ON-OFF-ON. These are
useful for selecting, say channel one Centre
for up, middle for mute and down for
channel two. NC (linked)

C&K Rear view of


switch tags
C&K are a US company which makes
some of the best toggles switches. They
do a special type of DPDT switch (such NC (linked)

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!)

Practical Electronics | June | 2024 61


AOShop
The home for specialist audio, analogue and historic
components – provided by Jake Rothman, PE’s
Audio Out columnist. The AOShop is your best bet for
classic analogue ‘NOS’ (new old stock) components,
including all parts for Audio Out projects and designs.

Ge semiconductors 5534H metal-cased op amp £3.00 Radiation resistant Special resistors


LM384, TDA2030A, Siemens cellulose acetate MKL
Small-signal PNP transistors TDA2050V £1.50 2.2/25 £0.80 Bourns wire-wound trimmer
NKT214F, OC57, OC59, TAA435 (Mullard power 5kΩ 3059 JM panel-mount £2.00
2N1377, 2N525 £1.00 Electrolytic – Mullard blue 017 series Thermistor RA53, R13 £4.00
amp driver) £1.20
10/25, 22/25, 100/10 £0.50 A13 £2.00
Low-noise PNP transistors 150/40, 470/40, 1000/40 £1.00
GET106 £2.50 Synthesiser ICs Thermistor CZ1, CZ6 £1.50
Tantalum – axial metal cased Holco H2 2.2MΩ 1W, 1% £1.00
Small power PNP transistors That/dbx 2180 VCA/VCF £6.00 Welwyn 1GΩ 2W £1.00
22/50, 47/35, 68/25, 100/20, 120/10,
AC153, AC153K, AC188, AC188K £1.50 CA3080 VCA/VCF (vocoder) £2.80 5k Bourns 3321H cermet trimmer £0.50
150/16, 220/10, 330/6 £2.00
CA3280 VCA/VCF £4.00
Small power NPN transistors 22/35, 33/35, 47/20, 68/15, 100/10,
LM13600/ LM13700 VCA/VCF £2.00 Potentiometers
AC176, AC176K, AC187K, 150/6 £1.25
CA3086 transistor array £1.00
AC141K £2.00 4.7/50, 6.8/35, 10/25, 10/35, 22/15 £1.00 Bourns 81
PT2399 echo/delay £1.50
High-voltage PNP transistors Axial moulded-case tantalum 25kΩ lin cermet £2.00
OC77, CV7001 £1.50 Dual transistors Kemet axial 6.8/10 £0.30 25kΩ lin, 5kΩ lin conductive
Kemet radial 33/10 £0.40 plastic £3.00
TO3 PNP power transistors 2N2639, 2N2223, 2N2910 (NPN) £4.00 STC radial 100/20 £1.50
OC22, CV7054 (OC23), OC25, Bourns 91
E401 (JFET Moog) £4.00 Tantalum bead 10k dual-gang lin or log £10.00
OC35, OC36, AD143, AD149, 2SK2145-Y dual JFET £0.80
AD161, AD162 £2.00 22/50 £1.00 Plessey moulded-track
2N5564 JFET £8.00 470/3 £2.00
AD140 £3.50 HN3C51F, HN3A51F £1.00 5kΩ log with switch £3.00
AD149, AD161/2 matched pair £5.00 680/6.3 £3.00 50kΩ A/log £3.00
DMMT3904/6, HN1A01F,
RF PNP transistors HN1C01F £0.50 Wet tantalum Mil 250kΩ lin dual £5.00
OC41, OC42, 2SA12, 2SA53,AF124, 220/25 axial £3.20 Alpha
AF178, GET872A £1.50 Loudspeakers Castanet button 140/30, 470/3 £3.20 16mm 4.7kΩ A/log £0.80
Hughes 540/10 £3.20 220kΩ A/log £0.80
NPN transistors PE Mini-Monitor
OC139, OC140, ASY73 £2.00 Volt PE165 6.5-inch woofer (each) £85 Bipolar 10kΩ lin centre-detent dual-gang £1.50
Morel MDT29 tweeter (each) £25 Hermetic bipolar tantalum 16/35 £3.20 Allen Bradley J series/Honeywell
Diodes Kit pair of PE165/MDT29 plus Elcap axial 10/50 £0.50
CV7049 (OA10), CG92 (OA91) £0.50 10kΩ lin 1 million cycles £5.00
Volt crossover parts and PCBs £299 Generic radial 100/16, 470/35, Blore Edwards AB 45 dual 5kΩ
Monacor DT-28N tweeter (each) £35 100/ 63, 22/35, 4.7/35, 220/16 £0.50 A/log with switch £3.50
Si semiconductors Vifa 19mm BC20SC15-04 Philips solid-aluminium (axial) 121/123 Alps RK9 dual-gang 5kΩ RD law £4.00
Diodes tweeter (each) £15 47/16 £1.00 Alps 50k log tapped motorised
ZC5800 RF Schottky £0.20 Volt crossover inductors 330/6.3 £2.00 stereo £5.00
Low-noise silicon transistors 1.2mH, 1.5mH, 2mH, 2.7mH, 0.5mH 100/35 £4.00 BI P260 500kΩ log conductive
BFW16A, 2SC3071, 2SC3068, (tapped at 0.3mH) (each) £5.85 plastic 1 million cycles £2.00
Philips Pearl 122 series (radial)
2SA1016K, 2SC2362K, Colvern wire-wound 100kΩ or
Fully assembled and tested high-quality 10/16 £0.30
2SA970BL £1.50 50kΩ dual-gang 3W £5.00
speaker prototypes – ask for details Silvered mica (radial) Mil Spec hermetic 10Ω £8.00
2SC2204, 2SD655, BC550C £0.50 LS3/5As and other similar speaker
ZTX651 £0.30 1nF/500 1% £1.00
systems (pair) £200-£350 Miscellaneous
ZTX751 £0.50 Trimmer capacitors
Fully tested reclaimed speakers Vishay plastic-film 4-40pF £0.80 Theremin Clearance Sale!
RF transistors (suitable for Theremin) Vifa BC14 5-inch woofer (each) £10
BF199 £0.50 Vishay plastic-film 5.5-45pF £1.00 Elysian Theremin MIDI box £300
Vifa TC26 1-inch tweeter (each) £10 Vishay plastic-film 5-80pF £1.20
Audio power MOSFETs PCBs
Low-price speakers Vishay plastic-film 10-250pF £2.00
Exicon 10N20, 10P20 £6.50 Pocket Theremin (EPE, 1996) £2.00
Philips 4-inch 4070 £2.00 Mica 1-12pF, 2-40pF £1.00
Hitachi 2SJ99, 2SK343 £3.50 Elysian Theremin (EPE, 1996) £6
EMI 10x6-inch, 30Ω Alnico £7 Synth VCF, VCO (EPE, 2017) £3.00
Hitachi 2SJ56, 2SK176 £8.50 64mm 64Ω neodymium £1.20 Audio transformers and 48V PSU (EPE, 2019) £3.00
JFETs 5x3-inch elliptical 50Ω or 80Ω inductors SMT dual transistor adapter £0.40
BFW11, BFW10, TIS73L, J177, Alnico £3.50 Eagle transformers
J113, U1994, U1898, 2SJ176, 1.65x2.75-inch 8Ω £1.50 LT44, LT722 driver, LT700, LT723 Contact
J201 £1.00 500Ω output £2.50 Jake Rothman
J175, J176, J112, J111, 2N3820, LT30 500mW output £3.50 The Old Rectory, Arlais Road,
2N5467, BF244, 2N5460, J230 £0.60 Capacitors 5:1 interstage £1.50 Llandrindod Wells, Powys
Note ‘10/63’ denotes ‘10µF 63V’. LD1 5HE (visit by appointment)
Small power output/driver transistors Repanco
2SB649A, D669A, 2SA1208, Polyester T/T3 splitter transformer £4.00 +44 (0)1597 829102
2SC2910, MJE253G, MJE243G, 3.3/100, 4.7/250, 4.7/63 £1.00 CH2 5mH RFC £2.00 jrothman1962@[Link]
2SA1725, 2SC4511 £1.20 5.6/63, 8.2/63, 10/63 £2.00
BD139,BD140, BD135, BD156, BD435, Balanced output transformer Minimum order £5.00 inc post
Mullard ‘Mustard’ C296 0.22/400 £2.00
BD436, MPSA63, BCV46 £0.50 Vigortronix 600Ω VTX-101-007 £10 Quantity discounts negotiable
Polycarbonate Vigortronix 600Ω VTX-101-3001 £10
MOSFETs Axial 2.2/63 1%, 4.7/160, 6.8/63 £1.00 Vigortronix 600Ω VTX-101-3002 £15
ZVP2106A £0.30 Payment
Gardners 150Ω £10 PayPal, cards (via phone), bank
Dual-gate 3SK45, BFS28 £1.50 Radial
Reclaimed BBC LL74/MPC transfer, cheques (payable to ‘J
6.8/160V, 10/63 £2.00
Metal-cased transistors nickel core 600Ω £12 Rothman’, UK pounds only)
Reclaimed 22/63 £2.00
BC143 £0.35 No VAT payable
2N1711 £0.50 Polystyrene Reclaimed mic input transformer £15
£0.30 Philips 1% 4.7nF/160, 6.2nF/500,
BCY71 Inductors Postage
BC109C £0.60 12nF/63, 22nF/63, 110nF/63,
82µH, 4.7mH, 100µH, 270µH, Small Jiffy bag £2.99
24nF, 2nF £1.00
Amplifiers 10µH, 14µH (low Z) £0.50 Small package £4.99
RIFA 1% 100nF/100, Suflex
LM318 high-speed op amp £0.35 7-inch ferrite rod with MW Big boxes and overseas at cost
90.9nF 0.5% £2.00
µA709 metal-cased op amp £2.00 and LW windings £3.00 – ask for a quote
Suflex 2.5% 10nF/63 (rad. or ax.) £0.50

62 Practical Electronics | June | 2024


Circuit Surgery
Regular clinic by Ian Bell

Topics in digital signal processing – ADCs

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

via digital processing to an analogue a digitised signal is determined by the


0V
output. This does not necessarily rep- number of bits (binary digits) in the ADC’s
resent every DSP system (not all have output. Specifically, for an N-bit output Fig.2. Generic schematic symbols for ADCs.
all the parts shown) but it serves as a there are 2N possible values. For example,
reference for the various subsystems for 10-bits there are 210 = 1024 possible is the maximum for a ‘standard’ ADC
we will look at. values. Increasing the number of bits – the 32-bit devices use oversampling –
Last month we looked at sampling. We increases the demands on the analogue they input samples at a much faster rate
have not discussed all the details of input circuitry in the ADC. The more bits the than they output them, which facilitates
filtering and the sampling process yet, but smaller the input differences the ADC reduction of noise and improves effective
at this point it is useful to look further has to discriminate to correctly convert it resolution. Analog Devices’ ADCs have
down the signal path to the analogue- to the digital code. Imperfections, errors speeds ranging from around two samples
to-digital converter (ADC) due to its and noise in the circuitry will reduce the per second to over 10 giga samples per
fundamental role in the digitisation of obtainable precision, so more bits require second (GSPS). The extremes relate to
analogue signals. better design and technology, and also devices aimed at specific purposes –
generally leads to slower sampling rates. high-precision sensing applications at the
Quantisation slow end, and the fastest for advanced RF
In a similar way to the finite time step Choosing ADCs signal processing systems such as satellite
limitation discussed last month, there There are a large number of ADC communications. The latter devices cost
is also a finite limit on the number of integrated circuits on the market, so in the low thousands of pounds, but of
different values a digitised signal can take. there is plenty of choice and variety. To course there are many inexpensive ADCs
This shift from a very large (or effectively find a device to suit your needs, as with for more everyday projects.
infinite) set of possible signal values to other ICs, you can visit the website of IC ADCs are often used with micro-
a smaller one is called ‘quantisation’. It manufacturers (for example, Analogue controllers and are typically connected
is similar to the rounding of values in Devices at [Link] and Texas to the microcontroller via a standard
numerical calculations. Digital hardware Instruments at [Link]) or component serial bus such as SPI or I 2C. A few
(and the software running on it) can distributors (like Farnell and RS) where ADCs with parallel outputs are also
handle numerical calculations which you can find selection tables which you available. As well as separate, standalone
have a very large number of possible can sort according to device parameters ADC ICs there are often ADCs built into
values. The level of numerical detail (such as number of bits and maximum microcontroller devices. These generally
used is referred to as the precision (eg, sampling rate) as well as finding price have moderate capabilities but are suitable
how many decimal digits a number can and availability information. for many projects and help reduce cost,
represent). Increasing precision requires Analog Devices is a leading complexity and component count. If a
more hardware and/or more processing manufacturer of data converters. At the suitable microcontroller and on-chip
time (or more speed to process a given time of writing they provide ADCs ranging combination is not available, then one
amount of data in a given time). from 6 bits up to 32 bits. Generally, 24-bits of the many discrete ADCs mentioned
above can be used.
Analogue Digital Analogue

Antialiasing Sample and Digital Reconstruction


ADC connections and signals
In ADC DAC Out
filter hold processing filter Fig.2 shows generic schematic
symbols for an ADC – not all the
Fig.1. Generic DSP system structure. signals shown may be actual pins

Practical Electronics | June | 2024 63


Code Code
output output

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

0100 Supplies and references


0011 In order to accurately convert a specific absolute voltage to a
0010 specific code the ADC requires an accurate reference voltage.
0001 This may be the supply, but supplies are often subject to
0000 variation and may also be noisy. Therefore, it is common to
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 use voltage reference circuits instead of the supply. These
b) Input: Vin/LSB
output very accurate fixed voltages, which change very little
with temperature and over time. Some ADCs allow a choice
Fig.3. Input-output (transfer) function for ADCs (a) 3-bit ADC (8 of reference source (eg, supply, on-chip reference, or external
output codes), (b) 4-bit ADC (16 output codes), (c) ADC with a reference via device pins). Using the supply as a reference works
(near) infinite number of bits, N – this is the ideal ‘straight-line’ best if the value converted is effectively a ratio of the supply
transfer function. (eg, via a resistive sensor in a potential divider) because supply
shifts have the same relative effect on the ADC and measured
– the functionality can be obtained via commands over a serial value, so the effect of supply shifts cancels out.
bus. ADCs may have one or two inputs for the signal being ADCs may have a simple single supply pin, or there may be
converted. One input is referred to as ‘single ended’ and two multiple supplies. This might include positive and negative
as ‘differential’. For single-ended inputs the value converted supplies for bipolar devices and separate supply pins for the
is the input voltage with respect to ground, and for differential analogue and digital parts of the chip. The latter may be due
it is the voltage difference between the two inputs (Vin+ – Vin–) to different operating voltages, but using separate supplies
which is converted. Single-ended circuits are simpler but also helps prevent noise from digital switching disturbing
differential inputs provide the ability to reject (cancel out) the analogue circuitry.
signals which are common to both inputs (common-mode
rejection). ADC transfer functions and LSB
Some ADCs have differential inputs which have a restricted Fig.3 shows the input-output relationship for three data
range of voltages on one of the inputs, typically tens or hundreds converters. In all cases the input is an analogue voltage, and
of millivolts with respect to ground. These are called pseudo- the output is a digital code. An ADC transfer characteristic
differential inputs. One of the ‘pseudo-differential’ inputs is has a staircase shape. The more bits in the output code the
effectively ground but the differential nature of the inputs still more steps we get in the complete transfer characteristic, as
provides common-mode rejection. Fully differential ADCs can be seen by comparing the 3- and 4-bit characteristics in
allow a wider range of voltages on both inputs. ADC inputs Fig.3a and Fig.3b. If we had a (near) infinite number of bits in
(both single ended and differential) may be either unipolar or the output code the transfer characteristic would be a perfect
bipolar. Unipolar inputs only allow voltages of one polarity straight line as seen in Fig.3c.
(typically positive with respect to ground), whereas bipolar As indicated above, the range of analogue input voltages
inputs can be positive or negative. over which an ADC performs conversion (the full-scale range

64 Practical Electronics | June | 2024


Code Ideal straight line Quantisation error
output transfer function 1.5 LSB
+0.5 LSB
111

Input: Vin/LSB
110

101
–0.5 LSB

0 1 2 3 4 5 6 7
100

Fig.5. Difference between the ideal straight-line transfer function


011
and the actual transfer function of a perfect 3-bit ADC. The
difference is the quantisation error.
010
0.5 LSB
Width of one signal (eg, audio) then the quantisation errors will be different
001 step is 1 LSB
on each conversion and over time they will have the same
statistical properties as random errors. Thus, quantisation
000 adds random noise to a digital representation of a (changing)
0 1 2 3 4 5 6 7 8
VRefL Input: Vin/LSB VRefH signal which was not present in the original analogue input.
For N-bit quantisation the signal-to-noise ratio, (SNR) of the
Full-scale range (FSR)
quantised signal is given by:

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

Quantisation errors Table 1 – properties of ideal ADCs related to numbers of bits


Due to the finite number of codes, the voltage represented by (ppm is parts per million).
the ADC’s code after conversion will not generally be exactly
Number Number of Relative size SNR LSB voltage for
equal to the original input voltage. The difference is known as
of bits Codes of LSB in dB 5V input range
the ‘quantisation error’. This error has a maximum value of ±0.5
LSB with the transfer functions illustrated here. The variation 3 8 13% −20 625mV
of error with input voltage for a 3-bit ADC is shown in Fig.5 4 16 6.3% −26 313mV
(for the transfer function in Fig.4). Quantisation error is not
the result of non-ideal circuit components; it is a fundamental 8 256 0.39% −50 19.5mV
property of the conversion process. Real ADCs will produce 10 1024 980 ppm −62 4.88mV
additional errors: offset error, zero-scale error, full-scale error,
12 4096 240 ppm −74 1.22mV
gain error, differential non-linearity (DNL) and integral non-
linearity (INL). We will discuss these shortly. 16 65536 14 ppm −98 76.3μV
If an ideal ADC is used to measure the same fixed voltage 22 4194304 0.24 ppm −134 1.19μV
in a noise-free circuit the same quantisation error will occur
each time. However, if an ADC is used to sample a continuous 24 16777216 0.060 ppm −146 0.298μV

Practical Electronics | June | 2024 65


Code Code Transfer function Full scale error
Ideal transfer function output
output with gain error

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

66 Practical Electronics | June | 2024


Code Code
output output 1.5 LSB

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

Exploring the Arduino TEACH-IN 8


FROM THE PUBLISHERS OF
FREE
CD-ROM
SOFTWARE

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

grips with the inexpensive, immensely popular Arduino microcontroller,


• Communications – connect to PCs and other Arduinos

as well as coding enthusiasts who want to explore hardware and


interfacing. Teach-In 8 provides a one-stop source of ideas and
practical information.
The Arduino offers a remarkably effective platform for developing a
huge variety of projects; from operating a set of Christmas tree lights
PLUS...
to remotely controlling a robotic vehicle wirelessly or via the Internet. PIC n’MIX

Teach-In 8 is based around a series of practical projects with plenty of


PICs and the PICkit 3 - A beginners
guide. The why and how to build
PIC-based projects

information for customisation. The projects can be combined together


in many different ways in order to build more complex systems that can Teach In 8 [Link] 1 04/04/2017 12:24

be used to solve a wide variety of home automation and environmental


monitoring problems. The series includes topics such as RF technology,
wireless networking and remote web access.
PRICE
£8.99
PLUS: PICs and the PICkit 3 – A beginners guide Includes P&P to UK if
ordered direct from us
The CD-ROM also includes a bonus – an extra 12-part series based around the popular
PIC microcontroller, explaining how to build PIC-based systems.

SOFTWARE
The CD-ROM contains the software for both the Teach-In 8 and PICkit 3 series.

ORDER YOUR COPY TODAY!


JUST CALL 01202 880299 OR VISIT [Link]

Practical Electronics | June | 2024 67


Practical Electronics PCB SERVICE
PROJECT CODE PRICE PROJECT CODE PRICE
JUNE 2024 Precision AM-FM DDS Signal Generator.................................CSE211002 14.95
Loudspeaker Test Jig................................................................04106231 12.95 Improved SMD Test Tweezers programmed PIC....................0410621PIC 12.95
AO 2x-dual-to-quad through-hole (pack of five).......................AO1-MAY23 6.95
MAY 2024 AO 2x-dual-to-quad SMD (pack of five)...................................AO2-MAY23 6.95
AO 2x-single-to-dual through-hole (pack of five)......................AO3-MAY23 6.95
GPS-Disciplined Oscillator........................................................04103231 12.95
AO 2x-single-to-dual SMD (pack of five)..................................AO4-MAY23 6.95
Dual RF Amplifier.......................................................................CSE220602A 5.95
Songbird ....................................................................................08103231 7.95
APRIL 2023
APRIL 2024 500W Amplifier Module.............................................................see p.22, April 2023
Basic RF Signal Generator.......................................................CSE221001 8.99 Clipping Indicator (per channel)................................................01112211 7.95
Basic RF Signal Generator (black front panel).........................CSE220902B 9.99 CD Welder Power Supply (one needed)..................................29103221 9.95
Silicon Chirp Cricket..................................................................08101231 7.99 CD Welder Controller (one needed).........................................29103222 9.95
Test Bench ‘Swiss Army Knife’..................................................04110221 9.99 CD Welder Energy Storage module (several needed)............29103223 7.95
AO Universal Dual Op Amp Board........................................AO1-APR23 9.95
AO Stereo RIAA precision passives kit for dual op amp.......AO2-APR23 8.95
MARCH 2024
Digital Volume Control Potentiometer SMD version................01101231 8.95
Digital Volume Control Potentiometer through-hole version....01101232 9.95 MARCH 2023
Advanced SMD Test Tweezers body........................................04106221 6.95 Pico BackPack...........................................................................07101221 9.95
Advanced SMD Test Tweezers legs (pair)...............................04106212 7.95 Semaphore Signal (controller)..................................................09103221 7.95
Semaphore Signal (blade)........................................................09103222 5.95
FEBRUARY 2024
Active Mains Soft Starter...........................................................10110221 10.95 FEBRUARY 2023
Tesla Coil driver board...............................................................26102221 9.95
JANUARY 2024 Tesla Coil potentiometer board.................................................26102222 5.95
Q Meter ....................................................................................CSE220701 8.95 Cooling Fan Controller & Loudspeaker Protector....................01102221 8.95
Q Meter (black solder mask).....................................................CSE220704 7.95 Remote Gate Controller............................................................11009121 12.95
Raspberry Pi Pico W BackPack................................................07101221 8.95
JANUARY 2023
DECEMBER 2023 Classic LED Metronome – 8-LED.............................................23111211 7.95
Digital Boost Regulator..............................................................24110224 8.95 Classic LED Metronome – 10-LED...........................................23111212 8.95
Dual-Channel Power Supply for Breadboards.........................04112221 11.95 Multi-Channel Speaker Protector – 6 channel.........................01101221 9.95
Display Adaptor for the Breadboard PSU.................................04112222 9.95 Multi-Channel Speaker Protector – 4 channel.........................01101222 7.95
Remote Control Range Extender – IR-to-UHF........................15109212 5.95
Remote Control Range Extender – UHF-to-IR........................15109211 7.95
NOVEMBER 2023
AO Universal Single Op Amp Board......................................AO1-JAN23 7.95
LC Meter Mk3............................................................................CSE220503C 9.95
DC Supply Filter for vehicles.....................................................08108221 8.95
Discrete Audio Op Amp PCB....................................................AO1-JUL23 9.95 DECEMBER 2022
Discrete Audio Op Amp PCB + essential components............AO2-JUL23 17.95 Hummingbird Amplifier..............................................................01111211 9.95
SMD Trainer PCB......................................................................29106211A 8.95
OCTOBER 2023 SMD Trainer PCB + parts.........................................................29106211B 13.95
Buck/Boost Charger Adaptor....................................................14108221 9.95
PIC Breakout Board for SOIC parts..........................................24110225 5.95 NOVEMBER 2022
PIC Breakout Board for DIP parts.............................................24110222 5.95 USB Cable tester – main PCB..................................................04108211 12.95
AVR64DD32 Breakout board....................................................24110223 5.95 USB Cable tester – front panel.................................................04108212 5.95
Automatic Train Controller.........................................................09109221 6.95 USB Cable tester – optional panel............................................SC5970 5.95
Chuff Sound module..................................................................09109222 6.95 Model Railway Carriage Lights – PCB.....................................09109211 6.95
AO transfmr PCB – standard VTX-A range........................ VTX-101-007 6.95
AO transfmr PCB – dual-outline VTX102-3001/101-3002....VTX-Dual 6.95
SEPTEMBER 2023
Mini LED Driver..........................................................................16106221 7.95
New GPS-Synchronised Clock.................................................19109221 9.95 OCTOBER 2022
Wide-Range Ohmmeter............................................................04109221 14.95 SMD Test Tweezers – PCB and pair of tweezer arms.............04106211-2 11.95
SMD Test Tweezers – programmed PIC12F1572-I/SN...........0410621A 7.95
AUGUST 2023 Tele-com............................................................................. 12110211 12.95
110dB RF Attenuator.................................................................CSE211003 9.95
Universal Battery Charge Controller (2023 update).................14107192 9.95 SEPTEMBER 2022
Wide-Range OhmMeter............................................................04109221 12.95 Touchscreen Digital Preamp – main board........................ 01103191 12.95
Touchscreen Digital Preamp – adaptor board pair............. 01103192 5.95
JULY 2023 20A DC Motor Speed Controller......................................... 11006211 9.95
Multimeter Checker/Calibrator..................................................04107221 10.95
MIDI Spectral Sound Synthesiser (full kit – see p.25)..............N/A N/A AUGUST 2022
Multi-purpose Battery Manager – I/O Expander module.... 11104212 5.95
JUNE 2023 Multi-purpose Battery Manager – Switch Module............... 11104211 8.95
Arduino Programmable Load....................................................04105221 8.95 Simple MIDI Music Keyboard (for 8 switches).................... 23101213 6.95
Buck-Boost LED Driver.............................................................16103221 8.95 Nano Pong......................................................................... 08105212 7.95

MAY 2023 JULY 2022

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.

68 Practical Electronics | June | 2024


Double-sided | plated-through holes | solder mask

PROJECT CODE PRICE PROJECT CODE PRICE


Silicon Labs AM/FM/SW Radio.......................................... CSE210301C 10.95 ATtiny816 Breakout / Dev Board with Capacitive Touch.... 24110181 £9.75
Level Crossing Controller................................................... 09108211 6.95 IR Remote Control Assistant (Jaycar version).................... 15005201 £8.95
IR Remote Control Assistant (Altronics version)................ 15005202 £8.95
JUNE 2022 PIC18F Development Board.............................................. PNM-JUL21 £12.95
Full-wave Motor Speed Controller...................................... 1010221 8.95 Microphone Preamplifier........................................................AO-JUL21 £11.95
PIC Programming Helper for 8-pin PICs only..................... 24106211 7.95
PIC Programming Helper for 8, 14 or 20-pin PICs ............ 24106212 10.95 JUNE 2021
Advanced GPS Computer.................................................. 05102211 9.95 Roadies’ Test Signal Generator (surface-mount version)... 01005201 £8.95
Roadies’ Test Signal Generator (through-hole version)...... 01005202 £9.95
MAY 2022 Touchscreen Wide-range RCL Box (Resistor module)....... 04104201
£18.95
Bus board PCB for Analogue Vocoder............................... AO1-MAY22 10.95 Touchscreen Wide-range RCL Box (Ind/Cap module)....... 04104202
Complete set of 14 PCBs for Analogue Vocoder................ AO2-MAY22 97.95 KickStart Part 3 – Gyrator-based Audio Filter.................... KS3-2021 £7.95
Programmed EEPROM for Digital FX Unit......................... FX1-MAY22 10.95
Programmed PIC for Digital FX Unit using potentiometer.....FX2-MAY22 8.95 MAY 2021
7-Band Equaliser (Mono)................................................... 01104201 £8.95
APRIL 2022 7-Band Equaliser (Stereo).................................................. 01104202 £10.95
64-key MIDI Matrix shield................................................... 23101211 8.95 Car Altimeter....................................................................... 05105201 £7.95
64-key MIDI Matrix switch board........................................ 23101212 11.95
High-current Battery Balancer ........................................... 14102211 10.95 APRIL 2021
Digital FX Unit – using potentiometer................................. 01102211 9.95 Reflow Oven – DSP Active Crossover (CPU)..................... 01106193
Digital FX Unit – using BCD switch.................................... 01102212 9.95 Reflow Oven – DSP Active Crossover (Front panel).......... 01106195 £19.95
Universal Audio PSU.......................................................... AO1-APR22 11.95 Reflow Oven – DSP Active Crossover (LCD)..................... 01106196
Frequency Reference Signal Distributor.................................... CSE200103 £8.95
MARCH 2022
Mini Isolated Serial Link..................................................... 24102211 £5.95 MARCH 2021
Busy Loo Indicator.............................................................. 16112201 £5.95
Analogue Vocoder – Band-pass filter board....................... AO1-MAR22 9.95 For the many pre-2016 PCBs that we stock please see the
Analogue Vocoder – HP/LP filter board.............................. AO2-MAR22 9.95 PE website: [Link]
FEBRUARY 2022
Arduino-based Power Supply............................................. 18106201 9.95 PE/EPE PCB SERVICE
Battery Monitor Logger....................................................... 11106201 10.95
Electronic Wind Chimes..................................................... 23011201 10.95
Order Code Project Quantity Price
Analogue Vocoder – Driver Amplifier.................................. AO-FEB22 8.95 .........................................................
JANUARY 2022 .........................................................
Vintage battery Radio Li-ion Power Supply........................ 11111201 9.95
MiniHeart: A Miniature Heartbeat Simulator....................... 01109201 8.95 .........................................................
DECEMBER 2021 .........................................................
AM/FM/SW Digital Receiver............................................... CSE200902A 13.95
Balanced Input and Attenuator for USB CODEC............... 01106202 11.95 .........................................................
NOVEMBER 2021
Dual Battery Lifesaver........................................................ 11111202 £6.95 Name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OCTOBER 2021 Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Mini Wi-Fi LCD BackPack.................................................. 24106201 £8.95 .........................................................
SEPTEMBER 2021 Tel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
USB SuperCodec PCB....................................................... 01106201 £14.95
Audio DDS Oscillator PCB................................................. 01110201 £5.95 Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Audio DDS Oscillator rotary encoder................................. 01110201-ENC 6.95
I enclose payment of £ . . . . . . . . . . . . . . (cheque/PO in £ sterling only)
Programming Adaptor Board for Audio DDS Oscillator...... 01110202 £5.95
High-power Ultrasonic Cleaner main PCB......................... 04105201 payable to: Practical Electronics
£14.95
High-power Ultrasonic Cleaner front-panel PCB................ 04105202
Night Keeper Lighthouse PCB........................................... 08110201 £5.95
Card No . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
AUGUST 2021 Valid From . . . . . . . . . . . . . . . . . Expiry Date . . . . . . . . . . . . . . .
Ol’ Timer PCB..................................................................... 19104201 £11.95
Ol’ Timer 8x8 RGB LED module using WS2812B.............. 19104201-88 £8.95 Card Security No . . . . . . . . . .
Ol’ Timer set of acrylic case pieces and spacer................. 19104201-ACR £8.75
Ol’ Timer DS3231 RTC IC wide SOIC-16.................................19104201-RTC £5.95 You can also order PCBs by phone, email or via the shop
Wideband Digital RF Power Meter..................................... 04106201 £9.75
on our website: [Link]
Switchmode 78xx regulators (PACK of 5!)........................ 18105201 £7.95
Cool Beans SMAD display................................................. CB-AUG21 £11.95
JULY 2021 No need to cut your issue – a copy of this form is just as good!

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 | June | 2024 69


Practical Electronics PCB SERVICE
PROJECT CODE PRICE PROJECT CODE PRICE
Nutube Guitar Effects Pedal............................................... 01102201 £12.95 Flip-dot Display black coil board.................................................. 19111181
Programmable Thermal Regulator (Peltier Interface)......... 21109181 Flip-dot Display black pixels........................................................ 19111182
£18.95 £14.95
Programmable Thermal Regulator (Peltier Driver)............. 21109182 Flip-dot Display black frame........................................................ 19111183
Tunable HF Preamp........................................................... CSE190502 £8.95 Flip-dot Display green driver board............................................. 19111184

FEBRUARY 2021 MARCH 2020


4G Remote Monitoring....................................................... 27111191 £9.95 Diode Curve Plotter............................................................ 04112181 £10.95
Steam Train Whistle / Diesel Horn Sound Generator................ 09106181 £8.50
JANUARY 2021 Universal Passive Crossover (one off)....................................... UPC0320 £12.50
Nutube Valve Preamplifier.................................................. 01112191 £12.95
Arduino DCC Controller...................................................... 09207181 £10.95 FEBRUARY 2020
Motion-Sensing 12V Power Switch.................................... 05102191 £5.95
DECEMBER 2020 USB Keyboard / Mouse Adaptor........................................ 24311181 £8.50
Pseudo-Random Sequence Generator.............................. 16106191 £7.95 DSP Active Crossover (ADC)............................................. 01106191
Clever Charger................................................................... 14107191 £11.95 DSP Active Crossover (DAC) ×2 ....................................... 01106192
PE Theremin Amplifier........................................................ AO-1220-01 £8.95 DSP Active Crossover (CPU)............................................. 01106193 £29.95
DSP Active Crossover (Power/routing)............................... 01106194
NOVEMBER 2020 DSP Active Crossover (Front panel)................................... 01106195
LED Christmas Tree (1 off)................................................. 16107181-1 £6.95 DSP Active Crossover (LCD).............................................. 01106196
LED Christmas Tree (4 off)................................................. 16107181-2 £14.95
LED Christmas Tree (12 off)............................................... 16107181-3 £24.95 JANUARY 2020
LED Christmas Tree (20 off)............................................... 16107181-4 £34.95 Isolated Serial Link............................................................. 24107181 £8.50
USB/SPI Interface Board.................................................... 16107182 £5.95
45V/8A Power Supply PCB plus acrylic spacer.................. 18111181 £14.95 DECEMBER 2019
45V/8A Power Supply front panel five-way display bezel... 18111181-BZ £3.95 Extremely Sensitive Magnetometer.................................... 04101011 £16.75
Five-way LCD Panel Meter/Display.................................... 18111182 £7.95 Four-channel High-current DC Fan and Pump Controller.... 05108181 £8.75
Useless Box........................................................................ 08111181 £11.50
OCTOBER 2020
Digital Audio Millivoltmeter................................................. 04108191 £9.95 NOVEMBER 2019
Precision Signal Amplifier................................................... 04107191 £7.95 Tinnitus & Insomnia Killer (Jaycar case – see text)............ 01110181 £9.95
Tinnitus & Insomnia Killer (Altronics case – see text)......... 01110182 £9.95
SEPTEMBER 2020
PE Theremin PSU.............................................................. AO-0920-01 £5.95 OCTOBER 2019
PE Theremin PSU transformer........................................... AO-0920-02 £7.95 Programmable GPS-synced Frequency Reference........... 04107181 £11.50
Micromite Explore-28......................................................... 07108191 £6.95 Digital Command Control Programmer for Decoders......... 09107181 £9.95
Ultrabrite LED Driver.......................................................... 16109191 £6.95 Opto-isolated Mains Relay (main board)............................ 10107181 £11.50
Opto-isolated Mains Relay (2 × terminal extension board)....10107182
AUGUST 2020
Micromite LCD BackPack V3............................................. 07106191 £9.95 AUGUST 2019
Steering Wheel Audio Button to Infrared Adaptor............... 05105191 £7.95 Brainwave Monitor.............................................................. 25108181 £12.90
Super Digital Sound Effects Module................................... 01107181 £6.95
JULY 2020 Watchdog Alarm................................................................. 03107181 £8.00
AM/FM/CW Scanning HF/VHF RF Signal Generator......... 04106191 £13.95 PE Theremin (three boards: pitch, volume, VCA).............. PETX0819 £19.50
Speech Synthesiser with the Raspberry Pi Zero................ 01106191 £5.95 PE Theremin component pack (see p.56, August 2019).... PETY0819 £15.00
PE Mini-organ PCB............................................................ AO-0720-01 £14.95
PE Mini-organ selected parts............................................. AO-0720-02 £8.95 JULY 2019
High-current Solid-state 12V Battery Isolator – control...... 05106191 £6.95 Full-wave 10A Universal Motor Speed Controller............... 10102181 £12.90
High-current Solid-state 12V Battery Isolator FET (2oz).... 05106192 £9.95 Recurring Event Reminder................................................. 19107181 £8.00
Temperature Switch Mk2.................................................... 05105181 £10.45
JUNE 2020
Arduino breakout board – 3.5-inch LCD Display................ 24111181 £6.95 JUNE 2019
Six-input Audio Selector main board.................................. 01110191 Arduino-based LC Meter.................................................... 04106181 £8.00
£10.95
Six-input Audio Selector switch panel board...................... 01110192 USB Flexitimer.................................................................... 19106181 £10.45

MAY 2020 MAY 2019


Ultra-low-distortion Preamplifier Input Selector.......................... 01111112 2× 12V Battery Balancer.................................................... 14106181 £5.95
£11.25
Ultra-low-distortion Preamplifier pushbutton Input Selector...... 01111113 Deluxe Frequency Switch................................................... 05104181 £10.45
Universal Regulator..................................................................... 18103111 £7.95 USB Port Protector............................................................. 07105181 £5.95
433MHz Wireless Data Repeater............................................... 15004191 £8.50
Bridge-mode Adaptor for Amplifier.............................................. 01105191 £7.95 APRIL 2019
iCEstick VGA Terminal................................................................. 02103191 £5.95 Heater Controller................................................................ 10104181 £14.00
Analogue noise with tilt control.................................................... AO-0520-01 £7.95
Audio Spectrum Analyser............................................................ PM-0520-01 £8.95 MARCH 2019
10-LED Bargraph Main Board............................................ 04101181 £11.25
+Processing Board.............................................. 04101182 £8.60

APRIL 2020 FEBRUARY 2019

70 Practical Electronics | June | 2024


CLASSIFIED ADVERTISING

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

BOWOOD ELECTRONICS LTD Electrical Industries Charity (EIC)


Suppliers of Electronic Components We help people working in the
electrical, electronics and energy COAST ELECTRONICS
[Link] community as well as their family BREAKOUTS-COMPONENTS-
Unit 10, Boythorpe Business Park, Dock Walk, Chesterfield, members and retirees. CONTRACT DESIGN-3D PRINTER PARTS-
Derbyshire S40 2QR. Sales: 01246 200 222 We use workplace programmes that MUSICAL-MICROCONTROLLERS
Send large letter stamp for Catalogue [Link]
give the industry access to financial
grants and a comprehensive
range of free and
MISCELLANEOUS confidential services. Andrew Kenny – Qualified Patent Agent
EPO UKIPO USPTO
VALVES AND ALLIED COMPONENTS? [Link]
Circuits Electric Machinery Mechatronics
For free stock list and/or advice, please Web: [Link]
contact me: geoffdavies337@[Link] COMPONENTS AS JOB LOT
Email: Enquiries@[Link]
Telephone: 01788 574774 Large stock. Transistors, Diodes,
Tel: 0789 606 9725
Logic, Memory and Analogue parts.
PIC DEVELOPMENT KITS, DTMF kits 1000s of passive items. Catalogued
and modules, CTCSS Encoder and and sorted. ‘New Old Stock’ in racks.
Decoder/Display kits. Email: rojobarn@[Link]
Visit [Link]

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.

Practical Electronics | June | 2024 71


Next Month – in the July issue
Dynamic NFC Tag
Near-field communication (NFC) devices have become widespread,
especially for ‘contactless’ payments. The availability of dynamic NFC tags
means you can now easily create your own custom NFC/RFID Tags. This
project explains how to program NFC chips.
Reciprocal Frequency Counter
This design measures low-frequency signals accurately and quickly.
A traditional frequency counter samples over a long period, but this one
measures the average period and calculates the inverse, so it only needs to
monitor a few pulses to get a precise reading. It’s useful up to about 10MHz.
Carriage Uncoupler for Model Railways
This mechanism automatically uncouples carriages from a
locomotive or other carriages, adding realism to a model
railway layout. It’s actuated by a servo motor with simple
control electronics.
Pi Pico-based Thermal Camera
A thermal infrared camera measures hot or cold spots
compared to the surrounding area, which is useful in
diagnosing hot spots in electronic circuits. They can be
pricey, but not this one, a DIY version that’s easy to build.
PLUS!
All your favourite regular columns from Cool Beans
and Circuit Surgery, to Audio Out, Teach-In, Techno
Talk and Net Work. On sale 6 June 2024
Content may be subject to change

Welcome to JPG Electronics NEW subscriptions hotline!


Selling Electronics in Chesterfield for 29 Years
Open Monday to Friday 9am to 5:30pm
And Saturday 9:30am to 5pm Practical
• Aerials, Satellite Dishes & LCD Brackets
• Audio Adaptors, Connectors & Leads
• BT, Broadband, Network & USB Leads
Electronics
• Computer Memory, Hard Drives & Parts We have changed the way we sell and renew
• DJ Equipment, Lighting & Supplies subscriptions. We now use ‘Select Publisher
• Extensive Electronic Components
Services’ for all print subscriptions – to start a
- ICs, Project Boxes, Relays & Resistors
• Raspberry Pi & Arduino Products new subscription or renew an existing one you
• Replacement Laptop Power Supplies have three choices:
• Batteries, Fuses, Glue, Tools & Lots more...
1. Call our NEW print subscription hotline:
01202 087631, or email: pesubs@[Link]
T: 01246 211 202
E: sales@[Link] 2. Visit our shop at: [Link]
JPG Electronics, Shaw’s Row,
Old Road, Chesterfield, S40 2RB
3. Send a cheque (payable to: ‘Practical
W: [Link] Electronics’) with your details to:
Practical Electronics Subscriptions, PO Box 6337,
Shaw’s Row

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

Rose & Crown


Johnsons
all Ro

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.

72 Practical Electronics | June | 2024


Did you know our online shop
now sells the current issue of
PE for £5.99 inc. p&p?
Practical
Electronics Prac
Electro tical
The UK’s premier electronics and computing maker magazine

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

Heart Rate GPS-D


Sensor Module Oscilla isciplined
tor Dual R
Wi-Fi Time SourceMas F Amp
lifier
for GPS Clocks the tering
UV
UV Se M-30A
nsor
Teach-In 2024
Learn to use Teach
-
the ESP32 Learn t In 2024
the ES o use
P32
PLUS!
P
LUS! Jun 2024 £5.99 Songb
Techno Talk – Program that!
ir
eginned: an ideal
Techn 06

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]

You might also like