Practical Electronics 2023-02
Practical Electronics 2023-02
Practical Electronics 2023-02
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Kick Start Make it with Micromite
Using digipots with BME280 humidity, pressure PicoMite Fingerprint
op amp amplifiers and temperature sensor Reader coding
Fingerprint
Reader
LTDZ V5.0
budget
Spectrum
Analyser
Tesla Coil
Solid-State
Flame
Discharge
PLUS!
Feb 2023 £5.99
Techno Talk – Mushroom magic 02
Cool Beans – Arduino Bootcamp
9 772632 573030
Net Work – Alexa update, plus space and energy news
www.electronpublishing.com @practicalelec practicalelectronics
See The World In Higher Resolution
Introducing the PIC16F17146 MCU Family, With Integrated 12-bit
ADC and Op Amp
The PIC16F17146 family of microcontrollers is packed full of peripherals to enable analog sensor
applications at low cost. With an integrated operational amplifier (op amp) and 12-bit differential ADCC, the
PIC16F17146 family brings your analog projects into focus. Now available in 8- to 40-pin packages, these
devices are a cost-effective solution for analog sensing.
Key Features
• 12-bit differential Analog-to-Digital Converter with Computation (ADCC)
• One op amp
• Two Capture/Compare/PWM (CCP)
• Two 16-bit PWM with dual outputs
• Two 8-bit DACs (1x internal, 1x external/buffered)
• Two Analog comparators
• Four configurable logic cells
• Flash CRC, 1x NCO, 1x CWG, ZCD
• Two EUSART (with LIN support)
• Two MSSP (I2C or SPI)
• Timer 0/1/2 (1x 16- / 2x 16- / 1x 8-bit)
Electronics Contents
Projects and Circuits
Tesla Coil by Flavio Spedalieri 16
This simple device generates extremely high voltages, enough to form a ‘flame
discharge’ resembling a flame. It can also demonstrate wireless power transmission.
Cooling Fan Controller & Loudspeaker Protector by John Clarke 24
This board controls up to three cooling fans, switching them on at a preset
temperature and ramping their speed. It also protects speakers from damage.
Driveway Gate Remote Control by Dr Hugo Holden 32
Sliding/swinging gate controllers inevitably fail after some years of service.
The solution is to replace the controller with this much more robust design.
Geekcreit’s LTDZ V5.0 Spectrum Analyser by Jim Rowe 40
This compact unit is low in cost but can perform spectral analysis from 35MHz to
4.4GHz, controlled from a PC using a very impressive free application.
Volume 1 and Volume 2 cover transmitters Volume 4 covers clandestine, agent or ‘spy’
and transceivers used between 1932-1948. radio equipment, sets which were used by
An era that starts with positive steps special forces, partisans, resistance, ‘stay
taken to formulate and develop a new behind’ organisations, Australian Coast
series of wireless sets that offered great Watchers and the diplomatic service. Plus,
improvements over obsolete World War I selected associated power sources, RDF and
pattern equipment. The other end of this intercept receivers, bugs and radar beacons.
SUBSCRIBE NOW!
JFETs as electronically
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Audio Out
Using audio
KickStart
Low-voltage
Make it with Micromite
Building GPS into
Circuit Surgery
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Audio Out Electronic Make it with Micromite
Using JFETs limiters Using audio Building Blocks Adding a PS/2 keyboard and
Circuit Surgery
Understanding
Audio Out
Practical
Electronics
The UK’s premier electronics and computing maker magazine
01202 087631
controlled resistors transformers op amps PicoMite systems and compressors transformers Using actuators TFT display to a PicoMite and using digipots (optimised for audio) fingerprints with a PicoMite in LTspice Universal op amp board for a PicoMite op amp amplifiers and temperature sensor Reader coding
WIN!
WIN!
Microchip
Remote Control Driveway Gate Cooling Fan Controller &
Microchip
MPLAB Snap
WIN! Hummingbird WIN!
Microchip
PIC32CX-BZ2
and WBZ451
Range Extender Remote Control Loudspeaker Protector
In-Circuit
Debugger
Microchip
AVR-IoT
Amplifier PIC32MM
Curiosity
Curiosity
Development
Cellular Mini Development Board
WIN!
WIN! Board Microchip
WIN! Curiosity
Development
Board
WIN!
Build a
SMD Test PicoMite
Tweezers USB Cable Tester
computer Classic LED Fingerprint
Intercom using retro Metronomes Reader
analogue phones! 35MHz-4.4GHz
Pocket Weather Station
Build a PicoMite Signal Generator LTDZ V5.0
SMD Trainer board budget
fingerprint reader
Spectrum
Build a GPS Analyser
Preamplifier tracker with USB Tesla Coil
with Digital Touchscreen the PicoMite Self-Contained 6GHz Cable Multi-Channel Solid-State
Tone / Volume Controls Digital Attenuator Tester Speaker Protector Flame
Discharge
PLUS! PLUS! PLUS! PLUS! PLUS!
Oct 2022 £5.49 Nov 2022 £5.49 Dec 2022 £5.49 Jan 2023 £5.49 Feb 2023 £5.99
Techno Talk – Solar flares – time to panic? 10 Techno Talk – Hidden hazards 11 Techno Talk – Giant boost for batteries 12
Techno Talk – Raudive voices revisited 01 Techno Talk – Mushroom magic 02
Cool Beans – Lixie displays and magnetic core memory Cool Beans – Investigating rotary encoders Cool Beans – LogiSwitch debounce breakout board Cool Beans – Introducing the Arduino Bootcamp Cool Beans – Arduino Bootcamp
9 772632 573023 9 772632 573023 9 772632 573023 9 772632 573023
Net Work – Whole-home mesh wireless systems Net Work – Technology and the Queen Net Work – Energy-saving and monitoring resources Net Work – Smart light bulbs and Alexa’s skills Net Work – Alexa update, plus space and energy news 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.
Electronics
Rest of the World £46.99 (Airmail)
1 Year: UK £59.99, Europe £69.99 (Airmail),
Rest of the World £84.99 (Airmail)
2 Years: UK £114.99, Europe £129.99 (Airmail),
SUBSCRIPTION PRICES 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 ........................................................................................
9 771030 266001
12
11
$ 50* NZ $1290
INC GST INC GST
SMD
Trainer
and how to solder surfac
e-mount parts
The small but powerful
Hummingbird
Amplifier
Hands-on with the
Raspberry Pi Pico
The smallest Raspberry
Pi yet!
• Combined subscriptions include both the printed magazine and online access.
• Prices are in Australian dollars (AUD) unless otherwise specified. Hummingbird Amp;
• Prices listed are for everywhere in the world except Australia and New Zealand. December 2021
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.
Raspberry Pi Pico;
Try our Online Subscription – now with PDF downloads! December 2021
An online issue is perfect for those who don’t want too much
clutter around the house and is the same price worldwide.
Issues can be viewed online, or downloaded as a PDF.
Electronics Editorial
Editorial offices
Practical Electronics Tel 01273 777619 What is it about Tesla?
Electron Publishing Limited Mob 07973 518682 To be clear, I am not talking about Elon Musk’s electric car
1 Buckingham Road Fax 01202 843233
Brighton Email [email protected]
company, but the creative and inventive Serbian, Nikola Tesla.
East Sussex BN1 3RA Web www.electronpublishing.com You have to be pretty special to have a major SI unit named after
you – in his case magnetic flux density – so what did he do?
Advertisement offices Well, he is not only the father of modern alternating current (AC)
Practical Electronics Adverts Tel 01273 777619
1 Buckingham Road Mob 07973 518682
and electricity supply systems, but also found time to work in
Brighton Email [email protected] areas as diverse as radio control, wireless energy transmission,
East Sussex BN1 3RA bladeless turbines and a whole lot more. He was fascinated with
Editor Matt Pulzer
high-voltage systems and also a bit of a showman. One of his
General Manager Louisa Pulzer most-famous inventions is the appropriately named ‘Tesla Coil’,
Digital subscriptions Stewart Kearn Tel 01202 880299 a resonant transformer system that produces impressive electrical
Online Editor Alan Winstanley sparks. Making these can be a quite a challenge, but this month
Web Systems Kris Thain
Publisher Matt Pulzer we have a superb project that is well within the reach of PE
readers. It’s great fun – why not give it a shot? (Once small caveat
Print subscriptions – this is not a project for beginners. Tesla Coils will ‘bite’ you if
Practical Electronics Subscriptions
you’re not careful. Do read the warnings in the project’s write up,
PO Box 6337
Bournemouth BH1 9EH Tel 01202 087631 and remember, Tesla Coils are not for the inexperienced.)
United Kingdom Email [email protected]
Free downloads
Technical enquiries We know many of you like to download the assorted free files
We regret technical enquiries cannot be answered over the
telephone. We are unable to offer any advice on the use, purchase, that are associated with projects (PIC program code, for example)
repair or modification of commercial equipment or the incorporation and to support PE’s regular columns (Circuit Surgery, Cool Beans,
or modification of designs published in the magazine. We cannot Make it with Micromite and so on). These are all located and
provide data or answer queries on articles or projects that are
more than five years old. easily accessed via our website (https://bit.ly/pe-downloads).
What some of you may not realise is that instead of tediously
Questions about articles or projects should be sent to the editor downloading each issue’s files one at a time, the last five years
by email: [email protected]
can be accessed in 12-month groups. A useful timesaver if you
Projects and circuits want to build up your file collection for back issues.
All reasonable precautions are taken to ensure that the advice and
data given to readers is reliable. We cannot, however, guarantee Apologies
it and we cannot accept legal responsibility for it.
The two most popular projects of the year, as measured by PCB
A number of projects and circuits published in Practical Electronics sales, were the USB Cable Tester (November-December 2022)
employ voltages that can be lethal. You should not build, test, and the SMD Trainer (December 2022). The orders flooded
modify or renovate any item of mains-powered equipment unless
you fully understand the safety aspects involved and you use an
in! But, as luck would have it, they were the two projects that
RCD (GFCI) adaptor. were hit hardest by this year’s favourite non-delivery excuse
– ‘supply chain issues’. The USB Cable Tester’s display bezels
Component supplies and the SMD Trainer components were ordered from the same
We do not supply electronic components or kits for building the
projects featured, these can be supplied by advertisers. We place, dispatched promptly and arrived at Heathrow in the UK
advise readers to check that all parts are still available before within the expected timeframe… and then, absolutely nothing
commencing any project in a back-dated issue. happened. They just sat in customs for over two weeks, then
got delayed with the postal strike, by which time we were well
Advertisements
Although the proprietors and staff of Practical Electronics take into the Christmas period, when delivery inevitable slows down
reasonable precautions to protect the interests of readers by further. All orders for both the above projects have gone out, and
ensuring as far as practicable that advertisements are bona fide, should have arrived by now. I’m very sorry for the delays and
the magazine and its publishers cannot give any undertakings
in respect of statements or claims made by advertisers, whether
thank you for your patience.
these advertisements are printed as part of the magazine, or in
inserts. The Publishers regret that under no circumstances will From all of us at Practical Electronics, we hope 2023 has
the magazine accept liability for non-receipt of goods ordered, or
for late delivery, or for faults in manufacture.
started off well for you and that it’s a successful, peaceful and
semiconductor-rich year.
Transmitters/bugs/telephone equipment
We advise readers that certain items of radio transmitting and Matt Pulzer
telephone equipment which may be advertised in our pages
cannot be legally used in the UK. Readers should check the law
Publisher
before buying any transmitting or telephone equipment, as a fine,
confiscation of equipment and/or imprisonment can result from
illegal use or ownership. The laws vary from country to country;
readers should check local laws.
… is exactly equal to the value of one picture, according to educationalists, for whom a picture is
definitely worth a thousand words. But that’s not all, as you will soon discover.
T
he logic of the thousand It turns out that this skin can be removed ‘Infineon is paving the way with a new
words notion is not hard to grasp, easily for further processing. Scientists solution for doing away with keys. By
although identifying the origi- can even use it directly for a project; it dispensing with batteries, we are pro-
nator of this saying is more difficult. just needs to be dried. ‘The skin could be viding, for the first time, a reliable,
Wikipedia traces it back to an old used, for example, as a flexible printed low-maintenance and secure way of
Chinese proverb, often attributed to circuit board … to manufacture elec- opening and closing smart locks.’
Confucius. Whatever the source, there’s tronics,’ adds Kaltenbrunner. However, To activate the lock, the mobile phone
little doubt that seeing something is at the moment, producing pulp [for sub- must be held directly on it. Near-field
often a better way of learning than strates] is energy-intensive and not that communication (NFC) is used to check
reading dry text in a book. sustainable, even though these fungus whether the device is actually autho-
Neither technique, however, com- skins only need waste wood to grow. rised to open the lock via encryption
pares to watching a well-made YouTube technology. At the same time, energy is
video on your computer, and to prove Ecological and biodegradable transferred contactlessly to a capacitor
this, I invite you to view https://youtu. The material’s robust, flexible and heat- that powers opening or closing the lock.
be/cM7t1Mpu7s4 where you’ll see the resistant properties could potentially
commendable Dave Jones explaining the become a natural substitute for poly- So how does it work?
difference between linear and switch- mers currently used in making flexible The core of the solution is a programmable
mode methods of reducing DC voltages. electronic components. Kaltenbrunner 32-bit microcontroller with a built-in NFC
He does this in a down-to-earth and en- explained that all types of printed cir- front-end to make it an NFC actuation
gaging way that holds your attention and cuit boards are made from composite controller. This approach enables firms
makes the subject look easy. No wonder materials that are generally difficult to to launch miniaturised smart locks onto
one of his fans writes: ‘I wish I had you separate, recycle or decompose. This the market with very few elements. The
as my teacher in engineering college.’ biodegradable mushroom skin, however, built-in true random number generator
This presentation must be worth a mil- is now emerging as a true alternative. allows data encryption and decryption
lion words, even if some of the other Initially, the researchers are targeting with extremely low power consumption,
stuff on YouTube is pretty wretched. applications in the field of medical tech- enabling developers to create complete
nology, where these kinds of components smart actuation devices with a minimum
Mushroom magic mainly need to work for periods of up number of additional components.
Fungi can now be used to make PCBs or to a year. The easily degradable fungal Continues White: ‘Our battery-less tech-
substrates for electronic components. skin is also surprisingly heat resistant, nology is especially suitable for locks that
Protagonists call this ‘myceliotronics’ able to withstand temperatures of up to require little mechanical effort, such as
and no, it is not an early April Fool’s 250°C, an important factor when building in office furniture, hospitals and fitness
joke. Not all fungi can be used, how- soldered circuits. Is there any relevance studios. Other possible applications are
ever, and so far only one variety is to hobby electronics? Not yet, but just as bicycle locks, mailboxes and parcel boxes.
suitable. Called Ganoderma lucidum, 3-D printers have become a household The solution thus provides greater conve-
it’s a variety that has limited distribu- object for some enthusiasts, maybe one nience and flexibility, while at the same
tion in Europe and parts of China, and day we will all be able to produce plant- time cutting the cost of key management
is now cultivated in India. It is more based PCBs in our workshops at home! in private and commercial properties. It
widely known for its medicinal prop- also comes into its own when batteries in
erties, used in China for 5,000 years to Goodbye to batteries? standard smart locks run out of power, or
treat diseases like diabetes and cancer, For some applications, quite possibly. when keys are lost, dispensing with the
as well as bacterial and skin infections. According to Infineon Technologies in need for expensive locksmith services.’
So, what is its use in electronics? Germany, using traditional keys will be
Martin Kaltenbrunner (Department a thing of the past in many areas of life. Coda
of Soft Matter Physics at the Johannes The company is launching onto the mar- Now you know almost everything about
Kepler University in Austria) claims it as ket a solution that can be used to open a thousand words, but I’ll leave you with
a ‘global first’ that could result in more and close locks using mobile phones – a couple of linked thoughts on this sub-
sustainable electronics. He explains without the need for batteries to power ject. A thousand words are what I am
that it was, ‘more or less an accidental the lock. The application gets the power asked to deliver each month for Techno
discovery, as so often is the case when it needs contactlessly from the mobile Talk, which I have now been doing for
it comes to science.’ phone, using a process widely known 20 years. It is also the number of words
To protect itself from pathogens and as ‘energy harvesting’. I need to write for my final contribu-
other fungi, this fungus forms a closed Adam White, President of Power tion next month. But more of that in a
skin on the surface of its growing medium. & Sensor Systems at Infineon, says: month’s time.
Practical Electronics is offering its readers the chance to win and requires no additional hardware to get started. The
a Microchip Curiosity Development Board (DM164137) – Curiosity Development Board is designed to support
and even if you don’t win, receive a 15%-off voucher, 8-, 14- and 20-pin 8-bit PIC MCUs with low-voltage
plus free shipping for one of these products. programming capability.
Microchip’s Curiosity Development Worth Out of the box, this board offers several
Board offers a cost-effective, fully
integrated microcontroller development
$37.50 options for user interface – including physical
switches, mTouch capacitive sensing and on-
platform targeted at first-time users, (approx £31.95) board potentiometers. A full complement
makers and those seeking a feature-
rich rapid prototyping board. Designed each of accessory boards is available via the
MikroElectronika mikroBUS interface footprint.
from the ground up to take full advantage
of Microchip’s MPLAB X and MPLAB Xpress The Curiosity Development Board can be operated
Integrated Development Environments, the Curiosity as an all-in-one development platform, or you can
platform includes an integrated programmer/debugger customise it to suit your individual needs.
Free-to-enter competition
Microchip Curiosity Development Board
Microchip
DM164137
E
veryone (in the UK) has their own view of
the BBC Licence Fee – who should pay and how
much, if anything (see box below). My personal
view of the Beeb’s budgeting is coloured by years of
doing freelance work at pittance pay for unfortunate
programme producers who were starved of the budget
they needed to do a good job – while broadcast stars and
corporation managers were overtly overpaid. One early
January I was in a lift at Broadcasting House when one
‘suit’ commiserated with another: ‘I expect you’ve come
back to a pile of problems’. ‘No problem,’ said the senior
suit. ‘I’ll just sort through it and delegate’.
But the law is the law – until it changes – and in theory,
anyone of any age or gender not destitute and not buying
a licence and watching TV content on any device can
end up locked up. So, are people actually going to jail
for watching but not paying?
I was recently inside a women’s prison, HMP Bronze- the professional producers. Set design, sound and light-
field in Ashford, Middlesex. I go there for live theatre and ing design is top notch. It’s an all-round good enterprise.
musical events staged for charity inside prisons by the After the performance, the deputy director, gave a
enterprising Grange Park Pimlico Opera group. Previous speech in which she referred to the disproportionately
productions have included Our House and Sweet Charity. high numbers of women in prison for not having TV li-
This time it was Betty Blue Eyes, the musical comedy cences. Is it really the case that many more women than
derived from Alan Bennett’s film A Private Function. A men are in prison for not buying a TV licence, I asked
core cast of professional actors and musicians perform her after her speech? Yes, she assured. So, I did some
with a group of prisoners, auditioned and rehearsed by independent digging.
To be accurate, people can go to jail for not paying
fines imposed for not having a licence, but not for not
Funding the BBC having a licence per se. And more women are prosecuted
The BBC is funded via a non-optional, paid-for licence because they are more likely to be at home and open the
for anyone watching any TV programme – not just one door to an inspector during the day. Even if they are at
from the BBC. It is a form of ‘quasi-taxation’. For further home, men are less obliging.
details, see the Wiki page: https://bit.ly/pe-feb23-beeb Most important, the government’s Department for
Digital, Culture, Media and Sport (DCMS) released an
w !
ne
1551W IP68 miniature enclosures
Learn more: hammfg.com/1551w
Contact us to request a free evaluation sample.
[email protected] 01256 812812
NEW!
couple of years, largely during Co- radically since the licence fee was
vid lockdown, women have been introduced. The DCMS Secretary of
imprisoned for TV licence evasion? State has been clear she will decide
I asked both the prison director and policy based on the evidence and the
her deputy director, who made the government, as we have committed to,
claim, to clarify. After a month and
reminders neither has responded. But
will carry out a review of the licence
fee funding model ahead of the next
5-year
I shall try asking them both again,
especially as the DCMS has now
Charter period.’
collection
confirmed, unequivocally: ‘There is Horrific?
no one currently in prison as a result
of not paying fines for not having a
A fun footnote: The obviously peeved
Grange Park producers of the show I
2017-2021
TV licence. saw had been forced to cancel a long- All 60 issues from Jan 2017
‘The penalty for TV licence evasion planned production of The Little Shop
to Dec 2021 for just £44.95
is a fine. Imprisonment is pursued of Horrors (a comedy about a man-
rarely and only as a matter of last eating plant) because – to quote the PDF files ready for
resort for those wilfully refusing to producers – ‘the Ministry of Justice immediate download
pay the fine or culpably neglecting / Prison Service suddenly decided
to pay. The courts will do everything at a very late stage that the title was
within their powers to trace those too sensitive, despite having known
See page 6 for further
who do not pay and use a variety about our plans for the production details and other great
of means to ensure the recovery of for months.’
criminal fines and financial penal- Theatre, movie and book buffs will
back-issue offers.
ties. In 2020 and 2021, there were of course know that the short-notice Purchase and download at:
no admissions into prison associated replacement, Betty Blue Eyes, has fun www.electronpublishing.com
with failing to pay a fine in respect with a criminal scheme to break the
E
ver heard of Compusonics, day. Compusonics also promised a that was ahead of its time.
the company that offered floppy digital video version.
disc recording long anyone The first working model was shown Practical Electronics is delighted to be
able to help promote Barry Fox’s project
dreamt of MP3? at the National Association of Broad- to preserve the visual history of pre-
In June 1984, US company Com- casters Convention in Dallas in 1986. Internet electronics.
pusonics announced a digital audio The computer player cost US$3,000 Visit www.tekkiepix.com for fascinating
recorder which stored 45 minutes of and played four minutes of stereo or stories and a chance to support this
stereo on a 5.25-inch computer floppy eight minutes of mono. unique online collection.
L
ooking back over many years’ For many everyday users, a cloud I described the Amazon Dash Wand, a
worth of Net Work columns, I’ve drive will host data files for peace of new handheld Wi-Fi device that would
come to recognise that many mind, and these days users are spoilt scan the barcodes of produce and add
new technological developments turn for choice. Major big names like Mi- them to your Amazon shopping cart, or
out to be little more than pie-in-the- crosoft, Google, Synology and Dropbox its built-in Alexa voice assistant would
sky vapourware that don’t work as offer cloud storage, and some periph- do the same on demand, making shop-
advertised. The consumer ICT sector is eral makers like Asus and Huawei ping effortless. The Amazon Dash Wand
littered with under-developed or half- will bundle some online storage too. was shut down in 2020, three years
finished products and software that Amazon, however, is dumping its after its launch, and Amazon made the
land users with the job of fault finding Amazon Drive cloud storage this year, scanning devices fit only for electrical
or debugging them, often hindered by and focusing on Amazon Photos in- recycling. The Dash Wand was a sign,
frustrating customer support, before stead – see: https://bit.ly/pe-feb23-nw2 though, of Amazon’s early determination
the product gets discontinued anyway. At a minimum you could back up to integrate Alexa into the domestic su-
essential files on a removable or slave permarket shopping routine.
Backing up drive – but rather than relying on a Then there were Amazon Dash
Back when cloud backups did not exist, cheap and flaky memory stick that buttons (Net Work, July 2015), pre-pro-
probably the most awful IT hardware might get zapped with static, today grammed stick-on buttons that added
the author ever invested in were the my choice would be a reputable USB a product (eg, laundry powder) to
Iomega Zip and Ditto Max drives; re- 3.0 solid state disk such as a Sam- your Amazon shopping cart with a
movable media devices that ran on a sung T5 or T7. I do in fact still take a single button press. Millions of these
PC’s parallel port. The term ‘Click of ‘last gasp’ air-gapped backup from my $5 gizmos were circulated but the Dash
Death’ was coined to describe failing NAS onto SSDs periodically. This also button never caught on and they were
Zip disks or drives that were about helps safeguard against the possibili- discontinued in 2019. The system also
to shred your precious data (see: ty of ransomware. It is also possible received criticism for not providing
www.grc.com/tip/codfaq1.htm). I found to back up the NAS to the cloud, but pricing information beforehand. The
the Ditto Max tape drive was similar- it is a costly and extremely slow pro- idea was never going to sit well with
ly undependable and generally awful cess. During some quiet downtime consumers who scribble out a shopping
to work with. Then a promising new it’s worth checking out some storage list and trundle to the supermarket,
digital tape backup system called On- options and how to back up your es- where non-foods could be quite a bit
stream, invented by Philips, offered sential files from a PC, smartphone, cheaper than Amazon.
slick USB tape drives with 30GB car- tablet or laptop to the cloud. Other instantly forgettable ideas cov-
tridges and superb ‘Echo’ software that ered before in Net Work include the
made it easy to restore earlier file ver- The Dash for cash Amazon Echo Look, an Alexa-pow-
sions with a single click. It worked like Some ideas probably fail not because ered camera device that took snapshots
a dream, until the tape drives started to the engineering was lacking but because of you and offered fashion tips (see
crash without warning. I got through project managers misread the market to https://youtu.be/9X_fP4pPWPw). The
three or four such drives before ditch- begin with. Back in Net Work, July 2014 $200 device was destined for the recycle
ing that idea too, and Onstream then
went bust.
Today, I run the excellent, but quite
involved Macrium Reflect backup soft-
ware, backing up files onto a Synology
RAID-style NAS (network-attached
storage), a long-time favourite. This
software ‘zips’ files together into one
large special-format file that is writ-
ten to the backup drive. In the event
of a total crash, though, the Macrium
software would have to be reinstalled
from scratch before you could restore
backup data – you do keep those serial
numbers and logins safe, don’t you? A
free version of Reflect 8 for home use
is available from www.macrium.com Amazon is keen as mustard to get into home grocery ordering. They have partnered with
and is definitely worth a try. the Morrisons retail chain.
technologies either. Shell reportedly three years, mostly caused by de- Scottish vehicle builder Munro has
wants to re-focus on gassing hydro- fective batteries, incorrect chargers released details of its new electric 4x4,
gen-fuelled trucks instead, leaving just or items being left on charge for too the MK_1, which has an all-terrain
11 public refuelling stations open com- long, they say. Third-party batteries ability and an all-electric powertrain,
pared to 57,000 EV charging points. which can be bought cheaply online making it a candidate for sectors in-
Meantime, Glasgow-based start-up are also to blame. cluding construction, agriculture,
HVS (Hydrogen Vehicle Systems) has Ionetic, a UK-based startup that mining, forestry, mountain rescue,
showcased a fully functional hydro- specialises in electric vehicle (EV) remote infrastructure maintenance and
gen-electric powertrain which will battery pack technology, has launched leisure. The fearsome-looking rugge-
be used on its 40-tonne Articulat- its state-of-the-art EV battery pack dised vehicle has a 220kW motor, a
ed Tractor (truck cab) unit. HVS is design platform which can cut devel- high ground clearance and can carry
first to market with its state-of-the-art opment costs and turnaround time for five and tow 3.5 tonnes. Sales should
powertrain and will build its vehi- EV manufacturers. Ionetic strives to start in the US in 2023. More informa-
cles in the UK, with its first HGV set overcome the design and implemen- tion is at: www.munro-ev.com/mk1
to go on sale in 2025. For details, see: tation hurdles facing lower-volume Plans for a new lithium refinery in
www.hvs.co.uk niche manufacturers. Their new soft- England have been given the green
Previous Net Work columns have ware-based platform can boost energy light. The UK’s first large-scale refinery
covered the risks of Li-ion battery fires density by 30% and increase utilisa- is aimed at supplying raw material for
in some depth. In November, 43 people tion of pack volume by up to 120%, EV batteries and rechargeables, and
were hurt, some very seriously, when compared to existing off-the-shelf will greatly reduce dependence on
an electric scooter battery caught fire solutions. It can also design a battery Chinese-sourced materials. The plant
on the 20th floor of a New York tower pack in a matter of days and reduce in Teesside will take about three years
block (https://youtu.be/q7zNtozubmI). implementation costs by over 90% to complete. You can read more at:
Some landlords now ban e-bikes and for auto industry OEMs. IONETIC https://teesvalleylithium.co.uk
scooters from being taken indoors due plans to open its first UK-based bat- That’s all for this month – see you
to the fire risk. Warnings have also tery manufacturing facility this year, in the next issue for more Net Work.
been issued to steer well clear of cheap which will make IONETIC the only
electric scooters or dodgy chargers, UK-based developer offering a turn-
with Zurich Insurance seeing claims key battery solution. More details at: The author can be reached at:
for lithium battery fires tripling over
[email protected]
https://ionetic.uk
Tesla Coil
This relatively small and simple device generates extremely high voltages,
enough to form a ‘flame discharge’ resembling a candle flame. It can also
demonstrate wireless power transmission by lighting up neon globes and
fluorescent lamps at some distance.
T
he inspiration for this project 150kV, and given its operating fre- emanates. This one is simpler, with a
came from a YouTube video of a quency of around 10MHz, it can cause dome instead, but it’s still a Tesla Coil
Plasma Flame Generator by Jay RF burns. (we’ll describe a larger and somewhat
Bowles of Plasma Channel in January Clearly, you need to be meticulous more complicated Tesla Coil with a
2021. I loved the simplicity of the cir- in building, testing and operating such toroid in a later article).
cuit (tuning and operation is a chal- a device. But we won’t tell you ‘don’t The Tesla Coil is a loosely coupled
lenge, though), its unique output, and try this at home’. Still, We Do Not Rec- resonant transformer invented by
the fact that the resulting device is rel- ommend that beginners assemble such Nikola Tesla in 1899. It is capable of
atively small. a device. producing high-voltage, low-current,
In this design, a solid-state oscillator It is more suitable for someone high-frequency alternating current.
drives a primary coil which excites the who, for example, has built several The voltages produced by Tesla Coils
resonator (secondary) coil, producing mains-powered devices and is used result from resonant voltage rise in the
a high-frequency, continuous-wave to the safety precautions involved in secondary and are not proportional to
output. The discharge produced by working with 230V AC. That’s because the turns ratio between primary and
the Coil is a very interesting ‘flame such people normally have the required secondary windings as with traditional,
discharge’ resembling a candle flame. mindset of ‘hands off when power is tightly-coupled transformers. That
The Coil can be used to demon- applied’, double-checking everything allows exceptionally high voltages to
strate wireless power transmission by before switching power on and thor- be produced with a practical circuit;
lighting up neon globes and fluores- oughly insulating all high-voltage con- in some cases, over 1MV!
cent lamps. ductors. So without further ado, let’s The Tesla Coil comprises two L-C
In the lead photo, you can see a get into it. resonant tuned circuits. The primary
matrix I made using 100 neon lamps, tank circuit consists of the primary
sections of which light up when placed Tesla Coils capacitor and a coil. The secondary
in proximity to a strong electromagnetic This Tesla Coil is based on a Class-E RF coil (and often, high-voltage toroid)
(EM) field (such as generated by this power amplifier that’s tuned to oscil- and the surrounding air form the sec-
Tesla coil). Depending on the panel’s late at around 10MHz. It drives a tap on ondary L-C circuit. The two circuits are
orientation, it can display the ampli- an auto-transformer; the transformer’s connected in series and tuned to reso-
tude of the EM field or the relative secondary is excited by the oscillator nate at the same frequency for efficient
shape. I think this is a really interest- to produce a high-frequency, continu- energy transfer.
ing way to observe such fields. ous-wave output. The classical Tesla coil uses a spark
The first thing you might think of You might be used to seeing Tesla gap arrangement to switch the energy
looking at photos of this device is: ‘is Coils with a doughnut-like metal toroid stored in the primary capacitor into the
it safe?’ Yes, and no. It generates about on top, from which the discharge primary coil.
The energy in the primary circuit, moving back and forth A continuous-wave coil operates at 100% duty cycle,
between the capacitor and primary coil, transfers (couples) resulting in silent operation. An interesting property of a
some of the energy to the secondary circuit. The voltage high-frequency, high-voltage output is its ability to produce
in the secondary continues to rise until the electrical field a flame discharge, in which the ionised air (plasma) takes
strength exceeds that of the insulating property of air sur- on the appearance of a candle flame. However, producing a
rounding the large surface areas of the top load and breaks stable flame is tricky and requires a fair bit of tuning.
out as an arc.
Tesla coils can be scaled up to produce many millions of Circuit description
volts. Currently, the world’s largest Tesla coil is the ‘Elec- As shown in Fig.1, the circuit uses a simple Class-E RF
trum’ designed by Eric Orr in New Zealand (see www. power amplifier to provide an RF drive current for the oscil-
gibbsfarm.org.nz/orr.php) and built by Greg Leyh of Light- lator. This amplifier design dates back to the mid-1960s.
ning on Demand (www.lod.org). Unlike a typical RF amplifier, which drives a 50W resistive
Excitation methods
There are three main types of excitation methods for Tesla coils: The Tesla Coil
when operating can
Spark gap Tesla coil (SGTC) produce a flame
Includes static gap, triggered gap and rotary gap types. This discharge which
loosely resembles
type of excitation may also be referred to as ‘disruptive’. A
a candle. Care
high-voltage source is typically used. should be taken
when operating
Solid-state Tesla coil (SSTC) the Coil as the
Includes single resonant and dual resonant solid-state flame produced is
(DRSSTC) types. A DC power supply is used to charge the extremely hot and it
capacitor, with a power semiconductor such as a MOSFET produces very high
or IGBT replacing the spark gap. voltages!
Construction easily. The central channel provides a 20mm diameter PVC pipe. However, I
The first construction task is to pre- space to mount the driving electronics. had to rewind this three times during
pare and wind the secondary reso- Also, it has flanges to act as feet, with initial testing due to it burning up.
nator coil. The former is made from holes to attach spacers for holding the 0.5mm wire will not handle 20A, which
standard 25mm inner diameter PVC upper structure. I discovered during troubleshooting.
pipe available from any plumbing The base plate supporting the pri- However, after moving to a current-lim-
or DIY supply store. I cut mine to a mary and secondary coils is made from ited power supply, I have not had any
length of 106mm, which was based an off-cut of 3mm FR-4 substrate (basi- problems with it.
on my calculated winding data from cally a PCB without copper). Alter- If doing it all over again, I would con-
JavaTC and allowed for extra mate- natively, you can also use an acrylic sider using larger diameter wire.
rial at each end for mounting. The (Plexiglas/PMMA) sheet. To connect the base of the secondary
outer diameter of the PVC tube is The heatsink needs holes to be back to the driver, I used a 2mm banana
26.9mm, and the winding itself is drilled and tapped for the mounting plug and socket so that I could remove
82.2mm high. points, as well as the MOSFET. and disconnect the secondary to work
I gave the surface a light sand- I mounted the driving components on the device.
ing, followed by a light coating with on a cut piece of unclad, punched lam- The connections to the MOSFET
electrical-grade varnish; however, this inate, 56mm x 107mm. We have pro- are terminated on the underside of
is not critical. duced a PCB design to make assembly the board (the solder side). The wires
As mentioned earlier, the secondary easier. I cut the board so that it fit snugly pass through holes drilled in the heat-
coil is wound using 0.5mm diameter inside the heatsink channel. sink and are terminated to a three-
enamelled copper wire; for example, Our driver PCB is coded 26102221, pole pluggable screw terminal. The
from Jaycar, Cat WW4016 or Altron- measures 56 x 107mm and is available MOSFET is connected via the plug. I
ics, Cat W0405. from the PE PCB Service. Mount the highly recommend this approach, as
The secondary coil can be wound by parts on that now, using the overlay it is reasonably likely that you will
hand or with the assistance of a hand diagram (Fig.2) as a guide to see which blow up a MOSFET at some point
drill. Once finished, apply several parts go where. during testing.
coats of clear polyurethane varnish to The control potentiometer is I also recommend purchasing a bulk
seal the coil. Another option is ‘Ulti- mounted on a PCB measuring 56 x quantity (eg, 10 pieces) to ensure you
meg’ electrical varnish, which I have 30mm, also available from the PE PCB can continue to experiment.
used; it is available from Hi-Wire (see: Service. This is mounted at 90° on the I glued the primary coil (L2) former
https://www.hi-wire.co.uk/acatalog/ end of the main PCB using tinned cop- and secondary (L3) plastic coupling to
Varnish.html). per wire braces to produce a robust the FR-4 fibreglass base using two-part
I built the base of the unit around a mechanical support. epoxy. I have begun to use the Loctite
large heatsink, Jaycar Cat SY4085. As L1 is a 10μH inductor. In my design, brand (see parts list) over Araldite and
well as cooling the MOSFET, it’s heavy this is 24 turns of 0.5mm diameter have not looked back. It works very well
enough that the Coil won’t fall over enamelled copper wire on a length of and is also cheaper.
Fig.2: we designed this driver board based on Flavio’s, which he made on a piece of unclad, punched FR4 fibreglass
insulation. It’s pretty straightforward as there aren’t that many components, but we have kept the tracks well spaced
apart to prevent arcing.
Testing
Before proceeding, make sure to keep
your body away from the secondary
coil at all times, especially the exposed
metal at the top. This sort of voltage at
such a high frequency can cause severe
RF burns. Always power the unit up While this Tesla Coil prototype was built on a veroboard, a manufactured
with the potentiometer would fully PCB is available.
anti-clockwise.
As mentioned earlier, the recom- To start the Coil, slowly rotate the con- this purpose. The tool is simply made
mended power supply is a current- trol pot until the circuit starts to pull cur- by sandwiching a nail between two
limited supply delivering around rent, then tap the acorn nut with an insu- sticks, with the assembly held together
32V DC. A current rating of 3.0-3.5A lated metal tip. The Coil will not estab- by epoxy glue. For a nice touch, cover
should be sufficient. lish the discharge on its own; the arc the sticks with heatshrink tubing.
You can test the unit initially without must be established using a small metal Start the breakout by turning the
the secondary coil. Place a small neon tip quickly tapped on the acorn nut. control pot to about halfway and tap
lamp near the primary (not connected I made a simple little tool from flat the breakout point with the tool. One
electrically) and power up the circuit. wooden ice lolly sticks and a nail for advantage of this approach is that it
The electromagnetic field will cause
the neon to light up if it is oscillating
correctly, as shown in the lead photo. The finished board is then
Remember that you will need to wind mounted comfortably inside the
the potentiometer clockwise a bit before heatsink. The adjacent photo
anything happens. shows the mounting arrangement
Power it down and place the second- for the MOSFET, which is located
ary inside the primary. When powered on the other side of the heatsink
underneath the main board.
back up, you may be able to observe a
discharge. If you have a compact fluo-
rescent lamp (CFL), bringing it near the
secondary should cause it to light up,
again due to the EM field.
Operation
I have found my Tesla Coil to have rel-
atively stable performance. I am driv-
ing my Coil from a dedicated 48V 5A
Mean Well switchmode power supply.
TEACH-IN 9
FROM THE PUBLISHERS OF
Y
OF
TEACH OUR
-IN SE
Electron Publishing GET TESTING!
Electronic test equipment and measuring
techniques, plus eight projects to build
FREE
CD-ROM
TWO TEACH
-INs
FOR THE PRICE
RIES OF ONE
AVAIL
• Multimeters and a multimeter checker
• Oscilloscopes plus a scope calibrator
AB
• AC Millivoltmeters with a range extender
PLUS...
YOUR GUIDE TO THE BBC MICROBIT
A LOW-COST ARM-BASED SINGLE-BOARD
COMPUTER
Teach-In 9
Get Testing
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
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 Mi-
crocontrollers – 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.
Practical
Electronics BACK ISSUES
Practical Practical Practical Practical Practical Practical Practical
Electronics Electronics Electronics Electronics Electronics Electronics Electronics
The UK’s premier electronics and computing maker magazine
The UK’s premier electronics and computing maker magazine
The UK’s premier electronics and computing maker magazine
The UK’s premier electronics and computing maker magazine
The UK’s premier electronics and computing maker magazine
The UK’s premier electronics and computing maker magazine
The UK’s premier electronics and computing maker magazine
Circuit Surgery Audio Out Circuit Surgery
Make it with Micromite Audio Out KickStart Circuit Surgery
Make it with Micromite Audio Out Cool Beans Make it with Micromite
Circuit Surgery Audio Out Wind turbine Electronic Building Blocks
Circuit Surgery Audio Out Circuit Surgery
Make it with Micromite Audio Out Circuit Surgery
Make it with Micromite KickStart Make it with Micromite
Exploring op amp PE Analogue Vocoder: Exploring op amp
Using and interfacing the Vocoder: Driver Using the Exploring
Using and interfacing the the Vocoder: Mastering switch Build an iButton-based
Exploring the Vocoder final Small-scale Building a budget Distortion and Designing a practical Code for an iButton-based
Simulating distortion Using transformers in Installing MMBASIC on
Using
a distortion and Exploring DACs and MMBASIC + RPi Pico + display
exponential amplifiers Driver Amplifier design versatile iButton input offsets Amplifier build I2C bus versatile iButton LM35 temp sensor Audio PSU debounce Royer oscillator
Electronic Door Lock assembly garden set-up electronic stethoscope
distortion circuits de-thump circuit Electronic Door Lockand distortion circuits audio electronics Raspberry Pi Pico distortion circuits microcontrollers = PicoMite Backpack!
power supply
Assembly
Board
clear_bit(intcon, 2);
Microchip
Learn Wind Chimes Evaluation Kit from Microchip
FCM_INTERRUPT_TMR
Simple
EF300BA110A122928352
WIN
Flowcode
Programming
86C
:2000200D928FE28073 Flowcode C
void interrupt(void)
{ if (intcon & 4) C
Learn
void interrupt(void) o(); {
bsf STATUS, RP0 Assembly
{ if (intcon & 4) clear_bit(intcon, 2);
bcf STATUS, RP1
Flowcode
:08000800F000F00S030 Hex
192kHz, 24-bit
o(); bsf STATUS, RP0
EF10000 movwf _adcon1
bcf STATUS, RP1 movlw D′192′
Hex :10001000040EF2000A0 :040000008A01122837
Learn
:040000008A01122837 86C EF10000
movwf _option_reg
Vintage Battery
:08000800F000F00S030 :2000200D928FE28073 :10001000040EF2000A0
Programming:
EF10000 EF300BA110A122928352
:10001000040EF2000A0
SuperCodec:
86C
If we do not have a a paper version of a particular SEND TO: Practical Electronics, Electron Publishing Limited
issue, then a PDF can be supplied for the same price. 113 Lynwood Drive, Merley, Wimborne, Dorset BH21 1UU
Your email address must be included on your order. Tel: 01202 880299 Email: [email protected] On-line Shop: www.electronpublishing.com
Please make sure all components are still available before Payments must be in £ sterling – cheque must be drawn on a UK bank and made payable to ‘Practical Electronics’.
commencing any project from a back-dated issue. All items normally posted within seven days of receipt of order. Copy this form if you do not wish to cut your issue.
Cooling Fan
Controller &
Loudspeaker
Protector
By
John Clarke
M
any devices need forced- to prevent the annoyance of constant amplifier back to a lower temperature.
air cooling when working hard fan noise (and dust collection). If the temperature continues to rise, the
but do not need fans to be run- One simple method to provide cool- fan will run at a progressively faster
ning (or perhaps only running slowly) ing fans is to have a thermostat con- rate, up to full speed.
when they are idle or under light load nected to the heatsink that switches By choosing the right fans, they will
conditions. This includes large power on the fan(s) whenever the temperature be extremely quiet at slow speeds, and
supplies, audio amplifiers, motor speed exceeds a certain threshold. But, when the temperature can usually be con-
controllers – just about anything that switched on, the fan(s) run at full speed trolled without making noise. Here,
gets hot under load. and make considerable noise. That is we’re using PWM-controlled com-
Even devices for which passive con- especially bad for an audio amplifier puter fans with brushless motors.
vection cooling is adequate can have as it can ruin the listening experience. They are readily available at a range of
their lifespans extended if they are A less obtrusive method is to adjust prices, start at just a few pounds each,
fitted with fans that switch on once the speed of the fan(s) so that there is and generally are silent at low speeds.
things start heating up. Those fans a gradual rise in speed as temperature Some can still move a lot of air at full
might only need to run during summer, rises. Once the heatsink passes a cer- speed, though.
when ambient temperatures are high. tain temperature, the fan(s) run slowly As this board is especially suitable
Ideally, the fans stop or spin slowly to start with; this usually provides for power amplifiers, we’ve added
when only a bit of cooling is required, sufficient air movement to bring the several extra features to it. Power
SPECIFICATIONS
DC offset reaction time: 75ms Temperature setting range: 0-100°C (273-373K)
Fan PWM control frequency: 25kHz Over-temperature hysteresis: 4°C (4K)
Amplifier DC offset detection: < –2V or > +2V AC loss detection threshold: 9V AC
Relay power-up delay: typically 6s after fans are detected
Fan disconnect/failure audible alarm: 264ms burst of 3.875kHz at 1Hz
Trimpot voltage/temperature conversion: 10mV/K (2.73V = 273K = 0°C)
Over-temperature or DC fault audible alarm: 264ms burst of 3.875kHz at 0.5Hz
NTC thermistor range: 0-100°C (responds to highest temperature when two are used)
Trimpot adjustments: three – fan switch-on threshold, fan speed range and over-temperature alarm
FEATURES
Suits mono and stereo audio amplifiers, or any other device which
needs thermal fan control
Onboard loudspeaker protector controller with de-thumping at switch
on and switch off
Loudspeakers are disconnected with over-temperature fault
One or two thermistors for temperature sensing
PWM control for one to three cooling fans
Over-temperature and fan-failure alarms
Temperature control range of 0-100°C
Fan detect and relay-on LED indicators
Amplifier connections
The Controller monitors the AC side of
the amplifier power supply as well as
amplifier output offset voltage. These
are wired to CON4; the AC supply volt-
age goes to IC1’s AN4 analogue input
at pin 16, while the amplifier outputs
go to AN5 (pin 15) and AN6 (pin 14).
AC detection is done by half-wave
rectifying the voltage from the trans-
former’s secondary. Diode D5 rectifies
the AC, and the resulting voltage is fed
through a low-pass filter comprising a
47kW resistor and 2.2μF capacitor.
Without any AC voltage, the AN4
analogue input at pin 16 of IC1 is held
at 0V via the 47kW pull-down resis-
tor. When at least 9V AC is applied,
the voltage at pin 16 will exceed 2.5V.
This voltage is limited to 4.7V by zener
diode ZD3.
The time constant for the filtering has
been chosen to ensure sufficient ripple
Scope 1: two PWM fan control waveforms, with a low duty cycle at the top voltage is removed from the rectified
in yellow (so the fan runs slowly) and a high duty cycle below in white, for a AC while minimising the detection
higher fan RPM, but short of full speed. period for loss of AC.
Setting up
With power applied, adjust VR1, VR2
and VR3 for suitable temperature set-
tings while monitoring the voltages
TP1, TP2 and TP3 respectively. We rec-
ommend starting by adjusting VR1 to
Fig.2: assembly of the Controller is straightforward; fit the components as get 3.03V at TP1, giving a 30°C (303K)
shown here, starting with the lower-profile axial parts and working your fan starting temperature. Then set VR2
way up to the taller devices. Watch the orientations of IC1, the diodes (Range) for 2.83V at TP2, providing a
(including LEDs), trimpots and electrolytic capacitors. 10°C ramp range. That way, the fans
will be at full speed by 40°C.
You can initially set the over-tem-
perature setting for VR3 to 50°C. That’s
323K, so adjust VR3 for 3.23V at TP3.
These settings may need adjusting to
optimise the way the fan speed varies
with temperature. Consider that with
a starting temperature of 30°C, the fans
will start to run as soon as you power
the device up on a hot day if the device
is not in an air-conditioned room. On a
sweltering day where it reaches 40°C,
the fans will run at full speed all the
time (which might be necessary!).
It depends on the device you are
cooling and how sensitive it is to tem-
perature. Keep in mind that, as it’s an
external device, the thermistor will be
measuring a lower temperature than
the semiconductor junctions that are
presumably generating the heat.
You could raise the switch-on thresh-
old temperature considerably if the
device adequately cools via convec-
tion when it isn’t running at maximum
power; the fans would then only need
to run at higher loads and temperatures.
When adjusting the range, we don’t
suggest you go too much lower than
10°C as the fans will appear to operate
in an on/off manner, particularly with
a range setting below 2°C.
Fig.3: here’s a guide on how to connect one of the speaker protection relays. If the temperature cannot be con-
If you have two amplifier channels, you can use a DPDT relay, in which case trolled using these settings, or if the fans
the wiring is similar but you duplicate the speaker and amp wiring for the run at full speed most of the time, you
second set of relay contacts, and connect the second SPEAKER + terminal to might need more fans (up to three max-
the other AMP1/AMP2 terminal. For two separate SPST relays, do the same imum for this Controller), larger fans or
but connect the second relay coil back to the other pair of relay terminals on fans that run at a higher speed at 100%
the controller board. duty cycle. Keep in mind that there are
flow-optimised fans and pressure-opti-
leads to pass through their mounting Before installing IC1, check the reg- mised fans (with different blade shapes).
holes, then secure its tab to the PCB ulator output voltage by applying 12V
using the M3 x 6mm machine screw across CON4’s +12V and 0V terminals. Accuracy
and nut, after which the leads can Check that the voltage between the Note that temperature setting accu-
be soldered. regulator metal tab and the right-hand racy is dependent on the 5V supply
W
hen I moved into my After repeated episodes of the sys- drive unit and are mechanically acti-
current home some 20 years tem failing, I was getting fed up. I vated at each end of the gate travel,
ago, I enjoyed the fact that took one of the original boards and via a spring arm, when the gate is fully
the front fence had a sliding electric replaced the relays, to good effect. I closed or fully open.
driveway gate. However, after about a also replaced some aged electrolytic A swinging gate is likely to have a
year, the gate started to malfunction, capacitors, but the writing was on similar arrangement, so my controller
initially with intermittent behaviour the wall. could be suitable for that type of gate.
and then total failure. Fortunately, the radio receiver board However, I have not tested it as such.
I inspected the gate control module, (a generic third-party product) had You would have to check how your
which was based around a control- always been very reliable, so I kept gate system works before deciding to
ler CPU. The motor switching relays that and decided to design a new con- use my controller.
looked somewhat small for the task, troller board to connect to it. The controller logic needs to take
and I could see significant contact burn- account of the states of these limit
ing through their transparent covers. My solution switches during the use of the gate.
I called the manufacturers for a sche- I decided to throw the original con- It must then control the motor direc-
matic, but they did not want to provide troller PCB in the bin and design my tion appropriately when the gate starts
any assistance. Instead, they directed own from scratch. Looking around at from a fully closed or fully open, or
me to their local repair agents. A fellow the parts in my workshop, I had a good perhaps intermediate position.
at the company seemed quite sympa- supply of 74-series vintage TTL logic It also needs to detect the motor cur-
thetic, but it was apparent he ‘wasn’t ICs. These are rugged and reliable, also rent in case the gate strikes an obsta-
allowed’ to help a customer to effect highly resistant to damage from elec- cle, to stop the gate motor.
their own repairs. trostatic discharge (ESD). The gate is controlled by a hand-
As is often the case, the repair agents The task of an electric driveway gate held remote via a radio receiver board,
were unable to make PCB-level repairs appears simple on its face. But like its output being a momentary closed
and could only replace the whole con- many automation systems, the devil contact from a small relay on the radio
trol board for hundreds of dollars. Ini- is in the detail. receiver board. But it could also be
tially, I accepted this. My sliding gate is powered by a controlled by a manual pushbutton.
It failed again a year later, and again, 24V DC bidirectional brush motor. Finally, the control logic requires a
I had to buy a new PCB. Further fail- It has two standard micro-switches very effective reset function to ensure
ures appeared after lightning storms as motion limit switches. These are that the gate remains in its stopped
on two occasions. mounted close together in the motor position with any kind of rapid, slow,
Circuit details
The circuit is shown in Fig.3. Either
power-cycling or gate over-current is
designed to set the gate into the ‘stop
before reverse’ condition. This does
not cause a problem even if the gate is
power cycled in the fully reversed con-
dition, as with the next activation of
the remote control, the state machine
is forced into the correct condition (ie,
‘stop before forward’) before the gate
starts its motion.
One important feature of the
design is that the limit switches
are debounced. The cross-coupled
inverter gates (IC1a, IC1b, IC1e and
IC1f) very effectively debounce a
changeover switch, unlike other meth-
ods using RC networks, Schmitt trig-
Power input: 24V AC gers, delay timers etc.
Motor current limit: adjustable from 0A to 8.33A This method is mainly time-domain
independent, and the 7404 logic ICs
Power for remote control board: 5V DC or 24V DC are not harmed because their outputs
Motor drive: 24V DC or rectified AC at up to 8.33A (200W) are only forced low for the very brief
propagation time of the inverter gate.
74-series ICs, while good at sinking
or variable mains power cycling. Oth- the state machine is in the correct current, only weakly source it.
erwise, a brownout, blackout or other condition according to the now-static One interesting consideration
event could trigger the gate’s motion switch data. On the trailing edge of is whether to regard the two limit
and maybe open up the gate when you the pulse, the state machine is then switches as independent items, or two
are not home. clocked to the ‘forward’ state, and the items acting together.
gate begins to close. The two limit switches are entirely
The state machine The closed switch is triggered when isolated from the mechanical perspec-
Considering these requirements, there it is shut, and the machine is set to the tive, and it is essentially impossible to
are four fundamental modes of opera- ‘stop before reverse’ state. If the button activate them simultaneously. After
tion, cycled through by a button press. is pressed again, the state machine is all, the gate cannot physically be in
Initially ignoring the two limit reset to this condition on the leading two places at once (open and closed),
switches, the remote control needs to edge of the pulse, then clocked to the and the spring arm that activates the
cycle the gate through four operational ‘reverse’ state on the trailing edge, and switch can only be pushed in one
states, shown in Fig.1. the gate starts to open. direction at a time.
Therefore, a two-bit counter is
needed, giving four logic states. I
achieved that using a 7474 dual D-type
Fig.1: the gate is controlled using a
flip-flop IC. These flip flops can be ‘state machine’ with four states: fully open,
preset or cleared, which is required to fully closed, opening or closing. The
take account of the gate limit switch remote button cycles to the next state in
conditions. the loop, while the limit switches on
Fig.2 shows how the state machine the gate force the machine into one
is controlled by a combination of the of the stopped states.
limit switches and the remote control.
For example, when the gate is open-
ing and it reaches the limit switch, a
100ms pulse is gated via the OR gate
and the lower AND gate, the state
machine changes to the ‘stop before
forward’ state, and the gate motor stops.
If the control button is then pressed
on the remote, upon the button ini-
tially being pressed, the ‘stop before
forward’ state is reset to be 100% sure
Fig.2: more detail on how the state machine is implemented using digital logic chips. When either the remote button
is pressed or a limit switch is activated, a pulse is generated. These pulses are ORed to create a pulse that advances
the state machine to the next state. The pulses are also ANDed with the limit switch signals to force the machine into
either the fully closed or fully opened states when needed.
Next, bend another off-cut to go wires need to enter the box and where motor and five or six wires going to the
from the other lead to the AC termi- the best place is for them to enter. limit switches. Ideally, use cables with
nal as shown in Fig.4 and the photo, The wire entry will need to be water- a round profile and run each through
then solder it to the other end of the proof if the unit will live outside, its own cable gland.
resistor and clamp it down in the which can be done either using one You could use a four-core screened
screw terminal. or more cable glands (as mentioned cable for the limit switches and two-
in the parts list) or seal the holes with core round cable for the others, mean-
Wiring it up neutral cure silicone sealant after run- ing you need three glands and thus
Before mounting the PCB in the case, ning the wires through. three holes in the case.
you will need to figure out where the Most likely, you will have ten wires If you can’t fit the radio receiver in
radio receiver module will be mounted to run in two twin leads and two multi- the case, you will need to run some
(it might be possible to fit it to the core cables: two for the low-voltage AC additional wires to the outside. These
inside of the enclosure lid), which power input, two wires going to the are two wires to power the receiver
board (assuming you aren’t supply- We won’t give any instructions on you will be better off finding a suit-
ing it with power externally) and two how to do this, except to say that you able plugpack instead.
which run from the receiver’s relay need to use correctly coloured mains- Drill holes for these glands (or the
contacts to input connector CON3. rated wire where appropriate (live bare wires, if using silicone) near
They could be run together using = brown, neutral = blue and earth = where the relevant connectors will be
three- or four-core screened cable. green/yellow striped). You will also once the PCB is mounted in the case.
Note that, as there is no room in the need to ensure that all exposed mains Mount the glands securely, then install
box for a mains transformer, you will conductors are insulated (eg, with the PCB, insert the wires, attach them
either need to use an AC plugpack or heatshrink tubing) and tied up neatly to the relevant terminals (as shown in
(more likely) mount a mains trans- with cable ties so they can’t float Fig.4), pull out most of the slack and
former, mains input socket (or captive around in the box if they break loose. tighten the gland nuts.
cord), fuseholder and wiring in a sep- If you aren’t experienced with If you have room to fit the receiver
arate insulated box. building mains-powered equipment, in the box, you could attach it to the
inside of the lid using neutral cure Testing, setup and use should get a reading close to 5V. Next,
silicone sealant – make sure it isn’t There isn’t much to go wrong, but check the voltage at the 68W 5W resis-
going to foul any components on the since the motor will not be running tor leads right near the edge of the PCB
main PCB when the cover is in place. initially, you could connect a safety relative to the tab of REG1.
Another option is to use tapped spac- resistor (say 10W 5W) in series with This reading should be between
ers and screws (assuming it has mount- the AC supply the first time you set it about 22V and 28V if a radio receiver
ing holes), but if you do that, make sure up. Check the AC voltage across that board is connected, but it could be
you seal the screw holes through the resistor; it should be well under 1V. somewhat higher than that (up to about
lid so moisture can’t get in. If it’s more, switch off and check the 35V) if there is no radio receiver board
If mounting it on the lid, that also board and wiring for faults. drawing power from the unit.
allows you to run the receiver antenna Assuming it’s OK, measure the volt- If that all checks out, remove
around the inside of the lid, assuming age between pins 1 and 14 of IC6 (or the safety resistor and connect the
it is using a length of wire as a whip. just about any of the 74xx ICs). You low-voltage AC supply directly to the
This compact unit is low in cost but can perform spectral analysis from
35MHz to 4.4GHz. It also includes a tracking generator for frequency-
domain analysis of filters, RF amplifiers and similar items. It needs to be
controlled from a PC via a USB cable (which also provides its 5V DC power
supply), using a very impressive free application.
A
bout a year ago, I bought £48 (free one-week shipping to UK). I The ADF4351 is quite a complex
an earlier version of the Geek- also downloaded Mr Augusto’s VMA device, but we had a pretty detailed
creit LTDZ spectrum analyser, SSA software. description of how it works in the
which came as a ‘naked PCB’ module. As you can see from the photos, the May 2019 issue of PE, specifically my
The idea was to check it out and write LTDZ V5.0 is quite compact at 62 x 55 review of the 35MHz-4.4GHz Digitally
a review, but I wasn’t too impressed x 19mm, not counting the two SMA Controlled Oscillator module.
when I tried it out. connectors extending from the input/ So please read that article if you
The software needed to control it was output end. want to know more about how this chip
both difficult to find and rather flaky, It also weighs only 83 grams. It comes works. You can also find the data sheet
and the unit itself had poor sensitivity complete with a 950mm-long USB2.0 for it at: https://bit.ly/pe-dec22-ad1
combined with a relatively high noise cable, with a Type-A plug at one end By the way, the LTDZ draws about
floor. There wasn’t much I could say and a micro Type-B connector at the 100mA from the PC in standby mode,
about it that was positive, so I decided other end, to connect it to a PC. rising to roughly 350mA when it’s
to give it a pass. The LTDZ V5.0 is quite well made, scanning with the tracking generator
But earlier this year, I found that an although the panels at each end of the also running.
improved version of the analyser had case in the unit I received had holes
become available (the LTDZ V5.0), com- for the countersink-head mounting How the analyser works
ing inside an extruded aluminium case screws which were not countersunk. I have prepared a block diagram
and not costing all that much more than This made it look unfinished until I (Fig.1) that shows how the LTDZ 5.0
the original ‘naked’ version. removed the panels and countersunk works. The ADF4351 chip at the bot-
I also discovered that although Geek- their holes to complete the job. tom of this diagram forms the heart
creit was still recommending the same This also gave me the opportunity of the analyser section, while the one
control software that I had found so to examine the PCB inside and take at upper right provides the tracking
problematic, a much better program its photo. All of the components in generator function.
had appeared – one that you can down- the LTDZ V5.0 are mounted directly The STM32F103 MCU (microcon-
load for free. on this PCB. troller) handles the operation of both
It’s called VMA Simple Spectrum Like the Geekcreit VHF-UHF sig- sections, directed by the software
Analyser (VMA SSA), written by Vitor nal generator module I reviewed last running in the PC. The two USB sig-
Martins Augusto, who lives in Portugal, month (PE, January 2023), the LTDZ nal lines (D– & D+) from the LTDZ’s
and it can be downloaded from his site: V5.0 uses the Analog Devices ADF4351 micro-USB connector at upper left pass
https://bit.ly/pe-feb23-vma digital PLL synthesiser chip. In fact, it through a CH340G USART chip before
So I went ahead and ordered an uses two of them: one in the analyser reaching the MCU. The micro has an
LTDZ V5.0 from the Banggood web- section, and one in the tracking gener- 8MHz clock crystal, while the CH340G
site (https://bit.ly/pe-feb23-ltdz), paying ator (TG) section. has a 12MHz crystal.
Trying it out
All I had to do initially was plug the
LTDZ into my computer using the sup-
plied cable and launch the VMA SSA
software. Next, I clicked on its Setup
menu, to tell it the virtual COM port
number which the LTDZ has been
Screen 1: the VMA SSA software output when the LTDZ input is terminated assigned (in my case, COM3) and the
with a 50W resistor over its frequency range of 35-4400MHz. particular Analyser model.
The VMA SSA application can work
with five different units, with the LTDZ
V5.0 listed as ‘SMA Simple Spectrum
Analyser Version 2 – 35MHz-4.4GHz
– ADF4351’.
You then need to select the ‘Spec-
trum’ option at the top left of the
screen. This gives you the main screen
for spectrum analysis, as shown in the
screen grabs.
Most of the screen is occupied by the
centre plotting graticule, with a nar-
rower graticule below it that can show
a ‘waterfall’ display (although the two
can be swapped, if you wish). On the
right are most of the control setting
controls, with a large START/STOP
button at the top.
Click on any of the small Frequency
Screen 2: the LTDZ input was now connected to an external VHF/UHF discone setting boxes on the right opens a ‘key-
antenna with a plot over 200-208MHz. The average signal level was –49dBm board’ dialog box that makes it easy
over that range. to enter a new frequency. This also
applies if you click on any of the other
small boxes; for example, the ‘Samples’
box, the ‘Wait (us)’ box or the ‘Marker1’
or ‘Marker2’ boxes.
Screen 1 shows what was displayed
when I fitted a 50W termination to the
LTDZ input, set VMA SSA for the full
span of 35-4400MHz and clicked the
START button. This is the ‘noise floor’
of the LTDZ, which I found to be almost
constant at –76.9dBm over the whole
frequency range.
Screen 2 shows what was displayed
when I connected the input of the
LTDZ to an external VHF/UHF discone
antenna, and set the VMA SSA soft-
ware to scan from 200MHz to 208MHz
(the frequency range used by Sydney’s
Screen 3: a Gratten GA1484B VHF-UHF signal generator was used to provide DAB+ transponders). The full range of
the LTDZ with an unmodulated 2.5GHz output at 0dBm. The software was then transponder signals is shown, with an
set to scan over 2.4-2.6GHz. average level of about –49dBm. Note
those five sharp ‘notches’ though; more
After using VMA SSA for a short better and much easier to use than the about this shortly.
time, I was so impressed that I sent Mr NWT4.11.09 software that Geekcreit The next step was to power up my
Augusto a donation of $25 and received still recommends. Gratten GA1484B VHF-UHF signal gen-
a permanent activation code. There is Incidentally, the file you download erator and set it to produce an unmod-
no doubt in my mind that it’s massively from Mr Augusto’s site is zipped, ulated output of 2500MHz (2.5GHz) at
Notch artefact
The next step was to leave the signal
generator set to 2500MHz with 0dBm
output and connected to the LTDZ
input, but to change the VMA SSA
app’s frequency settings to give a much
smaller spectrum span of 10MHz (ie,
5MHz either side of 2.5GHz). This gave
the display shown in Screen 4.
The spike at 2500MHz has now
expanded into a pair of ‘twin peaks’,
with a fairly deep notch between them.
The twin peaks reach an amplitude of The ‘rear’ of the module houses a micro Type-B USB socket for connecting to a
about –2.5dBm, much closer to the cor- computer, plus two more status LEDs to indicate STM32 operation and power,
rect value. But the notch in the centre and a pushbutton labelled ‘KEY’ which controls the tracking generator.
reaches down to about –31dBm, which
is a bit disconcerting. as he admits; crunching the scanning perform a couple of spectrum scans of
It turns out that this kind of notch is data to truly remove the notching circuitry connected between the track-
basically due to the fixed and relatively would be pretty complicated. ing generator output and the Spectrum
wide RBW of the LTDZ and similar In another post dated 4 February Analyser input.
low-cost analysers. As Vitor Augusto 2022 year (https://bit.ly/pe-feb23- The first item I scanned was a Flight-
explains in his blog post dated 13 Octo- vma3), Mr Augusto announced that Aware ADSB bandpass filter. This was
ber 2017 (https://bit.ly/pe-feb23-vma2), a colleague of his named Dominico connected via a 150mm-long SMA-
the fixed and wide RBW causes them to had put much work into improving SMA cable. Then after pressing the
have a ‘blind spot’ in the centre of their the performance of LTDZ analysers. ‘Key’ button (S1) on the rear of the
‘scanning slot’ as the Analyser moves This is both in terms of improving the LTDZ’s case to turn on the tracking gen-
the input signals past it. hardware (presumably concentrated erator, it was simply a matter of setting
It’s this blind spot that causes a notch around the low-pass filter) and revising VMA SSA to scan between 800MHz
in the centre of signals with a narrow the firmware in the STM32F108 MCU. and 1300MHz, and clicking on the
bandwidth. That’s why professional In his February post, Mr Augusto START button.
(and much higher-cost) spectrum anal- provided a link to a beta version of The filter’s bandpass curve was then
ysers give you a choice of RBW settings, Dominico’s revised firmware. However, displayed, as shown in Screen 5. The
as low as 10kHz he didn’t give any details of Dominico’s filter has a flat response from 1000MHz
Mr Augusto has included a notch changes to the LTDZ’s hardware. to 1150MHz, with an insertion loss of
function into his VMA SSA app, about 4dB, falling away quite steeply
which, when selected, can fill in this More details on the current product at either end. Just the shot for receiv-
kind of notch by replacing it with a Getting back to my review of the prod- ing ADSB signals centred on 1090MHz!
straight line between the twin peaks. uct as it stands today, I decided to try Finally, I ran a series of tests using
But this is just a cosmetic workaround, using the LTDZ’s tracking generator to SMA-SMA fixed attenuators, again
ELECTRONICS
£8.99
CD
Mike & Richard Tooley CD
JUMP START
TEACH-IN 3
£7.99
The three sections of the Teach-In 3 CD-ROM cover a Mike & Richard Tooley
TEACH-IN 5
FROM THE PUBLISHERS OF
huge range of subjects that will interest everyone involved 15 design and build circuit projects for newcomers or
CIRCUIT SURGERY JuMP START
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
following courses in schools and
students to experienced constructors and professionals. 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
i Over 40 different circuit ideas
Machine n Battery Voltage Checker n Solar- The techniques of project construction
Surgery, EPE/PE’s regular clinic dealing with readers’ Powered Charger n Versatile Theft Alarm n Spooky
PIC ‘N MIx
Starting out with PIC microcontrollers
nics
Teach-
In FREE Circuits n Frost Alarm n Mini Christmas Lights n
queries on circuit design problems – from voltage ro
FREE M
TEACH-IN 1 CD-ROM bo
rne
Publishing Ltd 201
0 CD-RO
t
W
1
TWO TEACH-INs FOR
Elec
©
TWO TEACH-INs FOR
THE PRICE OF ONE!
n Egg Timer n Signal Injector Probe n Simple Radio
THE PRICE OF ONE !
components is covered. Finally, our collection of 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 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
version – plus a specially written TINA Tutorial). n MikroElektronika, Microchip and L-Tek PoScope software.
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
£8.99
CD
A BROAD-BASED INTRODUCTION TO
ELECTRONICS
TEACH-IN 4
FROM THE PUBLISHERS OF £18.95
Mike & Richard Tooley FREE
CD-RO
The CD-ROM also contains the full Modern work for everyone
Electronics Manual, worth £29.95. The Manual i Over 800 PDF pages
What a Bargain!!
if not, open double-click
and
Explorer f
index.pd
This CD-ROM
Adobe®
requires
Reader™
from
and web links
UAL
projects, data, assembly instructions and web links.
dable Free
Downloa be.com
MAN.co.u
www.ado
BA SE .epe mag
k
2011
www ne Publishi
ng Ltd.
RASPBERRY Pi ®
DISCRETE LINEAR CIRCUIT DESIGN
the necessary software A COMPREHENSIVE GUIDE TO RASPBERRY Pi
Practically Speaking – • Understand linear circuit design INTRODUCING THE ARDUINO
• Pi PROJECT – SOMETHING TO BUILD • Design simple, but elegant circuits
The CD-ROM includes
• Hardware – learn about components and circuits
• Pi CLASS – SPECIFIC LEARNING AIMS
for the series, so that • PYTHON QUICKSTART – SPECIFIC PROGRAMMING TOPICS
the techniques of
• Learn with ‘TINA’ – modern CAD software
• Five projects to build: Pre-amp, Headphone Amp,
• Programming – powerful integrated development system
• Microcontrollers – understand control operations
• Pi WORLD – ACCESSORIES, BOOKS ETC
the files for:
Tone Control, VU-meter, High Performance Audio Power Amp • Communications – connect to PCs and other Arduinos
• HOME BAKING – FOLLOW-UP ACTIVITIES
readers and circuit project building.
FREE
designers can get DVD-R
OM
ALL THE
SOFTWA
TEACH-I
RE
N6
FREE M
-RO
CD CIRCUIT
n Teach-In 8
FOR THE RRY Pi
n Microchip MPLAB
RE FOR
SERIES SOFTWA 7
CH-IN
THE TEA
SERIES
Smartscope software.
building PIC-based projects
I
recently became the proud pressure generally indicates that the
owner of an antique ‘weather station’ weather is set to worsen, with storms and
– a barometer incorporating a winds likely. A rapid drop in pressure
thermometer and hygrometer and wanted usually signifies that a storm can be
to have a means of checking its accuracy expected in the next few hours.
when making measurements of pressure, Antique mercury barometers are
temperature and humidity. The solution to invariably shipped in safe transportation
this problem proved to be very simple and mode and thus arrive unset. The in-built
straightforward. It first involved finding safety mechanism locks the needle and
a suitable sensor, interfacing it with an pulleys, preventing damage in transit.
Arduino Uno microcontroller, and adding On arrival, the barometer needs to be
a low-cost 20x4-character LCD module on assembled, positioned, and then the
which to display the results. The entire user can manually set the instrument
task (including software development to the current ambient pressure. The
and testing) was accomplished in less process usually involves an adjustment
than a couple of hours. that sets the indicating pointer to the
My recently acquired antique instrument required position. Once the barometer is
(see Fig.11.1) uses a column of mercury set, it is ready for use. Modern electronic
contained in a glass tube with one end barometric instruments, with their tiny
open and the other end sealed. The open sensors, microcontrollers and digital
bottom of the tube is placed in a reservoir displays avoid this process completely.
filled with mercury with the upper surface
of the mercury in the reservoir open to
atmospheric pressure (for more details,
see: https://bit.ly/pe-jan23-hg).
When raised into position, the mercury
level in the glass tube descends, creating a
vacuum at the top. The weight of mercury
in the glass tube is then balanced against
the atmospheric pressure acting on the
reservoir. By this means the height of
mercury in the column is an indicator
of the current atmospheric pressure.
Increasing pressure indicates good
weather, with the chance of it being
cold during winter months. Decreasing
Fig.11.1. (left) The author’s late-Regency
mahogany-cased mercury barometer
incorporates a large circular silvered-
dial, mercury-in-glass thermometer (long
rectangular display), hygrometer (top Fig.11.2. Sensor module incorporating
circular dial), and at the bottom, a (red- a BME280 sensor with I2C interface
alcohol) spirit level. circuitry on the reverse side.
Field of application
Parameter
Weather monitoring Humidity sensing Navigation Gaming
Mode Forced Forced Normal Normal
Sample rate 1 per minute 1 per second n/a n/a
Standby time n/a n/a 0.5ms 0.5ms
Pressure ×1 ×0 ×16 ×4
Temperature ×1 ×1 ×2 ×1
Humidity ×1 ×1 ×1 ×0
Filter Off Off ×16 ×16
Current consumption 0.16µA 2.9µA 633µA 581µA
RMS noise 3.3Pa/30cm, 0.07% RH 0.07% RH 0.2Pa/1.7 cm 0.3Pa/2.5 cm
Data output rate 1/60Hz 1Hz 25Hz 1.75Hz
Table 11.2. Going Further with the BME280 pressure, temperature and humidity sensor module.
The official Arduino website provides the library for reading and
BME280 I2C The code for this project can be downloaded from the
interpreting BME280 environmental sensor data (using either I2C or SPI).
library February 2023 page of the PE website.
You can visit the library by going to: https://bit.ly/pe-jan23-uno280
You will find a useful introduction to the I2C bus at the Texas KickStart 7 (PE, February 2022) provides a useful
I2C bus
Instruments website. Just go to: https://bit.ly/pe-jan23-ti introduction to the I2C interface.
A
couple of months ago we recent postal strikes impacted the delivery made simple thanks to MMBASIC’s ability
explored Part 1 of an exciting of these units – what else could possibly to easily send and receive serial data. In
biometric project: a PicoMite go wrong! Well, the good news is that the Part 1 we looked at the structure of any
Fingerprint Reader. If you followed the replacement parts did arrive, so now we message that is sent to (or returned from)
article (Make it with Micromite, Part can continue our project. But before we do, the fingerprint module; and this is once
42, December 2022), then hopefully there is one word of caution that I really again summarised in Fig.3.
you were successful in connecting and wish to emphasise: please be careful not To demonstrate communications between
communicating with the low-cost R503 to bend or stress any of the six thin wires the PicoMite and the R503 (and to also
fingerprint module. However, due to a that protrude from the rear of the R503 – check correct connection), we provided
few unforeseen issues, the progress of you have been warned! a demonstration program in Part 1 for
this project was delayed, and hence last Due to the units having only recently download (FP_MessageDemo1.txt). When
month we were unable to go to print with arrived, we will now be extending this the program was RUN, it simply turned
Part 2. Admittedly, I was the cause of the project to three parts. This month, we will on the blue ring-LED surrounding the
first issue, in that I got a bit too carried cover the topics of fingerprint enrolment, fingerprint sensor – nothing too exciting, but
away with the output voltage on my PSU. and fingerprint searching, so that you it confirmed that the hardware was working
This resulted in the R503 intermittently understand what commands need to be and that the PicoMite could successfully
sending random data values (on its serial sent to the R503 to perform these tasks, communicate with the R503.
Tx pin) to the PicoMite – yes, I had and in turn, how to interpret the responses
inadvertently destroyed the module. back to the PicoMite. Then, in Part 3, we FP_MessageDemo2
A replacement R503 was quickly ordered will assemble a unit with a built-in display We will begin this month by using an
and arrived in good time. However, this to act as a standalone fingerprint reader. updated version of the FP_MessageDemo1
replacement module also started behaving program. This allows us to better
strangely (even though I was now using a Recap demonstrate the steps involved in
dedicated 5V USB PSU). Doubtless, you The R503 fingerprint module that we are enrolment, and searching. Download the
have all found that it can be extremely using is inexpensive (£20), can operate from aptly named file FP_MessageDemo2.txt
difficult to track down the cause of random just 3.3V and uses a serial UART connection from the February 2023 page of the PE
behaviour in an electronics project. Indeed, to communicate with the outside world. website (https://bit.ly/pe-downloads) and
I lost many hours carefully checking wiring Internally, it deals with all the complex install the program into the PicoMite.
(albeit only six connections) and checking algorithms that capture and then convert When you RUN the program, you should
the program code for what I then assumed an image of a fingerprint into a digital see the blue ring-LED light up (assuming
must contain one, or more, bugs. Matters template (which is essentially a long list
were not made any easier by the poorly of data values). This module is perfect
written (not to mention, incomplete) for linking to a PicoMite so that we can
datasheet for the R503 fingerprint module. assemble a complete fingerprint reader.
Eventually, I made the decision to order The circuit diagram from Part 1 is reshown
yet another replacement R503; in fact, two here in Fig.1. Assembly is made easier if
replacements were ordered. However, the you use a Pico Expander board, and six
appropriate DuPont
Red 3V3 leads (see Fig.2).
3V3
Black GND However, to make
0V
Yellow Tx the R503 do anything
GP1
Green Rx
useful, commands
GP0 need to be sent from
Bue Finger detect
GP2 the PicoMite to the Fig.2. Using a Pico Expander board
White Induction power
3V3 R503 in a certain like the one shown here (along with six
order (and observing appropriate DuPont leads) makes it
Fig.1. All six wires coming from the back of the R503 fingerprint s o m e s p e c i f i c very easy to attach the R503 fingerprint
module need to be connected to the PicoMite as shown above. timings). This is all module to the PicoMite.
Remember to comment!
We will shortly be working through the enrolment process
of fingerprints, and then the subsequent searching. This
will involve sending a specific sequence of commands to
the R503, and observing the responses. To avoid having
to continually alter the value of PD_Qty depending on the
command being sent, and then also having to set up the
relevant number of Package bytes with the appropriate
byte values, we have pre-coded (and numbered) all the
necessary steps that we are going to be using. There are six
Fig.4. A screenshot of what the FP_MessageDemo2.txt program steps for enrolling, and three steps for searching.
outputs to the terminal screen. Here it shows the bytes communicated Scroll up to line 118, and you will see step 1 defined
when sending the command to turn on the blue ring-LED (also refer to with PD_Qty=1 : TxPD(1)=&h01 which is the GenImg
text from Part 1, page 61). command (more on this shortly). However, note that
Enrolment
To register a new fingerprint, follow the six-step enrolment process:
1. Take an image of the finger (GenImg command)
2. Convert the image into a temporary Template and store it in
CharBuffer1 (Img2Tz command)
3. Taking a second image of the same finger (GenImg command)
4. Convert the second image into a second temporary Template and
store it in CharBuffer2 (Img2Tz command)
5. Generate a final Template based on averaging the two temporary
templates (RegModel command)
6. Store the final Template in one of 200 Template slots
(Store command)
Summary
I really hope that you’ll be able to get the project up and
running to this point. It is a fantastic example of how
software is used to control hardware. Remember that there
are just six cables between the PicoMite and the R503, so
there isn’t much that can go wrong with the build. And with
correctly written software, a really complex process can be
performed – in this case, a biometric sensor capturing an
image of a finger, and converting it into a digital template
for cross referencing. As always, if you run into any issues,
then please do get in touch!
Next Time
In Part 3, we will put all the steps performed manually
above for the enrolment process into an easy-to-use program,
along with the ability to store a description (ie, a person’s
name) against each fingerprint template. Likewise, use
the search functionality so that it is possible to detect
and read a fingerprint, and then search for it against all
stored fingerprint templates. Once this is done, we can
then create a standalone fingerprint reader, complete with
its own touchscreen display.
Until then, stay safe, and have FUN!
Fig.10. The Search command will look for a match between the current
temporary Template (here in CharBuffer1) with all those stored in Questions? Please email Phil at:
the template library. Any match found will be shown with a Command [email protected]
execution complete; along with the slot ID in RxPacket(3).
ELECTRONI CS
£8.99
SERIES
FOR
THE TEACH-IN
8
This CD-ROM version of the exciting and popular Teach-In 8 series INTRODUCING THE ARDUINO
• Hardware – learn about components and circuits
• Programming – powerful integrated development system
has been designed for electronics enthusiasts who want to get to • Microcontrollers – understand control operations
• Communications – connect to PCs and other Arduinos
SOFTWARE
The CD-ROM contains the software for both the Teach-In 8 and PICkit 3 series.
Station Road
Cullercoats Visit our Shop, Call or Buy online at:
North Shields
Tyne & Wear
www.cricklewoodelectronics.com
NE30 4PQ Visit our shop at:
Tel: 0191 2514363 [email protected] www.esr.co.uk 020 8452 0161 40-42 Cricklewood Broadway
London NW2 3ET
T
his month, we continue our Fig.1. This model is convenient to use for limit(x,y,z) function, to limit the
series on electronically controlled exploring general circuit behaviour rather minimum resistance to some very small
resistance by looking at the use of than attempting to simulate specific devices value (eg, 1mΩ) and the maximum to
digipots in circuits such as variable gain – for example, the input is just a control the RAB value (Rdigipot). An LTspice
amplifiers. As discussed in the last couple voltage, not a digital code, but this makes schematic using this approach is shown
of articles, digipots are either potentiome- the schematic smaller and simulations easier in Fig.2 – this is not a full simulation
ters or simple variable resistors (rheostats) to set up (only one control signal is needed, schematic – refer to last month for an
whose value (wiper position or resistor rather than multiple digital bits). The model example. The behavioural voltage source
value respectively) can be controlled by uses a behavioural voltage source and (B1) is used to create a stepped waveform
a digital control input. They can replace behavioural resistances, where the voltage on node N, starting at 0V at time 0 and
mechanical potentiometers and trimmers of a source (BV element), or resistance of a stepping every step-time (stept parameter)
in many applications. Most commonly, resistor (R element, as in a standard resistor) by 1/(number of steps) (nsteps parameter)
the digital control is via a standard micro- can be set by a mathematical expression. until a maximum of 1 is reached. This
processor interface, such as SPI, but other In general, a digipot can be modelled as takes the digipot through its full range if
simpler interfaces are available, for example two resistors RA and RB such that the total the simulation is run for an appropriate
to facilitate use of up/down pushbuttons. resistance RA + RB = RAB, where RAB is the time (nsteps × stept or longer).
Two months ago, we introduced ‘digipots’, resistance between the terminals A and B,
describing the basics of their operation, the specified resistance of the digipot (see Potentiometer formulae
structure and key characteristics, and Fig.1). The relative values Electronically
of RA and R controlled
Fig.3 resistance
shows the – Part 6
digipot from Fig.1 used
B
illustrating this with some example devices. depend on the wiperElectronically controlled resistance – Part 6
position. If we define as a grounded potentiometer. Using the
A digipot circuit is typically a resistor the wiper position as a value N, where N potential divider formula for vout we get:
ladder (series chain of resistors) connected = 0 with the wiper at B and N = 1 with the 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$
to an array of switches, one on each ‘tap’ wiper at A then we can write RA = (1 – N) 𝑣𝑣!"# = 𝑣𝑣&' = 𝑣𝑣&'
𝑅𝑅 + 𝑅𝑅 (1
𝑁𝑁𝑅𝑅%$ %$ + 𝑁𝑁𝑅𝑅%$
− 𝑁𝑁)𝑅𝑅
on the resistor chain. One switch is on to RAB and RB = NRAB. For a digipot with𝑣𝑣S = 𝑅𝑅$ 𝑣𝑣 = % $
𝑣𝑣
!"# &'
set the wiper position of the potentiometer, (strictly S + 1) wiper settings, we control 𝑅𝑅% +R𝑅𝑅
The AB
(1 − 𝑁𝑁)𝑅𝑅
$ terms cancel %$ +
in the 𝑁𝑁𝑅𝑅%$ &'leaving
division,
or variable resistor value. Last month, we N by applying a digital word D which can the two instances of N to cancel in the
focused on approaches to simulating generic range from 0 to S, thus N = S/D. denominator, so we𝑁𝑁get a simple expression:
digipots in LTspice, and discussed non-ideal Last month, we introduced an LTspice 𝑣𝑣!"# = 𝑣𝑣&' = 𝑁𝑁𝑣𝑣&'
𝑁𝑁(1 − 𝑁𝑁) + 𝑁𝑁
characteristics, particularly wiper resistance model for a digipot based on Fig.1 and 𝑣𝑣!"# = 𝑣𝑣 = 𝑁𝑁𝑣𝑣&'
(1 − 𝑁𝑁) + 𝑁𝑁 &'
and resistance variation (tolerance). using a voltage node (V(N)), which can
vary from 0 to 1V to represent N. We used This is important because the output does
Digipot model two behavioural resistors with values set by not depend (1 − 𝑁𝑁)𝑅𝑅
𝑅𝑅%on RAB. As discussed last
%$ month,
𝑣𝑣!"# = 𝑣𝑣$ = 𝑣𝑣$
We will use one of these simulation expressions based on RA = (1 – N)RAB and the 𝑅𝑅
total
𝑅𝑅% % + 𝑅𝑅
resistance
$ 𝑁𝑁𝑅𝑅
of + (1
digipots
(1 − 𝑁𝑁)𝑅𝑅
%$ − 𝑁𝑁)𝑅𝑅
can%$vary
%$
models again this month in the context RB = NRAB to implement a potentiometer. 𝑣𝑣!"# =significantly 𝑣𝑣 = between individual devices 𝑣𝑣 (eg,
𝑅𝑅% + 𝑅𝑅$ $ 𝑁𝑁𝑅𝑅%$ + (1 − 𝑁𝑁)𝑅𝑅%$ $
of variable-gain amplifier circuits using However, because the behavioural resistor 20% in some cases), but the resistors in the
digipots – specifically, the abstract model value must not be set to zero, and ideally ladder are much more accurately matched
based on a simple potentiometer shown in not become negative, we can use the LTspice to one another. 𝑁𝑁𝑣𝑣% + (1 − circuits
𝑣𝑣!"# = Therefore, 𝑁𝑁)𝑣𝑣$ which
𝑣𝑣!"# = 𝑁𝑁𝑣𝑣% + (1 − 𝑁𝑁)𝑣𝑣$
A
𝑣𝑣!"# 𝑅𝑅(
RA (1 – N)RAB =−
𝑣𝑣!"# 𝑣𝑣&'𝑅𝑅 𝑅𝑅)
(
W Wiper =−
𝑣𝑣&' 𝑅𝑅)
RB NRAB
𝑣𝑣!"# 𝑅𝑅(
B =1+
𝑣𝑣!"# 𝑣𝑣&' 𝑅𝑅 𝑅𝑅*
(
=1+
Fig.1. Basic digipot 𝑣𝑣&' 𝑅𝑅*
model. N is wiper
position from N = 0 at B 𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 𝑁𝑁
to N = 1 at A. =− =− =−
𝑣𝑣!"# 𝑣𝑣&'𝑅𝑅 𝑅𝑅% 𝑁𝑁𝑅𝑅 (1 − 𝑁𝑁)𝑅𝑅%$ 𝑁𝑁 (1 − 𝑁𝑁)
$ %$
=− =− =−
(1 − 𝑁𝑁)𝑅𝑅%$
Fig.2. Using LTspice behavioural resistors to model a digipot.𝑣𝑣&' 𝑅𝑅% (1 − 𝑁𝑁)
56 𝑣𝑣!"#
Practical Electronics | 𝐷𝐷February | 2023
=−
𝑣𝑣!"# 𝑣𝑣&' 𝐷𝐷 (𝑆𝑆 − 𝐷𝐷)
=−
Electronically controlled resistance – Part 6
𝑣𝑣!"# = 𝑁𝑁𝑣𝑣% + (1 − 𝑁𝑁)𝑣𝑣$ 𝑣𝑣!"# = 𝑁𝑁𝑣𝑣% + (1 − 𝑁𝑁)𝑣𝑣$
B 𝑣𝑣𝑁𝑁!"# 𝑅𝑅( RG
VB B
𝑣𝑣!"# = = 1𝑣𝑣&'+ = 𝑁𝑁𝑣𝑣&'
(1 − 𝑁𝑁) 𝑣𝑣&'+ 𝑁𝑁 𝑅𝑅*
𝑅𝑅% (1 − 𝑁𝑁)𝑅𝑅%$
𝑣𝑣
Fig.4. Non-grounded 𝑣𝑣
𝑅𝑅
!"# = Here, 𝑁𝑁𝑅𝑅
R 𝑣𝑣
is = feedback
$ the 𝑁𝑁 resistor and 𝑣𝑣 𝑣𝑣 𝑅𝑅 𝑁𝑁𝑅𝑅%$ 𝑁𝑁
!"#
=−
$
=− 𝑅𝑅% + 𝑅𝑅$ F%$
𝑁𝑁𝑅𝑅−%$ + (1 −
= 𝑁𝑁)𝑅𝑅%$ $ !"# = − $ = − =−
Fig.3. Grounded potential potential divider𝑣𝑣&' using% 𝑅𝑅 R G
(1
is −
the𝑁𝑁)𝑅𝑅
grounded
%$ (1 − 𝑁𝑁)
resistor (see 𝑣𝑣
Fig.6). &' 𝑅𝑅% (1 − 𝑁𝑁)𝑅𝑅 %$ (1 − 𝑁𝑁)
Fig.6. Op amp non-inverting amplifier.
divider using a digipot. a digipot. 𝑣𝑣!"# 𝑅𝑅 𝑅𝑅$ From 𝑁𝑁𝑅𝑅 Fig.5 and Fig.6𝑁𝑁 we see that
(1 − %$𝑁𝑁)𝑅𝑅%$
𝑣𝑣!"# =𝑣𝑣 = − 𝑅𝑅𝑣𝑣$=for =− both circuits= − gain
%
(1 − 𝑁𝑁)𝑅𝑅 the (1 𝑣𝑣−$ 𝑁𝑁)
is set by two have a value of a few picofarads. It is only
𝑅𝑅 + 𝑅𝑅$
&' % (1
𝑁𝑁𝑅𝑅%$ + − 𝑁𝑁)𝑅𝑅%$
%$
depend only on functions related to the% resistors 𝑣𝑣connected
!"# = 𝑁𝑁𝑣𝑣% + in(1series
− 𝑁𝑁)𝑣𝑣and$ that the shown here, but may be required in any
𝑣𝑣 𝐷𝐷
ratio RA to RB, and not directly on RAB, suffer gain !"#is set= by− the ratio of the resistor values. of the𝑣𝑣circuits
!"# 𝐷𝐷
= − discussed in this article.
much less due to variation of individual 𝑣𝑣&'
The resistor (𝑆𝑆 − 𝐷𝐷)
configuration matches that of 𝑣𝑣 (𝑆𝑆
If we&'switch the − 𝐷𝐷) digipot A and B
digipots. As we will discuss later, this is 𝑣𝑣 a = 𝑣𝑣!"# + (1
digipot,
𝑁𝑁𝑣𝑣 and the 𝐷𝐷 ratio-based formulae terminals around (for the circuit in Fig.7)
!"# % = − −𝑣𝑣𝑁𝑁)𝑣𝑣$ 𝑅𝑅(a digipot without
relevant to how digipots are used in circuits indicate 𝑣𝑣&' that we (𝑆𝑆 − 𝐷𝐷)
could
!"#
=− use we get a different formula for gain:
such as variable gain amplifiers, particularly the gain being 𝑣𝑣&'
dependent 𝑅𝑅) on the absolute
𝑣𝑣!"# (1 − 𝑁𝑁) (𝑆𝑆 − 𝐷𝐷) 𝑣𝑣!"# (1 − 𝑁𝑁) (𝑆𝑆 − 𝐷𝐷)
if reasonable accuracy is required without = − of the R=
value AB− resistance. =− =−
𝑣𝑣&' 𝑁𝑁 𝐷𝐷 𝑣𝑣&' 𝑁𝑁 𝐷𝐷
the need for software calibration. 𝑣𝑣!"# 𝑅𝑅(
Fig.4 shows a non-grounded potentiometer !"# 𝑣𝑣 Inverting =
(1 −− 𝑁𝑁)
amplifier (𝑆𝑆 − 𝐷𝐷)
using a However, this does not change the basic
=𝑣𝑣&'
− 𝑅𝑅 )𝑣𝑣 = −
!"# 𝑅𝑅(
with voltages applied at both ends (vA and 𝑣𝑣&' single digipot 𝑁𝑁 = 1 𝐷𝐷+ behaviour of the circuit – it just reverses
vB). This is more complex to deal with than Comparing Fig.5 𝑣𝑣&' and Fig.7 𝑅𝑅* we see R = R the order of the D-to-gain relationship.
F B
the grounded case. We use the circuit theory and RI = RA so the gain for the inverting The circuit produces exactly the same
cally controlled resistance
principle – Part 6
of superposition. This states that 𝑣𝑣!"#
amplifier using𝑅𝑅( the digipot is: set of possible gain values, but with D
=1+
for a linear circuit we can set all sources 𝑣𝑣&' 𝑅𝑅* less than S/2 amplifying, and D greater
𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 𝑁𝑁
except for one to zero, calculate the output =− =− =− than S/2 attenuating. At D = S/2 the gain
olled resistance – Part 6 one source, then repeat for 𝑣𝑣&' 𝑅𝑅% (1 − 𝑁𝑁)𝑅𝑅%$ (1 − 𝑁𝑁)
for just that is –1, and at D = 1 the gain is –(S – 1).
each source 𝑅𝑅$ in turn, and finally 𝑁𝑁𝑅𝑅%$add up the which confirms that the gain does not
𝑣𝑣!"# = 𝑣𝑣&' = 𝑣𝑣&' 𝑅𝑅
𝑣𝑣circuit 𝑁𝑁𝑅𝑅 𝑁𝑁
individual 𝑅𝑅% + 𝑅𝑅 contributions.(1 − 𝑁𝑁)𝑅𝑅 For + 𝑁𝑁𝑅𝑅
%$ the !"#
%$ = − $depend on%$RAB.=We Non-inverting amplifier using a
$ =− − can also write this
in Fig.4, if we set = 0 we have the 𝑣𝑣 &'
same 𝑅𝑅 (1 −
%formula in terms 𝑁𝑁)𝑅𝑅 %$ of (1
the − 𝑁𝑁)
number of wiper single digipot
𝑅𝑅$ v
𝑁𝑁𝑅𝑅
B
%$
𝑣𝑣!"# 𝐷𝐷
𝑣𝑣!"# = situation 𝑣𝑣&' =as in Fig.3 with vin 𝑣𝑣=&'vA, so the steps (S) and = − input value (D) using
digital Comparing Fig.6 and Fig.8 we see RF = RB
𝑅𝑅% + 𝑅𝑅$ (1 − 𝑁𝑁)𝑅𝑅%$ + 𝑁𝑁𝑅𝑅%$ 𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷)
contribution to vout is NvA. For vA = 0 we wiper position N = S/D: and RG = RA, so the gain for the inverting
𝑁𝑁
effectively 𝑣𝑣!"# = have the circuit 𝑣𝑣&' in
= 𝑁𝑁𝑣𝑣
Fig.3
&' with 𝑣𝑣!"# 𝐷𝐷
amplifier using the digipot is:
(1 − 𝑁𝑁) + 𝑁𝑁
the A and B digipot terminals switched =− 𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 1
𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷) =1+ =1+ =
round (A𝑁𝑁is grounded, B is the input), so 𝑣𝑣!"# (1 − 𝑁𝑁) (𝑆𝑆 − 𝐷𝐷) (1
𝑣𝑣!"#the = potential divider 𝑣𝑣 = 𝑁𝑁𝑣𝑣&' =− =− 𝑣𝑣!"# 𝑅𝑅 𝑣𝑣 &' 𝑅𝑅
𝑁𝑁𝑅𝑅%$
% −1 𝑁𝑁)𝑅𝑅 %$ (1 − 𝑁𝑁)
(1 − 𝑁𝑁) + 𝑁𝑁 &' formula becomes: As the𝑣𝑣wiper &' moves 𝑁𝑁 from B (N 𝐷𝐷 = 0, D==10)+ $ = 1 + =
𝑣𝑣&' 𝑅𝑅 (1 − 𝑁𝑁)𝑅𝑅 (1 − 𝑁𝑁)
𝑅𝑅% (1 − 𝑁𝑁)𝑅𝑅%$ to A (N = 1, D = S) the gain (according to % This also confirms %$ that the gain does not
𝑣𝑣!"# = 𝑣𝑣$ = 𝑣𝑣$𝑣𝑣 the(1 formula)
− 𝑁𝑁) changes
(𝑆𝑆 − 𝐷𝐷) from zero to minus depend on R . Just like above, we can
𝑅𝑅% + 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ + (1 − 𝑁𝑁)𝑅𝑅%$ !"# AB
=infinity,
− =−
although the effective value of also write this𝑣𝑣 formula 𝑆𝑆 using S and D:
𝑣𝑣&' 𝑁𝑁 𝐷𝐷 !"#
=
𝑅𝑅% simplifies
This (1 in− 𝑁𝑁)𝑅𝑅
a similar
%$ way to the RA will never be exactly zero (to give 𝑣𝑣!"# 𝑆𝑆 𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷)
𝑣𝑣!"# = 𝑣𝑣 = 𝑣𝑣$ =
+ 𝑅𝑅$ $ formula
𝑅𝑅%previous 𝑁𝑁𝑅𝑅%$ + to (1 give
− 𝑁𝑁)𝑅𝑅 %$ = (1 – N)vB.
vout infinite gain) due to the resistance of 𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷)
Adding the 𝑣𝑣!"#two
= 𝑁𝑁𝑣𝑣 contributions
% + (1 − 𝑁𝑁)𝑣𝑣$
gives the digipot A terminal. Similarly, the gain
output voltage for the circuit in Fig.4 as: with D = 0 will be non-zero, but there As the wiper moves from B (N = 0, D = 0)
will be significant attenuation. In practice, to A (N = 1, D𝑣𝑣=!"#S)=the 1 gain
=
𝑆𝑆 (according to
𝑣𝑣!"# = 𝑁𝑁𝑣𝑣% + (1 − 𝑁𝑁)𝑣𝑣$ very large gains are likely to cause the op 𝑣𝑣!"# 1 𝑆𝑆 &'
the formulae) 𝑣𝑣
changes 𝑁𝑁 𝐷𝐷
from 1 to infinity
𝑣𝑣!"# 𝑅𝑅( = =
amp output to saturate near the supply (the
𝑣𝑣&' op-amp
𝑁𝑁 𝐷𝐷 will saturate at very large
=−
Again, note that𝑣𝑣&' this does 𝑅𝑅) not depend on voltage (signal clipping). gains). Like the inverting circuit, the
the digipot RAB, only on the wiper position With D = S – 1 we get a gain of –(S – relationship between D and the gain is
𝑣𝑣 𝑅𝑅 𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 𝐷𝐷𝑅𝑅%$
(N). We!"# will=− use(this formula later. 1) (substitute D = S – 1 in the formula non-linear, = the=form of=the relationship
but
𝑣𝑣&' 𝑅𝑅) 𝑣𝑣!"# is𝑅𝑅different 𝑣𝑣%$
𝑁𝑁𝑅𝑅 &' 𝑅𝑅) %$ 𝑅𝑅)
𝐷𝐷𝑅𝑅 𝑆𝑆𝑅𝑅)
above), which may be very large for =
$
= –
= it is not simply a positive-
Op amp amplifiers 𝑣𝑣!"# 𝑅𝑅( digipots with a large numbers of steps𝑣𝑣&' gain 𝑅𝑅) version 𝑅𝑅) of the 𝑆𝑆𝑅𝑅)same behaviour. Unlike
=1+
Fig.5 and Fig.6 𝑣𝑣&'show the 𝑅𝑅* schematics of (eg, S = 1024). With D = S/2 (at N = 0.5)
the well-known
𝑣𝑣!"# 𝑅𝑅(basic op amp amplifier we get unity inverting gain (–1). For D D (wiper position input)
𝑣𝑣+ = −𝐺𝐺𝑣𝑣&'
circuits –=the1 +inverting (Fig.5) and non- less than S/2 the circuit attenuates, and
𝑣𝑣&' 𝑅𝑅* 𝑣𝑣+ = −𝐺𝐺𝑣𝑣&'
Digipot
inverting (Fig.6) configurations. The gain for D greater than S/2 it amplifies. The
𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 𝑁𝑁 RA
W
RB
of the=inverting − = −amplifier is given = − by: variation of gain with D is nonlinear – we Vin
𝑣𝑣&' 𝑅𝑅% (1 − 𝑁𝑁)𝑅𝑅%$ (1 − 𝑁𝑁) A B
will discuss this in more detail later. The 𝑣𝑣!"# = 𝑁𝑁𝑣𝑣&' − (1 − 𝑁𝑁)𝐺𝐺𝑣𝑣&'
𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 𝑁𝑁 rapid increase in gain at larger D values 𝑣𝑣!"# = 𝑁𝑁𝑣𝑣&' − (1 − 𝑁𝑁)𝐺𝐺𝑣𝑣&'
=− =− = − RF means that the choice of specific gain
𝑣𝑣&' 𝑅𝑅% (1 − 𝑁𝑁)𝑅𝑅%$ (1 − 𝑁𝑁) CC
𝑣𝑣!"#
RI 𝐷𝐷 values is limited in this part of the range. –
=− – The capacitor CC shown in Fig.7 is 𝑣𝑣!"# 𝐷𝐷 Vout
Vin 𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷) = 𝑁𝑁(𝐺𝐺 + 1) − 𝐺𝐺+= (𝐺𝐺 + 1) − 𝐺𝐺
Vout a compensation capacitor across 𝑣𝑣!"#the 𝑣𝑣&' 𝐷𝐷 𝑆𝑆
𝑣𝑣!"# 𝐷𝐷 + = 𝑁𝑁(𝐺𝐺 + 1) − 𝐺𝐺 = (𝐺𝐺 + 1) − 𝐺𝐺
feedback resistance that may be required 𝑣𝑣&' 𝑆𝑆
=−
𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷) to overcome instability caused by the
(1 − 𝑁𝑁) effect of the capacitance of the digipot Fig.7. Inverting op amp amplifier with
𝑣𝑣!"# (𝑆𝑆 − 𝐷𝐷) 𝑣𝑣!"#control. 2𝐷𝐷
Fig.5. Inverting = − op amp = −
amplifier. inputs on the op amp. Typically, it will digipot gain = 2𝑁𝑁 − 1 = −1
𝑣𝑣&' 𝑁𝑁 𝐷𝐷 𝑣𝑣&' 2𝐷𝐷 𝑆𝑆
𝑣𝑣!"#
= 2𝑁𝑁 − 1 = −1
𝑣𝑣!"# (1 − 𝑁𝑁)
Practical (𝑆𝑆 −
| 𝐷𝐷) 𝑣𝑣&' 𝑆𝑆
= − Electronics
=− February | 2023 57
𝑣𝑣&' 𝑁𝑁 𝐷𝐷
+
Vin
Vout
–
Digipot
RA RB
A W B
the digipot, or𝑆𝑆a combination of series resistors using an IC with more 𝑣𝑣!"#than non-grounded 𝐷𝐷 potential divider given
𝑣𝑣!"# = 𝑁𝑁(𝐺𝐺 + 1) − 𝐺𝐺 = (𝐺𝐺 𝑣𝑣+ +
= 1)−𝐺𝐺𝑣𝑣
− &'
𝐺𝐺
and parallel = resistors. 𝑣𝑣&'
one digipot on chip. Digipot resistors above we 𝑆𝑆get:
𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷)
Another solution to the linearity issue on the same chip are well matched, so
𝑣𝑣!"# = 𝑁𝑁𝑣𝑣&' − (1 − 𝑁𝑁)𝐺𝐺𝑣𝑣&'
is to use the digipot for one of the gain although the device-to-device variation
setting resistors, with a fixed resistor for may be large, the ratio of two rheostat- From𝑣𝑣which we obtain the following
!"# = 𝑁𝑁𝑣𝑣&' − (1 − 𝑁𝑁)𝐺𝐺𝑣𝑣&'
𝑣𝑣!"# formula 2𝐷𝐷gain in terms of N, or D and
𝑣𝑣!"#An1example
the other. 𝑆𝑆 is shown in Fig.14 mode digipots on the same chip will = 2𝑁𝑁 − 1 = for −1
= = 𝑣𝑣&' S (using N 𝑆𝑆= D/S):
𝑣𝑣&' the𝑁𝑁digipot
– this uses 𝐷𝐷 in rheostat mode as be accurate (for example, typically less 𝑣𝑣!"# 𝐷𝐷
the RF resistor in an inverting amplifier, than 1% error). The disadvantage of this𝑣𝑣 = 𝑁𝑁(𝐺𝐺 + 1) − 𝐺𝐺 = 𝑆𝑆 (𝐺𝐺 + 1) − 𝐺𝐺
&'
with a fixed RI resistor. The gain is: approach is that it requires two digipots 𝑣𝑣!"# 𝐷𝐷
= 𝑁𝑁(𝐺𝐺 + 1) − 𝐺𝐺 = (𝐺𝐺 + 1) − 𝐺𝐺
to control one amplifier, increasing cost 𝑣𝑣&' 𝑆𝑆
𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 𝐷𝐷𝑅𝑅%$ and complexity.
= = =
𝑣𝑣&' 𝑅𝑅) 𝑅𝑅) 𝑆𝑆𝑅𝑅) 𝑣𝑣!"# From 2𝐷𝐷 this we see the gain
= 2𝑁𝑁 − 1 = −1
𝑣𝑣&' 𝑆𝑆
is linearly dependent on N
D (wiper position input) 𝑣𝑣!"# 2𝐷𝐷
(or D)
= 2𝑁𝑁 − 1 = and does
− 1not depend
D (wiper position input)
Digipot 𝑣𝑣&' on the digipot 𝑆𝑆 R resistance,
AB
𝑣𝑣+ = −𝐺𝐺𝑣𝑣 &'
Digipot
RI RA RB so this circuit can provide
W
R2 RA
W
RB R1 Vin accurate linear gain control.
A B
Vin Unlike the previous circuits
A B
𝑣𝑣!"#
Practical 2𝐷𝐷 | February | 2023
Electronics 59
= 2𝑁𝑁 − 1 = −1
𝑣𝑣&' 𝑆𝑆
𝑣𝑣!"# 𝑆𝑆
=
𝑣𝑣&' (𝑆𝑆 − 𝐷𝐷)
This arrangement provides the most
symmetrical control of inverting and non-
– inverting gains with a range of –1 to +1. By
𝑣𝑣!"# 1 𝑆𝑆 A2 Voutb using a standard non-inverting amplifier,
= =
𝑣𝑣&' 𝑁𝑁 𝐷𝐷 + with gain A, in place of the buffer (A2
Vout
Digipot
in Fig.15) the gain of the circuit can be
RA RB controlled over any reasonable range of –A
A W B
to +A. On the other hand, RF and RI do not
𝑣𝑣!"# 𝑅𝑅$ 𝑁𝑁𝑅𝑅%$ 𝐷𝐷𝑅𝑅%$ have to be fixed resistors – another digipot
= = =
𝑣𝑣&' 𝑅𝑅) D (wiper
𝑅𝑅) 𝑆𝑆𝑅𝑅) could be used here (as in Fig.7) to provide www. poscope. com/ epe
position input) RF
a wider range of possible gain settings.
RI Fig.16 shows an LTspice schematic
Vin – based on the circuit in Fig.15. The buffer
𝑣𝑣+ = −𝐺𝐺𝑣𝑣&' A1 VX
is not included as we are just measuring
+
the output and there is no loading or
wiper resistance present in this model.
𝑣𝑣!"# = 𝑁𝑁𝑣𝑣&' − (1 − 𝑁𝑁)𝐺𝐺𝑣𝑣&' The results are shown in Fig.17 and
confirm the linear variation of gain from
Fig.15. Linear gain control using a digipot –1 to +1 as N ranges from 0 to 1.
in potentiometer mode.
𝑣𝑣!"# 𝐷𝐷
= 𝑁𝑁(𝐺𝐺 + 1) − 𝐺𝐺 = (𝐺𝐺 + 1) − 𝐺𝐺 Simulation files
𝑣𝑣&' If we use equal 𝑆𝑆resistors for RF and RI
then G = 1, so the gain formulae for Fig.15 Most, but not every month, LTSpice
simplifies to: is used to support descriptions and
analysis in Circuit Surgery.
𝑣𝑣!"# 2𝐷𝐷 The examples and files are available
= 2𝑁𝑁 − 1 = −1
𝑣𝑣&' 𝑆𝑆 for download from the PE website.
- USB - PWM
- Ethernet - Encoders
- Web server - LCD
- Modbus - Analog inputs
- CNC (Mach3/ 4) - Compact PLC
- IO
- up to 256 - up to 32
microsteps microsteps
Fig.16. LTspice simulation schematic for circuit in Fig.15. - 50 V / 6 A - 30 V / 2. 5 A
- USB configuration
- Isolated
PoScope Mega1+
PoScope Mega50
- up to 50MS/ s
- resolution up to 12bit
- Lowest power consumption
- Smallest and lightest
- 7 in 1: Oscilloscope, FFT, X/ Y,
Recorder, Logic Analyzer, Protocol
decoder, Signal generator
Fig.17. Simulation results for the circuit in Fig.16.
I
don’t know about you, but I’m an exhaustive list. You should use your illuminate), its anode (a) terminal must
really excited to be writing this series logbook to keep track of anything that be at a higher (more positive) potential
of Arduino Bootcamp columns. The might conceivably be of use in the future. than its cathode (k) terminal. (In the
only problem is that I have so many For example, algorithms, equations and case of an individually packaged LED,
thoughts bouncing around in my poor formulas (eg, calculating the value of an the cathode terminal is the shorter lead
old noggin that I don’t know where to LED’s current-limiting resistor), suppliers located on the flat side of the package.)
start. I’ll tell you what, let’s kick off by and part numbers (and prices) of com- By comparison, resistors are non-polar-
lighting up some more LEDs because ponents, experiments you may wish to ised, which means we can happily con-
doing so rarely fails to delight, but first... perform and projects you may want to nect them either way round.
build in the future… the list goes on. In my previous column (PE, Janu-
Captain’s log ary 2023), when we came to set up our
I meant to make mention of this before, Is it ‘a LED’ or ‘an LED’? breadboard, we located our current-lim-
but I was so excited by the thought of a When I pen my columns, I usually say iting resistor between the LED’s anode
flashing LED that it went clean out of my ‘a LED.’ Later, however, when I come to and the 5V rail (Fig.1a). Had we wished,
mind. Engineers (the good ones) always check the final laid-out piece, I find that however, we could have placed this re-
keep a logbook in which they record PE’s editor and publisher, the nefarious sistor between the LED’s cathode and
items like ideas, decisions, settings and illustrious Matt Pulzer, has replaced these the GND (0V) rail (Fig.1b). Either way,
results, to name but a few. instances with ‘an LED.’ the LED would turn on and light up. (If
In the case of decisions, for example, Which of us is in the right? Well, as your LED is too bright, you can increase
if you can think of three ways to do fate would have it, both styles are cor- the value of your current-limiting resis-
something, make brief notes describ- rect. It all depends on whether the writer tor, which will decrease the current and
ing those techniques (or just list them (or speaker) is thinking ‘LED’ to rhyme dim the LED.)
if they are well known to you). Also, in with ‘bed,’ in which case ‘a LED’ is the You may wonder why I’m taking the
addition to recording the approach you appropriate usage, or if we are thinking of time to waffle on about this here. All will
decided to use and why you opted for it as being spelled out as ‘L-E-D’ (which become clear in the fullness of time when
this choice, note your reasons for not sounds like ‘ell-ee-dee’), in which case we start to talk about ‘common-anode’
using the other options. ‘an LED’ is the way to go. and ‘common-cathode’ devices contain-
With respect to settings, one example ing multiple LEDs.
is my laser cutter and engraver. When Who’s on top?
I’m experimenting with new materi- Are you, like me, thinking of the classic 7-segment displays
als and different head speeds and laser ‘Who’s on first?’ comedy routine made The first light-emitting diodes (LEDs) to
power values, I note down what works famous by American comedy duo Abbott display in the visible spectrum appeared
(and what doesn’t) for future reference. and Costello? Well, this is nothing to do on the scene in 1962. At that time, you
When it comes to experiments, in ad- with that. could have any colour you wanted, just
dition to documenting the test setup (a Remember that LEDs are polarised so long as that colour was red. For the
few sketches and/or photographs never components, which means the way in first few years these devices were horren-
hurts), don’t record only the results which they are connected is important. dously expensive, depleting one’s bank
you were expecting (hoping) to see, For an LED to turn on and conduct (and account by around $200 apiece (Eeek!).
but also keep track
of anything that went
awry. Sometimes,
years later, you’ll 5V 5V
learn something a
new and think, ‘Just
k
a moment, I wonder a
if…’ As Isaac Asimov
k
famously said, ‘The
GND GND
most exciting phrase
to hear in science, the
one that heralds new
From GND From GND
discoveries, is not Arduino 5V Arduino 5V
Eureka! (I found it!)
(a) Resistor on LED’s anode (b) Resistor on LED’s cathode
but, ‘That’s funny…’
The points I just
mentioned don’t form Fig.1. It doesn’t matter ‘who’s on top.’ Fig.2. 7-segment display.
As we see, the segments are arranged in dimmer segments. The result is that the A B C D E F G DP
as a rectangle formed from two vertical brightness of the characters will depend
segments on each side accompanied by on the number of segments used to form
GND
one horizontal segment on the top, in the them. The number 1 (which is formed by
middle and at the bottom. In the physical lighting two segments), for example, will 3,8
device, this rectangle is often presented be brighter than the number 8 (which GND
AREF
13
12
~11
~10
~9
8
7
~6
~5
4
~3
2
TX-1
RX-0
GND
to being fun in its own right – the result DIGITAL IN/OUT (PWM ~)
Fig.5. Wiring up the breadboard.
of this testing means we now have a high
calculated as (5V – 2V) / 0.02A = 150Ω. level of confidence that our hardware works
This value of resistor will have brown- as expected. In turn, this means we can Fig.6. Connecting the Arduino.
green-brown colour bands. devote our full attention to the software. and 0 on the Uno circuit board; TX =
Add eight of these resistors to the eight Transmit and RX = Receive.) When we
pins on the display that are connected Preparing to use the Arduino upload programs from our host computer
to the A through G and DP segments, Unplug the USB cable from your Ar- to the Arduino, for example, the system
as illustrated in Fig.5. Earlier, we noted duino, remove the flying lead from the uses these pins to do the job.
that resistors are non-polarised, which breadboard and add eight jumper wires Now, plug your USB cable back into
means we can happily connect them to connect the display to the Uno, as il- your Uno. As you may recall, our final
either way round, so why have I shown lustrated in Fig.6. I’ve shown these jump- program in Part 1 of this series flashed
them all connected in the same way in ers as all being orange in this diagram an LED connected to digital I/O pin 6. If
this figure (and why do I do the same on for simplicity. In the real world, with my this program is still loaded in your Uno,
my breadboard in the real world)? One own setup, I used two groups of purple, you should see segment D flashing on
reason is that I find this to be aestheti- orange, yellow and blue wires because your 7-segment display.
cally pleasing. (Also, like many engi- this makes it a lot easier to check what’s I’m sorry, I need a moment… flashing
neers, I have a hint of a sniff of a whiff connected to what (and what isn’t) if LED… man drooling… and I’m back.
of the obsessive-compulsive about me!) things don’t work as expected. In our very first program in Part 1, we
We’re almost there, plug one end of a The reason we are using digital I/O explicitly specified the number of the
red jumper wire into the 5V power rail pins 2 to 9 on the Uno (as opposed to digital I/O pin we wanted to use when
and leave the other end as a flying lead, pins 0 through 7) is that, even though we called the pinMode() and digi-
as shown in Fig.5. Now power up your we always say this microcontroller has talWrite() functions. Later, we used
Arduino and make sure the green LED 14 digital pins numbered from 0 to 13, a #define preprocessor directive to as-
on your breadboard is lit, thereby inform- in practice we typically reserve pins 0 sociate a constant label we called PIN_
ing us that power is still making its way and 1 to perform any serial communica- LED with the number 6 (Line 1 in Listing
to the board. Plug the loose end of the tions with our host computer. (Observe 1a). Another technique is to declare the
flying red lead into the hole marked ‘A’ the annotations associated with pins 1 pin we wish to use as being a variable
in Fig.5, and make sure that the A
segment lights up (any hole in this
column will suffice). Repeat this for
all the other segments to confirm
our display is tickety-boo. Now
we’re really ready to rock n’ roll!
Being conventional
Any of our own names and labels that we declare in a C/C++ pro-
gram can contain any mixture of uppercase and lowercase alpha
characters (‘a’ to ‘z’ and ‘A’ to ‘Z’), numeric characters (‘0’ to ‘9’),
and underscore ‘_’ characters (no spaces or other symbols). Also,
they must start with an alphabet character or an underscore char-
acter, not with a number. Listing 2. Using an array of pins.
You will find that your life is a lot easier if you adopt a naming Although simple to understand, this would quickly become
convention and stick to it. This will greatly facilitate your reading a pain because we would be obliged to capture the rest of
and the understanding of your code in the future. If you end up our code in a verbose style. Try writing a program to turn
writing programs for a company, they will detail the convention each segment on and off using these individual variable
they wish you to use. In the case of your own programs, you can declarations and you’ll soon see what I mean. In fact, just
define your own rules. You don’t have to follow my convention, but for giggles and grins, I’ve written this program for you. It
I will say that I’ve evolved it over many years (and many mistakes). came in at 66 lines of code (file CB-Feb23-02.txt).
First, in the case of #define constant labels like PIN_LED, There’s a better way. What we are going to do is create
based on what I’ve seen from my professional programmer friends, an array of integers called PinsSegs[] in which we can
I use only uppercase alpha characters along with numbers and store the numbers of all the pins associated with the seg-
underscores. By comparison, in the case of variable names like ments. Since we know that our display has eight segments
PinLed, I use a typographical convention known as ‘camel case’ (including the decimal point), we could employ the fol-
(sometimes stylised as ‘camelCase’ or ‘CamelCase’), in which lowing declaration:
words are separated by a single capitalised letter, such as Good-
GollyMissMolly, for example. int PinsSegs[8] = {2,3,5,6,7,9,8,4};
Furthermore, I use what’s called ‘upper camel case’ (a.k.a. ‘Pascal
case’ or ‘bumpy case’) with an initial uppercase letter for global However, using a raw numeric literal like 8 in this way with-
variables (like PinLed) that can be seen throughout the program. out any explanation as to its origin and meaning is not a good
By comparison, although this isn’t something we’ve done yet, I idea. Programmers call this sort of thing a ‘magic number’
use ‘lower camel case’ with an initial lowercase letter for local because it’s appeared from nowhere. In addition to making
variables (like myLed) that are declared inside a function and can programs less readable, using magic numbers (other than 0
only be seen within that function. or 1) also makes them more difficult to update and main-
tain. A better solution is shown in Listing 2, in which we
Driving each segment in turn use a #define to declare a constant called NUM_SEGS that
If we return to Fig.6, we see that our display segments are con- we associate with the number 8 (Line 3). We then use this
nected to our Arduino pins as follows: A = 2, B = 3, C = 5, D = definition as part of our integer array declaration (Line 5).
6, E = 7, F = 9, G = 8 and DP = 4. These connections fell out this We will consider this program in a little more detail in a
way because we wanted to make our diagram look pretty, but it’s moment. First, use the Arduino’s IDE to capture this code
resulted in an out-of-order sequence. Happily, this isn’t a prob- and upload it into your Arduino Uno, then sit back and
lem because we can easily resolve things in our code. bask in the joy of watching your display’s segments flash
One thing we could do would be to declare the pins driving on and off in turn following the sequence A, B, C, D, E, F,
each of our segments as individual integer variables, for example: G, DP (file CB-Feb23-03.txt).
What? Homework?
There’s so much more I wanted to talk about in this column,
but I think there’s more than enough here to keep you busy
for a while. What would be useful while we wait for Part 3 is
Our patented range of Plug-of-Nails™ spring-pin cables plug directly
for you to think about what segments we need to activate to into a tiny footprint of pads and locating holes in your PCB, eliminating
represent the digits 0 through 9 (we could create a 1 by light- the need for a mating header. Save Cost & Space on Every PCB!!
ing segments B and C, for example). Solutions for: PIC . dsPIC . ARM . MSP430 . Atmel . Generic JTAG . Altera
Perhaps you could create a table of digits and correspond- Xilinx . BDM . C2000 . SPY-BI-WIRE . SPI / IIC . Altium Mini-HDMI . & More
ing segments. I’m sure I need not mention this (of course, I
will anyway), but this table would be something you could www.PlugOfNails.com
record in your logbook. Until next time, as always, I welcome Tag-Connector footprints as small as 0.02 sq. inch (0.13 sq cm)
your insightful comments, perspicacious questions and saga-
cious suggestions.
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
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.
DECEMBER 2020
Pseudo-Random Sequence Generator ............................. 16106191 £7.95
Clever Charger .................................................................. 14107191 £11.95
PE Theremin Amplifier ....................................................... AO-1220-01 £8.95 For the many pre-2016 PCBs that we stock please see the
NOVEMBER 2020 PE website: www.electronpublishing.com
LED Christmas Tree (1 off) ................................................ 16107181-1 £6.95
LED Christmas Tree (4 off) ................................................ 16107181-2 £14.95
LED Christmas Tree (12 off) .............................................. 16107181-3 £24.95
PE/EPE PCB SERVICE
LED Christmas Tree (20 off) .............................................. 16107181-4 £34.95 Order Code Project Quantity Price
USB/SPI Interface Board ................................................... 16107182 £5.95
45V/8A Power Supply PCB plus acrylic spacer ................. 18111181 £14.95 .........................................................
45V/8A Power Supply front panel five-way display bezel .. 18111181-BZ £3.95
Five-way LCD Panel Meter/Display ................................... 18111182 £7.95 .........................................................
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.
JULY 2017
Micromite-Based Super Clock ........................................... 07102122 £10.45
Brownout Protector for Induction Motors ........................... 10107161 £12.90
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
For rates and further information on display and classified advertising this market for the last
please contact our Advertisement Manager, Matt Pulzer – see below. twenty-seven years.
Unit 10, Boythorpe Business Park, Dock Walk, Chesterfield,
ADVERTISING INDEX
AO SHOP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 61 Advertisement offices
CRICKLEWOOD ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . 55 Matt Pulzer
ESR ELECTRONIC COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . 55
HAMMOND ELECTRONICS Ltd . . . . . . . . . . . . . . . . . . . . . . . . . . 10
Electron Publishing Ltd
JPG ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
1 Buckingham Road
MICROCHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cover (ii)
Brighton
PEAK ELECTRONIC DESIGN. . . . . . . . . . . . . . . . . . . . . . Cover (iv) East Sussex BN1 3RA
POLABS D.O.O.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 60 Tel 07973 518682
QUASAR ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Email [email protected]
SILICON CHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
STEWART OF READING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67 Web www.electronpublishing.com
TAG-CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 67
TERRINGTON COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 For editorial contact details see page 7.
Semaphore Signal
This realistic-looking OO Gauge Semaphore has been modelled on a
real British semaphore. It has a red/white ‘flag’ that tilts down by 45°
and lights a green LED to signal an oncoming train to continue, or is
horizontal with a red light, indicating it should stop.
PLUS!
All your favourite regular columns from Audio Out, Cool Beans and Circuit
Surgery, to Make it with Micromite, Techno Talk and Net Work. On sale 2 February 2023
Content may be subject to change
JPG Electronics
Britannia Maison Mes Amis
Bournemouth BH1 9EH, United Kingdom
Inn
Old Road Remember, we print the date of the last issue
ad
d
Roa
Old H
Cha
tsw
orth
Morrisons
address sheet that comes with your copy.
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.
ulating rgery
d
remie
coding
igipots
Micromite
r electr
PicoMite Fingerprint
Audio
onics a
nd com
puting
ice O u t maker
Driveway Gate Cooling Fan Controller Furt&er
h magaz
Univers circuits for th Ma
ine
Remote Control Loudspeaker Protector a l op am e
p boa
rd
ke it
Multip with Micro
le
for a P displays
mite
WIN! WIN! icoMite
Micro
Microchip
PIC32C chip Remo
Curiosity
t
Range e Control
Development and W X-BZ2
B
Board Curi Z451
Develoosity
WIN! pment Exten
Board der
Fingerprint
ClReader
assi
Metro c LED
LTDZ V5.0 nome
s
budget
Spectrum 35 M H z
Analyser Signa -4.4GHz
Tesla Coil l Gene
rator
Solid-State
M u l ti - Flame
Speak ChanDischarge
n
er Pro el
PLUS!
P tectoFeb
r 2023 £5.99
Techno Talk – Mushroom magic LUS! 02
Te
Cool Beans – Arduino Bootcamp chno Talk –
Cool B Raudiv
Net Work – Alexa update, plus spaceeand
ans energy
– Intro newse voic9 772632 573030
Net W es revis
ducing it
www.electronpublishing.com
ork – S the Ard ed
mart li practicalelectronics
@practicalelec
www.e ght bu uino B
lbs and ootc Jan 20
Alexa’s amp
lectro 23 £5.49
npubli
shing skills
.com 01
@prac 9 772
632 5
ticalele 73023
c
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