Pe 11 2022
Pe 11 2022
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Audio Out Electronic Make it with Micromite
Using JFETs limiters Using audio Building Blocks Adding a PS/2 keyboard and
and compressors transformers Using actuators TFT display to a PicoMite
WIN!
Microchip
AVR-IoT
Cellular Mini
WIN!
Build a
USB Cable Tester PicoMite
computer
Self-Contained 6GHz
Digital Attenuator
PLUS!
Nov 2022 £5.49
Techno Talk – Hidden hazards 11
Cool Beans – Investigating rotary encoders
9 772632 573023
Net Work – Technology and the Queen
www.electronpublishing.com @practicalelec practicalelectronics
Put the “Smart” in Smart Home
Easy Design with the PIC16F18076 Family of MCUs
No matter what you’re building, the PIC16F18076 family of MCUs can help you create faster, more feature-
rich smart home technology. Now, you can easily add capacitive touch buttons, control motors, integrate
IoT connectivity and monitor system health using the family’s on-chip smart peripherals. And, these cost-
effective MCUs integrate seamlessly with our latest GUI-based code configuration tools for a refreshingly
simple development experience. Start building your next smart home appliance today using Curiosity Nano
rapid prototyping hardware.
Key Features
• 8 to 44-pin packages
• 3.5 KB to 28 KB of internal memory
• CPU Speed up to 32 MHz
• 10-bit Analog-to-Digital Converter with Computation (ADCC)
• Automated Capacitive Voltage Divider (CVD)
• 8-bit Digital-to-Analog Converter (DAC) module
Electronics Contents
Projects and Circuits
USB Cable Tester – Part 1 by Tim Blythman 16
Here is an easy way to test all manner of USB cables; this USB Cable Tester is
so handy e thin you ill find it indis ensa le
Pocket Weather Station by Aarav Garg 26
his is an e cellent eginners ro ect that uses five odules to a e so ething
use ul a ini eather station you can carry every here ith you.
Model Railway Carriage Lights by Les Kerr 30
hese odel train carriage lights designed or gauge are attery o ered
and can e s itched on and o ith an e ternal agnet.
Self-Contained 6GHz Digital Attenuator by Jim Rowe 34
his rogra a le odule attenuates signals ro to y to
. d in . d ste s. ontrol is via five s all s itches and a tiny .
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!
Simulating distortion
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Audio Out
Using transformers in
Make it with Micromite
Installing MMBASIC on a Using distortion and
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery KickStart
Exploring DACs and
Make it with Micromite
MMBASIC + RPi Pico + display Mastering electronically
Practical
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Audio Out
Using audio
Make it with Micromite
Small displays and using
Circuit Surgery
JFETs as electronically
Practical
Electronics
The UK’s premier electronics and computing maker magazine
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
01202 087631
and distortion circuits audio electronics Raspberry Pi Pico distortion circuits microcontrollers = PicoMite Backpack! controlled resistance transformers infrared to synchronise time controlled resistors transformers op amps PicoMite systems and compressors transformers Using actuators TFT display to a PicoMite
WIN! WIN!
Microchip WIN! WIN!
Microchip Microchip Microchip WIN!
SAM C21 SAM V71
Xplained Ultra PIC32CM LS60 MPLAB Snap Microchip
Xplained Pro Curiosity Pro In-Circuit
Evaluation Kit Multi-purpose Battery Evaluation Kit
WIN!
Evaluation Kit Debugger AVR-IoT
WIN! WIN! WIN! Cellular Mini
Manager WIN!
Retro gaming
with Nano Pong!
20A DC Motor Speed Controller Build a
Single-Chip Silicon SMD Test PicoMite
Labs FM/AM/SW Adding small Tweezers USB Cable Tester
Intercom using retro computer
Digital Radio Receiver Controlling a displays to
Flowcode the PicoMite analogue phones!
linear actuator Digital Clock Micromite to Pocket Weather Station
Simple Flowcode Design Smartphone
MIDI
C
Bluetooth Link
Toot toot! void interrupt(void)
{ if (intcon & 4)
{
clear_bit(intcon, 2); Assembly
Preamplifier
:040000008A01122837
Preamplifier
EF10000
:10001000040EF2000A0
EF300BA110A122928352
86C
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 £41.99 (Airmail)
1 Year: UK £54.99, Europe £63.99 (Airmail),
Rest of the World £77.99 (Airmail)
2 Years: UK £104.99, Europe £119.99 (Airmail),
SUBSCRIPTION PRICES Rest of the World £149.99 (Airmail)
Subscriptions for delivery direct to any address in: To: Practical Electronics Subscriptions
PO Box 6337
UK: 6-months £29.99, 12-months £54.99, 24-months £104.99 Bournemouth BH1 9EH
Europe Airmail: 6-months £33.99, 12-months £63.99, United Kingdom
24-months £119.99 Tel: 01202 087631
Email: [email protected]
Rest Of The World Airmail: 6-months £41.99, 12-months
£77.99, 24-months £149.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 ustralian dollars ( U ) 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 Cables
Electron Publishing Limited Mob 07973 518682 Some of our projects are just for fun or to support another
1 Buckingham Road Fax 01202 843233
Brighton Email [email protected]
hobby, some projects help you enjoy superb audio quality
East Sussex BN1 3RA Web www.electronpublishing.com which might otherwise be too expensive to access, and some
of our projects are ingenious devices that help you keep your
Advertisement offices electronics show on the road. Our main project this month is
Practical Electronics Adverts Tel 01273 777619
1 Buckingham Road Mob 07973 518682
very much in the latter category.
Brighton Email [email protected]
East Sussex BN1 3RA You can picture the scene; a useful piece of equipment has
Editor Matt Pulzer
failed and resists all efforts to recover. We’ve all been there,
General Manager Louisa Pulzer and sooner or later we start to wonder if the problem is with
Digital subscriptions Stewart Kearn Tel 01202 880299 the actual equipment or just the cable it’s connected to. Perhaps
Online Editor Alan Winstanley there is a replacement in the ever-growing box of cables kept for
Web Systems Kris Thain
Publisher Matt Pulzer just this occasion. But is the old cable any good? Perhaps not…
so what to do? Well, now you can quickly and easily test the
Print subscriptions most common types of cable – the various incarnations of the
Practical Electronics Subscriptions
ubiquitous Universal Serial Bus cable, more commonly known
PO Box 6337
Bournemouth BH1 9EH Tel 01202 087631 as just a ‘USB cable’.
United Kingdom Email [email protected]
So, step forward the USB Cable Tester. It will check just about
Technical enquiries any USB cable: USB-A (2.0/3.2), USB-B (2.0/3.2), USB-C (3.2),
We regret technical enquiries cannot be answered over the
telephone. We are unable to offer any advice on the use, purchase, Micro-B (2.0/3.2) and Mini-B (2.0). It will even report short
re air or odification o co ercial e ui ent or the incor oration circuits, open circuits and other faults.
or odification o designs u lished in the aga ine. e cannot
provide data or answer queries on articles or projects that are
ore than five years old. In electronics, few things can be more frustrating than
troubleshooting, so anything that reduces the pain is truly
Questions about articles or projects should be sent to the editor welcome. This handy device will quickly and efficiently help
by email: [email protected]
you eliminate a common source of problems – thoroughly
Projects and circuits recommended!
All reasonable precautions are taken to ensure that the advice and
data given to readers is reliable. We cannot, however, guarantee Missing pages
it and we cannot accept legal responsibility for it.
We had a production problem last month and a few issues went
A number of projects and circuits published in Practical Electronics out with missing pages. We think we caught most of them before
employ voltages that can be lethal. You should not build, test, distribution, but if one slipped through and you received it then
modify or renovate any item of mains-powered equipment unless
you fully understand the safety aspects involved and you use an
do please let us know and we will of course replace it.
RCD (GFCI) adaptor.
PCBs
Component supplies We’ve had some PCB shortages recently but have now restocked,
We do not supply electronic components or kits for building the
projects featured, these can be supplied by advertisers. We and the online shop is fully up to date, especially with recent
advise readers to check that all parts are still available before boards. So, as the nights draw in, now is the perfect opportunity
commencing any project in a back-dated issue. to start planning some autumn and winter projects.
Advertisements
Although the proprietors and staff of Practical Electronics take Matt Pulzer
reasonable precautions to protect the interests of readers by Publisher
ensuring as ar as ractica le that advertise ents are ona fide
the magazine and its publishers cannot give any undertakings
in respect of statements or claims made by advertisers, whether
these advertisements are printed as part of the magazine, or in
inserts. The Publishers regret that under no circumstances will
the magazine accept liability for non-receipt of goods ordered, or
for late delivery, or for faults in manufacture.
Transmitters/bugs/telephone equipment
We advise readers that certain items of radio transmitting and
telephone equipment which may be advertised in our pages
cannot be legally used in the UK. Readers should check the law
e ore uying any trans itting or tele hone e ui ent as a fine
confiscation o e ui ent and or i rison ent can result ro
illegal use or ownership. The laws vary from country to country;
readers should check local laws.
A number of the substances (mainly fluids) that we use in our workshop for constructing new projects,
or refurbishing old test equipment and other appliances, are dangerous – in fact, potentially toxic or
even carcinogenic. Harmful either to ourselves or to the equipment. Carry on reading if you want to
know the risks you may be taking.
E
lectricity is not the only buy a cheap bench-top extractor fan on- sense whenever using WD-40 Company
hazard that lurks in the work- line that disperses the fumes to the far products.’ Too jolly well right!
shop. It’s funny (but only in an side of the room. But is soldering really WD-40 is a product to use with great
ironic kind of way) how many of the so harmful? It can be, yes. Soldering care. The version sold in aerosol cans
things we used to do are now consid- with lead (which many of us still do) is 90% flammable liquids and gas plus
ered highly dangerous. When I was a can produce dust and fumes that are 10% of a proprietary corrosion inhibi-
student, ‘Trike’ (trichloroethylene) had hazardous. In addition, using flux con- tor. Its original purpose was only as a
only just replaced good old ‘Carbon taining resin or colophony produces water-displacing compound (that’s what
Tet’ (carbon tetrachloride) as the go-to solder fumes that, if inhaled, can re- the ‘WD’ in the name stands for). The
solvent that would get the muck out of sult in occupational asthma or worsen kerosene in it gives it a low surface ten-
everything. Now it’s taboo. It was only existing asthmatic conditions; as well sion, which allows it to penetrate small
recently that DIY shop paint and var- as causing eye and upper respiratory cracks and crevices. Once this kerosene
nish removers contained methylene tract irritation. has evaporated, the oil is left with a
dichloride (alias dichloromethane or Another commonplace irritant is little corrosion inhibitor. Although the
DCM), which is now listed as a Class the liquid solvent used for chemi- oil has some limited lubricating prop-
Three carcinogen ‘with the possible cally ‘welding’ acrylic sheet to make erties, it also acts as an insulator and
risk of irreversible side effects’. As well cases for test gear and other projects. does nothing to clean oxidised switch
as leading to nausea and drowsiness, Plasweld is one of the brand names contacts. WD-40 does indeed protect a
it is a powerful skin irritant, meaning and it goes also by the name of methyl surface from corrosion and oxidation,
that you had to wear rubber gloves ethyl ketone (MEK) and butanone. It but it achieves this by physically cov-
and ensure good air ventilation when works like a treat, which is why it is ering it. And like all paraffinic oils, it
using these stripper products. Unlike also used to weld PVC electrical con- reacts slowly with oxygen in the air to
cats, we get only one life, so we have duit pipes. Industrial uses include cross-link and polymerise, producing
to use safer methods these days. degreasing oils and lubricants, also the well-known ‘gummy mess’.
to clean up certain adhesives, lacquer It is important to be aware that WD-
Cleaning materials and polishes and latex paints. You must, however, 40 is not plastic-friendly. Until recently,
Some household products are more provide good ventilation. As well as the company’s own website warned
harmful to our treasured equipment being a fire risk (highly flammable), that it attacks polycarbonate and clear
than to us human beings! For exam- MEK irritates the skin, causes dizziness, polystyrene plastic, but now gives only
ple, combined cleaning and polishing light-headedness, headache, nausea, a short list of plastics on which WD-
liquids containing silicone or solvents blurred vision, and may cause you to 40 is safe to use. On the Web there are
can be hazardous to certain plastics. pass out. Repeated high exposure can many reports of it causing other plas-
They can cause ‘stress corrosion crack- damage the nervous system and may tic materials to crack or crumble. As
ing’ in some thermoplastic materials. affect the brain. It’s not just us that it the action is not immediate, the effects
Armor-All (sold at Halfords and Wilko attacks – MEK will also degrade and are seen not seen until the damage has
for instance) is a form of silicone oil discolour most plastics, especially if already been done.
dissolved in a mixture of solvents. It exposed for a long period of time.
is fine for use on polyvinyl chloride PCBs warning
(PVC) but can cause problems with More traps for the unwary No, not ‘printed circuit boards’ but
ABS (acrylonitrile butadiene styrene, Many people swear by WD-40, ad- polychlorinated biphenyls, which are
a common thermoplastic polymer) vertised as ‘the can with thousands highly carcinogenic chemical com-
used in some radios, test gear and of uses: a penetrating oil, lubricant, pounds formerly used in industrial
telephones. For refreshing clear plas- cleaner, degreaser or solution to pro- and consumer products. You are very
tic dials and meter faces you are safer tect against or remove rust’. But read unlikely to encounter them nowadays
using something much milder to clean the small print on the website and unless you repair elderly television
them, but if strong solvents are essen- you will also see: ‘Many of the uses receivers and video monitors. They
tial, then use these carefully and rinse of WD-40 products described on our have a nasty tendency to seep out
off as quickly as possible. company websites were provided to of high-voltage capacitor cans and
WD-40 Company by end-users of the cover the device’s whole outer sur-
Noxious fumes and common sense products, and do not constitute rec- face. If you are unwise enough to
I confess I rather like the smell of hot ommendations or suggestions for use wipe away the greasy film with paper
resin-cored solder (rosin-cored sodder by WD-40 Company. These uses have towels, you will find that it has re-
if you are American) as it smokes and not been tested by WD-40 Company. turned a week later. Stay safe and have
sizzles, but I really shouldn’t. Better to Consumers should exercise common nothing to do with PCB capacitors.
Win a Microchip
AVR-IoT Cellular Mini
Practical Electronics is offering its readers the chance to win a configured to most major cloud service providers through
Microchip AVR-IoT Cellular Mini (EV70N78A) – and even if you Microchip’s IoT Provisioning Tool.
don’t win, receive a 15%-off voucher, plus free shipping for one
of these products. The AVR-IoT Cellular Mini comes pre-configured to send data
from on-board light and temperature sensors to the cloud,
The AVR-IoT Cellular Mini is a development board viewable using Microchip’s sandbox portal. The
based on the AVR128DB48 8-bit microcontroller sandbox portal provides customers with the ability
(MCU). This solution provides a robust platform to track and monitor their device in real time from
to start building sensor and actuator nodes Worth a remote location.
on 5G narrowband IoT networks. The AVR-
IoT Cellular Mini is a small-form-factor board $60.00 This functionality covers the core requirements
making it an ideal solution for developers who (approx £49.99) of many applications in various industries,
want to connect IoT devices to an available including agriculture, industrial and energy, as
5G network. This is an essential feature for each well as consumer spaces such as transportation
devices on the go or located in remote areas of goods, alarm systems, building automation
with limited availability of Long Range (LoRa) and remote monitoring.
networks or other Low Power Wide Area Network
(LPWAN) solutions. To provide an even easier, more efficient and cost-effective solution
for developers to connect IoT devices to 5G using the AVR128DB48,
Customers can tap into the flexibility and ease of design Microchip partnered with Sequans to include its Monarch 2 GM02S
offered in the latest AVR128DB48 8-bit MCU family, single-chip radio equipped with 5G LTE-M and narrowband IoT.
including security protection with Microchip’s ATECC608 Microchip also partnered with Truphone to provide the SIM card
CryptoAuthentication device. The ATECC608 can easily be for cellular service that offers reliable coverage worldwide.
Free-to-enter competition
T
he UK’s identity card products and services by providing
scheme was scrapped in 2011 proof that customers are not below
and fierce campaigning blocked the legal purchasing age.
the introduction of a more modern Although it’s not well publicised,
electronic/biometric system – as there is a version of the young person’s
used in many countries. The argu- ‘old enough to drink’ PASS photo-ID
ments for and against a secure, dedi- card which can be used to prove iden-
cated ID card are many and divisive: tity by older people who are clearly
would it cut crime but infringe on old enough to drink (details can be
civil liberties, interfere with both found here: https://bit.ly/pe-nov22-id) The UK’s PASS proof-of-age ID.
legitimate and illegitimate migration The ‘18+ Citizen Card’ costs £15 (£30
and asylum, save or cost taxpayers if needed quickly) and lasts only three Stores, clubs, pubs and hotels routinely
money? No one can accurately pre- years. It can be a physical photo card, use generic electronic ID readers which
dict, although the history of large, or digital ID phone app. cost a few hundred ponds. They hook up
government-backed IT systems is to The above is not good news for any- with a PC and do not need to go online
say the least patchy – just ask the one who is over 18, but who does not and access any official database. They
NHS or Royal Mail branch managers. drive and does not travel abroad. Try, are used to confirm that the customer
for instance, getting a faulty phone SIM pictured on the card is who they say they
Can you prove who you are? replaced; high street dealers will only are, how old they are and where they
But one thing is now becoming clear; send them to customers who can prove live. Gradually these readers are sliding,
the lack of an all-purpose modern-tech their identity with a driving licence or largely unseen, into more general use.
ID card means that some matters of passport. Other photo ID, such as library Think carefully about this before letting
everyday life in the UK now depend on or travel passes, will not be accepted. a driving licence or passport lapse; it
being able to offer one of three alterna- In North London, Camden Council may be a difficult, lengthy process to get
tives: a valid photo driving licence, recently made news by insisting on a new one, and in the meantime cause
a valid passport or a young person’s sight of a passport or driving licence you real access and retail problems.
PASS (Proof of Age Standards Scheme). before paying energy rebates and cri-
This is an ID card scheme supported sis benefits through Post Offices. It’s Is cash still king?
by the Home Office, the Chartered estimated that 20% of those offered Think carefully, also, about welcoming
Trading Standards Institute (CTSI) and a rebate in April did not collect it, the end of cash, and its replacement
the National Police Chiefs’ Council in many cases because they couldn’t with cards and phone readers – as
(NPCC). Its aim is to support retail- prove their identity. Other councils accelerated by the Covid crisis. I now
ers when supplying alcohol, tobacco, will very likely be pilloried for paying find that often the only way to buy an
knives, fireworks, gambling, access to out to people without solid proof of ice cream or coffee is with a debit/
pubs/clubs and other age-restricted who they are. credit card.
w !
ne
1551V snap-fit vented and plain
miniature plastic enclosures
Learn more: hammfg.com/1551v
More than 5000 standard stocked enclosure designs
[email protected] • 01256 812812
M
otorola laid plans for a promised international cover. In the fortune to send a picture. It’s Stone Age
satellite phone system way UK, Iridium’s European head office technology trapped in Space.’
back in the early 1990s, in Germany referred all enquiries to Iridium soon went bust and the
when different countries were using cell phone service provider Orange, network was sold for a knockdown
different and incompatible analogue but Orange told enquirers that there price – it now serves people in places,
cell phone technology. In the US, cell- would not be a commercial launch like remote mountains, deserts or ice
phones registered in one state would until the last quarter of 1999. The flows, who will pay a high price for
not work in another. The idea of a handset would cost at least £2,000 any call at all.
global system with one handset work- and there were no call tariffs yet, but More technology stories and images
ing anywhere in the world, sounded calls were expected to cost several at: https://tekkiepix.com/stories
wonderfully attractive. pounds a minute.
Motorola’s original scheme was to The omens were not good. The first Practical Electronics is delighted to be
able to help promote Barry Fox’s project
launch 77 satellites that circled the earth review samples had very limited battery to preserve the visual history of pre-
in a pattern of low orbits, and which life and provided erratic connection. Internet electronics.
were cleverly mapped to ensure that The GSM digital cell phone standard Visit www.tekkiepix.com for fascinating
a handset on the ground could always was by then being used in many coun- stories and a chance to support this
‘see’ at least one satellite overhead. So, tries, and local operators had roaming unique online collection.
T
his has been a tumultuous In the swinging Sixties, the Queen hope to return to in a future column. In-
year for Net Work readers in the would televise her Christmas message in cidentally, it would be another 20 years
United Kingdom. Earlier in 2022 colour for the first time in 1967. It does before the Internet started to catch on
we celebrated our Queen’s Platinum not appear to be archived anywhere, al- with mainstream users, hence my arti-
Jubilee marking 70 years of her reign, though a transcript is available at: www. cle, The Internet: What’s in it for you?,
and then we had a record-breaking royal.uk/christmas-broadcast-1967 published in July 1996, and which
sweltering summer heatwave followed For her televised 2022 Jubilee festivi- which prompted the first ever Net Work
by a change of Prime Minister. Just a ties, the Queen embraced the latest CGI column in the August 1996 edition.)
few days later, Britain and the world with an endearing TV sketch featuring An official Facebook page managed by
witnessed history in the making with the Paddington Bear and marmalade sand- the Royal Family would follow (www.
news of the passing of Queen Elizabeth wiches, which is now immortalised at: facebook.com/TheBritishMonarchy)
II followed by the enthronement of King https://youtu.be/7UfiCa244XE and while visiting London’s Science
Charles III. The same Royal channel on YouTube Museum in October 2014, the Queen
This month’s Net Work column pays is updated regularly in a timely fashion sent her first tweet, which read: ‘It is a
homage to the Queen and her penchant and, for those readers who may be inter- pleasure to open the Information Age
for progress and modernisation. To ested, the first address of King Charles exhibition today at the @ScienceMu-
borrow from a certain German car mak- III went online for a global audience at: seum and I hope people will enjoy
er’s strapline, the late Queen was very https://youtu.be/E_5REdx2Vtk visiting. Elizabeth R.’ In 2019, again at
much in favour of ‘advancement through the Science Museum, the Queen posted
technology’. As a 14-year-old, Princess Royal (e)Mail on The Royal Family’s new Instagram
Elizabeth’s first radio broadcast in war- The Internet arrived in 1970s Britain in account for the first time. One of Queen
time 1940 was a warming Children’s the form of a connection with Ameri- Elizabeth’s last public appearances on
Hour message of hope addressed to chil- ca’s ARPANET, the packet-switching television would turn out to be her
dren around the world evacuated from network that interconnected several poignant message during the Corona-
London and other cities. The broadcast high-end institutes and military es- virus epidemic in April 2020. It evoked
can still be heard on the official Royal tablishments. The Queen sent her first her wartime spirit, and she made refer-
YouTube channel at: https://youtu.be/ email in March 1976 while visiting the ence to that first ever Christmas message
VJI9LPFQth4 with a full transcript at: UK’s Royal Signals and Radar Estab- in 1940, which can be bookmarked at:
www.royal.uk/wartime-broadcast-1940 lishment (RSRE). Photos of the event https://youtu.be/2klmuggOElE
The Queen was always keen to use the celebrated the release of CORAL66, the
latest in communications, so 65 years programming language that originated The Queen goes nuclear
ago she wrote to the BBC to say she felt in the RSRE, and the Queen was pic- The year before her first Christmas
the time was right to televise her annual tured symbolically pressing the Send message was broadcast, the Queen saw
Christmas message for the first time. The button on a terminal to dispatch the how Britain was aspiring to become
BBC agreed, and the resulting grainy first official Royal email. (Britain’s Na- self-sufficient in electricity when, on
monochrome footage of the Queen’s 1957 tional Physical Laboratory (NPL) played 17 October 1956, she officially opened
Christmas broadcast can be viewed at: a definitive role in developing packet the world’s first full-scale nuclear power
https://youtu.be/mBRP-o6Q85s switching and the Internet, something I station at Calder Hall in Cumberland,
The UK Gridwatch website is a very informative guide to energy consumption from all UK energy sources as well as foreign interconnects.
U
S Cable
B Tester
It’s frustrating when a USB device doesn’t work, and you don’t know if it’s
a problem with the device itself or the cable. This is a huge problem if,
like us, you have a drawer full of USB cables and don’t know which ones
are good or provide power only. Bad cables can also cause intermittent
problems. Now there is an easy way to test all manner of USB cables; this
USB Cable Tester is so handy, we think you will find it indispensable!
F
ew things are as frustrating This device is compact and auto- Devices such as portable hard
as an intermittent fault when it matic. Simply plug a cable into the drives, which often require signifi-
comes to checking and diagnos- appropriate sockets, and it immedi- cant current, are especially prone to
ing faulty gear. It’s even worse if it is ately gives you an assessment. You this problem.
due to a dodgy cable because you can will know straight away if the cable None of these tests characterise the
never be completely confident that is suitable for your purpose. high-speed data performance of the
you have ruled out other problems. cable; much more specialised equip-
So for this reason it’s crucial to be Testing ment is needed to do this. Still, these
able to test cables. The USB Cable Tester performs two tests are performed very quickly and
These days, a lot of gear connects primary tests. Initially, the various can be used to give a very fast ‘go/
with USB cables and not just when conductors in each cable are tested no-go’ assessment on a cable.
it’s attached to a computer. Prac- for continuity at low current. With the rise of the ‘Right to Repair’
tically all mobile phones use USB This test can pick up whether, for movement, we think that the USB
for charging, and they’ve also found example, a given lead has the appro- Cable Tester will become indispens-
many niche uses due to their ubiq- priate internal data connections for able in places like Repair Cafés. We
uity, even for devices like shavers USB 2.0 or USB 3.2, or whether it shudder to think how much good gear
and toothbrushes. can carry power only. It can also has been discarded due to having a
So we’ve designed a USB Cable detect internal short circuits which faulty USB cable.
Tester that can check practically all can interfere with normal operation.
standard USB cables. If you’re like The USB Cable Tester can also per- Power and USB 3
us, you probably have a mix of the form a high-current test on the VBUS USB power delivery is a relatively
latest cables (such as USB-C) and a and GND leads to establish how much recent addition to the USB stan-
good number of older types (such as current the cable can handle without dards and is not something our unit
mini- and micro-USB). dropping excessive voltage. tests; these power delivery features
The USB Cable Tester will test any Checking the ability of the cable to are usually built into devices rather
cable with either a USB-C or USB-A carry current is arguably the most use- than cables.
(2.0 or 3.2) plug on one end and ful test, as it allows detection of the Note that in this description of the
any USB-C or USB-B plugs (such as most subtle and intermittent faults. USB Cable Tester we use ‘USB 3.2’ to
2.0, 3.2, micro or mini) on the other These are the faults where the device refer to any cables that you might know
end. With some basic adaptors, you seems to operate normally but fails as USB 3.0 or USB 3.1, since the USB
can also test common variants such when a burst of current is needed. 3.2 standard replaced (and is back-
as OTG (‘on-the-go’) cables and The device resets due to its supply wards compatible with) both USB 3.0
non-standard cables, such as those dropping out and might even imme- and USB 3.1. This is a similar situation
with USB-A plugs at both ends. diately start working again. to the way that USB 2.0 encompassed
and replaced USB 1.0 and USB 1.1; it’s USB Cable Tester can be used by even 4.5V nominal supply voltage means
now common to refer to devices com- those with no electronics experience. that no regulator is needed; another
patible with these as ‘USB 2.0’. The low-power features of this part (and more money) saved.
new microcontroller mean that a The device is housed in a compact
Design power switch is not needed and 140mm x 110mm x 35mm instrument
Before delving too deeply into the can be omitted. This may seem like case, about the smallest that would
circuit details, we’ll mention some a small saving, but it’s one less part fit everything. This means that it is
of the design considerations that we to consider during design and con- sturdy and looks the part, too.
made along the way. We designed the struction and shaves a little off the Some parts we could not skimp
USB Cable Tester to be economical to cost. The USB Cable Tester simply on. The USB Cable Tester uses robust
build, easy to use and robust enough sleeps between uses, sipping a tiny USB sockets, which cost a bit more
for regular use. 30μA from the battery. but are paramount to the longevity of
While it certainly would be pos- It runs from three AA cells which such a tool. We doubt that any other
sible to do this job without a micro- will last for many years with the USB device will have USB leads plugged
controller, that would entail a com- Cable Tester sitting on the shelf. The and unplugged so frequently.
plicated design.
Add in the fact that the nature of
the test results are often more than a
simple numeric result or basic binary Features and specifications for the USB Cable Tester
go/no go, and a microcontroller is an
inevitable part of the circuit. 1. Test just about any USB cable
With that in mind, we’ve used
a 40-pin PIC microcontroller. Any 2. Current pulse tests at 100mA, 500mA and 1A
fewer pins would require a multi- 3. Downstream-facing ports can accept USB-A (2.0/3.2) or
plexer or switch, adding complexity USB-C (3.2)
and cost. Rather than fall back on one 4. Upstream-facing ports can accept USB-B (2.0/3.2), USB-C (3.2),
of the old-fashioned 40-pin micros Micro-B (2.0/3.2) or Mini-B (2.0)
like the PIC16F877, we’ve decided to 5. Reports faults with individual cable ends (eg, plug with bare wires
get with the times and use its modern or detect OTG cables)
descendant, the PIC16F18877.
6. Can differentiate between power-only, USB 2.0 and USB 3.2 cables
The microcontroller displays the
test results on a 20x4 character LCD, 7. Will report short circuits, open circuits and other faults
allowing simple ‘human-readable’ 8. Reports voltage drop and cable resistance at usable currents
assessments to be delivered. Thus the
We have chosen to use through- does contain a handful of SMD parts Circuit details
hole parts to allow the components for various reasons, primarily cer- Refer now to Fig.1 above, the com-
to be easily obtained, and also so that tain types of USB sockets. Many of plete circuit of the USB Cable Tester.
the USB Cable Tester can be easily these sockets are only available in CON3 and CON4 at upper left are
assembled. Nevertheless, this project that form. the downstream-facing ports (DFPs)
Current affairs
The cable current-carrying capabil-
ity is tested by sending a brief burst
of power through the VBUS (5V) and
GND wires of the cable under test.
Since practically all the GPIO pins
on IC1 can act as analogue inputs for
its internal ADC (analogue-to-digital
converter), we can probe the cable at
several points to see how much volt-
age is dropped between them.
Up to 1A is supplied by a circuit
based around Q3, a P-channel MOS-
FET. Q3, L1, D3 and the 10μF capac-
itor form a fairly standard buck (step-
down) regulator arrangement. The completed USB Cable Tester photographed from the front and rear. This
When Q3 is switched on by a sig- shows that all connections are made from the front of the case. One tactile
nal from the microcontroller via the switch is raised so it can be more easily accessed through a hole in the lid.
220Ω resistor, current flows from the
battery positive through L1, charging
the 10μF capacitor. When Q3 switches
off, the inductor’s magnetic field col-
lapses, causing current to continue
flowing to the capacitor, through the
path provided via D3 and into the
10μF capacitor.
As in any other buck regulator, the
duty cycle at Q3’s gate determines the
voltage that the capacitor charges up to
but with the proviso that Q3 is a P-chan-
nel MOSFET and thus is on when its
gate is pulled low. A 10kΩ resistor
between Q3’s gate and source keeps it
turned off when it is not being driven.
The test voltage is applied to the
cable by three of the contacts of RLY1
and RLY2. One set of contacts con-
nects VBUS of the downstream-fac-
ing port to the positive end of the
storage capacitor. The second set of
contacts connects the GND of the
downstream-facing port to the 220mΩ
shunt resistor returned to circuit mainly to reduce the current flowing Schottky diode D2 feeds from the
ground, used to measure the current. when the relay contacts open, reduc- battery into microcontroller IC1’s sup-
The third set of contacts connects ing relay contact wear. ply, bypassed by 1000μF and 100nF
VBUS and GND at the upstream-fac- Both relays are controlled by capacitors. These also provide power
ing port, which is necessary to com- N-channel MOSFET Q2, which sinks to the LCD. The diode means that the
plete the circuit. Note that current current from the battery through both microcontroller’s supply does not dip
flows in the same direction as it would relay coils when its gate is brought during the brief bursts of current draw
under regular use. high by the microcontroller. A 10kΩ during cable pulse testing.
It’s important to realise that none resistor keeps the MOSFET off when
of the USB GND connections are con- it is not being driven, and 1N4148 Display
nected directly to the circuit ground diode D1 absorbs the back-EMF from LCD1 is a 20x4 character LCD panel
during this test. They are connected to both coils. that has its supply fed directly from
either end of the 220mΩ shunt resis- As we noted, power is derived from pin RD6 of IC1. The signal from RD6
tor, but only when the relay contacts three AA cells, giving a nominal 4.5V. is also connected to the gate of Q1,
are closed. A separate battery holder is wired into which switches the LCD panel back-
The 1kΩ resistor across the 10μF CON1. This feeds the 1000μF bulk light cathode via a 100Ω resistor. A
capacitor discharges it when the bypassing capacitor, Q3 and powers 10kΩ resistor also holds Q1 off when
buck regulator is not running. This is the buck regulator and relay coils. the micro is not driving the pin.
with pull-ups. Thus, any cable result in other pins being detected Any other connection within an
plugged in will pull one or more of as being low. upstream or downstream port likely
the downstream-facing port pins low. The tests are done in three phases. indicates a cable fault. So if one end
The IOC flags are set to allow a One phase simply checks for con- of a cable is plugged in, any of these
pin change to wake up the micro. nections between the pins associ- sorts of problems that are detected are
Just before engaging sleep mode, the ated with the downstream-facing displayed on the LCD screen.
pins are checked one more time; if a port. A second phase checks the The third test phase is a complete
cable is detected, sleep is bypassed. upstream-facing port. ‘matrix’ analysis of every combina-
While unlikely to occur with so many For the most part, these should tion of downstream-facing port pin
pins, it is possible for a pin change to show no connections, except perhaps and upstream-facing port pin. This
be missed, hence the reason for the for the cable shield and USB-ID pin. is turned into a cable-specific signa-
double-check. USB-ID is grounded on USB OTG ture that is compared with a list of
When a pin change is detected cables to indicate that the equipment signatures corresponding to known
(which could include a press on S1), connected to what would normally be cable types.
the micro wakes up and initialises all a ‘device’ needs to behave as a ‘host’. Some cable types have multiple sig-
the peripherals again before returning Depending on how the cable is natures. For example, the reversible
to the main idle screen. wired, there might also be a connection nature of USB-C means that there are
Whenever the micro is awake, it between the cable shield and ground. two equally valid signatures for a USB
uses the timer to perform tests about
four times per second. The results of
the test dictate what is displayed. The
idle screen is shown if no connection
is detected; this also displays the bat-
tery voltage and a countdown timer
until sleep occurs.
The tests work simply. Each pin
is typically set as an input with a
pull-up. One at a time – in turn –
each pin is pulled low and the states
of the other pins are tested. The wires The Tester automatically runs tests as soon as a cable is plugged in. This
in the USB cable connecting pins in known-good cable is identified as USB 2.0 compatible with no problems and a
downstream and upstream sockets voltage drop of 116mV at 1A.
3.2 cable. Table 1 shows what connec- that a USB 2.0 cable is detected, but • USB 2.0 cable: the red and mauve
tions are expected for each cable type. with the D+ line open; such a cable may points are detected.
An exact signature match means be suitable for a power-only application • USB 3.2 cable (Gen 2x1): as for
that the cable is a known type and but will be no good for data transfer. USB 2.0, plus any one of the four
displayed as such. An inexact match A simplified version of the decod- remaining groups of connections.
is shown as the nearest match and the ing would work as follows. • USB 3.2 cable (Gen 2x2): as for
differences are detected. • Power-only cable: just the red USB 2.0, plus either all the green
For example, the LCD might indicate points in Table 1 detected. points or all the orange points.
GND RX2+ 2 VBUS SBU1 D+ CC1 VBUS TX1+ GND GND TX1+ 7;ï VBUS CC1 D+ 'ï SBU1 VBUS 5;ï RX2+ GND
GND TX2+ 2 VBUS VCONN SBU2 VBUS RX1+ GND GND RX1+ 5;ï VBUS SBU2 'ï D+ CC2 VBUS 7;ï TX2+ GND
The two rows of closely spaced pins used in USB-C type plugs and sockets demand a tight pin pattern on the PCB. The
part we have chosen will be the most challenging part of this project to solder, and we doubt there is anything easier
to hand-solder available.
EE
FR -ROM
TEACH-IN 9
FROM THE PUBLISHERS OF
PIC n’ Mix
Including Practical Digital Signal Processing
PLUS...
YOUR GUIDE TO THE BBC MICROBIT
A LOW-COST ARM-BASED SINGLE-BOARD
Teach-In 9
Get Testing
Files for:
PIC n’ Mix
This series of articles provides a broad-based introduction to choosing and using a wide range Three Microchip
PICkit 4 Debugger
Guides
PLUS
Teach-In 2 -Using
PIC Microcontrollers.
In PDF format
of test gear, how to get the best out of each item and the pitfalls to avoid. It provides hints © 2018 Wimborne Publishing Ltd.
www.epemag.com
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.
Teach In 9 Cover.indd 1 01/08/2018 19:56
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).
WEATHER STATION
By Aarav Garg
We’re often describing how you can buy and use very low-cost electronic
modules. They’re great because they save you a lot of assembly time and
soldering work, and they often cost less than buying the individual parts
you would need to build them. Here is an excellent beginners’ project that
uses five such modules to make something useful – a mini weather station
you can carry everywhere with you.
I
s it hot in here, or just me? First steps a tube of neutral-cure silicone sealant
That’s a question you don’t have The first thing to do when begin- and a caulking gun) and, if you’re going
to ask anymore with this Pocket ning with any project is gathering the to make the optional case, access to a
Weather Station. required components. The required 3D printer.
It is a compact device, powered by devices and modules are listed in the
an Arduino Nano board that you can Parts List. They are mostly available Preparation
carry anywhere, right in your pocket. from online marketplaces like eBay, Now we need to plan the position of
It displays the current temperature and AliExpress and Amazon. all the components inside the enclo-
humidity on its OLED screen. Sure, you While they are inexpensive, chances sure. I wanted to keep the device as
may have the local weather report on are they will come from overseas, so thin as possible, so it is actually con-
your phone, but it’s amazing how much allow a few weeks (or even months) venient to carry in a pocket. Thus, I
local temperatures can vary from those for delivery. spread all the components out and did
recorded elsewhere in your area. By the way, the DHT11 is a smaller, not go with a layered structure. That
Plus, knowing the indoor tempera- less accurate version of the DHT22 tem- would decrease the width and height,
ture and humidity can be pretty helpful, perature/humidity sensor that we have but increase the thickness.
as how hot or cold it ‘feels’ is strongly used in the past and described in the Fig.1 shows how I stacked the com-
affected by humidity, not just tempera- April 2018 issue of PE. Its small size is ponents inside my Pocket Weather Sta-
ture. Even with moderate temperatures, useful in a pocket device. tion. I used an Arduino Nano board
high humidity can make you sweat Since it incorporates both tempera- because of its size, which is perfect for
more than a more intense dry heat! ture and humidity readings, we only this project. You could also come up
One reason it’s so portable is beacuse need the one sensor. The other parts with your own method of stacking the
of its integrated, rechargeable 160mAh are the Arduino board to query it, the components in ways that reduce the
LiPo battery. display to show the readings and the size of the device even further.
It is an excellent project for learning charger to keep the battery topped up. After you have planned your pre-
and is also really fun to make. It even You need a few basic tools to build ferred arrangement, refer to Fig.2, the
comes in handy sometimes! Sound the Pocket Weather Station: a solder- wiring diagram. This shows how all
interesting? Then let’s dive right in! ing iron, hot glue gun (or even better, the modules need to be connected. It’s
►
Fig.2: this diagram serves as both the wiring diagram and a form of circuit diagram; it shows all the connections
necessary to turn the separate modules into a Weather Station. You don’t need to use the same colour coding as we did,
but we strongly advise that you stick to the red/black colours for the power wires, and make sure that black only goes to
ground or negative pads, and red to positive pads. Take note that different DHT11 modules may have different pin-outs.
relatively simple, as there are just a Also, try to solder everything accu-
few modules, and none of them need rately to prevent any short circuit. Putting it all together
to be modified. It might be a tedious process, but Now, we need to place the whole circuit
believe me, later on it will feel worth inside the enclosure that we designed
Wiring it up the effort. After you have finished sol- earlier and 3D printed. It is vital that
Before you start building the dering all the components (excluding all the parts go in their respective cut-
Pocket Weather Station, you might the switch), it should look something outs for a neat and tidy look. It is also
like to watch my YouTube video like Fig.3. important that all the components are
showing how I assembled it, at: Obviously, we can’t carry it around firmly fixed in their place and cannot
https://youtu.be/ZhOhBuKC80M as just a collection of connected mod- move inside the enclosure to ensure
There are two types of connections ules, so we need an enclosure for our
to be made: power (red/black wires) Pocket Weather Station – and to give
and signal (green/orange/yellow wires). it a professional look. The best option
The charger board connects to the bat- we have is 3D printing.
tery as well as all the other modules,
to power them. The enclosure
The only other connections required I designed the enclosure in Tinker-
are for the I2C serial bus between the cad, which is a fantastic CAD software
Arduino Nano and the display, and package. It supports all skill levels, so
one signal wire from the DHT11 to the even if you are a beginner, you can still
Nano, so it can get readings. use it. You can download my 3D files
Start by connecting the battery to (.stl format) from the November 2022
the battery charging module. We aren’t page of the PE website.
connecting any wires to the switch yet, I don’t have a 3D printer, so I used an
because that has to be done once every- online 3D printing service based locally
thing is installed in the case. You can (to me) in India (www.iamrapid.com).
connect the power supply wiring of the I uploaded my .stl files to get an instant
Arduino, OLED and DHT11 modules to quote and ordered the parts right away.
each other, and the ground back to the The enclosure they delivered to me has
charger module; leave the wires for the great build quality.
switch loose for now. Chances are you will find a simi-
Try to keep the wire lengths just long lar local service. Do a web search for
enough to prevent a mess of wires later. ‘3D printing service’. Even better, you
For all the power supply connections, might also find a nearby maker space,
make sure you get the polarity correct, see: https://bit.ly/pe-nov22-ukms and
with black wires to the GND pins only www.hackspace.org.uk
and red wires to the positive pins. If you Fortunately, all the cutouts that I had
connect them the wrong way around, made in the design were in the exact Fig.3: once you have finished wiring
chances are good that some of the mod- spots I needed them, so I didn’t have to nearly all the components together, it
ules will be damaged. get a second prototype made. should look like this.
Programming
We need to upload some code to our
Pocket Weather Station. Without code
in the Arduino, our device is just a plas-
tic box with no functionality.
First, download my Arduino sketch
from the November 2022 page of the
PE website. It is a zipped directory con-
taining a file with a .ino file extension.
Unzip the package, install the latest
Arduino IDE (integrated development
environment) and open the .ino file.
longterm, reliable operation earlier because it If you wish to, you can of course-
of the Pocket Weather Station
Station. needs to be inserted into write the code yourself, but if you’re
I used hot melt glue to fix the enclosure from the outside. a beginner (or even if you aren’t), it’s
the parts inside the enclosure. After putting the switch into its slot, best to start with my version since we
However, while this is convenient, it use two small self-tapping screws or a know it works. You can always mod-
can fail if exposed to enough heat (eg, pair of bolts and nuts to fix it in place. ify it once you get it working. See the
if it’s left exposed in direct sunlight Then connect its two wires: one from panel opposite if you are interested in
inside a car). For this reason, you could the VCC pad of the Arduino board and how the code operates; that informa-
use neutral cure silicone sealant, which one wire from the positive output of tion could come in handy if you plan
offers a more reliable solution. It takes the battery charging module. to make changes to it.
longer to cure, but it’s not going to fall If the switch has three terminals, Once you have the code open in the
apart if it gets hot. make sure to connect those wires to two Arduino IDE, plug the Arduino Nano
As you fix the components in the adjacent terminals. That way, the cir- into your computer’s USB port (don’t
case, make sure the two USB sockets cuit will be completed with the switch plug into the USB charger port as it
line up with their access holes around slid to the wired end. does not pass data to the Arduino).
the edges, as you will need to connect Next, we need to complete the enclo- Then press CTRL+U (or select Sketch ĺ
to both of them later. sure. I used self-tapping screws to fix Upload) to compile the code and load
Now it’s time to add the project’s the lid in place. I had already made it into the Arduino.
slide switch into its dedicated slot. screw holes in the enclosure design, so Check the output at the bottom
Note that we did not connect the switch that was easy. Just make sure that the of the window for error messages.
At left is
the (nearly) Reproduced by arrangement with
completed SILICON CHIP magazine 2022.
project, it just www.siliconchip.com.au
needs the wires
soldered to the
switch at lower
right. Hot melt
glue was used to
make sure the
components were
secure. Note that
this glue can fail
if exposed to
enough heat.
Compilation takes a few seconds, and There might be an error in your code
if it finds a problem with your code, (perhaps you’ve forgotten to initialise
- up to 256 - up to 32
it will tell you there. Otherwise, you the display). Try using my code first as microsteps microsteps
should get an ‘Upload successful’ mes- you know it works, then modify it from - 50 V / 6 A - 30 V / 2. 5 A
sage, and your Pocket Weather Station there once you have it working. - USB configuration
- Isolated
will be fully operational.
Don’t forget to charge the cell (via the 2. All readings are ‘NA’
other USB port) so it is ready for use. This will happen if it can’t communi- PoScope Mega1+
The cell charge lasts quite a long time, cate with the temperature sensor. You
so you will rarely need to charge it. might have a problem with the connec- PoScope Mega50
Now, you can proudly carry the device tion between the temperature sensor to
wherever you go and show your cre- the Arduino board. Just re-check the
ation to friends (or maybe actually use connections. If they are correct, you
it as a weather station!). might have a problem with the sensor
itself – try replacing it.
Troubleshooting
If you are here, that probably means 3. It works when the USB cable is
that you have built the project, but it plugged in, but not from the battery
doesn’t work yet. Don’t worry, you will If this happens, there is a problem with
get it working and you will learn a lot your battery or perhaps the connec-
from troubleshooting it: tions between the battery and the rest
of the circuit.
- up to 50MS/ s
1. The OLED screen is blank - resolution up to 12bit
You might have damaged your OLED Links - Lowest power consumption
display due to an incorrect connec- This project on the Instructables web- - Smallest and lightest
tion, but more likely, you haven’t con- site: https://bit.ly/pe-nov22-pws1 - 7 in 1: Oscilloscope, FFT, X/ Y,
Recorder, Logic Analyzer, Protocol
nected the signal wires properly, so This project on the HackSpace web- decoder, Signal generator
re-check them. site: https://bit.ly/pe-nov22-pws2
It’s nice to have carriage lights in a model train – they add a pleasing
realism to you layout. These model train carriage lights (designed for
OO-gauge) are battery-powered and can be switched on and off with
an external magnet.
I
t might seem trivial to add lights carriage needed to have metal wheels the reed switch under the roof so that
to a model railway carriage, but there with some form of voltage pickup you can manually switch the lights on
are a few considerations that make attached to them, and they had to be and off by waving a magnet across it.
it a bit more difficult than you might insulated from each other.
initially expect. One important factor Today, most carriage wheels are Circuit description
is that the battery must be small, so the made of plastic, so they need substan- Fig.1 shows the full circuit diagram.
circuit must avoid discharging it when tial modification to pick up power The LT1932 IC2 constant-current
the lights are off. Also, you need a way from the track. Also, it isn’t that easy DC-to-DC LED driver provides a fixed
of switching the lights on or off easily. to make a reliable pick up. current that drives the series LED lights
This little circuit powers five white Now that efficient white LEDs are from the battery. It is about 70% effi-
LEDs and only draws a couple of available, it is practical to power them cient and will work down to a battery
microamps when off, and just 8mA from a small battery inside the car- voltage of 2V. It has a shutdown input
when on. The low off-current puts riage. The problem then becomes how that, when taken low, switches off the
a negligible load on the battery. The to switch the lights on and off. LEDs and reduces its current draw to
low 8mA operating current means that My simple solution is to mount a less than 1μA.
you can use two AAA batteries (cells, normally-open reed switch inside the I have specified high-intensity white
really) in series, giving 3V, which carriage, either under the roof or on the LEDs which give adequate light when
will power the circuit for about 100 floor. When a magnet is placed near driven with 1mA. The 70% efficiency
hours. If you lack the space for that the reed switch, its contacts close, sig- figure given above is for a 10mA LED
setup, you can use a single 3.7V Li-ion nalling the circuit to toggle the lights current. To reduce this to the 1mA
800mAh battery (for example, the Jay- on or off. required without unduly affecting the
car SB2300). You can see a video of the proto- efficiency, the shutdown pin is fed
The carriage size determines which type’s operation at: siliconchip.com. with a 10% duty cycle (1-to-9 mark-
batteries can be used. The circuit au/Videos/Carriage+Lights space ratio) PWM waveform.
stops working when the battery falls With this arrangement, you can The driver oscillates at 1.2MHz and
below 2V. add a magnet on the tracks just out- uses inductor L1, schottky diode D1
Until recently, lights in model rail- side a tunnel so that when the train and a 1μF ceramic capacitor to step
way carriages were powered from the approaches, it switches the lights on. up the battery voltage to the 15V or so
track. This is because small incandes- Another magnet placed near the tunnel needed by the LED string. To protect
cent lamps required a relatively large exit switches off the lights when the IC2 in case the LEDs are accidentally
current, so they couldn’t be battery train leaves the tunnel. If you want to disconnected, 24V zener diode ZD1
powered. To obtain the power, the use the train at night, you can mount clamps the maximum output voltage.
The peak current through the LEDs is Here is an example of how you can ►
set to about 10mA by the 2.2kΩ resistor mount the project into a carriage. Note
from IC2’s RSET pin to ground. the clear plastic insulation under the
An inexpensive PIC12F617 8-bit battery and PCB.
microcontroller is used to generate
the PWM waveform to drive the pin Construction
5 SHDN input of IC2. When reed There are components on both sides
switch S1 closes, it takes the GP2 of the PCB, so there are two overlay
digital input (pin 5) of IC1 high. diagrams: Fig.2 and Fig.3. The Car-
The 10kΩ pull-down resistor and riage Lights Controller is built on a 28
100nF capacitor help to debounce x 16mm PCB coded 09109211, which
the switch contacts. is available from the PE PCB Service.
This signals the microcontroller to It has been deliberately kept small to
come out of sleep mode and provide fit inside a typical OO-gauge carriage.
the switching waveform to IC2, turning I etched mine myself as a sin-
on the lights. If S1 is operated again, gle-sided design, but you can get the
IC1 goes back into sleep mode, and its double-sided version from the PE PCB
GP0 output at pin 7 goes low, switch- Service, which avoids the need to fit a
ing off the lights. In sleep mode, IC1 wire link. To keep the PCB small, most
draws about 1μA from the battery. parts are SMDs, so it’s a good project
If you add to this the <1μA of IC2 in if you’re interested in improving your
shutdown mode, you get a total cur- SMD soldering skills since it has a few
rent drain of less than 2μA, which is different types and sizes of SMD parts
a negligible load on the battery. – but nothing especially difficult.
Testing
Connect up the reed switch and LEDs,
and before connecting the battery,
have a last look at the board for faults
or dry joints. Ensure you connect the
battery the right way around – the cir-
cuit will be destroyed if you don’t.
Now place the magnet parallel to the
Turn the board over and solder in the Wiring it up reed switch a few millimetres away;
wire link (if you are using a single-sided While Fig.3 shows the basic external the LEDs should light. Remove the
board), zener diode, 1μF ceramic capac- wiring connections, there are more magnet, then put it back where you had
itor and the 100μF electrolytic, making details shown in the wiring diagram it, and the LEDs should extinguish.
sure the diode and electrolytic capac- (Fig.4). So that you can work out the
itor are the right way around. These length of the board connecting wires, Reproduced by arrangement with
components are all shown in the under- you need to decide how and where SILICON CHIP magazine 2022.
side overlay diagram (Fig.3). the components fit into the carriage. www.siliconchip.com.au
Teach-In 8 CD-ROM CD
EE
FR -ROM
ELECTRONICS
£8.99
SERIES
FOR
THE TEACH-IN
8
This CD-ROM version of the exciting and popular Teach-In 8 series INTRODUCING THE ARDUINO
• Hardware – learn about components and circuits
• 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.
Self-Contained 6GHz
Digital Attenuator
This new digitally programmable module
can attenuate signals from 1MHz to 6GHz by
0 to 31.75dB in 0.25dB steps. You control it using five small pushbutton
switches, while a tiny OLED screen shows the current setting.
I
recently reviewed a new and setting. Presumably, the rest of the capacitors. Apart from various bypass
small digitally-programmed UHF controller circuitry is mounted on the capacitors, that makes up all of the
step attenuator module that could underside of this PCB. actual attenuator section.
attenuate signals from 1MHz to The UHF attenuator chip is proba- Below is the control section, based
3.8GHz by 0-31dB in 1dB steps (Octo- bly the Analog Devices HMC1119, a on a microcontroller (possibly an STM-
ber 2022). It has an inbuilt microcon- ‘big brother’ to the HMC472 used in 32F103C8T6, like the one used in the
troller, and the attenuation is set using the aforementioned 3.8GHz attenuator. 3.8GHz attenuator).
four small pushbutton switches. According to the Analog Devices
The results were quite respectable data sheet, the HMC1119 has a range Operation
overall, although there seemed to be of 100MHz to 6.0GHz and seven con- The microcontroller (MCU) controls the
a bit of contact bounce with the push- trol bits, giving a setting range of 0 to attenuation settings of the HMC1119
button switches and the RF output 31.75dB in 0.25dB steps. It has a spec- via the seven programming lines, while
and power input connectors were too ified insertion loss of 1.3dB at 2.0GHz, the user determines the attenuation set-
close together. drooping to around 1.5dB at 3.5GHz ting using the five small pushbutton
As I finished writing that review, and a whisker below 2.0dB at 6GHz. – switches S1-S5. To make this easy, the
I became aware that a slightly larger all in all pretty impressive! MCU displays the current attenuation
digital attenuator had become avail- As with the 3.8GHz attenuator, I setting on the OLED screen, controlled
able, with a broader frequency range couldn’t find a full circuit for the new using a standard I2C serial interface.
and 0.25dB attenuation steps rather module, so I could only work out a basic When power is first applied, the
than 1dB. block diagram for it, shown in Fig.1. MCU sets the attenuation to 00.00dB. To
The RF1 input and RF2 output pins change this, you first press S3 (the OK
New module of the HMC1119 chip are coupled to the button) and then press S1 (<) or S5 (>)
The new module is likely available SMA input and output connectors via until the display is flashing the setting
from several suppliers on the web, but
I ordered the one shown in the photos
from Banggood, catalog code 1648810.
Currently, it’s priced at around £25
with free shipping to the UK. Like the
earlier 3.8GHz module, it’s almost cer-
tainly made in China.
The new module measures 56 x 40 x
16mm overall, not counting the SMA
connectors at each end for RF input
and output.
The digital attenuator section is on
a small PCB fitted down inside a 56
x 40 x 10mm CNC machined alumin-
ium block which forms the module’s
‘case’. The rest of the module’s cir-
cuitry is mounted on a second PCB
measuring 56 x 40mm, which forms
the top of the case.
The OLED panel is mounted on the
top of this PCB in the centre, along
with the micro-USB power socket, the
mini slider power switch and a tiny
SMD power LED. Then along the PCB
front are the five small pushbutton Fig.1: no full circuit diagram of the 6GHz attenuator available – this simplified
switches used to select the attenuation version is what we expect the block diagram look like.
Conclusions
Overall this new attenuator module seems reasonably good
value for money when you consider its relatively wide fre-
quency range and low price. I also like its ability to be pro-
grammed using the built-in MCU, control buttons and tiny
OLED screen, or from a PC via the USB port (and presumably
from a separate microcontroller, via the serial port header).
My only real gripe is that when I tried to unplug the USB
cable from the micro-USB socket after testing it, the socket
lifted straight off the PCB. It seemed to have been poorly sol-
dered, and as a result, I had to spend quite a bit of time sol-
dering it back on (under a microscope). I’d have preferred a
mini-USB socket, as these seem to be a bit more rugged and Visit our Shop, Call or Buy online at:
also attach more securely to the PCB.
www.cricklewoodelectronics.com
Reproduced by arrangement with Visit our shop at:
SILICON CHIP magazine 2022.
www.siliconchip.com.au
020 8452 0161 40-42 Cricklewood Broadway
London NW2 3ET
Fig.3: a graph showing the combined result from a variety of response tests on the attenuator at various settings.
T
his month, we will show
how easy it is to attach a TFT
display and a PS/2 keyboard to
a PicoMite, resulting in a standalone
computer that can be compared to
the popular MaxiMite Computer. Two
versions of the MaxiMite have been
featured in PE (November 2019, and
October 2021) and it must be stressed
that this PicoMite version is by no means
a replacement for either of them. So
why create it? Well, there are two main
reasons; the cost of parts used is much
lower than those required for either
MaxiMite version, but more importantly,
the PicoMite computer uses parts that
are readily available (yes, the main
chips for the MaxiMite are still pretty
much unavailable due to ongoing global
supply chain issues).
Just six modules are required to build
the PicoMite computer:
1. PicoMite
2. SSD1963 TFT module
3. PS/2 keyboard
4. Level shifter (so the 5V keyboard
doesn’t damage the 3.3V PicoMite) An easy-to-build PicoMite computer.
5. PS/2 breakout board (to connect the
keyboard to the level shifter) An important detail worth noting at this The PicoMite
6. 5V USB power supply (to power all point is that SSD1963 display modules To see an overview of how all the
the computer parts). typically have an onboard micro-SD card different elements are connected, please
socket. This means, with an refer to Fig.1. The PicoMite module is
appropriately sized SD card, it the heart of the computer. If you are
Keyboard
Touch SD can be used as the storage drive following this series (at least for the
panel socket
for our PicoMite computer. last few articles), you are likely to have
TFT module Also, these displays can a PicoMite module already. If not, then
optionally be purchased with a grab one, or ideally several; they cost
PS/2 resistive touch panel. Depending under £4 each and are readily available
breakout board on your requirements, a large from many online stockists.
touchscreen can make a nice No special firmware is used for this
user interface. computer, simply ensure that you
PicoMite
So, with the above six load the latest version of the PicoMite
Level shifter 5V USB PSU
module modules, we can easily build firmware which is available for free
a low-cost, modern-day version download from: geoffg.net/picomite.html
of an 80s home computer with At the time of writing this article, the
Fig.1. Overview of how the six modules connect an impressive 800x480, full- file available was PicoMiteV5.07.04.
together in the PicoMite computer. colour display. uf2. For details of how to install the
Fig.4. The elements of the computer are attached to the PicoMite, as shown here. The Fig.5. Pre-built level shifters are available,
TFT connection are shown in black, the touchscreen in orange, the SD card in blue and but it is also possible to build your own
the keyboard level shifter in purple. very easily – see Fig.6.
G
10kΩ Configuring the console
Once the keyboard and display have been connected to the
PicoMite, we can configure it to behave as a standalone
computer. Before disconnecting the PicoMite from the PC/
Fig.6. A simple level shifter for the PicoMite computer can be laptop, we need to enable the TFT to display the output
built with just four 10kΩ resistors and two N-Channel MOSFETs, that is normally sent to the Terminal app – in other words,
as shown here. enable ‘the console’. This is done from your Terminal app
by typing OPTION LCDPANEL CONSOLE 2 (the parameter 2 is
a reference to the default font; this can be changed to 1 (for
One point to highlight here is that PS/2 keyboards are smaller characters) or 3, 4 or 5 (for larger characters)
designed to operate at 5V, and this means the two signals Once the console is enabled, you will see the output that
(Clock and Data) coming out from the keyboard are at a 5V is normally displayed in the terminal app (ie, TeraTerm)
logic level. shown on the TFT screen. Now press some random keys on
However, the Pico module has a maximum rating of 3.6V the PS/2 keyboard and make sure they are displayed on the
on any input pin. If we connect the 5V keyboard directly to TFT (pressing Enter should then result in a ‘Syntax Error’).
the PicoMite then it will result in permanent damage to the However, if there is no response from the keyboard then check
PicoMite’s input pins (GP8 and GP9 in this case). Therefore, the keyboard circuit carefully (and ensure the keyboard is
we must use a level-shifter circuit to bring the 5V signals down configured correctly using OPTION LIST).
to a safe 3.3V, thus avoiding any damage to the PicoMite.
Power supply
Level shifter Once you have a working keyboard and console, you can
You can think of the level shifter as having an input side remove the USB lead that currently connects the PicoMite
operating at 5V (which connects to the PS/2 keyboard), and to your laptop/PC. This will power everything down. Now
an output side operating at 3.3V (which connects to the connect a suitable 5V USB power supply directly to the
PicoMite – pins GP8 and GP9). PicoMite and you should see the MMBASIC welcome message
It is possible to buy a pre-built level-shifter module; two appear on the TFT. From now on, anything you type on the
common examples are shown in Fig.5. Alternatively, you can keyboard will appear on the screen. If not, check that you
build your own on a small piece of stripboard or Veroboard. have not accidentally dislodged a cable. Also, do ensure that
All you need are four 10kΩ resistors, and two N-Channel your USB PSU can supply at least 300mA (most are now a
MOSFETs (2N7000 or equivalent) – see Fig.6 for connection minimum of 1A). If you have got to this point, then you are
details. Either way, you will also need a PS/2 connector almost done – we just need to connect (and configure) the
(effectively a 6-pin mini-DIN socket) into which you insert SD card socket.
the PS/2 keyboard cable plug. The easiest method is to use
a PS/2 breakout board (such as the one shown in Fig.7) SD card
which provides header pins to the four required keyboard An SD card is essentially an SPI device (just like the
connections (5V, GND, Clock, and Data). These header pins touchscreen). Only four connections are required to connect
then connect directly to the level shifter. it to the PicoMite, as shown in blue in Fig.4. These comprise
Fig.7. A PS/2 breakout board like this one makes it easy to connect the PS/2 keyboard to the level-shifter.
GND
HV1
HV2
HV
Data
PS/2 keyboard
card. Note that the SD card should ideally be 8GB, 16GB or 6-pin mini
32GB. Other capacities may work, but all brands of these DIN socket
GND
(External Insertion view)
LV1
LV2
LV
sizes tested so far seem to work without exception.
Summary GP8
JTAG Connector Plugs Directly into PCB!! 3D Printing • Cable • CCTV • Connectors • Components •
Enclosures • Fans • Fuses • Hardware • Lamps • LED’s •
No Header! No Brainer! Leads • Loudspeakers • Panel Meters • PCB Production •
Power Supplies • Relays • Resistors • Semiconductors •
Soldering Irons • Switches • Test Equipment • Transformers
and so much more…
Monday to Friday 08:30 - 17.00, Saturday 08:30 - 15:30
L R
L
ike many inductive parts, Impedance Zp = N2 × Zs may just refer to one secondary. There
audio transformers are a little is also sometimes confusion over centre
unusual and are often custom So with a ratio of 58:1 taps. An 8000ȍ centre-tapped prima-
wound. So, in this month’s Audio Out ry can also be described as 2000ȍ +
I will provide a comprehensive list of Zp = (58²) × 3 = 3364 × 3 = 10092ȍ 2000ȍ. This is because if two identical
the most common parts that I’ve come windings are connected in series then
across over 40 years, together with their Back to front the DC resistance doubles, but the im-
specifications and application. Note that A transformer can usually be used ‘back- pedance quadruples. If two windings
some companies listed no longer exist wards’ with the secondary and primary are connected in parallel the DC re-
– such as Repanco – and the data is windings swapped. The terms ‘primary’ sistance is halved and the impedance
provided for historical reference and for and ‘secondary’ are merely designations remains the same. This is because the
when you are working on old equipment. and the fundamental transformer equa- number of turns is effectively the same,
However, most of the items in the tables tions work both ways. For example, an but the cross-sectional area of the wire
below are available from the AO shop. LT700 makes an effective step-up trans- is doubled.
Before we go any further, here’s a re- former for a loudspeaker
cap on all-important audio transformer used as a microphone in
function of converting from turns ra- an intercom.
tio (N) to impedance, and vice versa. I’ve noticed on some
data sheets that the
N2 = Zp/Zs or N = ¥(Zp/Zs) turns ratio and imped-
ance don’t agree. This
For example, with a 10kȍ:3ȍ transformer: could be because they
are stating the optimum
N = ¥(10,000/3) = 58 source and load imped-
ances for flat response.
Therefore, the transformer has a ra- Also, where there are
tio of 58:1 dual secondaries, such Fig.39. The Vigortronix/OEP transformer mounting
as in the T/T3, 3.6:1+1, boards. These allow series/parallel linking, Zobel
Going the other way: the quoted impedance networks and the use of Molex connectors.
Fig.37. Studio monitor control unit with Sowter 5069 Fig.38. Custom-wound Jensen output transformers (lower left)
Mumetal/M6 output transformers. The Zobel network is 22nF in the Audio Precision SYS-2712 analyser. This transformer
and 1.5kΩ. This is the same transformer that we discussed in balanced output has the lowest distortion I’ve ever seen. It has
Fig.30 in Part 2. to, since it is the system by which other amplifiers are measured.
LT730 Eagle Push-pull output 500mW 500Ω CT:3.2Ω + 8Ω 12.5CT:1 or 500Ω CT:3.2Ω or 8Ω
7.9CT:1 (8Ω)
T/T1, E187A Repanco/OEP/RS Push-Pull driver 1mA DC in pri 800Ω:800Ω CT 2mW 1:1CT 800Ω:800Ω CT
217-624* Jaycar MM-2532
T/T2 Repanco Push-pull output 200mW low voltage 4.5V/6V OC72 amp 6.6CT:1 130Ω CT : 3Ω
T/T3 or E187B Repanco/OEP/RS Dual-secondary driver 5mW small Ravensbrook amp 3.6:1+1 3kΩ : 250Ω + 250Ω
217-646*
T/T4 Repanco Single-ended speaker output 50mW 20mA DC 9:1 243Ω : 3Ω
T/T6 Repanco Push-pull driver 2.8:1 CT 7.8kΩ: kΩ
T/T7 Repanco Push-pull output 1W 9V 2x OC81 9.2CT:1 250Ω:3Ω
T/T12 Repanco Class A 3W car radio output 2.9:1 400mA DC gapped core. 2.9:1 28Ω:3Ω
T/T23 Repanco 10W push-pull driver OC25 (80mA Ic) 2:1CT
T/T24 Repanco 10W push-pull OC25 output Could possibly replace output 1.35+1.35:1+1 22Ω CT:15Ω sec windings
transformer in Mullard 5W class-A PT1 transformer with in series 3Ω when in
worse bass. (Primary inductance 30mH, not 1H) parallel
X7920 Greenweld Interstage, collector load to base I/P 4.5:1 6kΩ:300Ω
GR51135 Gardeners Balanced low impedance OP 1.35+1.35:1+1 22Ω CT:15Ω sec windings in
series 3Ω when in parallel
PE Vocoder 1:1 150Ω:150Ω 4.5:1 6kΩ:300Ω
output
250P* Triad Magnetics (dis- Tapped push-pull split output (suitable for low power Ra- 2:1+1 1000Ω CT:250Ω+250Ω
tributed by Mouser) vensbourne style Fig.14a)
42TU048-RC* Xicon (via Mouser) 1W push-pull output useful for low-voltage outputs. 2.45:1 (8Ω) 48Ω CT:3.2 or 8Ω
42TU120-RC* Xicon 1W push-pull output (Bush TR130 radio replacement). 3.9:1 (8Ω) 120Ω CT:3.2 or 8Ω
42TU200-RC* Xicon (Mouser) 1W push-pull output (Deacy amp) 5:1 (8Ω) 200Ω CT:3.2 or 8Ω
42TU400-RC* Xicon (Mouser) 1W push-pull output 7.9:1 (8Ω) 500Ω CT:3.2 or 8Ω
42TU003-RC* Xicon (Mouser) 1W push-pull output op amp to speaker output 12.2:1 (8Ω) 1.2kΩ CT:3.2 or 8Ω
42TU400-RC* Xicon (Mouser) 1W push-pull output 7.9:1 (8Ω) 500Ω CT:3.2 or 8Ω
42TU003-RC* Xicon (Mouser) 1W push-pull output op amp to speaker output 12.2:1 (8Ω) 1.2kΩ CT:3.2 or 8Ω
The Audio Out guide to the Vigotronix VTX-101-003, Belclare/ amplifier enthusiast, they are the bee’s
audio transformers OEP A 262 A3E, RS 210-6426 or STC/ knees. One important characteristic
Our first list (Table 1) is for old trans- ESD 66122X, which are all equivalent. of expensive transformers is that they
former designs descended from the The windings should be connected in don’t generally need specialised drive
germanium transistor era (1954 to 1978). series if phantom power (connected to circuitry to give good results.
They were originally used for transis- the junction centre tap) is to be used and In professional audio gear the audio
tor radios and other consumer audio in parallel for moving-coil microphones. transformers are often the most expen-
products. Note that a star (*) indicates (However, for both configurations the sive components, even more expensive
the transformer is still being made. turns ratio remains the same.) Vigortronix than the toroidal mains transformer.
Next, (Table 2) we have medium-priced are the lowest-cost supplier of these com- They are worth it to many users/de-
audio transformers from companies such ponents. Note that Vigortronix also make signers because they sound good, are
as Gardeners, Hammond, Sescom, Triad bespoke ‘special’ inductive components, totally reliable and it’s the only way
and Vigortonix. These are parts suitable including mains toroidal transformers. to get fully effective isolation from ex-
for standard Hi-Fi and studio equipment; Last, but not least, we turn to high-end traneous noise.
with optimised circuitry they can give audio transformers in Table 3. CineMag, They are expensive because they are
excellent results. Audionote, Gardeners, Jensen, Sowter, a hand-made niche component. If you
Belclere, OEP (Oxford Electrical Prod- Partridge, Lundahl, Stevens & Billington look at the CiniMag ‘how it’s made video’
ucts), STC/ESD and Vigortronix make a and the BBC make the best transformers. (https://youtu.be/TqOSfW5tqBA) you will
range of generic audio transformers, all The Audionote transformers even use see lots of people doing skilled manual
with different part numbers for the same silver wire for the ‘cost-no-object Hi- jobs with wires and sticky tape. Even
component (see the VTX-A series in Table Fi designer’; although, from a physics laminations seem to be hand inserted
2). For the Steve Dove circuit in Fig.20 perspective I’m not convinced. How- one by one. It was the same when I
(Part 2) and Fig.25 (Part 3) you can use ever, if you are a single-ended triode visited ICW Capacitors recently, who
Insert C3, R3 Zobel for series Insert C2, R2 Zobel for parallel
C1, R1 can be used as an alternative position
VTX-A series
Individual windings
Primary Secondary
Gnd 4 Hot (A) side (B) side
A B C R 2 Cold
Hot 3 1 1
Cold 1 4 4 4 4
Gnd
3 3 3 3
Links Links
not not
used used
2 2 2 2
Gnd 1 1 3 Hot 1 1
C R
Cold 2 1 Cold
2 2
Hot 4 Gnd pin Gnd pin
Gnd
Note phase
Primary Secondary Dots – dots = hot
Fig.40. Variations of the transformer-mounting boards. Note Zobel RC values are for high impedance loading (>20kΩ) and a signal
generator source impedance of 50Ω.
make special capacitors for KEF speak- shown in the studio monitor control unit paper in the October 1987 issue of JAES
er crossovers. in Fig.37.) Indeed, it was Dr GAV Sowter (Journal of the Audio Engineering Soci-
Sowter transformers are the most cost-ef- who did the main research on nickel-based ety) is also well worth reading and this
fective of the top-quality units. (A couple core audio transformers in his 1945 Lon- can be found on the Sowter website:
of Sowters 5069 output transformers are don University PhD thesis. His seminal https://www.sowter.co.uk/pdf/GAVS.pdf
Fig.43. Dual-outline PCB for VTX-102-3001 and VTX-101-3002 output transformers. Note: the 6.8nF Zobel value is for a 50Ω source.
Jensen then took this further by or 43Vpk-pk). It should approach Audio Veroboard and other Paxolin boards just
making arguably the best audio trans- Precision levels with the right ampli- aren’t strong enough. Small ‘Lo-Fi’ trans-
formers. I have only seen two in my fier, but how would I test it? Expect formers from Eagle and Xicon are fine
whole career, the output transform- to pay well over £140 for one. Jensen mounted on stripboard. Big audio trans-
ers in the Audio Precision distortion have become so adept at balancing the formers can weigh over 200g and often
analyser shown in Fig.38. In conjunc- capacitances and resistances of their need to be bolted down, especially on
tion with a negative resistance driver transformers that most don’t even need PCBs. Today’s fibre-glass PCBs are much
amplifier, they give a distortion of Zobel networks. The upper response stronger than stripboard, especially if
less than 0.0002% over the full audio roll-off approximates to a Bessel curve they have plated-through holes. For this
bandwidth. Jensen’s JE-11BMCF out- which gives superior group delay, reason, I’ve had a couple of PCBs de-
put transformer is similar and has a thereby benefiting transient response. signed by Mike Grindle to mount some
THD of 0.002% with zero source re- commonly available transformers from
sistance at up to +26dBu (15.46V rms Let’s get building Vigortronix and OEP, which are used in
High-quality audio transformers are the bulk of my designs. These are both
much heavier than most components available from the PE PCB Service – No-
and mounting them requires extra care. vember 2022 section.
The first board is designed for the stan-
dard VTX-A range and has provision
for wiring both the dual primaries and
secondaries in series or parallel using
links. The earthing is via the mounting
holes, with the earth also available on
the Molex connectors for cable screen-
ing. There is also provision for Zobel
networks. There can be two separate
networks on individual secondaries (for
phase splitters) or a single one. This is
used when the two secondaries are com-
Fig.41. VTX-101-003 Microphone bined as one winding, either in series
transformer with screening can showing or parallel on the boards, as shown in
series-connected windings. The Zobel Fig.39. The overlays are shown in Fig.40.
values are 680pF and 15kΩ. The VTX-101- Fig.42. Line-output board with parallel- An assembled microphone input board
007 with secondaries in series is wired the connected VTX-101-007 transformer. The is shown in Fig.41. A line output board
same way with a Zobel of 13nF and 1.8kΩ. Zobel network is 1.3kΩ and 6.8nF. for the VTX-101-007 is shown in Fig.42.
Table 3: High-end and expensive
Note: Sowter and OEP have been taken over by Carnhill Transformers (https://carnhill.co.uk).
Note the Zobel network has different used in the Vocoder output transformer Dual parallel op amp
values for series and parallel connect- driver (February 2022) the Zobel capac- transformer driver
ed secondaries respectively, 13nF and itor was 33nF because of the negative The circuit in Fig.49 was developed to
1.8kΩ for series, and 6.8nF and 1.3kΩ source impedance drive. drive a VTX-101-007 600Ω balancing
for parallel. transformer while avoiding the addi-
The second board design (shown in Interesting circuits tion of a complex push-pull output
Fig.43) is a dual-outline for both the Finally, here’s a round-up of a few in- stage to provide the necessary current.
VTX102-3001 and the bigger VTX- teresting audio transformer circuits to Two 5534s with paralleled outputs
101-3002 output transformers. Again, whet your appetite / soldering iron. can provide up to 80mA peak. The
provision for Zobel networks is pro- circuit has negative output resistance
vided, since I’m sick of hanging them Hebden Sound/Calrec con- to reduce distortion. The prototype is
on the output of XLR sockets. Fig.44 denser microphone. shown in Fig.50.
shows the assembled board for the I helped the late Keith Ming with this
3001, and Fig.45 for the 3002 with the design many years ago. It shows what’s Push-pull driver
primaries wired in parallel to give a hidden inside many condenser micro- This circuit takes the opposite approach
1:1 ratio. When this transformer was phones (Fig.46). It’s a 500MΩ input to Fig.49 in that the transformer is driven
R10
R1 10MΩ R2 R11
1GΩ 10MΩ 68kΩ
C1 D Male
R6 TR2
1nF 390kΩ BC184LC XLR
G L1 socket
C3 330µH
T1
TR1 10µF 3
1.5:1
S 2N4338 16V
+
Screen BFW11 R7
+ C2
C5
100nF + 120kΩ 1µF
C11 35V 2 1
R4 R8
R13 R9
1GΩ 10µF 1.8kΩ 0V
35V 120kΩ 680Ω
+
C7 C8 C12
100nF 100nF L1 15nF
C4
25mm Mic 330µH
10µF
capsule 16V
TR3
C6 R3 R5 R12 BC214LC
10nF 10MΩ 150kΩ 560kΩ C9 C10
22nF 22nF
0V
Fig.47. Circuit for Hebden Sound/Calrec 1072 condenser microphone. Yes, those resistors are 1000MΩ (1GΩ).
1.8kΩ
100nF
100µF
+
Cold
0V
Fig.49. Line output transformer drive circuit. Op amps are in parallel to Fig.52. BTL transformer driver on Veroboard gives
double the output current to 80mA max. 11Vpk-pk at 30Hz from an 007 transformer, which is the
highest output voltage possible without saturation.
+
Output maximum: 54Vpk-pk
10µF 10µF at 1kHz into 600Ω load
25V 2.2kΩ 25V Output maximum: 36Vpk-pk
+
47nF 3.3kΩ
Trim Iq
gain to
x3.8 330pF
Set Iq
1.5kΩ
+4.0V gives Iq = 85mA
4.7kΩ
+ 47Ω
100µF 1.2kΩ 18kΩ 1W
25V
0V 0V
56kΩ
3.6:1+1
Max
In/Out
C DCR
4.7kΩ
22Ω
Log 0V
CW DCR Bidrectional
68Ω
Min dip
Output T/T3
level
0dB
Max dip
–16dB
Fig.54. Neve BA238 output driver board. Note the uses of a TO3 output Fig.56. ‘Mid dip’ circuit – provides isolation and a
transistor: bomb-proof, good-sounding over-engineering. ‘smiley curve’ at the same time.
Fig.55. A completed ‘Neve’ microphone pre-amp built for Ed Lewis at Giant Wafer Studios. Note the row of four LO1166 transformers.
+
Fig.61 fits the bill perfectly. I
BFY50
remember nagging my mum Input
to buy the little yellow box Gnd Connect to case and
pin 1 if XLRs are used
from the local TV shop. Then 8.2kΩ 560Ω 2.7Ω
8Ω
+ C1
100µF 1.2Vpk-pk
LT700*
45mW output
into 3 – 8Ω
loudspeaker
TR1
BC337
R2 R3
22kΩ 100Ω
Fig.59. Driving a transformer from a high source impedance raises
distortion. Feeding it through a 330nF capacitor (as in Fig.57) causes 0V
a steep rise in distortion with decreasing frequency. Transformers
already exhibit rising distortion in the bass, so this circuit gives an Fig.62. A cheapie circuit that cheeps – a 1kHz crude sinewave
exaggerated transformer effect. (0dB input, 100kΩ load, 40Ω source) LT700 test-tone oscillator.
I
n the previous two issues we Before discussing how to implement might be much louder than others due
discussed electronically controlled re- a compressor or limiter we need to to differences in the signal processing
sistance, focusing on the use of JFETs describe what they do and define their in each case. This could be difficult to
(Junction Field Effect Transistors) as volt- basic characteristics. Having done listen to even if the loudest source did
age-controlled resistors. First, we looked that, we will discuss their operational not cause distortion.
at the basic characteristics of the JFET principles, focusing on the role of the Limiters and compressors can
that make it suitable for this task. Then, JFET variable resistor in these circuits. address these problems by reducing
last month, we covered details of a vari- We will not cover full design details and the dynamic range of the signal to avoid
able attenuator in which a JFET takes the the complexities of different possible distortion and/or provide a safer or more
place of one of the resistors in a potential implementations. Readers interested comfortable listening experience. They
divider. We discussed the impact of the in complete JFET-based compressor can also be used in more specific ways;
JFETs characteristics on the design and circuit designs will be able to find many for example, in manipulating the sound
performance of this circuit, including use examples by searching online. from musical instruments. Compression
of feedback to reduce distortion caused of audio dynamic range can make audio
by the JFETs non-linearity. Finally, we Use of audio limiters sound louder, particularly when there
looked at examples of circuits in which and compressors is a hard limit on the maximum peak
the JFET attenuator is combined with op Audio signals can vary very substantially amplitude. Compression used in this
amps to create a voltage-controlled am- in volume or loudness over time – the way should not cause the maximum
plifier, often known as a ‘VCA’. range of loudness (quietest to loudest) level to be exceeded (that would cause
Such voltage-controlled amplifiers have in an audio signal is called the dynamic distortion) but allows the average level
a number of uses in both audio and radio range, and in some circumstances the to be larger – so with everything else
frequency circuits. In radio they can be dynamic range of the signal source equal (no change of volume control) the
used for AGC (automatic gain control) so is large enough to be problematical. perceived loudness increases. Record
that a radio receiver can adapt to varying Examples include situations where, if companies have increased compression of
signal strengths. In audio, they have a the quietest parts of the audio were at recorded music over the years to increase
number of specific uses, such as noise an acceptable level, then the loudest the perceived loudness of their product
gates and muting circuits, which reduce would be at dangerous levels to listeners (this is known as the ‘loudness wars’).
or modify the gain of an amplifier when or would cause excessive distortion in Unfortunately, this is often detrimental to
no signal is present to prevent noise amplifiers and speakers. Similarly, in the quality of the music, where dynamics
being very audible, or to cut the volume converting signals from analogue to are usually an important part of a good
of background audio (eg, music) when digital the analogue-to-digital converter listening experience. Similarly, the audio
a main signal is present (eg, a spoken will have a fixed dynamic range (from in adverts in many situations is often
announcement). They are used in music the least-significant bit to the maximum highly compressed and therefore sounds
synthesiser envelope shapers, which digital code value), which may be louder than other content.
control how the loudness of a note varies smaller than the
over time after is its played (eg, how dynamic range
long a note takes to fade after a keyboard of the source,
key strike). Another important use of again excessive
voltage-controlled amplifiers in audio distortion can
is in limiters and compressors, and this occur if the
what we will focus on this month because, converter’s
at least historically, this is an important maximum input
use of JFETs as electronically controlled level is exceeded.
resistors. Of course nowadays a lot of Another situation
modern audio processing is done using where audio
digital signal processing (DSP) hardware dynamics can
or software; nevertheless, it is interesting be a problem is
to consider how JFET-based circuits work. when switching
There are numerous ways to implement between different
voltage-controlled amplifiers other than sources (eg,
using JFETs as variable resistors, but here different speakers
we will stick with our current interest in conversation) Fig.1. Relationship between input and output levels for
in the JFET approach. w h e r e s o m e uncompressed, compressed and limited signals.
Fig.3. Gain of compressor against input level. Fig.4. Example compressor attack and release times.
Simulations
Fig.7 shows an LTspice schematic
which can be used to illustrate the
JFET resistance and potential divider
gain-to-gate-source voltage relationship
discussed above. The circuit applies a
constant 200mV DC voltage to the R1-
JFET potential divider and uses a DC
sweep simulation to plot the response
of the circuit for VGS values ranging from
−2.9V to −1.5V. The sweep range starts
at −2.9V as this is just above the JFET’s
threshold voltage (VT)
of the 2N3819, which
is −3V in the LTspice
model. The results are
shown in Fig.8. The
top trace shows the
resistance of the JFET
(calculated using drain-
source voltage (equals
V ( o u t ) ) divided by
drain-source current
(Id(J1)). The lower
trace shows the gain of
the potential divider
(V o u t / V ( i n ) ). We
Fig.9. LTspice circuit to investigate JFET potential divider gain with respect to compressor gain can see the reciprocal
control requirements. relationship between
both the JFET resistance
and the potential divider gain, and the
gate-source voltage above VT.
The LTspice circuit in Fig.9 has two
versions of the circuit in Fig.7. One is
basically the same as in Fig.7 and the
other uses a behavioural source to offset
the control voltage (JFET VGS) by 0.5V
with respect to the first. The sweep range
is extended with respect to Fig.7 to start
below the JFET threshold voltage.
The results for Fig.9 are shown in Fig.10.
The top plot simply shows the control
voltages to confirm the 0.5V offset between
them. The lower plot shows the potential
divider gain for the two circuits. The shape
of the curve is very similar to Fig.3 and
shows that if we apply a control voltage
to the JFET potential divider which is
proportional to the signal amplitude and
mapped onto a range appropriate for the
JFET, then we achieve the gain variation
characteristics required by a compressor
Simulation files
Fig.12. Simulation results for the circuit in Fig.11. Most, but not every month, LTSpice
is used to support descriptions and
circuit. By changing the DC offset of We can manipulate the characteristics analysis in Circuit Surgery.
the control voltage, we can modify the of the JFET potential divider by adding The examples and files are available
compressor threshold. additional resistors. This is illustrated for download from the PE website.
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
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 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
The techniques of electronic
project construction PRACTICALLY SPEAKING
The first section (80 pages) is dedicated to Circuit INGENUITY UNLIMITED
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 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
BA SE Mmag.co.uk
www.epe
ne Publishi
ng Ltd.
2011
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
L
ast month, we looked at some of the ways use precious metal brushes that wear more quickly. Literally
that we can turn electronic signals into physical move- hundreds of configurations of these motors are available,
ment. We covered DC motors and their use in linear with varying gear reductions, output shaft lengths and
actuators and RC servos. This month, we continue with gear configurations (eg, right-angles), stall currents and supply
and stepper motors. voltages. Output torque values can be over 50kg-cm.
Some motors are available with quadrature encoders (eg,
Gearmotors up to 64 counts per rotation) giving feedback of motor speed
Gearmotors are small DC motors that have a gearbox and/or direction.
mounted on one end. The gearbox reduces motor speed and If you intend using a gearmotor in a common application
increases torque, making the motors useful in a wide range (eg, turning a wheel on a model car or robot) then the cheapest
of applications where continuous rotation is required. Most approach is to buy a kit that comprises the motor, wheel,
of these motors use a D-shaped output shaft, so pulleys and coupling and mounting bracket (Fig.2).
wheels with a suitable female opening can be connected, with If you are after a large and powerful gearmotor, and are
or without set-screws (Fig.1). working to a strict budget, salvage a battery-powered electric
Micro metal gearmotors use a small motor (10 x 12mm drill. (The drills using old battery technology – eg, nickel-
cross-section) and exposed reduction gears. They are available metal hydride (NiMH or Ni–MH) batteries – are very often
in a very wide range of gearing – from 5:1 to 1000:1. ‘20D’ discarded.) Inside, you’ll find a brushed DC motor connected
gearmotors use enclosed gearboxes, with the assembly 20mm to an epicyclic gearbox (Fig.3). The assembly is easily removed
in diameter. Available ratios are from 29:1 to 154:1. Still more and connecting it mechanically to the output is easy – you just
gearmotors are available in 25mm and 37mm diameters with clamp a shaft in the chuck. These motor/gearbox assemblies
a wide variety of gear ratios. produce excellent torque, even at low supply voltages, thus
If you intend operating a gearmotor for long periods, ensure allowing them to be speed controlled over a wide range while
that you select one equipped with carbon brushes – some still having the grunt to operate real-world loads. The clutch
Fig.1. A gearmotor – note how the gearbox is attached directly to the Fig.2. A gearmotor, mounting bracket, coupling and wheel.
end of the motor, giving a compact assembly. The typical D-shaped Gearmotors are ideal for driving wheels on moving robots and similar
output shaft can be seen. This gearmotor is a 24V design that rotates – this gearmotor operates on 6V, draws a loaded 0.5A and rotates
at a no-load 25 RPM (150°/s). Cost is just £6. at 100 RPM. Cost is £11. (Courtesy Banggood)
fitted to many drills can even be used to in professional and hobby 3D printers separately monitored, or something like
protect the motor should the load stall. and CNC machines designed to machine a microswitch is used to establish a ‘start’
In summary, where continuous, high- wood, plastic or metal. They’re also position on a repetitive basis.)
torque rotation is needed, a gearmotor is used in printers, cameras and many The second major advantage is that
an excellent choice. The huge range and other consumer and industrial goods – a stepper motor has good low-speed
ready availability of couplers, mounts see Fig.5. torque. It can therefore get loads
and accessories also means that you Stepper motors have three major moving from a standstill better than
can assemble lots of different projects advantages over other actuators. The most other actuators, without needing
without any machining or complex first is that because they can be driven gearing. Finally, a stepper can be speed-
metalwork. However, keep in mind that in discrete steps, the position of the controlled accurately – the electronic
gearmotors are not ‘commercially rated’ output shaft can be determined with controller determines the required
– ball bearings are not used and there accuracy. That is, if the output shaft number of steps per second; making it
is no facility for easily oiling motors is rotated by – say – 50 steps, because essentially a frequency-based controller.
and gearboxes. the angular rotation is known for each While stepper motors are most often
step, the final shaft position can be used in applications where position or
Stepper motors accurately determined. (Note, though, speed are important, in many hobbyist
In contrast to the continuous rotation that this is open-loop control – there is applications stepper motors are also
achieved by DC brushed motors, stepper no position feedback built into a stepper useful when an ultra-durable motor is
motors – as the name suggests – are motor. To cater for this, most commercial required. Most medium and large stepper
driven in discrete steps, each step being users of stepper motors have systems motors are equipped with ball bearings
a small or very small fixed fraction of a where a variable being influenced (rather than plain bearings), and don’t
full rotation. Stepper motors are used by the action of the stepper motor is need commutator brushes, which wear
A
ctuator position feedback Door open Door closed Polarity
Fig.4. An easy way
can quickly get quite complex. reversal to automatically
Usually, a microcontroller is M switch off a DC
needed – and it will typically need to motor’s power in ‘fully
+
opened’ and ‘fully
run PID software to do a good job. But
closed’ positions.
what if you simply want a DC motor
to turn off when a certain position is – door, simply swap
reached? In that case, you can use the the polarity of the
approach taken in linear actuators. Let’s motor feed. The
look at this more closely – it’s elegant diode associated
and simple. with the ‘door open’
Let’s imagine we want to turn off an microswitch will
actuator when a door is fully opened or allow the current to
closed. Two normally closed (NC) series bypass the switch,
microswitches are used in the power so causing the
feed to the actuator motor, with their actuator to move
Red microswitches open Both microswitches closed Green microswitches open
levers or buttons arranged so that one in reverse. When
switch is opened when the door is fully When you want to open the door, the door fully closes, the same thing
open, and the other switch is opened you feed power to the circuit. Then, happens, but this time it’s the ‘door
when the door is fully closed. Across when the door has fully opened, the closed’ switch that opens to stop power.
each microswitch is wired a parallel microswitch cuts off power to the Note that the diodes must be rated for
diode, oriented cathode to cathode. motor. When you wish to close the the current requirement of the motor.
Fig.7 This standalone programmable controller is a very easy way of getting a stepper Solenoids
motor up and running. Speed, direction and rotational angle can all be set, and the module
Where an actuator with a short, low force
has the ability to store nine programs that can be run automatically in sequence.
and linear movement is needed, a solenoid
is the cheapest and easiest option.
in step count (eg, 200 steps/revolution) or indirectly as the A solenoid consists of a coil wound around a hollow former.
degree of rotational change for each step – so 1.8° in this case. Positioned partly inside the former is an iron plunger. When
(360° / 200 steps = 1.8° per step.) Common step counts are 24, power is fed through the coil, the plunger is pulled fully into the
48 and 200. Other stepper motor specifications include voltage, former. As this movement occurs, a coil spring is compressed.
current draw per phase and holding torque. For example, a When power is switched off to the coil, the spring returns the
NEMA-17-size stepper may have the following specs: 1.7A plunger to its previous position.
per phase at 2.8V and a holding torque of 3.7kg/cm. (See last Solenoids move very quickly, so they can place high
month’s issue for more on torque.) Note that maximum current instantaneous loads on whatever they are moving. They also
flow occurs when the stepper is in the ‘hold’ position. tend to be noisy when triggered, though of course when they’re
There is a range of stepper motor electrical configurations in fully open or closed positions, they don’t make any noise
resulting in 4-wire, 6-wire and 8-wire motors. These can be at all. Solenoids are specified for:
driven in different ways – eg, series and parallel, unipolar and n Operating voltage
bipolar, normal stepping and micro stepping. (For a detailed n Continuous current draw (but note that peak current draw
coverage of different stepper motor driving techniques, on switch-on will be much higher)
refer to Using Stepper Motors Parts 1-5, PE, October 2019 – n Maximum pull value (usually in newtons).
February 2020.)
If you are using a stepper motor in a critical positioning or Most solenoids are rated for continuous duty – that is, they can
speed application, I suggest that you buy a suitable stepper be held in their pulled-in position with a constant supply of
motor for your application and also buy the supplier’s power. Note that solenoids work equally happily on AC or DC.
recommended controller. There’s a lot of difference between Ensure that any solenoid you source has a plunger design
just making a stepper motor rotate – and having it rotate a to which it’s easy to make a mechanical connection. Many
repeatable number of steps with high torque. Of course, many solenoids have a forked end to the plunger, allowing connection
commercially available projects that use stepper motors (eg, of links via a simple pin, or screw and Nyloc nut. Solenoids
3-axis router and mill kits) take this approach, with the motors, are widely available at low prices and old tape recorders –
controller software and interface all provided. both audio and video – usually have a selection of solenoids
On the other hand, if all you want to do is rotate a stepper, and that can be salvaged.
you won’t destroy precious materials if it gets it slightly wrong If you’re using a transistor or similar to drive a solenoid,
(or you’re happy to tweak the control system to get the results remember that you will need to fit a freewheeling diode –
you want) then microcontroller stepper motor control boards, solenoids create a big inductive spike on switch-off.
and standalone low-cost stepper motor controllers, are widely Solenoids are ideal for applications like door and cabinet
available. For example, the Banggood / AliExpress ‘DC8V-27V locks, but they can also be used to raise visual indicators
Programmable Stepper Motor Driver Controller Board Step (your mail has just been delivered!) or to automate mechanical
/ Angle / Direction / Speed / Time Adjustable 42/57 Phase’ handles and pull-knobs.
Conclusion
If you wish to develop a mechanical system that is electronically
controlled, your options have never been better. There are now
plenty of low-cost electronic controllers available, and there’s
a vibrant retail sector selling mechanical parts. However, the
success or otherwise of your project will rest heavily on the
actuator(s) you choose and how you drive them.
For high speed and low torque applications, a simple
brushed DC motor directly driving the load (eg, a fan) works
well. If the torque requirement is high (eg, driving a winch
or hill-climbing wheeled robot) then a gearmotor is cheap
Fig.8. A typical general-purpose solenoid with a spring return. This and effective. For really high torque loads, look towards
one is for use on 12V, with a continuous current draw of 2A and a something like a car windscreen wiper motor. If the required
maximum pull of 20N (about 2 kg force.) Cost is low – only about £4. motion is in a straight line, a linear actuator will give
W
hen using linear actuators airbrake, one that rises very fast when rise as fast as possible. So what about
(see last month’s issue) and the driver puts their foot on the brake using a lever to increase the speed of
solenoids, levers are especial- pedal. (An air brake creates a lot of movement? If we put the actuator and
ly important. Levers trade higher speed aerodynamic drag and thus slows the the lever’s fulcrum (pivot point) close
and stroke for greater required actuator car very rapidly at high speeds – and together, with the load at the other
force, or vice versa – less required actu- all without any concern around tyre end of the lever, we will turn a slow
ator force for slower speed and reduced skidding on the road or track.) actuator movement into a faster one
stroke. (If this sounds familiar, it’s just From what we’ve learned here, an (Fig.8). But, at just the same rate as the
the same as gearing. Gearing comprises airbrake’s up/down movement would increase in speed, we will also increase
continuously rotating levers.) be best accomplished by a linear the force the actuator has to exert.
So, and just for a moment putting actuator – high force and when power So let’s say a linear actuator extends
on my other hat as an automotive is removed, it locks itself into position. fully over 5 seconds, and we want to
modification writer, let’s say we want However, these actuators are quite arrange a lever to make the airbrake
to create a racing car aerodynamic slow – and we’d want an air brake to extend fully in just 0.2 seconds. That’s
a 25:1 ratio – so the force on the linear
Fulcrum actuator goes up by just the same
A
Lever ratio. Hmm…, it depends on speed
B and air brake area, but let’s say that
at full deployment, the airbrake has a
force acting on it of 300N (that is, the
force that is trying to close it). 300N
multiplied by 25 = 7500N! In reality,
the required force won’t be quite as
high as this (because at any angle less
Linear actuator
than full deployment, the air brake will
exert less force) but the back-of-the-
envelope calculations quickly show
that no normal linear actuator is going
Fig.10. A trial rear aerodynamic air to meet the requirement. (In fact, in this
brake on a road car. When braking, the situation, I used a pneumatic cylinder
panel between the side fins was rapidly backed by a lot of air pressure. It didn’t
raised through about 80 degrees. The quite meet the force requirement, but
speed of the required erection, and it came close.)
Fig.9. By using a lever, we can increase the forces involved, meant that no off- So, while levers are very effective
the stroke and speed over which a linear the-shelf electrical actuator could do it
actuator works – distance B will be larger in mechanical situations of the sort
– no matter the leverage applied. But
than distance A, with both achieved in the we are describing, remember that you
a pneumatic cylinder (arrowed) could.
same time. But you can’t get something And the result? At very high speed the can never get something for nothing
for nothing – the force that the linear brake was excellent – but unfortunately, – there will always be a trade-off in
actuator needs to develop increases in at legal speeds, it was rather weak. Oh, terms of speed/stroke or required
direct proportion. if only to drive every day in Germany… actuator force.
O
ne of the things that Thinking about this caused me to re- Analogue magic
never ceases to amaze me is visit the gears forming the gear train in I’ve noticed that my meandering mus-
how little I know and how the simple servo my friend Steve Manley ings seem to be stirring up a lot of reader
much I have yet to learn. In an ear- dismantled and modelled (Fig.1). The memories. In my previous column (PE,
lier column (PE, September 2022) I 8:32 ratio between stages 2B and 3A im- October 2022), for example, I touched
waxed eloquently about the topic of mediately caught my eye, so I emailed on the topics of using mercury delay
servo motors and their gears and gear Peter back asking: ‘Re your point about lines and magnetic core stores for early
trains. As part of this, we noted that, gear wheels not having common denom- digital computer memory subsystems.
although some people – especially inators with respect to the number of This prompted a retired physicist and
in the UK – informally refer to gears their cogs. In the servo we broke down software engineer (just call me ‘Jim’) to
(a.k.a. gearwheels) as ‘cogs,’ the term in the September issue, we do have an email me saying: ‘Hi Max, I just read your
‘cog’ officially denotes an individual 8 to 32 cog transition between 2B and latest Cool Beans article and enjoyed it
tooth on a gear. 3A (Steve just recounted the cogs to as always. I have an interesting anec-
make 100% sure), so is this the excep- dote to share with you. Way back in the
The wheels are turning tion that proves the rule?’ 1980s I was doing my PhD at Warwick
Following that column, I received an Peter responded saying that this was University using a clapped-out Auger
email from retired mathematician, physi- indeed an unfortunate ratio, adding: ‘The electron spectrometer that I mostly had
cist and engineer Peter Brearey, who said: 10:38 ratio between 1B and 2A also is to rebuild, often from scratch, and that
‘One point you did not mention (and not so good. It would have been better used exclusively analogue electronics.
evident in the example gear train you to use 11:38 for 1B and 2A then 8:33 for It was connected to an equally clapped
showed) is that the ratio should have no 2B and 3A. But in this instance, it is un- out GEC4080 mainframe that used core
common factors such that each cog on likely users would dis-assemble the gear memory, a primitive analogue-to-digital
one gear wheel will interact with every train then re-assemble it later; also, the converter for signal measurement, and
cog on the coupled gear wheel to ensure wheels are plastic, so they would easily an equally primitive digital-to-analogue
even wear and to allow the gear train re-profile themselves provided they were converter for control of the spectrome-
to be dis-assembled and rebuilt with- made to a reasonably close tolerance. It ter. One day, halfway through a lengthy
out problems of binding and ill-fitting.’ is just that the more precision you want, experiment, we had a complete power
As soon as I read this I thought, ‘that the greater the need for gear ratios to have cut for about 15 mins. Of course, all the
makes perfect sense.’ It also struck me no common factor. A tolerance of 1/100 equipment and computers, including
that this probably wasn’t something I is less onerous than 1/1,000 or 1/10,000. the GEC went down. When the power
would have thought of for myself. A lot It is horses for courses, and where wear came back up, the BBC Micro in our lab
of this sort of thing was conceived in and/or breakage can be best tolerated. promptly proceeded to format both its
the distant past when mechanical engi- And for mass production, cost and re- floppy disks, and all of the (then) fancy
neering and steam-powered machines usability of parts and ease of assembly digital equipment either rebooted or
dominated the technological landscape. without errors is important (notice the hung in some obscure state. My equip-
It makes me realise that our engineering colouring of the wheels). Mass produc- ment powered up perfectly and took its
predecessors knew a lot of stuff about tion compared with a one-off hand-tuned next data point as though nothing had
a lot of stuff. item is like comparing chalk to cheese.’ happened. So, analogue electronics +
core memory = magic. Actually, this
Shaft Gear # Teeth Ratio incident opened my eyes, because this
is how all electronics should work, and
Input Input 9 will work in the future as soon as we
1A 47 5.2222 get truly persistent memory.’
Intermediate Jim went on to say: ‘One of my lec-
1B 10
turers at Warwick told me the follow-
2A 38 3.8000 ing story about mercury delay lines. He
Output was working on one of the first comput-
2B 8
ers and they had a long delay line that
3A 32 4.0000 was a glass tube filled with mercury
Intermediate that stretched right across the lab. They
3B 7
built a comfy bench over it to protect
it and so they could sit down. Immedi-
Output Output 23 3.2857 ately they noticed random bugs. Those
old computers depended entirely on
Fig.1. Summary of servo gear train. the time of flight of pulses down the
delay line, and they eventually figured abandoned ruins or hidden components control room in André’s photograph
out that whenever someone sat on the of the manmade environment. Although positively projects panache.
bench, their backside warmed the mer- targets of exploration vary from one
cury up just enough to slow the pulses country to another, high-profile aban- I’m as sick as a parrot
and introduce a bug.’ donments include amusement parks, Speaking of parrots (we weren’t, but
He closed by saying: ‘Sometimes I grain elevators, factories, power plants, we are now), in my previous column
long for the days when a power switch missile silos, fallout shelters, hospitals, we experimented using two 2-axis joy-
was a switch rather than a negotiation.’ asylums, prisons, schools, poor houses sticks to control two pan-and-tilt servo
I have to say this latter point brought a and sanatoriums. mechanisms. Since we were feeding the
wry smile to my face because I’m cur- I don’t know why, but I love wander- signals from the joysticks directly into
rently doing some work with switches ing round old buildings like factories an Arduino Uno, this required four of
myself and I know just what Jim means. and power plants. I also love seeing the Uno’s analogue input pins. Similar-
pictures of these things. Maybe it’s my ly, since we were driving the servos di-
I’m as happy as a clam interest in post-apocalyptic science fic- rectly from the Uno, this required four
In earlier columns I made mention of tion stories. The main thing is that I’m of its pulse-width modulated (PWM)-
the fact that I was heading out to Trond- not alone, because a lot of other people capable digital output pins.
heim in Norway at the beginning of are also interested in this sort of thing. In the case of the animatronic head cre-
September. While there, I gave a guest One of my heroes in this area is André ated by Steve Manley with (occasionally
lecture to the Embedded Computing Joosse, who hails from the city and mu- useful) suggestions by your humble nar-
students at the Norwegian University nicipality of Goes in the southwestern rator (PE, March, April, and May 2022),
of Science and Technology (NTNU). I Netherlands on Zuid-Beveland, which we have two 3-axis joysticks and seven
also gave the keynote presentation at is in the province of Zeeland. André’s servo motors. Your own projects (and
the FPGA Forum, which is the place to website boasts myriad awesome urbex our future projects) might boast many
‘see and be seen’ if you have anything photos (www.urbex.nl). One of my fa- more control inputs and servo outputs.
to do with FPGAs in Norway and nearby vourites, which André kindly gave me As result, in this column I was origi-
countries. I’m happy to report that both permission to share with the students nally planning on talking about using I2C-
of my talks went down rather well (well, and with the readers of PE, is of an aban- based analogue breakout boards (BOBs)
no one threw anything at me, which I doned power plant in Hungary (Fig.2.). to gather the signals from multiple ana-
always take to be a positive sign). If In the case of the students, I used this logue inputs, along with I2C-based servo
you are interested, you can learn more as the lead-in to talk about old display controller BOBs, each of which can con-
about these talks by bouncing over to technologies. For the purpose of our trol 16 servo motors. The result would
https://bit.ly/3BlWJTr and https://bit. discussions here, however, I just want allow us to monitor large numbers of
ly/3xvOZx3, respectively. us to feast our orbs on this bodacious analogue inputs and control large num-
One of the things I shared with the beauty. To be honest, words fail me. bers of servo motor outputs using just
students is the concept of ‘urbex’ (urban A lot of what we build these days is a two pins on our microcontroller.
exploration), which refers to the explo- ‘tribute to concrete’ and lacks even the The reason I’m not, in fact, talking
ration of manmade structures, usually rudiments of style. By comparison, the about this is that I’m currently feeling
A B
B
00 10 11 01 00 A g1 0 0
Clockwise
Rotation g2 1 0
B g3 1 1
00 10 11 01 00 10 11 01 00 g4 0 1
Clockwise Rotation
A g1 g4 g3 g2 g1 g4 g3 g2 g1
B A B
00 01 11 10 00
A g4 0 1
Anticlockwise
Rotation g3 1 1
B g2 1 0
Anticlockwise Rotation 00 01 11 10 00 01 11 10 00 g1 0 0
Fig.3. Conceptual working of rotary incremental quadrature encoder. Fig.4. The leading signal is used to determine the
direction of rotation.
as sick as a parrot. I’m not sure as to the I’d show you a picture of my anima- I feel like an old fool (but where are
origin of this phrase. Some sources say tronic noddle, but I don’t want to make we going to find one at this time of the
that it derives from the fact that some you cry. Fortunately, as you may recall, day?). The reason I say this is that I’ve
parrots will feed on fermenting (alco- Steve very kindly made his 3D design files come to the realisation that I largely
holic) fruit and end up suffering from a available for use by anyone who wants to meander my way through life without
hangover. I also read that Aphra Behn, create their own animatronic masterpiece. really noticing anything that’s going on
who was an English playwright, poet, You can download a compressed ZIP (file around me. My wife (Gina the Gorgeous)
prose writer and translator from the CB-May22-01.zip) containing these design has said this about me for years. Earli-
Restoration era, started the ball rolling files from the May 2022 page of the PE er today, for example, she proclaimed,
in her 1682 comedy, The False Count, website (https://bit.ly/3oouhbl). So, that’s ‘You haven’t been listening to a word
in which the maid Jacinta says of her just what I’m going to do, thereby restor- I’ve said!’ And I thought, ‘Well, that’s
mistress Julia, ‘Lord, Madam, you are ing my precious pate to its former glory a strange way to start a conversation.’
as melancholy as a sick Parrot.’ (watch this space for more details). Recently, someone asked me a question
Whatever the source of this expres- about switch bounce in the context of
sion, I’m certainly not wearing my happy Ravishing rotary encoders digital rotary encoders. At first, I thought
face. When Steve and I first commenced A few months ago, I read the biography we were talking about rotary switches,
work on our animatronic noggin project, of Leonardo da Vinci by Walter Isaac- but it turned out that the topic in hand
I visited the workshop of my friend ‘Car- son (https://amzn.to/3xvzbu6). One of was something completely different.
penter Bob’ and constructed a couple of the things I learnt was how Leonardo Consider the volume control on a car
small wooden testbenches to hold my had the ability to notice ‘stuff.’ For ex- radio, for example. In the not-so-distant
joysticks and servos (PE, March 2022). ample, I’ve looked at a lot of trees in my past, this would have been implemented
Meanwhile, Steve set to work creating time without thinking anything more using a potentiometer (variable resistor)
his 3D-printed masterpiece. profound than ‘That’s a pretty tree.’ By with a fixed range of rotation. More re-
When Steve’s far superior realisation comparison, Leonardo whipped out his cently, this control will be implemented
was finished, he kindly built one for me, tape measure and determined that the using a rotary encoder that has a tactile
which resulted in my proudly ‘holding sum of the cross-sectional areas of tree ‘click-click-click...’ feel as you rotate it.
my head in my hands’ (PE, May 2022). branches above a branching point is equal One point of interest here is that there
A few days before setting off to Norway, to the cross-sectional area of the trunk are no ‘end stops’ per se; that is, you can
since I had occasion to go downtown, (or the branch) immediately below that keep on rotating these things clockwise
I decided to take my fully-fledged ani- branching point. Genius! or anticlockwise to your heart’s desire.
matronic head to Bob’s workshop to
show him how our original prototype
had evolved.
It has to be said that Bob was duly
impressed, proudly presenting it to
anyone who visited his workshop while
I was there. However, when I returned
to my office, I foolishly left my head in
the trunk (boot) of my car (and that’s
not something you expect to hear your-
self saying on a regular basis). I really
didn’t think anything about the weath-
er, but it turned out that the outside
temperature tickled 100°F (~38°C) later
that afternoon.
The reason for my frowny visage is
that, when I returned home and went
to retrieve my head, I discovered that
it was a sadly drooping incarnation
of its earlier self, strangely reminis-
cent of Salvador Dalí’s melting clocks
in The Persistence of Memory – see:
https://bit.ly/3BOHJPu Fig.5. 30-click (top), 20-click (middle), and 20-click (bottom) (Image: Joe Farr).
I must admit that I had vaguely no- to ground (logic 0). Also, we can visu- A, then the mechanism is rotating an-
ticed these characteristics in my own alise the white areas as not being con- ticlockwise (Fig.4).
car, but I never paused to ponder this nected to anything, which will let the When you see these diagrams, things
phenomenon in more depth (I bet Leon- pull-ups on the A and B signals pull do look relatively easy, don’t they? It’s
ardo would have caught onto this im- them to logic 1. As a result, the A and true that my own knee-jerk reaction was
mediately). It turns out that these little B signals are 90° out of phase. In turn, to think that all we had to do was con-
rascals are being deployed everywhere. this results in four ‘Gray code’ (https:// nect the A and B signals to two digital
In my car, for example, there are two on bit.ly/pe-nov22-gray) combinations of inputs on a microcontroller – let’s say an
the radio (volume and tuning) and three A and B that we might label g1, g2, g3, Arduino Uno to keep things simple – and
on the air conditioning system alone. and g4. If A leads B, then the mecha- ‘Bob’s your uncle’ as they say (or aunt,
After a little investigation, I discov- nism is rotating clockwise. If B leads depending on one’s family dynamic).
ered that there are all sorts of these little
scamps. Let’s start with the fact that there
two main types, which we can class as
absolute and incremental. A digital ab-
solute encoder produces a unique digi-
tal code for each distinct angle of the
shaft. By comparison, an incremental
digital encoder will report changes in
position, but it will not report or keep
track of absolute position.
The encoding for both types can be
implemented using mechanical, opti-
cal, magnetic or capacitive technolo-
gies. For the purposes of these discus-
sions, we are focusing on mechanical
incremental quadrature digital encod-
ers because these cheap-and-cheerful
devices appear all over the place. Also,
there are lots of examples available on
Amazon for use with hobby projects, see:
https://amzn.to/3di9mHf
Fig.8. 30-click device: a) (top) turning the knob one click anticlockwise; and then b) again. Let’s get testing
We’ll start with one of our 30-way devices.
In this case, we started with both A (top)
Not so simple were. What this means is that if the A and B (bottom) being 11; had the knob
Of course, nothing in life is simple. I was and B outputs start at 11, then after one been rotated one click in either direction,
chatting to my friend Joe Farr, who hangs ‘click’ in any direction they will end up however, they would have commenced
his hat in the UK, and he mentioned that at 00. Another click will result in them at 00. Turning the knob one click clock-
he’s had some non-intuitive experienc- being 11 again. Remember that it’s the wise resulted in the waveforms shown
es with rotary encoders in the past. As signal that changes first that’s used to de- in Fig.7a, ending up with A and B at 00
a result of our discussions, we both or- termine the direction of rotation. (A transitioned first). Turning the knob
dered a bunch of different encoders and Now consider the first 20-click device, one more click clockwise resulted in the
dismantled them to see what was inside. which has 20 mechanical indentations waveforms shown in Fig.7b, ending up
Give me strength – each one was imple- (Fig.5 middle). In this case, the encod- with A and B back at 11 (again, A tran-
mented in a different way (see Fig.5)! ing disk also has 20 ‘spokes.’ As a result, sitioned first).
You may remember my saying that the A and B outputs always start with a Similarly, turning the knob one click
these encoders have a tactile ‘click-click- value of 11. Following a click, they will anticlockwise resulted in the waveforms
click...’ feel as you rotate them. This end up back at 11 again, but they will shown in Fig.8a, ending up with A and
is implemented by mechanical means have passed through the intermediate 10, B at 00 (B transitioned first). Turning
using small indentations in the casing. 00, 01 (or 01, 00, 10) values on their way. the knob one more click anticlockwise
The result is that the switch settles into Once again, it’s the signal that changes resulted in the waveforms shown in
a specific state following each click. first that’s used to determine the direc- Fig.8b, ending up with A and B back at
Let’s start with the 30-click device, tion of rotation. 11 (again, B transitioned first).
which has 30 mechanical indentations Finally, take a look at the second 20- Next, let’s look at one of the 20-way
(Fig.5 top). Joe has highlighted the click device, which also has 20 me- switches. In this case we always start with
common signal and the A and B signals chanical indentations (Fig.5 bottom). the A and B signals in a 11 state. Turn-
in red. The A and B contacts are slight- This one really made us scratch our ing the knob one click clockwise resulted
ly staggered (offset), thereby resulting in heads for a while. Let’s start with the in the waveforms shown in Fig.9a, with
the quadrature encoding. Of particular blue plastic piece on the left. In this A (top) and B (bottom) passing through
interest here is the fact that the encod- case, the big area of metallisation is the 10, 00, and 01 states, ending up with
ing disk itself has only 15 ‘spokes,’ as it connected to the common pin in the A and B returning to 11 (B transitioned
Bouncy bouncy!
I’m afraid I haven’t told you the whole
story (I rarely do). The waveforms I’ve
shown thus far have been relatively
clean noise-wise, but some of these de-
vices can be incredibly bouncy, and any
bouncing increases with the speed of ro-
tation (Fig.10).
In particular, observe the bouncing in
the middle of the screen. It’s bad enough
if the A and B signals are bouncing in iso-
lation, but it can be a pain in the nether
regions if they are bouncing together.
It’s easy to see how someone’s software
could get confused by this sort of thing.
In fact, thinking about this caused me
to pop out to my 2019 Subaru and start
playing with the rotary encoder volume
control on its radio. When you turn the
knob, a graphical display appears on the
screen representing the current volume
Fig.9. 20-click device: a) (top) turning the knob one click clockwise; and then b) (bottom) level. Each click of the knob results in
turning one click anticlockwise. a coloured segment being added to or
subtracted from the display.
I’ve never really looked at this closely
before. If I turn the knob clockwise the
volume goes up; if I turn the knob anti-
clockwise the volume goes down. How-
ever, now that I’m paying close attention,
I observe that things are not always as ex-
pected. Most of the time, slowly rotating
the knob ‘forward’ one click, for exam-
ple, causes a segment to be added to the
display (and the volume to increase) as
expected. However, sometimes we jump
‘backward’ one ‘click equivalent’ on the
display and the volume goes down, or
we jump ‘forward’ two ‘click equivalents’
on the display and the volume rises ac-
cordingly (‘Curiouser and curiouser,’
said Alice).
All of this tells me that the people who
wrote the software for my car had not
performed the same level of evaluations
Fig.10. The mechanical contacts in rotary encoders can bounce. as Joe and your humble narrator. Follow-
ing on from this, they hadn’t come up
Cool bean Max Maxfield (Hawaiian shirt, on the right) is emperor with the same cunning solution to this
of all he surveys at CliveMaxfield.com – the go-to site for the problem as have Joe and yours truly.
latest and greatest in technological geekdom. However, that’s a story for another day.
As always, I welcome your comments,
Comments or questions? Email Max at: [email protected]
questions, and suggestions.
PCBs for most recent PE/EPE constructional projects are available. From the July 2013 issue onwards, PCBs with eight-digit codes
have silk screen overlays and, where applicable, are double-sided, have plated-through holes, and solder mask. They are similar to
photos in the project articles. Earlier PCBs are likely to be more basic and may not include silk screen overlay, be single-sided, lack
plated-through holes and solder mask.
Always check price and availability in the latest issue or online. A large number of older boards are listed for ordering on our website.
In most cases we do not supply kits or components for our projects. For older projects it is important to check the availability
of all components before purchasing PCBs.
Back issues of articles are available – see Back Issues page for details.
All prices include VAT and UK p&p. Add £4 per project for post to Europe; £5 per project outside Europe.
rders and ay ent should e sent to
Practical Electronics, Electron Publishing Ltd
113 Lynwood Drive, Merley, Wimborne, Dorset BH21 1UU
Tel 01202 880299 Email: [email protected]
On-line Shop: www.epemag.com
he ues should e ade aya le to ractical lectronics (Payment in £ sterling only).
NOTE: ost oards are in stoc and sent ithin seven days o recei t o order lease allo u to days delivery i e need to restoc .
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
CRICKLEWOOD ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . 36 Advertisement offices
ESR ELECTRONIC COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . 41 Matt Pulzer
HAMMOND ELECTRONICS Ltd . . . . . . . . . . . . . . . . . . . . . . . . . . 10
iTP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cover (iv)
Electron Publishing Ltd
JPG ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
1 Buckingham Road
MICROCHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cover (ii)
Brighton
PEAK ELECTRONIC DESIGN. . . . . . . . . . . . . . . . . . . . . . . . . . . . 25 East Sussex BN1 3RA
POLABS D.O.O.. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 29 Tel 07973 518682
QUASAR ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Email [email protected]
SILICON CHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5
STEWART OF READING. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 55 Web www.electronpublishing.com
TAG-CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 41
TERRINGTON COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . 15 For editorial contact details see page 7.
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 3 November 2022
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
tswor
th
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: £29.99 (6 months); £54.99 (12 months); £104.99 (2 years). EUROPE: airmail service, £33.99 (6 months); £63.99 (12 months);
£119.99 (2 years). REST OF THE WORLD: airmail service, £41.99 (6 months); £77.99 (12 months); £149.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.
and compressors
Audio Out Electronic
nics
Using JFETs limiters Using audio Building Blocks
Make it’swith
CircAdding
transformers Using actuatorsJFE TFT
Ts as e
contro
preMicromite
lectro
ry
n
mier eleand
a PS/2 keyboard
uit display
Surge to a PicoMite
ica A u
ctronic
d io O
s and
compu
ting ma
lled re ker ma
sistors lly Using a ut Kick
transfo udio L
St a r t gazine
rme ow-vo M ake
WIN! rs op am ltage it
Buildin with Micro
Microchip ps g mite
PicoM GPS into
AVR-IoT ite syste
Cellular Mini
ms
WIN! WIN!
Micro
MPLAB chip
In-CircSnap
Debug uit
Build a WIN!
ger
Pream
Self-Contained 6GHzwith D plifier
Digital Attenuator Tone igital Touc B uild
a
/ Volu h
me Co screen tracke GPS
PLUS!
PLUS! n2022
Nov trol£5.49
s th e P i r w i th
Techno Talk – Hidden hazards
Te hn 11 coMite
Cool Beans – Investigating rotarycencoders
o Talk
–S
Cool B
Net Work – Technology and the Queen eans – olar flares –9 772632 573023
Net W L time to
ork – W ixie displays panic?
www.electronpublishing.com @practicalelec and m
hole-h practicalelectronics
www.e ome me agnet Oct 20
lectro sh wire ic core 22
npubli less sy memo £5.49
shing stems ry
.com 10
@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
innovative Technology Projects
USB OSCILLOSCOPES