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

Apr24 Int Opt

The April 2024 issue of Practical Electronics features various projects and articles, including updates on LTspice, digital input/output with the ESP32 microcontroller, and a basic RF signal generator. It also introduces a new series called Teach-In 2024 aimed at teaching electronics using the ESP32. Additionally, the magazine covers topics like automated test benches, audio design, and offers insights into new electronic kits and components.

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)
155 views76 pages

Apr24 Int Opt

The April 2024 issue of Practical Electronics features various projects and articles, including updates on LTspice, digital input/output with the ESP32 microcontroller, and a basic RF signal generator. It also introduces a new series called Teach-In 2024 aimed at teaching electronics using the ESP32. Additionally, the magazine covers topics like automated test benches, audio design, and offers insights into new electronic kits and components.

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
LTspice 24 update and Digital input and output with Designing
Frequency Response Analysis the ESP32 SoC microcontroller discrete buffers

‘Swiss Army Knife’


Basic RF Automated Test Bench
Signal
Generator WIN!
Microchip
Explorer 8
Development
Kit
WIN!

Teach-In 2024
Learn to use Silicon Chirp
the ESP32 Build your own
pet cricket
PLUS!
Techno Talk – Wait! What? Really? Apr 2024 £5.99
04
Cool Beans – Arduino: expanding the 7-segment display
Net Work – Label printers, smart home devices and SMRs 9 772632 573030

www.electronpublishing.com @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.
microchip.com/q20 MEC2550A-UK-01-24
Practical
Volume 53. No. 4
April 2024
ISSN 2632 573X

Electronics Contents
Projects and Circuits
Basic RF Signal Generator by Charles Kosina 16
Our AM/FM/DDS Signal Generator design from May 2023 is a great piece of test
equipment, but overkill for many tasks. If you only need a basic test signal from 10Hz
to 25MHz, then this Generator is just right – compact and cheap to build.
Automated Test Bench by Richard Palmer 24
his ‘Swiss r y ni e’ rovides test voltages signals varies a resistance switches
a component in/out of circuit and even measures some voltages. It uses automation
so tware testing auto atically and records in ut and out ut values or analysis.
Silicon Chirp by John Clarke 34
his et cricket will kee you co any it only needs to e ed occasionally and won’t
run away. ee it or yoursel or lay a rank on a a ily e er or riend y hiding it
in their roo . hen they switch the lights o they will get a it o a sur rise

Series, Features and Columns


Techno Talk y ax The agnificent 8
ait hat eally
Net Work y Alan instanley 10
e orts on a argain la el rinter ro hina lus s art ho e roducts y
ink’s a o are e a ined. here’s also news on S ower generation.
NEW SERIES!
Teach-In 2024 – Learn electronics with the ESP32 by Mike Tooley 40
Part 2 – Digital input and output
Circuit Surgery by Ian Bell 50
s ice and re uency es onse nalysis art
a s Cool eans y ax The agnificent 56
Arduino Bootcamp – Part 16
Audio Out y a e othman 62
Back to the buffers – Part 3

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
Welcome to the future
Exclusive Microchip reader offer 9
in a icrochi lorer evelo ent it
Teach-In bundle – what a bargain! 23
PE Teach-In 9 39
PE Teach-In 8 61
s or ractical lectronics ro ects
Practical Electronics PCB Service 68
Classified ads and Advertiser inde
Next month! – highlights of our next issue of Practical Electronics 72
Made in the UK.
Written in Britain, Australia,
the US and Ireland.
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 May 2024 issue of Practical Electronics will be
published on Thursday, 4 April 2024 – see page 72.

Practical Electronics | April | 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 www.electronpublishing.com
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: [email protected] Please visit our online shop now for full details of over 1000 electronic kits,
Web: quasarelectronics.co.uk 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 KickStart Circuit Surgery MitchElectronics Audio Out Circuit Surgery MitchElectronics Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out
Frequency shifting and A brand new series on electronics Legacy logic Mixing and tuning in the Our new series on electronics Discrete op amp 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
superheterodyne receivers basics for beginners revisited superheterodyne receiver basics for beginners: using the 555 update 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

Dual-Channel PSU Raspberry Pi Pico Digital


for Breadboards W BackPack WIN! Tame the Volume Control
Digital Boost
Microchip
PIC-IoT WG current surge! Potentiometer
Development
Regulator Board Active Mains
WIN!
Soft Starter WIN!
Microchip
PIC32MK MCJ
Curiosity Pro

Advanc
Development
Board ‘Swiss Army Knife’
WIN! ed SM Building the Active
WIN!
D Test Basic RF Automated Test Bench
Microchip Microchip
Tweeze Mains Soft Starter
PIC24F LCD and
Check quality factor PIC-IoT WA
Superb Active Signal
USB Curiosity Development rs
Development
with our Q Meter
Board
Subwoofer Generator WIN!
W
MitchElectronics Board
WIN!
Teach-In 2024 Microchip
Explorer 8
New learning series! MitchElectronics Superb Active Learn to use the ESP32
Development
Kit
WIN!
Discover Astable and New learning series! Subwoofer
Monostable circuits MitchElectronics
555/4017 circuits New learning series! Teach-In 2024
Op amps Advanced SMD Learn to use Silicon Chirp
and sensors Test Tweeze the ESP32 Build your own
rs
Display Adaptor pet cricket
for Breadboards PLUS!
PLUS! PLUS! PLUS! PLUS!
Dec 2023 £5.99 Jan 2024 £5.99 Feb 2024 £5.99 Mar 2024 £5.99 Techno Talk – Wait! What? Really? Apr 2024 £5.99
Techno Talk – Good grief! Is that the time? 12
Techno Talk – Oscillating onions, Batman!? 01
Techno Talk – Cheeky chiplets 02
Techno Talk – The Wibbly-Wobbly World of Quantum 03 04
Cool Beans – Arduino buzzers, ‘musical’ notes and LDRs Cool Beans – Arduino: switching with transistors Cool Beans – Arduino: ultrasound adventures Cool Beans – Arduino: expanding breadboard designs Cool Beans – Arduino: expanding the 7-segment display
Net Work – Low-power UPS systems for electronics 9 772632 573030
Net Work – Celebrating the magnificent UK mains plug! 9 772632 573030
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

www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @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: www.electronpublishing.com

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: [email protected]
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: [email protected]
Card Security Code .................. Valid From Date........................
Also via our online shop at: www.electronpublishing.com (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: www.electronpublishing.com Subscriptions start with the next available issue.

4 Practical Electronics | April | 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


is one of the best DIY electronics magazines in the Published in
n p n Silicon Chip
n n n p n p
electronics articles to general tech overviews.

Print Combined Online


$100 $110 0
The History of Computer
6 months 27 Memory; Jan-Feb 2023
2 8 1
1 21
1 year 10 11 1
120 1 2 8
Raspberry Pi Pico W
80 41 18 BackPack; January 2023
2 years 20 22 100
2 4 2 114

• Combined subscriptions include both the printed magazine and online access.
Wideband
• i es a e i st alia lla s ( D) less t e ise s e ifie Fuel Mixture Display;
• Prices listed are for everywhere in the world except Australia and New Zealand. April to June 2023
View siliconchip.com.au/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


siliconchip.com.au/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: www.electronpublishing.com


Practical
Volume 53. No. 4
April 2024
ISSN 2632 573X

Electronics Editorial
Editorial offices
Practical Electronics Tel 01273 777619 Welcome to the future
Electron Publishing Limited Mob 07973 518682
1 Buckingham Road Fax 01202 843233
Brighton Email [email protected] As every electronics hobbyist will undoubtedly agree, nothing
East Sussex BN1 3RA Web www.electronpublishing.com quite beats the thrill and satisfaction of powering up a newly-
Advertisement offices
built project, and – fingers crossed – witnessing our latest
Practical Electronics Adverts Tel 01273 777619 endeavours bursting into operation for the very first time. In years
1 Buckingham Road Mob 07973 518682 gone by, this initial ‘power-up’ might have taken the form of a
Brighton Email [email protected]
East Sussex BN1 3RA crackle or thump on a loudspeaker, the glow of vacuum tubes,
a switch-on ‘kick’ on a moving-coil meter needle or the blink of
Editor Matt Pulzer
General Manager Louisa Pulzer
a red LED showing a promising sign of life. Sometimes though,
Digital subscriptions Stewart Kearn Tel 01202 880299 despite all the efforts we diligently invest in assembling our latest
Online Editor Alan Winstanley
Web Systems Kris Thain
project, our toils might not go entirely to plan; instead of enjoying
Publisher Matt Pulzer a triumphant power-up, we might instead see some ‘magic smoke’
escaping from an errant component or two, or, disappointingly,
Print subscriptions
Practical Electronics Subscriptions
nothing at all happening. The principles of fault-finding and
PO Box 6337 debugging will challenge our detective skills and are an integral
Bournemouth BH1 9EH Tel 01202 087631 part of our wonderful hobby, and it’s immensely satisfying
United Kingdom Email [email protected]
to overcome any teething problems and finally see our work
Technical enquiries springing into life as we’d initially anticipated.
We regret technical enquiries cannot be answered over the
telephone. We are unable to offer any advice on the use, purchase,
re air or odification o co ercial e ui ent or the incor oration I sometimes wonder what our predecessors would make of
or odification o designs u lished in the aga ine. e cannot today’s state of the art. Powering up our latest projects might
provide data or answer queries on articles or projects that are
ore than five years old. see us greeted with a ‘Hello world’ exclamation on a liquid
crystal display, or the boot-up menu of a crisp and clear OLED
Questions about articles or projects should be sent to the editor
by email: [email protected]
alphanumeric read-out, just before it proceeds to connect to the
Internet. That’s the marvellous thing about our hobby: there’s
Projects and circuits always something new and exciting coming along to pique our
All reasonable precautions are taken to ensure that the advice and
data given to readers is reliable. We cannot, however, guarantee interest and challenge our constructional skills. Our workbench
it and we cannot accept legal responsibility for it. is a place where we can escape to and keep our brain busy for a
A number of projects and circuits published in Practical Electronics
time, while an increasingly noisy and uncertain world runs its
employ voltages that can be lethal. You should not build, test, course outside.
modify or renovate any item of mains-powered equipment unless
you fully understand the safety aspects involved and you use an
RCD (GFCI) adaptor. Here at Practical Electronics we do try to move with the times by
bringing you modern projects that will supply the enjoyment and
Component supplies satisfaction that we know our readers have a thirst for. We try to
We do not supply electronic components or kits for building the
projects featured, these can be supplied by advertisers. We cater for all levels, though, including our excellent educational
advise readers to check that all parts are still available before features such as Circuit Surgery and Teach-In, instructional
commencing any project in a back-dated issue.
material of the highest quality that you won’t find anywhere else.
Advertisements One thing’s for sure, our forebears would blink in total disbelief at
Although the proprietors and staff of Practical Electronics take what we can now achieve using just a handful of miniscule parts
reasonable precautions to protect the interests of readers by
ensuring as ar as ractica le that advertise ents are ona fide and some very clever coding. Over to you, readers – welcome to
the magazine and its publishers cannot give any undertakings this month’s Practical Electronics.
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
the magazine accept liability for non-receipt of goods ordered, or
for late delivery, or for faults in manufacture.
Matt Pulzer
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
e ore uying any trans itting or tele hone e ui ent as a fine
confiscation o e ui ent and or i rison ent can result ro
illegal use or ownership. The laws vary from country to country;
readers should check local laws.

Practical Electronics | April | 2024 7


Wait! What? Really? Techno Talk
Max the Magnificent

I first read Ready Player One deep in the mists of time we used to call 2011 (which is now 13
years ago – give me strength!). At that time, the technology depicted in this tale was the stuff of
science fiction, but we are getting closer day-by-day.

W
hen the combination of And then there’s augmented virtu- Apple Vision Pro. (It’s tempting to
artificial intelligence (AI) and ality (AV) in which a predominantly speculate that Henry David Thoreau
mixed reality (MR) comes to virtual environment is augmented with was channeling the future when he
fruition, it will change the way we in- real-world objects or people. Because proclaimed, ‘Surely the apple is the
terface with our systems, the world, all this is a bit of a mouthful, we use noblest of fruits.’)
and each other. the term mixed reality (MR) to embrace When people are first exposed to
AR, DR, VR and AV. Don’t get me started Vision Pro publicity shots, they of-
Keep it real! on hyper reality (HR), but feel free to ten assume that this device features
As John Lennon famously noted, search for ‘Hyper Reality’ on YouTube. a transparent visor because it looks
‘Reality leaves a lot to the imagina- like you can see the wearer’s eyes.
tion.’ In fact, there are multiple flavors More cheese, Gromit? In reality (no pun intended), the vi-
of reality. At one end of the reality spec- I was first exposed to VR in the form of sor is opaque. This feature – which
trum we have the real world, which military systems 20+ years ago. At that is called EyeSight – starts with a 3D
we might call ‘physical reality’ (PR). time, I thought a consumer-level ex- facial scan of the person wearing the
At the other end we have virtual real- perience of any significance was years headset. In addition to other tasks,
ity (VR) in which everything we see is away in my future. So, you can only four eye-tracking cameras inside the
computer generated. imagine my surprise and delight when headset are used to control where the
Most people these days are familiar the Oculus Rift VR headset launched virtual eyes are looking on the out-
with the term augmented reality (AR). in 2016. Suffice it to say I was at the ward-facing display.
Many believe this to involve only a front of the queue for one of those bo- I would love to own a Vision Pro,
visual view of the real world super- dacious beauties. but it’s way outside my price range.
imposed with text or graphics. More Of course, being tethered to a large A Quest 3 headset costs around £400
generally, and quoting myself, we computer and having to use external in the UK. By comparison, a Vision
might say that AR refers to ‘an interac- sensors was a bit of a downer, which Pro will lighten your wallet by a hefty
tive experience in which objects that is why I traded my Oculus Rift for an £3,500 give-or-take (Eeek!).
reside in the real world are enhanced Oculus Quest (now Meta Quest) VR
by computer-generated perceptual in- headset as soon as it came out in 2019. Wait! What? Really?
formation, sometimes across multiple More recently, I splashed the cash for a It’s probably fair to say that most people
sensory modalities, including visual, Meta Quest 3 MR headset, which was might be a tad embarrassed to be out and
auditory, haptic, somatosensory [relat- released in October 2023. This little about – perambulating through town or
ing to a sensation such as pressure or scamp is sitting on my desk singing its strolling round a supermarket, for ex-
warmth], and olfactory.’ siren song as I pen these words. ample – sporting a Quest 3 or Vision Pro
The conceptual opposite to AR is di- There are myriad mixed reality ap- style headset. Having said this, no one
minished reality (DR), which involves plications available for the Quest 3. would care if everyone else was doing
diminishing or removing information One of my favorites involves Wallace the same thing. Hopefully, it won’t be
or stimuli from the real world. One and Gromit. Assume you are standing long before we have display technolo-
example would be if you were at a in the middle of your family room. The gies like those being developed by Kura
cocktail party and your DR-enabled headset has forward-looking colour cam- (www.kura.tech), which look like reg-
system faded down all the voices ex- eras whose video streams are presented ular glasses but sport 50,000,000 MR
cept that of the person with whom on the displays that reside in front of pixels per eye.
you are conversing. Another would your eyes. As a result, you see the same I have just seen something else
be to change most of your view of the thing you would if you took the head- that has me quivering in excitement.
world into grayscale, leaving only the set off… apart from the virtual electric This comes to us from Zinn Labs
portion of interest in colour. Think toaster in front of you and the virtual (www.zinnlabs.com). It’s a set of glass-
of a Where’s Waldo image. It would jam-dispensing, steampunk-looking gun es frames (no lenses) equipped with a
be a lot easier to spot the little rascal in your hand. When a slice of toast is forward-looking camera that sees what
if he was the only portion of the pic- ejected from your toaster, you attempt you see and eye trackers that can de-
ture in colour. Similarly, if you were to hit it with a blob of jam fired from termine what you are looking at. If you
looking for your friends in an environ- your gun. If you miss, the jam carries visit Zinn’s website, you can see these
ment containing thousands of other on its trajectory until it hits (and sticks glasses connected wirelessly to ChatGPT.
people – like an open-air concert, for to) the ceiling or wall. Brilliant! All you do is look at something, ask a
example – it would be advantageous question about it, and let the ChatGPT-
if your AI+AR+DR headset present- The noblest of fruits generated answer tickle your lugholes.
ed everything but your friends in The current state-of-the-art in con- I’ve said it before, and I’ll say it again
black-and-white. sumer MR is the recently introduced – the future is closer than we think!

8 Practical Electronics | April | 2024


Exclusive offer

Win a Microchip Explorer 8


Development Kit
Practical Electronics is offering its readers the chance to win a With the Explorer 8 Development Kit, you can have a single
Microchip Explorer 8 Development Kit (DM160228) – and even development platform that allows you to update a legacy design
if you don’t win, receive a 15%-off voucher, plus free shipping while supporting our newest MCU offerings.
for one of these products.
Microchip designed the Explorer 8 Development Kit to be
The Explorer 8 Development Kit is a full-featured development your main tool for 8-bit development with support for a wide
board and platform for 8-bit PIC microcontrollers variety of functions. On-board components enable
(MCUs). This kit is a versatile development solution, easy development of human interface, power
featuring several options for external sensors, off- conversion, Internet of Things (IoT), battery
board communication and human interface.
Additionally, it offers ample room for expansion,
Worth charging and other applications using a
powerful 8-bit PIC MCU.
making it an excellent solution for developers $123.99
and engineers looking for a tool with the Additionally, the Explorer 8 Development
largest number of supported 8-bit PIC MCUs.
(approx £97.50) Kit also has a large capacity for expansion.
each Two Diligent Pmod interfaces, two
The Explorer 8 Development Kit is the latest MikroElectronika Click board sockets and two
offering in a long line of enterprise-class tools custom expansion headers allow you to quickly
for 8-bit PIC MCUs. The board is an evolution of the adapt as your development needs change. The
popular PIC18 Explorer Board, and has been updated to take Explorer 8 Development Kit supports several program
advantage of our most modern features: and debug solutions, including the PICkit 5, ICD 5 and MPLAB
• On-chip Core Independent Peripherals REAL ICE In-Circuit Emulator.
• Compatibility with all PIC MCUs
• 8-, 14-, 20-, 28-, 40/44-, 64- and 80-pin footprints

Microchip
Win a Microchip
Explorer 8
Development Kit

Free-to-enter
competition
Microchip
DM160228

How to enter December 2023 winner


For your chance to win a Microchip Explorer 8 Barry Lewis
Development Kit or receive a 15%-off voucher,
including free shipping, enter your details in the
online entry form at: Barry won a
https://page.microchip.com/PE-Exp8.html Microchip PIC24F
Closing date LCD and USB Curiosity
The closing date for this offer is 31 March 2024 Development Board

Practical Electronics | April | 2024 9


Net Work
Alan Winstanley
Our column covering Internet-related trends, and more besides, bags a label printer from
China at a bargain price. Plus some current and new smart home products by TP-Link’s Tapo
are examined. There’s also news on the SMR power generation front.

I
t’s now second nature for electronics is the model M220 which has a wider
hobbyists to source materials, tools, print head and larger battery.
components or printed circuit boards These labellers have a street price of
directly from China, and websites such about £45 ($55) but Temu was offering
as AliExpress, Banggood and Temu them for just £11 ($13), and four extra rolls
are falling over themselves to attract of labels cost about the same. Thus, their
our business. These websites sell a thermal labeller with refills would come
myriad of products, and they push in at about £25 ($30) delivered which,
heavy discounts or ‘new user benefits’ unlike AliExpress, included sales taxes
in order to hook new customers. It’s no with no hidden extras. Was this too good
secret that these Chinese super-sites to be true? There was only one way to find
are slugging it out for trade, and after out, and a smooth PayPal transaction was
several months of being bombarded by quickly completed in a few mouse-clicks.
their pop-up adverts, I finally buckled
and decided to try the newcomer Temu Testing Temu
website for the first time. Six days later my first Temu order arrived
Printing QR codes using the M110 labeller.
Temu’s online store is very slick and in England all present and correct, in
quite overpowering, but what caught the usual kind of barcoded polybag. The bit counterintuitive, but I managed to
my eye was an introductory ‘first time rounded design of the M110 printer takes muddle through.
customer’ offer on a thermal label maker, up little space, and mine was moulded in This way of working will be fine for
specifically the Phomemo-brand M110 blue ABS sporting a large logo ‘window’ printing labels on the go or in awkward
handheld Bluetooth printer. I’ve had my that looks like some sort of display screen locations, but I eventually realised that
eye on such a machine for quite a while, (it isn’t). There’s a two-colour 20mm the makers had made a strange omission:
because they are handy self-contained OLED status display, which is small but although the spec. sheet states Bluetooth,
rechargeable devices that can print, crystal-clear in operation. The printer Android and iOS compatibility, not
among other things, barcodes, QR codes contains a 1200mAh lithium battery mentioned anywhere was the fact that,
and labels for identifying cables. They which is charged through a USB-C port as I later discovered, printer drivers for
will also print die-cut or continuous and, as per the current trend, you provide 32-bit and 64-bit Windows and macOS are
labels on small rolls. Although the makers your own 5V mains charger. downloadable from the maker’s website,
call it a ‘business’ printer, it’s the sort of Labels are designed with the free Print along with free label creation software.
thing that can soon find uses in the home Master app for iOS or Android. Pairing There is also a Linux driver. Having
and workshop, and various coloured the Bluetooth printer was trouble free, installed the latest Windows driver and
and transparent labels, either diecut or and after loading the supplied roll of free ‘Labelife’ software on my PC I was
continuous, are sold too. Also available labels I was printing labels within a soon downloading labels to the printer
minute or two. The resolution quality via a USB-C cable. The printer firmware
was very good, and I was surprised by can also be updated that way. Using the
the comprehensive labelling software desktop software, the required label size
options provided: apart from plain text, can be chosen from the Templates menu
it will print QR codes, EAN and UPC and then text, images, QR codes and so
barcodes, as well as tables, monochrome on can be added. Designs can be saved
images and icons. In fact, it goes even to disk for future use.
further by offering OCR text capturing
and voice recognition, which worked Cable label capable
very well. Label content can be dragged Confusingly, the makers describe direct
around or resized, and a print history is thermal labels as ‘paper’ but the 40 x
stored to allow future reprints. 30mm diecut labels supplied are made
Initially, I found that designing of polymer film, which is resistant to
labels was better done on a tablet than tearing, abrasion, chemicals and water.
a smartphone. Either way, calling up They are good quality labels with semi-
(tap, swipe, double tap … etc) the text permanent adhesive, and they can be
editor window to make changes was hit peeled off again without leaving a residue.
The M110 by Phomemo is a self- and miss, frustratingly so at times, and The adhesive is not freezer-proof though
contained Bluetooth and USB thermal the text input field had a low contrast (as my frozen pies will testify).
labeller that prints on both polymer diecut and occupied a tiny area on my phone Cable identification labels made from
and paper labels. and tablet screens. The software was a the same plastic material are available

10 Practical Electronics | April | 2024


corresponding runtime and usage costs
displayed on the Tapo app. They double
as compact, handy programmable time
switches as well, and they can time
up or down. In ‘Away’ mode they can
act as a burglar deterrent by switching,
for example, lighting randomly during
predetermined periods. After installing
the TP-Link ‘skill’ on Amazon’s Alexa
app (Google Home is also supported), I
now have voice control of lighting and
TV power too, which works sufficiently
well 95% of the time. It’s also possible to
control them remotely with your app, and
share the control of certain Tapo devices
with up to eight friends and family.
Coming soon is an updated Tapo smart
socket, the P110M which includes an
Cable identification labels can also be produced on special diecut blanks. energy-monitoring chip that it claims
provides overload protection. This smart
in various colours and are handy for you enter the site. Printers and blank device will be Matter compatible (see Net
electricians, network engineers and labels also appear on Temu, Amazon Work, April 2023). Matter is the slowly
constructors. These have a printable and other sites. evolving new LAN protocol that promises
area of 35mm x 12mm on each side, and to make the installation of smart devices
the wraparound is good for cables up to Tapo dancing as simple as ‘plug and play’. ‘Simply
10mm diameter or so (12mm max), and Regular readers will know that I’ve been
although they are tear-resistant they trying the Tapo range of smart home
are not indestructible. It was easy to controls for quite some time. Tapo is
print labels in the app, and the narrow produced by TP-Link and it gives us an
section is then stuck around the cable indication of emerging smart home trends.
before the main printed area is folded This interesting and ever-expanding
over to stick it all together (see photos). brand is aimed at domestic users looking
This idea works very well. Although the to add affordable smart controls to their
Windows software has a template for home. Several Tapo bulbs and smart
them, strangely the printable area of the plugs (mains sockets) are in regular use
cable label is not defined, and I wasted by the writer which work well enough
quite a few labels due to misalignment. most of the time, although sometimes
The mobile Print Master app is a better they can be temperamental, and I have
choice here. to reboot them to restore functionality.
A number of other printers is sold by As Tapo is intended to control small
Phomemo, including a fun sticker printer domestic appliances, personally I would
and a 6 x 4 shipping label machine. avoid using them with, say, electrical
Other labels in the range include heating or motorised machines like an
transparent and decorative ones for air conditioner or hefty white goods
crafts or hobbies, so it’s worth browsing like a washing machine, or garage door
around the maker’s website for ideas. You motors, alarm systems or similar more
can buy labels direct using PayPal from demanding applications. The Tapo P110M is a smart plug
https://phomemo.com and watch for a Some Tapo smart plugs include an with energy monitoring that is Matter
pop-up discount voucher code when energy monitoring feature, with the compatible. It’s rated 13A for the UK.

1551W IP68 miniature enclosures


Learn more: hammondmfg.com/1551w

[email protected]
01256 812812

Practical Electronics | April | 2024 11


scan the provided QR code with your it’s one worth keeping an eye on to follow
smartphone and the Matter device will trends and developments.
be automatically configured to your
home network. Enjoy your smart home A hub of activity
products with ease right out of the box!’ Also part of the Tapo range is the ‘Smart
as TP-Link puts it. Hub’ (H100) which forms the heart
of a sub-group of Tapo smart sensors,
It does Matter switches and buttons. It’s a plug-in
Matter aims to enable compatible Matter mains-powered hub and its main feature
smart devices talk to each other, even if is its built-in audio chime and ability (in
the home itself goes offline (eg, due to theory) to connect to up to 64 devices.
a broadband outage). A host of Matter- The spec. sheet highlights that it uses
compatible devices are scheduled for 2.4GHz Wi-Fi, but it also uses the less
early release by TP-Link, and anything crowded 868MHz frequency (for UK
that simplifies an often technical and models) to link with compatible Tapo
onerous set-up routine can’t come smart devices, which TP-Link claims
soon enough. For more details visit: improves battery life ten-fold. (The same
https://bit.ly/pe-apr24-tpl frequency band has proven extremely
TP-Link’s ‘Kasa’ range of smart reliable when used by my Ecowitt
devices predates Tapo and seems more weather station sensors, described in
robust. Until recently, Tapo and Kasa previous issues.) They are ‘cloud free’
required their own apps and were in the sense that they will continue
not interoperable, but following an operating locally, even if the Internet The T110 magnetic sensor uses the
update the Tapo app can now control connection goes down, provided the H100 chime to warn of open doors or
both device ranges. To test this out, mains supply is still running. The app windows. It only has sticky pad fixings.
I tried adding an old TP-Link Kasa also lets you share functionality with
smart socket (HS100) to my Tapo app designated friends. particularly sturdy. The only mounting
– this was previously impossible to I tried the H100 hub with a Tapo Smart option is via the pair of sticky pads
do, and although the setup routine Contact Sensor T110 by adding them as supplied, which seems a missed
was a throwback to the earlier days devices on the Tapo app, then firmware opportunity; you can’t screw-mount them
of using smart home devices, it did updates were downloaded automatically. onto a wooden door frame, for example.
install successfully and proceeded to Setup was not as slick as I’d hoped for, Also available are a PIR motion detector,
update its firmware. A more compact and it took several attempts to configure a temperature/humidity sensor with LCD
smart socket (the Kasa KP105) is due everything successfully (I gave up at one screen and a smart water leak sensor.
out soon, while the new KP115 smart point). As a surprise bonus, ten minutes The Tapo Smart Button (S200B) allows
plug includes energy monitoring. Both later my Amazon Echo Show notified human-interactive control of other Tapo
devices have a current rating of 13A me that it detected a new device (the smart devices such as light switches,
(UK use). Not available in the UK yet, contact sensor) being added on the TP- bulbs with a single or double tap, and a
the Kasa KP125M is a new compact size Link ‘skill’. rotating action accesses more functions
Matter-compatible smart plug. The Tapo app lets you choose from (eg, a dimmer). It could also be used as
In Britain, the Kasa brand also includes 19 hub chimes such as doorbell ‘ding- a nurse-call alarm for elderly care, or it
smart radiator thermostatic valves to dong’ or alarm tones which are clear and could set, say, ‘Away’ mode when you
control central heating, and there is a strident (four volumes, up to 90dB). You leave the building.
whole raft of security cameras and video then link compatible sensors or switches
doorbells to choose from in TP-Link’s to the Tapo hub. So-called ‘Smart Actions’
rapidly expanding repertoire of home- then enable alarms or chimes to sound
networked devices. TP-Link does seem when certain triggers are detected. In
to be investing in this product line and my case, an alarm will sound when
the contact sensor is opened or closed
(my choice) and a delayed action from
seconds to hours can also be set. Its hours
of operation can also be dialled in like
a time switch, and all triggering actions
are logged in the app.
I had to invest quite some time in the
app before everything would function
as desired: there was no quick ‘plug and
play’ here. I eventually discovered that
configured Smart Actions were silently
stored in the app under ‘Automation’
where they could be toggled on or off
or deleted. This probably explains
the inconsistencies in operation that
The H100 Smart Hub with Chime works I experienced.
on 868MHz with compatible smart
sensors and peripherals. It continues Sticky sensors A 3D-printed doorbell adaptor plate
working locally even if the home The contact sensor itself is a two-part for the S200 button is sold on eBay
broadband is down. set containing a magnet and it’s not (stevedark001).

12 Practical Electronics | April | 2024


Keen to sample the performance of this
budget-priced range, I’ve now added a
Tapo smart rotary button (S200B) and
a smart water leak sensor (T300) onto
my home network for trials. Iin next
month’s Net Work I’ll report back on
how well these low-cost smart devices
are faring in practice.
A wallplate version (S200D) would
replace a wall light switch, but I’m not
sure how robust it would be, either
mechanically or network-wise. It’s also
suggested for sheltered doorbell use,
the hub sounding the doorchime. (Note
the button would be easily pocketed.)
An eBay user (stevedark001) sells a
3D-printed base and holder for Tapo smart
buttons that resembles a bell pushbutton:
Steve tells me it came about because
visitors didn’t realise his Tapo button
was in fact the doorbell!
For more demanding users, the Smart
Hub (H200) hub uses a mains adaptor
instead and has an Ethernet port and
microSD storage (512GB max), suitable for
up to 64 devices and up to four compatible
Tapo security cameras or video doorbells.
Chimes and sensor detection are also
included. More details and an online
shop are at: www.tapo.com

Power to the people


Work continues to make the UK’s nuclear
power generating industry fit for the 21st
century. At the site of the Hinkley Point
‘C’ nuclear power station in Somerset,
southern England, the world’s largest Putting the lid on: the world’s largest crane, Big Carl, placed a 245 tonne lid onto the
crane, the 750 tonne ‘Big Carl’, is doing Hinkley Point C Unit 1 nuclear reactor last December. A second reactor will follow.
the heavy lifting and last December it
topped off the Unit 1 steel containment ever since it was approved in 2016, and faster, cheaper route to bringing nuclear
building with a 47-metre diameter, 245- presently the £26bn ($31bn) project is due power stations on stream. The idea
tonne lid. The French-built reactor will to come on stream in 2027. (Attention will of SMRs is that key elements would
be installed this year and is the first new then turn to building another new nuclear be manufactured off site, before being
(UK) reactor to be built in over 30 years. A station, Sizewell C.) An honest appraisal delivered by road for final assembly at
second reactor is also under construction of progress is given by EDF in the video smaller power stations. SMRs could also
which, thanks to the experience gained at: https://youtu.be/rxhHTpnKX8Y be located in more isolated or rural areas
in rebuilding an entire industry, should As regular readers will recall, I’ve which will improve distribution. This
take 20-30% less time to complete, says previously described the concept of the factory-built, production line approach
EDF Energy. The project has been plagued Small Modular Reactor (SMR), which would improve efficiency and help
by delays, Covid and cost increases offers the power generation sector a keep the lid on costs. The International

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

www.terrington-components.co.uk | [email protected] | Tel: 01553 636999

Practical Electronics | April | 2024 13


router, switch and mesh hub running for
over half an hour. It’s enough to make
anybody want to live off-grid!

Battle of the bots


The industry obsession with AI chatbots
continues as Microsoft integrates Copilot
into the Edge browser (described last
month) and, eventually, the Windows
d e s k t o p . G o o g l e ’s e x p e r i m e n t a l
Bard chatbot was touted as ‘an early
AI experiment that can boost your
productivity, accelerate your ideas and
fuel your curiosity’ but was recently
Westinghouse has been chosen to supply four SMRs for a privately funded British rebranded as Gemini, so you will soon be
nuclear power station in Teesside. able to ‘chat with Gemini’ when searching
online. A Google search reveals that the
Atomic Energy Authority states that there reactor, but which raised numerous astrological sign Gemini is named after
are more than 80 SMR designs under safety concerns.’ He goes on to say how the constellation twins Castor and Pollux,
different stages of development in 18 it ‘reflects the fragility of the advanced so now you know!
Member States, including the Akademik nuclear power industry in the US, which Bringing your pet dog to work was
Lomonosov floating power unit moored has been driven by an oversupply of an idea that Amazon embraced at its
in the Russian Federation, which started reactor developers and a lack of genuine Seattle HQ in its earliest days. Some
generating in 2020 (as shown in Net demand’. The full statement is at: 7,000 pooches are now registered across
Work, March 2022). https://bit.ly/pe-apr24-ucsusa 40 office blocks, and more than 500
Britain’s Rolls-Royce is one of several Despite this major setback, NuScale dogs are in the offices at any one time,
blue-chip manufacturers scrambling to remains very upbeat and positive about Amazon says. It’s why you see a picture
be at the forefront of SMR development, the future, citing future projects including of a dog on an Amazon ‘Uh oh’ error
and last October the company was keen ones overseas that are in the pipeline. page. Amazon is developing its own AI
to remind us that it ‘had the only SMR The scramble to get SMRs to market bot called Rufus, named after the very
technology in a European regulatory continues, and back in Britain a major first dog (a Welsh corgi) ever to grace
approval process, putting us almost two step forward has been taken by a privately the office, where he was clearly a well-
years ahead of any of our competitors. financed SMR project to build four SMRs loved member of the Amazon team:
Securing a domestic contract is vitally in Teesside, in northeast England. Actual https://bit.ly/pe-apr24-amz
important to unlock the enormous global power generation using SMRs is still some Amazon’s Rufus AI is a shopping
export potential of our clean energy ten years away and the Teesside plant is assistant ‘bot that is currently undergoing
technology.’ The company is also keen expected to start producing in the early beta house-training with select mobile
to ‘reinforce its position as the SMR 2030s. The supplier of the four reactors is app users in the US. He’ll be let off the
design that’s furthest advanced towards neither Rolls-Royce nor NuScale, though, leash across the US later this year, and
being deployed in the UK.’ but America’s Westinghouse. Rolls-Royce presumably Rufus will obediently roll
has however been chosen as the preferred over into the UK in due course. (That’s
Scoping for sites supplier for a site in West Cumbria and enough dog puns.)
Rolls-Royce SMR is known to be scoping has its sights on delivering SMRs to the Mozilla, the name behind the Firefox
potential factory sites for manufacturing Netherlands as well. browser and Thunderbird email client,
modules, including one in the author’s Rolls-Royce SMRs could also has launched a hobby project sharing
locality, but its SMR plans have yet eventually be dedicated to producing journal called ‘DidThis’. It’s aimed at
to be granted full approval. Rivals clean fuels such as hydrogen. With the crafters, hobbyists, constructors, home
in the SMR race include America’s market for electric vehicles faltering, chefs, writers, knitters, woodworkers,
NuScale, who were the first to have it’s worth noting that Honda and GM wedding planners, car restorers... anyone
their proposals signed-off ready for recently signed a joint venture to who’s got a personal project on the go
production, as I reported in previous produce hydrogen fuel cells, which and would like to share its progress and
columns. NuScale has majored on the may ultimately find their way into everything they experienced along the
claim that they are ready to go with an vehicles of the future. Meantime a pilot way. It could be a brilliant way of sharing
approved design, and the firm says it project to heat an entire town, Redcar in electronics projects without having to
has now started production of forgings northern England, using hydrogen has resort to the vagaries of Facebook or
for the first modules. been shelved because the main source of a blog – you just use a smartphone to
Despite this, last November NuScale, hydrogen supply will not be available. upload images. At the moment, DidThis
by mutual agreement, pulled out of a Trials at Whitby and Ellesmere Port had works on iOS only, but an Android
major contract for its SMRs that were also been shelved earlier. version is promised. Stories are kept
destined for a project in US state Utah, At the other end of the energy scale, ‘private’ by default. I think it’s a terrific
citing rising costs and non-viability. A for my own part, living in a rural area I idea – more details are at: Didthis.app
statement by Dr Edwin Lyman, Director still sometimes struggle with occasional That’s all this month – do remember
of Nuclear Power Safety at the non- power cuts. I’d just finished writing last that all the above web links are ready-
profit Union of Concerned Scientists month’s column when I had yet another made for you on the Net Work blog at:
is more telling: he cites ‘regulatory unscheduled outage. Happily, my newly www.electronpublishing.com
corner-cutting’ and claims that ‘NuScale installed 9V and 12V uninterruptible
made several ill-advised design choices power supplies (see previous months) The author can be reached at:
in an attempt to control the cost of its held up magnificently, keeping my PC,
[email protected]

14 Practical Electronics | April | 2024


Sysblocks
Sysblocks
Sysblocks
Flowcode A4 Advert EPE 25 01 24 WIP.pdf 1 31/01/2024 13:15:30

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
[email protected]
Arduino Uno,1422
PIC18877, 380RPI2B, and ESP32 is now free for hobbyists.
+44 (0) 1422 252 380 [email protected]
www.flowcode.co.uk
Flowcode 10.1 with more than 20 microcontroller targets including
+44 (0) 1422www.flowcode.co.uk
252 380 [email protected]
Arduino Uno, PIC18877, RPI2B, and ESP32 is now free for hobbyists.
www.flowcode.co.uk
+44 (0) 1422 252 380 [email protected]

www.flowcode.co.uk
Basic RF
Signal
Generator
My AM/FM/DDS Signal Generator design
(May 2023) is a very convenient piece of test
equipment, but it’s overkill for many tasks. If you
only need a basic test signal from 10Hz to 25MHz,
then this Generator is just right – it’s compact, BY CHARLES KOSINA
cheap to build and doesn’t involve many parts.

T
his design came about OLED screen as in my other designs, As for the low end, the Q Meter
because my Q Meter (PE, January and the frequency is changed by a needs a minimum frequency of
2024) needs a 100kHz to 25MHz rotary encoder with a built-in push- 100kHz, but the module can go as low
signal at close to 0dBm to function. button switch. as 1Hz. I decided that 10Hz was a rea-
Many constructors may already have IC1 updates the display over a two- sonable lower limit, spanning the full
a suitable signal generator, such as wire I2C bus with the usual 4.7k range of useful audio frequencies.
my design from PE, May 2023. Still, pull-up resistors. The rotary encoder The resolution of the signal genera-
I decided to create a simpler version terminals are pulled up by 4.7k resis- tor is 1Hz; pressing the pushbutton on
that does the job with minimal com- tors, with 100nF and 470nF debounc- the encoder toggles through step sizes
ponents and at a lower cost. ing capacitors. The differing time con- of 1Hz, 10Hz, 100Hz, 1kHz, 10kHz,
A DDS design is the most sensi- stants make it easier for the micro to 100kHz and 1MHz. On power-up, the
ble option, and the Analog Devices detect the encoder rotation reliably. default step size is 1MHz.
AD9834 is a good DDS chip, but it costs The Generator could run from any CON4 is a standard Atmel six-pin
£15 plus delivery. It makes far more standard 5V plugpack, but as the cur- ICSP header that allows you to pro-
sense to purchase a ready-made mod- rent drain is not high, I decided to use gram IC1 in-circuit if fitted. There’s
ule, which costs less and comes with two AA cells and a switch-mode boost also an optional serial debug inter-
most of the necessary parts already converter to generate 4.4V DC. This face at CON3; if you aren’t using that,
assembled onto a PCB. boost converter is the same MCP1661 you can leave off MOSFET Q1 and its
There are a variety of suitable DDS or MP1541 chip used in my LC Meter 1k pull-up resistor. However, CON3
modules available on AliExpress and (PE, November 2023). should be fitted as it is also used to
eBay – see the parts list at the end of Why 4.4V instead of 5V? The result- trigger calibration when S2 is closed
the article for sugestions. ing current consumption is lower, or its pins 1 and 3 are shorted.
Using a module like this takes a lot extending battery life. The AA cells
of the hard work out of the design. should operate down to 1V each Output frequency response
By itself, the module will not do before the up-converter drops out. Once the firmware was working, I
anything; it requires the power and This voltage is set by the ratio of the plotted the output level against fre-
control signals through the 10-pin 330k and 120k resistors to the quency, shown as the red trace in Fig.2;
header. It only took me a little while feedback (FB) pin of REG1, which is two problems are apparent. The output
to design a control module for it. This maintained at 1.25V. was about -11dBm, which is too low,
has a microcontroller with a small Since 1.25V × ([330k ÷ 120k ] + and it falls off rapidly above 18MHz.
display to show the frequency and a 1) = 4.4V, the voltage at the cathode of The output level is set by one resis-
knob to set it. I kept the same display D1 will increase until it reaches 4.4V, tor, R2, which is 6.8k on the supplied
and appearance as the Q Meter, the then REG1 will adjust its duty cycle to module. By changing this to 1.2k ,
earlier Signal Generator and associ- maintain that. The switch interrupting the output increased to near 0dBm
ated projects. power from the battery to REG1 (S1) is over the flat part of the range, shown
onboard, making construction easier. in green in Fig.2. The resistor on the
Circuit details The AD9834 module is powered and module is an M1608/0603 size SMD
The resulting circuit is shown in Fig.1. controlled by IC1 via 10-pin header type, but a larger M2012/0805 size
Microcontroller IC1 is a 28-pin DIP CON1. It has an onboard 75MHz oscil- resistor will also fit.
ATmega168 or ATmega328. Speed is lator, so the maximum output fre- I measured the output power three
not critical, so I am using the internal quency (the Nyquist limit) is half that, ways, and they did not quite agree.
8MHz RC clock source; no external ie, 37.5MHz. But it is best to operate The most reliable method is to measure
crystal is needed. The display is the it lower than that, so I chose a maxi- the peak-to-peak voltage on an oscil-
same SSD1306-based 128×64 pixel mum of 25MHz. loscope with an accurate 50 RF load

16 Practical Electronics | April | 2024


Reproduced by arrangement with
SILICON CHIP magazine 2024.
www.siliconchip.com.au

AD9834 Based RF Signal Generator


Fig.1: the circuit is simple because the DDS signal generator is a prebuilt module that plugs into CON1. It’s controlled
by micro IC1, which monitors rotary encoder RE1 and displays the status on the OLED1 screen. Power comes from a
pair of AA cells via boost converter REG1 that generates a steady 4.4V.

(how I plotted Fig.2). The other meth- gave values between 1dBm and 4dBm your needs, no further modifications
ods used the tinySA spectrum analy- lower. This still leaves the problem are needed. However, I decided that
ser and the Analog Devices AD8318 of frequencies above 18MHz having a it was worthwhile to improve the fre-
power meter. Those two methods reduced level. If this is sufficient for quency response.

Fig.2: the output frequency response of the Signal Generator with the original resistor R2 (red) and new value (green).

Practical Electronics | April | 2024 17


If you look at my photos, you will parts list includes some close alterna- Another advantage of the larger
see that the two outputs on the mod- tives that might be easier to get. (H0323) case is that there is enough
ule each have a low-pass filter (LPF) room to fit a potentiometer to allow
consisting of three inductors and three Harmonics you to adjust the output level from
capacitors. We can fix the drop-off by As with all DDS systems, the output is around -23dBm to 0dBm, to be
replacing L4-L6 and C7-C9 with differ- not pure, with multiple spurs. These detailed at the end of the article.
ent value components, giving a cutoff are shown in Plots 1-3. Of the five Actually, you can fit a small (9mm or
frequency of 35MHz. frequencies I tested (5MHz, 10MHz, 10mm body size) potentiometer in the
The inductors are M2012/0805-size, 15MHz, 20MHz and 25MHz), 15MHz smaller (H0321) case, but using the
and the capacitors are M1608/0603- and 25MHz give the purest output as larger case gives you more room and
size SMDs, but again, M2012/0805 size they are one-fifth and one-third of the choices for that pot.
capacitors will fit. The new 5th-order clock frequency. The only spurs are Apart from the AD9834 module, two
Chebyshev LPF is shown in Fig.3. You harmonics of the fundamental. circuit boards are used. One contains
will note that C8 is not needed in this All others had multiple spurs, the control circuitry, and the other is
topology. The new frequency response mostly more than 20dB down com- the front panel with a cutout for the
is shown in Fig.4. The other output can pared to the output frequency (the display and two holes for the switch
be left as-is, as it is unused. other two not shown are similar in and tuning shaft. This panel is a snug
Despite the 35MHz cutoff frequency, appearance to Plot 2). fit into the detent on the front panel,
there is still a reduction at 25MHz due and it is held in place by the nut on
to the relatively low Q of the Coilcraft Housing it the switch shaft.
chip inductors I used; their rated Q fac- I used a 105 × 75 × 40mm ABS enclo-
tors are not high. At 25MHz, the 820nH sure with a clear lid, Altronics Cat Construction
inductor has a Q of 23, the 1.5µH has H0321. An alternative is the Altronics The control board is built on a 59
a Q of 10 and the 1.8µH has a Q of 15. Cat H0323 which is deeper at 55mm. × 65mm double-sided PCB coded
These are not very impressive figures! Using the shallower H3021 case, there CSE221001 that attaches to the clear
I tested some other SMD inductors is only just enough spare room for the lid by two screws in opposite corners.
that supposedly had a higher Q but battery holder on the left side. The Both boards are available from the PE
they actually made the output level larger one has more room for the bat- PCB Service.
slightly lower. So the Coilcraft induc- tery holder, allowing it to be attached Countersunk holes must be drilled
tors are good if you can get them; the to the bottom of the case. in the clear panel for these screws –
the best way to position the holes is
to place the blank PCB inside the top
Fig.3: this new cover hard up against the right side
Chebyshev low-pass and use it as a template for drilling the
filter arrangement holes for the switch, shaft encoder and
provides a much two diagonal mounting holes.
flatter response After that, assemble the control
than the one that
board (see Fig.5), starting with the sur-
comes with the
module. face-mounting components. The resis-
tors and capacitors are all 2.0 × 1.2mm,
so they aren’t too difficult to solder.
However, the 5-pin SOT-23 chip (reg-
ulator REG1) requires some care due
to its close pin spacing.
It really helps to have some flux
paste to solder REG1. Put a little over
the pads, then place the IC over them
and tack one of the pins on the side
with only two pins by loading a lit-
tle solder on the clean tip of a sol-
dering iron and touching it to both
the pin and pad. Check that all the
other pins are correctly located over
their pads; if they aren’t, re-heat the
joint and gently nudge the regulator
into position.
Once it’s aligned, put a bit more
solder on the iron and, after adding a
little more flux paste, touch it to the
three pins close to each other so that
three good joints are formed. Check for
bridges between the pins. If any have
formed, add more flux paste and then
use some solder wick to remove the
excess solder. Finally, solder the last
pin on the other side.
After that, all the through-hole
components on the front side can be
mounted. The OLED plugs into a 4-pin

18 Practical Electronics | April | 2024


Fig.4: the measured response of the new filter. It isn’t quite as good as estimated in Fig.3 due to the limited inductor Q
values, but it’s a vast improvement on the original. We calculate that the response to be significantly flatter than this
using the specified components.

socket strip and is attached by 16mm


screws through 8mm untapped spac-
ers. Depending on the exact OLED
screen used, the screws may need to
be either 2mm or 2.5mm in diameter;
most will accept M2 screws.
So the OLED sits at the right height,
carefully slide off the plastic strip on
the 4-pin header soldered to the OLED
and cut the pins to suit the depth of
the socket. Use a 28-pin DIL socket for Plot 1
the ATmega168/328. Finally, attach
the three connectors on the under- 5MHz
side of the board. Transistor Q1 and
its associated 1k resistor can be
omitted if you don’t need the serial
debug feature.
Assuming you have a blank chip, it
is easiest to program it in-circuit using
CON4. You will need an Atmel serial
programmer; an Arduino can be used
in this role. First, use the Arduino
IDE to upload the ArduinoISP sample
code to the Arduino to be used as a
programmer. Next, wire up CON4 to
the six-pin programming header on Plot 2
the Arduino, except for the RST sig-
nal on pin 5. Assuming you’re using
10MHz
the Uno, pin 5 on CON4 goes to its
D10 digital pin instead.
After that, you can use the free soft-
ware AVRDUDE (Linux or Windows
command-line) or AVRDUDESS (Win-
dows GUI) to upload the HEX file avail-
able from the April 2024 page of the PE
website: https://bit.ly/pe-downloads
Use the ‘Arduino’ as the program-
mer and 19,200 as the baud rate. Make
sure you select the correct COM port
(the one the Arduino programmer
board is using) and the target chip Plot 3
(ATmega168, ATmega328 etc). 25MHz
Modifying the DDS module at a time with some reasonably solid tin-lead solder into the pad on each
First, desolder and remove the small tweezers, then alternately heating one side before doing this.
SMDs labelled L4-L6 and C7-C9 from side and the other while pulling up Once the parts are off the board,
the board. You can do this with a stan- gently until the part lifts off the board. squirt a small blob of flux paste onto
dard iron by grabbing one component It usually helps to melt a little extra each pad, place some solder wick on

Practical Electronics | April | 2024 19


Fig.5: fit the components to the control board as shown here; note that there are two 4.7k resistors under the OLED screen
and a 100nF capacitor on the underside of the PCB.

top, press down with the iron, and, on the shaft encoder, it may operate Final assembly
when it’s hot enough, slide it off the backwards. If that is the case, then Attach the control board to the trans-
pad. That should remove all but a simply plug a jumper on the program- parent lid by two screws on opposite
very thin layer of solder. Clean up the ming header between pin 4 and pin corners with 12mm-long M3 tapped
flux residue with some flux cleaner or 6 of CON4. If you haven’t fitted the spacers, into the countersunk holes
pure alcohol and a lint-free cloth or header, you can do it now or solder a you made earlier.
cotton bud. short component lead off-cut between The AD9834 module attaches to the
You can then install all the new com- those pins. bottom of the case with M2/M2.5 ×
ponents: L4 = 820nH, L5 = 1.8μH, L6 The firmware reads the level on dig- 12mm countersunk (CSK) screws and
= 1.5μH, C7 = 33pF and C9 = 30pF. ital input PORTB.3, which determines nuts, plus 5mm untapped spacers.
Do not install a new capacitor on the the encoder direction sensing. Adding First, two holes need to be drilled
pads for C8. Note that one of the spec- a jumper between pins 4 and 6 of CON4 in the side for the SMA connectors, as
ified inductors has an open side which pulls that pin to GND. shown in Fig.7. The square wave out-
should face towards the PCB while the If all is well, connect the AD9834 put connector is not accessible and is
other inductors and the capacitors can module, being careful with the orienta- not used in this design.
be fitted in any orientation. tion of the flat cable, ensuring that pin 1 Next, slide in the module and use it
goes to GND at both ends. A green LED as a template to mark the position of the
Making the cable on that module should light up when two holes in the bottom. Drill these to
A short 10-pin flat ribbon cable with power is applied. 2.0mm or 2.5mm to suit your screws and
IDC connectors at each end joins the Check the output on the two SMA then countersink them on the bottom.
two modules. Crimp the IDC connec- connectors with an RF power meter
tors as shown in Fig.6; if in doubt, or oscilloscope. The output of the LPF Calibration
check the photos. You can use a vice requires 50 termination; without it, The output frequency accuracy depends
to close down the connector on the flat there may be some distortion of the on the exact frequency of the 75MHz
cable, making sure that it is exactly output waveform. oscillator on the module. I found the
square, although it’s better to use a ded-
icated IDC crimping tool (eg, Altronics
T1540).
There is no room for the strain relief
clips on the connectors, so leave them
off if supplied.

Testing
For initial testing, before assembling it
into the case, connect the battery and
switch it on. The OLED should come
up with an initial message showing the
version number. After two seconds, the
display will show the frequency, step
size and battery voltage. The default
frequency on power-up is 10MHz, and
the step size is 1MHz.
Check the VCC voltage at pin 7 or 20
of IC1; it should be close to 4V. You can
use the labelled pad near the bottom
edge of the PCB as a GND reference.
Rotating the knob should increase This photo shows nearly all parts required to build the Basic RF Signal Generator,
or decrease the frequency. Depending except for the replacement components for the DDS module (see the text above).

20 Practical Electronics | April | 2024


counter is 10MHz ±1Hz, then press the
knob. This sets a correction factor into
an EEPROM which is read on power-up.
As there is no temperature compen-
sation in the 75MHz crystal oscillator,
you can expect this frequency to drift
slightly, but it is likely to remain within
±20Hz at 10MHz. Recalibration may be
needed from time to time as the crystal
oscillator ages.

Battery life
With fresh AA alkaline cells, the input
voltage is about 3.2V. The current drain
starts at 80mA and increases as the bat-
tery voltage drops (because the boost
regulator maintains a constant output
voltage). By the time the battery drops
to 2.7V, the current is about 95mA.
The best alkaline AA cells are
3000mAh, but that rating is for a light
load. It has to be derated to 2000mAh
or so at the expected current drain. This
gives an expected operational life of
about 20 hours.

Adjusting the output level


Depending on component values and
settings, the Q meter can be fussy about
its input signal level. Sometimes the
0dBm value is too high. We can use
external attenuators, but this makes the
setup rather complicated.
The output level is set by resistor
R2 on the DDS module, so I thought
why not use a potentiometer in its
place? The wires to the potentiometer
could pick up some noise that would
amplitude-modulate the output. How-
Inductors L4-L6 and capacitors C7-C9 have been replaced on the AD9834 ever, if the wires are short, that might
module to provide a 35MHz cutoff frequency. The output level is adjusted by not be a problem.
changing R2, which I replaced with a potentiometer. The adjacent photos shows how I
did this on the prototype. I started by
error at 10MHz to be about 140Hz. This Set the frequency to precisely 10MHz replacing R2 with a 100nF M2012/0805
is of little importance for some applica- and measure the output with a fre- SMD capacitor, providing noise filter-
tions, for exampe driving the Q meter. quency counter. Turn on S2 or plug ing and a firmer base to the connecting
However, if you need it, there is a cal- the jumper across CON3 and rotate the wires. Connect a 1.2k M2012/0805
ibration procedure built in. tuning knob until the readout on the SMD resistor to one end of this capac-
itor, then use short wires to connect a
50k pot between the wiper and the
anti-clockwise end of the track.
Mount this on the right-hand side
of the enclosure so the wires are very
short. Take great care in attaching the
Fig.6: the ribbon cable is simple to make but ensure that the pins are fully wires to the module to prevent any
pushed into the plastic housing, or you might end up with bad connections. damage to the SMD connections.
With the maximum resistance, the
output becomes about 22mV peak-to-
peak, corresponding to about -29dBm.
At minimum resistance, the output is
close to 0dBm. I saw no evidence of
noise pickup in the output signal.
If adding this output control, using
the larger case (H0323) gives you
more options; you could use a 16mm,
10mm or 9mm potentiometer. With
the smaller case, you’ll have to use a
9mm or 10mm potentiometer to have
Fig.7: where to drill the holes in the side of the box for the SMA connectors. any chance of it fitting.

Practical Electronics | April | 2024 21


Parts List – Basic RF Signal Generator
1 double-sided PCB coded CSE221001, 59 × 65mm from the PE PCB Service
1 black PCB coded CSE220902B, 77.5 × 64mm, 1mm thick (front panel)
from the PE PCB Service
1 0.96in OLED screen, SSD1306-compatible controller (OLED1) [SC6176]
1 AD9834-based RF DDS signal generator module (MOD1) (see below)
1 vertical-mount rotary encoder with integral pushbutton and 20mm-long
shaft (RE1) [SC5601]
www.poscope.com/epe 1 105×75×40mm or 105×75×55mm ABS case [Altronics H0321 or H0323]
1 3.3uH axial RF inductor (L1)
1 820nH SMD inductor, M2012/0805, Q = 100 @ 25MHz (L4 on MOD1)
[Coilcraft 0805HP-821XJRC or Vishay Dale IMC0805ERR82J01] ●
1 1 8μ n 2012 080 40 2 n 1
[Coilcraft 0805CS-182XJRC or Murata LQW21HN1R8J00L] ●
11 μ n 2012 080 40 2 n 1
[Coilcraft 0805CS-152XJRC or Murata LQW21HN1R5J00L] ●
12 n 1
2 AA alkaline cells
1 2×5 pin header (CON1)
1 2-pin polarised header with matching plug and pins (CON2)
1 3-pin polarised header with matching plug and pins (CON3)
1 2×3 pin header (CON4; optional; for in-circuit programming of IC1)
1 jumper shunt (optional; to set the direction of RE1)
1 4-pin female header (for OLED1)
2 P n
(S1 and S2; S2 is optional, for calibration)
1 28-pin DIL IC socket (for IC1)
2 10-way IDC crimp sockets
- USB - PWM
- Ethernet - Encoders Cable and hardware
- Web server - LCD 1 knob to suit RE1
- Modbus
- CNC (Mach3/4)
- Analog inputs 2 M3 × 12mm tapped spacers
- Compact PLC
- IO 2 M3 × 6mm panhead machine screws
2 M3 × 6mm countersunk head machine screws
2 M2.5 or M2 × 12mm countersunk head machine screws
2 M2.5 or M2 × 16mm panhead machine screws
4 M2.5 or M2 hex nuts
2 3mm ID, 8mm long untapped spacers
2 3mm ID, 5mm long untapped spacers
1 70mm length of 10-way ribbon cable
1 double-sided foam tape pad or strips (to secure the cell holder)
Semiconductors
- up to 256
microsteps
- up to 32 1 1 8P 28P p 22100 X 1
microsteps
- 50 V / 6 A - 30 V / 2.5 A
1 P1 1 P1 41 FP n
- USB configuration 2 R 1
- Isolated 1 2N7002 N nn n F 2 1 optional, debug interface)
1 MBR0540 50V 500mA schottky diode, SOD-123 (D1)
PoScope Mega1+ Capacitors (all SMD ceramic, M2012/0805 size, unless noted)
2 10μF X R X7R 1 pF 0 0 NP0 7 n 1 ●
PoScope Mega50 1 470nF X7R 1 0pF 0 0 NP0 n 1 ●
4 100nF 0 X7R ● replacement parts for the AD9834 DDS module

Resistors (all 1% SMD M2012/0805 size, unless noted)


1 330k 1 120k 5 4.7k 1 1k (optional, debug interface)
Additional parts for adjustable output level
1 100nF 0 X7R 2012 080 p
1 1.2k 1% SMD M2012/0805 size resistor
1 50k chassis-mounting single-gang linear potentiometer
[Altronics R2245 or Jaycar RP8516]
1 n 8 pp n

- up to 50MS/s AD9834 module


- resolution up to 12bit Annoyingly, my original source for this module has now stopped selling it.
- Lowest power consumption
- Smallest and lightest
n n p pnn F n
- 7 in 1: Oscilloscope, FFT, X/Y, p n n n 22 n n .
Recorder, Logic Analyzer, Protocol n n n n pp
decoder, Signal generator
www.ebay.com.au/itm/254760896955 www.ebay.com.au/itm/184507223305
www.ebay.com.au/itm/264914563563 www.ebay.com.au/itm/224210854323
www.ebay.com.au/itm/145517726380
22 Practical Electronics | April | 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 D-R M cover a
FROM THE PUBLISHERS OF

FROM THE PUBLISHERS OF

huge range of subjects that will interest everyone involved 5 design and build circuit projects for newcomers or JUMP START
CIRCUIT SURGERY
in electronics – from newcomers to the hobby and  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
 The techniques of electronic
project construction PRACTICALLY SPEAKING
The first section pages is dedicated to Circuit INGENUITY UNLIMITED Machine n Battery Voltage Checker n olar- The techniques of project construction

PIC ‘N MIX
Surgery, EPE/PE’s regular clinic dealing with readers’ Powered Charger n Versatile Theft Alarm n pooky
 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 hristmas 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 E circuit simulation software. i od peaker n Logic robe n D Motor ontroller
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 –  The free CD-ROM provides
a broad-based introduction
to electronics
n Egg Timer n ignal njector robe n imple 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  A complete stand-alone


CD ROM
This CD
should
start
y, if not
microcontrollers
Simulatio automaticallindex.html
Circuit d version) tutorial in 11 parts plus free
 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


 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

 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 09:59:25
29/07/201

d 1
In 2 - JUL13.ind

components is covered. Finally, our collection of


Teach
Teach In 5 Cover.indd 1 29/07/2013 10:00:29
Teach In 3 Cover.indd 1 06/05/2010 16:22:29

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


Ingenuity Unlimited circuits provides over 4 circuit designs submitted by readers. microcontrollers and Practically Speaking – tips and techniques for project construction.
The D-R M 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 13:21:42
The D-R M also contains:
ui es to test your knowledge and T A circuit simulation software a limited n Complete Teach-In 2 book, a practical introduction to PIC microprocessors
n MikroElektronika, Microchip and L-Tek o cope software.
dd 1

version plus a specially written T A Tutorial .


CD Cover.in

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 D-R M 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...
 An eleven part tutorial
 Uses inexpensive circuit

many schools and colleges. These include, Edexcel


simulation software

TE 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 D-R M also contains the full Modern
The Full Modern Electronics Manual!
work for everyone
studying electronics

Electronics Manual, worth 2 . 5. The Manual  Over 800 PDF pages

contains over pages of electronics theory,


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

What a Bargain!!
if not, open double-click
and
Explorer f
index.pd

projects, data, assembly instructions and web links.


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

MAN.co.u
Downloa be.com
www.ado

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 Cover.indd 1 14/11/2011 20:33:21

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 D-R M 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 ircuit 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 i, or who has an idea for a project but doesn’t hardware and interfacing. It will provide a one-stop
n Learn with T A’ modern AD 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 n Five projects to build: The Arduino offers a truly effective platform for
Pi. It covers: i re-amp developing a huge variety of projects; from operating
n Pi programming ii eadphone Amp a set of Christmas tree lights to remotely controlling a
n Pi hardware iii Tone ontrol robotic vehicle through wireless or the Internet.
n Pi communications iv -meter Teach-In 8 is based around a series of practical
n Pi Projects v igh erformance Audio ower Amp. projects with plenty of information for customisation.
n Pi Class
n Python Quickstart This book also includes PIC n’ Mix: s and the
PLUS PICkit 3 – A Beginners
n Pi World E
guide’ by Mike ’ eefe 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 e pert’s take
TEACH-IN 7 by an ell tate TEACH-IN 8
FROM THE PUBLISHERS OF FROM THE PUBLISHERS OF
FREE
CD-ROM
R M also contains all on specialist circuits
SOFTWARE
FOR

Machines part 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 D-R M 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

n Microchip M LA
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- ation
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

martscope software.
building PIC-based projects

Teach In 6 Cover.indd 1 02/03/2015 14:59:08 Teach In 7 Cover VERSION 3 FINAL.indd 1 07/04/2016 08:25 Teach In 8 Cover.indd 1 04/04/2017 12:24

ORDER YOUR BUNDLE TODAY!


JUST CALL 01202 880299 – OR VISIT www.electronpublishing.com
This handy device can
provide test voltages, test
signals, vary a resistance,
switch a component in
or out of circuit and even
measure some voltages.
It ties into automation
software so it performs
tests automatically and
records input and output
values for analysis.

SWISS ARMY KNIFE


AN AUTOMATED TEST BENCH BY RICHARD PALMER

W
hen testing something on Two 16-bit analogue inputs with Despite being driven by an 8-bit dig-
the bench, I often need to fish over-voltage protection can measure ital-to-analogue converter (DAC), the
around in the parts drawer ±10V DC to within a few millivolts noise and distortion total less than 1.5%
for some control component, like a with excellent linearity. As long as both across the range (see Scope 1 and 2) after
switch or a pot. That’s so I can test input terminals are kept within that low-pass filtering. Major contributors to
some circuitry across a range of volt- range, it can measure differentials up to this are the sine generator DAC’s volt-
ages, with different component val- 20V. The input range can be extended age steps and a jump of several steps at
ues or with some element in and out by adding series resistance to the inputs. the zero-crossing point. These artefacts
of circuit. I’m usually also measuring The 0-10V DC analogue output has are much less visible on the high output
the impact of changes at one or two 256 steps of approximately 40mV (see range, making that the range of choice.
places in the circuit. Screen 1). While the accuracy isn’t at When finer voltage control is desired,
It’s remarkable how often I reach the same level as the analogue inputs, the sinewave generator can be teamed
for the same components: a switch, a 256 individual test values should be up with the digital pot to provide 256
100k pot, a sinewave generator and enough for most purposes. voltage attenuation steps for either of
a 0-10V control voltage source being The sinewave generator operates the basic output voltages.
among the most frequent. from 133Hz to 55kHz. The generator A general-purpose op amp based
A collection of these most-used ele- has two output voltages: 6V peak-to- inverter is included to provide addi-
ments would be like a ‘Swiss Army peak (2.1V RMS) and 775mV peak-to- tional flexibility in handling negative
Knife’ for the test bench. Most pocket peak (0.27V RMS). The available fre- input or output voltages.
knives don’t pretend to have all the tools quencies are multiples of 133.33 Hz, We’ve included two different relays:
you’ll ever need, or even the absolute and the software rounds settings down RLY1 is a 350mA SPST reed relay, use-
best of each kind of tool. Still, they offer to the nearest available value. ful for switching signals, while RLY2
a set of robust, basic tools that will get
the job done when the perfect tool isn’t
at hand or isn’t needed.
The cost and complexity of the proj-
Features and Specifications
∎ 256-step, 0-10V output (from a DAC)
ect have been kept down by controlling
it via Wi-Fi using a web interface rather ∎ 133Hz-55kHz sinewave generator
than an LCD screen. That also means ∎ Two ±10V fully-differential analogue inputs (16-bit ADC)
it can be teamed up with test automa- ∎ Analogue inverter with ±10V input and output ranges
tion software, such as TestController, to ∎ Two 3.3V digital outputs
automate many test bench tasks. ∎ Two 5V-tolerant digital inputs
Features and performance ∎ 100kΩ digital pot with ±15V terminal ranges
Pocket knives range from a single blade ∎ One 10A SPDT relay
to monsters with more than thirty func- ∎ One 350mA SPST reed relay
tions. We’ve settled on nine functions ∎ ±15V and +5V power supply rails
for this project, and focused on mak- ∎ Remote control via serial terminal and Wi-Fi telnet SCPI commands
ing them simple to use while designing
∎ Web interface
them to tolerate moderate abuse.
The input and output connections ∎ TestController integration
are made with spring-loaded or cam-op- ∎ Powered by a 5V plugpack
erated terminals and multiple ground ∎ Open-source code (excluding web interface)
connections are provided.

24 Practical Electronics | April | 2024


Screen 1: here, the
DAC output has
been fed to both
ADC inputs, and
we are plotting the
desired voltage
(mauve) against the
actual voltage read
by a multimeter
(red) and ADC
channels one (blue)
and two (dark grey)
over the range of
0-250mV. The ADC2
plot tracks the
external multimeter
almost exactly;
ADC1 has a slight
offset error due to
using 5% resistors in
the prototype.

is a 10A SPDT type that can switch The project is housed in a UB1 Jiffy cable voltage drop during operation
power supplies and similar. Both have box and powered by a 5V plugpack. might cause the brownout detector
LED indicators. A readily available switching boost on the ESP32 to trigger, resulting in a
The maximum recommended volt- converter module is used to provide potentially endless reboot cycle.
age across both relays is limited to ±15V supplies for the op amps and The unit features a flexible suite
50V by safety considerations for bread- digital pot. of remote control functions, which
board-style operation, rather than the The ±15V and +5V supply rails are is fortunate as there are no controls
relays themselves. Both can switch in available to power external circuitry. on the unit itself! It has been specifi-
less than 10ms. The specified boost converter can sup- cally designed to be compatible with
The digital inputs and outputs con- ply 500mA at +15V and 200mA at −15V. TestController, or via its web interface.
nect to ESP32 3.3V GPIO pins with At idle, the unit draws less than You can also control it via SCPI text
series resistances to limit current if 100mA from the 5V supply and around commands from the USB serial mon-
they are misconnected. The inputs have 200mA with both relays energised and itor in Arduino or via Telnet from a
zener diode protection, will correctly all the LEDs lit. While a 1A plug pack terminal program like PuTTY.
read 5V logic and are tolerant of up to is more than adequate to power the unit The manual included in the proj-
20V. The inputs and outputs all have itself, we recommend a 1.5A model if ect downloads has full details of the
LED indicators. you will be powering much in the way SCPI command set and communica-
A 256-step 100k digital potentiom- of external circuitry. tion parameters.
eter completes the feature set. We have Even with relatively high conversion Keeping with our pocket knife theme,
specified a high-voltage type, which efficiency, the 5V supply current draw we’ve specified critical resistors as read-
allows the pot terminals to be at any will be around three times that drawn ily available 1% values to provide a full-
voltage within the ±15V analogue sup- from either the +15V or −15V rails, and scale accuracy of a few percent ‘out of
ply rails. If you prefer a different resis- more than six times that drawn by a the box’. With a simple calibration pro-
tance (or can’t get the 100k type), you device across those rails. cess that only requires a multimeter,
can substitute any other MCP45HV While the project can be USB- you can make the analogue accuracy
value (5k , 10k and 50k ). powered for commissioning, the USB better than 1%.

Scope 1: the direct sine output from the DAC at 400Hz (blue Scope 2: the distortion artefacts from the sinewave output
trace) on the low-level output range shows some noise and are much less prominent on the filtered output at 5kHz as it
a zero-crossing discontinuity. The filtered output (yellow spends much less time on each step.
trace) shows a significant reduction in noise at the cost of a
slight overshoot at each step change.

Practical Electronics | April | 2024 25


‘Swiss Army Knife’ Test Bench Multitool
Fig.1: the Swiss Army Knife is based around an ESP32 Wi-Fi microcontroller
module. Besides its digital inputs and outputs, its internal DAC at pin 9 (IO25) is
used. Because the ESP32 ADC is poor, an external two-channel differential I2C ADC
chip (IC1) is used, along with a digital pot IC for that function (IC2) and a quad
op amp to buffer and filter the DAC signal plus provide an externally accessible
voltage inverter (IC3b).

While this isn’t a highly calibrated inputs and outputs directly via its GPIO 3.3V logic and around 0.3mA from a
instrument, it has sufficient flexibility, pins, plus it has a DAC and sinewave 5V source.
accuracy and connectivity to make life generator. It also manages Wi-Fi and The inputs will register ‘high’ for any
on the test bench far more productive. serial communications. voltage above 2.5V at pins 5 and 6 (IO34
The nominally 3.3V digital inputs and IO35) and are weakly pulled down
Circuit details have 4.7k series resistors and 3.3V by 50k resistors within the ESP32.
As shown in Fig.1, the heart of the proj- zener clamping diodes ZD1 and ZD2 The input LED indicators are driven
ect is an ESP32 Wi-Fi microcontroller to make them reasonably fault toler- by pins 29 and 30 (IO5 and IO18) to
module. The ESP32 handles the digital ant. They draw minimal current from avoid loading the digital inputs.

26 Practical Electronics | April | 2024


IC3d is an amplifying Sallen-Key
low-pass filter for the sinewave output,
with a -3dB frequency of around 70kHz.
The op amp gain is set to two, as Sal-
len-Key filters with gains of more than
three are unstable.
The MC33079 op amps can drive
their outputs within 1.5V of the supply
rails and have a 175k input imped-
ance. They can source and sink up to
30mA and feature short-circuit current
limiting. 100 resistors in series with
the outputs provide an extra margin of
safety if they are misconnected.
As the op amps use an industry-
standard footprint, substitution should
be possible if the specified devices
aren’t available. While the MC33079
is a more modern op amp with better
specifications, for most jobs the Swiss
Army Knife will be used for, the ven-
erable LM324 will work fine.
While the ESP32 has in-built
analogue-to-digital converter (ADC)
channels, they are not linear enough
for even basic measurements.
Analogue voltages fed in via CON4
and CON5 are measured by a two-chan-
nel, 16-bit differential ADS1115 ADC
(IC1) which is set to have a 2.048V input
range. 91k /10k resistive dividers on
the inputs reduce 10V signals to just
under 1V, allowing for excess input volt-
ages to be sensed and some component
variation to be corrected by calibration.
As it is desired to measure both posi-
tive and negative voltages, both divider
chains are referenced to the 1.1V bias
supply (VREF) rather than ground.
The ADS1115 has inbuilt over-volt-
age and negative voltage protection for
input currents of less than 10mA, which
are limited by the upper resistors in the
dividers. If the ADS1115 isn’t available,
an ADS1015 can be substituted with a
slight drop in accuracy.
The bias voltage for the ADC is pro-
vided by IC3c, which amplifies D1’s
0.65V forward voltage to the required
1.1V. This diode is biased with 1mA
from the 3.3V rail via a 2.7k current-
limiting resistor.
Inverting amplifier IC3b completes
the analogue functions. Its gain is set
to −1 and input impedance to 10k by
the pair of 10k resistors. The 100pF
capacitor combines with those resis-
tors to filter noise from the input, with
a corner frequency of 160kHz (1 / [2π
× 10k × 100pF]).
Pins 24 and 26 (IO2 and IO4) drive nominally 0-3.3V to 0-10V full scale.
the digital outputs. When low, they will The feedback resistor has been cho- Digital potentiometer
be below 0.3V, and when high, above sen to provide a little more than the The terminal voltages of digital pots are
2.7V. 220 series resistors limit the out- required three-times gain so that com- generally limited to the device’s digital
put current and, with zener clamping ponent variations can be readily cor- supply rails. The MCP45HV51 (IC2) is
diodes ZD3 and ZD4, provide a measure rected via calibration. a somewhat unusual high-voltage com-
of protection against misconnection. The 10k resistor and 100pF capac- ponent with an extended analogue-side
Op amp IC3a amplifies the out- itor form a low-pass filter to reduce the voltage range. Its ±15V analogue power
put from the DAC line (pin 9) that’s noise from the DAC. rails allow the pot terminal voltages to

Practical Electronics | April | 2024 27


be anywhere within that range. While locations are shown in Figs.3 and 4.
we chose the 100k model for our pro- Most of the components and the ESP32
totype, the MCP45HV series also has are on one side, with just the connectors
5k , 10k and 50k variants, any of and LEDs on the other side.
which may be substituted without any It’s best to fit the three SMD ICs first.
circuit changes. Locate their pin 1 indicators and line
Both the ADS1115 ADC and them up with the pin 1 indicators on
MCP45HV digital pot are controlled the PCB or Fig.3. Spread flux paste on
over an I2C serial bus by the ESP32. The pins on this dual-supply boost the IC pads, then tack one pin of the IC
Both devices have their additional converter (5V to ±15V) match to a corner pad.
address pins tied low. those on the PCB (MOD2). Other Check that the part is flat on the PCB
Two relays are provided, driven 5V to ±15V modules could be used and all the leads line up with the pads,
by NPN transistors Q1 and Q2, with but would need to be wired to the re-check the orientation of pin 1, then
diodes D2 and D3 to quench back-EMF PCB appropriately. tack a diagonally opposite pin. Solder
of the coils at switch-off. RLY1 is a the remaining pins with minimal sol-
350mA SPST reed relay with a 15mA in locating the holes, you can place der on the iron and clean up any bridges
coil, while RLY2 is a heavy-duty, 10A the blank PCB on the underside of the between pins with more flux paste and
model with SPDT contacts and a 5V Jiffy box lid with the component side some solder wick.
85mA coil. The indicator LEDs light showing. It should sit neatly inside the Once you’ve finished, clean off all
when a coil is energised. locating ridges. Mark and drill the four the flux residue and scrutinise the pins
Power comes from a 5V plugpack and mounting holes, then make the cut-out, under magnification to ensure all solder
a boost converter module (MOD2) that which should be 3mm outside the ter- joints have formed properly.
supplies ±15V. All three supply rails minal block outlines. Move on to the four SOT-23 devices
are brought out to a terminal block for While not necessary, it would be and solder them using a similar tech-
breadboard use. nice to countersink those four mount- nique. Note that there are two devices
ing holes and use countersunk screws, using this package, so don’t get them
Case preparation so they are flush with the lid. mixed up. Then solder the four zener
Start by marking out and cutting the diodes, ensuring their cathode stripes
holes in the lid as shown in Fig.2. There PCB assembly face as shown.
are just the four corner mounting holes Given the ongoing global supply short- Follow with the SMD capacitors and
to drill to 3mm, plus the rectangular cut- age of electronic components, some resistors; the resistors will be marked
out to make. You can do that by drilling substitution of the active components with codes indicating their values,
a series of holes just inside the rectan- may be required. Alternatives are noted but you’ll have to refer to the ceramic
gular outline, cutting between the holes in the circuit details above and in the capacitor packages to see their values
to remove the plastic inside and then parts list. (or measure them if unsure).
filing the edges smooth and to full size. The 142 × 83.5mm double-sided PCB Now flip the board over and sol-
We’re doing this before assem- is coded 04110221, available from the der the six SMD LEDs using a similar
bling the PCB because, to assist you PE PCB Service, and the component technique. Their cathodes are usually

9mm DIAMETER COAX POWER Fig.2: the Swiss Army Knife board can be used bare, or housed in a plastic UB1
JACK HOLE IN SIDE OF CASE,
10mm DOWN FROM TOP LIP Jiffy box. Just with four holes and one large rectangular cut-out need to be made
on the lid, plus one hole on the side for access to the DC power input socket.

14 LID OF UB1 BOX (VIEWED FROM TOP/OUTSIDE)


A 60 60 A

20 10
90 x 77mm CUTOUT FOR
ACCESS TO TERMINALS

37.5

C
L

37.5

A A

HOLES A ARE ALL 3.0mm IN DIAMETER C


L
ALL DIMENSIONS IN MILLIMETRES

28 Practical Electronics | April | 2024


marked, and they go opposite the + DevkitC come with narrower spacing. it on the lid using 2mm spacers (eg, two
markings in Fig.4 and on the PCB (+ You only need to populate the row that 1mm-thick washers stacked) to pro-
indicates the anodes, not cathodes). You matches your module. vide clearance for the component pins.
can check their polarity using a DMM Mount the terminals (CON2-CON12) Mark and drill the hole in the case for
set on diode test mode; they should light on the other side of the board. You’ll the coaxial power socket, as shown in
up with the red lead touching the anode probably want to orient them so that Fig.2, if you haven’t already.
and the black lead touching the cathode. the wire entries face the outside of the
With all the SMDs on the board, clean board, as that will be the most conve- Loading the software
off any remaining flux residue before nient way to use it. You should now program the ESP32
fitting the through-hole parts. We have separated from the PCB. As well as
specified header sockets for the ESP32 Final assembly programs being compiled and loaded
and the boost module so you can make The PCB mounts under the lid of a via an integrated development envi-
those items pluggable. While it might UB1 jiffy box with a hole cut in its top, ronment (IDE) such as the Arduino IDE,
be possible to solder them directly, we exposing the rectangular area shown in the ESP32 can load binary files using
don’t advise that as it will interfere with Fig.4. It is a tight fit; some trimming of an over-the-air (OTA) update program.
the testing and programming sequence. the PCB locating slots on the case’s side That has the convenience of being able
On the side with most of the compo- walls may be required. There is no need to update its firmware away from your
nents, fit the DC socket (CON1), ESP32 for a decal or cover plate as the critical computer.
(MOD1), boost module (MOD2) and information is silk-screened directly The first step is to load the OTA pro-
relays. When fitting the boost module, onto the PCB. gram, which also conducts validation
refer to Fig.3 and the photo above. There Clip or file off any pins protrud- of the PCB. Install the Arduino ESP32
is an extra row of pins for the ESP32 on ing more than 1.5mm from the silk- board files, following the instructions
the PCB, as some variants of the ESP32 screened side of the board, and mount at https://bit.ly/pe-apr24-esp1

Figs.3 and 4: fit


the components
to the board as
shown here, paying
particular attention
to the orientations
of the ICs, LEDs,
zener diodes, relay
RLY1 and the boost
module. Also, don’t
get the transistors
(Q1 and Q2) and
small signal diodes
(D1 and D2) mixed
up. The resistors
and capacitors are
not polarised; while
the resistors will
be marked with
coded values, the
capacitors won’t.

While the boost


module is shown
mounted vertically
here, using a
straight header,
you can mount it
horizontally as
shown in the photo
overleaf.

Practical Electronics | April | 2024 29


Next, install the ESP32 exception
decoder and file uploader plug-in
releases: https://bit.ly/pe-apr24-esp2
Select ‘ESP32 Dev Module’ as the
board in the Tools menu of the Ardu-
ino IDE and edit the OTA-Test.ino file
from the project download package to
include your Wi-Fi credentials – file
available from the April 2024 page of the
PE website: https://bit.ly/pe-downloads
Compile and run the program; the
Serial Monitor will display the IP
Address of the ESP32. You should get
an output similar to Screen 2 with the
Arduino Serial Monitor baud rate set
to 115,200. As expected, the program
has failed to find the ADC and digital
pot. If you miss the messages on the
Serial Monitor, simply push the boot
The underside of the PCB is where most of the components are mounted. This (EN) button on the ESP32 module, and
prototype differs from the final version, hence the added wires and components. it will restart.
Power down the ESP32 and plug
Parts List – Test Bench ‘Swiss Army Knife’ it into the PCB sockets with the USB
socket near the power input barrel
socket, leaving off the boost module for
1 double-sided PCB coded 04110221, 142mm × 83.5mm available from the
now. Re-connect its USB cable to the
PE PCB Service
computer. The two I2C devices should
1 UB1 Jiffy box [Altronics H0201 or H0151, Jaycar HB6011]
now show as available. All six LEDs
1 laser-cut UB1 Jiffy box lid (optional; 3mm acrylic) [Silicon Chip SC6337]
and the two relays should turn on and
1 5V 1A or 1.5A plugpack with 2.1mm inner diameter coaxial plug
off at two-second intervals.
[Altronics M8903A, Jaycar MP3144]
Now connect the boost converter
1 Espressif ESP32-DEVKITC-32D (MOD1)
(with power briefly removed) and
[Silicon Chip SC4447, Altronics Z6385A, Jaycar XC3800]
check the ±15V rails while still oper-
1 +5V to ±15V boost regulator module (MOD2) [Silicon Chip SC6587]
ating on USB power. The DAC output
1 micro-USB cable (to program MOD1)
should vary slowly between 0 and 10V
1 5V SIP reed relay (RLY1)
at the terminal block. The sinewave
[Pan Chang SIP-1A05, Littelfuse HE3621A0510, Teledyne SIP-1A05-D]
output should be a series of pulses
1 5V DC coil 10A SPDT relay (RLY2) [Altronics Z6325, Jaycar XC4419]
at the terminal block, as its buffer is
2 19-pin female 2.54mm headers (for MOD1)
AC-coupled, and we’re feeding it a
1 5-pin female 2.54mm header (for MOD2) (can be cut from longer header)
staircase signal.
1 2.1mm inner diameter PCB-mount DC barrel socket (CON1)
Connect the DAC signal to the
[Altronics P0620, Jaycar PS0519]
inverter input and check that the
7 2-pole, 5mm pitch ‘Euro’ type spring terminal blocks (CON2, CON4, CON5,
inverter’s output varies inversely with
CON10-CON12) [Altronics P2068, Jaycar HM3140,
its input voltage. You can fully test the
DECA MX722-500M or Eaton EM278502]
digital pot and ADC once the main
5 3-pole, 5mm pitch ‘Euro’ type spring- or cam-operated terminal blocks
program is loaded. For now, we have
(CON3, CON6-CON9) [Altronics P2070, Jaycar HM3142,
confirmed that they are responding to
DECA MX732-500M or Eaton EM278503]
I2C messages.
4 M3 × 12mm countersunk machine screws and hex nuts
In the Data folder that is associated
8 M3 x 1mm Nylon washers
with the OTA-Test program, edit the
Semiconductors profile.json file, find the section that
1 ADS1115IDGST or ADS1115IDGSR ADC, MSOP-10 (IC1) looks like the following and replace
1 MCP45HV51-x0xE/ST 8-bit I2C digital potentiometer, TSSOP-14 (IC2) the placeholder ‘ssid’ and ‘pass’ val-
(x0x = 502 [5k ], 103 [10k ], 503 [50k ] or 104 [100k ]) ues with those for your Wi-Fi network:
1 LM324D or MC33079 quad op amp, SOIC-14 (IC3)
[Altronics Y2523, Jaycar ZL3342] {
2 BC817 or BC846-BC850 SMD NPN transistors, SOT-23 (Q1, Q2) “ssid” : “your SSID”,
[Altronics Y1312, Jaycar ZT2118] “pass” : “WiFi password”,
6 SMD LEDs, M2012/0805 or gull-wing [Altronics Y1107, Jaycar ZD2000] “hostname” : “SwissArmy”
4 3.3V 1/2W+ zener diodes, DO-214AC or DO-213AA/SOD-80/MiniMELF }
(ZD1-ZD4) [eg, BZG05C3V3 or MLL5226B] Next, close the Serial Monitor win-
3 BAS16, BAV99 or similar signal diode, SOT-23 (D1-D3) [Altronics Y0089] dow. In the Arduino Tools menu,
Capacitors (all 50V SMD ceramic M2012/0805 size) click ‘ESP32 Sketch Data Upload’ to
4 1μF X7R 8 100nF X7R 2 270pF NP0 2 100pF NP0 copy the files in the Data folder to the
Resistors (all 1% SMD metal film, M2012/0805 size) ESP32’s local file system. The rest of
1 100k 5 91k 1 22k 1 15k 1 12k the files in this folder are needed for
15 10k 2 4.7k 1 2.7k 2 1.8k 2 1.5k the web interface. This uploaded file
4 1k 2 220 3 100 system will remain intact when new
programs are uploaded.

30 Practical Electronics | April | 2024


OTA loader and Swiss Army Knife basic tests.
Starting with WiFi with SSID = [MYSSID], password = [MYPASSWD]
.......
Connected to MYSSID
IP address: 192.168.1.XX
OTA loader at http://SwissArmy.local or the IP address above.
ADC NOT found at I2C address 0x48
Digital pot NOT found at I2C address 0x3C
Setup done. Now toggling relays and digital outputs, DAC staircases.

Screen 2: the expected output of the OTA-Test program on the serial monitor, Screen 3: the Over The Air (OTA)
before the ESP32 is plugged into the main PCB. login page displays when first
accessing the ESP32 via a browser.
Open up a web page using the IP Command?’ prompt. If you type Changing the Wi-Fi credentials
address or URL indicated by the Serial ‘*IDN?’ (without quotes) into the If you have difficulty connecting to
Monitor. On the OTA-Test program’s command field on the Serial Mon- your local Wi-Fi or need to change the
web interface, log in using ‘admin’ itor and click Send, the software settings, you can issue the following
and ‘admin’ as the credentials (see should respond with something like commands from a terminal program or
Screen 3). ‘Platy,SwissArmy,00,v0.1’. the Arduino Serial Monitor:
After you have logged in, select The unit can now be sealed up in
:SYST:SSID your-WiFi-SSID-
the downloaded project BIN file with the Jiffy box, powered via the plug-
without-quote-marks
the ‘Choose file’ button, and then pack and remotely controlled via the
:SYST:PASS your-WiFi-Password-
press the Update button. The web web interface.
without-quote-marks
page will track the upload progress, If you intend to use a USB con-
and after a short delay, the ESP32 nection from this point on, then we You can also change the Wi-Fi cre-
will reboot. strongly recommend that a USB iso- dentials by editing the profile.json
Re-open the Arduino Serial Mon- lator be used. This will help to avoid file on your computer and uploading
itor, and start-up commands should damage to the ESP32 in the event of it again, using the instructions above.
be displayed, ending with an ‘SCPI a misconnection. You only need to open the OTA-Test
Screen 4: the Swiss
Army Knife web
interface main page.
ADC1 and ADC2 are
reading 5.10V and
5.11V respectively,
while digital inputs
D1 and D2 are both
low. On the Settings
panel, relay RLY2 is
on, and digital output
D1 is high. The digital
pot is set at 128 steps
(50%). The sinewave
is currently being
adjusted (setting
highlighted) to 5.09V;
turning the dial will
result in 0.1V steps
(radio buttons under
the dial).
Screen 5: the
calibration page. If the
external multimeter
reads 9.61V, DAC1’s
output voltage
reading would need
to be boosted by 0.1V.
Changes are not stored
until the Save button is
clicked but calibration
values are saved
between sessions.

The source code and


other software files
are available from
GitHub at: https://bit.
ly/pe-apr24-sak

Practical Electronics | April | 2024 31


Screen 6: adding
the Swiss
Army Knife via
TestController’s
‘Load devices’
screen. The option
won’t be available
until you’ve
installed the
device definition
file and restarted
TestController.

program and re-upload the sketch data. and SCPI commands are available in Calibration
The OTA-Test program does not need to the manual included in the down- The analogue inputs and outputs can
be compiled or uploaded, but the unit load for this project available from be calibrated using a multimeter on the
will need to be re-calibrated after the the April 2024 page of the PE website: Cal tab. Connect the analogue output
profile upload. https://bit.ly/pe-downloads to both analogue inputs, set the DAC
The web interface can control all value to around 9.5V on the Main tab
Remote control and calibration the outputs and display all the input then move to the Cal tab.
The unit has been primarily designed to readings on its Main tab (Screen 4). It Measure the analogue input voltage
work with the open source software Test- also offers calibration functions on its with your multimeter and set the dif-
Controller: https://bit.ly/pe-apr24-test Cal tab (Screen 5). ference between the external multime-
or via its web interface. SCPI commands It’s best if only one of the remote ter’s reading and the analogue input in
can also be issued via an isolated USB control options is active at any time, as the ‘difference’ column for each input
serial connection or over Wi-Fi, using a settings made on one interface may not (positive if the multimeter reading is
terminal program (PuTTy or TeraTerm). seamlessly update on all the others. higher than shown). Once that is done,
TestController uses SCPI commands set the difference value for the DAC,
to control all functions besides calibra- Web interface then click the Save button.
tion and communication settings. Fur- The Main tab of the web interface is DAC calibration is somewhat less
ther details of the remote control modes accessible via http://swissarmy.local and accurate than for the ADCs, given that
has the input readings it only has 256 steps to cover the entire
on the left and settings 10V range.
on the right. You don’t need to calibrate all the
To set a numeric inputs and outputs at once as the
value, click on the calibration for any input or output,
setting to be changed where the difference value is zero,
and wind the knob. will remain unchanged when Save
The radio buttons is clicked.
under the knob deter-
mine the size of the TestController integration
increment, from 0.1 The TestController interface can con-
to 100 units. trol all functions other than calibra-
Under the sine- tion and communication parameters.
wave generator fre- The device definition file included in
quency setting there the downloads (SwissArmyKnife.txt)
are buttons to select needs to be loaded into the Devices
the low and high out- folder wherever you have installed
put ranges. TestController; the default location is
The digital pot has C:\TestController\Devices
two linked scales, Restart TestController and add the
one in counts (0 to device on the Load devices tab in
255) and the other TestController (Screen 6), using the
in percent of rota- address ‘swissarmy.local’ rather than
tion. Either may be its IP number, which could change
used, and the other if the unit hasn’t been used for some
will change synchro- time. Then click the Reconnect button.
Screen 7: the TestController Setup pop-up window shows nously. The relay and On the TestController command
the readings and allows most functions to be controlled. digital output buttons screen, click the Setup button, and the
Input values are updated every second. are on the far right. pop-up window in Screen 7 should

32 Practical Electronics | April | 2024


appear. The input values displayed at Conclusion
the top of the window will update once This is a relatively simple project, but Reproduced by arrangement with
a second, and you can set all output it can improve both the productivity SILICON CHIP magazine 2024.
values in the lower sections. and flexibility of your test bench. www.siliconchip.com.au

Using the Swiss Army Knife to test itself


The performance graphs in Screen 1 and
; ADC & DAC voltage tracking test
Screen 8 were created by connecting the ; create a control variable that can be logged
analogue output to an analogue input on =globalvar sVal=0
the unit, then using TestController to con- ; set initial value, let it settle and wait until value is logged
trol the analogue output. The values were =sVal=0.0
PlatyKnife::SOUR:A1 0.00
logged by TestController, along with volt- #delay 3
age measurements from a Bluetooth-con- ; don’t log commands and log values every 3 seconds
nected multimeter. #logcmds 0
TestController was used to create the #log 3
#hasLogged
charts. The results could also have been ; each iteration: update analogue output and wait for logging
exported to Excel for analysis. While I wrote #while (sVal<10.2)
a script (shown adjacent) to do this, TestCon- PlatyKnife::SOUR:A1 (sVal)
troller has a built-in step generator function #hasLogged
=sVal=(sVal+0.25)
that would have worked equally well.
#endwhile
I ran the script several times with differ- #hasLogged
ent parameters. The first iteration tested the #log 0
basic linearity of the device before calibra-
tion, using 0.25V steps to ramp the control A TestController script I used to test the Swiss Army Knife. After setting up
value (Math.sVal) from 0 to 10V. the initial values, the analogue output value is incremented by 0.25V until
The analogue input (blue) line in Screen the limit is reached. Each cycle waits for the log entry to be written before
updating to the next value.
8 is almost hidden behind the multimeter
results (red), indicating excellent linearity.
The analogue output (grey) had not been
calibrated before the test run and shows a
full-scale error of around 300mV.
The second test (Screen 1), using incre-
ments of 10mV, tested behaviour close to
0V and how the floating-point control value
mapped to the 256-step DAC output volt-
age. As the analogue output has a step size
of 40mV, the output voltage stays the same
for four 10mV control variable increments,
allowing time for each output level to be sam-
pled four times pre-step.
The ADC1 input has a negative offset
of -10mV. This was traced to a mismatch
between the divider resistors R2 and R4, as
5% 10k resistors were used in the proto- Screen 8: the tracking of the analogue input and output against the value
type. The second analogue input (dark grey measured on a B41T multimeter over the complete output range of 0-10V.
trace) shows almost no offset voltage and Note that while the analogue input and multimeter readings track well, the
tracks the multimeter reading accurately analogue output had not yet been calibrated and is low (Math.sVal is the
across the entire range. analogue output setting).
The code averages 16 samples per read-
ing to reduce the variation between read-
ings. The ADS1115 is capable of 860 sam-
ples per second. Over the two ADC chan-
nels, averaging sixteen samples gives 25
readings per second, more than fast enough
for our purposes.
To demonstrate how much this helps,
compare Screen 1 to Screen 9, which is the
same measurement without the averaging.
The analogue input measurement (blue
trace) also has some unevenness, repre-
senting a variation of a few counts between
ADC readings.
These scripts were run many times during
the project’s development, saving time and
avoiding transcription errors. Even at a mod- Screen 9: the performance at the low end of the analogue scale without input
est hourly rate, the time saved more than sample averaging. You can see the DAC steps of just over 40mV. The ADC’s
equalled the entire cost of the Swiss Army offset is around -1mV and tracks the multimeter well at low voltages. The 1 LSB
Knife’s components. jitter seen here is all but eliminated by the averaging done by the firmware.

Practical Electronics | April | 2024 33


Silicon Chirp
the pet cricket
BY JOHN CLARKE

This pet cricket will keep you company; it only needs to be fed occasionally
and won’t run away. Keep it for yourself or play a prank on a family member or
friend by hiding it in their room. When they switch the lights off, they will get a
bit of a surprise!

C
rickets, frogs and canaries When the novelty of cricket sounds its legs and mouth don’t even move
tend to be organic, made from wears off, it can be changed to a frog, while making those sounds! You
tried-and-tested construction croaking in the dark. Or, for some- could place a frog or bird toy near
materials such as DNA and proteins. thing completely different, change Silicon Chirp to make the ventrilo-
Until now, that is. Silicon Chirp, the sound to a singing canary to quism seem all the more real.
the electronic cricket, sounds like a brighten your day. For the cricket, most components
real cricket. Not only is this project Why call this critter Silicon Chirp? are mounted on Silicon Chirp’s back,
fun, it totally (and unexpectedly for The name comes from the fact that with its eyes being 3mm red LEDs.
a cricket) mimics frog and canary the workings to produce the cricket The piezo transducer that produces
sounds. With very few parts, it is sound are based upon silicon DNA. the sounds is slung under the PCB
easy and fun to build. Also, it produces a chirping sound. abdomen. Six legs are fashioned from
Silicon Chirp loves to sing in the Hence the name: Silicon Chirp. thick 1.25mm copper wire, while the
dark and happily chirps away, much As mentioned, Silicon Chirp can two antennae and ovipositor (tail)
to the annoyance of others. When produce the sound of a frog or canar- are made from a thinner gauge wire.
disturbed by light, (s)he ceases, thus ies and, of course, a cricket shape is
hiding its whereabouts until dark- inappropriate when making these Cricket sounds
ness falls again. But (s)he does not alternative sounds. We considered Crickets produce their iconic chirp-
immediately begin to chirp again having three separate PCBs with dif- ing sounds by rubbing a coarse sec-
when darkness falls. That could take ferent shapes, but swapping parts tion of one wing against a scraper
up to 40 seconds. from one board to the other seemed on the other. This process is called
And as you enjoy the peace and like overkill. ‘stridulation’; it’s a bit like running a
when all thoughts of an annoying Then again, the Bower Bird still stick along a picket fence or old-fash-
cricket drift away...chirping starts. looks like a bird, even when making ioned washboard.
And so begins the hunt for that pesky sounds like a chainsaw or a car alarm. Typically, the sound a cricket pro-
critter. Catching its glinting eyes in So, this cricket is a keen ventril- duces comprises three closely spaced
the dark, you are faced with a predic- oquist, mimicking the sounds of chirps, followed by a longer gap, then
ament: remain petrified and unable other animals while remaining in another three and so on (ie, they have
to move, or face that terrifying sight! the cricket shape. It’s so talented that a particular pattern or cadence).
A typical cricket chirp comprises
four bursts of a 4kHz tone, each last-
Features and Specifications ing for around 50ms. The spacing
] Looks and sounds like a cricket between each chirp is also about
] Also has the option to produce frog or canary sounds 50ms, while the separation between
] Flashing red eyes each triplet is around 250ms.
] Can be set to only operate in the dark (or light, in canary mode) These periods are not precise and
] Low current draw from 3V lithium coin cell do vary a little. However, the tone of
] Current draw: 0.4μA while dormant, 0.48-1.7mA during chirps the chirp does not appear to vary by
any noticeable degree.

34 Practical Electronics | April | 2024


Scope 1: cricket-like chirping is simulated by driving the Scope 2: a close-up of the drive to the piezo, showing how the
piezo with groups of three signal bursts spaced apart by 3V peak-to-peak square wave signals from the RA0 and RA1
around 20ms. These groups have much longer silent periods outputs (yellow and cyan traces) combine to produce a 6V
in between them. peak-to-peak square wave across the transducer (red trace).

Silicon Chirp follows the same between them. There is an extended Unlike crickets and frogs, which
pattern, with triplets of 4kHz bursts, gap between each series of repeated tend to make noise when it’s dark,
each separated by a longer gap. How- songs, between 80 seconds and nine bird sounds occur mainly when it is
ever, we found that driving a piezo minutes. Like the cricket and frog, light. So the light/dark detection is
transducer with three 20ms bursts at the bird songs are produced by vary- inverted for the canary.
4kHz and with 20ms gaps between ing the frequency, volume and length
them produced the most authentic of bursts of pulse trains applied to Circuit description
cricket sound, even though the 20ms the piezo. The complete Silicon Chirp cir-
periods are different from that of an The sound volume is varied by cuit is shown in Fig.1. It’s based
actual cricket. changing the pulse width of the sig- around microcontroller IC1, a
The screen grab in Scope 1 shows nals applied to the piezo transduc- PIC16F15214-I/SN, powered by a
the Silicon Chirp’s cadence as mea- ers. Narrow pulses generate a lower 3V lithium cell, switched via slide
sured by an oscilloscope. volume, while the wider pulses make switch S1. IC1 does not draw much
To act like a real cricket, the chirp more sound. The maximum (loud- current, typically only about 400nA
rate must vary slightly rather than est) pulse width equates to a duty while it is dormant. This rises to
being at precise intervals. So Sili- cycle of 50%. between around 480μA to 1.7mA
con Chirp’s chirping periods vary Each chirp starts at the mini- while making a noise.
randomly over a limited range. In mum pulse width, increasing to the Diode D1 is included as a safety
other words, they aren’t always required volume level over time. measure to prevent damage to IC1
exactly 20ms long or spaced apart Similarly, the pulse width is reduced should the cell be inserted incor-
by precisely 20ms. The variations in to zero over a short interval when a rectly. The correct polarity is with
the periods provide a more natural chirp or tweet is about to end. This the positive side up, but the cell
cadence and help prevent the sim- avoids clicks from the piezo trans-
ulated cricket chirp from sounding ducers, which would otherwise spoil
fake or artificial. the effect.
Frog sounds are produced simi-
larly but with a different cadence to The underside of Silicon
the cricket. For Silicon Chirp, frog Chirp, showing the large
sounds comprise a set of 10 chirps, piezo transducer. Feel free to
10ms long with 2ms gaps. customise the board to suit
This is followed by a 30ms gap and your taste. Note the on/off
then another set of three chirps. The slide switch near the ‘tail’.
ten and three groups are separated
by a delay of 200-1200ms that var-
ies irregularly. The frequency of the
chirps is set at around 2kHz.
The canary sounds have been
divided into three types, designated
A, B and C. Song A sounds like a typ-
ical canary, while Song B simulates
a Fife canary. Song C is a selection
that comprises various single phrases
produced by these birds.
The canary sings at random. Each
song is repeated between two and
27 times with a 2.4 to 17-second gap

Practical Electronics | April | 2024 35


holder will accept the cell in either In darkness, the LDR resistance Scope 2 is a close-up of the 4kHz
possible orientation. is high (above 5M ), so the voltage drive waveform fed to the piezo
With the positive side down, the at the RA4 input is more than 2.7V sounder. Channels 1 and 2 (yel-
cell will be shorted out by contact due to the voltage divider action of low and cyan traces) are the signals
with the sides and top spring con- the LDR and the 470k resistor. This applied at either end of the piezo
tacts. However, during insertion, voltage is detected as a high level by transducer, while the red trace shows
there could be a brief period when IC1. With sufficient light, the LDR the total. So, while each end of the
there is no contact with the cell resistance drops below 10k , so the piezo is driven by a 3.28V peak-to-
holder sides, so the circuit could voltage divider produces a low level peak waveform, there is double that
be supplied with a reversed voltage of 63mV or less at the RA4 input. voltage produced across the piezo.
polarity that could damage IC1. The thresholds for the RA4 input A 100 resistor limits the peak
Diode D1 clamps any reverse are 20% of the supply voltage for low current into the transducer’s capac-
voltage to a low level. The cell will and 80% of the supply for high. It is itive load immediately after the out-
lose some capacity if left connected a Schmitt-trigger input, so once it puts switch.
in reverse for more than a few sec- exceeds the high threshold, the volt- LED1 and LED2 are driven via the
onds, but that’s better than damag- age must drop below 20% of the sup- RA2 (pin 5) and RA5 digital outputs
ing the IC. ply to switch to low. Similarly, once with 330 current-limiting resistors.
IC1’s power supply is bypassed detecting a low, the voltage must go These LEDs are driven alternately on
with a 100nF capacitor and runs using above 80% of the supply before a and off while the piezo transducer is
its internal 4MHz oscillator. When high level is indicated. driven. When RA5 is low and RA2
dormant, this oscillator is shut down That ensures there is no rapid high, LED1 is lit, while when RA5
(ie, in ‘sleep mode’) to save power. switching between high/low state is high and RA2 is low, LED2 lights.
A ‘watchdog’ timer starts running to detection when the voltage is Note that RA5 is also used to drive
wake IC1 periodically (at approxi- between these thresholds. the LDR (LDR1) to monitor the ambi-
mately four-second intervals). During ent light level. When driving RA5
this period, the current consumption Driving the piezo transducer low for light measurement, RA2 is
is typically less than 1µA. IC1’s RA0 and RA1 digital output also set low, so the LEDs are off.
During the waking period, IC1 pins (pins 7 and 6) drive the piezo Similarly, when the LDR is off (RA5
checks the ambient light level on transducer that produces the chirps. high), RA2 is also brought high to
the light-dependent resistor, LDR1. The piezo is driven in bridge mode, keep the LEDs off.
Most of the time, the RA5 output (pin connected across these two outputs, Pushbutton switch S2 changes the
2) of IC1 is set high (3V), so there is which increases the AC voltage to sound produced from cricket to frog
no current flow through the 470k produce a louder sound. or canary. IC1 detects when S2 is
resistor and the LDR to minimise the When RA0 is driven high, the RA1 closed by monitoring digital input
current drain. output is taken low; when the RA0 RA3 (pin 4). When S2 is pressed,
When IC1 is awake, it sets the RA5 output is low, RA1 is high. In one the voltage at that pin goes to 0V.
output low (0V) and the LDR forms condition, there is +3V across the When the switch is open, the internal
a voltage divider with the 470k piezo transducer and in the other, pull-up at RA3 keeps that input level
resistor across the 3V supply. The -3V, producing a 6V peak-to-peak high. The S2 switch closure is only
RA4 digital input (pin 3) monitors square wave. This is shown in the checked during power-up; changing
the voltage across LDR1. Scope 2 screen grab. the sound can only be done then.

‘Silicon Chirp’ Cricket


Fig.1: Silicon Chirp is controlled by 8-bit PIC16 microcontroller IC1. Slide switch S1 applies power from the coin cell. It
then uses LDR1 to sense the light level and, depending on what it finds, produces sounds by driving the piezo transducer
from its pin 6 and 7 digital outputs while flashing the eye LEDs via the pin 2 and pin 5 digital outputs.

36 Practical Electronics | April | 2024


Construction The 100nF capacitor is fitted next, place this on top if you prefer. The on
Silicon Chirp is built on a double- and since it is an unpolarised part it position for the switch is when the
sided, plated-through PCB coded can be positioned either way round. slider is toward the front of the cricket.
08101231 that measures 94 × 30.5mm We installed slide power switch S1 You can also mount pushbutton switch
available form the PE PCB Service. on the PCB’s underside. You could S2 now by soldering its four pins.
Wire legs are soldered to this PCB
so it ‘stands up’ like a real cricket.
These wires and the other parts are Parts List – Silicon Chirp Cricket
shown in Fig.2 and Fig.3.
1 double-sided, plated-through PCB coded 08101231, 94 × 30.5mm
CON1 is the in-circuit serial pro-
available fro the PE PCB Service
gramming (ICSP) header, which is
1 CR2032 surface-mounting coin cell holder (CELL1) [BAT-HLD-001]
needed to program a blank micro.
1 CR2032 3V lithium cell
Screen printing for this is on the
1 SPDT micro slide switch (S1) [Jaycar SS0834]
underside of the board (for aesthetic
1 SPST surface-mounting tactile pushbutton switch (S2)
reasons); however, it needs to be
[Altronics S1112A, Jaycar SP0610]
installed from the top since only the
1 30mm diameter 4kHz wired piezo transducer (PIEZO1)
underside of the PCB has exposed
[Altronics S6140, Jaycar AB3442]
pads for soldering. The top layer pads
1 45k-140k light dependent resistor (LDR1)
are masked, also for aesthetic rea-
[Altronics Z1619, Jaycar RD3480]
sons. Ideally, you should remove the
3 M3 × 10mm panhead machine screws (metal or plastic)
ICSP connector after programming,
1 M3 × 6.3mm tapped Nylon spacer (or two M3 hex nuts)
as real crickets do not tend to have
2 Nylon or polycarbonate M3 hex nuts
a programming connector.
2 TO-220 insulating bushes (eg, from TO-220 insulating kits)
Begin by installing the surface-
[Altronics H7110, Jaycar HP1142]
mounting microcontroller, IC1. You
1 6-way header with 2.54mm pitch (CON1; optional, for programming IC1)
will need a soldering iron with a fine
1 200mm length of 1.25mm diameter enamelled copper wire (for legs)
tip, a magnifier and good lighting.
1 100mm length of 1mm diameter enamelled copper wire
The use of flux paste during soldering
(for antennae and ovipositor)
is advised, in which case you don’t
necessarily need a very fine solder- Semiconductors
ing iron tip. 1 PIC16F15214-I/SN 8-bit microcontroller programmed
Solder IC1 to its PCB pads by first with 01810123A.hex, SOIC-8 (IC1)
placing it with the pin 1 locating 2 3mm red LEDs (LED1, LED2)
dot to the top left, positioning the IC 1 LL4148, MM4148 or 1N4148WS (or 1N4148; see text) SMD diode,
leads over their corresponding PCB Mini-MELF (SOD-80) or SOD-323 [Altronics Y0161/Y0164A]
pads. Then tack-solder a corner pin Capacitors
and check that the IC is still aligned 1 100nF 50V X7R SMD M3216/1206 size
correctly. If you find that it needs Resistors (all M3216/1206 size 1%)
to be realigned, remelt the soldered 1 470k 1 330
connection and gently nudge the IC 1 100
into correct alignment.
Once alignment is correct, solder
all the IC pins and refresh that initial
joint. Any solder that runs between TOP VIEW
the IC pins can be removed with sol- WITH LEGS, TAIL
AND ANTENNAE
der paste and the application of sol-
100W CON1
der-wicking braid. CELL LED1
S2
CR–3032

PIC16F15214

Continue construction by install- CAPTURE K

+
CELL1

LDR1

ing the resistors. They are printed IC1

with a code indicating their values, SCREW &


STANDOFF LED2
A

which is likely to be ‘1000’ or ‘101’ 100nF


for 100 , ‘3300’ or ‘331’ for 330 and
‘4703’ or ‘474’ for 470k . These are
in ‘scientific notation’ where the last
digit indicates the number of zeros
to add to the first few digits to give
a value in ohms. BOTTOM VIEW
(JUST THE PCB)
Diode D1 can be installed next.
Remember that it is polarised, so PIEZO1
take care to orient it correctly, with S1
470kW

the cathode stripe facing away from


the centre of the PCB. There is suffi-
PIEZO1

D1 330W
cient pad area to allow Mini-MELF
(SOD-80) or SOD-323 package diodes
to be soldered in. Alternatively, an
axial-leaded 1N4148 could be used Fig.2 and Fig.3: Silicon Chirp is pretty easy to build. Simply place the components
with the leads at each end bent back as shown here but note that the piezo transducer is wired and mounted over reverse
by 180° to allow soldering to the polarity protection diode D1. That diode, IC1 and the LEDs are polarised and must
PCB pads. be soldered the right way around; the other components are not polarised.

Practical Electronics | April | 2024 37


so that the piezo transducer can be
Silicon Chirp should look similar to this
when yours is finished, but feel free to swung out of the way.
customise it to suit your taste. Note that Solder the piezo wires to the
the CR2302 cell is secured using one underside of the PCB at the positions
screw as a preventative measure marked ‘PIEZO1’. You could instead
against tampering, so children bring them to the top of the PCB and
can’t get a hold of the solder them through the correspond-
cell by itself. ing top holes, although that will look
a bit messy. The wires will need to be
shortened, but leave sufficient length
for the piezo to swing out of the way
to access the cell capture screw.
The piezo transducer wires will
probably be red and black, although
the transducer is not a polarised
component. It does not matter which
colour wire goes to the two piezo
PCB pads.

Legs and antennae


The legs can be fashioned from
1.25mm-diameter enamelled copper
The cell holder (CELL1) is a half- wire. Each front leg is 40mm long,
shell type and its body makes contact while the mid and rear legs are each
with the positive side of the cell. A each LED (the anode) is inserted in 30mm. These can be as simple or as
tinned copper area on the PCB com- the ‘A’ position on the PCB. fancy as you like. The cricket shape
pletes the cell holder and provides Mount the LDR about 5mm above printed at the rear of the PCB shows
for the negative connection to the the PCB surface, with its face sitting the general leg shape we used, as do
cell. It must be fitted with the cell horizontally. This component is not Fig.2 and the photos.
entry toward the rear of the cricket so polarised and can be installed either Bend the legs so that Silicon
that the cell capture screw prevents way around. Chirp’s PCB is above the platform
small children from removing it. The piezo transducer is mounted it sits on. Form the feet into small
This is to comply with my local on the underside of the PCB, sup- loops so that the sharp ends of the
safety standards (Australian Stan- ported on TO-220 insulating bushes wires are not exposed.
dard AS/NZS ISO 8124.1:2002), that are used as spacers to raise the Where the legs are soldered to the
where toys for children three years transducer from the PCB. This leaves PCB, you will need to scrape off the
and younger must have any batter- room for the cell capture screw enamel insulation (eg, using a sharp
ies (and/or cells) secured in a com- and diode to fit between the PCB hobby knife or fine sandpaper) before
partment by a screw. Alternatively, and piezo. The piezo transducer is you can solder them.
where there is no compartment screw secured with two 10mm M3 machine Make up the two antennae using
used, there must be two simultane- screws and two Nylon or polycar- 40mm lengths of 1mm-diameter
ous independent movements to open bonate nuts. enamelled copper wire and the ovi-
the battery compartment. You will need to drill out the positor (tail) with a 20mm length of
While Silicon Chirp is not really mounting holes on the piezo unit to a the same. Once in place, curl the two
a project for small children, it could 3mm diameter to suit the M3 screws. antenna wires into shape by running
be used in a household with children The nuts will not fit in the room pro- a thumbnail along the inside of the
who could potentially swallow but- vided on the piezo transducer mount- radius, with your index finger on
ton or coin cells, which poses a seri- ing lugs, so the screws need to enter the outside.
ous hazard (see the warning panel from the piezo transducer side. The Now install the CR2032 cell in its
for details). insulating bushes can then be slipped holder and switch on power with S1.
For our project, cell removal is onto the screw shafts, followed by the If all is well, the LEDs will momen-
blocked by a 10mm M3 machine piezo transducer, then the Nylon or tarily flash after about three seconds
screw inserted from the PCB’s polycarbonate nuts. to acknowledge that power has been
underside and secured on top with We use plastic nuts because a connected to the circuit.
an M3-tapped Nylon spacer. When metal nut will short out the cell if An acknowledgement by a brief
tightened, the spacer cannot be used at the end of the cell nearest to flashing of the LEDs also occurs when
removed by hand and stops the cell IC1. That’s because the PCB hole and a low light level is detected for the
from being removed. An alternative surrounding track are connected to cricket and frog, or when a high light
to the standoff is to use two M3 nuts, ground, while the metal of the cell level is detected for the canary. Low
with the top one used as a lock nut, holder connects to the cell positive. light can be simulated by covering
tightened against the other. To avoid any potential confusion and over the LDR, or a higher light level
Mount LED1 and LED2 so that the prevent the wrong type of nut from by shining light onto the LDR.
top of the dome of each LED is raised being placed at each point, we have Silicon Chirp will begin chirping
off the PCB by about 10mm. This pro- specified both piezo-securing nuts after a delay of about 10 seconds, pro-
vides enough lead length so they can as plastic. viding the low light level remains for
be bent to about 30° above the PCB Note that to remove the cell cap- the whole time.
plane and outward about 10° from the ture screw when the cell needs to be To program the PIC, you can down-
centre line, as shown in Fig.2 and the replaced, one of these piezo mount- load the firmware (01810123A.hex)
photos. Make sure the longer lead of ing screws will need to be removed from the April 2024 page of the PE

38 Practical Electronics | April | 2024


website: https://bit.ly/pe-downloads
Additionally, as mentioned previ-
ously, ICSP (in-circuit serial pro-
Warning: small cell
gramming) header CON1 will need to This design uses a small lithium cell that can cause severe problems if
be installed. One of the piezo trans- swallowed, including burns and possible perforation of the oesophagus,
ducer leads may need to be discon- stomach or intestines. Young children are most at risk. Read the
nected, or one end of the 100 resis- information sheet at www.schn.health.nsw.gov.au/fact-sheets/button-
tor, to allow programming. batteries on the dangers of button cells.
Ensure that the cell is kept secure using the cell capture screw and
Changing the sound Nylon spacer as specified, tightened sufficiently so they cannot be undone
Changing from cricket to frog to by hand. Keep unused cells in a safe place away from children, such as a
canary and back is performed by locked medicine cupboard. New cells should be kept within the original
holding switch S2 while switching secure packaging until use.
power on via S1. Continue to hold S2 Unfortunately, some older button-cell-powered devices not intended for
until you see the eyes flashing. They children under three provide easy access to the cells. Keep these away
will flash once for the cricket, twice from children or devise a method to make cell access more difficult (eg, by
for the frog and three times for the gluing the compartment shut).
canary. To change to the next selec-
tion, continue holding S2 for two
seconds until the eyes flash to show is detected, so they won’t necessarily The light sensitivity can also be
the next selection. stop as soon as the light goes away. altered by changing the 470k resis-
When you see the selection you tor value between the positive supply
want, release S2. The selected sound odifi ations and the PIC’s RA4 input. Increasing
is stored in flash memory, so that Silicon Chirp has a loud chirp, which the resistance value (say to 1M )
selection remains even if powered off can be pretty annoying! (But maybe will make the light threshold level
and on again. It only changes when you want that...) To reduce the vol- darker. By contrast, reducing the
S2 is pressed during power-up. ume, increase the value of the 100 resistance value will mean more light
Note that the frog sounds are best resistor in series with the piezo trans- is required to detect daytime.
expressed with the piezo transducer ducer. Increasing it to, say, 10k will
close to a flat surface to empha- reduce the apparent volume by about
sise lower frequencies. The canary 50%. Higher values will provide Reproduced by arrangement with
sounds run through a repertoire an even lower volume, to the point SILICON CHIP magazine 2024.
before switching off when darkness where it won’t chirp at all. www.siliconchip.com.au

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.
www.epemag.com

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 Cover.indd 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: www.electronpublishing.com

Practical Electronics | April | 2024 39


Teach-In 2024
Learn electronics with
the ESP32 by Mike Tooley
Part 2 – Digital input and output

I
n last month’s Part 1 of our Teach-In series we
provided an overview of the ESP32 and introduced the About Teach-In
development environment. We showed you how to use Our latest Teach-In series is about using the popular ESP32
your PC to monitor the ESP32’s built-in capacitive touch sen- module as a basis for learning electronics and coding. We
sors and our practical project involved using the ESP32 in a will be making no assumptions about your coding ability
or your previous experience of electronics. If you know one
portable emergency beacon. This month, we will be taking
but not the other, you have come to the right place. On
a more detailed look at digital I/O and showing you how to the other hand, if you happen to be a complete newbie
interface buttons and switches as well as how to drive loads there’s no need to worry because the series will take a
such as LEDs, relays and sounders. We will also introduce progressive hands-on approach. There will be plenty of
the Serial Monitor. As part of the Arduino IDE, this handy time to build up your knowledge and plenty of opportunity
tool provides a great way of testing your code. The learning to test things out along the way.
objectives for this part are: We’ve not included too much basic theory because this
n Know how to use the Serial Monitor can be easily found elsewhere, including several of our
n Know how to configure and use simple digital I/O previous Teach-In series, see:
n Know how to increase the output capability of the ESP32. https://bit.ly/pe-ti
https://bit.ly/pe-ti-bundle
Using the Serial Monitor There will be projects and challenges to help you check
When testing even the most basic code you will often find that and develop your understanding of the topics covered
you need some means of knowing what’s going on. Without each month.
having the benefit of a full user interface (such as a local keypad
and display) this can be tricky, but the Arduino IDE can come
to your rescue with its in-built Serial Monitor. However, before To send a message to the Serial Monitor you can use the Serial.
you can begin to use this useful tool you will need to initialise print and Serial.println() functions. The only difference
the Serial Monitor within your setup() code like this: between these functions is that the latter adds a newline character
at the end of the printed string. Here’s an example:
void setup() {
Serial.begin(9600); // Initialize the Serial Serial.print(“Pin selected = “);
Monitor
}

You probably noticed the parameter that we’ve used in the


Serial.begin() function. This sets the speed or data
rate in bits per second (baud) that will be used for serial
communication. It is typically set to either 9600 or 115200, but
other baud rates can be selected if required. An optional second
argument configures the data, parity and stop bits. The default
is eight data bits, no parity and one stop bit. This should work
fine with the Arduino IDE and many other applications, but
you may need to change it for different external hardware. For
example, the following code sets the serial UART to 9600 bits
per second with eight data bits, even parity and two stop bits:

void setup() {
Serial.begin(9600, SERIAL_8E2); // Initialize
the Serial Monitor
} Fig.2.1. Code for testing the ESP32’s built-in Hall effect sensor.

40 Practical Electronics | April | 2024


the variable selectedPin and then move
to the next line we would use:

Serial.println(selectedPin);

Listings 2.1 and 2.2 show how the serial


monitor can be used both to receive data
from, and send data to, the ESP32. The
first example (Listing 2.1) makes use of
the ESP32’s built-in Hall effect magnetic
sensor. Note that having entered or
downloaded the code (Fig.2.1) you will
need to enable the serial monitor from the
Tools menu, as shown in Fig.2.2 and select
the baud rate, as shown in Fig.2.3. When
the code is executed, you will be rewarded
with a list of returned data values, updated
every 500ms (see Fig.2.4). The data will
vary, although residual values of magnetic
field should all be fairly low, but the Hall
effect sensor can be tested by placing a
small magnet close to the upper surface of
the ESP32 module, as shown in Fig.2.5. As
the permanent magnet is moved towards
the ESP32 there will be a marked increase
in detected field strength accompanied by
Fig.2.2. Enabling the Serial Monitor from the IDE’s Tools menu. a change in polarity if the direction of the
This will print the character string enclosed in the quotes and field is reversed, as also shown in Fig.2.5.
the next item to be printed will appear immediately after the The second example (Listing 2.2) shows how individual
trailing space. So, if we wanted to add a pin number stored in characters can be sent from the PC via the serial link. The data

Fig.2.5. Using a small magnet to test the Hall effect magnetic


sensor. Reversing the field, as shown in (a) and (b) will result in a
reversal of the polarity of the returned data.
Fig.2.3. Setting the Serial Monitor’s baud rate.

Listing 2.1 Using the serial monitor to display data from


the ESP32’s in-built magnetic Hall effect sensor

/* Using the serial monitor to display data received from


ESP32’s in-built Hall effect magnetic field sensor */

int magField = 0; // Initialise data from sensor

void setup() {
Serial.begin(115200); // Initialise serial monitor
}

void loop() {
// The main loop repeats forever
magField = hallRead(); // Update sensor data
Serial.println(magField); // Display using
serial monitor
delay(500); // Short delay between readings
}
Fig.2.4. Returned data from ESP32’s built-in Hall effect
magnetic sensor.

Practical Electronics | April | 2024 41


Gotcha! Listing 2.2 Using the serial monitor to control the ESP32’s in-built LED
During compilation you may receive
an error message informing you that /* Using the serial monitor to toggle the ESP32’s in-built LED
‘hallRead was not declared in this on GPIO2 using the ‘x’ keys on the keyboard */
scope’. If that’s the case, it is worth
checking the currently installed int ledPort = 2; // GPIO2 is connected to the LED
version of the Espressif System boolean LEDstatus = HIGH;
esp32 board library. The failure to
compile seems to arise in the current void setup() {
‘3.0.0 alpha’ version. To put things pinMode(ledPort, OUTPUT); // Initialise the LED
right you can use the IDE’s Library Serial.begin(115200); // Initialise the serial monitor
Manager (see Part 1 last month) to }
remove the current version before
installing a previous version (we void loop() {
used version 2.0.11 without this char ch = Serial.read(); // Check for a character
problem occurring). // Check for a valid keyboard entry
if ((ch == ‘X’) || (ch == ‘x’)) {
digitalWrite(ledPort, LEDstatus); // Set on or off
to be sent (a single character followed LEDstatus = !LEDstatus; // Toggle the status
by New Line) is entered into the Serial }
Monitor’s message field, as shown in delay(100); // Short delay
Fig.2.6. The code will allow you to toggle }
the ESP32’s in-built LED (on GPIO2) ‘on’
and ‘off’ using a lower or upper case ‘X’
entered from the keyboard. should always be less than 10mA (equivalent to a load of no
less than about 330Ω). An output device (or ‘load’) can be
Configuring GPIO digital outputs connected so that it can be activated by either a HIGH state
The output state from a GPIO line can be HIGH (approx. 3.3V) output or by a LOW output condition (see Fig.2.7).
or LOW (close to 0V). The GPIO pins can source current when A current-limiting series resistor is required when driving an
in the HIGH state or sink current when in the LOW state. In LED. The value of LED series resistor should normally be within
both cases (and to keep well within the maximum ratings for the range 220Ω to 470Ω. For most of our examples we have used
the ESP32) we recommend the current that’s sourced or sunk 330Ω, which results in a typical LED current of around 4mA. If more
brightness is required, the value of series resistor can be reduced to
220Ω. This brings us once again to the important question of just
how much current we can safely extract (source or sink) from an

Fig.2.8. Circuit of the ESP32 traffic lights controller.

Fig.2.6. Entering character data into the Serial Monitor’s


message field.

Fig.2.7. Output loads activated by (a) HIGH and (b) LOW output
states. Fig.2.9. Wiring layout for the ESP32 traffic lights controller.

42 Practical Electronics | April | 2024


ESP32’s GPIO pins. Although the Espressif
Listing 2.3 Code for the ESP32 two- digitalWrite(Amber1, LOW);
datasheet states a maximum output drive
way traffic light controller digitalWrite(Green1, LOW);
current of 12mA, we recommend limiting digitalWrite(Red2, LOW);
the load current on any individual GPIO /* ESP32 traffic lights. Outputs digitalWrite(Amber2, LOW);
line to no more than 10mA, while at the red, amber and digitalWrite(Green2, HIGH);
same time ensuring that the total load on the green control signals for a 2-way delay(5 * delaytime);
ESP32’s digital outputs is less than 100mA. road junction // State 3
This should give plenty of scope for most */ digitalWrite(Red1, HIGH);
applications, but where additional current digitalWrite(Amber1, LOW);
drive is required an external transistor can // Define GPIO pins digitalWrite(Green1, LOW);
be used, as described later in our Practical const int Red1 = 12; digitalWrite(Red2, LOW);
const int Amber1 = 13; digitalWrite(Amber2, HIGH);
Project.
const int Green1 = 14; digitalWrite(Green2, LOW);
const int Red2 = 18; delay(delaytime);
Check it out! const int Amber2 = 19; // State 4
Our Check it out! feature involves building const int Green2 = 21; digitalWrite(Red1, HIGH);
a simple two-way traffic lights controller const int delaytime = 1000; digitalWrite(Amber1, LOW);
shown in Fig.2.8. Each of the two traffic digitalWrite(Green1, LOW);
lights (Light 1 and Light 2) will comprise void setup() { digitalWrite(Red2, HIGH);
a set of three LEDs: red, amber and green. // All pins configured as outputs digitalWrite(Amber2, LOW);
Rather than use individual LEDs (together pinMode(Red1, OUTPUT); digitalWrite(Green2, LOW);
with series resistors) we’ve taken the easy pinMode(Amber1, OUTPUT); delay(delaytime);
pinMode(Green1, OUTPUT); // State 5
option and used a ready-built mini traffic
pinMode(Red2, OUTPUT); digitalWrite(Red1, HIGH);
lights module fitted with red, amber and pinMode(Amber2, OUTPUT); digitalWrite(Amber1, HIGH);
green LEDs, together with series 330Ω pinMode(Green2, OUTPUT); digitalWrite(Green1, LOW);
resistors. The module is available from } digitalWrite(Red2, HIGH);
several online suppliers, and it uses a digitalWrite(Amber2, LOW);
common ground (GND) connection so void loop() { digitalWrite(Green2, LOW);
that the individual LEDs will become // State 0 delay(delaytime);
illuminated when their associated input digitalWrite(Red1, HIGH); // State 6
pins are taken HIGH. (Just search for ‘5V digitalWrite(Amber1, LOW); digitalWrite(Red1, LOW);
Mini Traffic Light LED Display’; eBay and digitalWrite(Green1, LOW); digitalWrite(Amber1, LOW);
digitalWrite(Red2, HIGH); digitalWrite(Green1, HIGH);
others offer plenty of choice.)
digitalWrite(Amber2, LOW); digitalWrite(Red2, HIGH);
The wiring layout for the ESP32 digitalWrite(Green2, LOW); digitalWrite(Amber2, LOW);
traffic lights controller is shown in delay(delaytime); digitalWrite(Green2, LOW);
Fig.2.9. The code shown in Listing 2.3 // State 1 delay(5 * delaytime);
should be entered or downloaded from digitalWrite(Red1, HIGH); // State 7
the April 2024 page of the PE website: digitalWrite(Amber1, LOW); digitalWrite(Red1, LOW);
https://bit.ly/pe-downloads digitalWrite(Green1, LOW); digitalWrite(Amber1, HIGH);
When the code is executed the two digitalWrite(Red2, HIGH); digitalWrite(Green1, LOW);
traffic lights should follow the sequence digitalWrite(Amber2, HIGH); digitalWrite(Red2, HIGH);
shown in the state table (Fig.2.10). digitalWrite(Green2, LOW); digitalWrite(Amber2, LOW);
delay(delaytime); digitalWrite(Green2, LOW);
Notice how States 2 and 6 are each to
// State 2 delay(delaytime);
be displayed for five seconds while the digitalWrite(Red1, HIGH); }
remaining states are displayed for 1
second. These display times are achieved
by introducing delays of appropriate length in the code. Note applications include sensing the state of buttons and switches
that it is only necessary to modify one line of code to change as well as a host of sensors with digital outputs, such as float
the timing of the lights. The code is very straightforward and switches, pressure switches, touch switches, microswitches,
should need no further explanation. proximity switches and magnetic reed switches. These devices
can all make use of a straightforward connection to a GPIO
Configuring digital inputs
There are numerous applications in which you might need to
make use of one or more of the ESP32’s digital inputs. Such

Fig.2.11. A selection of commonly available buttons and


Fig.2.10. Sequence table for the traffic lights controller. switches ideal for use with the ESP32.

Practical Electronics | April | 2024 43


Gotcha!
GPIO pins 34, 35, 36 and 39 are only available for digital
input and do not have internal pull-up and pull-down
resistors. So, if you need to use these pins for digital inputs,
remember to fit external pull-up or pull-down resistors.

input pin. A selection of commonly available buttons and


switches is shown in Fig.2.11.

Pull-up or pull-down?
We need our digital inputs to be in one of two states, either HIGH
or LOW with nothing in between. The former is usually defined
as a voltage level that’s greater than 75% of the nominal 3.3V
supply, while the latter is taken as less than 25% of the same
value (these two states correspond to more than 2.5V or less
than 0.8V, respectively). Note that, by default, the GPIO inputs
adopt a high-impedance state, and this invariably results in an
unpredictable and indeterminate input Because of this you will
often find that the GPIO pins are either pulled HIGH (pulled up)
or pulled LOW (pulled down) by means of external resistors.
Values are generally uncritical and can often be in the range
4.7kΩ to 100kΩ. Fig.2.12 illustrates the use of this technique.
Fig.2.14. Waveform showing switch bounce.
Gotcha! It’s important to be aware that the ESP32 has a rather neat
A problem arises with some types of mechanically
feature that allows inputs to be pulled HIGH or LOW without
actuated switch in which the switching action is not
clean, and the output state fluctuates rapidly before the need for external resistors. This can be achieved during
settling to a steady value. This condition is referred to as GPIO initialisation using the pinMode() command, as shown
‘switch bounce’ (see Fig.2.14) and it can be undesirable in the following fragment of code:
in many applications. The effects of switch bounce can
be reduced or eliminated by various means including pinMode(18, INPUT); D18 is a default digital input
the introduction of software delays or by slowing the pinMode(19, INPUT_PULLUP); D19 is a digital input
switching action using a simple capacitor-resistor (C-R) pulled high
network between the switch contacts and a GPIO input pinMode(21, INPUT_PULLDOWN); D21 is a digital
pin, as shown in Fig.2.15. input pulled low

The effect of INPUT_PULLDOWN and INPUT_PULLUP is


illustrated in Fig.2.13. Note that the ESP32’s internal pull-up/
pull-down resistors have a nominal value of 45kΩ.

Practical project (Part 1)


Our Practical Project involves the design, construction and
coding for a simple motor controller. The minimal circuit and
wiring layout for our prototype motor controller are shown
in Fig.2.16 to Fig.2.18 (the pin connections for the LED were
shown in Fig.1.21 last month). We’ve used 4.7kΩ external
pull-down resistors in conjunction with the RUN and STOP
switches and a 330Ω series resistor for the LED (later, we will
be replacing this with a small motor and driver).
Having connected the circuit, made the USB connection
to your PC and started the IDE, you can enter (or download)
Fig.2.12. External pull-up and pull-down resistors. the code shown in Listing 2.4. When you execute the code,
you should see that the LED becomes illuminated when
the RUN button is pressed. The LED should then remain
illuminated until the STOP button is operated. A subsequent
press of the RUN button
should restart the LED.
Now let’s walk through
the code.
The first few lines of
code define the constants
used to allocate the
GPIO pin numbers to
the two buttons and
LED. Next, we define
the variables that will
represent the states of Fig.2.15. Using a C-R network to
Fig.2.13. Equivalent internal pull-up and pull-down resistors. the two buttons and the reduce the effects of switch bounce.

44 Practical Electronics | April | 2024


button states we decide what to do depending upon
the current state of each button. If the RUN button
has been operated, we activate the LED but if the
STOP button has been operated, we turn the LED
off. Later, in Coding workshop we will take a close
look at how these decisions are made.
Having verified that the prototype works we can
add a small motor to be controlled by the RUN
and STOP buttons. Bearing in mind the current
limitation mentioned earlier we will need to add
some extra circuitry to supply the greater current
required. We will return to this in Part 2 a little
later, but first it’s worth considering how to drive
loads that demand more current or voltage than the
Fig.2.16. Circuit for the prototype motor controller. ESP32 can provide.

Driving high-current/high-voltage loads


The ESP32’s current drive capability is sufficient for a lot of
purposes (including illuminating an LED) but not enough to operate
actuators, motors, lamps and many other ‘real-world’ output
devices. Fortunately, the problem of driving the vast majority of
high-voltage and high-current loads can be easily solved using
one or more miniature relays. These electromechanical devices
comprise a coil wound on a high-permeability core and a moving
armature mechanically linked to a set of contacts that make and
break when the device is actuated. When sufficient current is
applied to the coil of the relay the resulting magnetic field will
cause the soft iron armature to pull-in and this in turn will open
or close the relay’s electrical contacts. A typical miniature PCB
mounted relay will operate from a 5V supply, and its contacts will
Fig.2.17. Circuit layout for the prototype motor controller pull-in at around 75% of this value. The specifications of such a
(based on a 30-pin ESP32 board). relay are listed in Table 2.1. Solid-state relays (like those shown in

LED output. Finally, the GPIO pins are then configured in Listing 2.4 Simple motor control
the setup() code.
The main loop of the code repeats forever and starts /* ESP32 button control example. One button will be
by reading the state of the two buttons. Having read the for Start and the other for Stop. The output will be
indicated on an LED*/

// Define constants for the GPIO pins


const int runButton = 19; // GPIO19
const int stopButton = 21; // GPIO21
const int ledOutput = 18; // GPIO18

// Define variable states


int runButtonState = LOW; // No user input yet so both
int stopButtonState = LOW; // buttons will be low
int outputState = LOW; // Initially this must be low

void setup() {
// Initialize the LED pin as an output
pinMode(ledOutput, OUTPUT);
// Initialize the two push button pins as an inputs
pinMode(runButton, INPUT);
pinMode(stopButton, INPUT);
}
Fig.2.18. Wiring for the prototype motor controller (based on
a 30-pin ESP32 board). void loop() {
// Read the current state of the two buttons
runButtonState = digitalRead(runButton);
stopButtonState = digitalRead(stopButton);
// Check if the buttons are pressed
if (runButtonState == HIGH) {
outputState = HIGH;
digitalWrite(ledOutput, HIGH);
}
if (stopButtonState == HIGH) {
outputState = LOW;
digitalWrite(ledOutput, LOW);
}
Fig.2.19. Solid-state relays designed for controlling AC mains }
with maximum load currents ranging from 10A to 45A.

Practical Electronics | April | 2024 45


able . le tri al spe ifi ations o a typi al iniature relay

Parameter Value

+
Nominal operating voltage 5V DC
Nominal operating current 73mA
Maximum load rating AC 250V 10A, DC 30V 10A
Pull-in voltage (typical) 3.8V
DC coil resistance
Power consumption (typ) 0.36W
Operating time (max) 10ms
Release time (max) 5ms
Contact resistance (max) .
Operating life 100,000 operations at rated load
Maximum switching rate 30 operations per second

Fig.2.19) can be used to control much greater AC mains loads


of up to 45A, but can still operate from a low voltage input.
It is important to note from Table 2.1 that the relay coil requires
an operating current that’s well beyond the output drive capability
of the ESP32. We therefore need an interface that will provide the
extra current required. Fortunately, this can be little more than a
low-power transistor and a handful of other components, as we
shall see later in Part 2 of our Practical Project.
A neater, and often more cost-effective alternative is that
of making use of a ready built relay interface board. Luckily,
there are quite a few to choose from and the most common
types are fitted with two, four or eight relays with each relay
having its own driver circuit.
Fig.2.20 shows a typical four-channel relay board. The board
has a transistor driver and an opto-isolator for each channel.
Similar boards can be purchased very cheaply (often less than
£5) and so it is invariably more cost effective to purchase one
of these boards rather than attempt to build one yourself.

Coding relay outputs


It’s very easy to control one or more relays using just a few
lines of simple code. First, you will need to make sure that
you define the digital output pins to which the relays are
connected using a line of the form:

int pump = 18; // Pump connected via a relay


on GPIO pin-18
int heater = 21; // Heater connected via a
relay on GPIO pin-21

Next you will need to add a couple of lines into the setup()
code block, as follows:

Fig.2.21. Circuit of the four-channel relay interface board.

pinMode(pump, OUTPUT); // Pump is configured


as an output
pinMode(heater, OUTPUT); // Heater is
configured as an output

The relays and their respective loads can be turned on and off
incorporating the following lines of code at appropriate points
in the main program loop:

digitalWrite(pump, LOW); // Turn the pump off


digitalWrite(pump, HIGH); // Turn the pump on
digitalWrite(heater, LOW); // Turn the heater off
Fig.2.20. A four-channel relay interface board. digitalWrite(heater, HIGH); // Turn the pump on

46 Practical Electronics | April | 2024


An example might be counting items into
batches of 10 on a conveyor. Let’s assume
that we need to operate an LED when the
count reaches (or exceeds) ten items. The
following fragment of code would do this:

if (count >=10) {
digitalWrite(fullLED, HIGH);
}

If the value of count is less than 10 then


the condition evaluates false and the
statement following the condition is
simply ignored. However, if the value of
Fig.2.22. Adding a transistor driver and motor to the output of the motor controller.
count is 10 or greater then the condition
Practical project (Part 2) evaluates true and the statement following the condition is
Now let’s return to the Practical project. We can add a motor to executed. In some applications it can be appropriate to use
the output of the ESP32 (GPIO pin-2) using a transistor driver a series of if statements to detect various conditions and to
similar to those used in the four-channel relay interface shown act on them accordingly.
in Fig.2.20. The modified circuit and wiring diagrams for the
motor controller are shown in Figs.2.22 and 2.23 respectively. The if ... else construct
The motor is a low-cost miniature 5V component fitted with The if ... else construct is very straightforward. The
an integral gearbox. TR1 provides the larger current drive basic syntax is just:
for the motor (typically 50 to 100mA) and acts as a switch
which is open when the GPIO pin-2 goes LOW and is closed if (conditional expression) {
when GPIO pin-2 goes HIGH (see Fig.2.24). Diode D1 is used // code to be executed if true,
to protect TR1 from the back EMF generated when the motor // each statement ending with ;
current flow ceases. Similar diodes are used whenever inductive } else {
loads (such as relays, solenoids and motors) are used as loads. // code to be executed if false
// each statement ending with ;
Coding workshop }
Being able to make decisions based on what’s happening and
then acting on this information in different ways is an essential Here’s a simple example. Let’s assume that we are monitoring
pre-requisite of any programming language. The C-code used an analogue voltage and wish to set a threshold of 512 as the
in the Arduino IDE provides you with a variety of different value at which a green LED should become illuminated and,
conditional constructs that allow you to do this. Simple below this value, we would like a red LED to be turned on. Our
decisions can be made using nothing more than if and else, if … else construct would then look something like this:
while loops can be controlled using while, do while, for and
loop. We will look at all of these, starting with if and else. if (inVoltage >=128) {
digitalWrite(greenLED, HIGH);
The if construct } else {
The if construct is the simplest of all the condition constructs. digitalWrite(redLED, HIGH);
It is used when a statement (or a series of statements) should }
be executed when a particular condition prevails. The basic
syntax is as follows: Unfortunately, this isn’t quite the whole story. The red and
green status LEDs should be mutually exclusive and so we
if (conditional expression) { might need to ensure that when one LED is turned on the other
// code to be executed if true, LED is turned off. There are various ways that we could do
// each statement ending with ; this. We could either set them both off before we arrive at the
} if else construct or we could turn one on and the other off

Fig.2.23. Wiring of the modified motor controller. Fig.2.24. Switching action of the transistor in Fig.2.22.

Practical Electronics | April | 2024 47


within a construct containing more than one statement (ie, a as long as it takes for an item placed on the belt to reach a
compound construct). limit switch. Note that we must check the status of the limit
switch inside the loop. If we forget to do this the motor will
Using the first method we might have: run forever!

// start with both LEDs off while (limitSwitchStatus == LOW) {


digitalWrite(redLED, LOW); // Limit not reached so run the motor
digitalWrite(greenLED, LOW); digitalWrite(motorRun, HIGH);
// now decide which LED to put on // Check to see if anything has changed?
if (inVoltage >=512) { limitSwitchStatus = digitalRead(limitSwitch);
digitalWrite(greenLED, HIGH); }
} else {
digitalWrite(redLED, HIGH); By making the conditional expression dependent on the value
} of a counter modified inside the loop we have a simple means
of performing one or more statements a predetermined number
The other possibility is: of times, as follows:

// Read the input voltage and count = 0;


// put the red or green LED on while (count < 50) {
if (inVoltage >=512) { // code to be executed 50 times
digitalWrite(greenLED, HIGH); // each statement ending with ;
digitalWrite(redLED, LOW); count = count+1;
} else { }
digitalWrite(redLED, HIGH);
digitalWrite(greenLED, LOW); In this wait loop we increment the counter on every pass
} through the loop until it reaches 50, at which point the
conditional expression evaluates to false and execution
Notice how in this example we’ve compounded several continues with the next statement in the code. Note that there’s
statements after the if and else. The curly braces, { and a neater way of incrementing the count value, as follows:
}, help make the logic clear and unambiguous. Of course, at
some point earlier in the code we would have to define the count = 0;
pins that we are using to control the two LEDs and initialise while (count < 50) {
the variables (inVoltage, redLED and greenLED). // code to be executed 50 times
// each statement ending with ;
Conditions count++;
There are several logical conditions that we can test for, and }
they are summarised in Table 2.2. Notice how an exclamation
mark (!) is used to denote ‘not’. In this case, count++ is used to ‘post-increment’ the value
In the previous example you should have noticed the >= of count. In other words, it takes the current value of
condition that we used to find out whether the input voltage count, adds one to it and places the new value back into
has exceeded the threshold value of 512. The ‘greater than the count variable.
or equal to’ condition isn’t the only one that we have to play Finally, here’s an example showing how a simple wait loop
with, as Table 2.2 shows. could be used to flash an alarm LED ten times:

The while construct flashCount = 0;


The while construct provides you with a means of continuously while(flashCount < 10) {
executing one or more statements until a condition evaluates false. digitalWrite(alarmLED, HIGH);
The loop containing the statement (or statements) will continue delay(500); // wait half a second
to be executed as long as the condition remains true but, as soon digitalWrite(alarmLED, LOW);
as it becomes false the loop will terminate and execution will delay(500); // wait half a second
continue with the next subsequent statement. The basic syntax is: flashCount++;
}
while (conditional expression) {
// statements to be executed if true, The do ... while construct
// each ending with ; The do ... while loop works in a similar fashion to the
} while loop but with the exception that the condition is tested
at the end of the loop, not the beginning. This means that the
Here’s an example that shows how a belt motor could be statements within the loop will always be executed at least
controlled using a while loop. The belt motor will run for once. The syntax is as follows:

Table 2.2 Code Meaning Notes


Conditions
a == b a is equal to b True if a and b have the same value
a != b a is not equal to b i aa b a iff al
a > b a is greater than b True if a is larger than b (but not true if they have the same value)
a < b a is less than b True if a is smaller than b (but not true if they have the same value)
a >= b a is greater than or equal to b True if a is larger than b (and also true if they have the same value)
a <= b a is less than or equal to b True if a is smaller than b (and also true if they have the same value)

48 Practical Electronics | April | 2024


do {
// code to be executed at least once,
// each statement ending with ;
} while (conditional expression);

Here’s an example of reading a pressure sensor and waiting a


short time for the output to reach a steady value:

do {
delay(100);
// wait for the value to settle
cp = readPressure();
// read the pressure sensor
} while (x < 10);

In this example we are calling the readPressure() function 10


times before arriving at the final value returned from the sensor.
Fig.2.25. Motor controller with toggle action RUN/STOP button.
The for loop construct (ie, their position in the program) can impose restrictions on
The for loop is widely used in almost every computer the scope over which they can be used. However, since we
language, and C is no exception. The construct is used to repeat often need to use variables on a global basis (ie, anywhere in
a statement (or series of statements) whenever a condition our program code) we will often place them before any of the
evaluates true. If the condition evaluates false, then the loop other code. Declarations involve assigning a variable type (see
is exited, and execution continues with the statement that last month), a name and (optionally) an initial value.
immediately follows the loop. The for loop must be initialised Next, follows code that’s used for setting up. This code is
at the outset and thus is a little more complex than the while placed in a function called setup() and it is executed at the
loop. The basic syntax is: beginning and only once. The setup() function is often used
to specify the pin modes (ie, input or output) and to configure
for (loop initialization, conditional expression, the IDE’s Serial Monitor, but if they are not being used then
increment) { the setup() function can simply be left empty.
// statements to be executed if true, The main program code is written inside a loop that executes
// each ending with ; forever (or until the reset button is pressed or the power is
} removed). This loop() function contains the functions that
will execute when the program is being run. Each function
As with the while loop, a counter is often used to control the takes the form of a block of code that is executed whenever the
loop, and this is incremented or decremented each time round function is called. Functions can be the ones that are built into
the loop. This makes the construct ideal for use in any repetitive the language, or they can be user-defined. This feature allows us
application, for example, checking the status of several I/O to extend the basic language for our own needs with our user-
lines. It is important to remember that loop initialisation occurs defined functions calling other functions (both user-defined
only once and before the loop is executed for the first time. and in-built) as and when required. Function declarations take
The next code fragment shows how the ASCII character set the form of one or more statements enclosed between curly
can be sent to the serial monitor. Note that, for this to run, we braces, { and }. Note that each individual statement must end
would first need to initialise the serial port interface using a line with a semicolon, ;.
such as Serial.begin(9600). Note also that we have declared As well as the block comments that we mentioned earlier,
the count variable (i) within the loop initialisation itself. comments can be placed in-line. These consist of plain text
appearing after two // characters and added at the end of the
for (int i = 0; i <= 63; i++) line to which they apply. As previously mentioned, comments
{ provide us with a useful reminder of what’s going on in the code
testValue = 64 + i; and they can be invaluable when maintaining and debugging
Serial.print(testValue); a program. Indenting (often by three or four spaces) is used
Serial.print(“\n”); to assist with program readability. This becomes particularly
delay(100); important when functions are enclosed within other functions.
} Top tip – do note that the IDE can tidy up your code very nicely
if you select Tools and then Auto Format.
Program structure and layout
By now you should have gained some idea of what code looks Teach-In challenge
like and how it is structured, but before we go any further it is Our second Teach-In challenge is one that will test your coding
well worth explaining the layout in a little more detail. You skills. Fig.2.25 shows a simplified version of the motor controller
may have noticed that the first few lines of code in a program in which only one button is provided. This button is to have a
usually take the form of a heading enclosed between pairs toggle function; press once for RUN and then again for STOP.
of characters, /* and */, which constitute a comment block. See if you can modify the code from Listing 2.4 to achieve this.
Everything between these two characters is taken as plain text
and, since this has no effect on program execution you can Next month
use as many lines of text here as you want. Next month, we will move into the analogue world and investigate
The code’s title comment block is usually followed by several the ESP32’s analogue input and output capability. We will be
variable declarations. The reason behind this is simply that, in introducing techniques for generating analogue waveforms, and
the C language, variables must always be declared before they are our Practical Project will feature a simple battery checker. Coding
used. In fact, declarations don’t have to be placed at the beginning workshop will provide an explanation of the binary, octal and
of the program code but the point at which they are declared hexadecimal number systems.

Practical Electronics | April | 2024 49


Circuit Surgery
Regular clinic by Ian Bell

LTspice 24 and Frequency Response Analysis – Part 2

L
ast month, we started looking is a non-modal window,
at the frequency response analysis so you can keep it open Circuit closed-loop gain
Amplifier open-loop gain
(FRA) function in LTspice, which for reference as you work. AC = So / Sinp
AC = So / Sai
was part of a major update from LTspice It is possible to revert to Sinp Sinp Sai So So
1 Ao
XVII (17.0) to LTspice 17.1. Since then, the old (‘LTspice Classic’) +
there has been another major update shortcuts via the edit Loop gain
Sf
with a new version number: LTspice 24. shortcuts function that is –bAo = S' f / Sf

Although our main focus in these arti- available from this window
cles is the FRA, like last month, we will – useful if the old ones are Break in loop to
define loop gain
start by looking at some of the changes too ingrained and you don’t S' f
in this release. want to relearn! b
So
In the old LTspice, the
User interface changes simulation configuration Fig.3. Structure of an amplifier with negative feedback
Unlike the LTspice 17.1 update, in the w i n d o w ( w h i c h w a s showing the open-loop (red), closed-loop (green) and
move to LTspice 24 there is a very obvious called ‘Edit Simulation loop-gain (blue) relationships.
visual difference, as icons and cursors Command’, and is now
have been updated (see Fig.1 and Fig.2 called ‘Configure Analysis’) would forget Frequency response
which show the old and new toolbars details of commented-out simulation analysis recap
respectively). The default background directives. Now, if there is appropriate text LTspice’s frequency response analysis
has also changed. on the schematic, the relevant parameters (FRA) is aimed at determining the
The new toolbar contains more or less will be shown in the appropriate tab in stability of negative feedback circuits;
the same functions, but the order has the simulation configuration window that is, finding out how much margin
changed to some extent, and there are when it is opened. Also, using shift- of error there is between stable and
some items which have been added or click, it is now possible to toggle text unstable operation. The LTspice FRA
removed. For example, the ‘Close All’ on the schematic between being a SPICE is optimised for use with switch-mode
windows button has gone, but there are directive (such as a simulation command) powers supplies (SMPS) but it can be
now both ‘Tile Horizontally’ and ‘Tile and a comment (which LTspice will not used with other feedback circuits. To
Vertically’ buttons, previously there was act on as a command). This is very useful introduce the basic concept and use of
just a button to tile windows horizontally. if you have a few simulation commands the FRA, last month we started looking
There is a new ‘Configure Analysis’ button set (eg, for transient and AC analysis) as it at applying the FRA to simple op amp
(to set up the simulation). Some functions provides a quick way to switch between circuits rather than dealing with the
have been renamed: ‘Control Panel’ is them. You can tell these apart in the complexities of an SMPS.
now the more conventional ‘Settings’, default colour scheme – directives are Last month, we covered some basics of
and schematic editing ‘Drag’ mode is now black, and comments are blue. feedback analysis of op amp amplifiers
called ‘Stretch’. This is where components The are some useful changes to the (see Fig.3, which shows a system diagram
are moved without breaking the wiring waveform viewer. Plot panes can now of a noninverting op amp amplifier).
connections, which is useful for adjusting be moved around and reordered more Key concepts are open-loop gain (the
the layout of a schematic. The general aim easily using move up/down functions gain of the op amp with no feedback
of these changes seems to be to update to from the right click menu. All cursors applied, AO) the fraction of signal fed
more modern conventions in function can be removed using the Esc key, and back (b), closed-loop gain (the gain of
naming and icon style. gain and phase margin annotation can the circuit with feedback, AC) and loop
Some default keyboard short cuts have be added where applicable. The help gain. Loop gain is the gain around the
changed; for example, schematic editing system has also changed and now loads feedback loop (−bAO) and is an important
duplicate mode was F6 and is now Ctrl+C. pages via a browser. The Help menu parameter when considering the stability
There is a new ‘Keyboards Shortcut Cheat has been expanded and includes Open of feedback systems.
Sheet’ window which can be opened Examples, which provides quick access to Measuring loop gain for a real
as a reference for the shortcuts. This the examples included in the download. circuit, and in simulation, is tricky as it

(Above) Fig.1. Old LTspice Toolbar; (Below) Fig.2. Updated toolbar in LTspice 24.

50 Practical Electronics | April | 2024


function. Fortunately, shift at gain 1 (0dB) would be needed
Gain (dB) a number of techniques to cause instability (see last month for
have been developed details). These values indicate how stable
to help overcome this the circuit is likely to be in operation.
problem, including the
Middlebrook method FRA updates in LTspice 24
0 (published in the Gain and phase margin are shown
Gain
margin paper ‘Measurement of graphically in Fig.4. The loop phase
Loop Gain in Feedback can be plotted simply as phase shift (as it
Log frequency Systems’, in the would be in an AC analysis) or it can be
0 180
International Journal shown as phase margin by setting the axis
of Electronics in 1975), scale values to phase shift + 180°, which
Phase margin
Phase shift

which is implemented makes it easier to read the phase margin


–90 90 by LTspice in its FRA. (at the 0dB frequency). This change in
The result of the axis labelling has been made in the FRA
Phase
margin LTspice FRA is a plot in LTspice 24, which now plots phase
–180 0 of loop gain and phase margin rather than phase shift. This can
against frequency and be seen in Fig.5 and Fig.6 which show
Fig.4. Loop gain plot showing gain margin and phase margin. The reported values for the example FRA plot from last month
phase axis can be labelled with either phase shift or phase margin. gain margin and phase (with LTspice 17.1) and the results from
margin. These indicate the same simulation run in LTspice 24.
potentially involves ‘breaking the loop’, how much additional gain at 180° phase Also, when this example was run in
which may profoundly affect a circuit’s shift, and how much additional phase LTspice 24 it did not automatically add
text giving both the phase and gain margins
(as seen in Fig.5), it just showed F(0dB)
and the phase margin, however, gain and
phase margin annotations can be added
manually by using the right-click menu
on the waveform plot and selecting ‘Notes
& Annotations’ and then ‘Annotate Gain
Margin’ (or phase margin). These added
annotations are included in Fig.6.
As explained last month, running an
FRA requires an FRA component to be
added to the schematic, specifically
inserting it into the feedback loop. Other
enhancements to the FRA in version
24 include a new 4-terminal probe
(schematic component) which can be
used in some situations where the FRA
analysis was difficult to implement with
just the FRA component. Analogue
Device’s release notes also say that the
stimulus generated to run the FRA has
Fig.5. Example FRA results from last month using LTspice 17.1. been improved to provide better accuracy
– it now has smoother changes between
waveforms as frequency is changed.

Transient analysis
frequency response
LTspice users and regular readers of
Circuit Surgery will be familiar with
plots of gain and phase against frequency
obtained using AC analysis. FRA plots
looks similar to AC analysis results;
however, the simulation is performed
in a fundamentally different way. The
setup required for a transient-based
analysis is more complex than for AC
analysis, so we’ll discuss the issues
involved before describing the FRA
settings in LTspice.
AC analysis uses a linearised model
of the circuit, from which LTspice
can rapidly calculate the response at
any frequency. Strictly speaking, AC
Fig.6. FRA results from the example from last month using LTspice 24 with phase and analysis only works for very small input
gain margin annotations added. Note the phase margin scale on the phase axis. amplitudes (AC analysis is also called

Practical Electronics | April | 2024 51


Signal amplitudes must be suitable –
too high and the circuit will be forced
outside its normal operating conditions,
for example clipping, or slew rate
limiting in the case of an amplifier –
too low and the output / response signal
may be difficult to measure / resolve
due to noise (in the lab) or accuracy
limitations (in simulation).
Because gain changes with frequency
(the whole point of performing a
frequency response analysis) the suitable
Fig.7. LTspice for investigating FRA with a simple op amp amplifier. signal levels may also change with
frequency. Also, when the frequency
is changed during the analysis run any
resulting abrupt changes in the input /
injected waveform may cause responses
such as spikes that could temporarily
invalidate the analysis. Therefore, it
may be necessary to wait for the circuit
to stabilise after each frequency step.
Furthermore, the circuit may take time
to settle to normal operation at start
up, so an initial delay before analysis
starts may be required.
For the specific case of loop-gain
analysis, it is also necessary to decide
where in the loop the signal will be
injected. In the case of LTspice this
involves adding an FRA component
to the schematic (this has name prefix
‘@’). The analyser component applies
the sinusoidal stimuli and measures the
Fig.8. AC analysis results (closed-loop circuit and op amp open loop) from the Fig.7 circuit. response. To reduce simulation time, it
may optionally simultaneously inject
multiple harmonics, although this may
‘small-signal analysis’). The model used Transient simulation corresponds reduce accuracy.
only applies to a particular operating with what would be done with a real The LTspice FRA uses the voltage-
point (the DC conditions, or bias, in the circuit in the lab to obtain a frequency only version of Middlebrook’s method,
circuit). Large signals will shift things response – typically using a signal which requires the device to be inserted
too far from this point, invalidating the generator and oscilloscope, often using into a point where a low impedance is
model parameters. For example, the gain automated measurements to cover the driving a high impedance. For an op
of an amplifier will decrease at high many different frequencies required amp amplifier, the op amp output and
input levels as it starts to clip. However, to calculate gain and phase shift. This feedback resistor should be suitable. For
once created, the linearised model gives is straightforward for a simple input an SMPS, the FRA component would
the same gain vs frequency result for to output response, but as discussed usually be placed between the power
any amplitude input. Therefore, it is last month, measuring loop gain supply output and error amplifier input.
common to use a 1V input from AC requires special techniques such as The FRA must interrupt all paths in
analysis in LTspice even if the real those published by Middlebrook. the loop – that is, there must not be a
circuit would not work correctly with The Middlebrook approach was parallel path in the loop which bypasses
this signal level. With an input of 1 developed for use in the lab but can the FRA component.
the output is numerically equal to gain also be implemented using transient
and therefore the gain is easy to plot – simulation. The LTspice FRA runs a Example circuit
you just plot the signal value (voltage); transient simulation in which it injects The circuit in Fig.7 will be used to look
you don’t have to calculate the gain as signals into the feedback loop and at basic use of the LTspice FRA and
v(out)/v(in). analyses the response in accordance relate the results to the op amp theory
LTspice’s FRA is aimed at stability with a version of Middlebrook’s method. we discussed last month. The circuit
analysis of SMPSs, which are non-
linear circuits with no small-signal Setting up an LTspice FRA
linear equivalent circuit that could be Setting up an AC analysis for input to Introduction to LTspice
used for AC analysis. However, there output gain is straightforward – it just Want to learn the basics of LTspice?
is an alternative to AC analysis, which requires the input amplitude (usually Ian Bell wrote an excellent series of
is to directly measure the gain and 1, as noted above) from a standard Circuit Surgery articles to get you up
phase shift with a range of sinewave source at the circuit input, and the and running, see PE October 2018
stimuli, using transient simulation required frequency range and number of to January 2019, and July/August
(time-based simulation to obtain circuit points for the plot to be produced. For 2020. All issues are available in
print and PDF from the PE website:
waveforms). This is the approach used a transient simulation-based frequency
https://bit.ly/pe-backissues
in LTspice’s FRA. response there is more to think about.

52 Practical Electronics | April | 2024


it is down by 3dB (half power) at 10Hz. feedback loop. If it is in place already
This is typical of real op amps. then it needs to be disabled during the
Op amp open-loop gain reduction standard transient simulation.
with increasing frequency is called Full FRA simulations can be quite
compensation, and is deliberately long, so it is a good idea to start with a
designed into the device to help ensure trial run that uses a very small number
stability when feedback is applied. The of frequencies to check it is operating
frequency at which the gain reduces correctly. The main setup for the FRA
by 3dB is set by the gain-bandwidth analysis is done via the FRA device
product parameter (G B W ) in the op right-click menu, rather than through
amp model, which in this case is 107 the more usual use of the Analysis
(10 million). On the sloped part of the Configuration dialogue.
open-loop response the product of gain
and frequency is 107 at all points (eg, FRA device configuration and
60dB (gain 1000) x 10kHz = 10 7 and trial run
0dB (gain 1) x 10MHz = 107). Fig.9 shows the setup dialog for the
The closed-loop gain (AC) is 10 (20dB), FRA device configured for a trial run
as noted above, and we see this gain is for the circuit in Fig.7. There are a lot of
maintained for the amplifier circuit until parameters which can be set for the FRA.
around 1MHz (where it is 3dB down) – we We will discuss the parameters used
can predict this from the gain-bandwidth for the initial run now, and comment
product by dividing by the closed-loop on others later.
gain. The closed-loop bandwidth is GBW/ The FRA can perform gain or impedance
AC = 1.0 x 107/10 = 1MHz. vs frequency analysis – we are looking
Last month, we saw that the closed- at gain, so this is selected. The start and
loop gain equation for a non-inverting end frequencies are obvious parameters,
op amp amplifier could be simplified but their required values depend on
by approximating the term (1 + bAO) the properties and specification of the
Fig.9. FRA setup for trial run. to bAO. This gives the closed-loop gain circuit being analysed. For a trial run
just in terms of b, which leads to the these should be fairly close together to
uses an idealised op amp (LTspice well-known gain formulae for op amp keep the number of frequencies analysed
UniversalOpAmp2, and is a basic non- amplifiers that only depend on the small. The number of frequencies is
inverting amplifier with a gain of 10 feedback resistors, not on the open- also controlled by the points per octave
(20dB) (1+R1/R2 = 1 + (90kΩ /10kΩ) = loop gain. A naive interpretation of the drop-down. A low setting (0.5) should
10). The FRA component (@1) is inserted gain formula 1+R1/R2 would imply the be used for trial runs. More points give a
between the op amp U1 output (low- same gain at all frequencies. However, more detailed graph but will take longer.
impedance op amp output) and feedback this is not the case because it depends As noted above, the stimulus
resistor (relatively high impedance since on the assumption of high open-loop amplitude must be suitable for the
90kΩ is used) to fit the requirements gain (or more accurately loop gain). circuit and may need to vary with
for FRA insertion. The schematic has The approximation breaks down at frequency. The FRA setup allows you
three analyses configured on it (FRA, high frequencies as the open-loop gain to define two frequency corners (F0 and
AC and transient). The LTspice 24 (bAO) reduces and is no longer much F1) at which the peak-to-peak signal
update means it is now easy to switch greater than one. voltages are defined: pp0 (low-frequency
between these using Shift-Click, which amplitude) and pp1 (high-frequency
toggles between SPICE directive (black Preparing for FRA amplitude) respectively. The amplitude
text) and comment (blue text). FRA uses transient simulation, so it is pp0 below F0 and pp1 above F1 and
Op amp U2 is the same as U1 and is is important make sure the transient varies from pp0 to pp1 between F0 and
included to provide an open-loop AC simulation is running correctly before F1. This is the amplitude at the point
analysis. This is done in a crude way starting FRA. For our example op amp where the FRA is inserted, which in
here – simply applying the input to circuit, which is close to ideal, this is this case is the op amp output. As the
the open-loop amplifier. This works for straightforward, but may be less so for gain of the amplifier is higher at lower
this idealised device in simulation, but more complex circuits such an SMPS. frequencies we would typically expect
for real devices (particularly in the lab) This simulation should be used to higher amplitudes at low frequencies,
more sophisticated approaches would be determine the time the circuit takes to but the specific values used here were
needed; for example, to ensure that the settle to normal operation (and other mainly set for purposes of illustration.
device is DC stable and does not saturate. parameters for an SMPS). If the delay The General section of the dialog
Fig.8 shows the results of running is significant, it should be reduced if contains timing parameters. The start
the AC analysis with the FRA device possible, or steps taken to speed up analysis time controls when the first
deactivated. It is helpful to understand the simulation. For the op amp circuit, stimulus is applied and should provide
this before looking at the FRA results. correct operation can be confirmed by enough time for the circuit to settle
The idealised model for U1 is configured using a sinewave input from source V1, after the start of the simulation. This is
to have an open-loop gain of one million but if this is done the source function important for circuits such as an SMPS,
(120dB). This value can be changed should be changed from sine to none but the value used here is for illustration
by right-clicking the op amp symbol before the FRA is run to prevent the rather than being necessary for analysis
(Avol parameter). We see the 120dB signal from interfering with the FRA of the op amp circuit. The minimum
gain on the open-loop plot (red trace) later. If not already in place, the FRA analysis time sets the minimum time
at low frequencies, but the gain starts component should be added to the for applying each frequency. Analysis
reducing above about 1Hz. Specifically, schematic at a suitable point in the starts after the settling time – which can

Practical Electronics | April | 2024 53


Fig.10. Stimulus waveform for FRA trial run using settings shown in Fig.9.

Fig.12. FRA setup for full run.

section also contains a checkbox for


disabling the FRA device – this should
be used when other types of analysis
are run.
The stimulus waveform for running
the FRA for the circuit in Fig.7 with
settings in Fig.9 is shown in Fig.10.
The frequency response plot is shown
in Fig.11. FRA waveforms are plotted
in the same way as a normal transient
Fig.11. FRA plot for the circuit in Fig.7 using settings shown in Fig.9. simulation and the response plot
window appears automatically after the
be adjusted appropriately if behaviours amp example, but for circuits such simulation completes. Three frequencies
such as spikes and ripples are observed as an SMPS the values should ensure were used: 1kHz, 4kHz and 10kHz.
in the waveforms when the stimulus that sufficient switching cycles are Ideally, the response plot would include
frequency changes. These parameters included without being so long as to the 0dB gain frequency, but here the
are not particularly critical for the op cause excessive run time. The General values are just to produce illustrative
waveforms. The waveform plot shows
the 0.5ms delay before the stimulus
is applied; the 50mV high-frequency
amplitude (at 10kHz); the 100mV low-
frequency amplitude (at 1kHz); and an
intermediate amplitude at the frequency
between these – corresponding with the
setting shown in Fig.9. The waveforms
look OK (there is no distortion) which
indicates that the parameters are suitable
for a full analysis.

i ulation files
Most, but not every month, LTSpice
is used to support descriptions and
analysis in Circuit Surgery.
am l a l a a ailabl
for download from the PE website:
https://bit.ly/pe-downloads
Fig.13. FRA plot for the circuit in Fig.1 using settings shown in Fig.12.

54 Practical Electronics | April | 2024


Full FRA analysis For readers interested in investigating the FRA further,
The setting used for a full analysis are shown in Fig.12 and the particularly for SMSP circuits, there are additional details
results in Fig.13. The frequency range has been increased to available via the LTspice help, and SMPS FRA examples
cover a wider range, similar to that in Fig.8, with more points are provided with the LTspice 24 download.
per octave than the trial run. The range goes up to 10MHz with

NEW!
an additional specific frequency of 100MHz, which extends
the range plotted without requiring many more waveform
steps. The datapoints are marked on Fig.13, which shows the
six or seven points per decade stopping at 10MHz, and the
single additional point at 100MHz. Furthermore, the coarse
stepping parameter is set to 100Hz, which reduces the number
of frequency steps per octave below the specified frequency.
These last two parameters are not really needed here but
are included to illustrate their use. They can help reduce
5-year collection
2017-2021
simulation time. For an SMPS, the simulation time may be
long at low frequencies because many switching cycles are
required for just one cycle of the stimulus. Simulation time
can also be reduced by setting the number of simultaneous
harmonics (typically 2 to 4). This applies multiple frequencies
All 60 issues from Jan 2017
at the same time – it is faster, but less accurate. to Dec 2021 for just £44.95
Comparing the results in Fig.13 with Fig.8 we see that the
loop gain (bAO) is equal to the difference (on the dB scale) PDF files ready for
LTspice 24
between theand Frequency
open- Response Analysis
and closed-loop gains,–while
Part 2 the loop immediate download
gain is much larger than 1. This matches theoretical
spice 24 and Frequency Response Analysis – Part 2
expec t a t i on s – t h e r e la tio n sh ip c a n b e c o nfir m ed
mathematically as follows, using the equation for closed-
loop gain discussed last month. 𝐴𝐴!
See page 6 for further details and
(1 + 𝛽𝛽𝐴𝐴!) other great back-issue offers.
20log(𝐴𝐴! ) − 20log(𝐴𝐴" ) = 20 log(𝐴𝐴! ) − 20log , 0
𝐴𝐴!
20log(𝐴𝐴! ) − 20log(𝐴𝐴" ) = 20 log(𝐴𝐴! ) − 20log , 0
(1 + 𝛽𝛽𝐴𝐴!)

(1 + 𝛽𝛽𝐴𝐴! ) Purchase and download at:


2 ≈ 20log(𝛽𝛽𝐴𝐴! )
= 20log 1𝐴𝐴!
(1 + 𝛽𝛽𝐴𝐴! ) 𝐴𝐴! www.electronpublishing.com
= 20log 1𝐴𝐴! 2 ≈ 20log(𝛽𝛽𝐴𝐴! )
𝐴𝐴!

Your best bet since MAPLIN


Chock-a-Block with Stock
Visit: www.cricklewoodelectronics.com
O r p h o n e o u r f r i e n d l y k n o w l e d g e a b l e st a f f o n 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:
www.cricklewoodelectronics.com
Visit our shop at:
www.PlugOfNails.com
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 | April | 2024 55


Max’s Cool Beans
Arduino Bootcamp – Part 16

Way back in the mists of time we used to call Part 14 (PE, February 2024), we commenced with me
complementing you on your perspicacious and sagacious appearance, after which I invited you to sa
By Max
something nicethe
aboutMagnificent
me.

Well, a reader we will call Ron (because that’s his name) rose to the challenge. Ron just emailed me
say: You look great in that Hawaiian shirt, and I love the way you digress loquaciously with verbosity
circumlocution when talking about things of an electronic nature. Well done, Ron. Although I don’t li
Arduino Bootcamp – Part 16
to boast (I’m known far and wide for priding myself on my humility), I must admit that I take some
satisfaction with respect to the garrulity and circuitousness of my humble scribblings.

Do you know the time?

W
ay back in the mists of time with
In ourthe current
previous datewe
column, andaddedtime. The real-time
a DS3231 office) to transfer
clock (RTC) data
to ouratspiffy
10 characters
new dual-breadboard
we used to call Part 14 (PE, second
setup. The looped
greataround reading
thing about an RTCtheisdate
that its per
backupsecond.
battery The UART
allows it toinremember
the Arduino the time when
February 2024), we com- and
power time from the– RTC
is removed eitherand displaying
accidentally Uno supports
or intentionally – fromvalues
the main ofsystem.
300, 600, 750,
menced with me complementing you these values in the Serial Monitor. If 1200, 2400, 4800, 9600, 19200, 31250,
on your perspicacious and sagacious you’ve forgotten what this program
Just to remind ourselves of where we’re at, you looks 38400, 57600 and
can download more.of our current hardware set
an image
appearance, after which I invited you like,
(file CB-Apr24-01.pdf). As usual, all the files mentioned in this column Arduino
you can download a copy now The default for the are available is 9600
from the April 20
to say something nice about me. (file CB-Apr24-02.txt). baud. We can dictate the baud rate used
page of the PE website: https://bit.ly/pe-downloads
Well, a reader we will call Ron I don’t know about you, but I’ve been by our program by specifying its value
(because that’s his name) rose to the jolly busy recently, paddling up a creek in the Serial.begin() function. And
Next, we created two small programs (or ‘sketches’ in the vernacular of the Arduino). The first loade
challenge. Ron just emailed me to without a paddle (or a creek), up to my we can specify the value used by the
the RTC with the current date and time. The second looped around reading the date and time from t
say: You look great in that Hawaiian armpits in alligators (I never metaphor Serial Monitor by clicking the down-
RTC and displaying these values in the Serial Monitor. If you’ve forgotten what this program looks lik
shirt, and I love the way you digress I didn’t like), and running around in pointing arrow next to the baud rate
loquaciously with verbosity and you can downloadcircles
ever-decreasing now (file CB-Apr24-02.txt).
a copyshouting, ‘Don’t value in the interface (Fig.1).
circumlocution when talking about Panic!’ As a result, I haven’t played with In our previous column, we decided
things of an electronic nature. Well I don’t
my know about
prototype sinceyou,
lastbut
weI’ve beenLet’s
spoke. jolly busytorecently,
speed thingspaddling
up by upusing
a creek without
57600 a paddle (or a
baud.
done, Ron. Although I don’t like to boast creek), up to my armpits in
all power up our Arduinos and fire up alligators (I never metaphor
However, I commenced this current in ever-
I didn’t like), and running around
(I’m known far and wide for priding decreasing circles shouting,
our programs together. Are you ready? ‘Don’t Panic!’ As a result, I by
session haven’t
updatingplayedmywithIDEmy to prototype
the latest since last w
myself on my humility), I must admit spoke. Let’s
One… two… allthree…
power up Go!our Arduinos and fireversion.up our programs
I’m assumingtogether. Are you
it was thisready?
that One… two
that I take some satisfaction with respect three…
Hmm.Go! Is your Serial Monitor displaying reset the Serial Monitor in my IDE
to the garrulity and circuitousness of weird and wonderful characters back to 9600 baud. This resulted in a
my humble scribblings. Hmm. Is your
something Serial
like theMonitor
following? displaying weird and fewwonderful
seconds of characters
gnashing something
of teethlike andthe following
rending of garb before I realised what
Do you know the time? 7t)LT)L�’T)L�7t)L�#t... was going on.
In our previous column, we added a As soon as I’d set the correct baud
DS3231 real-time clock (RTC) to our If so,
If so,although
although thisthis
may accurately
may accurately represent the ratedate andserial
in my time somewhere
monitor, then in the multi-universe, it
I started
spiffy new dual-breadboard setup. The to satisfy requirements
represent the date andhere timeon planet Earth. When
somewhere to seewe the see something
date and time like values
this, theI first
wasthing to do i
great thing about an RTC is that its check
in the that the baud rateit(think
multi-universe, fails‘communication
to satisfy speed’) in looking
expecting, the Serialsomething
Monitor is set liketothe
the same valu
backup battery allows it to remember requirements
we’ve used in here on to
the call planet Earth. When
the Serial.begin() following
functionlines:
in our program. Sometimes the Arduino’s
the time when power is removed – either we see something
integrated developmentlike this, the first thing
environment (IDE) remembers the last value we used in the Serial Monitor…
accidentally or intentionally – from the to
and dosometimes
is check that the baud rate (think
it doesn’t. 2024/2/10 (Saturday) 10:24:18
main system. ‘communication speed’) in the Serial 2024/2/10 (Saturday) 10:24:21
Just to remind ourselves of where Monitor is set to the same value we’ve
The Arduino uses a universal asynchronous receiver/transmitter 2024/2/10 (Saturday) (UART) function 10:24:24
to communicate w
we’re at, you can download an image used in the call to the Serial.begin() 2024/2/10
the host computer. This is a very simple interface in which both the data format (Saturday) 10:24:27
and transmission
of our current hardware setup (file function
speeds arein our program.
configurable. Sometimes
It requires only two wires to : transmit and receive in both directions (both e
CB-Apr24-01.pdf). As usual, all the files the Arduino’s integrated development etc.
also require a connection to ground).
mentioned in this column are available environment (IDE) remembers the last
from the April 2024 page of the PE value we used in the Serial Monitor… I feel like shouting, ‘It’s alive! It’s alive!’
website: https://bit.ly/pe-downloads and sometimes it doesn’t. Note that these values are updated every
Next, we created two small programs The Arduino uses a universal three seconds because we’ve included a
(or ‘sketches’ in the vernacular of the asynchronous receiver/transmitter three second (3000 millisecond) delay at
Arduino). The first loaded the RTC (UART) function to communicate the end of the loop() function in our
with the host computer. This is a very program. (Try changing this to 1000 and
simple interface in which both the observe that your display now updates
data format and transmission speeds each second.)
are configurable. It requires only two
wires to transmit and receive in both Drifting along
directions (both ends also require a I’m sorry. I drifted off there for a moment.
connection to ground). There’s something hypnotic about
There are a variety of ‘standard’ baud watching this series of date and time
rates used for serial communications values appearing on one’s screen. But
implemented using UART protocols. wait! Do the minutes values in your
Many of these are historical in nature. Serial Monitor fail to precisely match
Fig.1. Checking the baud rate in the For example, 110 baud was used by ASR the time displayed in the menu bar of
Serial Monitor. 33 Teletype machines (like the one in my your host computer?

56 Practical Electronics | April | 2024


Don’t freak out if there is a small discrepancy. One source of people (not you, of course) think there are no surprises to
any potential difference is associated with the way in which be uncovered. Let’s see, shall we?
we loaded the time and date into our RTC in the first place. In the case of a 24-hour clock, the day runs from midnight
The technique we used in our first program was to set the to midnight and is divided into 24 hours, which are numbered
RTC to the date and time at which the program was compiled. from 0 to 23. This scheme may be referred to as ‘military
This took place prior to uploading it into the Arduino and time’ in the US and parts of Canada, ‘continental time’ in the
using it to initialise the RTC, all of which took time. UK, and ‘railway time’ in other parts of the world.
Another source of error is that RTCs aren’t perfect and they’re By comparison, in the case of a 12-hour clock, the 24 hours
subject to drift. The DS3231 we’re using is phenomenally of the day are divided into two 12-hour periods designated
accurate in the scheme of things. If you look at its data sheet as a.m. (from the Latin ante meridiem, meaning ‘before
– available at: https://bit.ly/42CloQS – you’ll see this little midday’) and p.m. (from the Latin post meridiem, meaning
scamp has a specified accuracy of ±2ppm (parts per million) ‘after midday’). The 12 hours in each period are numbered:
over a temperature range of 0°C to +40°C. This means a 12 (which, amusingly, acts as 0), 1, 2, 3, 4, 5, 6, 7, 8, 9, 10 and
worst-case drift of 2 seconds for every million seconds. Since 11. Surprisingly, there is no widely accepted convention for
there are 60 x 60 x 24 x 365 = 31,536,000 seconds in a year how midday and midnight should be represented. However,
(assuming we aren’t in a leap year), then this equates to a in English-speaking countries, 12 a.m. means 12 o’clock
worst-case drift of ~0.2 seconds a day, ~1 second a week, midnight, while 12 p.m. indicates 12 o’clock noon.
or ~1 minute a year.
One final potential source of error may depend on whether
you purchased a real DS3231 that was manufactured by
Maxim Integrated, which is a subsidiary of the American
multinational semiconductor company Analog Devices, or
whether you acquired a cheaper Chinese ‘knock-off,’ which
may or may not be up to par.
One of the things we will be talking about at some stage
in the future is adding a few pushbutton switches to our
prototype and using them to implement a menu system that
will allow us to do things like setting the date and time by
hand, but that’s a discussion for another day because we
currently have other poisson à frire (fish to fry).

One 7-segment display (sad face)


As you will doubtless recall, we currently have only a single
7-segment display at our disposal (sad face). This wasn’t
an issue with our first experiments in which we wished to
display only the ten digits 0 through 9.
Later, when we came to experiment with our ultrasonic
sensor (PE, February 2024), we decided to present distances
on our display, where these distances were measured in
centimetres using values between 0 and 99. As part of this,
we elected to always employ two digits in the form 00,
01, 02… 97, 98, 99. As we said at that time: If we call our
most-significant and least-significant digits MSD and LSD,
respectively, and if we think of ‘…’ as indicating a pause,
then a first-pass view would be to display MSD … LSD … …
… MSD … LSD … … …, and so forth.
Well, we now want to display the hours and minutes
portions of the date and time values returned from our RTC.
For our purposes, each of these values will involve two digits,
which we can think of as HH:MM for hours and minutes.
This means we have four digits to display. If we refer to the
most-significant and least-significant hour and minute digits
as H-MSD, H-LSD, M-MSD, and M-LSD, respectively, then
one approach would be to display:

H-MSD … H-LSD … … … M-MSD … M-LSD … … … … … … … …


… H-MSD … H-LSD … … … M-MSD … M-LSD – and so forth.

To put this another way, we will display the H-MSD and H-LSD
digits with a short pause between them, wait for a medium-
sized pause, display the M-MSD and M-LSD digits with a
short pause between them, wait for a longer pause, and then
do everything all over again, and again, and… you get the idea.

Decisions, decisions…
Now it’s time for us to make a choice. Do we want to display
time in a 24-hour or 12-hour clock format? We all use digital
clocks in one form or another myriad times each day, typically
without thinking about things too deeply, so I bet most Listing 3a. Displaying hours and minutes in 24-hour format.

Practical Electronics | April | 2024 57


Let’s start by implementing the 24- to settle on what’s most pleasing to Which approach do you think we
hour clock system, which is the flavor your eye. should use? I agree – let’s do it ourselves.
our DS3231 RTC uses by default. In this The first thing we do on Lines 60 and The easiest way to start out here is to
case, each day officially begins in the 61 is declare four variables of type byte. take a step back and think about what
middle of the night (a.k.a. midnight) at We’re going to use these to store the we want to do (not surprisingly, this
00:00. A value of 12:00 occurs only at segments associated with our H-MSD, approach works well for most problems).
noon (ie, the middle of the day, a.k.a. H-LSD, M-MSD, and M-LSD digits. On The hours values returned by the DS3231
midday). The last minute of the day Line 63 we declare two variables of type running in 24-hour mode are numbered
begins at 23:59 and ends at 24:00, which int (integer) called hour and minute. 0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13,
is identical to 00:00 of the following (I’ll leave the mystery of what we are going 14, 15, 16, 17, 18, 19, 20, 21, 22, 23. If
day. This means our HH values will to store in these to your imagination.) we wish to present time in a 12-hour
span 00 to 23, while our MM values As we discussed in last month’s format, we need to convert these values
will span 00 to 59. column, the RTC library we are to be 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11,
using declares a new data type called 12, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11.
24-hour clock DateTime. This is a structure containing Well, that seems easy enough. If the
What we are going to do is to take the multiple members whose values we hours value returned from the RTC is
program that we discussed earlier (file can access using full-stop/period ‘.’ 0, we need to change our version to 12.
CB-Apr24-02.txt) which displays the delimiters (we introduced enumerated Alternatively, if the hours value returned
date and time from the RTC, plus take types, structures and type definitions from the RTC is greater than 12, we need
the program we used to display the in PE, December 2020). On Line 65, we to subtract 12 from this value.
2-digit values from the ultrasonic sensor declare a variable of type DateTime I just made this modification to my
(file CB-Feb24-03.txt from PE, February called now, to which we assign the program (file CB-Apr24-04.txt). As we
2024). Then we are going to munge and values returned from a call to the see in Listing 4a, the only difference
merge these little rascals together, add rtc.now() function. On Lines 67 and between our previous program and
a sprinkle of programming magic, and 68 we copy the hours and minutes values our new version is the addition of a
‘Bob’s your uncle’ (or aunt, depending out of our now variable into our hours simple conversion routine on Lines 71
on your family dynamic). and minutes variables (as we’ll see, through 74.
I just did this and it works like a doing things this way will make our Remember that the ‘-=‘ operator used
charm. But before you look at my lives much easier when we come to on Line 74 is known as a compound
solution, why don’t you have a bash implementing a 12-hour format). operator. The following two lines have
yourself? One ‘word to the wise’ is to As a reminder, our DigitSegs[] array the same functionality:
remember to change the Arduino pin contains the segments associated with
assignments to our PinSegs[] variable the digits we wish to present on the hour –= 12;
to be {9, 8, 7, 6, 5, 4, 3, 2} to match our 7-segment display. The way we’ve set hour = hour – 12;
new breadboard layout. We discussed things up, DigitSegs[0] contains the
this in our previous column, but it’s segments associated with the number 0, We introduced the concept of compound
easy to forget this sort of thing (as I just DigitSegs[1] contains the segments operators quite some time ago (PE,
discovered to my cost). associated with the number 1, and so on. March 2022). I know they can look a
Once you have your own solution up Remember that, if we have a number little ‘tricky’ when you are starting out.
and running, you can then compare it between 0 and 99, then dividing it However, they do allow us to concisely
to mine (file CB-Apr24-03.txt). Since by 10 using the division operator ‘/’ capture what we are trying to do, and
we’ve already seen most of this program will return the most significant digit, – after a while – you’ll find it becomes
before, we’ll just look at the loop() while dividing it by 10 using the easier to parse and process expressions
function here (Listing 3a). Note that I’ve modulus operator ‘%’ will return the using compound operators than their
created three definitions, SML_PAUSE, least-significant digit. This is what we expanded versions. The more you
MED_PAUSE, and BIG_PAUSE to which are doing on Lines 70 through 73 to capture code, the more you will grow
I’ve assigned values of 150, 450, and determine which segments we wish to to love compound operators (trust me,
1350 (milliseconds), respectively. I light up to display our most-significant have I ever lied to you before?).
made each delay three-times the length and least-significant hour and minute As one final thought before we
of its predecessor because… that’s just values. After this, it’s easy-peasy-lemon- proceed, if we are displaying time in
the sort of fellow I am. You can tweak squeezy to present the 4-digit sequence a 12-hour format, we could use the
these values to your heart’s content on our display, with each pair of digits decimal point (DP) segment on our
being separated (ie, all segments turned 7-segment display to indicate if the
off) by appropriate delays. time is a.m. (DP = Off) or p.m. (DP =
ON). Personally, I’m usually aware of
12-hour clock whether it’s the morning, afternoon, or
A lot of people find it difficult to wrap evening, so this would be superfluous
their brains around the 24-hour clock to requirements. However, this may be
format and they much prefer to use its of interest for those who are temporally
12-hour counterpart. challenged. We will return to consider
As fate would have it, the DS3231 can this further (by which I mean using the
run in either 24-hour mode (the default) or DP to indicate a.m. or p.m.; not people
12-hour mode. If you look at the DS3231’s who have a tortuous grasp on time) in
data sheet, you will see that bit 6 of the our next column.
hours register is defined as the 12-hour
or 24-hour mode select bit. Alternatively, Two 7-segment displays (happy face)
we can take the default 24-hour format I’ve said it before, and I’ll say it again,
returned from the DS3231 and convert when it comes to tedious, tiresome and
Listing 4a. Converting to 12-hour format. it into a 12-hour form ourselves. turgid music, you’d have to go a long

58 Practical Electronics | April | 2024


Adding and connecting the second display
The next step is to add a second 7-segment display to the
D1, 7, A
D1, 6, B left-hand side of the upper breadboard, as illustrated in
D1, 4, C
D1, 2, D Fig.3. Once you’ve inserted this display, connect the blue
D1, 1, E
D1, 9, F wires coming from our new set of current-limiting resistors.
D1, 10, G
D1, 5, DP Now, this part is important. Observe the black wire shown
D0, 7, A
as connecting pin 3 of display D0 to ground (0V). I want you
D0, 6, B to remove this wire but remember it for a thought experiment
D0, 4, C
D0, 2, D we are poised to perform. Similarly, observe the black wire
D0, 1, E
D0, 9, F shown as connecting pin 3 of display D1 to ground. Do not
D0, 10, G
D0, 5, DP add this wire but – once again – remember it for the thought
experiment to which we are racing (try not to lose your breath).
Display number
Display pin numbers
Display segments

Wot? Not enough pins?


For our purposes here, we are going to ignore the fact that
the Arduino Uno’s six analogue pins A0 through A5 can also
be used as digital input/output (I/O) pins. This is because
we’ve been using our analogue pins for other tasks – like
reading the value of a potentiometer (PE, November 2023)
or reading the value from a light-dependent resistor (LDR)
to measure the level of ambient light (PE, December 2023).
No one knows what the future holds, but there’s more
than a betting chance we might wish to add these types of
functionalities into a future incarnation of our clock. Also,
Fig.2. Adding eight more current-limiting resistors and wires. as discussed in our previous column, analogue pins A4 and
A5 are no longer available to us because we are using them
to provide I2C communication with our RTC.
way to find anything worse than One (commonly known for So, this is where we run into a problem. The Arduino Uno
its opening line ‘One is the loneliest number you’ll ever do’) has only 14 digital input/output (I/O) pins numbered from
as covered by Three Dog Night in 1969. 0 to 13. We can’t use pins 0 and 1 (well, we can, but we’re
Defying all possibility, the second line is even worse than not going to) because these are used to implement any UART
the first: ‘Two can be as bad as one, it’s the loneliest number conversations with our host computer. Examples of these
since the number one’ (I mean, come on, give me a break!). communications are when the host computer programs the
Well, we are here to refute the premise of this second line, Arduino, or when our programs send messages to the host
because we are going to add a second 7-segment display to computer using Serial.print() function calls.
our breadboard (happy face). This means we have only 12 digital I/O pins at our disposal.
Was that a squeaky squeal of excitement I just heard? (Yes, Thus far, we’ve been using eight of these pins (2 through
it was, but I just realised that it was me). 9) to drive the eight segments on our 7-segment display
(remember, the decimal point counts as a segment in its
Adding more current-limiting resistors own right). This means we have only four digital I/O pins
The first thing I want you to do is return to the illustration (10 through 13) remaining that are available to us.
showing our full prototype as it currently stands (file But wait, there’s more. Although we aren’t doing so
CB-Apr24-01.pdf). presently, in the past we’ve used our four free digital pins
In the following discussions, any references to wire colours
reflect those I’ve used in my illustrations, your wire colours
D1, 7, A
may vary depending on what you have available and what D1, 6, B
you decide to use. D1, 4,
D1, 2,
C
D
We’re going to leave the green and blue wires connecting D1, 1,
D1, 9,
E
F
the Arduino to our RTC on the lower breadboard as-is. In 10 9 8 7 6 D1, 10, G
D1, 5, DP
the case of the eight orange wires connecting the Arduino to
D0, 7, A
one side of the 150Ω (brown-green-brown) current-limiting D0, 6, B
D0, 4, C
resistors on the upper breadboard, I want you to leave the D0, 2, D
ends plugged into the Arduino as-is, but unplug the ends D0, 1, E
D0, 9, F
connected to the breadboard. 1 2 3 4 5 D0, 10,
D0, 5,
G
DP
In the fullness of time, we are going to deploy four 7-segment
displays, which we will call D0, D1, D2 and D3. Currently,
5V and 0V from lower breadboard

only D0 is installed on our breadboard. Our existing eight


Display number
Display pin numbers
Display segments

current-limiting resistors are connected to the eight segments


on D0 by the eight purple wires. D3 D1 D0

Now, I want you to add eight more 150Ω resistors along


with eight blue wires on the right-hand side of the upper
breadboard, as illustrated in Fig.2.
Talking about the colour choices for our wires just reminded
me of a time when not everyone had colour televisions and
BBC snooker commentator Ted Lowe famously said something
along the lines of: ‘He’s going for the pink, and for those of
you watching in black and white, the pink is next to the DO NOT ADD THIS WIRE ! REMOVE THIS WIRE !

green.’ Hopefully you are not reading a black-and-white


photocopy of this issue of PE. Fig.3. Adding and connecting the second 7-segment display (D1).

Practical Electronics | April | 2024 59


This is easy to do in practice
T o Display D 1 T o Display D 0 (it’s also easy to mess up if you
From Current-Limiting Resistors
aren’t paying attention), but it’s
@#$%^ difficult to draw as – once
again – I just discovered to my cost.
The thing is that, to make things

Upper Breadboard
D1 D0 understandable in my illustrations,

Upper Breadboard
I don’t want any of these wires to
cross each other.
When I was a kid, my dad drew
three boxes on a piece of paper and
said they represented three houses.
Then he drew three circles on the
same piece of paper and said they
BC 377 represented three utility companies
E 3 1C
(gas, water and electricity). He told
Lower Breadboard

me that my goal was to use lines

Lower Breadboard
2B
to connect each house with each
utility company without any of the
lines crossing over. He promised
me this was possible (I’m sure he
had his fingers crossed behind
his back when he said this). This
9 8 7 6 5 4 3 2 G ND 5V kept me occupied for days, so – as
From Arduino 11 10
From Arduino far as dad was concerned – it was
‘mission accomplished.’
Fig.4. Reconnecting the Arduino. Fig.5. Adding two transistors. Just for giggles and grins,
I created a drawing showing
to implement tasks like driving our piezoelectric buzzer (PE, the resistors in the upper breadboard and the wires from
December 2023 and January 2024) and communicating with the Arduino plugged into the lower breadboard – see file
our ultrasonic sensor (PE, February 2024). Once again, we CB-Apr24-05.pdf. Why don’t you download this, print it out,
may wish to add these types of functionalities into a future and try adding the requisite wires without any of them crossing.
incarnation of our clock. Once you’ve finished, compare your version to mine (Fig.4).
So, ignoring any potential additional functionalities for Yes, I’m afraid that is a somewhat self-satisfied smirk you
the moment, now that we’ve added our second display, we see plastered on my visage. I must admit that I’m rather
have 16 segments to drive and only 12 pins to drive them proud of this implementation.
with, which presents us with a bit of a poser…

Reconnecting the Arduino


As a first step, I want you to connect the free ends of the
orange wires coming from the Arduino to free rows of Components from Part 1
terminal strips on the lower breadboard. Next, I want you LEDs (assorted colours) https://amzn.to/3E7VAQE
to add more orange wires such that each signal from the Resistors (assorted values) https://amzn.to/3O4RvBt
Arduino drives the same segment on both displays. For Solderless breadboard https://amzn.to/3O2L3e8
example, we want pin 2 on the Arduino to be connected to Multicore jumper wires (male-male) https://amzn.to/3O4hnxk
the free ends of the current-limiting resistors driving the
Components from Part 2
A segments on both the D0 and D1 displays, pin 3 on the
7-segment display(s) https://amzn.to/3Afm8yu
Arduino to be connected to the free ends of the current-
limiting resistors driving the B segments on both the D0 Components from Part 5
and D1 displays, and so forth. Momentary pushbutton switches https://amzn.to/3Tk7Q87
Components from Part 6
Passive piezoelectric buzzer https://amzn.to/3KmxjcX
Online resources
For the purposes of this series, I’m going to assume Components for Part 9
that you are already familiar with fundamental con- SW-18010P vibration switch https://bit.ly/46SfDA4
cepts like voltage, current and resistance. If not, you Components for Part 10
might want to start by perusing and pondering a short Breadboard mounting trimpots https://bit.ly/3QAuz04
series of articles I penned on these very topics – see:
https://bit.ly/3EguiJh Components for Part 12
Similarly, I’ll assume you are no stranger to solder- Light-Dependent Resistor https://bit.ly/3S2430m
less breadboards. Having said this, even if you’ve used Components for Part 13
these little scamps before, there are some aspects to BC337 NPN Transistor https://bit.ly/40xAgyS
them that can trap the unwary, so may I suggest you
feast your orbs on a column I wrote just for you – see: Components for Part 14
https://bit.ly/3NZ70uF HC-SR04 Ultrasonic Sensor https://bit.ly/49AMBq4
Last, but not least, you will find a treasure trove of Components for Part 15
resources at the Arduino.cc website, including exam- Real-Time Clock (RTC) https://bit.ly/3S9OjHl
ple programs and reference documentation.

60 Practical Electronics | April | 2024


What would happen if… the current flowing through each segment there are no black wires connecting pin
This is where we arrive at the thought to 10mA. However, in addition to 3 on each display to ground (Fig.3), we
experiment we discussed earlier. reducing the brightness of the displays, are going to add two BC377 transistors,
Suppose our displays were to be wired this wouldn’t help us with the fact that two resistors and two control wires
up as shown in Fig.3. That is, with the both displays are presenting the same coming from the Arduino (Fig.5).
two black wires connecting pin 3 on values. Another, much more promising For your delectation and delight, you
each display to ground. What would solution is… can download an image of our latest
happen if we started to run one of our and greatest hardware setup including
old programs that repeatedly counts from Adding two transistors all the changes we’ve discussed in this
0 to 9 while driving the corresponding Do you remember when we used a BC377 column (file CB-Apr24-06.pdf).
segments on the 7-segment displays? transistor to vary the brightness of a single
Well, two things would occur. First, 7-segment display (PE, January 2024)? Next time
since our two displays are wired in parallel In that case, we turned the transistor on In our next column, we are going to use
(side by side), the same value would be and off very quickly, and we varied the our dual displays to first display the
presented on each display, which isn’t ratio between it being on and off to vary hours (HH) and then the minutes (MM),
tremendously useful to us in the scheme the brightness of the display. after which we will start to consider
of things. Second, since we are using Well, we are going to do something how we might further boost our clock
150Ω current-limiting resistors, each similar here. In this case, however, we to employ four 7-segment displays (be
segment will be drawing 20mA of current are going to use two transistors to ensure still my beating heart)! In the meantime,
when it’s turned on (we discussed this in that only one display is on at any time. I think it would be a good idea for you to
excruciating detail in PE, February 2023). In addition to limiting the current to a start performing your own experiments
As we now have two displays in parallel, single display at a time, this will also with our current dual display setup – just
this means the Arduino pins driving our allow us to present different values on make sure that you only ever have one
displays will have to source 2 x 20mA each display. So, after first ensuring that of our transistors turned on at a time!
= 40mA of current. They can do
this… but not for long… especially
if a lot of them are doing it at the
same time. Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor of all he
One solution to our 40mA surveys at CliveMaxfield.com – the go-to site for the latest and greatest
problem would be to double the in technological geekdom.
values of our current-limiting
resistors to 300Ω, thereby halving Comments or questions? Email Max at: [email protected]

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 Cover.indd 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 www.epemag.com

Practical Electronics | April | 2024 61


AUDIO AUDIO OUT

OUT
L R

By Jake Rothman
Back to the buffers – Part 3

F
ollowing the stripboard
designs for a discrete buffer in R12
16.2mA 47Ω
last month’s Audio Out I have +25V
*Add these parts for
produced a PCB version; this board 48V single-rail operation 0.92mA + C9
R7
will be available from the PE PCB 4.7kΩ 47µF
R4* C4 ZD1 R5 35V
4.4V R8 3.7V 3.9V
Service from next month. All the 33kΩ 1nF 10kΩ
390Ω 0V
versions of the circuit given in the C3* +
TR2
R3* BC556B R9
last issue can be built on this PCB, 2.2µF
47kΩ 15Ω +
4.8mA
25V
but it is most likely to be used for the 44V
C1 C6
0V 2.2µF
high-voltage Darlington version given 470nF
50V
TR1
VIN C8
originally in Fig.14 (shown again BC550C R11 100µF
R2 47Ω 25V
here in Fig.24 in case you missed it). 620Ω –0.8V

+
R1 C2 VO
Unlike the discrete op amp PCB, the 100kΩ 100pF 10.4mA
components are more spaced-out, TR3 R6 R14
0V 47kΩ 100kΩ
reflecting the simplicity of the circuit. MPSA29
LED1
This helps with experimentation, Red
high-efficiency
allows for big audiophile capacitors C5 +
1.13V 10µF
and is shown in Fig.25. The single-rail 10V
1.7V
R10 R13
version is shown in Fig.26. 560Ω
0.58V
47Ω
–25V
I’ve also had a few more useful buff-
ering circuit design ideas, which will be C10
47µF
the topic of this and next month’s pieces. + 35V
0V

JFET input buffer


I’m sorry, but I just can’t leave anything
Fig.24. Buffer circuit repeated from Fig.14 in Part Two (PE, March 2024).
alone! A new version of the JFET buffer
circuit (originally Fig.22) is shown 0.3% at 6Vrms). Playing with this design also removed the anti-spike components
in Fig.27. This ‘re-optimisation’ often reminded me that one of the best things R9 and ZD1. This was done because the
happens when I receive a PCB because about discrete circuits is the way the later stages in most audio systems clip
it’s easier to change parts and test com- resistor values can be optimised for any first. To run the buffer at ±25V, (match-
pared to original prototype stripboard given operating condition. ing the discrete op amp power rail) the
versions. I found I got better results with I also increased the rails to ±18V, the decoupling resistors R12 and R13 can be
the Fairchild/OnSemi J113 JFET than maximum allowable, since the JFET has increased to 470Ω.
the BF244A. They are cheaper as well, a voltage limit of 35V Vds (drain-source I was surprised to see noise curves for
around 13p each (when buying 100 from voltage). Of course, I then had to change the J111 to J113 JFETs on the OnSemi
Mouser). The distortion at 1Vrms into all the resistor values. Note that some data sheet, I always thought these devices
600Ω was 0.0008% with R8 changed components are omitted, such as the were intended for switching rather than
to 300Ω. (At 4Vrms it was 0.006%, and single-rail biasing parts, R3, R4 and C3. I audio designs. At an operating current of

Fig.25. The assembled discrete buffer amplifier. Fig.26. Single-rail version of discrete buffer amplifier. Extra biasing
parts: R3, R4, C3 and SGL supply link installed. C10 is omitted.

62 Practical Electronics | April | 2024


R12
+17.8V 15.3mA +25V

+ C9
R7
. k 100µF
C4 3V 2.4V R5 25V
270pF R8 . k
0V
TR2
BC556B
1.4mA BC143* C6 + C7
TR1 22µF 31.4V 220nF
J113 35V
R2 C1 Ib
k 100nF
IC C8
VIN 4.8mA R11 100µF
8mA 25V
IS

+
VO
R1 C2 +0.8V
47pF TR3
BC546B R6 R14
. k k
0V BC141* Fig.28. JFET buffer amplifier PCB. Note
0V *TO5 transistor the cross-legged mounting of JFET TR1
J113 for higher IC and that the output transistors TR2 and
LED1
Top view R10* 1.8V 1.8V
0.95V
Orange TR3 have been upgraded to TO5 devices.
Interchangeable D Low-bri R13
symmetric JFET S 9.5mA –25V R8 300Ω
G
*Sets IC –17.8V R9 link
15.3mA C10
100µF
+ 25V R10 100Ω
0V R11 33Ω
R12, R13 470Ω
Fig.27. JFET buffer circuit – the supply rails are ±18V and resistors R12 and R13 allow R14 100Ω
it to be used on ±25V supplies. (Overlay diagram will be provided next month.)
1.35mA, the noise voltage of the JFET is LED1 orange 3mm (or similar with a Vf Balanced buffer
2.5nV/√Hz, better than the NE5534 and of 1.8V at 5mA) Now that we have a good discrete op
equal to most expensive audio JFET op ZD1 omitted amp and buffer circuit, we can start
amps. By increasing the current up to combining them into useful audio sys-
10mA, the noise can be reduced to just Capacitors tems. The classic use of a buffer in Hi-Fi
1.3nV/√Hz, not bad at all. C1 100nF 5mm polyester 10% pre-amplifiers is to isolate the low and
C2 47pF 2.5mm ceramic 10% NP0 changing input impedance of a Baxandall
JFET buffer assembly C3 omitted tone control from the volume control, as
The JFET buffer assembled on the PCB C4 270pF 2.5mm ceramic 10% NP0 shown in Fig.29.
is shown in Fig.28. Note the link for R9 C5 10µF 10V 2.5mm pitch radial I mentioned in the last issue that
and the omitted components. Sadly, the electrolytic another pro audio use is to buffer the
pinout of the J113 JFET was different, C6 22µF 35V 2.5mm pitch radial inputs of a differential op amp circuit
not centre-gate, so a ‘leg wiggle’ was electrolytic to provide equal high input imped-
needed. Note also that the board can C7 220nF 2.5mm ceramic 20% X7R ance for good CMRR. This is shown in
accommodate TO5-cased transistors for C8 100µF 35V 5mm pitch radial Fig.30. The op amp resistors have to be
TR2 and TR3, as shown. This allows a electrolytic, non-polarised pre- kept low for low noise, resulting in a
higher output stage current if desired. ferred. Nichicon UEP1E101MPD difficult-to-drive low input impedance
It’s also much easier to fit heatsink clips from Mouser. that needs buffering. Another problem
if needed. C9, C10 100µF 25V 3mm pitch two off is that the input resistances of the dif-
ferential op amp circuit are unequal if
JFET buffer component list Resistors they are the same value resistors on both
R1 1MΩ inputs. I changed the values to equalise
Semiconductors R2 1kΩ this, giving equal loading to the buffers.
TR1 J113 N-channel JFET R3, R4 not used This ensures the even-order distortion
TR2 BC556 PNP small-signal bipolar R5 6.8kΩ harmonics produced by the buffers are
TR3 BC546 NPN small-signal bipolar R6, R7 2.2kΩ equal. These harmonics cancel out in

Low input impedance


that also varies with R is a low value for
frequency and low noise k R
High impedance control setting Buffer
does not load 3
volume control Balanced – R
input + R1 –
Baxandall VO 1 2 Low impedance
VIN Buffer tone control Unequal impedance VO
0V +
CW 0V
R
Low output
impedance Buffer R Differential
op amp circuit
Treble Bass R1 = R2 = high R2
Tone controls input impedance,
0V 0V
ty ically k to
Volume control
ty ically k 0V

Fig.29. A common use of a buffer in audio is driving a filter Fig.30. Instrumentation amplifier arrangement of a buffered
network such as a Baxandall tone control. Filters need to be differential amplifier. This gives inputs that are high impedance and
driven from a low impedance and log volume potentiometers equal impedance. The buffers also allow the resistors to have low
need to be loaded by a high impedance. values, minimising noise.

Practical Electronics | April | 2024 63


Negative resistance?
While making these changes I was surprised
to find that the input resistance on the in-
verting input of the op amp was less than
the input resistor of 1kΩ. How could this
be? The answer was that the same voltage
present on the non-inverting pin of the
op amp was also present on the inverting
pin, which is always the case with linear
op amp circuits with negative feedback.
This voltage is 180° out of phase compared
to the inverting input terminal voltage.
This increases the overall voltage across
the resistor, giving it effectively a lower
value (the opposite of bootstrapping) as
shown in Fig.32. I couldn’t find this effect
in differential amplifiers mentioned in
Fig.31. Distortion curve of differential amplifier with two JFET buffers on the inputs. any textbook, but like many odd things in
Input 1Vrms output 3.2Vrms (9.1Vpk-pk) into 600Ω. analogue design, it’s still just Ohm’s law.

ZIN
Voltage across this resistor is 1.5Vpk-pk . k
Balanced JFET
Hence, I = 1.5mA input buffer R20
esistance or . with not k
k
k 3
– –
1Vpk-pk DC-coupled
0.5Vpk-pk + outputs VO
ZIN k 1 2 +
VIN– – 0V R19
VO JFET
buffer
VIN+ +
0.5Vpk-pk
k Op amp wired as In R8 Offset
1Vpk-pk ZIN position trim
differential amplifier
ZIN k (with CMRR
k
preset in CMRR
middle position) Discrete op trim
0V amp PCB 0V

Fig.32. There is an interesting effect related to the input Fig.33. In comparison with the circuit in Fig.32, the actual resistor
impedance of the differential amplifier; both input signals are values used take into account the resistance-reduction effect
equal and anti-phase. The 1kΩ resistor on the inverting input is mentioned in the text. There is also a gain of 3.2, and the input
reduced to an effective value of 667Ω or 2/3 of its value. This impedances have been equalised. Note the preset for CMRR
assumes all differeerntial amplifer resistors are equal. adjustment and the resistor values are low for noise minimisation.
the differential op amp. I also decided to add a CMRR trim- DC coupling
mer (PR3) in the network. Looking at the final distortion The buffers can be DC coupled to the op amp inputs if desired
curves for the whole system in Fig.31, I think all this fiddly since their +0.81V offset can be easily be rejected by the dif-
tweaking and experimenting was worth it. The cancellation ferential op amp. The offset adjust preset PR1 will need to be
effect achieved was 8dB reduction on the second harmonic. tweaked to bring the output of the whole system to zero. To
do this, omit the bipolar DC blocking
capacitor C8 from both buffer boards.
By omitting these coupling capacitors,
the CMRR will be maintained at low
frequencies since electrolytics have
poor tolerances, resulting in possible
mismatching. However, there is the safety
issue of a hard DC offset being trans-
mitted to the output if there is a wiring
error or fault in one of the buffers. This
could then damage what is connected to
the output. Of course, the output could
be AC coupled, or have a DC detection
circuit and muting relay put in. The final
circuit is shown in Fig.33.
The assembly of the three PCBs is
shown in Fig.34. They will go in a nice
box one day to make a top-notch balanced
headphone amp.

Next month
We will conclude our discrete buffer
Fig.34. Connecting two buffer boards with a differential op amp to make an journey next month by looking at an op
instrumentation or headphone balanced input amplifier. I hope to tidy this up and amp buffer circuit and an interesting
build it into a decent enclosure. design called the ‘diamond buffer’.

64 Practical Electronics | April | 2024


ESR Electronic Components Ltd BACK ISSUES
All of our stock is RoHS compliant and CE Practical
approved. Visit our well stocked shop for Electronics
Electronics
all of your requirements or order on-line.

We can help and advise with your enquiry, BACK ISSUES – ONLY £5.95
from design to construction. Practical Practical Practical Practical Practical

D NA –
D NA –

IG E
IG E

PE

!
PE

ES M
N
ES M
N

N NEW E
N NEW E
Electronics Electronics Electronics


Electronics


Electronics

EW
EW
The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine
Circuit Surgery Make it with Micromite Audio Out Circuit Surgery Make it with Micromite Audio Out Circuit Surgery Make it with Micromite Audio Out Flowerpot speakers! PIC n’ Mix Circuit Surgery Make it with Micromite Audio Out Circuit Surgery
Timing and metastability Build an RGB display project Construct a Timing and metastability Fun display project How to make a Transformers Accessing Internet data Superb microphone A low-cost route to Software tools for Understanding Analogue inputs and Constructing the PE Micro-Cap 12
in synchronous circuits using a Micromite Plus transistor radio in synchronous circuits using a Micromite Plus transistor radio and LTspice with your MKC preamplifier high-quality Hi-Fi the PIC18F Differential amplifiers using servomotors Theremin amplifier simulator review

Frequency Reference Mastering Nutube Guitar WIN! Touchscreen WIN! Ultrabrite LED WIN! Don’t miss Random WIN!
WIN!
Signal Distributor RFID tags for Microchip Overdrive and Superb PE PIC Microchip Wide-range Microchip bike light Microchip
Explorer 16/32 our Super Number Microchip
MPLAB Starter Kit

your projects
Curiosity HPC
Development Distortion Pedal Development PIC24F LCD and
USB Curiosity
RCL Box
MCP19114 Flyback
Standalone
Development
Kit Summer Sale! Generator for Serial Memory
Products
Board
WIN!
Board Development
Board
Evaluation
Board WIN! WIN!

Clever Controller
Meet the for dumb chargers
Meet the Cricket: Mastering stepper Micromite
making IoT designs motor drivers Explore-28 Hi-Fi amp on
super easy! the cheap!
Programmable Robot Buggy

3D Printing • Cable • CCTV • Connectors • Components •


Thermal Programmable Ultrasound Completing the
Thermal Roadies’ Test sensing! High-power 45V/8A
Regulator Signal Generator
Regulator Variable Linear Supply
Make your own PCBs Tunable HF Making a Fun LED
with our precision Preamplifier Building the splash with Christmas
Fabulous low-cost Low-noise

Enclosures • Fans • Fuses • Hardware • Lamps • LED’s •


Solder Reflow Oven NeoPixels! Tree offer!
Concrete speakers! theremin PSU
PLUS! PLUS! PLUS! PLUS! PLUS!
Techno Talk – Tin whiskers scourge Apr 2021 £4.99 Techno Talk – No blame, no shame? Mar 2021 £4.99 Techno Talk – Bad science and good Jun 2021 £4.99 Sep 2020 £4.99 Techno Talk – Triumph or travesty? Dec 2020 £4.99
04 03 06 Cool Beans – Even cooler ping-pong ball lights! 09 12
Cool Beans – Bouncing around the Maxiverse Cool Beans – Round-up of NeoPixel effects Cool Beans – Smoothing LED colour transitions Net Work – IP security cameras Cool Beans – Mastering NeoPixel programming
Net Work – Hydrogen: a viable alternative to batteries? 9 772632 573016
Net Work – Videoconference cameras 9 772632 573016
Net Work – Lockdown technology and how we now work 9 772632 573016
Techno Talk – The perils of an enquiring mind... 9 772632 573016 Net Work – The (electric) car’s the star! 9 772632 573016

www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics

Leads • Loudspeakers • Panel Meters • PCB Production •


Power Supplies • Relays • Resistors • Semiconductors • We can supply back issues of PE/EPE by post.
Soldering Irons • Switches • Test Equipment • Transformers We stock magazines back to 2006, except for the following:
and so much more…
2006 Jan, Feb, Mar, Apr, May, Jul
Monday to Friday 08:30 - 17.00, Saturday 08:30 - 15:30 2007 Jun, Jul, Aug
2008 Aug, Nov, Dec
2009 Jan, Mar, Apr
2010 May, Jun, Jul, Aug, Oct, Nov
2011 Jan
2014 Jan
2018 Jan, Nov, Dec
2019 Jan, Feb, Apr, May, Jun
Issues from Jan 1999 are available on CD-ROM / DVD-ROM
Station Road If we do not have a a paper version of a particular
Cullercoats issue, then a PDF can be supplied – your email address
North Shields must be included on your order.
Tyne & Wear
NE30 4PQ Please make sure all components are still available before
commencing any project from a back-dated issue.
Tel: 0191 2514363 [email protected] www.esr.co.uk

STEWART OF READING
17A King Street, Mortimer, near Reading, RG7 3RS
Telephone: 0118 933 1111 Fax: 0118 933 2375
USED ELECTRONIC TEST EQUIPMENT
Check website www.stewart-of-reading.co.uk
Fluke/Philips PM3092 Oscilloscope 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
N ower lifier k d O
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 | April | 2024 65


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 [email protected]
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

66 Practical Electronics | April | 2024


DIRECT BOOK SERVICE

Teach-In 2017
The books listed here
have been selected by
the Practical Electronics
editorial staff as being
of special interest to
everyone involved

Introducing the in electronics and


computing. They are
supplied by mail order

BBC micro:bit
direct to your door.
FOR A FULL DESCRIPTION
OF THESE BOOKS AND
CD-ROMS SEE THE SHOP ON
OUR WEBSITE
PYTHON CODING ON THE BBC MICRO:BIT
Jim Gatenby www.electronpublishing.com
Python is the leading programming language, easy to learn and widely used by
professional programmers. This book uses MicroPython, a version of Python adapted
for the BBC Micro:bit. All prices include
Among the many topics covered are: main features of the BBC micro:bit including a
simulation in a web browser screen; various levels of programming languages; Mu Editor
UK postage
for writing, saving and retrieving programs, with sample programs and practice exercises;
REPL, an interactive program for quickly testing lines of code; scrolling messages, creating
and animating images on the micro:bit’s LEDs; playing and creating music, sounds
and synthesized speech; using the on-board accelerometer to detect movement of the
micro:bit on three axes; glossary of computing terms. MICROPROCESSORS
This book is written using plain English, avoids technical jargon wherever possible and
covers many of the coding instructions and methods which are common to most program-
INTERFACING PIC MICROCONTROLLERS – 2nd Ed
ming languages. It should be helpful to beginners of any age, whether planning a career in
Martin Bates
computing or writing code as an enjoyable hobby.
298 pages Order code NE48 £34.99
118 Pages Order code PYTH MBIT £7.99
PROGRAMMING 16-BIT PIC MICROCONTROLLERS IN
GETTING STARTED WITH THE BBC MICRO:BIT C – LEARNING TO FLY THE PIC24
Lucio Di Jasio (Application Segments Manager,
Mike Tooley Microchip, USA)
Not just an educational resource for teaching youngsters coding, the BBC micro:bit is a tiny 496 pages + CD-ROM Order code NE45 £38.00
low cost, low-profile ARM-based single-board computer. The board measures 43mm × 52mm
but despite its diminutive footprint it has all the features of a fully fledged microcontroller to-
INTRODUCTION TO MICROPROCESSORS AND
gether with a simple LED matrix display, two buttons, an accelerometer and a magnetometer.
MICROCONTROLLERS – 2nd Ed
Mike Tooley’s book will show you how the micro:bit can be used in a wide range of applications John Crisp
from simple domestic gadgets to more complex control systems such as those used for light- 222 pages Order code NE31 £29.99
ing, central heating and security applications. Using Microsoft Code Blocks, the book provides
a progressive introduction to coding as well as interfacing with sensors and transducers. THE PIC MICROCONTROLLER YOUR PERSONAL
INTRODUCTORY COURSE – 3rd Ed
Each chapter concludes with a simple practical project that puts into practice what the reader John Morton
has learned. The featured projects include an electronic direction finder, frost alarm, reaction
tester, battery checker, thermostatic controller and a passive infrared (PIR) security alarm. 270 pages Order code NE36 £25.00

No previous coding experience is assumed, making this book ideal for complete beginners
PIC IN PRACTICE – 2nd Ed
as well as those with some previous knowledge. Self-test questions are provided at the
David W. Smith
end of each chapter, together with answers at the end of the
book. So whatever your starting point, this book will take 308 pages Order code NE39 £24.99
THEORY AND you further along the road to developing and coding your
own real-world applications.
MICROCONTROLLER COOKBOOK
REFERENCE 108 Pages Order code BBC MBIT £7.99
Mike James
240 pages Order code NE26 £36.99

PRACTICAL ELECTRONICS HANDBOOK – 6th Ed


Ian Sinclair
440 pages Order code NE21 £33.99
BOOK ORDERING DETAILS
STARTING ELECTRONICS – 4th Ed
Keith Brindley All prices include UK postage.
296 pages Order code ELSEV100 £18.99 For postage, add £3 per book to Europe, £4 for rest of the world per book.
ELECTRONIC CIRCUITS – FUNDAMENTALS & CD-ROM prices include VAT and/or postage to anywhere in the world.
APPLICATIONS – Updated version
Mike Tooley Send a cheque, (£ sterling only) made payable to: Practical Electronics or credit card details
400 pages Order code TF43 £32.99 (Visa or Mastercard) to:
FUNDAMENTAL ELECTRICAL AND ELECTRONIC Electron Publishing Limited,
PRINCIPLES – 3rd Ed 113 Lynwood Drive, Wimborne, Dorset BH21 1UU
C.R. Robertson
368 pages Order code TF47 £21.99
Books are normally sent within seven days of receipt of order.
Please check price (see latest issue of Practical Electronics or website) before ordering from old lists.
A BEGINNER’S GUIDE TO TTL DIGITAL ICs
Robert Penfold For a full description of these books please see the shop on our website.
142 pages OUT OF PRINT BP332 £5.45 Tel: 01202 880299 – Email: [email protected]

UNDERSTANDING ELECTRONIC CONTROL SYSTEMS Order from our online shop at: www.electronpublishing.com
Owen Bishop
228 pages Order code NE35 £36.99

Practical Electronics | April | 2024 67


Practical Electronics PCB SERVICE
PROJECT CODE PRICE PROJECT CODE PRICE
APRIL 2024 APRIL 2023
Basic RF Signal Generator ......................................................CSE221001 8.99 lifier odule ............................................................see . ril
Basic RF Signal Generator (black front panel)........................CSE220902B 9.99 li
ing ndicator er channel ...............................................01112211 7.95
Silicon Chirp Cricket .................................................................08101231 7.99 elder ower Su ly one needed .................................29103221 9.95
est ench ‘Swiss r y ni e’.................................................04110221 9.99 elder ontroller one needed ........................................29103222 9.95
elder nergy Storage odule several needed ...........29103223 7.95
MARCH 2024 O niversal ual O oard ....................................... O .
igital olu e ontrol otentio eter S version ...............01101231 8.95 O Stereo recision assives kit or dual o a ...... O .
igital olu e ontrol otentio eter through hole version...01101232 9.95
dvanced S est wee ers ody.......................................04106221 6.95 MARCH 2023
dvanced S est wee ers legs air ...............................04106212 7.95 ico ack ack..........................................................................07101221 9.95
Se a hore Signal controller .................................................09103221 7.95
FEBRUARY 2024 Se a hore Signal lade .......................................................09103222 5.95
ctive ains So t Starter..........................................................10110221 10.95
FEBRUARY 2023
JANUARY 2024 esla oil driver oard..............................................................26102221 9.95
eter ...................................................................................CSE220701 8.95 esla oil otentio eter oard ................................................26102222 5.95
eter lack solder ask ....................................................CSE220704 7.95 ooling an ontroller ouds eaker rotector ...................01102221 8.95
as erry i ico ack ack...............................................07101221 8.95 e ote ate ontroller ...........................................................11009121 12.95

DECEMBER 2023 JANUARY 2023


Digital Boost Regulator.............................................................24110224 8.95 lassic etrono e ............................................23111211 7.95
ual hannel ower Su ly or read oards ........................04112221 11.95 lassic etrono e ..........................................23111212 8.95
is lay da tor or the read oard S ................................04112222 9.95 ulti hannel S eaker rotector channel ........................01101221 9.95
ulti hannel S eaker rotector channel ........................01101222 7.95
NOVEMBER 2023 e ote ontrol ange tender to .......................15109212 5.95
eter k ...........................................................................CSE220503C 9.95 e ote ontrol ange tender to .......................15109211 7.95
Su ly ilter or vehicles....................................................08108221 8.95 O niversal Single O oard..................................... O N .
iscrete udio O ................................................... O .
iscrete udio O essential co onents ........... O . DECEMBER 2022
u ing ird lifier .............................................................01111211 9.95
OCTOBER 2023 S rainer ..................................................................... .
uck oost harger da tor ...................................................14108221 9.95 S rainer arts ........................................................29106211B 13.95
reakout oard or SO arts.........................................24110225 5.95
reakout oard or arts............................................24110222 5.95 NOVEMBER 2022
reakout oard...................................................24110223 5.95 S a le tester ain .................................................04108211 12.95
uto atic rain ontroller........................................................09109221 6.95 S a le tester ront anel ................................................04108212 5.95
hu Sound odule.................................................................09109222 6.95 S a le tester o tional anel...........................................SC5970 5.95
odel ailway arriage ights ....................................09109211 6.95
SEPTEMBER 2023 O trans r standard range ....................... .
ini river.........................................................................16106221 7.95 O trans r dual outline ... ual .
New S Synchronised lock................................................19109221 9.95
ide ange Oh eter ...........................................................04109221 14.95 OCTOBER 2022
S est wee ers and air o twee er ar s............ .
AUGUST 2023 S est wee ers rogra ed SN.......... .
d ttenuator ................................................................CSE211003 9.95 ele co ............................................................................ 12110211 12.95
niversal attery harge ontroller u date ................14107192 9.95
ide ange Oh eter ...........................................................04109221 12.95 SEPTEMBER 2022
ouchscreen igital rea ain oard........................ 01103191 12.95
JULY 2023 ouchscreen igital rea ada tor oard air ............ 01103192 5.95
ulti eter hecker ali rator .................................................04107221 10.95 otor S eed ontroller ........................................ 11006211 9.95
S ectral Sound Synthesiser ull kit see . .............N N
AUGUST 2022
JUNE 2023 ulti ur ose attery anager O ander odule ... 11104212 5.95
rduino rogra a le oad...................................................04105221 8.95 ulti ur ose attery anager Switch odule.............. 11104211 8.95
uck oost river ............................................................16103221 8.95 Si le usic ey oard or switches ................... 23101213 6.95
Nano ong......................................................................... 08105212 7.95
MAY 2023
recision S Signal enerator ................................CSE211002 14.95 JULY 2022
roved S est wee ers rogra ed .................... . Silicon a s S adio.......................................... CSE210301C 10.95
O dual to uad through hole ack o five ...................... O . evel rossing ontroller .................................................. 09108211 6.95
O dual to uad S ack o five ................................... O .
O single to dual through hole ack o five ..................... O . JUNE 2022
O single to dual S ack o five ................................. O . ull wave otor S eed ontroller ..................................... 1010221 8.95
rogra ing el er or in s only.................... 24106211 7.95
rogra ing el er or or in s ........... 24106212 10.95
dvanced S o uter ................................................. 05102211 9.95

s or ost recent PE/EPE constructional ro ects are availa le. ro the uly issue onwards s with eight digit codes
have silk screen overlays and where a lica le are dou le sided have lated through holes and solder ask. hey are si ilar to
hotos in the ro ect articles. arlier s are likely to e ore asic and ay not include silk screen overlay e single sided lack
lated through holes and solder ask.
lways check rice and availa ility in the latest issue or online. large nu er o older oards are listed or ordering on our we site.
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.
ack issues o articles are availa le see ack ssues age or details.

68 Practical Electronics | April | 2024


Double-sided | plated-through holes | solder mask

PROJECT CODE PRICE PROJECT CODE PRICE


MAY 2022 JUNE 2021
Bus board PCB for Analogue Vocoder .............................. AO1-MAY22 10.95 oadies’ est Signal enerator sur ace ount version .. 01005201 £8.95
Complete set of 14 PCBs for Analogue Vocoder............... AO2-MAY22 97.95 oadies’ est Signal enerator through hole version ..... 01005202 £9.95
Programmed EEPROM for Digital FX Unit ........................ FX1-MAY22 10.95 ouchscreen ide range o esistor odule ...... 04104201
£18.95
Programmed PIC for Digital FX Unit using potentiometer....FX2-MAY22 8.95 ouchscreen ide range o nd a odule ...... 04104202
ickStart art yrator ased udio ilter.................... KS3-2021 £7.95
APRIL 2022
64-key MIDI Matrix shield .................................................. 23101211 8.95 MAY 2021
64-key MIDI Matrix switch board ....................................... 23101212 11.95 7-Band Equaliser (Mono)................................................... 01104201 £8.95
High-current Battery Balancer .......................................... 14102211 10.95 7-Band Equaliser (Stereo) ................................................. 01104202 £10.95
Digital FX Unit – using potentiometer ................................ 01102211 9.95 Car Altimeter...................................................................... 05105201 £7.95
Digital FX Unit – using BCD switch ................................... 01102212 9.95
Universal Audio PSU ......................................................... AO1-APR22 11.95 APRIL 2021
e ow Oven S ctive rossover .................... 01106193
MARCH 2022 e ow Oven S ctive rossover ront anel ......... 01106195 £19.95
Mini Isolated Serial Link..................................................... 24102211 £5.95 e ow Oven S ctive rossover .................... 01106196
Busy Loo Indicator............................................................. 16112201 £5.95 Frequency Reference Signal Distributor.................................... CSE200103 £8.95
nalogue ocoder and ass filter oard ...................... AO1-MAR22 9.95
nalogue ocoder filter oard............................. AO2-MAR22 9.95 MARCH 2021
Nutu e uitar ects edal .............................................. 01102201 £12.95
FEBRUARY 2022 rogra a le her al egulator eltier nter ace ........ 21109181
£18.95
Arduino-based Power Supply ............................................ 18106201 9.95 rogra a le her al egulator eltier river ............ 21109182
Battery Monitor Logger ...................................................... 11106201 10.95 una le rea .......................................................... CSE190502 £8.95
Electronic Wind Chimes .................................................... 23011201 10.95
nalogue ocoder river lifier................................. AO-FEB22 8.95
For the many pre-2016 PCBs that we stock please see the
JANUARY 2022 PE website: www.electronpublishing.com
Vintage battery Radio Li-ion Power Supply ....................... 11111201 9.95
MiniHeart: A Miniature Heartbeat Simulator ...................... 01109201 8.95

DECEMBER 2021
PE/EPE PCB SERVICE
AM/FM/SW Digital Receiver .............................................. CSE200902A 13.95 Order Code Project Quantity Price
Balanced Input and Attenuator for USB CODEC............... 01106202 11.95
.........................................................
NOVEMBER 2021
Dual Battery Lifesaver ....................................................... 11111202 £6.95 .........................................................

OCTOBER 2021 .........................................................


Mini Wi-Fi LCD BackPack ................................................. 24106201 £8.95
.........................................................
SEPTEMBER 2021
USB SuperCodec PCB...................................................... 01106201 £14.95 .........................................................
Audio DDS Oscillator PCB ................................................ 01110201 £5.95
Audio DDS Oscillator rotary encoder................................. 01110201-ENC 6.95
Programming Adaptor Board for Audio DDS Oscillator ..... 01110202 £5.95
Name . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
High-power Ultrasonic Cleaner main PCB ........................ 04105201
£14.95 Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
High-power Ultrasonic Cleaner front-panel PCB ............... 04105202
Night Keeper Lighthouse PCB........................................... 08110201 £5.95 .........................................................

AUGUST 2021 el . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ol’ i er .................................................................... 19104201 £11.95 Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Ol’ i er odule using S ............. 19104201-88 £8.95
Ol’ i er set o acrylic case ieces and s acer ................ 19104201-ACR £8.75 I enclose payment of £ . . . . . . . . . . . . . . (cheque/PO in £ sterling only)
Ol’ i er S wide SO ................................ .
Wideband Digital RF Power Meter .................................... 04106201 £9.75 payable to: Practical Electronics
Switchmode 78xx regulators (PACK of 5!) ....................... 18105201 £7.95
Cool Beans SMAD display ................................................ . Card No . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
JULY 2021 Valid From . . . . . . . . . . . . . . . . . Expiry Date . . . . . . . . . . . . . . . .
tiny reakout ev oard with a acitive ouch ... 24110181 £9.75
IR Remote Control Assistant (Jaycar version)................... 15005201 £8.95 Card Security No . . . . . . . . . .
IR Remote Control Assistant (Altronics version)................ 15005202 £8.95
PIC18F Development Board.............................................. PNM-JUL21 £12.95 You can also order PCBs by phone, email or via the shop
icro hone rea lifier.......................................................AO-JUL21 £11.95 on our website: www.electronpublishing.com

No need to cut your issue – a copy of this form is just as good!

ll rices include and . dd er 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: [email protected]
On-line Shop: www.epemag.com
he ues should e ade aya le to ‘ ractical lectronics’ (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 | April | 2024 69


Practical Electronics PCB SERVICE
PROJECT CODE PRICE PROJECT CODE PRICE
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
Nutu e alve rea lifier ................................................. 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
here in lifier....................................................... 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
ower Su ly ront anel five way dis lay e el.. 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
recision Signal lifier .................................................. 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
igh current Solid state attery solator o ... 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


ltra low distortion rea lifier n ut Selector......................... 01111112 2× 12V Battery Balancer ................................................... 14106181 £5.95
£11.25
ltra low distortion rea lifier ush utton n ut Selector ..... 01111113 Deluxe Frequency Switch.................................................. 05104181 £10.45
Universal Regulator .................................................................... 18103111 £7.95 USB Port Protector ............................................................ 07105181 £5.95
ireless ata e eater .............................................. 15004191 £8.50
ridge ode da tor or lifier............................................. 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
APRIL 2020 +Processing Board ............................................. 04101182 £8.60
Flip-dot Display black coil board................................................. 19111181
Flip-dot Display black pixels ....................................................... 19111182
£14.95
FEBRUARY 2019
Flip-dot Display black frame ....................................................... 19111183 1.5kW Induction Motor Speed Controller........................... 10105122 £24.95
Flip-dot Display green driver board............................................ 19111184
NOVEMBER 2018
Super-7 AM Radio Receiver .............................................. 06111171 £15.95

70 Practical Electronics | April | 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: [email protected] 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
www.bowood-electronics.co.uk 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
www.bowood-electronics.co.uk 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 WWW.COASTELECTRONICS.CO.UK
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? www.electricalcharity.org
Circuits Electric Machinery Mechatronics
For free stock list and/or advice, please Web: www.akennypatentm.com
contact me: [email protected] COMPONENTS AS JOB LOT
Email: [email protected]
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: [email protected]
Visit www.cstech.co.uk

ADVERTISING INDEX
CRICKLEWOOD ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . 55 Advertisement offices
ESR ELECTRONIC COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . 65 Matt Pulzer
FLOWCODE. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
HAMMOND ELECTRONICS Ltd . . . . . . . . . . . . . . . . . . . . . . . . . . 11
Electron Publishing Ltd
JPG ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
1 Buckingham Road
MICROCHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cover (ii)
Brighton
PEAK ELECTRONIC DESIGN. . . . . . . . . . . . . . . . . . . . . . Cover (iv) East Sussex BN1 3RA
POLABS D.O.O.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 22 Tel 07973 518682
QUASAR ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Email [email protected]
SILICON CHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
STEWART OF READING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 65 Web www.electronpublishing.com
TAG-CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55
TERRINGTON COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 For editorial contact details see page 7.

Practical Electronics | April | 2024 71


Next Month – in the May issue
Dual RF Amplifier for Signal Generators
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.

GPS-Disciplined Oscillator
The GPS-Disciplined Oscillator (GPSDO) is built almost
entirely in software, so it only requires a PIC, an oven-
conditioned crystal oscillator and a few other supporting
parts. It provides an extremely accurate 10MHz signal with
an error in the parts per billion range.

UVM-30A Module Ultraviolet Light Sensor


Learn how to use this ultraviolet (UV) light-sensing ‘breakout’
module. It detects the intensity of UV solar radiation and hence
the degree of protection you may need to prevent skin damage.
If you connect it to an Arduino or other microcontroller, it can even
indicate the current ‘UV Index’.

PLUS!
All your favourite regular columns from Cool Beans and
Circuit Surgery, to MitchElectronics, Teach-In, Techno Talk
and Net Work. On sale 4 April 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: [email protected]
T: 01246 211 202
E: [email protected] 2. Visit our shop at: www.electronpublishing.com
JPG Electronics, Shaw’s Row,
Old Road, Chesterfield, S40 2RB
3. Send a cheque (payable to: ‘Practical
W: www.jpgelectronics.com 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: www.electronpublishing.com

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: [email protected]. 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 | April | 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 pre mierOut
Audio
electro
LTspice 24 update and Digital input and output
Circuitwith Designing
nics an
Frequency Response Analysis LTspic Surgerydiscrete buffers
the ESP32 SoC microcontroller d com
e 17.1 a puting
Respo n
nse An d Frequenc Teach maker
alysis y A -In 2 02 magaz
new s 4
with th eries on lea
ine
e ESP3 rn
2 SoC ing electronic Audio
O
microc
ontrolle s Design ut
in
r discrete g
Digita buffers
Volum l
Potente Control
iomete
r
‘Swiss Army Knife’ WIN!
Basic RF Automated
Buildin Test Bench PICM3ic2MroKchMip
Signal Mains g the Active Devrieolospitmy ePnrot
Cu CJ

Generator WIN! Soft S Board


Microchip tarter
Explorer 8
Teach
Development
-In 2
n to us024
Kit
WIN!Lear
e the E
Teach-In 2024 SP32
Learn to use Silicon Chirp
the ESP32 Build your own
pet cricket Adv
Test anced S
PLUS! Twe M
PLUS!
Techno Talk – Wait! What? Really? Apr 2024 £5.99 ezer D
Techn
Cool Beans – Arduino: expanding the oT
7-segment display
04
s
alk – T
Cool B he ib
Net Work – Label printers, smart home ans – andW
edevices SMRsbly-W9 772632 573030
obbly
Net W Arduin World
ork – C o: exp
www.electronpublishing.com anding
ookies practicalelectronics
@practicalelec
of Qua
www.e , priva bread ntum Mar 20
lectro c y and on board 24
npubli lin design £5.99
shing e advertis s
.com ing 03
@prac 9 772
ticale
632 5
73030
lec
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.

www.electronpublishing.com

You might also like