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

Aug24 Int

The August 2024 issue of Practical Electronics features various projects including an LC and ESR meter, a WebMite-based watering system controller, and a teach-in series on using the ESP32 microcontroller. It also highlights advancements in cybersecurity with the PIC32CK SG MCU, which integrates advanced security features for compliance with stringent standards. Additionally, the magazine includes articles on online security, audio equipment design, and a variety of electronic kits available for purchase.

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

Aug24 Int

The August 2024 issue of Practical Electronics features various projects including an LC and ESR meter, a WebMite-based watering system controller, and a teach-in series on using the ESP32 microcontroller. It also highlights advancements in cybersecurity with the PIC32CK SG MCU, which integrates advanced security features for compliance with stringent standards. Additionally, the magazine includes articles on online security, audio equipment design, and a variety of electronic kits available for purchase.

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

Practical

Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Teach-In 2024 Audio Out
Topics in digital signal processing Create a Wi-Fi Access Point with Mechanical
– the frequency domain the ESP32 SoC microcontroller switches in audio

WebMite
Watering
System
Controller

WIN!
Microchip
PolarFire SoC
Discovery Kit
WIN!

Teach-In 2024 Arduino-based


Learn to use L/C+ESR Meter
the ESP32
WebMite: PicoMite
meets the Web

PLUS!
Techno Talk – That makes so much sense! Aug 2024 £5.99
08
Cool Beans – DIY logic probes
Net Work – Passkeys and online security 9 772632 573030

www.electronpublishing.com @practicalelec practicalelectronics


Meet New Cybersecurity Mandates Easily:
PIC32CK SG MCU
Arm® Cortex®-M33 Core With HSM and TrustZone® Technology
In anticipation of stringent cybersecurity standards, our PIC32CK SG MCU is your solution for addressing
the pressing cybersecurity challenges without compromising performance.

The PIC32CK SG MCU family combines the security of a fully isolated Hardware Security Module with
Arm’s TrustZone® secure partitioning. This provides defense in depth against cyber-attacks for the most
demanding applications.

Designed as a mid-range MCU, the PIC32CK SG MCU integrates advanced hardware security subsystems to
surpass regulatory requirements effortlessly. With a high level of cyber protection integrated, designers can
ensure their products meet and exceed cybersecurity mandates without sacrificing efficiency or speed.

Key Features
• Based on Cortex-M33 at 120 MHz
• 2 MB Dual Panel Flash/512 KB RAM for complex system
• 10/100 Ethernet, USB, CAN-FD, I2S, I2C
• Advanced key management
• Certificate authority
• Secure boot

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.
© 2022 Microchip Technology Inc. All rights reserved.
microchip.com/PIC32CKSGMCU MEC2572A-UK-06-24
Practical
Volume 53. No. 8
August 2024
ISSN 2632 573X

Electronics Contents
Projects and Circuits
LC and ESR Meter by Steve Matthysen 16
This enhancement to our Wide-Range Digital LC Meter (June 2019) adds capacitor
ESR measurement – useful for diagnosing faulty equipment because increasing ESR
over time is one of the most common ways electrolytic capacitors fail.
WebMite by Geoff Graham with firmware by Peter Mather 28
What happens when the PicoMite meets the web? Find out with this powerful project
that combines a Raspberry Pi Pico with MMBasic, Wi-Fi and Internet connectivity.
We put it to good use in this month’s Watering System Controller
WebMite-based Watering System Controller by Geoff Graham 34
This advanced Watering System Controller does it all. It can change the watering
schedule depending on the seasons, check the weather forecast before watering and
alert you to a burst pipe or blocked sprinkler. Best of all, it’s easy to set up and use.

Series, Features and Columns


Techno Talk by Max The Magnificent 8
That makes so much sense!
Net Work by Alan Winstanley 10
Reports on passkeys to improve online security and eliminate password logins, plus
the transfer of data to a new phone – some hints and tips.
Circuit Surgery by Ian Bell 44
Topics in digital signal processing – the frequency domain
Audio Out by Jake Rothman 48
Switching in audio equipment – Part 3
Max’s Cool Beans by Max The Magnificent 52
Arduino Bootcamp – Part 20
Teach-In 2024 – Learn electronics with the ESP32 by Mike Tooley 60
Part 6 – the ESP32 as a Wi-Fi Access Point

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
Exciting news!
Exclusive Microchip reader offer 9
Win a Microchip PolarFire SoC Discovery Kit
PE Teach-In 9 27
Teach-In bundle – what a bargain! 33
PE Teach-In 8 43
Classified ads and Advertiser index 69
Practical Electronics PCB Service 70
PCBs for Practical Electronics projects
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 September 2024 issue of Practical Electronics will be
published on Thursday, 1 August 2024 – see page 72.

Practical Electronics | August | 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 Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out
LTspice 24 update and Digital input and output with Designing Topics in digital signal Analogue input and output with Designing Topics in digital signal Using LED displays with the ESP32 Mechanical Topics in digital signal processing Sensing the environment with Mechanical Topics in digital signal processing Create a Wi-Fi Access Point with Mechanical
Frequency Response Analysis the ESP32 SoC microcontroller discrete buffers processing – sampling the ESP32 SoC microcontroller discrete buffers processing – ADCs SoC microcontroller switches in audio – sample and hold the ESP32 SoC microcontroller switches in audio – the frequency domain the ESP32 SoC microcontroller switches in audio

WebMite
WIN!
Microchip Watering
Curiosity HPC
Development
Loudspeaker System
Board Make your Controller
WIN! Test Jig own Dynamic
RFID tags WIN!
‘Swiss Army Knife’ Dual RF Amplifier Microchip
GPS-Disciplined Heart Rate PolarFire SoC
Basic RF Automated Test Bench Oscillator Reciprocal
Discovery Kit
Sensor Module WIN!
Signal Mastering Frequency Counter
Generator WIN!
the UVM-30A
Microchip
Explorer 8 Wi-Fi Time Source Teach-In 2024
Development UV Sensor for GPS Clocks Arduino-based
Kit
WIN! Learn to use L/C+ESR Meter
Teach-In 2024 the ESP32
Teach-In 2024 Learn to use
Teach-In 2024 Teach-In 2024 the ESP32
Learn to use Silicon Chirp Learn to use Learn to use WebMite: PicoMite
the ESP32 Build your own the ESP32 the ESP32 meets the Web
Songbird: an ideal
pet cricket beginner’s project Pi Pico-based
Thermal Camera
PLUS! PLUS! PLUS! PLUS! PLUS!
Techno Talk – Wait! What? Really? Apr 2024 £5.99 May 2024 £5.99 Jun 2024 £5.99 Jul 2024 £5.99 Aug 2024 £5.99
04 Techno Talk – One step closer to a dystopian abyss? 05
Techno Talk – Program that! 06
Techno Talk – Who saw that coming? 07
Techno Talk – That makes so much sense! 08
Cool Beans – Arduino: expanding the 7-segment display Cool Beans – Arduino: 7-segment display delights Cool Beans – Arduino: 7-segment display delights Cool Beans – Arduino: 7-segment display decoders Cool Beans – DIY logic probes
Net Work – Label printers, smart home devices and SMRs 9 772632 573030
Net Work – Electric cars, Moon-shot missions and more 9 772632 573030
Net Work – GaN USB chargers, solid-state EV battery 9 772632 573030
Net Work – Practical advice on electronics repairs 9 772632 573030
Net Work – Passkeys and online security 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 | August | 2024


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

9 771030 266001
$1150* NZ $1290
05

INC GST
INC GST

Melbourne Exhibition Centre,


May 10-11

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

Australia’s top electronics magazine


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

Print Combined Online


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

• Combined subscriptions include both the printed magazine and online access.
Wideband
• Prices are in Australian dollars (AUD) unless otherwise specified. Fuel Mixture Display;
• Prices listed are for everywhere in the world except Australia and New Zealand. April to June 2023
View 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. 8
August 2024
ISSN 2632 573X

Electronics Editorial
Editorial offices
Practical Electronics Tel 01273 777619 Exciting News!
Electron Publishing Limited Mob 07973 518682 Change is in the air. Practical Electronics is the world’s longest-
1 Buckingham Road Fax 01202 843233
Brighton Email [email protected] running hobby electronics magazine. Our first issue came out in
East Sussex BN1 3RA Web www.electronpublishing.com November 1964 when commercial transistors had been available
Advertisement offices
for less than a decade and ICs were only just beginning to appear
Practical Electronics Adverts Tel 01273 777619 – at eye-watering prices that only NASA could afford. Many fine
1 Buckingham Road Mob 07973 518682 magazines have appeared (and sadly disappeared) in the last 60
Brighton Email [email protected]
East Sussex BN1 3RA years, but PE has endured and thrived. I’m sure that one of the
main reasons PE has survived is the quality of its content – thanks
Editor Matt Pulzer
General Manager Louisa Pulzer
to the very hard work of all who write and work for the magazine.
Digital subscriptions Stewart Kearn Tel 01202 880299 But there is another reason – we’ve never been afraid to change,
Online Editor Alan Winstanley
Web Systems Kris Thain
and now it’s time for a new chapter in PE’s long-running story. We
Publisher Matt Pulzer are joining the Silicon Chip publishing stable.

Print subscriptions
Practical Electronics Subscriptions
What does this mean for Practical Electronics?
PO Box 6337 Silicon Chip is an Australian magazine with which we have
Bournemouth BH1 9EH Tel 01202 087631 shared content since the beginning of 2008. They have provided
United Kingdom Email [email protected]
sophisticated projects of the highest quality and it’s been a
Technical enquiries very successful relationship. So successful in fact, that when
We regret technical enquiries cannot be answered over the
telephone. We are unable to offer any advice on the use, purchase,
I mentioned to its editor/publisher Nicholas Vinen that I was
repair or modification of commercial equipment or the incorporation thinking of retiring we decided to work out a way to ensure PE
or modification of designs published in the magazine. We cannot wouldn’t retire with me.
provide data or answer queries on articles or projects that are
more than five years old.
So, the big question is where does PE go from here? The short
Questions about articles or projects should be sent to the editor
by email: [email protected]
answer is most things will stay exactly as they are. All of PE’s
authors will continue to contribute exactly as they do now. Nicholas
Projects and circuits is absolutely clear that PE must not become a ‘Silicon Chip light’,
All reasonable precautions are taken to ensure that the advice and
data given to readers is reliable. We cannot, however, guarantee that would be pointless. If anything, the magazine will get better –
it and we cannot accept legal responsibility for it. Nicholas intends to up the pagination which means more pages and
A number of projects and circuits published in Practical Electronics
more content, all of which will benefit you the reader.
employ voltages that can be lethal. You should not build, test,
modify or renovate any item of mains-powered equipment unless Thank you
you fully understand the safety aspects involved and you use an
RCD (GFCI) adaptor. I first started working on PE nearly 30 years ago with a small job
producing its circuit diagrams. In 2008 Mike Kenward, the editor/
Component supplies publisher asked me if I’d consider becoming PE’s editor. I jumped
We do not supply electronic components or kits for building the
projects featured, these can be supplied by advertisers. We at the opportunity, and it’s been an exciting and rewarding role.
advise readers to check that all parts are still available before Then, at the start of 2019 I became publisher, just in time to catch
commencing any project in a back-dated issue.
the full brunt of the pandemic, but we survived!
Advertisements
Although the proprietors and staff of Practical Electronics take Throughout my time with PE I have had fantastic support from
reasonable precautions to protect the interests of readers by
ensuring as far as practicable that advertisements are bona fide, our many talented contributors – PE is nothing without its creative
the magazine and its publishers cannot give any undertakings scribes – thank you one and all; in no particular order: Alan
in respect of statements or claims made by advertisers, whether
these advertisements are printed as part of the magazine, or in Winstanley, Jake Rothman, Ian Bell, Clive ‘Max’ Maxfield, Mike
inserts. The Publishers regret that under no circumstances will Tooley, Julian Edgar, Mike Hibbett, Phil Boyce, Mark Nelson,
the magazine accept liability for non-receipt of goods ordered, or
for late delivery, or for faults in manufacture.
Barry Fox, Stewart Kearn, Kris Thain, the late John Becker, Mike
Kenward… and to anyone I’ve left off this list, apologies! Last, but
Transmitters/bugs/telephone equipment by no means least, thank you to all our many loyal readers and
We advise readers that certain items of radio transmitting and
telephone equipment which may be advertised in our pages
subscribers. You’ve kept us going and I’m sure your continued
cannot be legally used in the UK. Readers should check the law support will enable Nicholas to carry on bringing you the very best
before buying any transmitting or telephone equipment, as a fine,
in electronics publishing over the coming years.
confiscation of equipment and/or imprisonment can result from
illegal use or ownership. The laws vary from country to country;
readers should check local laws. Matt Pulzer
Publisher

Practical Electronics | August | 2024 7


That makes so Techno Talk
much sense! Max the Magnificent

I’m always amazed by the cunning creations of the pioneers of yesteryear, especially when I consider
the rudimentary sensors they had at their disposal. I often wonder what their reactions would be to
see the sophisticated sensors we have available to us today.

A
s usual, my poor old noggin a series of 20-minute movies, and later modulated continuous wave (FMCW)
is full of random thoughts bounc- shown in the 1950s and 1960s on TV. approach that can provide distance and
ing around like super balls on Buck sported a ray gun in the form velocity data on a pixel-by-pixel basis,
steroids. The topic that has currently of a ‘U-235 Atomic Pistol’. The reason I allowing them to perceive and identify
captured my attention is that of sensors. mention all this is that the first practical objects more than a kilometer away.
What pops into your mind when you photoelectric cells were invented in the Meanwhile, companies like Owl
hear (or see) the word ‘sensor’? Living 1880s. In 1955, Zenith introduced the Autonomous Imaging are creating long-
in an age of wonders as we do, you may world’s first wireless television remote wave infrared (LWIR) thermal focal plane
be thinking of highfalutin’ devices like control called the Flash-Matic. Looking arrays (thermal imagers). The signals
lidar (laser detection and ranging) or like something Buck Rogers would not from these images can be employed by
radar (radio detecting and ranging) . be ashamed to be seen carrying, this glo- AI to perform object detection, classifi-
When we boil things down, however, a rified torch (flashlight) employed a beam cation and ranging. As the folks at Owl
sensor is any device that detects some of light to activate four photocells locat- told me, ‘Within five years, all new cars
physical phenomenon and produces a ed at the corners of the screen, thereby will be able to see at night!’
corresponding output signal. allowing the user to control the volume
For our purposes here, we will as- and channel selection. That’s deep!
sume electrical output signals in terms Have you ever thought about our amaz-
of voltage or current being used to feed Mobile sensor platforms ing ability to perceive the world around
electrical or electronic systems, but this Do you remember the artificial intelli- us in three dimensions? Powered by our
isn’t cast in stone. gence (AI) called KITT (Knight Industries optical sensors (eyes) and associated com-
Two Thousand) powering the highly ad- puters (brains), we call this ability ‘depth
Victorian fax machines vanced, very mobile, robotic automobile perception.’ There are many aspects to
Can you imagine the Victorians sending in the Knight Rider TV series of the 1980s? this, but we start with the fact that each
faxes to each other? This may seem far- Today’s cars are getting close to (some- of our eyes sees a slightly different im-
fetched, but in 1842, a Scottish engineer times they surpass) KITT’s capabilities. age due to their separation in our heads.
and inventor called Alexander Bain came My own 2019 Subaru Crosstrek is The resulting disparities are processed
up with a cunning idea. He created an equipped with binocular vision that can in the visual cortex of our brains to yield
image to be transmitted by cutting it out be used to detect and correct any drifting depth information.
of a thin sheet of tin. He placed this metal out of lane, vary the speed of the cruise Even with one eye closed, we can still
image on a movable insulated base and control if we get too close to a car in front, do things like track and catch a ball head-
connected it to one side of a battery. The and slam on the breaks if it feels we are ing our way. In this case, our brains make
base was slowly passed under a swing- in danger of imminent collision. All of use of visual cues, including knowing
ing pendulum formed from a conducting this is made even more exciting by my how big we expect objects to be, and our
wire with a weighted point on the end. wife screaming in my ear. understanding that if an object appears
Whenever this point connected with the In fact, today’s autonomous cars and to be growing bigger, then this may be a
metal image, it completed the electrical robots are essentially mobile sensor and good time to duck.
circuit, thereby converting the dark and computing platforms. A very common In the case of machine vision, one of
light areas of the image – which were scenario is to have multiple cameras the components of depth perception
represented by the presence or absence equipped with CMOS sensor arrays that is the ability to create a 3D depth map
of tin – into an electrical signal. are sensitive to light in the visible part (point cloud) of the scene. We can do
This cunning creator used this electri- of the spectrum. These feed advanced this using two CMOS sensors to pro-
cal signal to activate a relay attached to processors running AI algorithms that vide binocular vision, but that increases
the end of another pendulum that was can perform tasks like object detection the cost. We can employ a single CMOS
swinging back and forth over a second and recognition. sensor in conjunction with an AI, us-
moving bed. The activated relay caused These cameras can be augmented by ing its understanding of the scene to
an attached pencil to encounter a piece of lidar and radar sensors. The original li- determine where and how big things
paper laying on the moving bed, thereby dars were big, bulky, and expensive, are in 3D space, but this requires a lot
reproducing the original image in metal but new versions are coming online in of computation.
as a drawing in pencil. which almost everything is implemented The folks at a company called AIRY3D
in semiconductor form. As opposed to have come up with a way to use a single
Ray guns and TV controllers a simple time-of-flight (TOF) approach CMOS sensor to generate both a regu-
Did you ever see the original Buck Rogers which involves generating powerful puls- lar 2D image and a 3D point cloud on a
science fiction serial from 1939 starring es of light and measuring the round-trip pixel-by-pixel basis with very little com-
Buster Crabbe? Filmed in glorious black- time of any reflections, companies like putation. I don’t know about you, but
and-white, this was originally released as SiLC Technologies are using a frequency I certainly didn’t see this one coming!

8 Practical Electronics | August | 2024


Exclusive offer

Win a Microchip PolarFire


SoC Discovery Kit
Practical Electronics is offering its readers the chance to win CPU cluster based on the RISC-V Instruction Set Architecture
a Microchip PolarFire SoC Discovery Kit (MPFS-DISCO-KIT) – (ISA). A large L2 memory subsystem can be configured for
and even if you don’t win, receive a 15%-off voucher, plus free performance or deterministic operation and supports an
shipping for one of these products. asymmetric multi-processing (AMP) mode.

The PolarFire SoC Discovery Kit features a quad- The board includes support for Microchip’s Mi-V
core, RISC-V application-class processor that
supports Linux and real-time applications, a Worth ecosystem, a MikroBUS expansion header
for Click Boards and a 40-pin Raspberry Pi
rich set of peripherals and 95K of low-power,
high-performance FPGA logic elements. This
$132.00 connector, as well as a MIPI video connector.
The expansion boards can be controlled
fully featured, yet low-cost kit allows the rapid (approx £104.50) using protocols like I2C and SPI. One
testing of application concepts, development
of firmware applications, programming and
each GB of DDR4 memory is available, as well
as a microSD card slot for booting Linux.
debugging of user code. Communication interfaces include one Gigabit
Ethernet connector and three UART connections
The Discovery Kit is built around the PolarFire via the USB type C connector. An on-board FlashPro5
MPFS095T SoC FPGA that features an embedded programmer is available to program and debug the PolarFIre
microprocessor subsystem consisting of a quad-core, 64-bit FPGA through a USB-to-JTAG channel.

Free-to-enter competition

Microchip Microchip
Win a Microchip MPFS-DISCO-KIT
PolarFire SoC
Discovery Kit

How to enter June 2024 winner


For your chance to win a Microchip PolarFire David Izzard
SoC Discovery Kit or receive a 15%-off voucher,
including free shipping, enter your details in the
online entry form at:
https://page.microchip.com/PE-SoC.html

Closing date David won a


The closing date for this offer is 31 July 2024
Microchip Curiosity HPC Development Board

Practical Electronics | August | 2024 9


Net Work
Alan Winstanley
This month’s column explains how the use of passkeys improves online security and eliminates
password logins. The author also transfers data to a new phone and shares some hints and tips.

E
very web user will recognise liable to forget where you last left your Common Captcha screens ask ‘how many
the annoying requirement to password book, they’re not a good idea. traffic lights’ or ‘what is four times two’, or
log into any website that retains A limited choice of online password they may ask users to drag a jigsaw puzzle
a user’s personal details. Even trivial managers is available that automates the piece into position, but advanced hacking
online transactions usually involve task of logging in or filling in online forms. can nevertheless still defeat some of them.
inputting our name, address, mobile In the author’s case, having accumulated Admittedly, even I struggle to make sense
number and email address. Some even over 400 different logins over time, online of some Captcha screens, but, sadly, the
impertinently ask for our date of birth, security has been managed for 15 years ones who struggle most with this hurdle
or they might offer to remember debit with Roboform password management are those with vision problems who rely
and credit card numbers as well, an software. Roboform has been established on screen reader software to surf the web.
offer I never accept! 25 years and is something of an unsung Web page screens that say ‘I am not a
Much has been written about the need hero in my opinion, as without it, life at a robot’ might seem deceptively simple or
to use a mix of special characters that busy desk would soon grind to a halt; it’s pointless, but they’re designed to be screen-
makes passwords harder to guess. The one of the very few online services that reader friendly, and Google’s reCAPTCHA
old idea of substituting alpha characters I’m happy to invest time and money in, v3 doesn’t need a challenge at all.
with numbers (called ‘leetspeak’) such and it also works across mobile devices. Another log-in annoyance is the
as p455w0rd has fallen out of fashion, It’s a powerful programme with many cookie opt-out screen, necessitated
and probably the best practical advice features and a few quirks, and you soon by the European GDPR and ePrivacy
is to use a ‘passphrase’ of several words wonder how you managed without it. Directive. Cookie screens have spread
and maybe a special character at the end, Another popular password manager is like a rash across the web, and seem
such as: bread-coffee-7281#. A longer LastPass, a product that has suffered at intended to punish website visitors
string of random words makes passphrases least two security breaches in the recent seeking to safeguard their own privacy.
even harder to guess, for example: past. The Tech Republic website doesn’t Standardised cookie modules are often
tulip.sugar.lawn.yoyo. recommend LastPass for that
To help users to memorise their reason alone, and tech website
passwords, I’ve noticed how special The Verge reckons LastPass
notebooks are sold, helpfully labelled may ‘have a lot of work to do
‘Password Book’ or similar, which would if it wants people to trust it
undoubtedly be goldmines in the wrong again’. LastPass is striving hard
hands. Recording logins and PINs openly to restore credibility and has
in clear print this way would also breach now implemented a minimum
the terms and conditions of banks and standard of 12-character
credit card providers, rendering the passwords. Others to try
account holder entirely liable for any include highly-rated NordPass
losses caused by fraud. If you can’t (https://nordpass.com) and
remember logins, and you’re maybe 1Password (https://1password.
com). Obviously, you must also
safeguard access to your PC and
any password manager software
as well, so explore those security
options carefully.

Crumbling cookies
During the log-in process,
users are often interrupted by a
‘Captcha’ screen, which aims to
prevent automated scanning or
hacking of a website by ‘bots. A
Captcha (Completely Automated
P u b l i c Tu r i n g t e s t t o t e l l
Computers and Humans Apart)
‘challenge-response’ causes a
user to physically respond to a
This Captcha screen uses a sliding jigsaw question, supposedly proving Some cookie opt-out screens make it onerous for users
puzzle piece to confirm you’re really human. that a real human is logging in. wanting to opt out of receiving unwanted cookies.

10 Practical Electronics | August | 2024


Apart from being hard to remember,
another major problem with passwords
is that, despite using multiple words and
special characters to defeat hackers, they’re
inherently insecure in the first place, simply
because users can be tricked into revealing
them through the use of fraud or phishing
scams, for instance. Or maybe that Password
Book could be stolen or lost.
A phishing email or a highly targeted
‘Take Five’ is a UK Government campaign spearphishing mail may trick a victim into
with lots of resources to highlight the risks visiting a fraudulent website, where the Major websites such as eBay offer to
of scams, fraud and identity theft. password can be captured by crooks, or create passkeys for users – they’re far more
secure and easier to use than passwords,
ransomware could be downloaded onto a
and are worth setting up on your device.
used on websites. The smartest ones visitor’s computer. Some phishing emails
have a simple ‘Reject All’ or ‘Essential can be highly convincing, especially if to offer alternative logins using much
only’ button allowing users to quickly they are timely ones (eg, one supposedly more secure passkeys. These are fully
opt-out before proceeding, while others from ‘DHL’ arrives when I really am encrypted and use a unique ‘private’
annoyingly require visitors to opt out waiting for a DHL delivery), and even the key on the user’s device together with
of a dozen ‘legitimate interest’ cookies, author has had to hit the brakes once or a corresponding ‘public’ key stored by
one by one. As often as not, this latter twice before clicking a likely-looking link. an online service. Old hands will recall
type gets a thumbs down from the author It’s so easy to fall for this type of fraud PGP (Pretty Good Privacy) which was
and I will simply go elsewhere instead. when busily working online; as the UK’s one of the few ways of encrypting or
As an aside, web surfers will often see National Cyber Security Centre (NCSC) signing messages or transactions using
click-through URLs containing strings of says, ‘Asking users to examine, in depth, PGP keypairs. Put simply, it’s rather like a
characters that register web server statistics every email they receive will not leave user giving out open padlocks (the public
(Google Analytics) – an example might be: enough hours in the day for work tasks. key) to all and sundry, asking them to lock
https://anywebsiteurl.com/ It’s an unrealistic and counter-productive up messages with them before delivering
?utm_source=google&utm_medium= goal because responding to emails and them to you. It doesn’t matter who has
emaillist&utm_campaign= clicking links is an integral part of an open padlock, because you’re the
128465419&utm_content= work.’ The Government advice to guard only one with the (private) key who can
468754&utm_term=cookietest&ad_ against these threats is to ‘Take Five’, see: open them again. The private key is then
source=2&gclid=Cj... etc. www.takefive-stopfraud.org.uk safeguarded on your device by a PIN, a
The term ‘UTM’ means ‘urchin tracking Take Five contains many educational password or biometrics like fingerprints
module’ which is Google’s website resources, web banners and information or facial recognition. Accessing the private
analytics at work. The string might that can help to spread the word: if you’re key also proves that you are physically in
include search terms, your username or involved with a local Facebook group or control of the device on which it is stored.
email address in plain text or other data have vulnerable friends or relatives, the Websites including PayPal, eBay and
that identify trends and visitor behaviour Take Five campaign is a timely reminder Amazon now offer to set up passkeys as
in the stats. Facebook does the same, and of these potential risks and it’s worth logins and they are an excellent idea for
the string ...url/?fbclid=blah... directing them to it. safeguarding security. Passkeys also make
often appears in website tracking code, logging in from a device much simpler, as
containing the Facebook Click Identifier. No pesky passwords – get a Passkey there’s no password to remember. Amazon
These days, I usually cut and paste In extreme cases, passwords or user data has a useful primer on how passkeys work
these URLs into Notepad and delete may be stolen from a website’s database at: https://bit.ly/pe-aug24-amz
the question mark and everything after following, say, a ransomware attack,
it, in order to defeat Google Analytics. and within a few seconds they can fall A token gesture
Only then do I paste the shortened URL into the hands of fraudsters anywhere in Other methods of enhancing security
into my browser. the world. Some websites are beginning include the use of physical devices

new
sizes!
1554/1554F
Polycarbonate IP68
Learn more:
www.hammondmfg.com/1554
[email protected] • 01256 812812

Practical Electronics | August | 2024 11


These Yubico security keys provide a physical ‘touch token’ that protects your logins securely against fraud or ID theft. Both USB-A
and USB-C types are available.

or ‘tokens’ such as the USB security – One-Time Passwords (OTPs) – sent by old phone, after which the process of
keys produced by Sweden’s Yubico. financial institutions or service providers. copying contacts, mail, apps and media
These are used by all Google’s staff and Just to reiterate a vital point: OTPs that – including all those photos and videos –
contractors for secure computer and you receive should never be given out started automatically. This can be handled
server logins, Yubico says. I covered to anyone else, as they may well be over Wi-Fi or via USB. Note that iOS as
Yubico’s secure keys in the June 2020 fraudsters looking to steal from you. If well as Android are supported. Happily,
issue of Net Work and more details of you unexpectedly receive an OTP, it may
these hardware devices are online at: be a sign of fraudulent activity taking
www.yubico.com place, so be on your guard and investigate
The author’s Facebook account is if necessary. An authenticator app on a
secured with a Yubico USB security smartphone can also be used to generate
key which, as an ID confirmation check, a code number as part of the 2FA process
needs a simple touch-tap to prove that – both Google and Microsoft offer them.
I’m physically present when logging in. In the past few weeks, I finally upgraded
Other higher-security types have a proper my Huawei P20 smartphone as it was
biometric fingerprint reader built in, but showing its age and was starting to buckle
they become pricey – around €95, exc. tax. under the workload. It must be said that
Yubico keys are available in USB-A and the Huawei has proved faultless, and it
USB-C styles, and a tiny ‘Nano’ version was generally a pleasure to use, but US
is designed to reside in the port. sanctions against the brand effectively
The buzzword here is ‘FIDO killed off the UK market, and so the next
authentication’ which is a powerful task was to transfer its contents to a new
encryption protocol at the heart of Yubico Samsung Galaxy 5G. I’ll summarise my
secure keys. You can learn more about experience of upgrading a phone, with
FIDO at: https://bit.ly/pe-aug24-fido and hints and tips that I hope will help readers
a catalogue of products and services that to prepare for the same eventuality.
are ‘Yubico-aware’ is at: https://bit.ly/ Although I rather dreaded the task, in
pe-aug24-yub reality, the job of moving everything over
Over time, I expect to see more acceptance to a new phone went exceptionally well.
of hardware tokens like these as online For good measure, a cloud backup of my
security becomes ever more challenging. thousands of photos and video files is
offered by Huawei and is still available
Time to swap phones for as long as I pay the negligible annual
Like many people, the writer has come running cost. Huawei has kept its side of
to rely on a smartphone for helping with the bargain, and the cloud backup works
many everyday tasks or keeping track of efficiently, so I downloaded the cloud
communications. In some applications backup onto my PC as an extra measure.
they are virtually indispensable: I wish
it wasn’t always the case, but services Switch it up
including routine banking, shopping On powering up the new phone, a setup
or even buying a parking ticket now routine asks whether you want to transfer
The Samsung Switch app worked
use apps and, at the very minimum, data to it from another device, and flawlessly when transferring data and
consumers are often expected to have a Samsung’s Switch app is duly installed. apps from an old mobile phone to a new
mobile phone to receive security codes The same app is also needed on the Samsung smartphone.

12 Practical Electronics | August | 2024


familiar with the code. Facial recognition scanning is another
biometric option, but I didn’t bother setting it up.
It was then a matter of getting to know the new phone.
Tempered glass screen protectors costing just a few pounds
are sold on eBay which safeguard against damage. A seller
called ‘Pixfab’ supplied mine at low cost and it fitted perfectly
thanks to the kit containing a screen wipe and drying tissue.
It’s a one-shot operation so align everything carefully before
releasing it onto the screen. A couple of ‘bubbles’ disappeared
by themselves after a few hours and the screen protector is
totally invisible. (An option in Settings can increase touch-
screen sensitivity if screen protectors are used.) A tempered
glass protector for the triple camera lens array, also supplied
by Pixfab, fitted perfectly as well. The biggest headache was
probably finding a suitable case, as the web is awash with
Chinese-made products, but one branded ‘Qltypri’ proved fine,
without spending silly money. What is comically marketed as
‘PU leather’ is – of course – actually polyurethane!
The experience taught me that it’s feasible to set up a cloud
backup, especially useful in case your phone is stolen or lost,
with data uploaded over Wi-Fi rather than using mobile data.
It’s critical to keep on top of account logins too, as these are
You can safeguard a smartphone camera lens with a low-cost
tempered glass protector. needed the first time apps are opened on the new device. For
anyone interested, Samsung fully explain the details of the
the process was very simple, and no particular problems were Switch app, giving readers a good insight into compatibility
experienced, but be ready to input those pesky usernames and and how it works – see: https://bit.ly/pe-aug24-sam
logins when launching them on the new phone for the first time. Back on the topic of QR codes; as far back as the February
WhatsApp, which is encrypted end-to-end, will only operate 2012 issue I described how these new pixelated peculiarities
one account on one device at a time, so the ‘old’ account was would transform the way we captured data, by using our
automatically disabled on the old phone, but all WhatsApp camera phones as scanners. As I explained above, I found
media were migrated effortlessly to the new device. my new smartphone scans even large, complex QR codes
What I thought would be the trickiest transfer of all – the HSBC instantly, but it’s worth remembering that fake QR codes
online banking apps – was totally seamless; HSBC allows you sometimes appear in public spaces. Counterfeit QR codes
to use up to three devices and a QR code helped complete the might sometimes be stuck over genuine labels: one car park
operation very smoothly, with no issues experienced at all. As was covered with them, with scammers trying to rake in cash
another benefit, the much better camera on the Samsung ‘snaps’ from motorists. Railway station car parks and posters are
QR codes with just a cursory glance (see later). Everything went another prime target. The UK’s NCSC offers advice which is
commendably smoothly, and I reflected that, finally, modern worth recalling before you go and ‘snap’ a likely-looking QR
technology had delivered on its promises. Samsung, Google and code: https://bit.ly/pe-aug24-ncsc
Microsoft will jostle to offer cloud backup plans as well, and
it’s worth spending time getting to know at least one of them. Fun with FLIR
The July 2024 issue of PE included a design for a Pico-based
Thumbs up thermal camera which, compared with the cost of commercial
Next, biometrics can be set up as your fingerprint ‘dabs’ must units, is an inexpensive and worthwhile introduction to capturing
be scanned by the new device for the first time. This was a infra-red heat maps and exploring the emissivity of materials.
slow process, and it’s wise to scan multiple fingertips in case My computer colleague recently dropped into the office with
one suffers cuts or abrasions. Samsung allows up to four prints another toy to play with: a ‘CAT’ branded ruggedized smartphone
to be scanned, but this idea won’t work if fingertips are wet with a difference, as it has a built-in FLIR (Forward-Looking
through rain or moisture, so it’s definitely worth remembering Infrared) thermal camera. The CAT S60 battery was on its last
PIN number alternatives and do practise using them to remain legs, but I managed to power it up with a USB powerbank. The

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 | August | 2024 13


This toughened ‘CAT’ smartphone includes a FLIR thermal camera. It can also highlight hot (or cold) spots and heat emitted by
‘vampire’ gadgets.
FLIR camera can capture heat maps in colour, as well as imaging
in monochrome and highlighting hot spots in red, or cold spots
in blue. Spot-readings of temperatures are displayed. Checking
a hot water supply or looking for ‘vampire’ electrical gadgets is
fascinating. FLIR phones crop up on eBay from time to time,
and as our project designer agreed last month, thermal cameras
could help diagnose trouble spots in all sorts of situations. As for
replacing the CAT’s battery, well, that’s a project for another day!

Aiming for the stars


Next, a roundup of current space missions and projects from
around the world. China’s Chang’e 6 probe, launched in May,
successfully touched down on the far side of the moon, and
it’s hoped soil samples will eventually be returned to Earth.
After a false start or two, Boeing’s Starliner launched its first
crewed flight for NASA on 5 June, docking successfully with
the International Space Station on a mission initially intended
to last about ten days. A number of small helium leaks in the
capsule are being investigated, and the next mission will carry The first test flight of the European Space Agency’s Ariane 6
three or more astronauts sometime in 2025. heavy lifter is scheduled for early July. (Image: ESA)
Sierra Space and NASA are now testing the ‘Dream Chaser’ accomplishment that heralded the start of the space race, and
spaceplane ready for launching later this year. The vehicle is the in turn saw the creation of a new, resilient, self-healing packet-
first ever uncrewed winged ‘space-shuttle’ style vehicle to be switching data network – what became known as the Internet.
manufactured commercially (see Net Work, August 2023). The
maiden flight of the 30-foot long (9m) vehicle, named Tenacity, And finally
will deliver cargo to the ISS using its ‘Shooting Star’ module. The arrival of the 1990s ‘Internet’ for consumers is where
Sierra Space also has ambitions to build the first commercial I came in, with the first column appearing in August 1996
‘inflatable’ space station in the future. when the world-wide web barely existed. This month’s Net
The inaugural flight of the European Space Agency’s long Work is sadly the last one to appear under the auspices of the
overdue Ariane 6 heavy lifter is scheduled for the 9 July, current Editor and Publisher, Matt Pulzer. Matt has edited PE
launching from French Guiana on the South American coast. successfully for many years and also became the Publisher in
A key feature of Ariane is that its upper stage main engine can 2018, and has worked tirelessly to bring PE readers the widest
stop and start up to four times, allowing it to deliver payloads choice of projects, tutorials and interesting topical features.
at four locations along its trajectory, bus-stop fashion, rather Navigating us safely through the stormy waters of pandemics
than having to release an entire payload all in one go. and lockdowns, Matt’s dedication and expertise has given each
The ESA has striven to replace Soyuz launches with Ariane issue a touch of finesse and class. With Matt’s encouragement
ever since co-operation with Russia ceased following the Net Work grew into a feature bringing readers news and trends
Ukraine invasion. Space fans can, however, marvel at the covering the Internet, technology, space, energy and more. Matt
Soyuz ‘User’s Manual’ still available on the ESA website at: explains elsewhere what’s in store for your favourite hobby
https://tinyurl.com/mv7zpukd electronics magazine, so here’s my personal ‘thank you’ to
It contains a fantastic wealth of detail plus a history of USSR Matt for supporting Net Work throughout all these years, and
Soyuz rockets, starting with Sputnik’s launch 67 years ago, an more importantly, for bringing readers their copy of Practical
Electronics every month. Good luck, Matt!
Teach-In Check Point answers – see page 66-67.
See you next
month for the latest The author can be reached at:
1. c 2. b 3. b 4. c 5. c 6. b 7. b 8. a 9. b 10. c
11. a 12. c 13. a 14. a 15. c 16. a 17. b 18. b 19. a 20. a
from Net Work!
[email protected]

14 Practical Electronics | August | 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
T
im Blythman presented an
Steve Matthysen’s Arduino-Based LC Meter with excellent per-
formance, range and accuracy

LC and ESR METER


in the June 2019 issue. The meter is
based on a custom Arduino shield
and is easy to build. Its accuracy
is optimised by auto-calibration
features and compensation for the
inherent capacitance of the leads
and even the Arduino pins.
While it’s undoubtedly useful for
This enhancement to our Wide-Range checking suspect components, for
Digital LC Meter from June 2019 allows electrolytic capacitors, it is import-
it also to measure capacitor ESR. That ant to know whether it has a low
impedance to alternating currents.
is extremely useful for diagnosing faulty That requires it to have a low equiv-
equipment because increasing ESR over alent series resistance (ESR).
time is one of the most common ways Why is ESR so important?
electrolytic capacitors fail. Electrolytic capacitors are used
where high charge storage is required.
In many applications, current must
flow efficiently into and out of the
capacitor to charge or discharge it.
ESR acts like a resistor in series with
the capacitor, losing energy each
time current flows in or out.
That ESR also prevents the capac-
itor from doing its job properly,
which is usually stabilising voltage.
Say the capacitor is being charged
at 1A and then starts discharging at
1A. If it has an ESR of 1W, the volt-
age seen by the rest of the circuit will
suddenly shift by 2V ([1A + 1A] ×
1W). For example, that would add to
the ripple on a power supply stor-
age capacitor.
High ESR values also lead to heat-
ing within the electrolytic capaci-
tor, possibly changing the capaci-
tance and reducing the integrity of
its electrolyte.
One of the most common indi-
cations of failed or failing electro-
lytic capacitors is a sudden or grad-
ual increase in their ESR values.
Increased ESR values can introduce a
wide range of mysterious circuit fail-
ures that are sometimes difficult to
pin down. For a switch-mode power
supply, these include decreased
voltage regulation, filter failures,
elevated noise levels, signal losses,
or failure to start.
Therefore, it makes sense when
testing electrolytic capacitors to con-
firm that their capacitance and ESR
values are in the appropriate ranges.

Revised design
In this design we feed signals into
an Arduino Uno driving an LCD. The
benefit of doing this is that the ESR
front end can be built on a relatively
small circuit board and integrated
with the LC meter presented in the
June 2019 issue. That makes it a great
general-­purpose instrument that can

16 Practical Electronics | August | 2024


not only check the ESR of capacitors
but also their values (up to a certain
Electrolytic capacitor construction
limit), plus it can be used to measure
inductors and more. In their most basic form, capacitors have two conductive plates (the anode
Alternatively, you could simply and cathode) separated by an insulating material called the dielectric. There
attach the front end to an Ardu- are three main types of electrolytic capacitors based on the material used for
ino Uno (or clone) with a 4-line the anode and the associated dielectric used in their design: aluminium, nio-
I 2 C alphanumeric LCD to pro- bium oxide and tantalum.
duce a standalone ESR meter. Capacitance is directly proportional to the total surface area of the plates
The code for both the LC-inte- but inversely proportional to the distance between the plates. Hence, the thin-
grated and standalone versions is ner the dielectric, the more efficient capacitors become.
available for download from the Dielectrics have a high resistance; for low-value capacitors, examples include
August 2024 page of the PE website: various polymers, mica, ceramics and even some liquids and gases, including
https://bit.ly/pe-downloads air. In all three types of electrolytics, the anode consists of the primary material
If you have already built the LC (aluminium, niobium oxide or tantalum) and the dielectric is a very thin layer of
meter and want to attach the ESR the respective oxide (pentoxide for niobium) deposited on the face of the anode.
module, you could do that, although This very thin dielectric must be in close contact with the cathode, which
starting from scratch is quite possi- is the electrolyte’s purpose. In essence, the electrolyte is the actual cathode,
bly the easier option. except that we also require a physical connection that allows the device to be
soldered into a circuit. To ensure a high-quality coupling with low resistance,
Measuring ESR the electrolyte is a highly conductive liquid, gel or solid.
Fig.1 shows a simplified diagram In aluminium electrolytic capacitors, an efficient way to ensure a high-qual-
representing the theory of operation. ity coupling between the two is to sandwich a thin electrolyte-soaked sheet of
S1 and S2 are electronic switches paper between the dielectric and the cathode. Manganese dioxide is a solid
controlled by the Arduino. When no electrolyte typically used in niobium and tantalum capacitors to connect the
measurement is underway, both S1 cathode to the dielectric.
and S2 are in the discharge position
to ensure the capacitor being tested
and the C-Ramp capacitor are main-
tained in discharged states. a constant current source to the Courtesy of Ohm’s law, we know
At the start of a measurement cycle, capacitor being tested. Depending that the magnitude of the resulting
the Arduino code places S2 into the on the range, the applied current is voltage pulse is directly propor-
Charge position and charges C-Ramp either 0.5mA, 5mA or 50mA. The tional to the ESR of the capacitor.
with a constant current of 9.4mA. test current pulse is kept very short The resulting test pulse voltage is
The resulting voltage at the inverting to minimise charge build-up on amplified by a factor of 20 and is
input of the comparator increases at the capacitor plates; we only want fed into the non-­i nverting input of
a steady rate of 20mV/ms (ie, 20V/s). to measure the momentary pulse the comparator.
After 480µs, S1 is switched to the that develops across the capacitor’s It compares the magnitude of the
charge position for 20µs, connecting equivalent series resistance. test pulse to the reference ramp volt-
age, and if the magnitude of the test
pulse is greater than the latter, the
comparator produces a 5V pulse at
its output. The Arduino code incre-
ments a counter and then waits
another 480µs before closing S1
again for 20µs to produce another
test pulse.
Since the ramp voltage increases
at a constant rate, it will eventually
exceed the magnitude of the test
pulses. The Arduino code detects
the missing pulse and stops the mea-
surement process, placing both S1
and S2 in the discharge position.
The Arduino uses the total number
of pulses and the test current to cal-
culate the ESR figure and displays it
on the LCD screen.

Circuit details
Fig.2 shows the circuit diagram of
the original LC meter (on the left)
with the ESR add-on on the right.
However, note that some extra com-
Fig.1: S1 repeatedly discharges and then briefly applies current to the DUT. ponents are shown on the left, such
The pulses are too short to charge the capacitor, so the resulting voltage is as mode switch S1 and ESR input
proportional to the ESR. The pulse amplifier then feeds an amplified version
protection diodes D5 & D6.
to the comparator, along with a linear ramp, and by counting the number of
output pulses, we can accurately determine the ESR. While only one connection is
shown passing between them – the

Practical Electronics | August | 2024 17


added ESR+ terminal connection Pulse current sources the relatively high values of the cur-
– there are 10 further connections Transistors Q1, Q2 and Q3 are driven rent source resistors. Critically, the
between the corresponding pins of by Arduino Uno digital outputs D12, measurement is taken directly from
CON5 and CON6. Note that GND is D11 and D10 when the respective the DUT terminal, so the circuit is
shared between both sides via pin 8 output is pulled low. The Arduino not measuring the ESR of those two
of those connectors. Uno will switch on one of the transis- capacitors as well.
We have produced two versions of tors depending on the measurement The 100nF capacitor keeps the
the PCB. The smaller version that is range. The 10kW, 1kW & 100W col- impedance low at high frequencies,
an add-on to the existing LC Meter lector resistors set the current pulse as required by the nature of the short
design only has the added circuitry to 0.5mA, 5mA or 50mA. current pulses.
on the right (with a few components There is no current regulation; Whenever Q1, Q2 and Q3 are
mounted off-board, such as D5 & D6). we rely on the fact that the 5V sup- turned off, the Arduino Uno digi-
However, the larger version of the ply is regulated, and the DUT is ini- tal output D13 switches Q4 on by
PCB incorporates everything shown tially discharged when the current supplying current to its base. This
in Fig.2 and simplifies the wiring, is applied. Therefore, close to 5V ensures that the two AC-coupling
especially since CON5 & CON6 are appears across the selected resistor capacitors are maintained in a dis-
not required. and the current is determined by charged state, ready for the next cur-
The ESR circuit on the right has Ohm’s law. rent pulse.
three sections: 1) a set of current The current pulse is applied to Inverse parallel diodes D1 & D4
sources used to pulse the capaci- the capacitor being tested via the protect Q4 from potentially high
tor being tested (upper left), 2) the parallel 100nF and 47µF capacitors currents should a charged capaci-
pulse amplifier (lower left) and 3) which block any DC components. tor be connected to the test leads.
the reference voltage ramp genera- The ESR of this combination of The maximum pulse voltage for an
tor (upper right). capacitors is inconsequential, given ESR value of 100W is typically under

18 Practical Electronics | August | 2024


Arduino-based L/C+ESR Meter
Fig.2: the original LC Meter circuit is on the left (with a few additions), while the added ESR-sensing circuitry
is on the right. Headers CON5 and CON6 are not present on the combined PCB we’ve designed; instead, the ten
connections are run via PCB tracks. Otherwise, a ribbon cable joins all pins between the two connectors.

500mV, so D1 and D4 have minimal the 270nF capacitor discharged in Integration with the LC meter
effect on the pulse voltage. the absence of a pulse. The LC meter used the Arduino’s ana-
log comparator inputs (D6 and D7)
Pulse amplifier Voltage ramp generator as digital outputs to drive the coils
The pulse voltage developed across PNP transistors Q7 and Q9 operate of relays RLY1 and RLY2. It was nec-
the capacitor being tested is fed to as a current mirror circuit to charge essary to move those functions to D3
the pulse amplifier via a 33nF capac- the 470nF ramp capacitor at a con- and D4 (by modifying the LC Meter
itor and a 1kW series capacitor. The stant rate. When the Arduino pulls code) to allow the ESR function to use
pulse is amplified by a two-stage pin 4 of CON6 low, Q9 switches on, the comparator. The larger, combined
transistor amplifier formed by Q5 causing about 9.4µA to flow through PCB design includes this rerouting.
and Q6. The ratio of the 6.8kW feed- the 470kW resistor. At the same time, At the same time, D3 and D4 are
back capacitor to the 150W fixed Q8 switches off, allowing the ramp shared with the ESR meter as digi-
resistor and VR1 (adjusted for about capacitor to charge. Q7 mirrors the tal I/Os via the selector switch, S1,
200W) sets the gain to 20 (1 + 6.8kW current through Q9, so the capacitor that chooses between the LC and ESR
÷ [150W + 200W]). begins to charge from 0V at 9.4µA. modes. This was necessary since
Diodes D2 and D3 protect Q5 if a The rising voltage across the there were insufficient spare I/Os
charged capacitor is connected to 470nF capacitor is connected to the available on the Uno. As the origi-
the test leads. Arduino Uno’s internal comparator nal LC Meter shield lacks CON5, the
The amplified pulse voltage goes (inverting input) via pin 1 of CON6. wires from CON6 go to the Arduino/
to the non-inverting input of the The Arduino Uno disables the ramp switch pins on my prototype.
Arduino Uno’s comparator via a generator by setting pin 4 of CON6
270nF capacitor, which blocks the high, turning off the charging via C9 Additional input protection
DC voltage across the 680W resistor while switching on Q8 to discharge If the ESR meter were accidentally
at Q6’s collector. This resistor keeps the ramp capacitor. connected to a charged capacitor,

Practical Electronics | August | 2024 19


the energy dumped into this circuit in Silicon Chip in the March 2004 The program starts in the high
could still damage it despite the issue, with minor changes to the range by setting D12 low and D13
protections mentioned above. As pulse timings to better suit the Ardu- high. This sets the pulse current to
with a much earlier design, we have ino Uno. The original design uses a 0.5mA. At the same time, the refer-
included two high-current diodes pulse width of 8µs with an off-time ence voltage generator is initiated
(1N5404s) connected back-to-back of 492µs. Such settings resulted in by setting D3 low.
directly across the input sockets: a slight fluctuation in the readings. If the pulse at the Arduino’s non-­
D5 and D6. Despite this, remember For example, a 0.6W resistance inverting input exceeds the refer-
to discharge capacitors before test- would show a reading fluctuating ence voltage, the comparator’s inter-
ing them! between 0.59 and 0.61. A pulse rupt-on-change feature sets a flag
width of about 20µs improved the indicating a pulse was detected.
Software stability with no impact on accuracy, Consequently, a counter is incre-
The ESR measurement code is based so a 480µs off-time was adopted to mented, the interrupt flag is reset,
on Bob Parker’s algorithm published maintain the overall 500µs period. and another pulse is applied to the
capacitor being tested.
This process repeats until the code
detects that the flag was not set after
Parts List – Arduino ESR Meter applying a current pulse. This sig-
1 suitable case [Altronics H0401] nifies that the reference ramp volt-
1 Arduino Uno or equivalent microcontroller module age has reached a level greater than
1 20×4 blue backlit alphanumeric LCD with I2C interface [SC4203] the pulse voltage, and therefore the
1 double-sided PCB coded 04106182, 68.5 × 115.5mm counting is complete.
1 100μH bobbin-style or high-current axial RF inductor (L1) After each count cycle, if the total
4 5V DC coil DIL reed relays (RLY1-RLY4) [Altronics S4100, Jaycar SY4030] number of pulses is below 10, the
1 200W top-adjust multi-turn trimpot (VR1) next lower range is selected, and
1 3PDT solder tag toggle switch (S1) [Jaycar ST0505] the measurement is repeated until
1 vertical tactile pushbutton switch (S2) the count produced is between 10
3 PCB-mount right-angle banana sockets; one black, two red and 100. In the low range, a count
(CON2, CON3, CON7) [Silicon Chip SC4983] OR between 10 and 100 equates to an
3 panel-mount banana sockets; two black, one red (CON2, CON3, CON7) ESR reading of between 0.1W and
1 4-pin right-angle polarised header with matching plug and pins (CON4) 1W; in the medium range, it rep-
1 set of Arduino-style regular headers (1×10-pin, 2×8-pin, 1×6-pin) resents 1W to 10W; or 10W to 100W
1 100mm length of 4-way ribbon cable terminated in the high range.
with DuPont sockets at one end If the count exceeds 100, the pro-
8 M3-tapped 12mm spacers gram automatically tries the next
9 M3 × 6mm panhead machine screws higher range until the count is
4 M3 × 6mm countersunk head blackened machine screws between 10 and 100. If the count
remains above 100 on the highest
Semiconductors range, then the display will show
1 LM311 high-speed comparator, DIP-8 (IC1) “Over range!”.
[Altronics Z2516, Jaycar ZL3311]
3 BC327 or BC328 500mA PNP transistors (Q1-Q3) Test lead resistance
2 BC337 or BC338 500mA NPN transistors (Q4, Q8) Since we aim to measure ESR val-
1 BC548 or BC547 100mA NPN transistor (Q5) ues well below 1W, the resistance
3 BC558 or BC557 100mA PNP transistors (Q6, Q7, Q9) of the test leads and banana socket
2 1N4004 400V 1A diodes (D1, D4) connections can introduce errors.
2 1N4148 75V 200mA diodes (D2, D3) Therefore, if the Zero button (S2)
2 1N5404 400V 3A diodes (D5, D6) is pressed, the Arduino notices its
Capacitors D4 input pulled low and shows the
1 220μF 16V electrolytic message “Short test leads and press
1 100μF 16V electrolytic zero…”.
1 47μF 16V non-polarised electrolytic Once the leads are shorted, the
1 22μF 16V electrolytic Arduino repeatedly measures and
2 10μF 6.3V tantalum or ceramic displays the lead resistance in ohms
1 470nF 63V MKT on the fourth line of the LCD. The
1 270nF 63V MKT code now waits for the zero but-
3 100nF 50V multi-layer ceramic or MKT ton to be pressed again and saves
1 33nF 63V MKT the lead resistance in the Ardui-
2 1nF 1% NP0/C0G ceramic, MKP or polystyrene [Silicon Chip SC4273] no’s EEPROM. The stored result is
Resistors (all 1/4W 1% axial) then subtracted from the subsequent
1 470kW 1 220kW 5 100kW 2 47kW 7 10kW capacitor ESR measurements.
2 6.8kW 1 4.7kW 4 2.2kW 1 1.3kW 3 1kW In addition to displaying ESR mea-
1 680W 1 220W 1 150W 1 130W 1 100W surements on the LCD, the Arduino
also produces a serial stream of the
Extra parts if building the ESR Meter with separate PCBs
measurement data via its USB port.
1 double-sided PCB coded 04106181, 68.5 × 53mm
The incremental count is dis-
1 3PDT solder tag slide switch (S1) [Mouser 502-50209LX]
played for each current pulse, fol-
1 2x5 IDC header with matching socket (CON6)
lowed by the final count, the final
Ribbon cable and heatshrink tubing
range selected and the number of

20 Practical Electronics | August | 2024


The prototype Meter was made using a specialised case to suit the display module. While you can use multiple PCBs as
shown above, a single board design using the PCB shown in the lead photo requires much less wiring.

range changes made during a mea- Combined LC / ESR Meter which mode has been selected to the
surement. Note that the accumu- When the LC Meter and ESR Meter Uno via its digital input D2. With D2
lated count includes the effects of are combined, a contact on the LC/ low, it is in ESR mode. Switching
test lead resistances. ESR selector switch, S1, signals from one mode to the other happens

What is a normal ESR value? sheet for the RubyCon YXF series generalised expected readings, so
Electrolytic capacitors include reac- for similar capacitance and voltage manufacturer data sheets should
tive elements, so the ESR value will ranges lists the maximum expected be used as a reference. However,
change depending on the frequency ESR values to be between 0.025W it should be apparent that a capac-
of the applied voltage (there is also an and 1.3W. itor is faulty if the measured ESR
equivalent series inductance or ESL). Table 1 below shows tabulated value exceeds tens or even hun-
Temperature changes also affect the typical ESR values. These are dreds of ohms!
reading, as do different manufactur-
ing processes. Manufacturer data Table 1: typical ESR readings for good capacitors A version
sheets typically give the expected of Table 1
ESR values at 20°C and 100Hz, 120Hz 10V 16V 25V 35V 63V 160V 250V that can be
or 100kHz, although many do not 1μF downloaded
5 4 6 10 20
include such information (or give it as a PDF.
differently, eg as a dissipation factor). 2.2μF 2.5 3 4 9 14
Thus, providing definitive expected 4.7μF 6 3 2 6 5
ESR values for all electrolytic capac-
itors is impossible. Still, we do not 10μF 1.6 1.5 1.7 2 3 6
expect to see the values exceeding
22μF 3 0.8 2 1 0.8 1.6 3
several ohms, and higher-value capac-
itors should generally have lower ESR 47μF 1 2 1 1 0.6 1 2
values. Capacitors designed for
use in switch-mode supplies (often 100μF 0.6 0.9 0.5 0.5 0.3 0.5 1
labelled “Low ESR”) should have val- 220μF
ues of a fraction of an ohm or less. 0.3 0.4 0.4 0.2 0.15 0.25 0.5
For example, the data sheet for the 470μF 0.15 0.2 0.25 0.1 0.1 0.2 0.3
Panasonic FM-A series of aluminium
capacitors gives values from 0.012W 1000μF 0.1 0.1 0.1 0.04 0.04 0.15
to 0.34W ohms varying with the volt- 4700μF 0.06 0.05 0.05 0.05 0.05
age rating (6.3V to 50V) and capac-
itance (22μF to 6800μF). The data 10mF 0.04 0.03 0.03 0.03

Practical Electronics | August | 2024 21


If you decide to build the ESR meter
as separate PCBs, you might also
need a mounting arrangement for the
banana sockets as shown here and in
Fig.8. In this case diodes D5 & D6 are
located inside the white heatshrink.

after the program completes the cur-


rent procedure being processed by
the Arduino.
As previously mentioned, Ardu-
ino pins D3 and D4 are shared
between the LC and ESR modules.
D3 serves as a digital output in
both modes; however, D4 is a dig-
ital input for the ESR module (for
the Zero switch) but an output for
the LC meter (driving RLY1). When
switching modes, D4 is reconfigured
by the code as required.

Case selection
The case used for the prototype is
available from Mouser Electron-
ics (563-HH-3421) or Digi-Key
(HH-3421-ND), although stocks are
limited. An optional tilt stand is
available separately from Digi-Key
(377-1171-ND).
Because the combined board is
considerably narrower than the ESR-
only board, it should fit in that case.
With an internal depth of 37mm
(excluding things like mounting
bushes, which could be removed),
the Arduino and control board stack
should fit, as should mode switch
S1, but it will be a bit of a squeeze.
Alternatively, you could use just
about any rectangular case. It would
need to be at least 175mm tall inter-
nally for a 20×4 LCD module to fit at
the top with the combined control
PCB and Arduino below it. The LCD
will be around 87mm wide, defining
the minimum internal width, while
a depth of at least 30mm is required
to fit the Arduino Uno, the shield on
top of it, and the body of switch S1.
Fig.3: this is the wiring needed to add the ESR feature to the existing LC
Meter design by simply adding another small board (at the bottom). We think The Altronics H0401 sloped case
most constructors will prefer the much easier method of building the single specified in the parts list should
combined PCB! have plenty of room. Because of the

22 Practical Electronics | August | 2024


sloping lid, you will need to mount
the LCD and other PCBs to the inside
of the lid. The screws and spacers in
the parts list are intended to allow
you to do this; the nut for switch S1
can also be used to hold the board
in place. Remember to position the
board so that the banana sockets will
be accessible (or mount the chassis
socket off-board).

Construction
First, you need to decide if you will
build the original LC Meter design
and wiring in the add-on ESR mod-
ule or the combined PCB. We reckon
the latter is a lot simpler.
Fig.3 shows the wiring required Fig.4: the combined PCB
with separate boards, while Fig.4 is basically the LC Meter
shows the combined PCB. For the shield (top section) with
combined version, the only part you the ESR circuitry added
need to add externally to Fig.4 is the below. Toggle switch
S1 selects between the
LCD screen, via CON4. two functions. Some
If you want to build the add-on extra mounting holes
board, it is shown in Fig.5, while the have been added to
LC Meter board, without the sockets increase mounting
(as we’re using off-board sockets), is flexibility, although they
shown in Fig.6. We’ll describe the unfortunately are not in a
assembly process for the combined rectangle.
board; the two smaller boards are
similar, you just need to skip the
parts that are not onboard.
The combined PCB measures 64.5
× 115.5mm, is coded 04106182 and
is available from the PE PCB Service.
It’s essentially a larger-­than-normal by trimpot VR1 (ideally a multi-turn be printed on them, possibly as codes
Arduino shield. type, although universal pads are like 102 = 1nF, 104 = 100nF etc) and
Fit the resistors first, checking provided) and pushbutton switch S2. then the electrolytics. The latter are
their values with a multimeter as Follow with the transistors. There polarised, so insert the longer posi-
you install each one. Follow with the are nine, of four different types, so tive leads into the pads marked + (the
smaller diodes (1N4148 & 1N4004), make sure to get the right types in striped side is negative). Remember
taking care to check their orienta- each position and orientate them as that the 47µF non-polarised type
tions; face the cathode stripes as shown. Bend their leads with small goes at lower left. If you’re unsure
shown in Fig.4. pliers if necessary to fit the pads. about the values, check each com-
Next, mount IC1 (which can be The next job is to install the capac- ponent with a multimeter.
soldered to the board or socketed, itors, starting with the non-polarised Now is a good time to fit the bulk-
but watch its orientation), followed MKTs/ceramics (the values should ier components like the reed relays

Figs.5 & 6: if you want to build the separate ESR board (left), either to use it as a standalone ESR meter or to add to
an existing LC Meter (right), here is where all the components go. Besides the 10-way ribbon cable from CON6 (which
could be left off & the ribbon cable soldered to the PCB), you also need to wire up the COM− and ESR+ test terminals.

Practical Electronics | August | 2024 23


(watch their orientation), diodes D5 The remaining headers mount on headers into the shield board from
& D6 (ditto), the banana sockets and the underside of the board. Use stan- the underside. Place a scrap of per-
inductor L1. dard pin headers for the four SIL fboard, protoboard or similar on
That just leaves the headers and connections to the Arduino Uno (or top of the header pins that stick out
the 3PDT mode switch. The CON4 similar) since we will not stack any- the top of the board, then use a flat
header needs to be fitted as we’ll thing on top of this board. However, object to push the headers down so
use it to connect to the LCD later, they need to be fitted using a partic- the tops of the pins are flush with
unless you plan to solder the LCD ular method due to the height of the the perfboard.
wires directly to its pads. CON1 is USB connector on the Arduino Uno Carefully remove the perfboard
only needed if you plan to mount board that will fit below. without moving the headers, then
the banana sockets off-board and First, apply some insulation to solder the pins at either end. This
will not solder the wires directly the top of the USB socket on the will mean there is a gap between the
(although you will need to do so for Uno, such as electrical tape or Kap- underside of the PCB and the plas-
CON7 regardless). ton tape. Next, insert the Arduino tic spacer on the headers. That’s so
the pins project out further to reach
the Arduino sockets despite the USB
socket not allowing the shield to be
pushed fully down.
Finally, the 3PDT toggle switch
mounts on the top side of the board
into slotted holes designed to suit
its rectangular solder lugs. This
avoids the need to run nine flying
leads, although you could do so if
you want to mount that switch else-
where. If doing so, use a short length
of ribbon cable.

Testing
Make a final inspection of the sol-
dering to ensure there are no solder
bridges between tracks and that all
the components are in their correct
position and correctly orientated.
If you have built the separate
ESR board, you can do some test-
ing before you wire it up. Connect
pin 5 of CON6 to a +5V supply with
pin 8 at 0V.
Measure the current draw, which
should be about 1mA. If the cur-
rent is significantly higher (or zero),
disconnect the supply and look for
assembly errors.
When plugging the shield into
the Arduino, we recommend that
you use 12mm tapped spacers and
short machine screws to hold the
two boards together due to the fact
the headers won’t plug fully into
the sockets. Attach the four spac-
ers to the mounting holes on the
Arduno, but only one needs to be
screwed in through the shield to
hold it down. The rest just set it at
the correct height.
If there is a solder joint touch-
ing the top of the USB socket that
prevents you from tightening the
screws, you should trim it flush to
the extent possible.

Wiring
If you are building the combined
PCB, there isn’t much to the wiring.
You just need to make up a 4-way
When the Meter is switched to ESR mode, a splash screen is briefly displayed cable to go from CON4 to the I2C LCD
showing the ‘Zero value’, which is effectively the offset due to the resistance of header. Make sure the connections
the leads and anything else that might be in the measuring circuit. are made per the labelling on the two

24 Practical Electronics | August | 2024


PCBs, ie, GND to GND, SDA to SDA
etc. If in doubt, refer to Fig.3; using a
4-way ribbon cable will keep it tidy.
If you haven’t already soldered
the I2C adaptor to the LCD screen,
do that now, as the 4-way cable from
the main board connects to that.
If you’re adding the ESR board to
an existing LC Meter, or building the
boards separately for some other rea-
son, wire them up as per Fig.3. The
ten wires from CON6 are shown sep-
arately for clarity but again, it’s best
to use a 10-way ribbon cable and
only split out the individual wires
as much as necessary to reach the
appropriate pads.
Note how, in Fig.3, the LC Meter
shield no longer plugs directly into
the Arduino since many of the pins
are rerouted. Also note that diodes
D5 & D6 are mounted off-board in
this case.

Loading the software


To upload the firmware for the Uno
board, you need to have the Ardu-
ino IDE (Integrated Development
Environment) software installed on
your computer. If you don’t have
it, get it from: www.arduino.cc/en/
main/software
The program that runs on the Uno
requires an external library to inter-
face with the I2C LCD. Open the IDE
and select: Sketch → Include Library
→ Manage Libraries... ,then search for
“liquidcrystal_pcf8574” and install
the version by Matthias Hertel.
Now open the sketch file: “ESR.
ino” for the standalone version or
“LC_ESR_Meter.ino” for the com-
bined version. Select the board type
as Arduino Uno (Tools → Board Type
→ Arduino AVR Boards), then use the
Tools → Port menu to select the serial
port that the Arduino is plugged into.
Most versions of the Uno will display
as COMx: (Arduino Uno or similar)
in the dropdown menu.
If you’re using a 16×4 LCD rather
than the 20×4 LCD recommended,
change the line “lcd.begin(20, 4)”
to “lcd.begin(16, 4)”. Compile
and upload the sketch by pressing
Ctrl-U. If you see the message “Done
Uploading” at the bottom of the win-
dow, then all is well. If you get an
error message, check that the LCD I2C
library is installed correctly and that
the correct serial port is selected.

LCD adjustment
If the LCD backlight is not lit, check
that the backlight jumper is fitted on Fig.7: while not recommended for the combined PCB, here is how the separate
PCBs were mounted on an acrylic baseplate for the prototype.
the I2C adapter board. If the back-
light is working, but there is no text, Zeroing the test leads has been saved in the EEPROM; if
adjust the contrast pot on the back The program first checks to see not, you will be prompted to per-
of the I2C adapter board. if the resistance of the test leads form the Zero process. Follow the

Practical Electronics | August | 2024 25


the total resistance of the leads to be
Here is another view of less than 1W or it won’t accept the
the combined PCB we result and briefly display the mes-
designed, plugged sage “Invalid reading or bad leads”
into an Arduino
before aborting the zeroing process.
Uno, at actual size.
Note how as well In normal measurement mode and
as the banana with the test leads separated, the dis-
sockets projecting play should indicate “Over range”.
off the left-hand
side, the USB and Calibration
DC power inputs Calibration is straightforward, using
of the Uno do a known resistance of about 68W
too. This allows or 82W. Verify the resistor’s actual
you to make value beforehand with a multimeter
holes in the side
(deducting the multimeter lead resis-
of the case for
all of those tances measured when shorting the
connectors. leads together). Switch S1 (if pres-
ent) to ESR mode. With this resistor
connected via the probes, the screen
should display a value close to the
resistor value.
Adjust VR1 until the reading
matches the resistor value. Now
try a resistor in the medium range
(1-9.9W) across the leads and verify
that the reading is close to expected.
Similarly, a 0.1-0.9W resistor should
give a very close measured result.
With calibration complete, you
can now test a selection of electro-
lytic capacitors to get a feel for the
meter’s operation.
The screen shows the measured
ESR on the first line, the range (High,
Medium or Low) on the third line,
and the saved lead resistance on the
fourth line. There is no need to sub-
tract the lead resistance from the dis-
played ESR value, as that has already
been done.
If you’ve built the combined LC/
ESR Meter (as we think most peo-
ple will), now would also be a good
time to switch over to LC mode and
verify that the unit changes modes
when you flick the switch and that
Screen 1: This screen is seen when no component is connected, or when a inductor and capacitor measure-
resistance over 100W is detected. The bottom line continues to display the lead ments are correct.
resistance. If you see this when a capacitor is connected, it's probably not good
anymore! Final assembly
If you are building the unit as a
standalone ESR meter, all that
remains is to place the Arduino
and ESR shield into an appropriate
enclosure, with the LCD visible and
the test lead terminals (and possibly
S2) accessible.
We have not shown the wiring
to achieve this but it is similar to
what is shown in Fig.3 without the
Screen 2: Pressing and holding the ZERO button brings up this screen. You LC Meter shield. The main differ-
should short the ESR measurement terminals using the leads you would use for ences are that the two connections
measurement and confirm that a low value as seen is displayed before pressing ►
from pins D3 & D4 on the Arduino
the ZERO button again. to the ESR PCB via S1 should be run
directly, while pin D2 should be tied
instructions requesting the test leads The display should briefly indicate to GND. The 5V and GND supply
to be shorted, and once the displayed that the zeroing process is complete connections also connect from the
resistance is stable, press the zero before changing to the regular mea- Arduino to the ESR board rather than
switch (S2). surement display. The code expects via the LC Meter Shield.

26 Practical Electronics | August | 2024


left edge of the board and attached your case, you may not need this;
via short wires. you can mount the sockets directly
As in the prototype, you would to it, or use the onboard ones.
typically mount the LCD screen near If you are chassis-mounting mode
the top of the case with the main switch S1, you might want to make
PCB below. a similar bracket for it if mounting
Power for the prototype was fed in it directly to the case isn’t suitable.
via the Uno’s power connector, with Consider that you should drill a
the plug going through a cut-out in hole about 3mm in diameter in the
the left-hand side of the case. You case for accessing Zero switch S2
Fig.8: while also not necessary could use a similar arrangement, or later should you need to recalibrate
for the version built with the use a chassis-mounting DC barrel the lead resistance. Having to open
combined PCB as described, this socket mounted elsewhere and wired up the case to do that could be a
shows the mounting bracket used
to the VIN and GND pins of the Uno. nuisance.
to hold the banana sockets in the
prototype. If your enclosure doesn’t have a Table 1 can be printed onto adhe-
clear lid, cut a piece of clear acrylic sive paper or printed, laminated
or other plastic for the display win- and glued onto the case as a guide.
If you have built the combined dow. You can either glue this onto That is what I did for the prototype.
PCB, fitting it into an enclosure is a the underside of the enclosure cover Keep in mind that if you’re using the
bit more straightforward. Again you or mount it on top of the LCD. Combined PCB, the mode switch tog-
will need a cut-out to view the LCD gle will be in the middle of where I
screen (unless your case has a clear Prototype mounting details attached it on my prototype. Depend-
lid) and possibly a way to access S2 Some constructors may wish to use ing on where you’ve put the banana
(eg, a small hole in the case). a similar mounting arrangement to sockets, you may be able to attach it
The toggle switch will fit through the prototype. However, this is not higher up to clear that switch.
a hole in the lid of your enclosure, suitable if you are using the com-
but the board should be mounted bined PCB; it’s only relevant if you Conclusion
against the left edge so that the have separate PCBs. The boards, Don’t forget to discharge the capac-
banana sockets will fit through holes mounting brackets and display were itors before testing them!
in the side (unless you’ve decided to mounted on a 4mm-thick acrylic
mount them elsewhere and connect base plate, as shown in Fig.7.
them to the socket pads via flying Fig.8 shows the reinforcement Reproduced by arrangement with
leads). You could use panel-mount bracket used for mounting the banana SILICON CHIP magazine 2024.
banana sockets mounted just off the sockets to the case. Depending on 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 | August | 2024 27


where the PicoMite meets the Web

The WebMite
a Raspberry Pi Pico with MMBasic, WiFi and Internet Connectivity
| Article and MMBasic by Geoff Graham | WebMite firmware by Peter Mather |

M
ost readers will be familiar ; Remotely edit BASIC programs. Loading the WebMite firmware on
with the PicoMite, which we ; Transfer files to and from the Pico the Raspberry Pi Pico W is the same
introduced in the July 2022 over WiFi using TFTP. as with the original Raspberry Pi Pico
Make it with Micromite column. It is These features have been imple­ and is described in the user manual.
a Raspberry Pi Pico programmed in mented using an easy-to-use program­ Essentially, you plug your Pico W into
the MMBasic language and is a very ming framework with the flexibil­ a USB port on your computer while
capable microcontroller at a low price. ity to handle the unusual aspects of holding down the button on the top of
Following that, the Raspberry Pi accessing internet resources. Later in the module. The Pico will then create
Foundation released the Raspberry Pi this article, we will present an exam­ a pseudo USB drive on your computer,
Pico W, which is very similar to the ple of a simple web server that uses and you just drag and drop the Web­
original Pico but with the addition of just 12 lines of BASIC code – that is Mite firmware into that.
a WiFi module. all it takes to serve up a web page for When the transfer has been com­
In theory, you could take any Pico your projects. pleted, the Pico will restart running the
project and then add an internet con­ The MMBasic language is an easy- WebMite firmware and create a serial
nection… but it is not quite that easy. to-use programming environment. connection via its USB port.
The internet and its protocols are com­ With the WebMite, you can easily add Once it has done that, you can use
plicated, with many protocol layers. internet features to complex gadgets a terminal emulator like Tera Term
That means it takes an experienced with touch-sensitive LCD panels, SD (http://tera-term.en.lo4d.com) to access
programmer to accomplish even the card support for storing files, connec­ the WebMite’s console. If you then hit
simplest task. tion to various sensors and so on. the Enter key on your keyboard, you
That is where our new WebMite will see the MMBasic prompt, which
comes in. We have added to the Pico­ Loading the firmware is just a greater-than character (>). You
Mite firmware support for the wireless As the hardware is already built for can configure the WebMite, test com­
capability of the Pico W and the proto­ you (the Raspberry Pi Pico W, avail­ mands, edit programs, and run them at
cols (802.11n, DHCP, WPA-PSK, TCP, able for under $10), all you have to this command prompt.
IP, TLS, HTML etc) that are necessary do to create the WebMite is load the
to access the internet. With the Web­ appropriate firmware onto that mod­ Internal file system
Mite, you can easily: ule. Luckily, that is easy. Before we get into the internet capa­
; Connect to a WiFi network with The WebMite firmware can be bilities of the WebMite, we need to
a specified SSID and password. downloaded for free from from the introduce the internal file system. It
; Implement a web server with August 2024 page of the PE website: looks like an SD card to the program­
advanced features. https://bit.ly/pe-downloads or the mer, but files are actually stored in the
; Query websites for data. author’s website at http://geoffg.net/ flash memory chip of the Raspberry
; Get the current time/date. webmite.html Pi Pico W.
; Check the weather. It comes with a comprehensive 178- You can open files for reading and
; Send emails. page user manual that includes a tuto­ writing, create and navigate directo­
; Publish/retrieve data from MQTT rial on BASIC programming for pro­ ries and do all the things you can do
broker services (for IoT messaging). gramming beginners. with a physically attached SD card.
That includes using the normal BASIC
file commands such as OPEN, CLOSE,
FILES etc. If you connect a removable
SD card to the WebMite, it is accessed
as drive “B:” while the internal file
system is drive “A:”.
This internal file system has a capac­
ity of about 600kB, and it is automat­
ically created by the firmware when
MMBasic is loaded onto the Rasp­
berry Pi Pico (W). This is especially
useful on the WebMite because, to set
up a web server, you need somewhere
to store the web pages and images to
All that you need serve. The internal file system is per­
for the WebMite is an fect for the job.
affordable Raspberry Pi Pico W. This feature was introduced in the
last release of the PicoMite firmware,

28 Practical Electronics | August | 2024


so if you are currently using the Pico­
Mite or the VGA PicoMite, consider
upgrading to get this feature.

Connecting to WiFi
The WebMite can connect to any WiFi
network running 802.11n (2.4GHz)
with WPA-PSK security. The encryp­
tion must be either TKIP or AES (or
both) and DHCP must be enabled
on your router. These are standard
requirements for most WiFi-enabled
gadgets, so most routers are set up like
this by default.
To log into your network, use the
command OPTION WIFI at the Web­
Mite’s command prompt. For exam­
ple, if your network is called MyNet­
work and the password is secret, you Screen 1: You can connect to the WebMite using Telnet over WiFi via Tera Term.
would use this command at the com­ This lets you do everything that you can do via a USB cable, including editing
mand prompt (the quote characters and running programs.
are required):
You can also use PuTTY in Win­ are slower and clunkier (which is why
OPTION WIFI “MyNetwork”, “secret”
dows or the telnet command in Linux they are only used when required).
This will be remembered and will or macOS (it is no longer part of the To allocate RAM for holding a long
be automatically reapplied on every macOS by default, but you can install string, you need to declare an array of
reboot. It will also cause the WebMite it via Homebrew). integers with a size (in bytes) that will
to restart and drop the USB connec­ fit the longest string expected. While
tion, so you will have to reconnect to File transfers declared as integers, the string rou­
access the command prompt again. Another handy feature is the ability to tines do not store numbers in these;
You can check the IP address that transfer files to and from the WebMite they are just used as memory blocks.
your router gave to the WebMite with over WiFi. This is done using TFTP For example:
the command: (Trivial File Transfer Protocol) from
DIM INTEGER StrA(512),StrB(512)
a Windows, Mac or Linux computer.
PRINT MM.INFO(IP ADDRESS)
In Windows, this is built into the Each array is 512 integers, and an
Most routers will allocate the same operating system; however, you must integer is eight bytes, so each array
address to the WebMite on every enable it first by going to the Control occupies 4KB of RAM (512B × 8). A
reboot. However, if you want to ensure Panel, selecting “Programs and Fea­ character is one byte, so each can store
the address will not change, go into tures”, then “Turn Windows features strings of up to 4,096 characters. These
your router’s configuration and allo­ on or off”. Finally, scroll down the list arrays are passed to the long string rou­
cate a static IP address to the WebMite. and tick TFTP Client. tines using empty brackets. For exam­
Incidentally, you can have many Web­ You can then send a file to the Web­ ple, to copy StrB to StrA, you can use
Mites on your network with different Mite’s internal file system (drive A:) the command:
IP addresses and they will not conflict. using the following command in a
LONG STRING COPY StrA(), StrB()
Command or Power Shell window:
Remote connection via Telnet Long strings are documented in the
TFTP -i ipaddress PUT filename
The WebMite could be installed in user manual. It is worthwhile to famil­
some inaccessible place, so the firm­ This protocol can also be used to iarise yourself with them as they are
ware allows you to use Telnet over retrieve files from the WebMite, eg: invaluable when dealing with the large
your WiFi network to access the amount of data sent over the internet.
TFTP -i ipaddress GET filename
MMBasic console. This feature is
enabled with the command: Web server functions
Long string support Assuming that you have connected
OPTION TELNET CONSOLE ON
Another new feature of the WebMite the WebMite to your WiFi network
As before, this command will that needs explaining is long strings. as described above, the next step in
be remembered and automatically Regular string (text) variables in implementing a web server is to tell the
applied on every reboot. It will also MMBasic can store a maximum of 255 firmware to start a TCP server. This is
cause the processor to restart, so you characters. However, most data trans­ done with another OPTION command
will have to reconnect to regain the ferred between an internet client and as follows (it must be entered at the
command prompt. server is much longer than that. The command prompt):
The recommended terminal emula­ WebMite has a series of routines called
OPTION TCP SERVER PORT 80
tor, Tera Term, supports Telnet, so all long strings to address this need.
you need do is select that in the new These work with strings of any Port 80 is the standard HTTP port,
connection dialog box and enter the length, limited only by the available normally used for serving web pages.
WebMite’s IP address, as shown in RAM. Using them, you can pull long As with the other OPTION com­
Screen 1. You can do everything you strings apart, search for specified text, mands, this only needs to be entered
can via a physical USB connection copy parts of the text and so on. They once and will be remembered. It will
using Telnet, including editing and mimic what the standard string func­ also cause the WebMite to restart.
running programs... all over the WiFi! tions do in MMBasic, although they In your program, you tell the server

Practical Electronics | August | 2024 29


what to do if an incoming request is insert data your BASIC program has The command specifies that the results
received with the command WEB TCP collected into the web page. should be saved in CurrentTemp and
INTERRUPT. This specifies a subrou- For example, if your program had a CurrentHumid variables.
tine that the firmware will call (inter- variable called Humid which had the The WebInterrupt subroutine, start-
rupting the main program) whenever value of 42 and represented the cur- ing at line 7, is where the work is done
a request is received. rent humidity, the following text in in serving up the web page. Whenever
Within your interrupt subroutine, your HTML file: the TCP server receives a request, it
you can retrieve the remote request will call this subroutine, interrupt-
The current humidity is {Humid}%
using the command WEB TCP READ. ing whatever the BASIC program was
This command needs a long string buf- Displays in the client’s browser as: doing at the time.
fer for holding the text of the remote This subroutine first defines sev-
The current humidity is 42%
request (see above for a description of eral local integer variables, including
long strings). You can also send non web pages an array of integers called b(), used
The request from the remote browser using the WEB TRANSMIT FILE com- as a long string variable to hold the
will look something like that shown mand, which will send images, audio incoming data.
in Screen 2. In this case, the browser files and much more (without substi- The web server can handle multi-
is requesting a web page called “page. tuting for variables). ple simultaneous requests, so the pro-
html”, but it could be the name of an Using these commands, you can gram starts a loop stepping through all
image file or even a single forward create a web server that will serve up possible connections. The WEB TCP
slash (/), which is a request for the pages displaying whatever data you READ command will read whatever
default page of the website (typically have collected. This server could also is available on each connection and
called “index.html”). respond to remote commands from the save any received data in the long
The request could also be a notifi- user to turn on/off motors, pumps etc, string buffer b().
cation that the user has clicked on a as required. Whatever the WebMite The following two lines look for
button or control on the web page and can do locally, it can also do remotely! GET and HTTP keywords in the
is expecting the WebMite to take some received request. The next line checks
action. In that case, the text between A simple web server that these keywords are present and in
the keywords GET and HTML will This example will display the tem- the correct order. In that case, we send
indicate the control involved and the perature and humidity in a fictional the default web page, “index.html”.
user’s action. greenhouse. From the comfort of Note that we don’t care what file the
Some queries may use the keyword your living room, you could call up remote browser actually requested;
POST instead of GET, but the intention the web page on your phone, tablet we just send the default page for every
is the same; whatever is between the or computer and see the current con- request.
first keyword and HTML is the request ditions for your plants, even though This web page is shown in Program
from the remote browser. they may be located at the bottom of 2 and consists of just three lines. The
your garden. first line is the heading, and the next
Sending a web page The whole program is shown in Pro- two define the text on the page. When
If the request is for a web page, you can gram 1 and is about as simple as it gets the page is transmitted, the firmware
send it using WEB TRANSMIT PAGE. at just 17 lines. The web page is even will substitute the text {CurrentTemp}
This specifies a file formatted in HTML smaller, at only three lines. and {CurrentHumid} with the cur-
residing in the internal file system of The first line of the program starts rent values of those variables. “<BR
the WebMite (described above) or on the web server and specifies the inter- />” in HTML is an instruction to the
an SD card (if connected). rupt subroutine to be used for any web browser to insert a new line (line
When the firmware transmits the incoming requests (“WebInterrupt”). BReak).
web page, it will scan the page for The next four lines implement a Screen 3 shows the result displayed
any embedded BASIC variables sur- simple loop where a DHT22 sensor in a browser.
rounded by curly brackets. It will sub- (connected to the GP28 pin, as shown This is a functional program, and if
stitute these with the current value in Fig.1) is queried for the current tem- you have a Raspberry Pi Pico W handy,
of the variable. This facility lets you perature and humidity ten seconds. you can copy the files to it and have

Screen 2: a web request from a remote browser will look like this. The Fig.1: here’s how to connect the
important part is the text between the keywords GET and HTTP. In this case, the DHT22 temperature/humidity sensor
browser is requesting a web page called “page.html”, but it could be an image for the sample web server program in
file or some text indicating that the user has clicked a control on the web page. Program 1.

30 Practical Electronics | August | 2024


WEB TCP INTERRUPT WebInterrupt Program 1: this simple web server program displays the
DO temperature and humidity in a fictional greenhouse. It is just 17
BITBANG HUMID GP28, CurrentTemp, CurrentHumid lines; the WebInterrupt subroutine starting at line 7 is where the
PAUSE 10000 work is done in serving up the web page.
LOOP

SUB WebInterrupt
LOCAL INTEGER a, p, t, b(512)
FOR a = 1 To MM.INFO(MAX CONNECTIONS) <H3>Greenhouse Monitor</H3>
WEB TCP READ a, b() The temperature is {CurrentTemp}&deg;C <BR />
p = LINSTR(b(), “GET”) The humidity is {CurrentHumid}%
t = LINSTR(b(), “HTTP”)
If (p > 0) And (t > p) Then Program 2: this is the web page HTML source for the program
WEB TRANSMIT PAGE a, “index.html” shown in Program 1. The first line defines a heading and
ENDIF the next two specify the text in the page. When the page is
NEXT a
END SUB
transmitted, the firmware will substitute the text {CurrentTemp}
and {CurrentHumid} with the current values of those variables.

it working immediately. To make it with associated buttons and switches if you wanted to get the default web
easy, the WebMite firmware download (or a touchscreen) can be converted to page from a website called example.
includes both these files and a ‘readme’ a web interface with the same func- com, you could do it this way:
file with detailed instructions. Give it tions and more.
DIM INTEGER b(512)
a go and be prepared to be amazed at An excellent example is the Water-
WEB OPEN TCP CLIENT
what the WebMite can do. ing System Controller starting on page
“example.com”, 80
36 of this issue. It uses the WebMite
WEB TCP CLIENT REQUEST
Advanced server features and there are no controls on the phys-
“GET / HTTP”, b()
Web infrastructure is a rich environ- ical box. All the controller’s functions
WEB CLOSE TCP CLIENT
ment, so you can add many more fea- are configured and controlled exclu-
tures to your web pages. These include sively via web pages in a browser. Editor’s note: the WEB OPEN and
images, textured backgrounds, multi- WEB TCP commands should all be
ple pages and more. TCP client on a single line; the commands are
For example, you might want to dis- As well as acting as a web server, the shown split here due to limited col-
play a graph of past temperatures and WebMite can act as a client and get umn width.
humidity for your hypothetical green- data from web servers on the inter- The web page would be saved in the
house. That can be done by defining net. Three commands will do this for long string buffer b() and you could
a virtual LCD panel in the WebMite. you: WEB OPEN TCP CLIENT, WEB pick it apart to get the data you wanted
This does not have an attached phys- TCP CLIENT REQUEST and WEB using the long string routines.
ical display, but regardless, you can CLOSE TCP CLIENT. For example, There are many services available
draw your historical data on it using
the graphical drawing commands built Screen 3: how
into MMBasic: line, pixel, text etc. the simple
You can save this image as a BMP file web server
to the internal file system in the Web- appears to
Mite. Then, when a remote browser a user on a
requests the web page with this embed- phone, tablet
or computer.
ded image, the browser will also ask
for this file, and the user will see an
image representing the graph of past
temperatures and humidity that your
program recorded. Screen 4 illustrates Screen 4: with
what it could look like. a little more
Even more useful is the ability to programming
define HTML forms in the web page, effort, you
including embedded controls such as can extend
buttons, checkboxes, radio buttons, the simple
input text fields and much more. Using web server
these, the user can, via the web page, to display a
send commands to the BASIC program graph of past
temperatures
running on the WebMite to do things and humidity
like turn devices off/on, set parame- readings
ters and so on. Screen 5 provides some for your
examples of these. greenhouse.
A wide range of controls is available
but be warned that the HTML code
can get complicated. The web page at
www.w3schools.com/howto/default.
asp lists these controls and their fea-
tures, and has plenty of examples that
you can copy into your web pages.
This ability means that many proj-
ects that generally need an LCD screen

Practical Electronics | August | 2024 31


on the internet that can be accessed prevent eavesdropping and tamper-
with the TCP client. Two that are ing; many sites insist that this proto-
documented in the WebMite user col is used.
manual are getting the weather and
sending emails. Network Time Protocol
You need an account with a weather Getting the current time and date is
service to get the weather. The user such a common task that the WebMite
manual describes how you can con- has a dedicated command for just this
nect to Open Weather Map; you can purpose using the Network Time Pro-
get a wealth of data using their ser- tocol (NTP) as follows:
www.poscope.com/epe vice, such as the current tempera-
WEB NTP timeoffset
ture and weather for a city or sub-
urb, plus a forecast for the next day With this command, the WebMite
or two. Open Weather Map is free for will get the date/time from a public
the basic service and is accurate and time server pool and set the internal
comprehensive. clock of the WebMite accordingly. This
Sending emails is a little more com- means that you do not need a real-
plicated, as most email relay services time clock in your project; you don’t
have protection to stop them from need a mechanism to adjust the time
being used to send spam. To send an or date either.
email, you need to connect to an SMTP The parameter “timeoffset” is the
relay service that will then send your local time zone as a floating point num-
email to its destination. The example ber. For example, “WEB NTP 9.5” will
in the user manual uses SendGrid for get the current time and set the clock
this task, as they allow a free account in the WebMite to Adelaide time. Note
to send up to 100 emails a day (plenty that daylight saving compensation is
for the WebMite). not included in the NTP service.
Sending an email is handy as it Another handy inclusion is a series
allows your WebMite-based gadget to of commands to post and retrieve data
- USB - PWM alert you to errors and faults, provide from an MQTT broker. MQTT (Mes-
- Ethernet - Encoders regular status updates etc. For exam- sage Queuing Telemetry Transport) is
- Web server - LCD ple, your greenhouse monitor could a protocol that enables a client to post
- Modbus - Analog inputs
- CNC (Mach3/4) send an email if the temperature went data on a server (called an MQTT bro-
- Compact PLC
- IO too high or low. ker) for later retrieval by another cli-
Many internet services now require ent. It is rather like a bulletin board
a secure (encrypted) connection, so service for small computers.
the WebMite also implements an An example would be our green-
experimental version of TLS (Trans- house monitor. Say it was battery-­
port Layer Security), an extra protocol powered; it could power up once an
layer above the TCP layer that super- hour, measure the temperature/humid-
sedes the SSL protocol. Client-server ity, post the results to an MQTT broker
applications use TLS to communicate and power down to save the battery.
across a network in a way designed to Separately, a client program on a PC
- up to 256 - up to 32 could later read these messages, dis-
microsteps microsteps
- 50 V / 6 A
play the results and graph them.
- 30 V / 2.5 A
- USB configuration
- Isolated Conclusion
In this summary of the WebMite firm-
PoScope Mega1+ ware, we have not mentioned all the
features that the WebMite inherited
PoScope Mega50 from the PicoMite. That includes the
high-performance CPU, fully-­featured
BASIC programming language, built-in
program editor, support for touch-­
sensitive LCD panels, playing sound
and music, external SD cards and an
extensive range of communications
protocols like serial and I2C.
The Raspberry Pi Pico W costs little
(~£5) and is readily available, so why
not have a go? Load the free WebMite
Screen 5: you can include embedded firmware and discover how easy it is
controls such as buttons, checkboxes, to connect to the internet or turn this
- up to 50MS/s radio buttons, input text fields and cheap device into a web server.
- resolution up to 12bit much more on a web page using
- Lowest power consumption HTML forms. The user can use these
- Smallest and lightest
to send commands to the BASIC
- 7 in 1: Oscilloscope, FFT, X/Y,
Recorder, Logic Analyzer, Protocol program running on the WebMite to Reproduced by arrangement with
decoder, Signal generator turn devices off or on, set parameters SILICON CHIP magazine 2024.
and so on. www.siliconchip.com.au

32 Practical Electronics | August | 2024


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

Mike & Richard Tooley CD


JUMP START CD

TEACH-IN 3 TEACH-IN 5
£7.99

Mike & Richard Tooley


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

FROM THE PUBLISHERS OF

huge range of subjects that will interest everyone involved 15 design and build circuit projects for newcomers or JUMP START
CIRCUIT SURGERY
in electronics – from newcomers to the hobby and i The how and why of circuit design those following courses in school and colleges. 15 design and build circuit projects
dedicated to newcomers or those

PRACTICALLY SPEAKING
students to experienced constructors and professionals.
following courses in schools and

The projects are: n Moisture Detector n Quiz


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

PIC ‘N MIx
Surgery, EPE/PE’s regular clinic dealing with readers’ Powered Charger n Versatile Theft Alarm n Spooky
i Over 40 different circuit ideas
Starting out with PIC microcontrollers

queries on circuit design problems – from voltage nics


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

t
W

1
TWO TEACH-INs FOR

Elec
©
TWO TEACH-INs FOR
THE PRICE OF ONE! THE PRICE OF ONE !
The second section – Practically Speaking – i The free CD-ROM provides
a broad-based introduction
to electronics
n Egg Timer n Signal Injector Probe n Simple Radio Provides
a practi
cal
to PIC
introduction llers
Plus:
MikroElektro
Microchip pe
L-Tek PoSco
nika,
The free CD-ROM provides a
practical introduction to PIC

Receiver n Temperature Alarm.


microcontro software

covers hands-on aspects of electronics construction.


ws
for Windo

n Program i A complete stand-alone


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

Again, a whole range of subjects, from soldering to


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

8 Inter
active ledge
and logo, Techno
ip name of Microchip
Technol
Microch
ip
.09 software

PLUS
The Microch arks s. © 2013
Your Know
016-02
ed tradem countrie 1. MCCD1
register and other d. Issue
in the USAAll rights reserve

avoiding problems with static electricity and identifying


Inc.
3 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 40 circuit designs submitted by readers. microcontrollers and Practically Speaking – tips and techniques for project construction.
The CD-ROM also contains the complete Electronics Teach-In 1 book, which
provides a broad-based introduction to electronics in PDF form, plus interactive 29/04/20
10 13:21:42
The CD-ROM also contains:
quizzes to test your knowledge and TINA circuit simulation software (a limited n Complete Teach-In 2 book, a practical introduction to PIC microprocessors
n MikroElektronika, Microchip and L-Tek PoScope software.
dd 1

version – plus a specially written TINA Tutorial).


CD 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 CD-ROM covers three of the most


H
£29.9
INTRODuCTION TO ELECTRONICS 5

important electronics units that are currently studied in


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

many schools and colleges. These include, Edexcel


simulation software

BTEC level 2 awards and the electronics units of the


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

Diploma in Engineering, Level 2. THE MODERN ELECTRONICS MANuAL


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

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

contains over 800 pages of electronics theory,


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

What a Bargain!!
if not, open double-click
and
Explorer f
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 CD-ROM also contains all the circuit software for Teach-In 8 is an exciting series designed for
to electronics enthusiasts and computer buffs who the course, plus demo CAD software for use with the electronics enthusiasts who want to get to grips with
want to get to grips with the Raspberry Pi. Teach-In series. the inexpensive, popular Arduino microcontroller, as
n Discrete Linear Circuit Design well as coding enthusiasts who want to explore
Teach-In 6 is for anyone searching for ideas to use n Understand linear circuit design
their Pi, or who has an idea for a project but doesn’t hardware and interfacing. It will provide a one-stop
n Learn with ‘TINA’ – modern CAD software source of ideas and practical information.
know how to turn it into reality. This book will prove n Design simple, but elegant circuits
invaluable for anyone fascinated by the revolutionary nF  ive projects to build: The Arduino offers a truly effective platform for
Pi. It covers: i) Pre-amp developing a huge variety of projects; from operating
n Pi programming ii) Headphone Amp a set of Christmas tree lights to remotely controlling a
n Pi hardware iii) Tone Control robotic vehicle through wireless or the Internet.
n Pi communications iv) VU-meter Teach-In 8 is based around a series of practical
n Pi Projects v) High Performance Audio Power Amp. projects with plenty of information for customisation.
n Pi Class
n Python Quickstart This book also includes PIC n’ Mix: ‘PICs and the
PLUS PICkit 3 – A Beginners
n Pi World E
guide’ by Mike O’Keefe FCRDE-ROM
EE M

n ...and much more!


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

Audio Out – an
£8.99 £8.99
D CD
DV
and Circuit Surgery
The Teach-In 6 CD-
TEACH-IN 6 analogue expert’s take
TEACH-IN 7 by Ian Bell – ‘State TEACH-IN 8
FROM THE PUBLISHERS OF FROM THE PUBLISHERS OF
FREE
CD-ROM
ROM also contains all on specialist circuits
SOFTWARE
FOR

Machines part 1 and 2’.


THE TEACH-
IN 8
FROM THE PUBLISHERS OF SERIES

the necessary software RASPBERRY Pi ®


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

the techniques of
• Pi ClASS – SPECifiC lEARninG AimS • Learn with ‘TINA’ – modern CAD software • Microcontrollers – understand control operations
• PYthon QuiCkStARt – SPECifiC PRoGRAmminG toPiCS • Five projects to build: Pre-amp, Headphone Amp,
readers and circuit the files for:
• Communications – connect to PCs and other Arduinos
• Pi woRld – ACCESSoRiES, BookS EtC Tone Control, VU-meter, High Performance Audio Power Amp

project building.
• homE BAkinG – follow-uP ACtivitiES

designers can get FREE


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

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

easily with the projects


SERIES

IDE XC8 8-bit compiler


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

Smartscope software.
building PIC-based projects

Teach In 6 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
WebMite-based
Watering System Controller
By Geoff Graham
This advanced Watering System Controller does it all. It can change the
watering schedule depending on the seasons, check the weather forecast
before watering and even alert you to a burst pipe or blocked sprinkler. Best
of all, it is very easy to set up and use.

W
ateringsystemcontrollers, read it and edit it if you have any damage caused by the permanent-
often known as reticulation special requirements. ly-open valve.
or irrigation controllers, This project was partly developed Some systems have a pump as
are notoriously difficult to program. to demonstrate what you can do with the water supply; in that case, the
They generally have a small LCD the WebMite. Even if you do not want Watering System Controller would
screen and an array of tiny buttons to build a Watering System Control- switch that on and off instead of a
or switches to configure the water- ler, this project can be helpful by pro- master valve.
ing schedule. viding the code and techniques you Either way, the Controller will
Our Watering System Controller can use in other projects. switch it on half a second before
has no LCD or buttons; it is entirely The Watering System Control- the first sprinkler valve is opened
set up and controlled via a web ler program will even run on a bare and switch it off half a second after
browser on your smartphone, tablet Raspberry Pi Pico W. That means you the last has been closed. That is to
or computer. The web pages are easy can explore the program and try it ensure that the water pipes lead-
to understand and provide every- yourself without building anything; ing to the sprinkler valves are kept
thing you need to set it up. you just need the Pico W module. full of water, avoiding the situation
The key component is the WebMite, where a sprinkler valve closes after
a Raspberry Pi Pico W microcontroller Watering system layout the master valve, letting water out
running the MMBasic programming Fig.1 shows a typical reticulation lay- of the pipes.
language, starting on page 28 in this out. The water supply is connected Otherwise, when the master
issue. Here it delivers the web pages, via a master valve to a series of valves valve next opens, the water rushing
gets the time, date and weather from that control individual sprinklers (or through the empty pipes could act
the internet and follows the watering sets of sprinklers). The Controller as a hammer and damage the joints
schedule you have configured. opens the master valve, then steps in the pipe and the valve.
The only other significant com- through each sprinkler valve in turn, The flow sensor is an optional but
ponents in this design are a small opening them for the specified time. worthwhile addition. It is usually fit-
power supply and the solid-state The master valve is important as ted at the outlet of the pump or mas-
relays (SSRs) that drive the solenoid it provides a backup if one of the ter valve and tells the Controller the
watering valves. sprinkler valves is stuck open (it amount of water flowing through the
The program running on the Web- happens). The master valve will still system. The Controller records this
Mite is written in BASIC, so you can cut off the water supply, limiting the and, over time, builds up an average
flow rate for each valve.
The Controller can then easily
The finished controller detect an abnormal flow rate when it
in a weatherproof opens a valve, either over or under
enclosure mounted the average. This is invaluable as
on an exterior wall. an excessive flow indicates that a
We decided to mount pipe has burst and it might be dig-
the status LED on ging a hole in your garden. A low-
the lid along with a er-than-normal flow rate means a
waterproof power sprinkler or valve is blocked; if left
switch.
unfixed, that could cause your plants
to die.
When an excessively high flow is
found, the Controller immediately
shuts off that valve to stop any dam-
age. In the case of underflow, it will
continue with the watering time in
the hope that some water is getting

34 Practical Electronics | August | 2024


Fig.1: a typical watering system
layout. The water supply is
connected via a master valve (or
pump if using rain water) to a series
of valves that control the sprinklers.
The optional flow sensor allows
the Controller to detect a burst pipe
(above-average flow) or blocked
valve (below-average flow).

through, but it will also inform you Typical Watering System Control- The first field on the configuration
of the problem. lers require you to change the water- page allows you to enter a meaning-
The rain sensor is also optional. ing characteristics at the start of each ful title to be displayed on the main
The Watering System Controller season, and that can quickly become page. You can also enable or dis-
can check the weather forecast for tedious, something that our design able the schedule with a checkbox.
you and skip watering if rain is pre- cleverly eliminates. The next four fields let you set the
dicted, but connecting a rain sensor That page includes buttons to con- start and stop dates in the year for
provides a backup specific to your figure each schedule. After clicking the schedule. Schedules can over-
garden. The Controller will check one, you will be presented with a lap and, if you want the same water-
the sensor before it starts a watering web page similar to that shown in ing scheme for the whole year, you
run, and if it indicates that it is cur- Screen 2, which provides all the can set the start to 1/1 and the end
rently raining, the schedule will be schedule details. to 31/12.
skipped for that day.

Controller capabilities Features & Specifications


To set up the Controller, you use a web » Configured using a web interface from a smartphone, tablet or computer
browser to access its web page, shown
» Controls a master valve plus up to eight sprinkler valves
in Screen 1. It lists all the possible
» Up to eight independent watering schedules
watering schedules, with a button
to configure each. It also has a RUN » Schedules can be customised for different requirements during summer etc
NOW button that can be used to start » The active schedule can be skipped if rain is forecast or detected
the watering schedule at any time. » Sprinkler times can be increased on hot days
These schedules are set to start at » Flow sensor support for detecting burst pipes, blocked valves or sprinklers
a certain date in the year and termi- » A rain sensor can be connected to avoid watering during rain
nate at another. For example, you » Schedules can run on certain days of the week or at intervals in days
can set up a schedule for the sum- » Schedules can start at a fixed time or a period before/after sunrise/sunset
mer months tailored to the demands » Time and date are set from the internet with automatic daylight saving
of hot weather, another for autumn compensation
when less watering is required, » No battery-backed clock is required
another for winter and so on. You » Schedules continue if the WiFi or internet is down
can set up the watering requirements
» Schedules automatically restart after a power failure
for the whole year and, unless you
» Powered by 24V AC at 1A
change your mind, it will be repeated
year after year.

Practical Electronics | August | 2024 35


The following section allows you valves (plus the master valve), but a maximum temperature over a cer-
to set the days of the week for water- you do not need to install that many tain threshold. The former can avoid
ing or specify a watering interval in if you need fewer. The program will wasting water, while the latter can
days. This is a case of one or the other skip any valves with a zero or blank prevent plant death on unusually
but not both. watering time. hot days.
Following this, you set the time If you have entered some water- At the bottom of the page is a but-
for the watering to start. Screen 2 ing times in these fields, the RUN ton to save the changes that you have
shows this set to 6 hours 0 minutes NOW button will appear on the main made. The BASIC program saves the
after midnight (ie, 6am). However, page, even if the schedule is dis- configuration and settings to a file
using the dropdown list, you can abled and the other fields have not called “settings.dat” in the internal
also specify a number of hours and been filled in. That means you can file system of the WebMite. On pow-
minutes before sunrise, after sun- create a watering sequence that can er-up or a reboot, the program reads
rise, before sunset or after sunset. only be started on demand from the that file so that all the details are in
That gives you a lot of flexibility in web page. memory.
setting the start time. The final section allows you to
In the next section, you can con- change the watering schedule for General settings
figure each solenoid valve’s water- that day depending on the weather The GENERAL SETTINGS button
ing time in minutes. The Controller forecast. You can skip watering at the bottom of the main page (in
will step through each valve in the entirely if rain is forecast, and you Screen 1) takes you to the web page
sequence, opening it for the spec- can increase the watering times if the shown in Screen 3. On this page,
ified time. It can drive up to eight forecast for the next 24 hours predicts you can tell the program your loca-
tion, connected sensors and details
Screen 1: the for sending emails.
main web page The location data is used for many
you see when you features of the Controller, including
connect to the its time zone, daylight saving com-
Controller. It lists pensation, the times for sunrise and
all the watering sunset and the weather forecast. You
schedules and
need to enter the name of your city
their start and
stop dates. The and the country code, which is AU
CONFIGURE for Australia and NZ for New Zealand
button lets (a full list of the Alpha-2 codes can
you change be found at https://w.wiki/Gb$). After
the associated that, you can click on the TEST but-
schedule, ton, and you should see a response
while the RUN similar to that shown in Screen 4.
NOW button For large cities, you can also enter
immediately a suburb (eg, “North Sydney”); if that
starts that
is found, it will provide you with a
program.
more specific weather forecast.
The database has over 200,000
cities and towns, so you should be
able to find your location. If you can-
not, try for the nearest larger city or
town within the same time zone. The
Screen 2: this weather predictions might still be
allows you accurate enough, depending on how
to modify
close it is to you.
a schedule,
including the These functions use data
start and stop from Open Weather Map (http://
dates, the time openweathermap.­com). It uses that
to start watering, service to look up the latitude and
the watering time longitude when validating your loca-
for each valve tion. The program can then use that
and the actions to information to query Open Weather
take based on the Map for your time zone (includ-
weather forecast. ing DST) and the sunrise and sun-
set times.
If a schedule depends on the
weather forecast, the program will
query Open Weather Map for the
24-hour forecast before running the
watering schedule. With that data,
the program can then determine if
the schedule should be skipped or
needs to be modified.
If you do not enter a location, the
Controller will still operate but will
use the AEST (GMT + 10 hours) time

36 Practical Electronics | August | 2024


zone or whatever is set in the BASIC Screen 3: this
program. You can still set a watering screen lets
you change
schedule and start times, but com-
the settings for
pensation for daylight saving will the Controller
not be included, and you will not as a whole.
be able to set times based on sunset/ You can tell it
sunrise or modify the schedule based your location,
on the weather. the connected
sensors and how
Sensors to send emails.
There is a section below the location The location
data where you can configure the is particularly
important as it is
flow and/or rain sensors (if fitted).
used to determine
The flow sensor will alert you if the the time zone,
water flow for a particular valve is daylight saving
significantly over or under its average compensation,
flow rate. Either case will cause the times for sunrise
status LED to flash and add a warn- and sunset and
ing message on the main web page of the weather
the Controller. However, these can be forecast.
missed, so an email alert (see below)
should also be configured to ensure
you are notified of the fault.
If the fault is not corrected, the
Controller will, over time, add this
abnormal flow into its average flow
rate for the valve and eventually stop
treating it as a failure. So, if you get
an email indicating a fault, make
sure that you attend to it. When you
fix the fault, click the button to reset
the average so that the BASIC pro-
gram knows to build a new average
for fault detection (it will do that for
all valves).
You can connect a rain sensor and,
if configured, the Controller will not
run a watering schedule if it is cur- Screen 4: you can
rently raining. That is in addition to test the location
checking the weather forecast. Most you entered and
if it is found,
rain sensors have normally-closed
you will see a
contacts that open in the case of message like this.
rain, which is what the Controller is When you test the
designed for. You just need to con- email function,
nect it to the screw terminal on the you will see a
Controller and tick the box to enable similar message
this function. confirming that it
worked OK.
Sending emails
This is an invaluable feature as you
would not normally check the Con-
troller’s status LED or web page daily.
Because sprinklers are usually run
before sunrise, critical faults can which should be entered in the next dominated by the Raspberry Pi Pico
remain unnoticed for months, by field (From Email Address). Finally, W (ie, the WebMite). The only other
which time they could have done a you need to provide an email address significant components are the power
lot of damage to your garden. to receive emails. This can be the same supply and the solenoid drivers.
To send emails, you need to open as the From Address or different. All valves use a single common
a free account with SendGrid (http:// To test your settings, click on the return connection. The Controller
sendgrid.com). Opening the account TEST button. After a few seconds, is designed for the typical solenoid
is a little tedious because they need to you should see a confirmation mes- valves used in domestic reticulation
verify your identity to prevent spam- sage telling you that a test email has systems that are controlled by 24V
mers from abusing their service. How- been successfully sent. You can then AC. These solenoids usually draw a
ever, with the account created, you can check your email inbox to confirm surge current of 350mA when ener-
get a free API key (a 69-character string) you have received it. gised, then drop to a holding current
that you can enter in the API key field. of about 220mA.
When you get the key from Send- Circuit details An IXYS CPC1965 solid-state relay
Grid, you must also provide them The circuit diagram for the Water- drives each valve. These switch on
with a matching “from email address”, ing System Controller, Fig.2, is the zero crossing of the AC waveform,

Practical Electronics | August | 2024 37


so there are no problems with induc- divider that sets the output to 5V and into the WebMite, letting you use the
tive kickback from the coils in the a couple of bypass/filter capacitors. USB port to debug and test the soft-
solenoid valves. These are controlled The power requirement of the Con- ware on the WebMite even while the
by an inbuilt LED that provides iso- troller is modest at 60-100mA. Watering System is powered.
lation between the input and output. However, the relatively high input The flow and rain sensor inputs are
The drive current for the LED is voltage of around 34V DC from the pulled up to 3.3V (from the Pico) by
about 5mA (limited by the 470W rectified 24V AC would result in 3.3kW resistors and clamped to stay
resistor), which is well within the 3-4W of heat being generated by a within the supply rails by pairs of
drive capability of the microcontrol- linear regulator. In a sealed enclo- schottky diodes. The diodes are for
ler’s digital outputs. sure, that could lessen the life of protection from miswiring, nearby
Only two solenoid valves can be the electrolytic capacitors. With the lightning strikes etc. In both cases,
energised at once: the master and the switching power supply, dissipation the input is pulled to ground by the
currently open sprinkler valve. These is less than 1W. sensor, which is detected and pro-
are protected by separate PPTC (poly- The life of the electrolytic capaci- cessed by the WebMite’s BASIC pro-
meric positive temperature coeffi- tors is a major consideration, as the gram.
cient) ‘fuses’, which increase in resis- Watering System Controller should There are two LEDs and two tac-
tance if there is an excessive current ideally last for 10-20 years or more. tile switches mounted on the PCB.
through them, limiting the maximum For this reason, we have speci- The red LED indicates the control-
current. When the fault is removed, fied high-­voltage, high-temperature ler status; when it is solidly lit, the
they revert to regular operation. capacitors with higher capacitances Controller is operating without fault.
They protect against short circuits than strictly necessary. Those factors If it is flashing or off, that indicates a
in a solenoid or the solenoid wiring. together should extend the life of the fault like an abnormal flow detected
The power supply is a switching capacitors considerably. by the flow sensor, an inability to
buck (step-down) regulator provid- 5V power to the WebMite is sup- connect to the internet etc.
ing 5V DC to the WebMite and the plied via schottky diode D2. This is to The green LED illuminates when
flow sensor (if fitted). This comprises isolate the Controller’s power supply the Controller is running a watering
switching regulator REG1, induc- from the USB 5V provided by your cycle; the abort button below it can
tor L1, diode D1, a feedback voltage computer if you have plugged that terminate this cycle. The reset switch
will force the WebMite to reboot,
which is useful if you are upgrading
the firmware.

Circuit board design


The fully-populated Watering Sys-
tem Controller PCB is shown in Photo
1. This is intended to be mounted
in a RITEC RP1285BF 186 × 146 ×
75mm waterproof sealed enclosure.
Altronics stocks this (Cat H0310F)
and there are others of a similar size,
some with a clear lid.
Note the screw terminals along the
bottom edge of the PCB. The first on
the left is the 24V AC power input.
While a capacity of 1A is specified, a
source capable of providing 750mA
or more should work OK.
Further along the bottom are the
outputs for driving the eight sprin-
kler valves plus one master valve.
Also on the bottom edge are the
inputs for the optional flow and rain
sensors. The flow sensor should be
a Hall effect type that can be pow-
ered by 5V DC. The parts list gives a
typical example, although there are
many other suppliers. The rain sen-
sor does not need power and should
be a type with normally-closed con-
tacts; again, the parts list gives a typ-
ical example.
The board has been designed so
there is plenty of space between the
screw terminals and the bottom of
the case, allowing you to route the
Photo 1: The fully populated Watering System Controller PCB (shown smaller wires easily.
than actual size). Along the bottom edge are the screw terminals for the power
On the top of the PCB, there is
input, the master valve plus eight sprinkler valves and the inputs for the
optional flow and rain sensors. The board has plenty of space below the screw space for a small toroidal transformer
terminals to route the wires. that can be installed by a qualified

38 Practical Electronics | August | 2024


Watering System Controller
Fig.2: the Watering System Controller circuit is dominated by the Raspberry Pi
Pico W (ie, the WebMite). The power supply at upper left is a switching design
to reduce heat generation. The solenoid drivers on the right switch on the zero-
crossing of the AC waveform to avoid inductive spikes from the solenoid valves.

electrician if the Watering System existing controller, it might already has space for a small toroidal trans-
Controller is to be permanently wired be available. former at the top, such as Jaycar Cat
to a power circuit. We mounted the prototype Water- MT2112 or Vigortronix VTX-146-
Before you decide on the place- ing System Controller next to the 030-212.
ment of the Controller, check that the house fusebox, which had a mains The Controller does not have facil-
WebMite can reach your WiFi net- GPO socket inside, then used a 24V ities for terminating and fusing the
work at that location. As described AC plug pack to power the Controller. transformer primary as that would
later, you can do this by loading the This is the best and most economi- be done by the electrician.
firmware onto the WebMite and pow- cal solution; suitable plug packs are
ering it with a 5V USB power bank inexpensive and easy to find. Typi- Construction
or portable computer. If you can call cal examples are Jaycar MP3032 and The Controller is built on a 132 ×
up its web page from that location, Altronics M9379A. 152mm double-sided PCB coded
you are good to go. If you want to power the Control- 15110231, with the components
ler from the mains, you will need a mounted as shown in Fig.3. It is
24V AC power source qualified electrician to run the cables available from the PE PCB Service
24V AC is the standard power supply and connect them to a power circuit. Before you start, you need to
for domestic watering system con- This is expensive, so we do not rec- decide what options you will include
trollers and if you are replacing an ommend it, but if you must, the PCB or exclude. The first is the number of

Practical Electronics | August | 2024 39


valves to control. Most reticulation panel of our prototype. If you see a factory-­fresh Raspberry Pi Pico W,
schemes only need two, three or four the LED flashing, you can visit the you first need to load the WebMite
sprinkler valves, but the Controller Controller’s web page to determine firmware (MMBasic). The process is
can control up to eight to accommo- the cause. described in detail in the WebMite
date large layouts. Most constructors All the components are through- User Manual, but we will summarise
will choose one of the options men- hole types, so construction should it here:
tioned in the parts list: four, six or be easy and there are no particular 1. While holding down the white
eight valves. tricks. Follow Fig.3 and the silk- button on the top of the Pico, plug it
The two sensor inputs are also screened text on the PCB and start into your computer. The Pico should
optional. You can omit the associ- with the low profile components, appear as a pseudo USB drive on
ated components if you do not plan working towards the taller compo- your computer.
to install a rain or flow sensor. Still, nents. 2. Locate the WebMite firmware
you might want to fit them in case The WebMite (Pico W) can be sol- (with a name like WebMiteV5.07.07.
you decide to use them later. dered directly to the PCB, but we uf2) and drag and drop that into the
The two LEDs and tactile switches strongly recommend using sockets USB drive.
are also optional. They are helpful if on the PCB and pin headers on the 3. When it finishes copying, the
you are fault-finding or setting up the WebMite to make it a plug-in device. WebMite will reboot and reconnect
Controller, but they will be of little That way, you can easily remove it to your PC as a serial port over USB.
use once the box is sealed. You could for testing and fault-finding. The green LED on the top of the Pico
mount them on the front panel using W should slowly flash.
waterproof LEDs and switches with Loading the firmware 4. Determine the name of the
flying leads, where they would be Before you plug the WebMite into serial port used by the WebMite (ie,
much more useful. the board, load the firmware via COM12), then use Tera Term (http://
We mounted a waterproof power the USB port on a computer (Win- tera-term.en.lo4d.com) to connect
switch and status LED on the front dows, Mac or Linux). Starting with to that port.

Fig.3: this shows where to


place the components on
the PCB. Note that many
parts are optional and
could be left off if you
don’t need them. Take care
with the orientation of
the IC, diodes, SSRs and
electrolytic capacitors.

40 Practical Electronics | August | 2024


5. Press return/Enter and you
should see the MMBasic command
Parts List – Watering System Controller
prompt (the > character).
1 double-sided PCB coded 15110231, 132 × 152mm
Next, you must set the WebMite
1 Raspberry Pi Pico W microcontroller module (MOD1)
options for accessing the WiFi net-
1 RITEC RP1285BF 186 × 146 × 75mm sealed enclosure
work. These are entered at the com-
[Altronics H0310F, DigiKey 164-RP1285BF-ND, Mouser 546-RP1285BF]
mand prompt and each will cause
1 330μH 0.5A bobbin-style inductor (L1) [Altronics L6227]
the WebMite to reboot, so you will
1 IXYS CPC1966Y or CPC1965Y solid-state relay (SSRLYM)
need to reconnect the Tera Term ses-
[Mouser 849-CPC1966Y or 849-CPC1965Y]
sion after each (the double quotes
2 500mA hold current, 1A trip PPTC resettable fuses (PTC1-2)
are required for the SSID and pass-
[Altronics R4550A or Bourns MF-RX050/72-AP]
word values):
2 PCB-mounting momentary tactile switches (S1, S2) [Altronics S1120]
OPTION WIFI “SSID”, “password” 2 two-way 5/5.08mm 45° PCB-mounting terminal blocks (CON1, CON2)
OPTION TCP SERVER PORT 80 [Altronics P2044A]
OPTION TELNET CONSOLE ON 2 20-pin headers, 2.54mm pitch (for MOD1)
2 20-pin header sockets, 2.54mm pitch (for MOD1)
The following command will show
2 3AG PCB-mounting fuse clips (F1) [Altronics S5980]
the IP address that your router has
1 3AG slow-blow 500mA fuse (F1)
allocated to the WebMite:
4 No.4 × 6mm panhead self-tapping screws
PRINT MM.INFO(IP ADDRESS) Semiconductors
Now you need to copy some files 1 LM2574(Y)N-ADJ buck regulator, DIP-8 (REG1)
to the WebMite’s internal file sys- 1 W04 400V 1.2A bridge rectifier (BR1) [Altronics Z0073 or Z0073A]
tem. The best way to do this is by 2 1N5819 40V 1A schottky diodes (D1, D2)
using TFTP on your computer. Fol- 1 3mm red LED (LED1)
low these instructions for Windows: 1 3mm green LED (LED2)
siliconchip.au/link/abmf Capacitors
The files are in the download for the 2 220μF 63V 105ºC radial electrolytic caps
Watering System Controller from the Resistors (all ¼W 5% axial)
August 2024 page of the PE website: 1 10kW 1 3.3kW 3 470W
https://bit.ly/pe-downloads
Extra parts for a four-, six- or eight-valve controller
They are named “retic.bas”, “con-
4, 6 or 8 IXYS CPC1966Y or CPC1965Y solid-state relays (SSRLY1-SSRLY8)
fig.html”, “index.html” and “setup.
[Mouser 849-CPC1966Y or 849-CPC1965Y]
html”. Use the following TFTP com-
4, 6 or 8 470W ¼W 5% axial resistors
mands to transfer the files (ipaddr is
2, 3 or 4 two-way 5/5.08mm 45° PCB-mounting terminal blocks
the IP address of the WebMite):
(CON3-CON6) [Altronics P2044A]
TFTP -i ipaddr PUT retic.bas Extra parts for the flow sensor
TFTP -i ipaddr PUT config.html 2 1N5819 40V 1A schottky diodes (D3, D4)
TFTP -i ipaddr PUT index.html 1 10kW ¼W 5% axial resistor
TFTP -i ipaddr PUT setup.html 1 3.3kW ¼W 5% axial resistor
You can check the files have copied 1 three-way 5/5.08mm 45° PCB-mounting terminal block (CON7)
correctly by using the command FILES [Altronics P2045A]
at the MMBasic prompt. That will list 1 5V-powered flow sensor, TTL output
the files in the internal file system. [Valves Direct siliconchip.au/link/abmg]
Now you can run the BASIC pro- Extra parts for the rain sensor
gram using the following command 2 1N5819 40V 1A schottky diodes (D5, D6)
and the Watering System Controller 1 10kW ¼W 5% axial resistor
should start up: 1 3.3kW ¼W 5% axial resistor
RUN “retic.bas”
1 two-way 5/5.08mm 45° PCB-mounting terminal block (CON8)
[Altronics P2044A]
When the program starts, it will 1 rain sensor with NC contacts [Valves Direct siliconchip.au/link/abmh]
print a series of status messages on the
console. The program does this when-
ever it takes some action; it is useful
for debugging and understanding what included in the download package. fault has been detected; if it is per-
is happening. Now you can install the WebMite on manently illuminated, that means
You can now fire up your web the Controller PCB, place the Control- that everything is working correctly
browser and enter in the address field ler in its final location and attach the (as far as the program is concerned).
the IP address of the WebMite that case lid. You can then set up the Con- While the Controller is starting up,
you determined earlier. When you troller as described earlier by accessing the LED will turn off or flash for a
press Enter, you should then see a it via WiFi, configuring each watering while, but if it is still flashing after a
web page similar to Screen 1 (with- schedule, completing the basic setup minute or two, something is wrong.
out the configuration data entered). section to enter your location etc. If the LED indicates an error, log
Note that it’s possible to skip all into the Controller web page and
the steps above apart from setting Fault-finding check for a message in red at the
the WiFi options and running the If the Controller does not work as bottom. This could be an incorrect
program by instead loading the all- expected, first check the status LED. configuration, inability to access
in-one “WaterCtrl.uf2” file that’s If it is off or flashing, that means a the internet, excessive water flow

Practical Electronics | August | 2024 41


Modifying the BASIC program '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
' User changeable constants
While the Controller is configured '''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''''
via its web pages, you can also ‘ set this to 1 to disable the location warning
change some minor settings by Const DisableLocationWarning = 0
editing the BASIC program. To do ‘ this is the default time zone if the location is not set
Const DefaultTimeZone = 10.0
this, use Telnet to connect to the
WebMite’s console (eg, using Tera ‘ the % increase in flow rate to trigger a fault
Term), then press CTRL-C to inter- Const UpperFtolerance = 50
‘ the % decrease in flow rate to trigger a fault
rupt the running program. Const LowerFtolerance = 50
Enter EDIT at the command
prompt to run the editor. Scrolling ‘ % forecast % chance of rain required to skip a schedule
down, you will see part of the pro- Const RainThreshild = 90
gram labelled “User changeable ‘ API key for accessing Open Weather Map
constants”, as shown in code below. ‘ This key is shared between all users of this program and is
These are the parameters that you ‘ limited to 60 queries/minute. This should not be a problem but
can easily change. ‘ you can easily get your own key and be inderpendent. To do this
‘ goto https://openweathermap.org/ and open a free account, then
The status LED will flash con- ‘ generate a key and replace the key below with your own key.
tinuously if you have not entered a Const OWMKey = "73cd207244614965fc5ca3646bdd10ab"
location on the general setup page.
To avoid this, you can turn off the hours). To do this, change the line daylight saving in this case.
warning by setting DisableLocation- CONST DefaultTimeZone = 10.0 The program will signal a fault
Warning to 1 instead of 0. to your time zone. For example, from the flow sensor if the value is
You might want to change the Adelaide is 9.5. Note that the pro- 50% above the long-term average.
default time zone from AEST (+10 gram will not be able to correct for This can be changed by changing

etc. When you correct this error, the


message should vanish and the sta-
tus LED will stop flashing.
If you cannot log into the web
page or the Controller appears dead,
unplug the WebMite and plug it
directly into the USB port on your
computer. Then use Tera Term to
access the serial-over-USB console
to diagnose the problem. You might
have to press CTRL-C to terminate the
running program so you can access
the MMBasic console.
Try restarting the BASIC program
with the command RUN “retic.bas”.
As the program starts, you should see
a series of messages in your terminal
emulator describing the progress.
The first will be concerned with con-
necting to your WiFi, then connect-
ing to the internet, followed by more
messages detailing the progress in
getting your location and time zone
from Open Weather Map.
The success or failure of these
should give you some pointers as to
where to look. Typical problems that
can trip you up include:
● Not programming the Pico W
with the correct WebMite firmware.
● Incorrect SSID or password in
the OPTION WIFI command.

Photo 2: the Controller mounted in


a waterproof sealed enclosure. This
shows it with an onboard 24V mains
transformer, but note that it must be
installed by a qualified electrician
who will terminate the primary and
connect it to a suitable power circuit.

42 Practical Electronics | August | 2024


computer but not in the enclosure,
the entry Const UpperFtolerance = If you open an account with Open then it could be something as sim-
50 to another value. For example, if Weather Map, they will provide you ple as a wire inside the controller
you wanted the Controller to be much with an API key. The key is a 32-char- box draped near the WebMite’s WiFi
more sensitive to excessive flow, you acter-long string of letters and num- aerial, reducing its sensitivity.
could change the value to 20 (20%). bers that acts like a password. To If the fault appears to be with the
Similarly, for the lower tolerance replace the key in the code, edit the control board, you will have to revert
(reduction in flow), change the entry program line starting with “Const to traditional fault-finding proce-
Lower­Ftolerance on the line below. OWMKey =”. dures like checking that the power
We have registered an account When the program gets the supply is working correctly and 5V
with Open Weather Map and used weather forecast from Open is on the VSYS pin of the WebMite.
the associated API key in the Water- Weather Map, the chance of rain Also check the component values
ing System Controller program. is returned as a percentage, with 0 and examine your soldering in detail.
Their free account provides us representing no chance of rain and Hopefully, your Watering System
with everything we need. The only 100 indicating certainty. If a sched- Controller will work the first time,
significant restriction is that users ule is configured to skip watering and you can relax knowing that
of the key are limited to 60 queries on a forecast of rain, the program your plants will have all the water
per minute or a million in a month. will do this if the chance of rain is they need.
That means that all users of this at least 90%. For future software updates, check
program will be using the same API You can change this threshold the Practical Electronics website or
key, but that should be fine as it is to anything you want by changing the author’s website at: http://geoffg.
unlikely for 60 users to all make a the line “Const RainThreshild = 90”. net/retic.html
call in the same minute. However, For example, if you only want to skip If you enjy using the WebMite
you can get your own access key if watering if it is certain to rain, you can then consider joining the Back Shed
you want to be independent. set the value to 100 (ie, 100% chance). Forum (www.thebackshed.com/
forum/Microcontrollers), where
many enthusiastic WebMite and
MMBasic users are happy to help
● Your router is not configured for ● You have not copied the program newcomers with advice and hints.
WPA-PSK security and DHCP. files to the WebMite. Use the FILES
● Your router is blocking the Web- command to check that all four files
Mite from reaching the internet. have been copied correctly and are
● You have not set the options cor- not zero bytes. Reproduced by arrangement with
rectly. Use OPTION LIST to check If the WebMite seems to oper- SILICON CHIP magazine 2024.
them. ate fine while plugged into your www.siliconchip.com.au

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 | August | 2024 43


Circuit Surgery
Regular clinic by Ian Bell

Topics in digital signal processing – the frequency domain

W
e are looking at various effect circuits or signal processing will
Amplitude
topics related to digital signal have on a signal and helps us understand
processing (DSP). DSP covers design requirements. The frequency axis
a wide range of electronics applications of signal spectra and response plots may
where signals are manipulated, anal- be linear or logarithmic, with logarithmic
ysed, generated, stored or displayed as axes often used when a very wide range
digital data, but originate from, and/or of frequencies is considered.
are output as, real-world signals for in- Signal strength on spectra may be 0 1 2 3 4 5 6 7 8
teraction with humans or other parts of plotted with various parameters such as Frequency/kHz

the physical world. Fig.1 shows the key voltage, current, power or power density.
Fig.2. Spectrum of a 1kHz sinewave.
elements of a generic DSP system with a Although theoretical spectra can be
signal path from an analogue input via continuous functions, the practicalities Amplitude
digital processing to an analogue output. of measurement and simulation usually
This does not necessarily represent every result in a spectrum that is effectively a
DSP system (not all have all the parts histogram comprising frequency ranges
shown) but it serves are as reference for or ‘bins’ for which the signal strength
the various subsystems we will look at. is plotted. It follows that if we change
In our discussion of sampling signals, the width of the bins the signal level in
0 1 2 3 4 5 6 7 8
so far we have mainly considered the each bin may also change. Using spectral Frequency/kHz
signals in time domain (waveforms of density avoids this problem, however,
voltage against time) but in DSP is it also when spectra are drawn simply to show Fig.3. Spectrum of a 1kHz square wave.
important to understand the frequency the general shape of the signals at different
content of signals (the frequency domain). frequencies, rather than provide specific Amplitude

For example, we have already discussed numerical data/measurements, the units


the Nyquist rate and the need for an and bin ranges are often less importance.
antialiasing filter (see Fig.1) to remove The sinewave has the simplest spectrum
signals which would cause errors in the with a single peak at just one frequency
sampled signal. This requirement relates (see Fig.2). Other simple periodic
to the frequencies inherently contained waveforms, such as square waves, have 0 1 2 3 4 5 6 7 8
in sampled signals. As Matt Pulzer spectra with peaks with specific relative Frequency/kHz
mentioned in his May 2024 Editorial, magnitudes at specific sets of individual
DSP is notoriously maths heavy. This frequencies (see Fig.3). Non-periodic, Fig.4. Spectrum of a generic non-period
month, we will cover several concepts meaningful waveforms, such as voice waveform with DC.
which relate to the mathematics in DSP, signals, contain a wide range of different
but with a focus on the ideas rather frequencies, but with stronger components Amplitude

than the equations. We will use one key at some frequencies than others, and a
formula and do some calculations that potentially complex variation of signal
involve just multiplying and adding. strength with frequency.
Often when discussing signal
Spectra processing we want to depict the spectrum
To depict the frequency domain, we use of a generic non-periodic signal, such as 0 1 2 3 4 5 6 7 8
graphs of signal strength versus frequency speech or music. Fig.4 shows a spectrum Frequency/kHz

– the signal’s spectrum. We also plot of such a signal which has content from
parameters such as the gain of a circuit DC to 2kHz. Fig.5 shows a spectrum of Fig.5. Spectrum of a generic non-period
against frequency as a frequency-response a signal with no DC (zero amplitude at waveform with no DC.
graph. Looking at frequency responses zero frequency) but also with content in such as these are commonly used when
and signal spectra together shows us the the range up to 2kHz. Spectral shapes discussing signal processing in the
frequency domain. The spectra in
Analogue Digital Analogue such figures are often drawn on linear
Antialiasing Sample and Digital Reconstruction
axes which can go down to zero (DC)
In ADC DAC Out
filter hold processing filter – log frequency axes cannot show
zero frequency (minus infinity on a
Fig.1. Generic DSP system structure. log scale).

44 Practical Electronics | August | 2024


Amplitude
signal using complex numbers. The two
parts of a complex number are known as (a)
Area = 4 × ¼ = 1
the ‘real’ and ‘imaginary’ parts. The term ¼
imaginary is employed because these
values are multiples of the square root of t
–2T –1 0 1 –2T
–1 (given the symbol ‘j’ in electronics).
There is no ‘normal’ number which when
–4 –3 –2 –1 0 1 2 3 4
Frequency/kHz
multiplied by itself gives –1, but it is a
very useful mathematical concept for (b)
Area = 2 × ½ = 1
½
Fig.6. Spectrum for a 1kHz sinewave with describing things that really do happen.
negative frequencies shown (same signal as For many signals the spectrum is
shown in Fig.2). symmetrical about zero frequency – for
t
example, Fig.6 shows the spectrum of –2T –1 0 1 –2T
Amplitude
a 1kHz sinewave including negative
frequencies and Fig.7 shows the same
spectrum as Fig.4 with the negative
frequencies included. The commonly (c) 1

seen symmetrical spectra may indicate


the negative part is redundant, however, Area = 1 × 1 = 1
asymmetric spectra are possible; this is
–4 –3 –2 –1 0 1 2 3 4
Frequency/kHz
related to the complex number properties
of the signal and occurs in cases such as t
Fig.7. Spectrum of a generic non-period the quadrature modulation mentioned –2T –1 0 1 –2T

waveform with DC with negative frequencies in the February 2024 Circuit Surgery.
shown (same signal as shown in Fig.4). Fig.8. Visualising a continuous time impulse.
Impulses
The mathematics behind the idea that An impulse is an idealised pulse. We
a signal can be represented as a sum mentioned impulses in the May 2024
of sinewaves (this is effectively what Circuit Surgery, and it is worth discussing 1
a spectrum shows) was first proposed them in more detail because they are
n
by the French mathematician Joseph important in signal processing. For –3 –2 –1 0 1 2 3
Fourier (1768 – 1830). The set of peaks example, digital filters are categorised in
in a periodic waveform is called its terms of their response to impulse inputs. Fig.9. Unit sample (discrete time impulse).
Fourier series, and the more general We can consider sampling as multiplying
mathematical process for converting from the continuous time signal by an impulse an area of 1 – this is an impulse. The shape
a time domain to a frequency domain train (a waveform comprising a set of is not necessarily rectangular, but this
representation of a signal is called the evenly spaced impulses). In continuous representation makes it easier to show the
Fourier Transform (and the reverse or time an impulse (also called a ‘Dirac delta’) constant area in this discussion.
inverse Fourier Transform goes the other is a pulse which is of zero duration but Fig.10 shows a continuous time
way). For the sampled signals used in DSP with ‘an area under the curve’ of one. For waveform, the unit impulse train used
the basic Fourier Transform is replaced discrete (sampled) signals an impulse is for sampling and the sampled signal.
by the Discrete Fourier Transform (DFT). a single sample with a value of 1 at one The spectrum of a unit impulse train is
There are several methods of calculating sample point and a value of 0 for all other interesting in that it has the same shape
the DFT from the signal sample data, but samples. This is called a unit sample and in the frequency domain – it is also a set
one method, the Fast Fourier Transform is related to another mathematic concept of evenly spaced impulses. If the time
(FFT), as its name suggests, is much more called the ‘Kronecker delta’. domain impulse train has amplitude 1
computationally effective than the others, Fig.8 shows a way of visualising a (unit impulse) and a period (time between
so FFT is the usual approach. To see the continuous time impulse, and a sampled impulses) of T (the sampling period)
spectrum of a waveform in LTspice you signal impulse is shown in Fig.9. The top then the spectrum is an impulse train of
use View > FFT from the right-click menu waveform (a) in Fig.8 shows a pulse that amplitude 1/T spaced by f = 1/T, where f
on the waveform. starts at time –2T and ends at +2T, so it is the sampling frequency. The spectrum
A consequence of the Fourier Transform has a duration to 4 (in arbitrary time units). of the sampling impulse train from Fig.10
is that the spectrum of a signal contains It is zero at all other times. Its amplitude is shown in Fig.11. The arrowheads seen
negative frequencies. This concept may is ¼ (this could be volts, but again the on the waveforms and spectrum in Fig.10
be hard grasp intuitively – it is a result units are arbitrary in this discussion). and Fig.11 are commonly used to indicate
of the mathematical representation of The area under the pulse is simple to impulses. The sampling impulse train and
the spectrum rather than being part of calculate because of its rectangular shape impulse train in the spectrum are often
our direct perception of the world. It is – it is 4 × ¼ = 1. The middle waveform considered to extend from minus infinity
related to the need to represent signals (b) shows a pulse half the duration and to plus infinity (in time and frequency)
and circuit responses using ‘complex twice the amplitude of waveform (a). Its for theoretical work, but of course this
numbers’. Amplitude alone is not area is also 1 (2 × ½). Similarly, the bottom does not happen for real signals.
sufficient to fully define a sinusoidal waveform is again half the duration and
signal of a given frequency – we also twice the amplitude, so the area is still 1 Convolution
need to know phase (offset in time). (1 × 1). We can repeat this process many We know the spectrum of the sinewave in
Phase and amplitude are not the most times with the pulse getting shorter and Fig.10 (a single frequency peak, like the
convenient way of representing the signal greater in amplitude. Eventually the pulse spectrum in Fig.2) and we have just seen
for mathematical analysis. An alternative, duration will tend towards zero and the the spectrum of the impulse train from
also with two values, is to represent the amplitude towards infinity, but still with Fig.10 (Fig.11). We also know that the

Practical Electronics | August | 2024 45


shown in Fig.10) the two
Continuous waveform with sample points xc(t) functions are the sinewave
spectrum (xc(f)) (like Fig.2) and
the impulse train spectrum s(f)
t (like Fig.11). These are both
functions of frequency that are
convolved to find the spectrum
of the sampled signal (xs(f)),
Sampling impulse train s(t) again a function of frequency.

Equation
Convolution can be applied to
t
T
both continuous and discrete
(sample-based) functions. For
continuous functions its
Sampled signal xs(t) definition involves integration Fig.12. Tetrahedral dice.
(calculus), but for the discrete
case we replace integration with up everything in the sequence of values
t summation, which is easier to defined by the expression to the right of
understand if you have not the sigma symbol (f(m)*g(n-m) in this
studied calculus. The case) and the summation range definition
convolution
Digital Signal Processing Topics – Frequency of the two discrete
Domain is below and above the symbol’. Here the
functions f(n) and g(n) is range is for variable m from -∞ to ∞. The
Fig.10. Time domain (waveform) view of the
defined by the following value below the sigma symbol defines
sampling process.
equation: the start value for m via the expression
! m = -∞ and the final value of m in the
sampled signal in Fig.10 (xs(t)) is related 𝑓𝑓(𝑛𝑛) ∗ 𝑔𝑔(𝑛𝑛) = ( 𝑓𝑓(𝑚𝑚) 𝑔𝑔(𝑛𝑛 − 𝑚𝑚) sequence is written above the sigma
to the continuous (xc(t)) and sampling "#$!
symbol. The value of n is fixed for a given
(s(t)) signal by multiplication: xs(t) = summation in the convolution equation,
xc(t)s(t). The question arises as to how We will look at the various parts of this but to find the complete result of the
this relationship maps to the frequency equation to explain what they mean. convolution (eg, a new spectrum) we
domain, and hence what the spectrum of The convolution operator symbol is ‘*’, need to calculate a separate summation
the sampled signal is. This leads us to an so f(n)*g(n) means the convolution of for all values of n from -∞ to ∞. However,
important mathematical operation called functions f and g. (The fact that the symbol as noted previously we can restrict our
‘convolution’ and an important theorem * is commonly used for multiplication calculations to much smaller ranges of n
which states that the multiplication of two in coding languages is a possible source and m for practical applications.
functions in time domain is equivalent of confusion.)
to the convolution of their spectra in A function is a mathematical operation Convolving dice
the frequency domain. Similarly, the performed on one or more variables (the We will illustrate a convolution
convolution of two functions in time variables are n and m in the above). calculation in a simple context before
domain is equivalent to the multiplication Functions are often named using a single looking at the calculation for a spectrum
of their spectra in frequency domain. letter (f and g in the above). For example, example. Consider throwing two dice
Unless you have studied mathematics we could define a function called q on and working out what the probability
at a fairly advanced level you may not variable x as meaning ‘x squared’, then that you get a specific total value. This
have heard of convolution, however it is we would write q(x) = x 2. However, is easy enough to solve by writing down
very important in a variety of areas – DSP functions in this context can also refer all the combinations, but it can also be
of course – but also probability theory, to things such as waveforms and spectra solved by a convolution, so it is a useful
image processing, artificial intelligence for which there is not a very simple example to show how the summation
and various other areas of mathematics, expression such as x2, but for which we sequences work. We will consider two
physics and engineering. A reasonably know or can find the value of, say, f(n) tetrahedral dice (see Fig.12) as they have
simple example, that people might not for any value of n. just four possible values rather than the
be aware is a type of convolution, is the As noted, the above equation is the standard six – this simply reduces the
moving average in statistics, which is also discrete version of convolution, which amount of calculation.
related to the basics of digital filtering. means the functions are of discrete For the first dice [‘die’ if you prefer] the
Convolution is an operation performed variables – that is, n and m are integer function f(n) is the probability of rolling
on two mathematical functions; it (whole number) values. As mentioned value n, which is ¼ or 0.25 for n = 1,2,3,4.
combines them to produce a new function. above, we typically assume that waveform Given that n can be any integer we note
In our case (spectra related to the signals and spectrum data ranges from minus to that for all other values of n, f(n) is zero.
plus infinity, so n and m would start at The function g(n) is the probability of
s(f) -∞, go through zero, that is … -1, -2, 0, rolling value n for the second dice, which
1, 2, 3 … and then on up to ∞. For real has the same values as f(n). The values
1/T
waveforms and spectra, we obviously are shown in Table 1.
have to use a more limited range and so The convolution f(n)*g(n) is equal to
–4f –3f –2f –f 0 f 2f 3f 4f typically assume all values of the function the probability that the total value of the
Frequency outside the range of interest are zero. two dice will be n. Given the minimum
The symbol S (Greek capital sigma) total is 2 (rolling two 1s) and maximum is
Fig.11. Spectrum of the sampling impulse in the convolution equation is the 8 (two 4s) we expect f(n)*g(n) to be zero
train from Fig.10, where f = 1/T. summation operator, which means, ‘add for all values except n = 2 to 8. We will

46 Practical Electronics | August | 2024


Table 1. Tetrahedral dice probabilities.
xs(f)
–2fs –fs fs 2fs
n … -2 -1 0 1 2 3 4 5 6 …
1
f(n), g(n) 0 0 0 0 0.25 0.25 0.25 0.25 0 0 0

Convolving spectra –10 –5 0 5 10 f


xc(f)
The dice example may seem a long way
1 Fig.15. Spectrum of the sampled sinewave
from DSP, but digital filters are based
obtained by convolving the spectra in Fig.13
on calculations like these in which f() is
and Fig.14. Note the replication of the
the input signal and g() is a set of values
–10 –5 0 5 10 f original spectrum.
which set the filter’s characteristics. Also,
as we mentioned above, we can use xs(f)
Fig.13. Spectrum of sinewave of frequency
convolution to calculate the spectrum –2fs –fs fs 2fs
f = 1 which is sampled.
of a sampled signal from the spectra
of the continuous signal and sampling
xs(f) signal. In general, the spectra may be
1 continuous, but by avoiding rigorous –10 –5 0 5 10 f
maths and choosing a simple case where
we can assume discrete spectra we can Fig.16. Spectrum of the signal similar to that
provide an illustration of this. in Fig.7 with a bandwidth from DC to f = 2
–10 –5 0 5 10 f
Consider a sinewave of frequency 1 sampled at fs = 5.

Fig.14. Spectrum of the sampling impulse (arbitrary units, but could be kHz) and multiples of fs to ±∞, but of course it is
train with sample frequency f = 5. sampling rate of 5 (could be 5kHz). limited in range in real systems. In the
The sinewave spectrum is xc(f), which discussion on modulation in December
corresponds to f() in the convolution 2023 we saw that multiplying waveforms
look at one example calculation in detail equation and is shown in Fig.13. Its value is together produced sum and difference
– getting a total of 6. There are 16 possible zero for all cases except xc(-1) and xc(1). The frequencies, and this is also what is
outcomes from rolling the two dice of sampling signal spectrum s(f) corresponds happening here with sum and difference
which 3 combinations add up to 6, these to g() in the convolution equation and is occurring at each multiple of the sampling
are 2+4, 3+3 and 4+2, so the probability shown in Fig.14. Its value is zero for all frequency. A further illustration in Fig.16
(calculated without convolution) of the cases except s(0) and s(n) where n is a shows the spectrum of a sampled version
total being 6 is 3/16 = 0.1875. multiple of 5. In general, the amplitude of of a signal similar to that in Fig.7 where
The convolution calculation f(6)*g(6) s(f) is the amplitude of the pulse divided the original spectrum extends from DC
is shown below in Table 2. This shows by T (sampling period); however, we will to f = 2 and sampling frequency is again
the summation (from the equation above) just assume it is 1 for simplicity. fs = 5. Again, we see the replication of
for a range of values of m around the We can quickly calculate xc(n)*s(n) to the spectrum at each multiple of the
points at which the results are non-zero. find the sampled waveform spectrum sampling frequency. Next month, we
For all other values of m we know that the by just considering the summation of will look at the implications of sampled
result will be zero so we do not need to x c(m)s(n-m) for the two cases where signal spectra for system design.
calculate these. The convolution delivers xc(m) is 1 (at m = -1 and 1) as
the result f(6)*g(6) = 0.0625 + 0.0625 all other cases contribute zero. Table 3. Convolution to calculate sampled signal
spectrum (non-zero values highlighted in blue).
+ 0.0625 = 0.1875, the same as above. This is shown in Table 3 for a
Convolution can be described as the small example range of n and m = -1 m=1
product of two functions where one is the resulting spectra is shown
n n-m xc(m)s(n-m) n-m xc(m)s(n-m) S
reflected in the y-axis (reversed) and in Fig.15.
shifted. We see in the above that in From Table 3 and Fig.15 -2 -1 0 -3 0 0
the calculation of f(n)*g(n) the terms we see that spectrum of the -1 0 1 -2 0 1
in f() and g() use different values sampled waveform contains the
of the variable (eg, f(1)g(5) and f(2) original spectrum (at f = -1 and 0 1 0 -1 0 0
g(4)) – this is the ‘shifting’. Also, the 1) plus copies of the spectrum 1 2 0 0 1 1
variable for g() goes down in value as shifted from its original position
2 3 0 1 0 0
the summation progresses (g(5), g(4), centred on 0 to being centred
g(3) and so on) – this the ‘reversal’ or on multiples of the sampling 3 4 0 2 0 0
‘reflection’. If you search online you can frequency. For example, the 4 5 1 3 0 1
find various animations which illustrate original spectrum is replicated
convolution calculations graphically to centred around f s to gives 5 6 0 4 0 0
help emphasise this point – for example, peaks at f = 4 and 6 (+1 and 6 7 0 5 1 1
https://youtu.be/KuXjwB4LzSA -1 relative to 5). Theoretically
7 8 0 6 0 0
this replication occurs for all
Table 2. Convolution calculation.

m … 0 1 2 3 4 5 6 …
f(6)*g(6) = …+ f(0)g(6-0) + f(1)g(6-1) + f(2)g(6-2) + f(3)g(6-3) + f(4)g(6-4) + f(5)g(6-5) + f(6)g(6-6) +…
f(6)*g(6) = …+ f(0)g(6) + f(1)g(5) + f(2)g(4) + f(3)g(3) + f(4)g(2) + f(5)g(0) + f(6)g(0) +…
f(6)*g(6) = …+ 0×0 + 0.25×0 + 0.25×0.25 + 0.25×0.25 + 0.25×0.25 + 0×0.25 + 0×0 +…
f(6)*g(6) = …+ 0 + 0 + 0.0625 + 0.0625 + 0.0625 + 0 + 0 +…

Practical Electronics | August | 2024 47


AUDIO AUDIO OUT

OUT
L R

By Jake Rothman
Switching in audio equipment – Part 3

I
finished off last month promising to move on to
+
electronic switching in this month’s Audio Out, and we L input 100µF 620Ω

+
will make a small start, but first there are a few odds and –
L output

ends to polish off in the mechanical audio switching section.


100kΩ
Mono Stereo
‘Soft’ bypass
0V
A ‘soft’ bypass, as opposed to a hard bypass shown in Fig.51
+
last month, is an arrangement that works well for internal R input 100µF 620Ω

+
R output
bypassing in systems where the input is driven from a low –
impedance. However, it does not work well for self-contained
100kΩ
units such as guitar pedals where the high-impedance guitar
signal is loaded by the input stage at all times, pulling the
0V
impedance down. A typical place where this is used is in
Hi-Fi preamplifiers to bypass the tone control – see Fig.52.
Fig.53. Traditional mono switch circuit.
Mono switch it cancels out across the left and right channels. In more
This is an essential test switch for music producers to sophisticated units, a little bit of gain is introduced via
listen for phase problems in stereo mixes, accomplished a proper summing amplifier (Fig.54) to counteract the
by mixing the left and right channels. This must be done attenuation. A typical ‘fudge value’ being +4.5dB.
using resistors, since it can be dangerous if the left and
right channels are simply joined together. Imagine if there ‘Juggler’ switch
were two out-of-phase 10Vrms signals from two op amps It is sometimes necessary to switch the order of two processing
(not impossible in audio) and their outputs were joined. blocks. A common dilemma facing music engineers is ‘do we
The ‘electronic smell of death’ from burning epoxy would have the EQ followed by the compression or the other way
soon fill the air. The simple resistive summing circuit round?’ It sounds very different depending on which way you
shown in Fig.53 leads to a halving of the voltage
level (−6dB) if only one channel has a signal on L input
it. It remains the same if it’s the same signal on + 100µF 47Ω Stereo
+

both channels, say a vocal in the middle of the



mix. This means material in the (stereo) middle 22kΩ L output
is louder relative to sources panned left or right 22kΩ
Mono
S1a

when ‘mono-ed’. This is fine for checking mixes,


but if one really does want to listen to stereo 0V
mixes in mono it’s not ideal, and compensating + 100µF 47Ω
for this is complex. However Hi-Fi buffs with
+

100kΩ
old record collections also like a mono button –

for playing mono records with a stereo pickup. 5kΩ 22kΩ


This reduces the surface noise because some of
Mono gain 0V
1.5kΩ

Out +
100µF
Output 22kΩ
EQ 0V Mono
Input from low- In Out S1b
impedance drive +
In 100µF R output
47Ω
+

R input
– Stereo

22kΩ
Bass Treble
0V

Fig.52. Alternative bypass circuit where the


processor’s input is always connected, such as in Fig.54. Mono switch circuit with a bit of gain tweaking to equalise the
this Hi-Fi preamplifier configuration. volume difference between mono and stereo.

48 Practical Electronics | August | 2024


Fig.56. Interior of
an Arcam 65 Plus
amplifier. It used
a microcontroller
employing a
rotary encoder to
accomplish full
remote control.
Too high tech for
me, I couldn’t fix
it. (Lovely Douglas
Self power
amplifier though!)
The thick white
wires are a bypass
‘bodge’ from the
Aux input sockets
to the tone control
inputs.

do it. One option is quite a convoluted ended up bypassing the whole selector
circuit called a ‘juggler’ using three section, reducing it to a single-input
Input 1
ganged change-over switches (3PDT) computer amplifier. RL1a
as shown in Fig.55. A real benefit of electronic
Input 2 RL2a
switching can be had by removing
Electronic switching easily corrupted small-signal wiring Input 3
RL1b
That’s i t f or me c h a n i c a l a u d io connected to mechanical switches at
switching; now we can move on to the front panel and confining it to the Input 4
the important topic of electronic audio PCB at the rear. The DC control signals
1 2
switching, which offers the possibility can then go anywhere around the front
V+ coil
of remote control that has become panel for the most ergonomic layout. voltage
an essential marketing tool today. I This means there is no need to worry 0V 0V
don’t rate it that highly as I’m always about hum when placing a switch next
NC
losing ‘remotes’ and I don’t think a to the mains switch. 1
sedentary lifestyle is so wonderful. If The simplest and highest quality 2
3
I’m going to select a new source, I see way of implementing DC control is Input
select 4
no problem in getting up to operate a to use relays, but it is debatable if
switch. A modern amplifier following this is truly ‘electronic’ – more like
this tradition is the Arcam 65 Plus ‘electromechanical’. On the other
shown in Fig.56. This design uses a hand, I tend to view relay control as
rotary encoder and a microcontroller electronic because it involves electrical Fig.57. Four input selector switch using
to control the electronic switching. control signals. Again, the relays can DPDT relays. Duplicate for stereo use.
Unfortunately, the micro died in mine be located at the back and only the Suitable relay is Relpol R8M822N,
and could not be replaced thanks to DC control wires need to go to the Rapid 61-6018.
proprietary programming/silicon. I front panel switch. Relays are most
commonly available with
V+
dual change-over contacts
and have to be used in the S1

FX A S1b special circuit shown in Off


In Out Push to break
Fig.57 to achieve a four-
A then B NO NC
position input selector. A
S1a
Input Output
possible problem with this RL1
approach is that the signal
B then A FX B
has to go through more than
In Out one contact. If the relays
S1c S2
are well-sealed (better still
hermetic) with gold-alloy On
Push to make
contacts then this is not
0V
Fig.55. A ‘juggler’ switch swaps over the order of two an issue. Relay control is
circuit blocks. S1 is a 3PDT device. An alternative still the choice in most
approach could use a 4053 logic IC or latching relay. top tier Hi-Fi systems and Fig.58. Latching relay circuit.

Practical Electronics | August | 2024 49


Debouncer section monostable
S1 1MΩ
S1 +5 to 15V V+
Push to 100nF Push to
make make –
0V 741
+ Output +10V until S1
pressed then –10V
V–
100nF
10nF 1MΩ 1.5MΩ
V+ To switch
sections 220kΩ
CD4001a CD4013a
Output 10kΩ 10kΩ
Q (inverted)
10nF

0V
D Q Output
R S
CD4001b
Fig.60. Op amp latching circuit. Avoids the use
100kΩ 100kΩ 100kΩ
of unreliable CMOS chips and give higher output
voltage as well.
latch with an op amp using a circuit that appeared
4.7kΩ in Elektor Summer Circuits (July 1983) as illustrated
in Fig.60. I have found this arrangement useful since
Low-current
LED, on when it can use a standard op amp power supply. It is
S1 pushed also a good use for old spare op amps that are too
0V
noisy for audio, such as 741s. A drawback is the
problem of an uncertain state upon switch-on. One
Fig.59. CMOS switch debouncer and flip-flop. Ideal for controlling 4066 way round this is to have some kind of capacitive
chips. Shown using single-rail supply, but could use a dual-rail supply. delay on one side of the bi-stable. Fig.61 shows a
discrete bi-stable used in Boss effects pedals.
test gear. My Audio Precision analyser takes the number of
relays to extremes, and many can be heard clicking away as Next month
it runs through various test routines. This mechanical noise That was a very brief start to electronic audio switching.
is annoying and strangely reassuring at the same time. Relay Next month, we will dive properly into this important and
coils consume relatively high levels of power at 100mW or fascinating topic.
more, and can generate high back voltages when turned off.
It is vital to use clamping diodes, an independent power rail
and an independent earth to avoid clicks and bangs.
ESR Electronic Components Ltd
Control logic
One of the great advantages of using electronic control is that
latching/maintained switches can be replaced by cheaper
momentary types. Gold-plated contacts are not needed All of our stock is RoHS compliant and CE
either since we are dealing with switching DC rather than approved. Visit our well stocked shop for
low-level signal currents, sometimes called ‘dry switching’. all of your requirements or order on-line.
However, we need to generate a latching action to hold the
selected position. It is possible to use a spare contact on a We can help and advise with your enquiry,
relay to do this job (Fig.58), but it is more convenient to use from design to construction.
a latching logic element, such as a flip-flop/bi-stable to do
this. This can be done with standard logic ICs such as the
4013 dual D-type flip-flop. A common problem affecting
counting logic when controlled by mechanical switches is 3D Printing • Cable • CCTV • Connectors • Components •
Enclosures • Fans • Fuses • Hardware • Lamps • LED’s •
switch bounce. This can cause erratic operation, such as
Leads • Loudspeakers • Panel Meters • PCB Production •
jumping a few steps randomly. A monostable made with a Power Supplies • Relays • Resistors • Semiconductors •
couple of NOR gates makes a good de-bouncer to feed the Soldering Irons • Switches • Test Equipment • Transformers
flip-flop, as shown in Fig.59. It’s also possible to make a and so much more…
Monday to Friday 08:30 - 17.00, Saturday 08:30 - 15:30
+9V

470pF 470pF
1MΩ 56kΩ 56kΩ

Output Output
100kΩ 100kΩ
BC549B
1kΩ
470pF BC549B
Foot switch 10nF 56kΩ 56kΩ Station Road
push to 470pF Cullercoats
make
0V North Shields
Tyne & Wear
NE30 4PQ
Tel: 0191 2514363 [email protected] www.esr.co.uk
Fig.61. Good old discrete flip-flop; still used in Boss guitar pedals.

50 Practical Electronics | August | 2024


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

Practical Electronics | August | 2024 51


Max’s Cool Beans
By Max the Magnificent

Arduino Bootcamp – Part 20

J
ust for giggles and grins, There are many different
let’s start this column with what families of these components. Top view
they call a ‘pop quiz’ in the US I suggested the LS (‘Low-

16v100uF
(this means an unexpected test; it’s Power Schottky’) family Side
views To other
nothing to do with pop music, thank because they are cheap and rails and
goodness). The way we currently have cheerful and do the job. My breadboard

our clock working, we always display second choice would have a k k


16V 100µF
the most-significant (left-hand) digit, been the HC (‘High-Speed a = anode (+ve) Electrolytic From
k = cathode (-ve) Capacitor Arduino
even if it’s a 0 (Fig.1a). Suppose we CMOS’) family because these
decided to suppress this leading 0 and are more tolerant with respect
instead display a blank (Fig.1b). Can to the voltages on their input Fig.2. Adding a 16V 100µF electrolytic capacitor.
you think of a way to implement this in signals. On the other hand,
our latest and greatest program from our they are less tolerant of static, and they ohms (kiloohms or kΩ, meaning 103),
previous column (PE, July 2024) using may be a tad more expensive. Some or millions of ohms (megaohms or MΩ,
the minimum number of modifications? hobbyist kits offer both LS and HC types meaning 106).
– see: https://bit.ly/44JMZRa By comparison, in the case of
Dazed and confused? The 04 and 08 reflect the types of logic capacitors, their values (capacitances) are
With respect to the 7404 and 7408 functions (the 04 contains six NOT gates; measured in units of farads (F). The term
integrated circuits (ICs) we introduced the 08 boasts four 2-input AND gates). ‘farad’ was originally coined by Latimer
in our previous column, I received You can peruse and ponder the entire list Clark and Charles Bright in honour of
several emails from dazed and confused of available functions on the interweb the English scientist Michael Faraday.
readers asking about the extra letters at: https://bit.ly/3wON1L3 We typically deal with capacitors having
marked on the packages, which should Last, but certainly not least, the final small values measured in millifarads
read something like SN74LS04N and character (or characters) indicates the (mF, meaning 10 –3), microfarads (µF,
SN74LS08N. For one stalwart fellow, package type, where N tells us that our meaning 10–6), nanofarads (nF, meaning
it was the ‘N’ that threw him into a tiz- devices are presented in plastic dual 10–9), and picofarads (pF, meaning 10–12).
woz. ‘Have I ended up with the wrong in-line packages (PDIPs). Why am I waffling on about this now?
ones?,’ he pleaded, plaintively. If you wish to delve deeper, a handy- Well…
Let’s start with the first two letters, dandy Interpreting TI Logic Part Numbers
which are shown as ‘SN’ here. These document is available for your perusing Smoothing things out
refer to the manufacturer, which is pleasure at: https://bit.ly/3ylkYn3 As I mentioned at the end of our last
Texas Instruments (TI) in this case – column, I ran into a WTW (‘what
under TI’s part numbering scheme, ‘SN’ Little and large the what?’) problem with one of my
stands for ‘Semiconductor Network’. The There used to be a British comedy duo breadboards. During the process of
‘74’ portion of the moniker indicates called Little and Large. Straight man diagnosing this problem, I did what I
commercial components that operate Syd Little (born Cyril John Mead) and should have done much earlier, which is
over a temperature range of 0°C to +70°C. comic Eddie Large (born Edward Hugh to add a 16V 100µF electrolytic capacitor
If this were 64, it would indicate an McGinnis) became household names straddling the power and ground rails
industrial component (–40°C to +85°C), in the late 1970s and the 1980s. The on the breadboard as close as possible to
while 54 would signify a military reason they just popped into my mind the point where the power and ground
component (–55°C to +125°C). is that we tend to deal with very small wires arrive from the Arduino (Fig.2).
and very large values with respect to This type of capacitor looks like a
electronic components (just call me the small soda can with two legs. It’s a
‘Sovereign of Segues’). polarised component (ie, a part with
Take resistors, for example. The values polarity), which means it can be correctly
(resistances) of these little scamps are connected into the circuit in only one
(a) Display leading 0 measured in units of ohms (symbol orientation. The longer lead is the anode,
Ω). These are named after the German which is connected to the more positive
physicist Georg Simon Ohm, who studied rail (the +5V rail, in our case). The shorter
the relationship between voltage, current lead is the cathode, which is connected
and resistance (and often forgotten, to the more negative rail (the 0V rail, in
(b) Blank leading 0 temperature). We typically deal with our case). The cathode side of the can is
resistors having large values measured also marked with a minus sign to give
Fig.1. Do we want a leading 0? in hundreds of ohms, thousands of us a clue. You can obtain these devices

52 Practical Electronics | August | 2024


digital logic devices – like our 7404 Mea culpa
100nF Ceramic Capacitor and 7408 chips – are switching, they I have something to share with you –
can pull the supply rail voltage down mea culpa – which means ‘through
Top view by introducing a momentary (transient) my fault’ in Latin, and is used to mean
Side view 104
current load. This can affect nearby ‘it was my fault’ or ‘I apologise.’ So,
devices, which are ‘coupled’ via their why am I apologising? Well, I came to
power and ground pins. To prevent realise that I sort of threw you in at the
this, a ‘decoupling capacitor’ is usually ‘deep end’ in our previous column. I
7404
applied between the power and ground presented you with the schematic and
pins of the IC (the same as the bypass layout for our new 2:4 decoder without
capacitor). In this case, we can think any accompanying assembly and test
of the capacitor as acting like a small, instructions... yup, mea culpa
localised energy reservoir (a miniature Throughout this series, I’ve enjoined
battery, if you will), holding the voltage you to take things one step at a time. I
steady long enough for the main supply should have followed my own advice
Fig.3. Adding an 0.1µF (100nF) ceramic to catch up. when it came to the addition of the
capacitor to the breadboard. It’s a good idea to add decoupling/ decoder. ‘It’s just two jellybean logic
bypass capacitors in the form of chips,’ I thought. ‘I can do this in my
ceramic components to our circuits. sleep,’ I thought. ‘What could possibly
from any electronic component supplier, If you are unsure as to the number(s) go wrong?’ I thought.
including Amazon – see, for example: and value(s) of these capacitors, you So, you can only imagine my surprise
https://bit.ly/44LzpNa should check the data sheets for the when I first ran the program with the
The 100µF is the device’s capacitive specific manufacturers’ parts you are circuit featuring our new decoder and…
value read as ‘100 microfarads’. The 16V using. Having said this, a good rule of it didn’t work. Even worse, it didn’t
is its rated value, which means it isn’t thumb is one 0.1µF (100nF) capacitor work in a very unintuitive way. That’s
capable of handling more than 16V. I per IC. This should be positioned as when I started to worry about how you
picked 16V because (a) it provides nice close to the IC’s power pin(s) as possible, were getting on at your end.
headroom over our 5V supply and (b) it’s connecting this pin to the ground plane After a lot of messing around trying to
a commonly available value. It would in the case of a printed circuit board diagnose the issue, eventually resorting
be perfectly OK to use a higher rated (PCB), or to the ground rail in the case of to having a video call with my chum, Joe
component like 25V or 50V if that’s what a breadboard (Fig.3). Ceramic capacitors Farr, it turned out there was a problem
you have available. However, a higher aren’t polarised, so we can connect them with the internals of my breadboard in
voltage rating typically means a physically either way round. the area where I’d added my 7404 and
larger or more expensive part, often both. Why haven’t I mentioned these before? 7408 chips (sometimes one is tempted
This capacitor is used to filter out any Well, our current circuit involves only to wonder if Gremlins truly are naught
electrical noise from the power source, two chips containing combinatorial but a myth).
which is the Arduino in our case. It functions that are less susceptible to When I eventually come to remove all
can also help to smooth out any power noise and voltage dips on the power rail. the components from this breadboard at
dips caused by components switching Things will become more ‘interesting’ some stage in the future, I’m going to pry
and drawing extra current. This isn’t when we start to use chips containing the back off and look inside to locate the
a mission-critical component for our sequential (clocked) elements, such problem. However, since I was pushed
existing circuit, but I’ve decided to add as shift registers, for example. Having for time, and since I knew that everything
one anyway. said this, it’s good to get into the habit apart from the decoder was operating
of adding these capacitors as a matter as expected, I simply reconstructed
No coupling allowed of course, so that’s what we are going the decoder portion of the circuit on a
As you may recall, the terms ‘current- to do. You can get ceramic capacitor separate half-size breadboard (Fig.4).
limiting,’ ‘pull-up,’ and ‘pull-down’ kits containing multiple values – see: As you can imagine, I was just a little
are simply qualifiers we add to https://bit.ly/4bEAUiv less cocky this second time around,
resistors to remind ourselves as to the One thing that can trip beginners causing me to implement the decoder
functions we’re using them to perform up is that the values printed on these in a more staged way, as discussed later
(the physical devices we use are the components are not particularly in this column.
same). Similarly, ceramic capacitors intuitive, so do your best to not get
can be employed for a wide variety them mixed up. What we are looking That’s shocking!
of tasks, including acting in ‘bypass’ for is components that say ‘104’ (if Before we plunge into the fray with
and ‘decoupling’ roles. Although these we are lucky) as illustrated in Fig.3. gusto and abandon (and aplomb, of
serve different purposes, many people What does this mean? I was hoping course), we should remind ourselves
use the terms ‘bypass capacitor’ and you wouldn’t ask. It means 10 x 10 to that semiconductor devices like light-
‘decoupling capacitor’ interchangeably. the fourth power (10 x 104) = 100,000 emitting diodes (LEDs), transistors and
A ‘bypass capacitor’ is usually applied measured in picofarads (pF), which ICs can be fatally affected by static
between the power and ground pins of an equates to 100nF or 0.1µF (now, you try electricity in the form of electrostatic
IC. It provides a low-impedance path to explaining this to someone). discharge (ESD). If you happen to build
steer voltage spikes and high-frequency I’ve added all the capacitors up a static charge (by walking across a
noise to ground, thereby ‘bypassing’ the mentioned here into the latest and carpet in your stocking feet, for example)
IC. (This noise can come from the power greatest incarnation drawing of our and you generate a spark, although
supply or other parts of the circuit or prototyping platform (file CB-Aug24- there’s not much current, that spark can
external sources). 01.pdf). And, as usual, all the files be as high as 35,000V, which can give
The term ‘coupling’ refers to the mentioned in this column are available any semiconductor device with which
undesired transfer of electrical energy from the August 2024 page of the PE it comes into contact a very ‘bad hair’
between subsystems. For example, when website: https://bit.ly/pe-downloads day indeed.

Practical Electronics | August | 2024 53


Fig.4. Working system with the 2:4 decoder on the half-size breadboard at the bottom.

As I said deep in the mists of time is naught but ‘click bait.’ Silicone is an up to 2V, the 20V setting will measure
when we started Part 1 of this Arduino electrical insulator, but anti-static mats voltages up to 20V, and so on. Now
Bootcamp series (PE, January 2023): must be able to conduct static build-up suppose we wish to measure a signal
‘To prevent any such unfortunate away to ground. A giveaway clue is that that we know can vary only between 0V
occurrence, may I make so bold as to there is no way to connect these mats and 5V, like the signals generated by our
suggest you invest in an anti-static to ground! Arduino Uno, for example. In this case,
mat (https://amzn.to/3g1YH4A) and an we would select the 20V range because
anti-static wrist strap (https://amzn. Testing times this is the closest to the values we want
to/3WYZ9Bu). Both typically come If you don’t already own a digital to measure while still being higher
with crocodile clips (a.k.a. alligator multimeter, now would be a really good than the values we want to measure. If
clips in the US), which you can pull time to invest in one. You have two main we were to select the 200V range, this
off to reveal banana plugs. My preferred options in the form of hand-ranging or would still measure our signal, but with
modus operandi is to plug these banana auto-ranging products. There are more less precision.
plugs into an anti-static grounding plug pros and cons to this decision than you By comparison, in the case of an auto-
(https://amzn.to/3hDIcML), which is – might suppose, but the accuracy will be ranging multimeter, the setup is faster
in turn – plugged into a wall socket or the same in both cases. because all we need to do is select the
a power strip.’ For the purposes of this column, we DC voltage option. However, this type of
With respect to the anti-static mat, will simply note that a hand-ranging multimeter will take longer to make the
get the largest one you can that fits multimeter takes a little longer to set reading because it first needs to decide
your workspace (and your budget). up because you first need to select the on the most appropriate range.
Also, and this bit is very important, if desired range. This can be a little tricky For what we are doing here, which will
you are working with static-sensitive for beginners to wrap their brains around. include verifying our power connections
components (diodes, transistors, ICs…), Suppose our hand-ranging multimeter and monitoring the states on our logic
then do not waste your money on a indicates support for the 2V, 20V and signals, I would suggest buying a cheap-
blue or grey ‘Heat-Resistant Silicone 200V DC voltage ranges, for example (I and-cheerful hand-ranging device, such as
Work Mat’ (like this one: https://bit. can no longer remember why multimeter the ULTRICS Digital Multimeter, which is
ly/4bMwYfw). I know the description manufacturers use these arcane values). available for only £9.99 from Amazon at
includes the words ‘anti-static,’ but this The 2V setting will measure voltages the time of writing: https://bit.ly/4dMDu7V

54 Practical Electronics | August | 2024


One very important point
when you opt for a cost- a
+5V
Components from Part 1
conscious offering like this is LEDs (assorted colours) https://amzn.to/3E7VAQE
k
to use it only for low-voltage Resistors (assorted values) https://amzn.to/3O4RvBt
680Ω
and low-current work, say up Probe Solderless breadboard https://amzn.to/3O2L3e8
to 40V and a couple of amps. Multicore jumper wires (male-male) https://amzn.to/3O4hnxk
Don’t use it for mains or higher- 680Ω

voltage applications. I’m in no a a = anode


Components from Part 2
way impugning the purveyors
k = cathode 7-segment display(s) https://amzn.to/3Afm8yu
k
0V (GND)
of these products, but why take Components from Part 5
any chances? Momentary pushbutton switches https://amzn.to/3Tk7Q87
Fig.5. Logic tester.
If you decide to delve deeper
into electronics, then at some stage in the future you may Components from Part 6
decide to invest in more sophisticated equipment, for example, Passive piezoelectric buzzer https://amzn.to/3KmxjcX
an oscilloscope. I was just about to say that, since you are Components for Part 9
reading this Arduino Bootcamp column, you probably don’t SW-18010P vibration switch https://bit.ly/46SfDA4
have a tool like this in your collection. But then it struck
me that you could be an analogue hero dipping your toes Components for Part 10
in the digital waters for the first time, in which case (a) you Breadboard mounting trimpots https://bit.ly/3QAuz04
may indeed have an oscilloscope and (b) welcome to the Components for Part 12
digital world; come on in, the water’s fine. Light-Dependent Resistor https://bit.ly/3S2430m

That’s logical Components for Part 13


One very useful tool for the sort of work we’re currently BC337 NPN Transistor https://bit.ly/40xAgyS
doing is a logic probe, which can be used to detect and reflect Components for Part 14
our logic 0 (0V) and logic 1 (5V) states. These are cheap, HC-SR04 Ultrasonic Sensor https://bit.ly/49AMBq4
cheerful and extremely useful. You can buy one already
built, like the Laser 5263 for £16.44 (https://bit.ly/4aqwo6h) Components for Part 15
or the JDXFENG for £3.99 (https://bit.ly/3wSHovd), or you Real-Time Clock (RTC) https://bit.ly/3S9OjHl
might even opt for a DIY soldering kit version for £8.75 Components for Part 18
(https://bit.ly/3yv5D3e). Long tailed (0.1-inch pitch) https://bit.ly/3U1Vp2z
I decided a logic probe would be helpful in tracking down header pins
my own problem, but I can’t remember where I put mine, and
I didn’t want to wait for one to be delivered (or spend any Components for Part 19
money on one, for that matter), so I decided to whip up a little Prototyping boards https://bit.ly/3UMkcZ1
something with what I had to hand. In a crunchy nutshell, Kit of popular SN74LS00 chips https://bit.ly/3wqgzyv
we are talking about using a small breadboard (or part of our Components for Part 20
existing breadboard), two LEDs, two resistors, and a multi- 16V 100µF electrolytic capacitors https://bit.ly/44LzpNa
core jumper wire. We will use items from the various kits Ceramic capacitors (assorted values) https://bit.ly/4bEAUiv
we purchased in Part 1 of this epic saga (PE, January 2023).
A schematic is shown in Fig.5.
The reason I selected red and yellow LEDs is that the ones have preferred to use red and green devices, but my green
in my kit both claim forward voltage drops of 2V. I would LEDs are noted as having a forward voltage drop of 3V.
Let’s assume we leave the end of our probe waving in the
air. In this case, once we’ve accounted for the two 2V voltage
Top View drops, we are left with 5V – 2V – 2V = 1V to power both LEDs.
a
a I’ve decided to use 680Ω resistors (with blue-grey-brown
Side View
bands). Since there are two of them in series (one after the
k k
From other other), the total resistance is 1,360Ω. Using Ohm’s law of V
a = anode a k breadboards = I × R, from which we derive I = V / R, we know our current
a k
k = cathode
(I) will be 1V / 1,360Ω = ~0.7mA. What this means is that
both of our LEDs will glow very dimly indeed.
Now suppose we connect the flying end of our logic probe to
+5V. This could be our power supply rail or an output from one
E D C B A
E D C B

of our digital ICs that’s currently driving a logic 1 value. In this


case, we will have 5V on both sides of our yellow LED, which
therefore won’t do anything at all. By comparison, our red LED
J I H G F

J I H G F

now has the full 5V across it (and one 680Ω resistor). Removing
1 5 10 15 20 25 30
this LED’s 2V voltage drop gives 5V – 2V = 3V. Since all the
current is now flowing through a single resistor, this current
will be 3V / 680Ω = ~4.4mA, which means the red LED will
glow with a respectable brightness without hurting our eyes.
Similarly, if we connect the flying end of our logic probe
to +0V (this could be the ground rail or an output from one
of our digital ICs that’s currently driving a logic 0 value, our
P1 P2 P3 P4 P5 P6
red LED will be disabled and our yellow LED (which we are
pretending is green) will glow like a champion.
As I previously mentioned, we could implement our
Fig.6. Six logic probes. logic probe on an unused portion of one of our existing

Practical Electronics | August | 2024 55


the breadboard (along with all their
Connection
4
s0 → U1.5
wiring), and we’ll do it all again from
6
5 & y3 s0 → U2.13 the beginning.
No connection s0 → U2.5
U2_2
Even if your decoder worked from
1 2 1
s1 → U1.1 the get-go (pat yourself on the back),
3 s1 → U2.1 you may still find these discussions to
U1_1 2 & y2 s1 → U2.4
s1 be instructive.
Pin 11 To U1.6 → U2.9
U2_1 We start by returning to our 2:4
Transistors U1.6 → U2.2
From 5
12 decoder schematic (Fig.7a) and using
6 11 →
Arduino 13 & y1 U1.2 U2.10
it to create a wiring list (Fig.7b). If you
U1_3
U1.2 → U2.12
s0 U2_4 have a photocopier or a scanner handy,
Pin 10 U2.8 → y0
it would be a good idea to make a couple
10 U2.11 → y1
&
8
y0 U2.3 → y2 of copies of Fig.7.
U1 = 7404 9
U2 = 7408
U2.6 → y3 The first check is to make sure our
U2_3
(a) Schematic (b) Wiring List
wiring list matches our schematic. Take
a colored pencil and highlight a section
of wire (not the whole wire) in the
Fig.7. Schematic and wiring list for 2:4 decoder. schematic, like the bit that goes from s0
to U1.5 (IC1, pin 5), and then highlight
breadboards. However, if we have a is completely off. Finally, plug the probe the corresponding line in the wiring list.
spare board available – preferably a into the lower ground rail and check that Do this for all the wire segments in the
half-size board – then it might be better the yellow LED glows brightly while the schematic. When you’ve finished, all
to employ this because it will be useful red LED is completely off. the wires in the schematic and all the
for other projects in the future. You can If any of this doesn’t work as stated, lines in the list should be highlighted.
lay this out however you wish, but one start by using your multimeter to verify If anything remains unhighlighted, we
possibility is shown in Fig.6. that you have 5V between the anode (a) have a problem that needs to be resolved
Yes, I know, I got a bit carried away of the yellow LED and the cathode (k) before we proceed further.
(LEDs… what can I say?). In the of the red LED. Next, check that you Before we do anything else, we want to
discussions below, you will be able have both LEDs plugged in the right deactivate our 7-segment displays to (a)
to get by with a single logic probe, but way round (compare the schematic make sure they don’t flicker annoyingly
more will be better, and they’ll always to your breadboard layout). If all else and (b) make sure we don’t have multiple
come in handy in the future. fails, try swapping out the
Note that, although I show the power LEDs (they could be bad…
100nF Ceramic
and ground wires feeding our probe board remember ESD). Capacitors
as coming from our other breadboards, Once you have your first
we could use a separate +5V supply if probe working (bravo!), build as
we wished. The important point here many as you wish, one at a time, 14 8
is that all the breadboards and power testing each one as you add it (5V)
supplies must share (be connected to) the to your breadboard, and then
same ground (I’ll explain the rationale proceed to the next section. 7408 7404
behind this next month).
One point to go along with our What we should have done
1 7
philosophy of taking things step-by- So, finally we come to what (0V)
step is to start by building only probe we should have done the
U1 = 7404
P1. Once you’ve added the components first-time round. If you are U2 = 7408
as shown, power things up and observe having problems with your
that both LEDs associated with P1 glow 2:4 decoder, then I know this From Arduino 11 (s1) 10 (s0)
faintly. Next, plug the probe into the is going to hurt, but let’s power
lower power rail and check that the red everything down, remove the Fig.9. Add the ICs along with their power and ground
LED glows brightly while the yellow LED 7404 and 7408 chips from connections and ceramic capacitors.

To Displays
D3 D2 D1 D0

y3 y2 y1 y0
From 2:4 Decoder
(eventually)

Fig.8. Disable the displays. Listing 2a. Simple test of 2:4 decoder.

56 Practical Electronics | August | 2024


pair of rails at the bottom of the board Feel the power!
and then the pair at the top of the board. Re-apply the power, and then check the
Ideally, you should see a 5V (meaning voltage across pins 7 and 14 of the 7404. I
+5V) value, but the Arduino’s supply mean this literally – apply the black probe
isn’t ferociously robust, so you may have to pin 7 and the red probe to pin 14. Once
a slightly lower reading. In my case, I’m again, this should reflect a voltage of ~5V.
seeing 4.87V, as shown in Fig.4. If your Next, verify that the voltage across pins 7

Time
reading is substantially lower than this – and 14 of the 7408 is the same ~5V.
say 4.5V, for example – then you have a
problem, possibly even a bad breadboard, Testing, testing
which is what happened to me. This is where things get interesting. All
If you get a negative reading like we are going to do is repeatedly write the
(a) Order of display –5V, then this probably means you’ve values 0, 1, 2 and 3 to the displays D0,
applied your probes the wrong way D1, D2 and D3, respectively. Remember
round. Your red probe should be on that we can have only one display active
the power rail and your black probe at a time. Also, since we want to be able
(b) All off should be on the ground rail. If the to see what’s happening, we’ll set things
reading continues to show negative, up so each value will be on for one second
then check the probe connections at the and off for three seconds.
Fig.10. Test values.
multimeter end. The black wire should Let’s start by creating a simple test
displays active simultaneously because be plugged into the ‘COM’ (common) program (file CB-Aug24-02.txt). I’ve based
we know that’s a bad idea. So, connect port and the red wire should be plugged this on the latest and greatest program from
the ends of the y0, y1, y2 and y3 wires into the ‘VΩmA’ port. the previous issue, but I’ve stripped out
into the lower ground rail (the blue 0V Now, power everything down again, anything extraneous to what we’re trying
rail) as illustrated in Fig.8. These are the add the 7404 and 7408 ICs to the to do here. As an example, our loop()
wires connected to the resistors that drive breadboard, and connect their power function is now as shown in Listing 2a.
the bases of our transistors. Connecting and ground pins as shown in Fig.9. With respect to the f o r ( ) loop
them to 0V will turn the transistors off, Remember that the ‘dimple’ at one end established on Line 63, the iDisp control
thereby disabling the displays. of the package is used to determine variable repeatedly counts from 0 to 3.
Next, power everything up and verify which end is which. In this case, both of We start by turning all our display
that the green and blue LEDs straddling our chips use pin 14 for power and pin segments off (Line 63). Then we set the
the power and ground rails at the top of 7 for ground, but every IC is different, values on our s0 and s1 signals (Lines
the breadboard light up. so you should always consult the data 66 and 67). We derive these signals from
Now, set your multimeter to the 20V DC sheets for any chips you are using. While the current value of iDisp (we discussed
range, and then use its probes to check we’re at it, let’s also add the two 0.1µF this last month). Next, we activate the
the voltage across the power and ground ceramic capacitors we discussed earlier. segments associated with the current
rails. As a ‘rule-of-thumb,’ I typically We’ll mount these as close to each IC’s digit we wish to display (Line 68).
apply the black probe first. Start with the power pin as possible. Once again, we use the current value of

Fig.11. Using logic probes to make sure everything works.

Practical Electronics | August | 2024 57


Online resources
For the purposes of this series, I’m going to assume
that you are already familiar with fundamental con-
cepts like voltage, current and resistance. If not, you
might want to start by perusing and pondering a short
series of articles I penned on these very topics – see:
https://bit.ly/3EguiJh
Similarly, I’ll assume you are no stranger to solder-
less breadboards. Having said this, even if you’ve used
these little scamps before, there are some aspects to
them that can trap the unwary, so may I suggest you
feast your orbs on a column I wrote just for you – see:
https://bit.ly/3NZ70uF
Last, but not least, you will find a treasure trove of
resources at the Arduino.cc website, including exam-
ple programs and reference documentation.

To be honest, digital multimeters aren’t great for monitoring


logic signals, but we can use them ‘at a pinch.’ You might
Listing 4a. Modifying the DigitSegs[] array.
be surprised to learn that analogue multimeters (or analogue
voltmeters) are much more useful here. Given a choice,
iDisp to select the segments. Finally, we pause for a delay of however, we will be better off using the simple logic probes
ON_OFF_TIME, which I’ve set to 1000 milliseconds (1 second). we created earlier.
All of this means that when we run our program,
the sequence presented on our displays will appear
as shown in Fig.10a.
Well, the sequence would appear as shown in
Fig.10a except for two small points (I’m reminded
of Black Adder telling Baldrick, ‘It’s a cunning plan
with one tiny flaw’). Can you spot the tiny flaws in
our case? You’re correct: (a) we haven’t wired up our
2:4 decoder yet and (b) we’ve forcibly deactivated all
our displays as per Fig.8. So, when we first run our
program, the output will be as illustrated in Fig.10b.
Check that the two purple s1 and s0 wires are
connected as shown in Fig.9. That is, one end of
the s1 wire should be connected to the Arduino’s
digital pin 11, while the other end is connected to
U1.1. Similarly, one end of the s0 wire should be
connected to the Arduino’s digital pin 19, while
the other end is connected to U1.5.
We know that our s1 and s0 signals should be
repeatedly going through the sequence 00, 01, 10
and 11. If we think about this another way, s0
will be going through the sequence 0, 1, 0, 1 (off
for a second, on for a second, ...) while s1 will be
going through the sequence 0, 0, 1, 1 (off for two
seconds, on for two seconds, …).
Assuming your multimeter is still set to 20V in
the DC range, place the black probe on U1.7 (that’s
pin 7 of the 7404) and the red probe on U1.5. Since
pin 5 is connected to signal s0 from the Arduino,
you should see your multimeter display showing
0V, 5V, 0V, 5V. If not, re-check that the other end
of the purple wire is plugged into pin 10 on the
Arduino. If it is, try swapping the wire for a new one.
Once you’ve confirmed that you are seeing what
you expect, highlight the s0 → U1.5 track segment
in a new copy of Fig.7 (or use the old copy and
mark it with a different colour). Do this both in the
schematic (Fig.7a) and the wiring list (Fig.7b). Keep
on doing this with every new segment as it’s verified.
Leave the black probe on pin 7 and move the
red probe to pin 1, which is connected to signal
s1 from the Arduino. Now the multimeter display
should show 0V, 0V, 5V, 5V. If not, re-check that
the other end of the purple wire is plugged into pin
11 on the Arduino. If it is, try swapping the wire. Listing 4b. Modifying the loop() function.

58 Practical Electronics | August | 2024


If you created only one probe, connect it to U1.5 and watch do is modify our program to replace a 0 with a blank on
the LEDs flash yellow, red, yellow, red, then connect it to U1.1 display D3. As always, there are numerous ways to do
and watch the LEDs flash yellow, yellow, red, red. If you created this. The approach I opted to use works as follows (file
two probes, you can monitor both signals simultaneously. CB-Aug24-04.txt).
Now, let’s perform our first test on U2 (the 7408). Add a First, as illustrated in Listing 4a, I modified the instantiation
wire to connect U1.5 (s0) to U2.5 and use one of your logic of our DigitSegs[] array on Line 31 by increasing its size
probes to verify that you are still seeing the yellow, red, yellow, from NUM_DIGITS (ten elements that are indexed from 0
red pattern on U2.5 (if not, check both ends are plugged into to 9) to NUM_DIGITS+1 (eleven elements that are indexed
the right holes in the breadboard and/or swap out the wire). from 0 to 10). This new element, which corresponds to all
Add another wire to connect U1.1 (s1) to U2.4 and use one our segments being off, appears on Line 44. We can access
of your logic probes to verify that you are still seeing the this using DigitSegs[10] in our code. We could have
yellow, yellow, red, red pattern on U2.4. specified this directly as B00000000, but I decided to use
U2.4 and U2.5 are inputs to one of the AND gates in U2. If our existing ALL_SEGS_OFF definition.
everything looks good, connect a probe to the output of this Next, we need to add a simple test just before we display the
AND gate, which is U2.6. In this case, you should be seeing digits. This test is shown on Lines 93 and 94 of Listing 4b. If the
yellow, yellow, yellow, red. digit to be displayed on display D3 is 0, we replace this with
This is the good part. Disconnect the end of the green y3 NUM_DIGITS, which is defined as being 10. This will cause
wire from the ground rail (Fig.8) and connect it to U2.6. the call to DisplaySegs() on Line 102 to display our blank.
Display D3 should present blank, blank, blank, 3. That is, it
should be off for three seconds and then display the number Next time
3 for one second and then repeat. I know you’re as tired of hearing me say this as I am of
OK, now you know the drill. Use a similar process to bring saying it, but in our next column we honest-to-goodness
up the remaining displays, one at a time. I only hope you are going to start using a BCD-to7-segment decoder in our
will be as happy as I was once everything starts to work as clock. As always, until that frabjous time comes (next
planned (Fig.11) month, I pomise!), I welcome your comments, questions
All that remains now is to reload the program that uses our and suggestions.
2:4 decoder to control the displays and show the time (file
CB-Aug24-03.txt).
Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor of all he
And finally… surveys at CliveMaxfield.com – the go-to site for the latest and greatest
I hope you haven’t forgotten our in technological geekdom.
pop quiz from the beginning of
this column. What we want to Comments or questions? Email Max at: [email protected]

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
ENI 325LA RF Power Amplifier 250kHz – 150MHz 25W 50dB POA
HP/Agilent HP 34401A Digital Keithley 228 Voltage/Current Source POA Marconi 2955B Radio
Multimeter 6½ Digit £325 – £375 Time 9818 DC Current & Voltage Calibrator POA Communications Test Set – £800

Practical Electronics | August | 2024 59


Teach-In 2024
Learn electronics with
the ESP32 by Mike Tooley
Part 6 – The ESP32 as a Wi-Fi Access Point

I
n the previous part of our Teach-In series, we
introduced the 1-wire and I2C bus interface standards and About Teach-In
showed how you can easily add a low-cost LCD display to Our latest Teach-In series is about using the popular ESP32
your ESP32 projects. Coding Workshop introduced maths opera- module as a basis for learning electronics and coding. We
tions and functions and our Teach-In Project featured the design, will be making no assumptions about your coding ability
construction and coding of a simple environmental monitor or your previous experience of electronics. If you know one
but not the other, you have come to the right place. On
displaying temperature, barometric pressure and humidity.
the other hand, if you happen to be a complete newbie
This month, we begin to explore some of the ESP32’s inbuilt there’s no need to worry because the series will take a
features that help make wireless communication a reality. progressive hands-on approach. There will be plenty of
We begin by introducing some of the basic concepts and time to build up your knowledge and plenty of opportunity
terminology associated with Wi-Fi technology and how the to test things out along the way.
ESP32 can scan for available networks to which it can connect. We’ve not included too much basic theory because this
Our Practical Project shows how the ESP32 can be configured can be easily found elsewhere, including several of our
for use as a Wi-Fi Access Point, making environmental data previous Teach-In series, see:
from a low-cost sensor available for remote display on a https://bit.ly/pe-ti
smartphone, tablet, laptop or desktop PC. https://bit.ly/pe-ti-bundle
Earch month, there’ll be projects and challenges to help you
The learning objectives for the sixth part of our series are, know: check and develop your understanding of the topics covered.
n How to set up and use ESP32 Wi-Fi
The difference between Station (STA) mode and Access
n  IP addresses
Point (AP) mode For reasons that will be obvious, every device connected to a
n How to run a scan for nearby wireless networks network needs to have its own unique address. This address
n How to configure the ESP32 Wi-Fi in AP mode is simply a 32-bit (IPv4) or 128-bit (IPv6) number. These are
How to apply simple Arduino C++ string handling techniques
n  usually expressed as a sequence of bytes with the decimal
n That HTML is used to display AP data in a web browser. values quoted for each. Here’s an example of a four-byte local
IP address: 192.168.1.1. Note that devices connected to your
Getting to grips with Wi-Fi own router are all members of the same network and can
Since this is the first time that we’ve used Wi-Fi in this Teach-
In series it’s worth starting by explaining a few of the concepts
that underpin the technology. By enabling connectivity
without the need for cabling, Wi-Fi is now commonly used
in modern homes and businesses. All ‘smart’ devices make
use of Wi-Fi and even a humble item such as a doorbell now
employs this technology. We will start by explaining some
key terms before moving on to explain the two modes of
connection that the ESP32 uses.

Internet Protocol (IP)


First proposed in 1974, Internet Protocol (IP) is simply a set
of rules that facilitates the exchange of data between devices
connected to a network. IP defines the structure of the packets
that encapsulate the data to be delivered from a source to a
host, and vice versa. Each packet consists of the data to be
transmitted together with a header that incorporates an IP
address. IP forms part of the layered protocol often referred
to as ‘Internet protocol suite’, the different levels of which
are categorised as Application, Transport, Internet and Link. Fig.6.1. An ESP32 operating in Access Point (AP) mode.

60 Practical Electronics | August | 2024


Fig.6.3. An ESP32 serving data to several ESP32 clients.
versions of the ESP32 operate on the 2.4GHz band, but dual-
band versions (such as the ESP32-C5) have recently become
available. The 5GHz band suffers from less congestion and can
therefore be more reliable, but unfortunately it’s less robust and
the range can be somewhat limited due to signal absorption
and attenuation within buildings. For most purposes single-
band operation at 2.4GHz is perfectly adequate for the ESP32.

Service Set Identifier (SSID)


An SSID is the name used to identify a Wi-Fi network and
Fig.6.2. An ESP32 operating in Station (STA) mode. just comprises a sequence of alphanumeric characters. SSID
is not case-sensitive and a default SSID is normally set by the
communicate using these local IP addresses without the need equipment manufacturer and often appears printed on a label
for an Internet connection. attached to the bottom or rear panel of a wireless router. The
SSID can usually be changed easily if required.
Dynamic Host Control Protocol (DHCP)
IP addresses within the network are assigned by the router
using Dynamic Host Control Protocol (DHCP). This process
is automatic, and it occurs whenever a device first connects
to the network. The router then updates its list of connected
devices together with their allocated IP addresses. If you
have the correct network privileges you can easily log into
the router and view this list.

Wi-Fi bands
Wi-Fi communication operates in two discrete frequency bands.
The original 2.4GHz band and the more recently available
5GHz band. Each of these bands is further subdivided into
several channels, each with an allocated number. Most existing Fig.6.4. Typical output from Listing 6.1.

Table 6.1 Summary of common Wi-Fi encryption methods

Encryption Outline

Wired Equivalent Outdated but still widely used. Available in 64, 128 and 256-bit versions. Officially retired by the Wi-Fi
Privacy (WEP) Alliance in 2004.

Formally adopted in 2003, the most-common WPA configuration is WPA-PSK (Pre-Shared Key). The
Wi-Fi Protected keys used by WPA are 256-bit, a significant increase over the 64-bit and 128-bit keys used in the WEP
Access (WPA) system. WPA originally employed Temporal Key Integrity Protocol (TKIP) but this was later superseded
by the Advanced Encryption Standard (AES).

Officially superseded WPA in 2006. It uses AES algorithms and CCMP (Counter Cipher Mode with Block
Wi-Fi Protected
Chaining Message Authentication Code Protocol) as a replacement for TKIP which is still available in
Access II (WPA2)
WPA2 (as a fallback) and to ensure interoperability with WPA.

First announced in 2018 and offering significant improvements over WPA2. It uses Protected
Management Frames (PMF) to enable encryption of the data used for network management (in
Wi-Fi Protected
addition to that used for the data itself). Also incorporates other security enhancements and
Access III (WPA3)
protection against brute force and offline attacks. WPA3 192-bit Enterprise Mode currently offers the
most advanced Wi-Fi encryption.

Practical Electronics | August | 2024 61


Listing 6.1 A simple ESP32 Wi-Fi scanner
Gotcha!
/* Simple Wi-Fi Network Scanner */ To avoid making your network
vulnerable and prevent an ‘Evil
#include “WiFi.h” Twin’ attack, it is considered
good practice to change your
void setup() { router’s SSID. You will find further
Serial.begin(115200); information in the documentation
supplied with your router.
// Initialise WiFi
WiFi.mode(WIFI_STA);
WiFi.disconnect(); Received Signal Strength Indicator
delay(1000); // Short delay RSSI provides you with an indication of
} the strength of a Wi-Fi signal. The greater
the RSSI the better the signal quality
void loop() { with less susceptibility to errors. Strictly
Serial.println(“Starting scan ...”);
speaking, RSSI is a relative measurement
int n = WiFi.scanNetworks(); // n is number of networks discovered
Serial.println(“Scan completed!”); whereas ‘dBm’ is an absolute measure of
if (n == 0) { the power received from a Wi-Fi antenna.
Serial.println(“No networks discovered!”); // Alert if none found. Despite this, RSSI is normally expressed
} else { in ‘dBm’ (decibels relative to 1mW) and
Serial.print(n); a value of -70dBm (or greater) is often
Serial.println(“ networks found”); quoted as an indicator of good Wi-Fi
Serial.println(“No.\tSSID\t\t\t\t\t\RSSI\tCH\tEncryption”); performance. Note, however, that values
for (int i = 0; i < n; ++i) { in the range -70dBm to -90dBm can still
// Print SSID and RSSI for each network found prove satisfactory provided there is no
Serial.printf(“%2d”, i + 1);
co-channel contention.
Serial.print(“\t”);
Serial.printf(“%-32.32s”, WiFi.SSID(i).c_str());
Serial.print(“\t”); Security and encryption
Serial.printf(“%4d”, WiFi.RSSI(i)); Since the introduction of Wi-Fi in the
Serial.print(“\t”); late 1990s, Wi-Fi has always had some
Serial.printf(“%2d”, WiFi.channel(i)); form of security algorithm to provide for
Serial.print(“\t”); user authentication and communication
switch (WiFi.encryptionType(i)) { encryption. Several different forms of
case WIFI_AUTH_OPEN: data encryption help make networks
Serial.print(“open”); more secure. Some that you are most
break;
likely to encounter are listed in Table 6.1.
case WIFI_AUTH_WEP:
Serial.print(“WEP”); In order of effectiveness, Wi-Fi
break; encryption methods are usually ranked
case WIFI_AUTH_WPA_PSK: in the following order:
Serial.print(“WPA”); 1. WPA3 (currently the most effective
break; security)
case WIFI_AUTH_WPA2_PSK: 2. WPA2 plus AES
Serial.print(“WPA2”); 3. WPA plus AES
break; 4. WPA plus AES with fallback to TKIP
case WIFI_AUTH_WPA_WPA2_PSK: 5. WPA plus TKIP
Serial.print(“WPA+WPA2”);
6. WEP
break;
case WIFI_AUTH_WPA2_ENTERPRISE: 7. Open network (no security at all).
Serial.print(“WPA2-EAP”);
break; ESP32 connection modes
case WIFI_AUTH_WPA3_PSK: The ESP32’s Wi-Fi API (Application
Serial.print(“WPA3”); Programming Interface) provides support
break; for the industry standard IEEE 802.11b/g/n
case WIFI_AUTH_WPA2_WPA3_PSK: protocol driver. So, when connected to a
Serial.print(“WPA2+WPA3”); network the ESP32 can be configured
break; either in Access Point (AP) mode (Fig.6.1)
case WIFI_AUTH_WAPI_PSK:
or in Station (STA) mode (Fig.6.2).
Serial.print(“WAPI”);
break;
default:
Serial.print(“Not known”); Gotcha!
} The negative values that are used
Serial.println(); when quoting RSSI simply indicate
delay(10); that the received signal power
} is below 1mW. Therefore, large
} negative values of RSSI correspond
Serial.println(“”); to weaker signals. You should also
WiFi.scanDelete(); // Tidy up note that the decibel (dB) measure
delay(5000); // Delay before the next scan is logarithmic so that, for example,
} a power difference of 20dB actually
corresponds to a ratio of 100:1.

62 Practical Electronics | August | 2024


Listing 6.2 Code for this month’s Practical project
Gotcha!
It’s easy to confuse different Wi-Fi /*
configurations. In AP Mode the ESP32 Basic WiFi Access Point with an ESP32 sending
provides its own Wi-Fi network to temperature and humidity data obtained from a
which other devices connect, but in DHT22 sensor. Uses the DHT22 library file by dvarrel
STA Mode the ESP32 just connects */
to an AP provided by another device,
usually a wireless router. #include <WiFi.h>
#include <WebServer.h>
#include <DHT22.h>
In STA mode the ESP32 connects to
another Wi-Fi network such as that // Enter your chosen SSID and password here
const char* ssid = “ESP32”;
provided by a nearby wireless router. In
const char* password = “12345678”;
this mode the ESP32 effectively becomes
a Wi-Fi client. Note that, whereas the AP // Create an instance of the DHT22 class and
to which the ESP32 connects is usually a // set the digital I/O to pin-21
router, an AP could also be provided by DHT22 dht22(21);
another ESP32 acting as a server.
When operating in AP Mode, Wi-Fi- // Configure the IP address
enabled devices (such as a smartphone, IPAddress local_ip(192, 168, 1, 1);
tablet or PC) can connect to the ESP32. IPAddress gateway(192, 168, 1, 1);
In this situation, the ESP32 creates its IPAddress subnet(255, 255, 255, 0);
WebServer server(80);
own Wi-Fi network to which other Wi-
Fi devices can connect. In this mode, void setup() {
the ESP32 serves HTTP data that can be // Use the serial monitor
read and displayed using a Web browser Serial.begin(115200);
running on a client device (Fig.6.3) // Configure WiFi connection
WiFi.softAP(ssid, password);
Check it out! WiFi.softAPConfig(local_ip, gateway, subnet);
The time has come to make use of the delay(100);
ESP32’s Wi-Fi capability, so let’s get // Enable the AP server
started by carrying out a scan to discover server.on(“/”, handle_OnConnect);
server.onNotFound(handle_NotFound);
the available networks. Depending on
server.begin();
where you live this can be as few as one Serial.println(“HTTP AP started”);
(the Wi-Fi network provided by your own }
wireless router) to well over a dozen! void loop() {
Each network will display a different server.handleClient();
SSID and each will have a particular }
encryption method.
We need to start by initialising the void handle_OnConnect() {
ESP32’s Wi-Fi in Station Mode (STA) Serial.println(“Reading data...”);
using a line of the form: // Read the DHT22 sensor
float humidity = dht22.getHumidity();
float temperature = dht22.getTemperature();
WiFi.mode(WIFI_STA); // Initialise server.send(200, “text/html”, SendHTML(temperature, humidity));
in STA mode }

However, if by chance, the ESP32 has void handle_NotFound() {


already been connected to an Access server.send(404, “text/plain”, “Not found”);
Point (AP) we first need to disconnect }
from it by using:
String SendHTML(float temperature, float humidity) {
WiFi.disconnect(); // Disconnect String ptr = “<!DOCTYPE html> <html>\n”;
ptr += “<head><meta name=\”viewport\” content=\”width=device-width,
from an AP
initial-scale=1.0, user-scalable=no\”>\n”;
ptr += “<title>ESP32 Access Point</title>\n”;
Then we need to scan the available ptr += “<style>html { font-family: Helvetica; display: inline-block;
networks, and determine the SSID and margin: 0px auto; text-align: center;}\n”;
encryption method for each one. We ptr += “body{margin-top: 50px;} h1 {color: #006600;margin: 50px auto
will send the results using the ESP32’s 30px;} h2 {color: #660099;margin-bottom: 50px;}\n”;
serial print function so that they can be ptr += “</style>\n”;
ptr += “</head>\n”;
ptr += “<body>\n”;
ptr += “<h1>ESP32 Access Point</h1>\n”;
ptr += “<h2>Temperature: “ + String(temperature) + “&deg;C</h2>\n”;
ptr += “<h2>Humidity: “ + String(humidity) + “%</h2>\n”;
ptr += “</body>\n”;
ptr += “</html>\n”;
return ptr;
}

Fig.6.5. ESP32 and DHT22 interconnection.

Practical Electronics | August | 2024 63


Gotcha!
When exploring your network
environment, it’s always worth
scanning several times to see
if anything has changed. Wi-Fi
networks are dynamic, and you
will find that some will appear and
disappear sporadically from the
network list.

displayed using the IDEs and display


them on our host PC. Since a further scan
might reveal something different we will
repeat this process every five seconds.
Each time deleting the results of the
previous scan in order to free memory. Fig.6.6. Layout diagram for Fig.6.5.
This is achieved using:

WiFi.scanDelete(); // Tidy up
and free some memory

The code for our simple Wi-Fi scanner


is shown in Listing 6.1.
Fig.6.4 shows typical output produced
by Listing 6.1. It’s worth taking a close
look at this. The Wi-Fi networks found
are displayed in strict order of received
RSSI (strongest at the top of the list). If Fig.6.7. Serial monitor output from Listing 6.2.
you look at the RSSI column you will
see that the best signal (at -54dBm) is
received from one of the stations on
the BTWholeHome network while the
weakest (at -97dBm) is being received
from the BT-PRFK5J network. You
should also note that five of the networks
are operating on Channel 11, three on
Channel 1, and one on Channel 6. Note
that BTWholeHome is a mesh network
with three separate connecting points,
one on each floor of the house. Fig.6.4
also reveals that the most common
encryption method is WPA2, with one
network using WPA+WPA2, and another
is ‘open’ (with no encryption).

Practical project
We mentioned earlier that in AP mode
the ESP32 can create its own Wi-Fi
network to which other smart devices
can be connected. This allows you to
monitor and view data remotely without
the need for a wireless router or host Fig.6.8. Typical Wi-Fi configuration screen on a desktop PC.
computer. To show how useful this is
we’ve created an application based on we need to include three libraries at the might already have them. If not, just go to
the DHT22 temperature and humidity beginning of the code. This is done with the IDE’s Library Manager (as described
sensor that we met last. month. the following lines: in earlier parts of this Teach-In series).
The complete code for our Practical In Listing 6.2 we have included several
Project is shown in Listing 6.2. Note that #include <WiFi.h> // To use lines of code that are needed to configure
ESP32 Wi-Fi the IP address used by the ESP32. Note
that we’ve set the local IP address to
Gotcha! #include <WebServer.h> // To 192.168.1.1. This is the address that you
You might have noticed that we’ve
used ‘\t’ in several of the Serial. use the ESP32 as a web server will need to enter into your browser’s
println statements of Listing address bar to access the hypertext
6.1. The \t simply inserts a non- #include <DHT22.h> // To use transfer language (HTML) data served
printing tab character in the string the DHT22 sensor by the ESP32.
to be printed and this can be used to Rather than just display plain text,
ensure that the text is aligned neatly. It may not be necessary to download and we’ve included some HTML tags to
install all of these library files as you improve the appearance of the data.

64 Practical Electronics | August | 2024


Listing 6.3 Some examples of string handling

/* Some simple examples of string handling */


#include <string>
void setup() {
Serial.begin(115200);
}

void loop() {
Serial.println(“String handling examples ...”);
char firstString[] = “Practical Electronics”;
int n = strlen(firstString);
Serial.print(“First string length = “);
Serial.println(n);
// Print the first string
Serial.println(firstString);
// Print the first character
Serial.print(“First character = “);
Serial.println(firstString[0]);
// Print the last character
Serial.print(“Last character = “);
Serial.println(firstString[n - 1]);
String secondString = “ ESP32 “;
// Print the second string
Serial.print(“Second string = “);
Serial.println(secondString);
// Trim leading and trailing spaces
secondString.trim();
// Print the trimmed string
Serial.print(“Trimmed string = “);
Serial.println(secondString);
// Shorten a string
String thirdString = “OUTPUT DATA”;
// Print the third string
Serial.print(“Third string = “);
Serial.println(thirdString);
String subString = thirdString.substring(0, 3);
Serial.print(“First three characters = “);
Serial.println(subString);
while (1) // Suspend execution
;
}

These appear between the <style> and </style> tags. Between


the <body> and </body> tags you will find the three lines of
text that will actually be displayed on the client device. This text
inherits the properties (font, colour, margins and so on) that we’ve
previously defined between the <style> and </style> tags.
Fig.6.5 and 6.6 respectively show the circuit and wiring layouts
for the Practical Project – the interconnection of the DHT22/
ESP32. You will find that these are identical to the diagrams that
we used in our previous Teach-In (refer to this if you need further
information on the DHT22 temperature and humidity sensor).
To test the Practical Project you will need to enter or download
the code from the PE website at: https://bit.ly/pe-downloads
Open the file in the IDE and then compile and execute the code.
If you’ve followed the series thus far this should be a breeze!
You might then want to check that the AP is up and running. To
do this, start the Serial Monitor and then press the ESP32’s reset
button. You should be rewarded with a ‘power-on’ message like
that shown in Fig.6.7. This confirms that the AP is operational.
If you look at the code in Listing 6.2 you should find that
we’ve allocated an SSID of ‘ESP32’ and used ‘12345678’ as
the password. This isn’t particularly imaginative, and you are
welcome to change both. However, at this stage we will assume
that you’ve kept our default values.

Fig.6.9. (Top right) Typical network selection screen on a


smartphone showing the ESP32 as an available Access Point (AP).

Fig.6.10. (Bottom right) Connecting to the ESP32 AP.

Practical Electronics | August | 2024 65


Fig.6.12. Desktop PC browser showing data served by the ESP32
in AP mode (note the IP address in the browser’s address bar).

Now select your client


device. This can be Gotcha!
a desktop, laptop, Arrays in the C++ language are
tablet or smartphone indexed from zero. This means that
equipped with Wi-Fi the first element stored in an array
and a web browser. has an index of 0 and for a string
For a typical Widows comprising n characters the last
PC go to Network and element will have an index of (n-1)
Internet settings, select
Wi-Fi, and then click
on ‘Show available provides you with some pointers to help
networks’ as shown in you along the way.
Fig.6.8. Examine the list Strings are just a series of alphanumeric
of available networks characters stored in array. You have
and then select ‘ESP32’ already met quite a few of them, for
Fig.6.11. Entering the ESP32’s network security key (the as shown in Fig.6.9. example: HTTP started … and text/
password). Click on ‘Connect’ (see html in Listing 6.2. Each of these strings
Fig.6.10) and enter is enclosed in quotation marks but note
the password ‘12345678’ as shown in that an opening quote must always have
Fig.6.11. a matching closing quote!
There’s one final step to complete the The characters in these strings are
project. Having connected your device stored in a series of memory locations
to the ESP32 AP you will need to open that we refer to as an ‘array’. Here’s an
a browser and enter the IP address example of some alphanumeric text
that we’ve assigned. This should be stored in an array.
entered into the browser’s address bar as
‘192.168.1.1’. You will be rewarded with char titleString[] = “Practical
the page that your ESP32 is currently Electronics”;
serving, and it should look like that
shown in Fig.6.12 although the displayed The 21 characters of ‘Practical Electronics’
data will, of course, be different. are stored in 21 consecutive memory
If you are using a tablet or smartphone locations and they are individually
the procedure will be similar. Fig.6.13 indexed (from 0 to 20) within the
shows a typical list of Wi-Fi networks
displayed using a smartphone while
Fig.6.14 shows the page provided by the
ESP32 after entering the same IP address Gotcha!
and connecting to it. Once again, if you find that the Serial
Monitor displays gobbledygook
Coding Workshop instead of a series of meaningful
As you begin to experiment with your values, you should first check that
own ESP32 applications you will sooner you have set a baud rate that matches
or later begin to feel the need for code the speed that you’ve specified in
that will allow you to manipulate strings your code. The examples in this
of characters. This Coding Workshop instalment all configure the ESP32’s
serial port for operation at 115200
baud. To work correctly this must
match the value that you’ve set in
Fig.6.13. (Left) Selecting the ESP32 AP the Serial Monitor.
using an Android smartphone.

66 Practical Electronics | August | 2024


spending a little time experimenting with this code to get a
feel for just how useful this can be. The output from Listing
6.3 is shown in Fig.6.15.

Check Point
Now that we’ve reached the half-way point in our Teach-In series
Check Point replaces our usual Teach-In Challenge. This is a great
opportunity to test your knowledge of the ESP32. Just select one
answer to each of these questions. When you’ve finished you can
check your answers at the bottom of page 16. Good luck!

1. The maximum integer number that can be represented


using unsigned eight bits is:
(a) 7
Fig.6.14. Smartphone showing data served by the ESP32 in AP
(b) 15
mode (note the IP address in the browser’s address bar).
(c) 255.

2. In-line comments are preceded by:


(a) *
(b) //
(c) $.

3. In which band does ESP32 Wi-Fi normally operate?


(a) 1.2GHz
(b) 2.4GHz
(c) 5GHz.

4. The expression delay(50); will suspend the execution


of code for:
(a) 5s
(b) 50s
(c) 0.050s.

5. Analogue output from an ESP32 is based on:


(a) Amplitude modulation (AM)
(b) Frequency modulation (FM)
(c) Pulse-width modulation (PWM).

6. 16-bit numbers with no decimal points are referred to as:


(a) Bytes
(b) Integers
(c) Floating point.

7. In the first byte of an I2C transfer, how many bits are used
to convey the address?
(a) Four bits
(b) Seven bits
Fig.6.15. Output from Listing 6.3. (c) All eight bits.

character array. For example, to extract and print the eleventh 8. When an LED is conducting, its:
character we could use: (a) Anode is positive with respect to its cathode
(b) Cathode is positive with respect to its anode
Serial.println(titleString[10]); (c) Cathode is at the same potential as its anode.

You’ve hopefully concluded that this would output ‘E’ (the 9. To set the state of a digital I/O pin you would use:
eleventh item in the array) on the Serial Monitor. (a) outputSet();
The sample code shown in Listing 6.3 shows ways in (b) digitalWrite();
which strings can be accessed and also modified using the (c) outputWrite();.
trim() function (to remove leading and trailing spaces)
and the substring() function (to create a substring from 10. The I2C interface standard allows for a maximum of:
consecutive characters within the original string). It’s worth (a) 15 devices
(b) 63 devices
(c) 127 devices.
Gotcha!
When entering your code remember that character strings 11. The speed at which serial data is transferred is often
to be printed need to start and end with matching opening quoted in:
and closing quotation marks. An error will occur if you (a) Baud
don’t do this and the compiler will reject your code. (b) Hertz
(c) Mbyte.

Practical Electronics | August | 2024 67


12. In an I2C bus: 18. The maximum HIGH state voltage that can appear on any
(a) Only slaves can be present of the ESP32’s GPIO pins is:
(b) Only one bus master can be present (a) +2V
(c) More than one bus master can be present. (b) +3.3V
(c) +5V.
13. The ESP32’s magnetic sensor is based on:
(a) Hall effect 19. Which one of the following lines of code will generate
(b) Ohm’s Law an error?
(c) Charge conservation. (a) int a = 3.142;
(b) delay(60000);
14. Which one of the following gives the typical forward (c) pinMode(19, OUTPUT);
current for a small LED indicator?
(a) 5mA 20. Switch bounce results in:
(b) 50mA (a) A rapid and undesirable change in logic levels
(c) 500mA (b) The inability of a switch to remain in the currently selected
state
15. Internal pull-up and pull-down resistors are provided (c) Unwanted delay before the contacts of a switch open or close.
for use with:
(a) All of the ESP32’s digital I/O pins Answers are at the bottom of page 16.
(b) None of the ESP32’s digital I/O pins
(c) Some of the ESP32’s digital I/O pins. How did you do?
If you scored 18 or more, you’ve already become an ESP32
16. On an SPI bus the bus lines are: expert. If you scored between 15 and 18, you’re already well
(a) Usually pulled high and driven low when data is present on the way. If you scored less than 15 it’s worth taking another
(b) Usually pulled low and driven high when data is present look at the earlier parts of this Teach-In series.
(c) Always left floating regardless of whether data is present.
Next month
17. When x = 2 and y = 3 the maths expression pow(x, y) In next month’s Teach-In we will be introducing Network
will evaluate to: Time Protocol (NTP). Our Practical Project will take the
(a) 6 form of an accurate clock that displays network time on a
(b) 8 16 × 2 character LCD. Coding Workshop will look at arrays
(c) 9. and array handling.

Your best bet since MAPLIN


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

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


into a tiny footprint of pads and locating holes in your PCB, eliminating
the need for a mating header. Save Cost & Space on Every PCB!!
Solutions for: PIC . dsPIC . ARM . MSP430 . Atmel . Generic JTAG . Altera
Xilinx . BDM . C2000 . SPY-BI-WIRE . SPI / IIC . Altium Mini-HDMI . & More
Visit our Shop, Call or Buy online at:
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)

68 Practical Electronics | August | 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 . . . . . . . . . . . . . . . . . . . . . . . . . . 68 Advertisement offices
ESR ELECTRONIC COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . 50 Matt Pulzer
HAMMOND ELECTRONICS Ltd . . . . . . . . . . . . . . . . . . . . . . . . . . . 11
JPG ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Electron Publishing Ltd
FLOWCODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 15
1 Buckingham Road
MICROCHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cover (ii)
Brighton
PEAK ELECTRONIC DESIGN . . . . . . . . . . . . . . . . . . . . . . Cover (iv) East Sussex BN1 3RA
POLABS D.O.O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 32 Tel 07973 518682
QUASAR ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Email [email protected]
SILICON CHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
STEWART OF READING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 59 Web www.electronpublishing.com
TAG-CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 68
TERRINGTON COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . 13 For editorial contact details see page 7.

Practical Electronics | August | 2024 69


Practical Electronics PCB SERVICE
PROJECT CODE PRICE PROJECT CODE PRICE
AUGUST 2024 AUGUST 2023
Arduino ESR Meter combined L/C-ESR..................................04106182 9.99 110dB RF Attenuator.................................................................CSE211003 9.95
Arduino ESR Meter separate ESR...........................................04106181 7.99 Universal Battery Charge Controller (2023 update).................14107192 9.95
Watering System Controller......................................................15110231 11.99 Wide-Range OhmMeter............................................................04109221 12.95

JULY 2024 JULY 2023


Dynamic NFC Tag (22 × 31mm)...............................................06101231 5.95 Multimeter Checker/Calibrator..................................................04107221 10.95
Dynamic NFC Tag (86 × 54mm)...............................................06101232 7.95 MIDI Spectral Sound Synthesiser (full kit – see p.25)..............N/A N/A
Reciprocal Frequency Counter.................................................CSE230101C 8.95
Reciprocal Frequency Counter, lid 1mm thick black................CSE230102 7.95 JUNE 2023
Pi Pico-based Thermal Camera................................................04105231 6.95 Arduino Programmable Load....................................................04105221 8.95
Buck-Boost LED Driver.............................................................16103221 8.95
JUNE 2024
Loudspeaker Test Jig................................................................04106231 12.95 MAY 2023
Precision AM-FM DDS Signal Generator.................................CSE211002 14.95
MAY 2024 Improved SMD Test Tweezers programmed PIC....................0410621PIC 12.95
GPS-Disciplined Oscillator........................................................04103231 12.95 AO 2x-dual-to-quad through-hole (pack of five).......................AO1-MAY23 6.95
Dual RF Amplifier.......................................................................CSE220602A 5.95 AO 2x-dual-to-quad SMD (pack of five)...................................AO2-MAY23 6.95
Songbird ....................................................................................08103231 7.95 AO 2x-single-to-dual through-hole (pack of five)......................AO3-MAY23 6.95
AO 2x-single-to-dual SMD (pack of five)..................................AO4-MAY23 6.95
APRIL 2024
Basic RF Signal Generator.......................................................CSE221001 8.99 APRIL 2023
Basic RF Signal Generator (black front panel).........................CSE220902B 9.99 500W Amplifier Module.............................................................see p.22, April 2023
Silicon Chirp Cricket..................................................................08101231 7.99 Clipping Indicator (per channel)................................................01112211 7.95
Test Bench ‘Swiss Army Knife’..................................................04110221 9.99 CD Welder Power Supply (one needed)..................................29103221 9.95
CD Welder Controller (one needed).........................................29103222 9.95
MARCH 2024 CD Welder Energy Storage module (several needed)............29103223 7.95
Digital Volume Control Potentiometer SMD version................01101231 8.95 AO Universal Dual Op Amp Board........................................AO1-APR23 9.95
Digital Volume Control Potentiometer through-hole version....01101232 9.95 AO Stereo RIAA precision passives kit for dual op amp.......AO2-APR23 8.95
Advanced SMD Test Tweezers body........................................04106221 6.95
Advanced SMD Test Tweezers legs (pair)...............................04106212 7.95 MARCH 2023
Pico BackPack...........................................................................07101221 9.95
FEBRUARY 2024 Semaphore Signal (controller)..................................................09103221 7.95
Active Mains Soft Starter...........................................................10110221 10.95 Semaphore Signal (blade)........................................................09103222 5.95

JANUARY 2024 FEBRUARY 2023


Q Meter ....................................................................................CSE220701 8.95 Tesla Coil driver board...............................................................26102221 9.95
Q Meter (black solder mask).....................................................CSE220704 7.95 Tesla Coil potentiometer board.................................................26102222 5.95
Raspberry Pi Pico W BackPack................................................07101221 8.95 Cooling Fan Controller & Loudspeaker Protector....................01102221 8.95
Remote Gate Controller............................................................11009121 12.95
DECEMBER 2023
Digital Boost Regulator..............................................................24110224 8.95 JANUARY 2023
Dual-Channel Power Supply for Breadboards.........................04112221 11.95 Classic LED Metronome – 8-LED.............................................23111211 7.95
Display Adaptor for the Breadboard PSU.................................04112222 9.95 Classic LED Metronome – 10-LED...........................................23111212 8.95
Multi-Channel Speaker Protector – 6 channel.........................01101221 9.95
NOVEMBER 2023 Multi-Channel Speaker Protector – 4 channel.........................01101222 7.95
LC Meter Mk3............................................................................CSE220503C 9.95 Remote Control Range Extender – IR-to-UHF........................15109212 5.95
DC Supply Filter for vehicles.....................................................08108221 8.95 Remote Control Range Extender – UHF-to-IR........................15109211 7.95
Discrete Audio Op Amp PCB....................................................AO1-JUL23 9.95 AO Universal Single Op Amp Board......................................AO1-JAN23 7.95
Discrete Audio Op Amp PCB + essential components............AO2-JUL23 17.95
DECEMBER 2022
OCTOBER 2023 Hummingbird Amplifier..............................................................01111211 9.95
Buck/Boost Charger Adaptor....................................................14108221 9.95 SMD Trainer PCB......................................................................29106211A 8.95
PIC Breakout Board for SOIC parts..........................................24110225 5.95 SMD Trainer PCB + parts.........................................................29106211B 13.95
PIC Breakout Board for DIP parts.............................................24110222 5.95
AVR64DD32 Breakout board....................................................24110223 5.95 NOVEMBER 2022
Automatic Train Controller.........................................................09109221 6.95 USB Cable tester – main PCB..................................................04108211 12.95
Chuff Sound module..................................................................09109222 6.95 USB Cable tester – front panel.................................................04108212 5.95
USB Cable tester – optional panel............................................SC5970 5.95
SEPTEMBER 2023 Model Railway Carriage Lights – PCB.....................................09109211 6.95
Mini LED Driver..........................................................................16106221 7.95 AO transfmr PCB – standard VTX-A range........................ VTX-101-007 6.95
New GPS-Synchronised Clock.................................................19109221 9.95 AO transfmr PCB – dual-outline VTX102-3001/101-3002....VTX-Dual 6.95
Wide-Range Ohmmeter............................................................04109221 14.95
OCTOBER 2022
SMD Test Tweezers – PCB and pair of tweezer arms.............04106211-2 11.95
SMD Test Tweezers – programmed PIC12F1572-I/SN...........0410621A 7.95
Tele-com............................................................................. 12110211 12.95

PCBs for most recent PE/EPE constructional projects are available. From the July 2013 issue onwards, PCBs with eight-digit codes
have silk screen overlays and, where applicable, are double-sided, have plated-through holes, and solder mask. They are similar to
photos in the project articles. Earlier PCBs are likely to be more basic and may not include silk screen overlay, be single-sided, lack
plated-through holes and solder mask.
Always check price and availability in the latest issue or online. A large number of older boards are listed for ordering on our website.
In most cases we do not supply kits or components for our projects. For older projects it is important to check the availability
of all components before purchasing PCBs.
Back issues of articles are available – see Back Issues page for details.

70 Practical Electronics | August | 2024


Double-sided | plated-through holes | solder mask

PROJECT CODE PRICE PROJECT CODE PRICE


SEPTEMBER 2022 SEPTEMBER 2021
Touchscreen Digital Preamp – main board........................ 01103191 12.95 USB SuperCodec PCB....................................................... 01106201 £14.95
Touchscreen Digital Preamp – adaptor board pair............. 01103192 5.95 Audio DDS Oscillator PCB................................................. 01110201 £5.95
20A DC Motor Speed Controller......................................... 11006211 9.95 Audio DDS Oscillator rotary encoder................................. 01110201-ENC 6.95
Programming Adaptor Board for Audio DDS Oscillator...... 01110202 £5.95
AUGUST 2022 High-power Ultrasonic Cleaner main PCB......................... 04105201
£14.95
Multi-purpose Battery Manager – I/O Expander module.... 11104212 5.95 High-power Ultrasonic Cleaner front-panel PCB................ 04105202
Multi-purpose Battery Manager – Switch Module............... 11104211 8.95 Night Keeper Lighthouse PCB........................................... 08110201 £5.95
Simple MIDI Music Keyboard (for 8 switches).................... 23101213 6.95
Nano Pong......................................................................... 08105212 7.95 AUGUST 2021
Ol’ Timer PCB..................................................................... 19104201 £11.95
JULY 2022 Ol’ Timer 8x8 RGB LED module using WS2812B.............. 19104201-88 £8.95
Silicon Labs AM/FM/SW Radio.......................................... CSE210301C 10.95 Ol’ Timer set of acrylic case pieces and spacer................. 19104201-ACR £8.75
Level Crossing Controller................................................... 09108211 6.95 Ol’ Timer DS3231 RTC IC wide SOIC-16.................................19104201-RTC £5.95
Wideband Digital RF Power Meter..................................... 04106201 £9.75
JUNE 2022 Switchmode 78xx regulators (PACK of 5!)........................ 18105201 £7.95
Full-wave Motor Speed Controller...................................... 1010221 8.95 Cool Beans SMAD display................................................. CB-AUG21 £11.95
PIC Programming Helper for 8-pin PICs only..................... 24106211 7.95
PIC Programming Helper for 8, 14 or 20-pin PICs ............ 24106212 10.95 JULY 2021
Advanced GPS Computer.................................................. 05102211 9.95 ATtiny816 Breakout / Dev Board with Capacitive Touch.... 24110181 £9.75
IR Remote Control Assistant (Jaycar version).................... 15005201 £8.95
MAY 2022 IR Remote Control Assistant (Altronics version)................ 15005202 £8.95
Bus board PCB for Analogue Vocoder............................... AO1-MAY22 10.95 PIC18F Development Board.............................................. PNM-JUL21 £12.95
Complete set of 14 PCBs for Analogue Vocoder................ AO2-MAY22 97.95 Microphone Preamplifier........................................................AO-JUL21 £11.95
Programmed EEPROM for Digital FX Unit......................... FX1-MAY22 10.95
Programmed PIC for Digital FX Unit using potentiometer.....FX2-MAY22 8.95 For the many pre-2016 PCBs that we stock please see the
APRIL 2022 PE website: www.electronpublishing.com
64-key MIDI Matrix shield................................................... 23101211 8.95
64-key MIDI Matrix switch board........................................ 23101212
High-current Battery Balancer ........................................... 14102211
11.95
10.95
PE/EPE PCB SERVICE
Digital FX Unit – using potentiometer................................. 01102211 9.95 Order Code Project Quantity Price
Digital FX Unit – using BCD switch.................................... 01102212 9.95
Universal Audio PSU.......................................................... AO1-APR22 11.95 .........................................................

MARCH 2022 .........................................................


Mini Isolated Serial Link..................................................... 24102211 £5.95
Busy Loo Indicator.............................................................. 16112201 £5.95 .........................................................
Analogue Vocoder – Band-pass filter board....................... AO1-MAR22 9.95
Analogue Vocoder – HP/LP filter board.............................. AO2-MAR22 9.95 .........................................................

FEBRUARY 2022 .........................................................


Arduino-based Power Supply............................................. 18106201 9.95
Battery Monitor Logger....................................................... 11106201 10.95
Electronic Wind Chimes..................................................... 23011201 10.95
Name. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Analogue Vocoder – Driver Amplifier.................................. AO-FEB22 8.95 Address . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
JANUARY 2022 .........................................................
Vintage battery Radio Li-ion Power Supply........................ 11111201 9.95
MiniHeart: A Miniature Heartbeat Simulator....................... 01109201 8.95 Tel . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
Email . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
DECEMBER 2021
AM/FM/SW Digital Receiver............................................... CSE200902A 13.95 I enclose payment of £ . . . . . . . . . . . . . . (cheque/PO in £ sterling only)
Balanced Input and Attenuator for USB CODEC............... 01106202 11.95
payable to: Practical Electronics
NOVEMBER 2021
Dual Battery Lifesaver........................................................ 11111202 £6.95 Card No . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .
OCTOBER 2021 Valid From . . . . . . . . . . . . . . . . . Expiry Date . . . . . . . . . . . . . . .
Mini Wi-Fi LCD BackPack.................................................. 24106201 £8.95
Card Security No . . . . . . . . . .

You can also order PCBs by phone, email or via the shop
on our website: www.electronpublishing.com

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

All prices include VAT and UK p&p. Add £4 per project for post to Europe; £5 per project outside Europe.
Orders and payment should be sent to:
Practical Electronics, Electron Publishing Ltd
113 Lynwood Drive, Merley, Wimborne, Dorset BH21 1UU
Tel 01202 880299 Email: [email protected]
On-line Shop: www.epemag.com
Cheques should be made payable to ‘Practical Electronics’ (Payment in £ sterling only).
NOTE: Most boards are in stock and sent within seven days of receipt of order, please allow up to 28 days delivery if we need to restock.

Practical Electronics | August | 2024 71


Next Month – in the September issue
Build Your Own Calibrated Microphones
This phantom-powered, balanced and calibrated microphone is ideal
for measurement applications but is also great for recording work. You
can choose from multiple different microphone capsules that can be
calibrated to produce an almost flat response.

Modern PIC Programming Adaptor


Program most newer PIC microcontrollers out-of-circuit
with this PIC Programming Adaptor. It works using a PICkit
or SNAP programmer and suits 8- to 40-pin micros. With
external adaptors, you can program SMD chips in SOIC,
SSOP or TSSOP packages.

Salad Bowl Speakers


These stylish speakers are surprisingly good performers
considering they’re made using salad bowls from IKEA. They are
simple to build but they can handle 50W RMS per channel.

Teach-In
Next month, we will introduce Network Time Protocol (NTP),
and create an accurate clock that displays network time on a
16 × 2 character LCD.
PLUS!
All your favourite regular columns from Cool Beans
and Circuit Surgery, to Audio Out, Fox Report,
Techno Talk and Net Work. On sale 1 August 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 | August | 2024


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

nics
The UK
Circuit Surgery Teach-In 2024 ’s pAudio
remieOut
r electr
Topics in digital signal processing Create a Wi-Fi Access
CircPoint
uit
with Mechanical
o
in audio nics and
– the frequency domain Topics Surgerswitches
the ESP32 SoC microcontroller
y compu
– sam
in digit
a
ple an l signal proc
ting ma
T each- ker ma
WebMite d hold essing
Sensin In 2024
g the e
gazine
Watering th
e ESP3 virn
2 SoC onment wit Audio
O
microc h Mecha ut
System ontrolle
r n
switch ical
es in a
Controller udio
Make
y
own D our
WIN! y
RFID t namic
Microchip
PolarFire SoC ags
Discovery Kit
WIN!

Teach-In 2024 Arduino-based Recipr


Learn to use L/C+ESR Meter Frequeocal
the ESP32 ncy Co
unter
Te
WebMite: PicoMiteLe ach-In 2024
a
meets the Web the rn to use
ESP32

PLUS!
P
LUsense!
S! Pi
Aug 2024P ico
£5.99
Therm08 -based
Techno Talk – That makes so much
Techn
Cool Beans – DIY logic probes
Cool B
o Talk
– Who al Cam
eans –
Net Work – Passkeys and online security
Net W Arduin
saw th 9 772632 573030
at com era
ork – P o: 7-seg in g?
www.electronpublishing.com ractica
@practicalelec ment d
www.e l adpracticalelectronics
vice on isplay Jul 20
lectro electro decod 24 £5
npubli nics re ers .99
shing pair
.com s 07
@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