May24 Int
May24 Int
Electronics
The UK’s premier electronics and computing maker magazine
Circuit Surgery Teach-In 2024 Audio Out
Topics in digital signal Analogue input and output with Designing
processing – sampling the ESP32 SoC microcontroller discrete buffers
Dual RF Amplifier
GPS-Disciplined
Oscillator
Mastering
the UVM-30A
UV Sensor
Teach-In 2024
Learn to use
the ESP32 Songbird: an ideal
beginner’s project
PLUS!
Techno Talk – One step closer to a dystopian abyss? May 2024 £5.99
05
Cool Beans – Arduino: 7-segment display delights
Net Work – Electric cars, Moon-shot missions and more 9 772632 573030
Sysblocks
www.flowcode.co.uk
Practical
Volume 53. No. 5
May 2024
ISSN 2632 573X
Electronics Contents
Projects and Circuits
GPS-Disciplined Oscillator by Alan Cashin 16
This GPS-Disciplined Oscillator is mostly built in software, so it only requires a PIC,
an oven-conditioned crystal oscillator and a few other supporting parts. It provides an
extremely accurate 10MHz signal with an error in the parts per billion range.
Dual RF Amplifier by Charles Kosina 26
This small RF amplifier has two outputs with individually selectable gains. This makes
it suitable to add to a signal generator to provide a higher output level, or for better
drive strength, or ‘fanning it out’ to multiple other pieces of equipment and more.
UVM-30A Module Ultraviolet Light Sensor by Jim Rowe 29
This UV light-sensing ‘breakout’ module detects the intensity of UV solar radiation and
hence the degree of protection you may need to prevent skin damage. If you connect it
to an Arduino or other microcontroller, it can even indicate the current ‘UV Index’.
Songbird by Andrew Woodfield 33
Here’s a decades-old design brought up to date in a new package and made to appeal
to beginners as well as experienced builders. It’s quick and easy to build and a great
project if you’re new to electronics.
The Wireless for the Warrior books are a the introduction of VHF FM and
source of reference for the history and hermetically sealed equipment.
development of radio communication
equipment used by the British Army Volume 3 covers army receivers from
from the very early days of wireless up 1932 to the late 1960s. The book not
to the 1960s. only describes receivers specifically
designed for the British Army, but also
The books are very detailed and include the Royal Navy and RAF. Also covered:
circuit diagrams, technical specifications special receivers, direction finding
and alignment data, technical receivers, Canadian and Australian
development history, complete station Army receivers, commercial receivers
lists and vehicle fitting instructions. adopted by the Army, and Army Welfare
broadcast receivers.
Volume 1 and Volume 2 cover
transmitters and transceivers used Volume 4 covers clandestine, agent or ‘spy’
between 1932-1948. An era that starts radio equipment, sets which were used by
with positive steps taken to formulate special forces, partisans, resistance, ‘stay
and develop a new series of wireless sets behind’ organisations, Australian Coast
that offered great improvements over Watchers and the diplomatic service. Plus,
obsolete World War I pattern equipment. selected associated power sources, RDF and
The other end of this timeframe saw intercept receivers, bugs and radar beacons.
01202 087631
Circuit Surgery MitchElectronics Audio Out Circuit Surgery MitchElectronics Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out Circuit Surgery Teach-In 2024 Audio Out
Mixing and tuning in the Our new series on electronics Discrete op amp Demodulation in the Our new series on electronics Designing LTspice 17.1 and Frequency A new series on learning electronics Designing LTspice 24 update and Digital input and output with Designing Topics in digital signal Analogue input and output with Designing
superheterodyne receiver basics for beginners: using the 555 update superheterodyne receiver basics for beginners: op amps discrete buffers Response Analysis with the ESP32 SoC microcontroller discrete buffers Frequency Response Analysis the ESP32 SoC microcontroller discrete buffers processing – sampling the ESP32 SoC microcontroller discrete buffers
www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics www.electronpublishing.com @practicalelec practicalelectronics
Take out a one-year subscription and save more than £10 over the year.
Even better – save over £1 per issue if you subscribe for two years – a total saving of £26.
Electronics
Rest of the World £46.99 (Airmail)
1 Year: UK £59.99, Europe £69.99 (Airmail),
Rest of the World £84.99 (Airmail)
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
$1150* NZ $1290
05
INC GST
INC GST
Australia’s
International Airsho
All the newest tech
in Avalon Airpor
w
t
• Combined subscriptions include both the printed magazine and online access.
Wideband
• Prices are in Australian dollars (AUD) unless otherwise specified. Fuel Mixture Display;
• Prices listed are for everywhere in the world except Australia and New Zealand. April to June 2023
View siliconchip.com.au/Shop/SubRates for a full list of current prices.
• Price estimates are just that and should only be used as a guide, we primarily
take payment in the form of Australian dollars.
Silicon Chirp;
April 2023
Try our Online Subscription – now with PDF downloads!
An online issue is perfect for those who don’t want too much Advanced SMD
clutter around the house and is the same price worldwide. Test Tweezers;
Issues can be viewed online, or downloaded as a PDF. February & March 2023
Electronics Editorial
Editorial offices
Practical Electronics Tel 01273 777619 Welcome to May!
Electron Publishing Limited Mob 07973 518682 ‘Spring is sprung,’ well nearly, and what better way to welcome
1 Buckingham Road Fax 01202 843233
Brighton Email [email protected] in the new season than with a little inspiration from a Songbird
East Sussex BN1 3RA Web www.electronpublishing.com – in this case an electronic one. This month’s avian project is just
Advertisement offices
one of four to keep you busy with a soldering iron. Our silicon-
Practical Electronics Adverts Tel 01273 777619 based warbler is an ideal beginner’s circuit. It contains no SMDs
1 Buckingham Road Mob 07973 518682 or tricky construction techniques, and a very pleasing result can
Brighton Email [email protected]
East Sussex BN1 3RA be obtained in just a few hours of productive work. It would be
ideal for a youngster who wants to build their first electronic
Editor Matt Pulzer
General Manager Louisa Pulzer
project, ideally under supervision from someone with experience
Digital subscriptions Stewart Kearn Tel 01202 880299 of using the necessary tools.
Online Editor Alan Winstanley
Web Systems Kris Thain
Publisher Matt Pulzer For those of you with more experience, the Dual RF Amplifier
and GPS-Disciplined Oscillator (GPSDO) provide very useful
Print subscriptions
Practical Electronics Subscriptions
testbench circuits that you will likely use again and again.
PO Box 6337
Bournemouth BH1 9EH Tel 01202 087631 Last, but not least, we welcome the return of Jim Rowe’s excellent
United Kingdom Email [email protected]
overviews of cheap sensors and modules. This month, he
Technical enquiries provides a handy explanation of a low-cost UV sensor module.
We regret technical enquiries cannot be answered over the
telephone. We are unable to offer any advice on the use, purchase,
Jim is based in famously sunny Australia, so perhaps the more
repair or modification of commercial equipment or the incorporation cynical among you may well wonder why we should worry about
or modification of designs published in the magazine. We cannot UV in the famously less sunny (cloudy) UK. Well, I checked with
provide data or answer queries on articles or projects that are
more than five years old. the UK’s Met Office and UV can certainly be a problem in Britain,
especially for those with fairer skins, so I think it is well worth
Questions about articles or projects should be sent to the editor
by email: [email protected]
learning to use this module – wherever you are based!
Transmitters/bugs/telephone equipment
We advise readers that certain items of radio transmitting and
telephone equipment which may be advertised in our pages
cannot be legally used in the UK. Readers should check the law
before buying any transmitting or telephone equipment, as a fine,
confiscation of equipment and/or imprisonment can result from
illegal use or ownership. The laws vary from country to country;
readers should check local laws.
As always, we live in exciting times. Indeed, times are getting more exciting by the minute.
Can you imagine being able to simply look at something, ask a question, and receive a spoken
answer from an AI? I just saw such a system in action!
I
n my previous column (PE, April This comprised only 34 lines of code, I am confident it won’t be long before
2024), we talked about the concept 20 of which were items like { and }. we are all sporting some form of MR
of mixed reality (MR), which en- Out of the 14 lines containing more ‘something or other.’ Personally, I think
compasses augmented reality (AR), meaty statements, 11 of them (that’s one of the MR interfaces intended for
diminished reality (DR), virtual reality close to 80%) had bugs, and this was daily usage that will arrive on the scene
(VR) and augmented virtuality (AV). one of my better days! sooner rather than later will look a bit
Mixed reality is exciting, but the real Prior to the introduction of LLM- like a pair of ski goggles, but I’m pre-
game-changer will come when we com- based assistants called copilots, pared to be surprised by something else.
bine it with artificial intelligence (AI), embedded software developers typi- When people tell me that they would
all boosted by the awesome data band- cally spent 20% of their time thinking have little use for an AI+MR solution, I
widths promised by mmWave 5G and 6G about the code they were poised to think back to the early 2000s when the
cellular communications. The question write, 30% of their time writing the same folks told me they had no use for
is, whether this will be a game-changer code they’d just thought about, and phones that could take pictures (‘All
for good… or the other sort. 50% of their time debugging the code I want to do with my phone is make
they’d just written. By comparison, calls’). All I can say is, ‘Look at you now!’
Where are we? 60% of today’s embedded code is auto- One of the examples I often present
A large language model (LLM) is an AI matically generated by GitHub Copilot. is being able to ask my AI+MR combo
model notable for its ability to achieve This would offer a tremendous per- a question like, ‘What was that book
general-purpose language understand- formance boost if not for the fact that I was reading a few months ago that
ing and generation. The first LLM to – since Copilot was trained on open- talked about AI and Ada Lovelace?’ I
impinge on the general public’s col- source sources – 40% of the code it can envisage the AI responding with
lective consciousness was ChatGPT. generates has bugs or security vulner- the name of the book, while the MR
Created by OpenAI, ChatGPT began to abilities. Fortunately, we have Metabob highlights its location on my bookshelf.
roam wild and free in November 2022, from Metabob (don’t ask), which is a There are several required ‘build-
which is only around 18 months ago form of copilot that identifies and ad- ing blocks’ that are starting to fall into
as I pen these words. dresses any problems introduced by place. For example, a company called
This form of Generative AI (GenAI) is humans and other AIs. Prophesee makes a teeny tiny event-
now all around us. There are AI-based based vision sensor that’s only 3mm x
writing tools (give them a few text Where are we heading? 4mm in size and consumes only 3mW
prompts and they will write your mar- There’s a famous quote: ‘It is difficult of power. Another company called
keting slogans, product descriptions, to make predictions, especially about Zinn Labs has mounted these sensors
brochures… and so on); AI-based pre- the future.’ This quote is so famous in a pair of glasses frames that are also
sentation-generation tools (give them a that no one knows who said it. It’s been equipped with an eight-megapixel for-
few text prompts and they will generate attributed to all sorts of people, from ward-looking camera, microphones,
your PowerPoint presentation for you); Mark Twain to Niels Bohr to Yogi Berra. loudspeakers, and a cellular connec-
AI-based speech-to-text transcribers Whoever did say this knew what they tion to a cloud-based AI. The camera
(give them an audio or video file and were talking about. I would never have captures the scene while the sensors
they will return the written transcript); predicted many of the technologies we track what your eyes are looking at.
AI-based content summarisers (give enjoy today. Contrariwise, some of the I’ve seen a demo where the user looks
them an audio or video file – or the out- technologies I was looking forward to at something like a plant and simply
put from a transcriber – and they will seeing have failed to materialise (in asks a question like, ‘Can I grow this
return a summary along with a list of more ways than one). plant indoors?’ The AI immediately
action items); text-to-image generators One of the questions I often ask tech- responds, ‘Yes, but it requires bright
(I’m currently having a lot of fun with nologists when I’m interviewing them light, so you’ll need to place it near a
Stable Fusion), and – most recently is, ‘Will we have technology XYZ next south-facing window.’
– a company called DeepMotion an- year?’ (where XYZ is whatever futur-
nounced a text-to-3D-animation tool istic technology forms the topic of our Horns and swords
called SayMotion. conversation). Of course, they always I feel like we are sitting on the horns of
In my case, I’m particularly interested answer ‘No.’ My next question is, ‘Will a dilemma with a Sword of Damocles
in how AI might help with hardware we have this technology in 100 years’ hanging over our heads (I never meta-
design and software development. As a time?’ To this, they always respond phor I didn’t like). I hope we’re heading
case in point, shortly before I started to ‘Yes.’ Then I say: ‘So, now we have the toward an age of wonder; I fear we’re
write this column, I whipped up a tiny endpoints, all we need to do is narrow one step closer to a dystopian abyss.
test program to run on an Arduino Uno. things down a little.’ Pass me my dried frog pills.
L
ast month, the author tried out the and cheerful, of the sort that domestic
Chinese online vendor Temu for the mail order distributors would drop into
first time, after finally succumbing a polybag along with a display header
to an introductory offer of a heavily card and then quadruple the selling
discounted Bluetooth thermal label price. Apart from handy little doo-
printer. Initial impressions of the service dads and knick-knacks, it wasn’t long
were encouraging, and it wasn’t too long before I found enough of interest to fill
before more Temu orders were on the way. a couple more orders. This included
It must be said that Temu’s website a 6-in-1 environment monitor that is
impresses in many respects, and clearly widely advertised online, which displays
Temu has gone to some lengths to reassure Formaldehyde (HCHO), PM2.5 and
consumers and remove any nagging PM10 (2.5- and 10-micron particulate
doubts and uncertainty that potential matter), TVOC (total volatile organic
buyers might have about sourcing compounds) as well as CO and CO2 levels.
goods directly from China. A myriad The unit is self-contained, powered by a
of merchandise is on sale and website rechargeable battery and data is displayed
users will see a slick shopping cart and on a colour LED. Although I didn’t have
seamless integration with credit card high expectations of it, and a minority of
processing, highlighting an emphasis on reviews had been unfavourable, I decided
PCI DSS (Payment Card Industry Data it was worth a try at the offer price of £21
Security Standard) compliance –Western- (£35-40 elsewhere) and one duly arrived
This 6-in-1 environmental monitor is
standard data protection conditions that on my doorstep a week or so later.
designed for domestic users and offers
vendors must follow when handling If nothing else, it’s interesting to try a digital readout of six factors. Readings
credit and debit card details. Options sampling the air for pollutants in domestic shown when located in a busy kitchen.
to cancel orders, or add to existing ones situations, and when testing the monitor
before despatch, are also offered provided I did sometimes notice large changes in, environment. Obviously, the monitor
you’re quick enough. Everyone hates say, the kitchen when various cooking is designed for domestic use and is for
buying something only to see the price appliances were in full swing. I also noted guidance only; there’s no way of checking
drop soon afterwards, so Temu’s ‘Price PM2.5 and PM10 readings that were calibration or its accuracy, but it is what
Adjustment’ policy promises to refund the broadly within the targets for particulate it is and, given the low price, I didn’t
difference within 30 days. In Britain, the matter published by the UK Government: mind giving it a go.
Evri courier network is used by Temu for https://bit.ly/pe-may24-pm Overall, first impressions of Temu
the last mile in home deliveries, and my Perhaps my rural location helps have been surprisingly encouraging,
first orders arrived flawlessly in a matter with air quality, and city dwellers may and there have been no quality issues
of days; a credit is offered if deliveries measure entirely different levels in their either, though I could do without those
don’t arrive by the promised date.
It’s been hard to fault the service offered
so far, and naturally the Temu app on
a smartphone makes shopping more
effortless than ever. One downside is
the blizzard of emails that are sent by
Temu and Evri giving order updates,
tracking and delivery details, and
customers can expect to see regular
pop-up notifications with enticing offers
and discounts tempting them to buy even
more. The Temu website exhibits many
‘dark pattern’ behaviours (see Net Work,
June 2023) that track your browsing or
shopping patterns and nag you to buy
now, before it’s too late.
Chinese whispers
Much of the Chinese-made merchandise The Tapo Smart Button S200 is an entry-level gadget to switch or dim compatible
offered by Temu I would class as cheap smart devices. The author had mixed success (see text).
[email protected]
01256 812812
The Smart #1car’s interior has a flat control panel dominating The Smart brand is best known for its quirky little petrol cars and
the dashboard. the new Smart #1 is a compact SUV for the EV market.
Terrington
Components
• Project boxes designed and manufactured in the UK.
• Many of our enclosures used on former Maplin projects.
• Unique designs and sizes, including square, long and deep
variaaons of our screwed lid enclosures.
• Sub-miniature sizes down to 23mm x 16mm, ideal for
IoT devices.
MADE IN BRITAIN
An insight produced by NoScript showing some of the All 15 of these pirated Basic Soldering Guide books were
scripts running behind the scenes on a busy news website. spotted on Amazon by the author before being removed from
(courtesy, David Hicklin.) sale. The same ruse is currently affecting other book titles.
D
anish electronics company Anders Partida Petersen, Brand Di- Scammer update
Sandberg (slogan ‘IT is for eve- rector at Sandberg, is realistic when he We have already warned that scammers
rybody’) makes clever and well- admits the new tool ‘may well seem like have moved on from selling fake capac-
designed gadgets with a real purpose. I something for nerds’. But I guess that ity USB memory devices that store far
recently tried Sandberg’s ‘Unusual hard term covers many of our readers! I’m fewer megabytes than claimed to SSD
drive tool’ because it makes a nice fit pretty sure computer service centres drives that store far fewer gigabytes
with our recent articles on making PCs will love it too. than claimed. Fortunately, there are
perform much better by replacing an I’ve tried it and certainly love it. I just easy-to-use free apps that test capacity.
‘old-fashioned’ spinner Hard Disk Drive wish I hadn’t previously wasted my So far, the tests have been lengthy, but
with a new SSD (Solid-State Disk). money on a multi-bay HDD dock that a newish free app plays clever tricks
To make the HDD-to-SSD replacement looks good but has corrupted some of my to shorten the test time. It randomly
you first need to clone (not simply copy) HDDs, and also on two-bay HDD docks tries to read and write data at widely
the existing operating system on the exist- which are far less use than the much spaced sections of the memory map.
ing HDD to a new and empty SSD. This neater Sandberg tool. So, it quickly fails if real capacity is
can be tricky and risky because making The USB 3.2 cloner and dock costs lower than it should be. The drive is
a mistake in the cloning process can eas- £59.99, and in addition to SATA supports then red flagged for junking or more
ily result in wipeout, with the old HDD SSD fitting types M.2, NVMe and M Key, detailed testing. For further details,
and new SSD both empty. Sandberg’s in sizes 2230 / 2240 / 2260 / 2280. see: https://bit.ly/pe-may24-drv
‘unusual’ tool makes cloning as safe and
easy as it can be; near risk-free in fact.
The same tool also makes it much easier
to work with ‘bare’ HDDs and SSDs, stor-
ing and reading data to and from discs
of both types.
Smart connector
The Sandberg tool is really just a very
smart connector strip, powered with a
separate 12V supply. The strip has SATA
and NVMe sockets for plug-in connection
to standard 2.5-inch and 3.5-inch SATA
spinner drives and SSDs of the type that
slot straight into modern computers and
peripherals. Connection of the tool to
a PC or mobile is by standard USB-A
or USB-C cable. No screwdrivers are
needed. Rather fiddly rubber plugs do
the job of screws.
Two drives, HDD and SSD, can be
connected to a computer simultaneously
or separately, with reading and writing
possible to both. But the tool also has on-
board software that lets it clone directly
from one drive to the other, without the
need to connect to a computer. A physical
switch controls the direction of cloning,
HDD to SSD or vice versa. This is what
makes wipeout mistakes far less likely.
Sandberg says that because the tool
supports USB 3.2 it’s theoretically pos-
sible to achieve transfer speeds right up
to 10 Gbps. But this will of course depend Fox tested and approved – Sandberg’s ‘Unusual hard drive tool’ makes cloning drives
on the drive specs. straightforward, easy and safe.
tekkiepix pic of the month became a thing of the past, just as thread-
ing audio tape was no long necessary
U-matic video cassette recorder once Philips had launched the audio
cassette in the 1960s, and Americans
slapped 8-track cartridges in car players.
All the the proud owner of a U-matic
player had to do was ‘post’ a sealed cas-
sette into a letter-box slot, and a clever
mechanism hidden inside the player
automatically laced it round the drum.
JVC marketed U-matic recorders as
U-VCRs that plugged into a ‘regular TV’
and recorded ‘off-the-air TV programs’
under ‘full remote control’. Meanwhile,
however, JVC was working secretly on
the less expensive VHS system.
For many years, U-matic was a stan-
dard convenience tool for broadcasters,
programme makers, business teachers
and TV advert producers. Early video
U-Matics were not pretty, they just did the Early CD discs were often edited and
job, and loaded faster than open reel. mastered on U-matic systems. cinemas used U-matic tapes, and se-
curity services used them for secret
H
ere’s a good ‘pub quiz’ by professionals rather home users training videos – as one UK journalist
question for PE readers of a because of high cost and the lack of an found out to his cost when he bought
certain vintage: ‘When did the easy connection. Neverthless, U-matic some cassettes from a tech jumble
first video cassette recorders go on became a must-have trophy gadget for sale and thought the contents looked
sale, and what was the name of the well-heeled homeowners, and record- suspicious. Soon after he wrote about
manufacturer?’ Betamax, from Sony, ers were soon available with built-in them in a specialist video magazine,
in 1975? Wrong. VHS from JVC, in connectors for home TVs. promptly followed by a knock on his
1976? Wrong, again. So perhaps it was U-matic cassettes held ¾-inch tape, home door and a bunch of big men with
a bit of a trick question? rather than the 1-inch tape used for security IDs confiscated the cassettes.
Panasonic was ahead of VHS with a open-reel recorders and ½-inch tape In the early 1980s U-matic cassettes
VCR called the Quasar VX ‘The Great used by Beta, VHS and the Philips and were used to store digital audio and
Time Machine’, born 1975, but it died ‘nerve gas’ systems. But most people became the de facto standard tool
soon after – and not just because the neither knew nor cared what kind of for mastering Compact Discs (CD).
marketing team hadn’t realised that just tape was in the cassette. The cassette tape stored digital audio
about everyone associated the label ‘VX’ Until then, home video wannabees packed inside a video signal. As far as
with nerve gas. So, was that one first? had had to struggle with open spools of the U-matic recorder was concerned
Sorry, wrong again; and even though very expensive video tape that needed it was just another signal.
Dutch Philips had stolen a march on careful threading round a spinning More consumer-friendly (smaller,
the Japanese with the N1500 VCR in head drum. Touching the tape could lighter and cheaper) VHS and Beta
1972, that’s still not the right answer. spoil a recording – and anything less decks could do the same job, but U-
The first working video cassette re- than precision threading could wreck matic recorders and tapes were far
corder was the U-matic, developed by the delicate video heads. more rugged.
Sony, with Panasonic and JVC joining U-matic cassettes only ran for an hour,
in for a joint launch in 1971. but so did the Philips cassettes and the Practical Electronics is delighted to be
able to help promote Barry Fox’s project
It’s true that the first U-matic record- first Sony Betamax tapes. Sony’s boss to preserve the visual history of pre-In-
ers needed a bolt-on tuner and output Akio Morita initially saw no problem ternet electronics.
circuitry to feed into the aerial socket with this because back then most Japa- Visit www.tekkiepix.com for fascinating
of a home TV. It’s also true that the nese TV programmes only ran for an stories and a chance to support this
U-matic system was initially adopted hour anyway. Threading video tape unique online collection.
GPS-Disciplined Oscillator
The GPS-Disciplined Oscillator
(GPSDO) is built almost entirely
in software, so it only requires
a PIC, an oven-conditioned crystal
oscillator and a few other supporting parts. It
provides an extremely accurate 10MHz signal with an
error in the parts per billion range.
T
here are a few situations This project describes a GPS-Disci- The aim of this was to create a use-
where having a very accurate fre- plined Oscillator (GPSDO) that uses ful and inexpensive GPSDO that could
quency is essential. Many pieces the 1PPS signal to adjust (discipline) deliver 10MHz into 50W with a maxi-
of test equipment, such as oscilloscopes the frequency of a 10MHz oven-condi- mum error of 0.01Hz.
and spectrum analysers, have an inter- tioned crystal oscillator (OCXO). The It is based on a cheap CTI OSC5A2B02
nal 10MHz reference that’s accurate to output is accurate to a few parts per oscillator, a PIC16F1455 microcontrol-
within a few Hz (around one part per billion (ppb) at worst, and normally ler and a 74HC04 hex CMOS inverter
million). They usually have an input 1ppb or better. running from a 5V supply.
socket for a more precise external sig- The GPS module I used was the
nal source for operating with much GNSS and GPS cheapest available, the u-blox NEO-6
higher precision. GPS refers to the constellation of nav- (possibly a clone), using an active
As people explore high and higher igation satellites launched by the US antenna with a 3m lead. There was no
operating frequencies, reference accu- government but is sometimes used to need for any display; anyone with a
racy becomes more critical. An error describe any positioning system that smartphone can see their position and
of 1 part per million (ppm) at 7MHz uses satellite data for navigation. get accurate time, so such a display is
is only 7Hz, hardly noticeable in a Last century, the only useful con- redundant. The operational status is
single-sided band (SSB) signal). But at stellation was the GPS constellation. indicated with a single LED.
5GHz, the same error is 5kHz, enough More recently, many nations have This prototype system performed
for the signal to not be received at the launched their own satellite constel- well enough to justify creating a PCB,
expected frequency. lations, such as GLONASS (Russia), and several were built. However, it
Global Navigation Satellite System BeiDou (China) and Galileo (Europe). was overly sensitive when connected
(GNSS) satellites have accurate atomic The term ‘global navigation satel- to other equipment.
clocks onboard that are adjusted by sig- lite systems’ (GNSS) refers to all the Another problem was that I had not
nals from ground-based master clocks. available constellations. Many ‘GPS’ designed the PCB with any enclosure
The satellites broadcast signals with receivers are actually GNSS receivers in mind, so it needed a larger enclosure
precise timing that allow a GPS receiver and can use data from several constel- than necessary. And people may prefer
to determine the receiver’s location and lations. This means the receiver is more a 12V supply rather than a 5V supply.
the time. Many GPS receiver modules likely to pick up usable signals since Consequently, I designed the
generate an accurately timed one pulse many more satellites are available to it. revised PCB that is presented in this
per second (1PPS). However, there are differences article. The oscillator is substantially
between constellations, and the independent of the rest of the circuitry.
receiver may be less accurate if it The PCB fits a UB3 Jiffy box and runs
switches between constellations. from 12V DC.
A UI is provided to obtain more sta- by IC4 emanates from pin 7 and is fed from the general 5V supply. The 5V
tus information, and some limited con- to the gates of P-channel and N-chan- rail from the standard linear regulator
trol over the GPSDO, via the microcon- nel MOSFETs Q1 and Q2, which oper- that powers the OCXO is stable enough
troller UART. By default, the NMEA ate as an inverter. When the PWM sig- that the MAX6350 IC is not required.
data stream from the GPS module is nal is low, Q1 switches on, pulling the Therefore, constructors should omit
passed through to the UART. Programs output up via a 10kW resistor, whereas REF5 and instead solder a wire from
are available to decode the information when the PWM signal is high, Q2 the output of REG6 to REF5’s pad 6
and display items such as the num- switches on, pulling the output low (the dashed line in Fig.1). Regardless
ber of satellites in view, their signal via another 10kW resistor. of the source of the reference voltage,
strength, position in the sky and the The resulting signal is fed through it is fed through an LC low-pass filter
location data’s reliability. This can be three RC low-pass filters connected (1mH/47μF) before being applied to
useful to diagnose performance issues. in series to the control terminal (pin the source of MOSFET Q1 to remove
The UI can also be accessed by a 1) of the 10MHz crystal oscillator any digital noise.
terminal program such as TeraTerm. (OCXO). The time constant of this fil- The output signal from the OCXO
The user can change the output from ter is around one second. at pin 3 is fed through an inverter
the NMEA stream to a log of what the The main reason for inverting the (IC7a) and 22pF AC-coupling capac-
GPSDO is doing. There are some con- PWM signal with two MOSFETs was itor to the clock input pin (pin 2) of
trol functions to change some defaults, so the input to the PWM filter can have microcontroller IC4, which has an
reboot or update the software without its amplitude determined by a very internal DC bias. It’s also fed to the
removing power. precise reference voltage for stability remaining five inverters in IC7 con-
in the resulting control signal, gener- nected in parallel, with series resis-
Circuit details ated by a MAX6350 voltage reference tors on the outputs to prevent them
The entire circuit is shown in Fig.1. IC. However, testing showed that it was from ‘fighting’ each other if they don’t
The controlling PWM signal produced sufficient to isolate the PWM supply switch simultaneously.
The output of this set of inverters REG3 powers microcontroller IC4, The remote end requires a buck
is AC-coupled to output connectors hex inverter IC7, the GPS module converter, a line driver and the GPS
CON7 and CON9 with a 1kW resistor and some other bits and pieces, while receiver. This setup has been tested
to provide 0V DC bias. REG6 powers the crystal oscillator and over a 12m cable, and worked over
An opto-isolated serial interface PWM control signal inverter, as men- 20m. However, I did not design a PCB
is provided at CON5, which can be tioned earlier. Both regulators will for this.
plugged straight into a USB/serial remove any remaining switching noise If you wish to implement this, fit
converter module. By isolating it, we from the buck regulator that passes the line receiver IC using a socket. For
prevent electrical noise from being through the LC filter. remote use, install the line receiver. For
fed back from a connected computer. The GPS module is wired to CON6. local use, remove the line receiver and
Isolation is via two opto-couplers, one The 1PPS signal is fed to pin 8 of IC4 plug the GPS receiver into CON6. Oth-
for each direction (in/out) – OPTO1 while the serial stream goes to pin 12. erwise, IC3, CON8 and the two asso-
and OPTO2. The PCB has provision for data ciated 100W resistors can be left off.
Turning now to the circuit’s power to be fed in from a GPS receiver via
supply, the incoming 12V is filtered dual-differential receiver IC3. This Preparing the enclosure
by a 100μF capacitor and then fed is an experimental interface to allow Before mounting any parts on the PCB,
into a buck converter module (REG1) remote location of the GPS receiver use it as a drilling template for the
that efficiently drops it to 6.5-7.5V. Its for situations where a local GPS mounting holes on the Jiffy box lid,
output is filtered by a 220μF capac- antenna cannot pick up adequate GPS which will become the base. Refer to
itor, then an LC low-pass filter to signals. The connection to the remote Photo 1, which shows the preferred
remove most of the switching noise receiver utilises a standard Ethernet position for a UB3 enclosure, with the
(100μH/470μF) before being applied UTP cable, with two pairs for the two power connector close to the back and
to two 5V low-dropout linear regula- signals and the remaining pairs for plenty of space for mounting the buck
tors, REG3 and REG6. 12V power. converter module.
Testing
Before applying power, check your
soldering for unwanted shorts, espe-
cially around the MOSFETs. Also
check to ensure the fillets are all shiny
and well-formed, all components are
in the correct locations and have the
right orientations.
If you decided to use an adjustable
buck converter, verify that you’ve set
it for approximately 7V output before
connecting it to the main PCB. This is
not critical as it can be adjusted later,
during testing.
The converters used on the pro-
totypes are adjusted by rotating
the onboard potentiometer screw
anti-clockwise. Nothing happens for
much of the rotation, then the voltage
reduces over very little travel. Once the PCB has been assembled, it needs to be wired
Connect the LED to its header, to the output socket, GPS module, USB socket and LED1. Note the omitted
apply power and check that it lights optional parts.
up or flashes. Check the output volt-
age from the buck module at either
end of inductor L1 relative to 0V (eg,
one of the two larger plated holes on
either side of unused socket CON8).
Verify it’s close to the expected volt-
age (6.5-7.5V). Also measure the out-
puts of the two 5V regulators at their
tabs and verify that they are both
close to 5V.
If the LED is not flashing, probe pin
3 of the PIC. It should be switching
between 5V and 0V. If it is, you might
have the LED connected the wrong
way around.
If the LED flashes at 2Hz, the 10MHz
signal is not reaching the PIC at its pin
2. Check for a 10MHz signal between
the two pins of CON7. It should also
be present at pin 1 of IC7 (directly con-
nected to the output of the oscillator).
If all is well, the LED should flash
at 1Hz with about 800ms on and
200ms off. This indicates that the PIC
is working and using the 10MHz from
the oscillator as its clock.
You can check the control voltage Fig.2: fit the components as shown here, taking care with the orientation of
the electrolytic capacitors, ICs, opto-couplers, regulators and LED1. Several
at the control pin of the OCXO, which
parts are not needed and are shown left off, while CON8 and the two 100W
is connected to the right-hand end of resistors below it are depicted but not required. Don’t forget the short wire
the resistor immediately between it link near the middle of the board, shown in red, which bypasses REF5.
and REF5. It should be in the range
BS250 Pinout
Be aware that there are
versions of the BS250
MOSFETs with non-
standard pinouts (the
standard pinout is DGS
left-to-right looking at
the flat ‘label’ side; see
Fig.1). If you end up with
those, you might need to
rotate it or bend the pins.
Usually the non-standard
versions have their pinout
printed on the face.
Calibration
The GPSDO is self-calibrating. The
purpose of the calibration is twofold;
it determines the actual sensitivity of
Fig.4: we’re recommending a USB/serial module with a micro-USB socket
the crystal oscillator (the control volt-
that plugs directly into CON5 (it has an onboard header socket). However,
age vs frequency relationship) and you can use most USB/serial adaptor you want, including the very common
a reasonable control voltage to use type shown here, wired to a 6-way female header to match CON5.
when the system is started.
After the oscillator has been run- This will take more than an hour, A single flash per second indicates
ning for a few hours, turn off the sys- and if the GPS signal is marginal, it the GPSDO has completed calibration
tem and reattach the GPS module with may be longer (or not achieved – in and has reached 10MHz within 1ppb.
its antenna. Let the system run until which case you will need to relocate A double-flash suggests it may not be
it delivers one flash every second. the antenna). within specification.
TEACH-IN 3 TEACH-IN 5
£7.99
huge range of subjects that will interest everyone involved 15 design and build circuit projects for newcomers or JUMP START
CIRCUIT SURGERY
in electronics – from newcomers to the hobby and i The how and why of circuit design those following courses in school and colleges. 15 design and build circuit projects
dedicated to newcomers or those
PRACTICALLY SPEAKING
students to experienced constructors and professionals.
following courses in schools and
PIC ‘N MIx
Surgery, EPE/PE’s regular clinic dealing with readers’ Powered Charger n Versatile Theft Alarm n Spooky
i Over 40 different circuit ideas
Starting out with PIC microcontrollers
t
W
1
TWO TEACH-INs FOR
Elec
©
TWO TEACH-INs FOR
THE PRICE OF ONE! THE PRICE OF ONE !
The second section – Practically Speaking – i The free CD-ROM provides
a broad-based introduction
to electronics
n Egg Timer n Signal Injector Probe n Simple Radio Provides
a practi
cal
to PIC
introduction llers
Plus:
MikroElektro
Microchip pe
L-Tek PoSco
nika,
The free CD-ROM provides a
practical introduction to PIC
8 Inter
active ledge
and logo, Techno
ip name of Microchip
Technol
Microch
ip
.09 software
PLUS
The Microch arks s. © 2013
Your Know
016-02
ed tradem countrie 1. MCCD1
register and other d. Issue
in the USAAll rights reserve
d 1
In 2 - JUL13.ind
A BROAD-BASED INTRODUCTION TO CD
ELECTRONICS
TEACH-IN 4
FROM THE PUBLISHERS OF
Electronics Manual, worth £29.95. The Manual i Over 800 PDF pages
What a Bargain!!
if not, open double-click
and
Explorer f
index.pd
MAN.co.u
Downloa be.com
www.ado
BA SE .epe mag
k
© Wimbor
Audio Out – an
£8.99 £8.99
D CD
DV
and Circuit Surgery
The Teach-In 6 CD-
TEACH-IN 6 analogue expert’s take
TEACH-IN 7 by Ian Bell – ‘State TEACH-IN 8
FROM THE PUBLISHERS OF FROM THE PUBLISHERS OF
FREE
CD-ROM
ROM also contains all on specialist circuits
SOFTWARE
FOR
the techniques of
• Pi ClASS – SPECifiC lEARninG AimS • Learn with ‘TINA’ – modern CAD software • Microcontrollers – understand control operations
• PYthon QuiCkStARt – SPECifiC PRoGRAmminG toPiCS • Five projects to build: Pre-amp, Headphone Amp,
readers and circuit the files for:
• Communications – connect to PCs and other Arduinos
• Pi woRld – ACCESSoRiES, BookS EtC Tone Control, VU-meter, High Performance Audio Power Amp
project building.
• homE BAkinG – follow-uP ACtivitiES
nM
icrochip MPLAB
RE FOR
SERIES SOFTWA 7
CH-IN
THE TEA
Smartscope software.
building PIC-based projects
Teach In 6 Cover.indd 1 02/03/2015 14:59:08 Teach In 7 Cover VERSION 3 FINAL.indd 1 07/04/2016 08:25 Teach In 8 Cover.indd 1 04/04/2017 12:24
M
any signal generators do at the op amp output and 2.5V peak-to- 100nF × 470W]) so they will not attenu-
not provide a high enough out- peak at the 50W load, or 884mV RMS ate signals within the specified operating
put level for certain uses. This (13.9dBm/24mW). The maximum out- frequency range, from 100kHz to 75MHz.
small PCB uses an OPA2677 high-speed put with a 12V supply is about 25dBm, The signals are coupled to the non-in-
dual op-amp to boost signals of 100kHz- as shown in the specifications panel. verting input pins, so the amplifiers do
75MHz at around 0dBm (1mW, 225mV/- The RF Amplifier is useful from not invert the signal phase. The outputs
13dBV into 50W) to around 18dBm 100kHz to 75MHz, although once past of the op amps (pins 1 and 7) are fed
(63mW, 1.78V/5dBV into 50W). 50MHz, the maximum output level back to the inverting inputs (pins 2 and
The OPA2677 has impressive specifi- starts to drop off. Table 1 shows spot 6) via 470W resistors, which form volt-
cations. It can operate on voltages from measurements at several frequencies age dividers with trimpots VR1/VR2 and
3.3V to 12V, has rail-to-rail outputs, a using my signal generator as an input. their series 68W resistors.
high drive capability and a gain band- The output variability somewhat The 100nF capacitors in the feedback
width (GBW) of 200MHz. But what depends on the signal generator varia- network reduce the DC gain of these
makes it stand out is a slew rate of 1800V/ tion in output level. amplifiers to 1x so that the input offset
µs, which means it can provide a large The OPA2677 is not cheap, about £5 voltages (up to 5.3mV) are not ampli-
output swing for high-frequency signals. from Digi-Key, Mouser or element14, fied. The corner frequency of the high-
Since it is a dual op amp, my design but I bought five from AliExpress for pass filter formed is similar to that of the
provides two outputs for the one input £8. Still, even if you pay £5 (each), the input networks as the component values
signal. Individual feedback resistors overall cost of building this RF Ampli- are the same.
and a potentiometer set the gain for fier is modest. As mentioned earlier, the op amps
each output. have very high gain bandwidths (GBW)
The maximum gain is 1 + (470W ÷ Circuit description and slew rates, so they are effective up to
68W) = 7.9 times with the 1kW single-turn The whole circuit is shown in Fig.1. The high frequencies. Because the gain band-
trimpot set to minimum. The lowest gain signal fed in via SMA connector CON1 width is fixed, the maximum signal fre-
is 1 + (470W ÷ 1068W) = 1.44 times with is AC-coupled to both halves of dual op quency drops as you increase the gain.
the trimpot set to maximum. The out- amp IC1 via 100nF capacitors. These For example, with the GBW of 200MHz,
put impedance is 50W and it will safely signals are biased to half the VCC rail a gain of four times is possible at 50MHz
drive a 50W load. (eg, 2.5V for a 5V supply or 6V for a 12V or about three times at 70MHz.
The power supply voltage should supply) using 470W resistors. The outputs of the two op amps are
ideally be in the range of 9-12V. You Those coupling capacitors and bias coupled to SMA connectors via 100nF
could use 5V DC, but the amplified sig- resistors form high-pass filters with a capacitors to eliminate the VCC/2 DC
nals will be limited to 5V peak-to-peak corner frequency of 3.4kHz (1 ÷ [2π × bias and fed through 51W resistors for
impedance matching. You could change
them to 75W if you need to feed into a
Features and Specifications 75W device.
∎ Operating frequency range: 100kHz to 75MHz The VCC/2 rail is formed by a
1.2kW/1.2kW voltage divider with a
∎ Number of inputs: 1
100nF capacitor from the junction to
∎ Number of outputs: 2, individually gain adjustable ground to eliminate supply ripple and
∎ Gain range: 1.44 times (3dB) to 7.9 times (18dB) keep the source impedance low at higher
∎ Maximum output level: frequencies. Op amp IC1 also has a
25.6dBm @ 30MHz (360mW into 50Ω, 12.5dBV, 4.25V RMS) 100nF supply bypass capacitor.
23.2dBm @ 50MHz (207mW into 50Ω, 10dBV, 3.2V RMS) Note that there is no termination resis-
13.5dBm @ 70MHz (22mW into 50Ω, 0.51dBV, 1.06V RMS) tor for input CON1. You could add an
∎ Power supply: 9-12V DC @ 20-25mA (or 5V DC with reduced maximum M2012/0805 size resistor (51W or 75W)
output levels) across the terminals of the SMA socket
if you need one.
Construction solder joints to ensure they are all good. convenient. Its exact orientation doesn’t
Construction is straightforward as there Next, fit the passives (none are polar- matter as long as you observe the ‘+’ and
are only a couple dozen components. ised), using a similar technique of tack- ‘–’ markings when wiring it up.
The Dual RF Amplifier is built on a dou- ing one side, then adjusting the align-
ble-sided PCB coded CSE220602A that ment and after a brief delay to allow the Housing it
measures 38 × 38mm, which is available solder to solidify, solder the other side. This board is small, so it can fit into most
from the PE PCB Service. Refer to the The resistors will be marked with cases. A metal case is preferred for RF
PCB overlay diagrams, Fig.2 and Fig.3, codes indicating their values (eg, 122 shielding. See the parts list for sugges-
to guide you during assembly. or 1201 for 1.2kW), while the capacitors tions and note that the 51 × 51mm die-
Start by fitting the SMDs to the com- will not be marked, but they are all the cast cases sold by Jaycar and Altronics
ponent side, with IC1 first. Determine its same value (100nF). When all the SMDs are too small to fit the PCB.
pin 1 location – look for a dot or divot in are mounted on that side, flip the board Fig.4 shows the hole positions to drill
one corner, or failing that, a chamfered over and solder the lone capacitor on in the lid or base, and the board can
edge on the pin 1 side. Locate it with pin the other side. then be mounted using the SMA con-
1 towards the upper right with the PCB That just leaves the six through-hole nector nuts.
oriented as shown in Fig.2. components: two trimpots, the power Drill a hole in the side of the case to fit
Add flux paste to its pads, then tack header and the three SMA sockets. It’s a chassis-mount barrel socket and wire it
one pin with solder and check the align- best to fit the SMA sockets next, so you up to CON4. Double-check that the pos-
ment of the other pins. If they are good, have good access to their pins. Push itive wire (usually the tip of the barrel
solder the diagonally opposite pin. Oth- them down fully and solder all five pins, socket) goes to the + side of CON4, as the
erwise, heat the original solder joint and keeping in mind that you may need some board has no reverse polarity protection.
gently nudge the part until it is in place. extra heat or flux to solder the four outer There isn’t a great need for a power
Then solder the remaining pins, pins due to their thermal mass. switch as you can simply unplug the
refresh the first one and clean up any Finally, mount the two trimpots and plugpack from the wall when you
solder bridges which might have formed the power header. Use single-turn trim- aren’t using it. Still, if you want to add
between pins with another dab of flux pots as multi-turn types likely have too a power switch, all you have to do is
paste and some solder wick. much inductance. You could solder drill a hole in a convenient location,
Clean flux residue off the board with some figure-8 wire directly to the board
alcohol or a flux cleaner and inspect the for power, but a polarised header is more
Dual RF
Amplifier
mount the power switch and wire it in your power supply to the barrel socket
series with the positive conductor from and use a DMM to check that the power
the barrel socket to CON4. polarity at the plug is correct. Then
If you want to add reverse polarity plug it in and connect a signal to the
protection, solder a 1N5819 diode to input socket.
the barrel socket with its anode to the Verify that an amplified version of
positive tab of the socket, then run the the signals appears at the outputs using
supply wire to the board or switch from a scope, signal level meter or frequency
its cathode. That will drop the supply counter, depending on what you have
- USB - PWM voltage slightly, by around 0.3V, so it on hand.
- Ethernet - Encoders may have a small impact on the maxi-
- Web server
- Modbus
- LCD mum output signal level. Using it
- Analog inputs
- CNC (Mach3/4) - Compact PLC
Finally, you might want to drill a cou- There isn’t much to it – just power it
- IO ple of small holes in the face of the case up, feed in your signal, adjust the level
opposite the board so that you can slot using trimpot VR1 or VR2 if necessary,
in a thin adjustment tool to adjust trim- and take the output from the correspond-
pots VR1 and VR2 with the case closed. ing socket. The CON2 signal level/gain
That depends on your application; is adjusted using VR1, and the CON3
you could just set a different fixed gain signal level/gain is adjusted using VR2.
for both trimpots and then use which- Keep in mind that VR1 and VR2 are
ever output suits your needs at the time. wired such that anti-clockwise rotation
Before screwing on the lid, unplug increases the gain and clockwise rota-
the CON4 plug from the board, connect tion decreases it.
- up to 256 - up to 32
microsteps microsteps
- 50 V / 6 A Reproduced by arrangement with This article is in memory of Rod
- 30 V / 2.5 A
- USB configuration SILICON CHIP magazine 2024. Graham, VK3BQJ, who passed away
- Isolated www.siliconchip.com.au on 4 November 2022.
PoScope Mega1+
PoScope Mega50
- up to 50MS/s
- resolution up to 12bit
- Lowest power consumption Fig.4: just about any metal case would be suitable but this one is relatively
- Smallest and lightest
- 7 in 1: Oscilloscope, FFT, X/Y,
compact. The lid is larger than the base, so if using this as a template, cut it to
Recorder, Logic Analyzer, Protocol the appropriate outline. The central area could be cut out and transferred to
decoder, Signal generator just about any other case. The hole in the side for the power socket is not shown
here; it could go just about anywhere.
UVM-30A Module
Ultraviolet Light Sensor
This ultraviolet (UV) light-sensing ‘breakout’ module detects the intensity
of UV solar radiation and hence the degree of protection you may
need to prevent skin damage. If you connect it to an Arduino or other
microcontroller, it can even indicate the current ‘UV Index’.
P
rotection is critical if you curve, with the peak at the middle of better sensitivity over slightly more
spend a lot of time outdoors the day or soon thereafter. So it can than half of the UV-A range, from
in the summer sunshine (sun- be worthwhile to keep tabs on the UV 315nm to 365nm.
screen and hat) to avoid sunburn and radiation level if you are going to be The vertical units in Fig.1 are micro-
to lower your chances of developing outdoors, even in the early morning amps per milliwatt of UV radiation.
skin cancer. or late afternoon. The Genicom data sheet for the GUVA-
The UVM-30A analogue UV light At the heart of the UVM-30A mod- S12SD lists the typical peak response
sensing module is ideal for detect- ule is a miniature UV sensor called of the device as 0.14A/W at 350nm,
ing harmful UV rays and can be used the GUVA-S12SD. This is in an SMD equivalent to the peak of the curve
to build your own UV sensor. It eas- package measuring 3.5 × 2.8 × 1.8mm in Fig.1.
ily connects to an Arduino or other and is made by Genicom Co Ltd in
microcontroller unit (MCU) and with South Korea. Inside the module
the right firmware, it will indicate the Genicom describes their device as As shown in the circuit diagram (Fig.2)
current UV Index or ‘UVI’. If you’re a schottky-type gallium-nitride pho- there’s very little in the UVM-30A
unsure what this is, please see the ‘UV todiode designed to respond to UV module apart from the GUVA-S12SD
Radiation and UV Index’ panel. radiation with wavelengths between sensor (PD1), and a small SGM8521 op
Sunburn and skin damage are 240 and 370nm (nanometres). It is amp (IC1) used to convert its output
caused by the UV wavelengths in solar also described as being ‘blind’ to vis- current into a voltage.
radiation, which can still be quite ible light. The conversion performed by op
strong even when the sky is overcast. The response curve of the GUVA- amp IC1 conforms to the expression
So checking the UV radiation level is S12SD sensor is shown in Fig.1. Its Vo = 4.3 × 106 × Ipd, where Ipd is the
still important. sensitivity is very low at wavelengths current passed by PD1 in amps. So a
UV radiation varies in strength below 240nm, rising steadily to a peak PD1 current of 280nA should result in
during the day, just like visible light at 350nm before dropping sharply an output of 1.2V.
and infrared (IR) heat radiation. As between 360nm and around 375nm. So Most of the circuitry in Fig.2 is
with these other wavelengths, its it has good sensitivity over the UV-B inside a pale yellow rectangle with
intensity tends to follow a bell-shaped range from 280nm to 315nm and even a dashed red border because that
The UVM-
30A module
comprises a
larger PCB
(28 × 12.5mm)
and a smaller
PCB (3.5 ×
2.8mm). The
smaller PCB
hosts the
GUVA-S12SD
UV sensor in
a white SMD
package.
This image is
shown at 250%
actual size.
Fig.1: the sensitivity of the GUVA-S12SD sensor to light within the UV spectrum.
The x-axis is the light wavelength in nanometres, while the y-axis shows the
microamps conducted per milliwatt of incident radiation at that wavelength.
This indicates that it’s most sensitive to UV-A but will also pick up much of the
UV-B spectrum and some UV-C, at reduced sensitivity.
Fig.5: the mapping of the output of the UV sensor to the UV index is primarily linear, except below a UV index of one.
Therefore, the formula to convert its output voltage to the UV index is pretty simple. The sketch source code (available for
download) shows exactly how it’s down.
Fig.6: to make a
practical device,
I added a serial
(I2C) 16×2 LCD
module to the basic
circuit, wired as
shown here. That
allows the Arduino
to display both
the raw UV sensor
output voltage and
the equivalent UV
index in a handy
portable package
if the Arduino is
battery-powered.
EE
LATES HE
T CO
OF OU PY TEACH-IN 9
FROM THE PUBLISHERS OF
TEACH R
-IN SE
Electron Publishing GET TESTING!
Electronic test equipment and measuring
FREE
CD-ROM
TWO TEACH
-INs
RIES
techniques, plus eight projects to build FOR THE PRICE
OF ONE
AVAILA
• Multimeters and a multimeter checker
• Oscilloscopes plus a scope calibrator
BL PRICE £8.99
• AC Millivoltmeters with a range extender
NOW! E
• Digital measurements plus a logic probe
• Frequency measurements and a signal generator
• Component measurements plus a semiconductor
junction tester
PLUS...
YOUR GUIDE TO THE BBC MICROBIT
A LOW-COST ARM-BASED SINGLE-BOARD
COMPUTER
Teach-In 9
Get Testing
PLUS
Teach-In 2 -Using
PIC Microcontrollers.
In PDF format
This series of articles provides a broad-based introduction to choosing and using a wide range © 2018 Wimborne Publishing Ltd.
www.epemag.com
of test gear, how to get the best out of each item and the pitfalls to avoid. It provides hints
and tips on using, and – just as importantly – interpreting the results that you get. The series
Teach In 9 Cover.indd 1 01/08/2018 19:56
deals with familiar test gear as well as equipment designed for more specialised applications.
The articles have been designed to have the broadest possible appeal and are applicable to all branches of electronics.
The series crosses the boundaries of analogue and digital electronics with applications that span the full range of
electronics – from a single-stage transistor amplifier to the most sophisticated microcontroller system. There really is
something for everyone!
Each part includes a simple but useful practical test gear project that will build into a handy gadget that will either
extend the features, ranges and usability of an existing item of test equipment or that will serve as a stand-alone
instrument. We’ve kept the cost of these projects as low as possible, and most of them can be built for less than £10
(including components, enclosure and circuit board).
PLUS! You will receive the software for the PIC n’ Mix series of articles and the full Teach-In 2 book – Using PIC
Microcontrollers – A practical introduction – in PDF format. Also included are Microchip’s MPLAB ICD 4 In-Circuit Debug-
ger User’s Guide; MPLAB PICkit 4 In-Circuit Debugger Quick Start Guide; and MPLAB PICkit4 Debugger User’s Guide.
W
hen the festive season or box with a mostly bare aluminium also makes it much easier to build than
birthdays approach, those front panel. I felt it lacked the visual the original design.
interested in electronics appeal to capture the imagination of I removed the original large and
often look for a small, easy-to-build today’s younger audience. costly 8W speaker and its driver tran-
project to give as a gift. Something with This revision was my solution. sistor in favour of a modern, inexpen-
flashing lights or a variety of sounds Along with migrating the circuit to sive piezo speaker. Mounted on the rear
has universal appeal, especially for the 74HC-series CMOS logic family, of the PCB, it produces a bright sound
our (grand)children. Helping a begin- I also redesigned the printed circuit without driving parents to utter despair.
ner to build one of these is the perfect board (PCB) into a more compact and The original used a somewhat
way to spark an interest in the hobby. attractive bird shape – something expensive 9V battery, while a pair of
The problem is identifying a suitable between an overfed festive budgie inexpensive AAA cells power my new
design. During a recent search, I came and a kookaburra! version. The new 3V supply also sig-
across an ‘electronic canary’ designed Modern PCB manufacturing pro- nificantly reduces the current draw to
by Ron de Jong, published in Electron- vides a choice of PCB solder mask under 2mA.
ics Australia way back in May 1981. colours. I chose purple, but you could
Unfortunately, the 74C-series CMOS also go with something like green, yel- What makes it sing?
chip used in the original design is low or red (after all, it was initially a The Songbird consists of two almost
not as widely available as 74HC-se- ‘canary’). Contrasting with the colour- identical sets of three coupled oscil-
ries devices. Also, the original design coded bands of the resistors on the lators, ie, circuits that produce a con-
used a large square PCB mounted in PCB, the overall effect is bright and tinually changing voltage level. Each
a very large plain rectangular plastic cheerful. The double-sided PCB design oscillator uses one of the six CMOS
schmitt-trigger inverters inside the
The ‘inspiration’ for the 74HC14 integrated circuit (IC). Fig.1
Songbird project came shows the basic oscillator circuit used
from the May 1981 edition in each case.
of Electronics Australia. The The inverter (triangle) produces a
image shown is the lead low output voltage when its input volt-
photo used for that article.
age is high and vice versa. Connected
to it are a resistor, ‘R’, and a capaci-
tor, ‘C’. The values of C and R vary in
each oscillator.
When power is switched on, capac-
itor C is discharged, and the inverter
input is at ‘ground’ potential (0V,
or logic ‘low’ level). As a result, the
output of the inverter is near +3V (a The full Songbird circuit is shown in 3V. It is connected to the circuit via
logic ‘high’ level). The voltage across Fig.3. In each oscillator, a series diode/ switch S1, which acts as a power on/
capacitor C begins to rise as current resistor combination placed in paral- off switch. A 100μF capacitor stabi-
from the high level at the inverter out- lel with resistor R results in an asym- lises the battery voltage so that it does
put flows via resistor R. metric square-wave shape by changing not vary in the short term as the oscil-
When the voltage across C rises the resistance depending on whether lators draw varying currents.
above the schmitt-trigger low-to-high the capacitor is being charged or dis-
transition voltage (about 1.5V in this charged. Different capacitor and resis- Building the Songbird
case), the inverter input recognises tor values in each set of three timing- Remember that this is designed to
that the input has gone from a logic chirp-note oscillators produce two be an ideal beginners’ project, so the
‘low’ to a logic ‘high’. It immediately slightly different bird sounds. following description is primarily
changes the inverter’s output to a logic These signals are combined by written for those with limited expe-
‘low’ voltage, almost at ‘ground’ poten- using each output to drive one side of rience. Children from around nine
tial or 0V. the relatively high-impedance piezo or ten years of age can build it (with
The voltage across capacitor C starts speaker, which produces the final help). However, it’s equally suitable
to fall as current flows from the capac- desired bird sounds. for those interested in building a lit-
itor back to the low-level output via The circuit is powered by a battery, tle project that is just a bit different.
resistor R. When the input voltage falls shown at upper-right in Fig.3, compris- Simply put, you can never be too old
below the schmitt-trigger high-to-low ing two 1.5V cells in series to produce to build the Songbird!
transition voltage (about 0.7V), the
inverter input voltage is detected as The basic version of the
a low, and output suddenly switches Songbird uses a simple
to high. The whole cycle then repeats. unetched PCB as the base.
Over many such cycles, the result
is a sawtooth voltage at the input pin If using the battery box
varying from 0.7 to 1.5V, and a square with an integral switch,
wave at the output ranging from almost the base will need to be
slightly wider (63mm) as
0 to 3V. The frequencies of these wave-
the box is longer than the
forms are identical and proportional to holder shown here. Still,
the product of the values of resistor R it does save you from
and capacitor C (the ‘time constant’). having to mount and wire
The basic bird sound is made from up the switch.
two pairs of three of these oscillators
coupled together. In each tri-oscillator
group, one sets the basic timing, the
second creates the chirp, while the
third makes the tone of the bird sound.
Other components around each oscil-
lator modify and combine these three
to produce the final sound. The result-
ing waveforms are shown in Fig.2.
At the top of Fig.2 is shown the
timing oscillator, in the middle is the
chirp oscillator and at the bottom is
the note oscillator.
Children and beginners will need 5 A soldering iron holder – it helps resistor using its coloured bands
help from a more experienced builder, you to avoid accidental contact before fitting (or even better, verify
given the inherent risks of a hot solder- with the iron’s hot tip! A good sol- the value with a DMM set to mea-
ing iron and other possibly dangerous dering station will come with one. sure ohms) because different resis-
tools like side-cutters. 6 A ‘solder sucker’ desoldering tool tors have very similar bands (eg, 1kW,
The instructions assume it will and/or solder wicking braid – these 10kW and 100kW).
be built in four stages, each taking help you to remove solder if you get Your parts supplier may only have
between 20 and 45 minutes. You might it in the wrong place or incorrectly (smaller) 1/8W resistors or (more pre-
prefer to make it in several shorter place a part and need to remove it cise) 1% tolerance resistors, which
10-to-15-minute bursts to better match (that can happen to anyone). will work just as well. 1% resistors
a younger child’s concentration. For 7 A multimeter – you might find this have five bands rather than four. See
the more experienced, you can prob- helpful for checking resistor val- the table in the parts list, which shows
ably build the whole thing in about ues, checking battery voltages and how they vary.
1½ to 2 hours. testing for shorts and open circuits. You will need to bend the leads of
Still, there’s no rush. The Songbird They start under £5 (eg, Jaycar Cat the resistors into a U-shape so you
will happily wait to burst into song QM1500, Altronics Cat Q1053B)! can insert them into the pads on the
until you’re finished. You will likely PCB, as shown in Fig.5(a). You can do
make fewer mistakes if you take your Find a clear space to build the Song- this with your fingers or pliers, but it’s
time. Check each part before solder- bird, such as a kitchen table, with more precise to use a lead-bending
ing and enjoy the relaxed pace of the plenty of light. Also, ensure you have jig (available at low cost from stores
construction process. good ventilation because soldering like Jaycar and Altronics), as it will
will create some fumes. Place a cloth form the bends precisely the right dis-
Some tools you’ll need include: or a layer of newspaper (or similar flat tance apart. Then, insert the resistor
1 A 15-25W soldering iron with a fine disposable material) over your work- as shown in Fig.5(b).
to medium tip. Keep this clean by ing area to avoid marking the tabletop Solder the leads, making sure to
carefully wiping the tip periodi- with your tools, the PCB or molten sol- form a shiny fillet like in Fig.5(c), then
cally on a damp rag or sponge. der during assembly. trim the excess leads using side-cutters
2 0.5-1.0mm fine rosin-cored solder. A helpful way to handle the parts at the height indicated by the dashed
If this is your only project, a 15g during construction is to place them line. Protect your eyes when doing
‘hobby tube’ will be enough in a small plastic tray, say 300mm × this, as the cut leads can be sharp
3 Sharp pair of small side cutters. 200mm, on one side of your workspace. and will fly off if you don’t hold them
while cutting.
Other useful tools include: Construction step #1 (resistors) Note that there are two ways to
4 Fine needle-nosed pliers or a com- The location for each resistor is insert each resistor but the circuit
ponent bending jig (Jaycar Cat shown in Fig.4. It’s usually easiest will work either way. Still, it’s neater
TH1810 or Altronics Cat T1495); to install the resistors in groups. to place them all in the same orienta-
these bend the component leads. Double-c heck the value of each tions, as in Fig.4.
Construction step #2 capacitors are polarised, meaning you white PCB overlay. One end of the IC
(diodes and capacitors) must orient them correctly. The nega- is marked by a notch in its body (some
Next, fit the six diodes as shown in tive lead is marked by a stripe on the ICs have a divot or dot in the nearby
Fig.6. These are all the same type, but capacitor body, while the overlay dia- corner instead). This end goes clos-
your diodes may have a slightly differ- gram indicates where the longer posi- est to the Songbird’s eye, as shown
ent body colour to those shown here. tive lead is inserted. in Fig.8.
Their size is exaggerated for clarity in Once they are in the right places and Before trying to fit the IC, it’s help-
Fig.6; the important thing is that, in have the correct orientations, solder ful to slightly bend each row of IC
each case, the black stripe on the end each capacitor and trim the leads. The pins until they are close to parallel.
of the glass body must face down or two larger electrolytic capacitors go on Gently roll each side of the IC towards
to the right as shown. the rear side, allowing the Songbird’s the ends of the pins on a hard flat sur-
Bend each diode’s leads as you did eye to be more clearly seen. Mount face, as shown in Fig.7, so that the IC
for the resistor. When you insert it, them last. pins lie parallel (or close to it). You
make sure to align the diode’s black can also buy a tool to do this (again,
band with the band printed on the PCB Construction step #3 check Jaycar and Altronics), which
overlay. Solder and trim the leads in (the integrated circuit) is easier to use, but the flat surface
the same way as for the resistors. You must fit the 74HC14 CMOS IC method does work well provided you
Next, fit the four ceramic capacitors, to match the pattern shown on the are careful.
shown in yellow in Fig.6. Two have the
same value. Take care to place the cor-
rect part in the right location, although
they are non-polarised, so it doesn’t
matter in which of the two possible
orientations you fit them. The PCB
silkscreen overlay shows the value of
each capacitor to help you.
Ceramic disc capacitors may be
marked in various ways. The most
common markings are shown in Fig.6.
After fitting each component, solder
and trim the leads similarly to before.
Next, fit the three smaller axial
electrolytic capacitors, which are
mounted on the top side of the PCB.
They come in metal cans with a plastic
covering except at the top. Electrolytic
Fig.6: this diagram will help you to fit the diodes and the capacitors on the
Fig.5: each resistor should be (a) bent Songbird’s PCB. The ceramic capacitors are not polarised and can go in either
to shape, (b) placed down on the PCB, way around. However, the electrolytic capacitors must have their longer
soldered, and then trimmed with side leads inserted in the pads marked with a + (the stripe on the can indicates the
cutters (dotted line height) to produce opposite, negative lead). Similarly, the diodes must be fitted with the cathode
the result at (c). stripes facing as shown.
Now fit the IC into the PCB as along the lower edge of the Songbird battery box. Just make sure you can
illustrated in Fig.8 and solder all the PCB. The result is surprisingly robust. still open it to replace the cells!
pins. You don’t need to trim the pins The double AAA-cell battery holder The piezo speaker can be mounted
after soldering, as they should only and slide switch are then mounted on the rear of the main PCB using
just project through the other side of directly to this blank PCB, the former a 3D-printed speaker mount (see
the PCB. with a couple of drops of epoxy glue Fig.9) and a couple of dabs of hot
and the latter by soldering three of the glue. You could print this yourself
Construction step #4 unused lower tags of the slide switch if you have a 3D printer – STL files
(speaker and battery) to the blank PCB base. for all the 3D-printed items used in
There are two ways to complete the Note that kits will include a battery this project are available from the
Songbird. You can use a simple square box with an integral switch, simpli- May 2024 page of the PE website:
PCB for the base. This version is quick fying construction somewhat. The kit https://bit.ly/pe-downloads
and easy to build. Alternatively, you will also have a double-sided tape pad The two piezo speaker wires may
can create a more elaborate birdcage that you can use to stick that box to be connected either way around to the
and base. That will take more time, the base very easily and quickly. Since PCB at the two points marked ‘Piezo’
but it gives a more attractive finish to the battery box is a bit longer than a on the overlay, as shown in Fig.10.
the project. simple battery holder, it would be best You can trim the wires slightly if they
to use a 63 × 45mm unetched PCB for are too long before soldering them in
Option 1 – simple PCB base the stand in this case (not included place. These wires may be almost any
The photo at upper left shows the in the kit). colour, and some can be pretty deli-
basic version with the PCB mounted Alternatively, you could use hot cate, so a little care is required.
to a single-sided, unetched 52 × 45mm melt glue or silicone sealant to attach Finally, add the battery and switch
PCB base by soldering a few spots the Songbird PCB to the side of the wiring; the switch is not required for
the battery box included in the kit, as
it is already integrated into the box.
In that case, you just need to connect
the two wires from the box to the PCB
but watch the polarity; the red wire
must go to the terminal marked + on
the PCB.
to mount on a curved surface. The If you prefer that the speaker is out
Songbird is then mounted on the base of sight, there is enough space in the
using two small PCB off-cuts mea- base for it to be glued there using the
suring about 3 × 6mm. These are sol- 3D-printed speaker holder. However,
dered on the lower edge on the rear the bird sounds will be less audible.
of the main PCB, separated by a gap The birdcage is made from 18-gauge
of about 10mm. (1.2mm diameter) galvanised wire and
This method allows the Songbird to a 20mm diameter piece of tinplate.
be mounted into the slot in the base You can obtain the galvanised wire
and then adjusted from side-to-side in from most garden centres or hardware
the slot to centre the Songbird in its stores. I cut the circular piece of tin-
cage. The gap in the slot is used for plate from a discarded tin can.
the wiring to the switch and battery. It’s easiest to begin by unrolling
The wiring details inside the base are about a metre of wire from the wire
shown in Fig.11. roll. Get this as straight as possible by
The piezo speaker is mounted in holding one end of the wire in a vise
the same way as the basic version and pulling on the other end with a
(Option 1). The battery and speaker pair of heavy-duty pliers. Modest force
wiring to the PCB is the same as shown is sufficient. Then cut eight 105mm
in Fig.10. lengths from this straight piece.
We can help and advise with your enquiry, BACK ISSUES – ONLY £5.95
from design to construction. Practical Practical Practical Practical Practical
D NA –
D NA –
IG E
IG E
PE
!
PE
ES M
N
ES M
N
N NEW E
N NEW E
Electronics
–
Electronics
EW
EW
The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine The UK’s premier electronics and computing maker magazine
Circuit Surgery Make it with Micromite Audio Out Circuit Surgery Make it with Micromite Audio Out Circuit Surgery Make it with Micromite Audio Out Flowerpot speakers! PIC n’ Mix Circuit Surgery Make it with Micromite Audio Out Circuit Surgery
Timing and metastability Build an RGB display project Construct a Timing and metastability Fun display project How to make a Transformers Accessing Internet data Superb microphone A low-cost route to Software tools for Understanding Analogue inputs and Constructing the PE Micro-Cap 12
in synchronous circuits using a Micromite Plus transistor radio in synchronous circuits using a Micromite Plus transistor radio and LTspice with your MKC preamplifier high-quality Hi-Fi the PIC18F Differential amplifiers using servomotors Theremin amplifier simulator review
Frequency Reference Mastering Nutube Guitar WIN! Touchscreen WIN! Ultrabrite LED WIN! Don’t miss Random WIN!
WIN!
Signal Distributor RFID tags for Microchip Overdrive and Superb PE PIC Microchip Wide-range Microchip bike light Microchip
Explorer 16/32 our Super Number Microchip
MPLAB Starter Kit
your projects
Curiosity HPC
Development Distortion Pedal Development PIC24F LCD and
USB Curiosity
RCL Box
MCP19114 Flyback
Standalone
Development
Kit Summer Sale! Generator for Serial Memory
Products
Board
WIN!
Board Development
Board
Evaluation
Board WIN! WIN!
Clever Controller
Meet the for dumb chargers
Meet the Cricket: Mastering stepper Micromite
making IoT designs motor drivers Explore-28 Hi-Fi amp on
super easy! the cheap!
Programmable Robot Buggy
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
I
n the last month’s part of our Teach-In series, we
introduced digital I/O and showed you how to interface About Teach-In
buttons and switches, and how to drive loads such as Our latest Teach-In series is about using the popular ESP32
LED, relays and sounders. We also showed you how to use module as a basis for learning electronics and coding. We
the Serial Monitor to test and debug your code. In this third will be making no assumptions about your coding ability
or your previous experience of electronics. If you know one
part we will be introducing the ESP32’s analogue-to-digital
but not the other, you have come to the right place. On
converter (ADC) and moving into the analogue world. Our the other hand, if you happen to be a complete newbie
Teach-In Practical Project is a tester for 1.5V alkaline batteries. there’s no need to worry because the series will take a
The learning objectives for this third part of our series are progressive hands-on approach. There will be plenty of
to know how to: time to build up your knowledge and plenty of opportunity
n Configure and use simple analogue I/O to test things out along the way.
n Interface analogue sensors We’ve not included too much basic theory because this
n Use binary, octal, hexadecimal and ASCII. can be easily found elsewhere, including several of our
previous Teach-In series, see:
ESP32 analogue input https://bit.ly/pe-ti
The ESP32 has two 12-bit analogue-to-digital converters https://bit.ly/pe-ti-bundle
(ADC). Each of these supports up to 18 analogue channels, Earch month, there’ll be projects and challenges to help you
but not all may be available in a particular development check and develop your understanding of the topics covered.
board implementation. For example, the 30-pin board that
we’re using for most of our practical projects has just six the DAC) to an analogue value perceived by the comparator
ADC1 channels and nine ADC2 channels available. A further as being the same as the analogue input.
limitation is that ADC2 is unavailable when Wi-Fi is being
used. Obviously, this isn’t an issue if Wi-Fi isn’t required, but Reading analogue inputs
it might be a problem if you need many analogue channels. Last month, we used digitalRead() to sense the state
Fig.3.1 shows the ADC pins available on the most common of the ESP32’s GPIO pins, the result being either HIGH or
30- and 36-pin ESP32 boards. LOW. The corresponding function for analogue inputs is
The ESP32 ADC uses a technique known as ‘successive analogRead().
approximation’. This uses a comparator
that compares an analogue input with the
output of a digital-to-analogue converter
(DAC), as shown in Fig.3.2. The digital
input to the DAC (a 12-bit value) is held
in a dedicated successive-approximation
register (SAR). This holds a series of
values that rapidly approximate to
an SAR value that’s equivalent to the
analogue input. The process stops when
the data held in the SAR is converted (by
Gotcha!
The ESP32 supports 18 different
analogue channels but not all of
them may be present on a particular
development board.
Fig.3.1. Analogue pins on two common ESP32 development boards (30-pin left/36-pin right).
Gotcha!
ADC2 can’t be used if your application is using Wi-
Fi. So, if you do need Wi-Fi it’s important to use
ADC1 instead.
Fig.3.2. An ADC based on successive approximation.
As you might expect, analogRead() requires a GPIO pin as There are two things to note from this. First, we need to
an argument. Note that we would normally want to assign the use a float because we are no longer dealing with integer
pin before the main body of code using a statement like this: values for voltage.
Second, a scaling factor (3.3/4095) is needed to convert
int analogPin = 15; // Sensor voltage on pin-15 our raw reading from the ADC into a corresponding voltage.
It’s worth checking this out by connecting an ordinary
Here, GPIO15 (often marked ‘D15’ on development boards) potentiometer (10kΩ to 20kΩ would be ideal) across the
corresponds to ADC2 Channel 3. Later in the code we will 3.3V supply with the slider taken to the pin in question, as
need a variable in which to store the returned analogue value shown in Fig.3.3. A suggested wiring arrangement is shown
from pin-15. We can do this using: in Fig.3.4.
Enter or download the code shown in Listing 3.1 – all this
int rawReading = analogRead(analogPin); // month’s code is available for download from the May 2024
Sensor value page of the PE website: https://bit.ly/pe-downloads
When you execute the code and start the Serial Monitor
The result stored in rawReading will be a 12-bit value you will see the voltage present at pin-15 updated every
from the ADC. This can range from 0 to 4095 (where 4095 second. If you rotate the shaft of the potentiometer over its
corresponds to the 3.3V DAC reference voltage). full range, you will see the voltage changing smoothly from
In some applications you might need to convert the 12-bit 0V at one extreme to 3.3V at the other. Typical analogue
value from the ADC into a corresponding voltage value. To readings are shown in Fig.3.5.
do this, you will need to convert the value returned by the
ADC and store it in a float variable, as in:
Fig.3.4. Wiring arrangement for the circuit shown in Fig.3.3. Fig.3.5. Typical analogue readings obtained from the Serial Monitor.
void loop() {
Gotcha! int rawReading = analogRead(analogPin);
Voltages outside the range 0 to 3.3V must // The raw reading from the potentiometer needs to be
never be applied to the ESP32’s analogue // converted to volts and stored as floating point
input pins. If you need to measure larger float volts = rawReading * (3.3/4095);
voltages it will be necessary to use a potential // Send the value and print it using the serial monitor
divider at the input. Furthermore, in some Serial.println(volts);
applications it’s important to avoid reverse delay(1000); // Delay for 1s before repeating the loop
polarity at the input. }
void loop() {
// Select ADC2 Channel 3 (GPIO pin-15)
int gpioPin = 15;
// Read the voltage at D15
int analogVolts = analogReadMilliVolts(gpioPin);
// Display the current voltage in mV
Fig.3.6. The ESP32’s ADC step size. Serial.printf(“ADC input = %d mV\n”,analogVolts);
// Wait for a while
delay(1000);
ESP32 ADC performance }
Before we move on to some practical ESP32
ADC applications it’s worth explaining some
of the specifications and potential limitations size is illustrated in Fig.3.6. If ESP32’s ADC is that it does exhibit
of the device. you don’t need the full default some non-linearity, as shown in Fig.3.7.
12-bit resolution you can
Resolution select a different value using Range
The resolution of an ADC is defined by its step size. analogReadResolution(). The ESP32’s analogue input range extends
In the ESP32, a 3.3V supply reference is used with a For example, 10-bit resolution from 0V to 3.3V. The voltage applied must
12-bit ADC. This achieves a comfortably small step (210 = 1024 different values) not be allowed to fall outside this range.
size of approximately 0.8mV (3.3/4096). This step can be selected using
analogReadResolution(10). Introducing the Serial Plotter
Thus far in our series we’ve made
Accuracy extensive use of the IDE’s Serial Monitor,
The accuracy of an
ADC depends on
the accuracy of its
reference voltage
source. The reference
voltage for the ESP32
is derived from the
3.3V supply and there’s
no provision for an
external (and more
accurate) reference
voltage source.
Linearity
Ideally, an ADC
should be perfectly
linear. Unfortunately,
Fig.3.7. ESP32 ADC non-linearity (the range from a n u n c o m f o r t a b l e Fig.3.8. Circuit to demonstrate the use of the
1V to 2.75V can be considered reasonably linear). p e c u l i a r i t y o f t h e Serial Plotter.
void setup() {
Serial.begin(9600);
}
void loop() {
// Get the current input from the LDR
int ldrValue = analogRead(analogPin);
Serial.println(ldrValue);
delay(1000);
// Repeat forever
}
Fig.3.10. Serial Plotter display for Listing 3.2. Fig.3.12. Suggested wiring diagram for Fig.3.11.
Fig.3.15.
PWM
principle.
Check it out!
Having demonstrated how easy it is to sense light level using
a low-cost LDR it is worth showing how this inexpensive
component can form the basis of a simple automatic lighting
controller. Fig.3.13 shows the circuit of our automatic light
controller. The output of our ESP32 at D4 is fed to a relay
analogWriteFrequency(10000); //
Generating waveforms
Let’s now move on to generating a waveform rather than a
steady average. This is a little bit trickier because we will
Fig.3.16. PWM output waveform. need to code the waveform into a repetitive loop in which
successive values of duty cycle are output via the DAC. Listing
3.5 shows an example of generating a stepped waveform:
If you enter and execute the code in Listing 3.5 and connect
a DC voltmeter between pin-15 and ground you should be
rewarded with series of voltage values that steadily increment
from zero to about 2.9V in increments of about 0.32V. This
is a simple low-speed stepped waveform. You might now be
wondering if it’s possible to generate a sinewave so let’s examine
The waveform in Fig.3.15(b) is HIGH for 25% of the time void setup() {
and low for the remaining 75%. It has a mark-space-ratio of }
1:3. The HIGH time is one quarter of the total time for the
cycle and so the duty cycle is 25%. void loop() {
for (int step = 0; step < 10; step++) {
The waveform in Fig.3.15(c) is HIGH for 75% of the time
analogWrite(outPin, step * 25);
and low for the remaining 25%. It has a mark-space-ratio of delay(2000); // 2 sec. delay between levels
3:1. The HIGH time is three quarters of the total time for the }
cycle and so the duty cycle is thus 75%. }
Now look again at the three waveforms in Fig.3.15 and note
how the average value of voltage differs according to the duty
cycle. In Fig.3.15(a) the average value is 0.5V where V is the Listing 3.6 Code for sinewave generation using a look-up table
maximum value. The corresponding averages for Figs.3.15(b)
and 3.15(c) are 0.25V and 0.75V. Thus, as we change the duty /* Low frequency sine wave generator.
cycle of the wave we also change its average value. This code uses the default PWM settings. */
The first of the two parameters used in the analogWrite()
function is the GPIO pin number, while the second relates to int outPin = 15; // Use GPIO D15
the duty cycle of the waveform. By default, this parameter // This is the sinewave lookup table:
const uint8_t sineLUT[] = {
can range from 0 to 255, corresponding to duty cycles from
128, 152, 176, 198, 218, 234, 245, 253,
zero to 100%. So, for example, to generate a 50% duty cycle 255, 253, 245, 234, 218, 198, 176, 152,
waveform at D15 we could use lines of the form: 128, 103, 79, 57, 37, 21, 10, 2,
0, 2, 10, 21, 37, 57, 79, 103
int outPin = 15; // PWM output pin };
Fig.3.18. Sinewave output produced by Listing 3.6. Fig.3.19. Sinewave output produced by Listing 3.7.
two ways of doing this; first, using a look-up table (LUT) and
second, by calculating values using the maths library. Gotcha!
The code in Listing 3.6 produces a sinewave of about When using the noTone() function to turn off your tone
2Vpk-pk with a frequency of 10Hz. The output waveform you must ensure that the ‘T’ is in upper case, notone()
just won’t work!
benefits from the addition of the simple C-R low-pass filter
(R1 and C1) shown in Fig.3.17. This helps to smooth the
output waveform and improve its shape. The frequency can There’s another way of generating a sinewave that uses the
be changed by altering delay(). Varying the delay parameter built-in maths library. Here we repeatedly calculate values as
from 1 to 20 will change the frequency from 31Hz to 1.6Hz we need them rather than extract them from a look-up table.
respectively. Fig.3.18 shows the waveform produced. Listing 3.7 shows how this is done. Once again, the delay
parameter sets the frequency of the sinewave output.
Fig.3.19 shows the waveform produced.
1278 = (1 × 64) + (2 × 8) +
(7 × 1) = 64 + 16 + 7 = 8710
void loop() {
10112 = (1 × 8) + (0 × 4) + (1 × 2) + (1 × 1) = 8 + 2 + 1 = 1110. for (int dutyCycle = 0; dutyCycle <= 255; dutyCycle++) {
ledcWrite(ledChan, dutyCycle); // Output to the LED
Octal (base 8) number system delay(delayTime);
In the octal (base 8) number system, the weight of each }
digit is eight times as great as the digit immediately }
to its right. The rightmost digit of an octal integer
/*
Decimal, binary, octal, and hexadecimal table
*/
void setup() {
//Initialize serial and wait for port to open:
Serial.begin(9600);
while (!Serial) {
; // Wait for the serial port
}
delay(1000);
// Print the table heading and
// use tabs to separate columns
Serial.println(“”);
Serial.print(“Dec.”);
Serial.print(“\t”); Fig.3.23. Conversion of binary to hexadecimal (and vice versa).
Serial.print(“Binary”);
Serial.print(“\t”);
Serial.print(“Octal”);
Serial.print(“\t”);
Serial.print(“Hex.”);
Serial.print(“\t”);
Serial.println(“ASCII”);
}
void loop() {
delay(200);
Serial.print(lineValue);
Serial.print(“\t”);
Serial.print(lineValue, BIN);
Serial.print(“\t”);
Serial.print(lineValue, OCT);
Serial.print(“\t”);
Serial.print(lineValue, HEX);
Serial.print(“\t”);
Serial.println(char(lineValue));
if (lineValue == endValue) {
while (true) {
continue; // Got to the end!
}
}
lineValue++; // Go round again ...
}
Next month
In Part 4, we will introduce seven-segment LED
and matrix displays. Coding workshop will
deal with random number generation and our
Practical Project will feature a dice roller.
A
few moments ago, as I pen
these words, I was conversing
with my son about – let’s say an
occurrence that had just occurred – when
I started to make the comment, ‘If there’s
one good thing to be said for any of
this…’ and he finished my sentence by
saying ‘…it’s not our fault and it’s not
our problem.’ I felt so proud. Despite
his habitual look of disinterest when
I’m discoursing, it turns out he has been
listening to me after all.
That’s interesting
I’m a digital logic designer by trade.
Although we haven’t discussed any of
this thus far in our bootcamp columns,
there are several mathematical tools
available to make the lives of digital logic
designers simpler, including Boolean Fig.2. Dual breadboard setup (Source: Mike Tooley / PE).
algebra, Karnaugh maps, and De Morgan
transformations. Don’t panic. We aren’t columns appeared in Scientific American One of the things that immediately
going to go into any of these tools here. magazine for a quarter of a century. caught my eye was the first picture of
However, if you do plan on taking a One of the topics covered in Martin’s Mike’s breadboard setup, which was
deeper dive into electronics, it would book is Venn diagrams, which typically accompanied by the caption: ‘Two
be a good idea to gain some familiarity involve the use of circles to illustrate (slightly modified) breadboards provide
with these topics. In which case, may I simple set relationships in areas like a convenient space for a 30-pin ESP32
make so bold as to note that they are all probability, logic, statistics and computer development board.’ Look and see for
introduced in excruciating exhilarating science. The reason I mention this here is yourself (Fig.2). Do you spot anything
detail in my book, Bebop to the Boolean that I’m bubbling over with glee because interesting and/or unusual? Jot down
Boogie – see: https://bit.ly/3u9XIWV I just spotted something that (a) relates to a list and then we can compare notes.
I often use Bebop as a reference myself. what we’ve been talking about in recent The first thing I observe is the gaps in
The scary thing is that I regularly read columns and (b) falls neatly into a Venn the middle of the red and blue horizontal
something in there and think, ‘Wow, diagram intersection of ‘that’s interesting’ lines reflecting the power and ground
that’s interesting, I never knew that,’ and ‘it’s not my problem’ (Fig.1). rails, respectively. This indicates that the
before remembering that I wrote it in conducting rails inside the breadboard
the first place. Another book I keep It’s not my problem are themselves split. As we discussed in
for reference is Logic Machines and A couple of columns ago (PE, March my Arduinos and Solderless Breadboards
Diagrams by Martin Gardner (https:// 2024), we migrated to using a dual- blog (https://bit.ly/3PdnqBk), these ‘split-
bit.ly/3v7b8DJ). Martin was one of breadboard setup. At that time, we noted rail’ boards make it easier to work with
my heroes. His Mathematical Games that it is possible to remove one or both circuits that require a mix of power
power and ground rail assemblies from supplies, like 5V and 3.3V, for example.
That’s interesting It’s not my problem the top and bottom of the breadboard. Did If Mike is intending to use only a single
you pause to say to yourself, ‘I wonder supply, then he will add jumpers to link
why anyone would ever want to do such both sides of the power rails and both
a thing?’ Well, as soon as the full March sides of the ground rails.
issue of PE landed on my desk, I read it Now look at the middle of Mike’s dual-
cover-to-cover. One item of particular board setup. The ESP32 is so wide that if
interest to me was Part 1 of Mike Tooley’s we tried plugging it into just one board,
Teach-In 2024 – Learn electronics with there would be no free terminal holes
the ESP32. This is going to be awesome. on one side and only one free hole next
That’s interesting AND it’s not my problem I’ve never found the time to play with an to each of the pins on the other side. As
ESP32, so I’m going to follow this series we see, Mike has removed the upper
Fig.1. Venn diagram. with great interest. power and ground assembly from the
E D C B A
the left.
Personally, I would have preferred
Upper Breadboard
D1 D0
the numbers to start with 1 on the left
H G F
H G F
and increment as we move to the right.
Of course, they do this if we rotate the
I
I
J
J
60 55 5 1
0 5 55 60
and Fig.3b). In this case, the count starts E3 1C
at 0, which actually makes good sense
Lower Breadboard
E D C B A
2B
I
60 55 5 0
positioned halfway between the second
and third columns, thereby requiring us
From Arduino 11 10
(b) Mike’s breadboards to count back from column 5 to determine
with which column the 0 is related. Also,
Fig.3. Can you spot the difference? this leads us to the realisation that the Fig.4. Controlling the displays with transistors.
leftmost column is numbered –1. Color
me confused. least, for the moment) is to use eight
lower board before connecting the boards It gets worse. If you look at row A in of the Arduino’s pins (pins 2 to 9) to
together. This allows his ESP32 to span the upper left of one of Mike’s boards drive both displays in parallel (side-
the two boards while still leaving two and follow it horizontally to the right, it by-side). Also, for each display, we’ve
free breadboard terminal holes next to ends up as row J. Similarly, if you look at added a BC377 transistor to control its
each of its pins. column 0 in the upper left of the board ground pin. Arduino pins 10 and 11
Thus far, everything reflects what we’ve and follow it vertically to the bottom, it are used to control displays D0 and D1,
discussed in our earlier columns. I’ve ends up as column 61. respectively (Fig.4).
saved the best (or worst, depending on Other than having rotational symmetry, You can remind yourself of our entire
your point of view) for last. Suppose you which benefits us not at all, this annotation current setup by downloading, perusing,
are playing a remote game of chess. If it’s scheme has nothing whatsoever to and pondering of our latest and greatest
your opponent’s turn and they send you recommend it. For example, if you are incarnation (file CB-May24-01.pdf).
a message saying ‘Qf3,’ then you know using a board as shown in Fig.3a, there As usual, all of the files that are mentioned
they’ve just moved their queen to the is no ambiguity if you are instructed to in this month’s column are available from
square located on file (column) f and row ‘Connect a wire between B3 and G60.’ By the May 2024 page of the PE website:
3. The reason you know this is because comparison, following this instruction is https://bit.ly/pe-downloads
everyone who plays chess has adopted more than problematic if your board is As one final reminder, our BC377
a standard notation for describing and as shown in Fig.3b because there are two transistors are of a type known as NPN.
recording the moves. locations that can be addressed as B3 and The way we are using these transistors
Similarly, there are occasions when two more that can be referenced as G60. in this circuit, we can think of them as
it may be advantageous to be able to Happily, if there’s one good thing to acting like switches. In the case of an
document instructions for populating a be said for any of this… it’s not my fault NPN transistor, applying 0V (LOW) to
breadboard with components and wires and it’s not my problem! its control terminal (the base, B) will
using some form of standard notation turn the transistor off, which means it
along the lines, ‘Connect a 150Ω resistor Preparing to rock and roll will act like an open switch. In turn, this
between locations (x1,y1) and (x2,y2)’ Just to set the scene, let’s remind ourselves means the ground pin on the display can’t
or ‘Connect a wire between locations that we now have two common-cathode activate any of the light-emitting diode
(x3,y3) and (x4,y4).’ But what form of 7-segment displays in play. In addition (LED) segments, even if the Arduino is
notation should we use to identify our to their ground pins (their common trying to light them up.
(x,y) values? cathodes), each display has eight segment By comparison, applying 5V (HIGH)
Suppose you were the inventor of (anode) pins (the decimal point counts to the transistor’s base will turn it on,
the original breadboard. One approach as a segment), so 16 anode pins in all. which means it will act like a closed
might be to use the letters A through As we noted in our previous column switch between its collector (C) and
E and F through J to identify the rows (PE, April 2024), the Arduino Uno has emitter (E) terminals. This will effectively
while also employing numbers to 14 digital I/O pins numbered 0 to 13. connect the display’s ground pin to the
identify the columns. Well, that seems We are reserving pins 0 and 1 for UART breadboard’s ground (0V) rail, which
to be simple enough. I mean, seriously, communications with our host computer, means any of its segments being powered
how complicated could it be? More which leaves 12 pins for us to work with. by the Arduino will light up.
complicated than you might think. The problem is that our dual displays
Let’s start with the breadboards I’ve require 2 x 8 = 16 pins. This is a bit of a Firing up our two displays
been using (Fig.3a). As we see, the letters poser. A conundrum, some might say. This bit is very important. Since our two
A through J are associated with the rows The solution we decided to adopt (at displays are wired in parallel, we must
Listing 2b. The loop() function for first test. Fig.5. Welcome to the real world (we hope you’ll enjoy your stay).
Fig.7. One set of current-limiting resistors will suffice. Listing 4a. The loop() function for second test.
Teach-In 8 CD-ROM EE
FR -ROM
CD
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
has been designed for electronics enthusiasts who want to get to • Programming – powerful integrated development system
• Microcontrollers – understand control operations
SOFTWARE
The CD-ROM contains the software for both the Teach-In 8 and PICkit 3 series.
OUT
L R
By Jake Rothman
Back to the buffers – Part 4
T
his month, we’ll wrap up the strategy is to start by combining circuit subtle low-frequency rise in THD that
series on discrete op amp/buffer blocks you already know work. If it occurs with capacitors, for example.
designs. The complexity of a full doesn’t work, it’s easier to find the fault. To fix the oscillation, I placed a
discrete op amp is not really required for There was a hard offset upon turn-on capacitor (CComp) across the collectors
a buffer and the simple three-transistor because I forgot that the omitted voltage- of the long-tailed pair. I used 470pF out
circuits given (PE, April 2024, Fig.24, amplifier stage was inverting. To get of the ‘mixed cap’ drawer which fixed
Fig.27) are usually sufficient. However, round this, the negative feedback had to the oscillation problem. I then checked
sometimes op amp characteristics, such be applied to the non-inverting terminal for slewing distortion which occurred
as a low output offset are occasionally OA+ on the input stage. Guess what? It at a too low a frequency of 40kHz, so
needed. The high open-loop gain of a still didn’t work. Then I remembered the I then reduced the capacitor to 150pF
full op amp (discrete or monolithic) also current mirror had to be turned round – but then some other unwanted high-
enables a very low output impedance to as well. One side of the mirror is output frequency signal appeared. Fortunately,
be obtained. There are some expensive and the other, the diode-connected this was not an oscillation, but 470kHz
dedicated buffer chips available, such transistor side (TR5 on the original op RF noise emitted from a new Metcal
as the LM302, which employs 18 amp circuit (PE, October 2023, Fig.15)), soldering iron I had recently started
transistors. So, I thought a ‘halfway- is for current sensing. Having done this using. Unfortunately, this new problem
house’ discrete solution based on an necessary ‘flipping’, the circuit worked. also had me going round in circles for
op amp input stage with the voltage Next, I needed to do some optimisation. a couple of days after sudden rises in
amplifier stage (VAS) omitted would be distortion on various amplifiers I was
worthy of some R&D. Oscillation testing. The problem was solved by
As is usual with new circuits with moving the soldering iron away from
Op amp buffer design negative feedback, it oscillated when the test circuit, at which point I was
My resulting design is a two-stage op first turned on. It was barely visible relieved to determine that the 150pF
amp, sometimes called a ‘Schlotzaur on the scope as a
circuit’. It has an open-loop gain of thicker trace, but
around 6000 if constant current loads very apparent on the +25V
19mA
are used. To start, the discrete op amp distortion analyser, R4 R3 R7
200Ω PR1 200Ω 10kΩ
board from the October 2023 article was with a reading of 5kΩ
used with a long-tailed pair (LTP) stage 0.02% THD+N
followed by a class-A emitter follower. a t 1 V rms ( t o t a l DC offset 4.8mA
Distortion depression
However, this low distortion was only for
an output signal of 1Vrms (2.8Vpk-pk) into
600Ω. I needed to check the distortion
at different output levels all the way up
to clipping. I increased the output level
in 1Vrms steps on the Fig.37 FET op
amp buffer giving the curves shown in
Fig.39. What looked good at 1Vrms didn’t
look so good at higher test levels up to
clipping. There was a rise in distortion
at the low-frequency end at 12Vrms due
Fig.40. Using the original full discrete op amp as a buffer suffers from rising high- to the modulation capacitor C8 getting
frequency distortion. Note that the top curve is for the output just before clipping at stressed.
17Vrms. I then tested the original full discrete
op amp (PE, October 2023, Fig.15) wired
as a buffer with 100% negative feedback
and this gave a large high-frequency
(10kHz) distortion hump of 0.026% at
16Vrms, shown in Fig.40. This is because
a lot of compensation capacitance is
required to make this topology unity-
gain stable. This causes a problem with
slewing when driving the capacitance
and there is little negative feedback at
high frequencies left for output stage
distortion reduction. It did give a large
output of 17Vrms (48Vpk-pk) just beginning
to clip with ±25V rails, 2Vrms more than
the single-ended three transistor circuit
for the same rail voltage.
+
*Set Iq 22µF VO
what I’m good at! It takes me longer to 10V
R1 R12
input the schematic into LTSpice than C2 47Ω
100kΩ 100pF Ib Th
erm R11
it does to build it. I can pull out any TR2 al 22Ω
0V BC456B link
component from my vast ‘Cupboard-
R7*
Based Programming Language’ 6.8Ω
(CBPL, shown in Fig.44) quicker than
downloading any component model R9
on-line. When I need a simulation I can 100Ω TR6
ZTX751
always get a friend with the necessary D3 TR4
0V BC456B 4.2mA
10,000-hours practice time to do a 1N4148
R5
skills swap with me. The catch with C6 D4 130Ω
100nF 1N4148
my CBPL method is that the file size 13.5mA
–25V
is 1500 square feet. You need to have
bought a house before 1995 or have had
a big inheritance to install it. Fig.45. ‘Diamond’ buffer. An unusual circuit with two parallel, but opposite polarity input
emitter follower stages. These then drive a complementary class-AB emitter-follower output.
Fig.44. ‘Cupboard based programming language’ for analogue Fig.46. This Avondale Audio active crossover board uses four
circuits. This shelf of passive components comprises 650 diamond buffers with a similar proprietary circuit to Fig.45. The
Farnell plastic drawers alone. (These cost more than the parts transistors are thermally coupled to ensure a stable quiescent
in some cases!) current. Note there are lots of SMT components under the board.
LED1
The Diamond buffer is an interesting,
+VE
R5 R6 R12 GND
C7
if poorly named circuit, which I first -VE
came across in an Elektor oscillator C4 C6
R7 R10 ZD1
design (February 1979). It is a class- C3
SGL SUPPLY
AB push-pull mirror-image circuit R3
LINK
I/P
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
T
his month, we will start to converter (DAC). The output of the the signal value is captured and stored
look at various topics related to DAC is a ‘stepped’ waveform which for processing at specific points in
digital signal processing (DSP). is converted to a smooth analogue time. Sampling usually occurs with a
DSP covers a wide range of electronics waveform by the reconstruction filter. fixed time interval (called the sample
applications where real-world signals Fig.1 shows key components in a generic period, T) between sample points. A
such as sound, images, temperature, pres- DSP system, but not all DSP systems sampling period of T corresponds with
sure, position and speed are converted will contain all these components. For a sampling frequency (or rate) of 1/T.
to digital data for manipulation, analy- example, digital generation does not Sampling frequency is a key performance
sis, storage and display. The resulting require the input half from Fig.1 and the parameter of DSP systems. In the most
processed digital information, or new system’s output may not require a DAC basic approaches, the sampling frequency
information which has been generated if it is just one or more on/off controls, is the same throughout the system, but it
digitally, can also be converted into real- or a pulse-width-modulated signal. is also possible to use different rates in
world signals for human consumption different parts of a system. For example,
(eg, audio and video) or manipulation Sampling and quantisation initially sampling the analogue signal
of the physical world (eg, mechanical We assume that analogue signals can have at a relatively high rate, but effectively
and thermal). These systems can be rela- an infinite number of possible values resampling (within the digital part) to a
tively complex (for example, streaming between their upper and lower limits lower rate for performing the processing
movies from the internet or control of (peak values). We also assume that their operations (this is called ‘downsampling’
industrial robots) or relatively simple value may be different (by some arbitrary or ‘decimation’).
(for example, a basic microcontroller small amount) after an infinitely small A signal defined at a set of sample
measuring temperature). change in time. This is not strictly true times is referred to as a discrete time
Fig.1 shows the key elements of when you consider that electric current signal, to distinguish it from a continuous
DSP systems, with a signal path from depends on discrete charge carries (eg, time signal. Digital (DSP) circuits process
analogue input via digital processing to electrons) and quantum effects come discrete time signals, but it is also possible
analogue output. The input signal passes in to play when at sufficiently small to build analogue circuits which work with
through an analogue antialiasing filter scales. However, for the majority of sampled signals. These use continuous-
which removes frequencies that would analogue electronic circuit designs it value analogue signals that update to new
otherwise cause errors. A sample-and- is reasonable to assume this property values at each sample point. Switched-
hold circuit captures the filtered input for analogue signals. capacitor circuits are an important example
signal at the points in time at which it is On the other hand, digitised analogue of this technology, and are widely used
to be digitised. The process of sampling, signals can only have a finite number in integrated circuit design.
and the use of antialiasing filters are key of possible values. This is because they
concepts in DSP and will be discussed in are represented by digital code values, Sampled signals
more detail in this article. An analogue- which have a finite number of bits. The top plot in Fig.2 shows a set of
to-digital converter (ADC) produces An ADC/DAC with an N-bit output/ sample points, with sample period T,
digital codes that represents the values of input digital word can handle at most on an analogue waveform. The sampled
the analogue signal at the input sampling 2N different values. When an analogue signal itself, in its most general form, is
instants. The digital processing performs signal is digitised, the process of going just a set of values associated with the
operations on the digitised signal (data); from an effectively infinite number of sample times. It does not have a value
this can be implemented directing in possible values to a finite one is called between these times – this is illustrated
digital hardware or by software running quantisation and is an inherent property in the middle waveform in Fig.2. This
on a processor. of ADCs. We will look at ADCs (and representation fits directly with digital
The result of the digital processing DACs) in more detail in a later article. data – a set of discrete values stored in
of the input signal (or results of direct Digitised (sampled) analogue signals a digital circuit, computer memory or
digital generation) are converted to also only change to a new value after other media.
analogue values at the output sample a finite amount of time – this is the If sampled values are processed in
times using a digital-to-analogue fundamental nature of sampling, where an analogue circuit, then the signal is
often held constant between sample
Analogue Digital Analogue points and waveforms typically have
Antialiasing Sample and Digital Reconstruction
a stepped appearance, like the bottom
In ADC DAC Out
filter hold processing filter plot in Fig.2. This is the waveform
that would be seen at the output
Fig.1. Generic DSP system structure. of both the sample-and-hold and
Introduction to LTspice
Want to learn the basics of LTspice?
Ian Bell wrote an excellent series of
Circuit Surgery articles to get you up
and running, see PE October 2018
to January 2019, and July/August
2020. All issues are available in
print and PDF from the PE website:
https://bit.ly/pe-backissues
Fig.7. Adding more sinewaves to the schematic in Fig.5.
Nyquist rate
Mathematical analysis of the process of
sampling a signal shows that signals with
a frequency of less than half the sampling
frequency are reliably represented in
Fig.10. Waveforms of sampling at exactly the Nyquist rate, example 1. the sampled data. This is known as the
NEW!
spatially sampling the image projected by the lens onto the
sensor. If the image contains small repetitive details aliasing
can occur. To overcome this, an optical filter is used to
provide an amount of blurring which will prevent aliasing.
However, in recent years more digital cameras have become
available without anti-aliasing filters. These provide better
5-year collection image quality in situations where aliasing would not occur.
Fig.12. The
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.
FEBRUARY 2022
PE/EPE PCB SERVICE
Arduino-based Power Supply............................................. 18106201 9.95 Order Code Project Quantity Price
Battery Monitor Logger....................................................... 11106201 10.95
Electronic Wind Chimes..................................................... 23011201 10.95 .........................................................
Analogue Vocoder – Driver Amplifier.................................. AO-FEB22 8.95
.........................................................
JANUARY 2022
Vintage battery Radio Li-ion Power Supply........................ 11111201 9.95 .........................................................
MiniHeart: A Miniature Heartbeat Simulator....................... 01109201 8.95
.........................................................
DECEMBER 2021
AM/FM/SW Digital Receiver............................................... CSE200902A 13.95 .........................................................
Balanced Input and Attenuator for USB CODEC............... 01106202 11.95
All prices include VAT and UK p&p. Add £4 per project for post to Europe; £5 per project outside Europe.
Orders and payment should be sent to:
Practical Electronics, Electron Publishing Ltd
113 Lynwood Drive, Merley, Wimborne, Dorset BH21 1UU
Tel 01202 880299 Email: [email protected]
On-line Shop: www.epemag.com
Cheques should be made payable to ‘Practical Electronics’ (Payment in £ sterling only).
NOTE: Most boards are in stock and sent within seven days of receipt of order, please allow up to 28 days delivery if we need to restock.
Practical
Electronics
If you want your advertisements to be seen by the largest readership
at the most economical price then our classified page offers excellent Practical Electronics
value. The rate for semi-display space is £10 (+VAT) per centimetre reaches more UK
high, with a minimum height of 2·5cm. All semi-display adverts have a readers than any other
width of 5.5cm. The prepaid rate for classified adverts is 40p (+VAT) per UK monthly hobby
word (minimum 12 words).
electronics magazine.
Cheques are made payable to ‘Practical Electronics’. VAT must be
Our sales figures prove it.
added. Advertisements with remittance should be sent to: Practical
Electronics, 113 Lynwood Drive, Wimborne, Dorset, BH21 1UU. We have been the leading
Tel 07973518682 Email: [email protected] monthly magazine in
BOWOOD ELECTRONICS LTD
For ratesofand
Suppliers further
Electronic information on display and classified advertising
Components this market for the last
please contact our Advertisement
www.bowood-electronics.co.uk Manager, Matt Pulzer – see below. twenty-seven years.
Unit 10, Boythorpe Business Park, Dock Walk, Chesterfield,
Derbyshire S40 2QR. Sales: 01246 200 222
Send large letter stamp for Catalogue
ADVERTISING INDEX
CRICKLEWOOD ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Advertisement offices
ESR ELECTRONIC COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . 39 Matt Pulzer
HAMMOND ELECTRONICS Ltd . . . . . . . . . . . . . . . . . . . . . . . . . . . 10
JPG ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 72
Electron Publishing Ltd
FLOWCODE . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . Cover (ii)
1 Buckingham Road
PEAK ELECTRONIC DESIGN . . . . . . . . . . . . . . . . . . . . . . Cover (iv)
Brighton
POLABS D.O.O. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 28 East Sussex BN1 3RA
QUASAR ELECTRONICS . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 3 Tel 07973 518682
SILICON CHIP . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 5 Email [email protected]
STEWART OF READING . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 62
TAG-CONNECT . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . 24 Web www.electronpublishing.com
TERRINGTON COMPONENTS . . . . . . . . . . . . . . . . . . . . . . . . . . . 12
For editorial contact details see page 7.
PLUS!
All your favourite regular columns from Cool Beans and
Circuit Surgery, to MitchElectronics, Teach-In, Techno Talk
and Net Work. On sale 2 May 2024
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
of your current subscription in a box on the
ad
d
Roa
address sheet that comes with your copy.
Old H
orth
tsw
Cha
Morrisons
Sparks
Digital subscribers, please call 01202 880299
Retail & Trade Welcome • Free Parking • Google St View Tour: S40 2RB or visit: www.electronpublishing.com
Published on approximately the first Thursday of each month by Electron Publishing Limited, 1 Buckingham Road, Brighton, East Sussex BN1 3RA. Printed in England by Acorn Web Offset Ltd., Normanton WF6
1TW. Distributed by Seymour, 86 Newman St., London W1T 3EX. Subscriptions UK: £33.99 (6 months); £59.99 (12 months); £114.99 (2 years). EUROPE: airmail service, £38.99 (6 months); £69.99 (12 months);
£129.99 (2 years). REST OF THE WORLD: airmail service, £46.99 (6 months); £84.99 (12 months); £164.99 (2 years). Payments payable to ‘Practical Electronics’, Practical Electronics Subscriptions, PO Box
6337, Bournemouth BH1 9EH, United Kingdom. Email: [email protected]. PRACTICAL ELECTRONICS is sold subject to the following conditions, namely that it shall not, without the written consent of the
Publishers first having been given, be lent, resold, hired out or otherwise disposed of by way of Trade at more than the recommended selling price shown on the cover, and that it shall not be lent, resold,
hired out or otherwise disposed of in a mutilated condition or in any unauthorised cover by way of Trade or affixed to or as part of any publication or advertising, literary or pictorial matter whatsoever.
nics
The UK
Circuit Surgery Teach-In 2024 ’s pre mierOut
Audio
electro
Topics in digital signal Analogue input and output
Circuitwith Designing
nics an
processing – sampling LTspic Surgerydiscrete buffers
the ESP32 SoC microcontroller d com
e 24 u puting
Freque pd
ncy Re ate and T maker
spons ea ch-In 20 magaz
e Ana
lysis Digita
l input 24 ine
th e ESP3an d
2 SoC output with Audio
microc O
Design ut
ontrolle in
r discrete g
buffers
Dual RF Amplifier
GPS-Disciplined
Oscillator Basic
R
Mastering Signal F ‘Swiss
the UVM-30A Ge A
UV Sensor nerato Automa rmy Knife’
r ted Te
WIN! st Ben
Microc
hip
ch
E xplo
Develo rer 8
Teach-In 2024 pment
Kit
IN! W
Learn to use Teach
the ESP32 -In 20
LeaSongbird:
rn to u 2an
4 ideal
s
thebeginner’s
ESP32 e project
PLUS! Silicon
P
Techno Talk – One step closer to LaUdystopian
S! abyss? May 2024 £5.99 C
Build y hirp
pet cr our own
Techn 05
o Tadelights
Cool Beans – Arduino: 7-segment display lk – W it
Cool B
Net Work – Electric cars, Moon-shot eans – andamore
missions Arduin
! What 9 772632 573030
?R icket
Net W
ork – L o: expa eally?
www.electronpublishing.com abel p
@practicalelec nding
practicalelectronics
rinters t
www.e
lectro
, smart he 7-segmen Apr 20
24 £5
npubli home t displa .99
shing device y
.com s and SM 04
@pr Rs 9 772632
actica
lelec
5 73030
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