Professional Documents
Culture Documents
95
*
1
*
IN
CE 196
AUDIO TESTER
AN AFFORDABLE SOLUTION
Using PC-Based Software
and a USB Audio Interface
p. 06
FOCUS ON
Test &
Measurement
p. 14 AC Grid Frequency Meter
Monitor Mains Frequency and Voltage
p. 30
Get Started With
p. 18
Modest Inductance Meter Your Oscilloscope
A DIY Instrument for Your Find Your Way Through the Knobs
Workbench and Buttons
R2
C2
4k64
C1
R1
+5V
C3
8 1 D2
DRAIN U1 BP
7 2 AMS1117-3.3
DRAIN GND
6 3
F1 D1 1mH DRAIN FB
L1
5 4
L1 DRAIN C/S 2 U2 +3V3
L2
10 / 0W5 R19 R21
HP-01 2
R20
C8 C9 D3 C15 C7 C4 C5
MOV1
220170-016
Disruption in Test and CO2 Traffic Light with Sigfox Smart Plug Teardown
Measurement Equipment No Wi-Fi Network Needed! p. 74 Which Ones Are Hacker- p. 90
p. 48
Alternatives to the Typical Friendly?
Benchtop Devices
e-zine
Your dose of electronics
Elektor Magazine,
English edition
Jens Nickel
Edition 5/2022 International Editor-in-Chief, Elektor Magazine
Volume 48, No. 514
July & August 2022
www.elektor.com
www.elektormagazine.com Measuring Does Not Have to be Expensive
If you measure, you measure crap: Every student of a technical or scientific discipline experi-
Elektor Magazine, English edition ences this at the latest during his or her first relevant internship — and that’s how it should
is published 8 times a year by be. The experience of the user and sound background knowledge cannot be replaced by any
Elektor International Media instrument.
Head Office:
Elektor International Media b.v. That’s why we’re once again offering the typical mixture of practice and theory on this import-
PO Box 11 ant topic. My colleague Clemens Valens introduces beginners to the use of oscilloscopes. In
6114 JG Susteren his article “Inexpensive Audio Measurement Station,” Alfred Rosenkränzer combines his
The Netherlands professional specialization in measurement technology with his passion for audio. A good
Phone: (+31) 46 4389444
USB audio interface, a PC and inexpensive measurement software are enough to get a more
Memberships:
than usable solution for measurements on hi-fi systems, (do-it-yourself) speakers and other
E-mail: service@elektor.com equipment. The engineer, who also proves his good judgement with various measurements,
www.elektor.com/memberships only wishes for a notch filter in front of the input of the interface. This will be added in one
of the next issues!
Advertising & Sponsoring:
Raoul Morreau
Phone: +31 (0)6 4403 9907
Beyond that there are of course again a lot of projects with practical use. In this issue you will
E-mail: raoul.morreau@elektor.com find a measuring device for the mains frequency as well as one for the series resistance of
capacitors. Plus, an inductance meter that’s easy on the wallet, and much more!
www.elektor.com/advertising
Advertising rates and terms available on request.
Regulars FOCUS
3 Colophon
86 Low-Budget Tablet Oscilloscope ADS1013D
25 Starting Out in Electronics Good Value for the Money?
Rectifiers
100 Skin Impedance and Skin Capacitance
28 electronica fast forward 2022 Small Experiments
Industry
104 From Life’s Experience
No Local Business
114 Hexadoku
FOCUS
The Original Elektorized Sudoku
48 Disruption in Test and Measurement Equipment
Innovation from the Smaller Players
Features
FOCUS
54 Infographics
Facts and Figures About Test & Measurement
22 Acoustic Wave Hovering 56 Inspiration, That’s What It’s All About
A Look at the Makerfabs Acoustic Levitation Kit Interview with Entrepreneur Walter Arkesteijn
of InnoFaith Beauty Sciences
FOCUS
30 Get Started With Your Oscilloscope 58 Minimizing EMC Interference from Storage Chokes
Find Your Way Through the Knobs and Buttons
FOCUS
42 Moisture Sensors for Watering Systems Low-Budget Tablet
Automatic Watering
Oscilloscope
61 GUIs with Python (Part 5) ADS1013D
Tic-Tac-Toe
86
4 July & August 2022
Get Started With
R2
C2
4k64
C1
Your Oscilloscope
R1
Smart Plug
R20
C8 C9 D3 C15 C7 C4
MOV1
Teardown
30 90
4µ7 4µ7 470µ
U 400V 400V 16V
Acoustic
FOCUS ON
Wave
Hovering
Test &
22 Measurement
lektor July & August 2022
analog
Figure 1: Spectrum of a 1 kHz sinewave at 1 VRMS (0 dbV), generated Figure 2: Compare with Figure 1: spectrum of a 1 kHz sinewave at
and measured using the Audio Precision APx555. 1 VRMS using the Steinberg UR22.
The inspiration for this project began after Considerations Most professional test equipment of the early
I had spent over 20 years working in a A search on eBay for second-hand profession- third millennium more or less takes the form
high-tech design company surrounded by al-level test equipment quickly revealed the bad of a black box, with no user controls. The
top-notch test equipment, including for audio news. Even units more than ten years old, long unit is controlled and its results processed
measurements. Suddenly this period came to out of manufacturer’s support, were going for using software running on a PC. Why should
an end and my options for making a quick test over a €1,000. New equipment with the specifi- things be any different in the hobby world? So
or measurement became severely limited. I cations I was looking for started at a little under I started off by looking for suitable software
was rudely separated from the professional €10,000, which seemed totally out of propor- for making audio measurements.
equipment that I had been used to, not just by tion to what I was trying to achieve with them. I
the distance between home and workplace therefore had to try to come up with a different, My requirements for the software were that
but also by the effects of the coronavirus. and above all more affordable, solution. it should work with both internal hardware
Levels
and with external hardware connected over manual, available in both English and German. The AudioTester software allows the output
USB. I wanted it to be able to measure total The free trial version offers all the features of level to be set in dBFS (dB full scale) — that
harmonic distortion (THD) and signal-to-noise the software for one month, the only limitation is, in decibels relative to the maximum output
ratio (SNR) as well as frequency response. being that the program automatically termi- level of the DAC. The actual level at the output
Furthermore, the signal generator part of nates a measurement after ten minutes. To of the interface must then be set either directly
the system should at a minimum be able continue, the software must be restarted. Since on the interface itself or using its accompany-
to produce sine, square and noise signals. it remembers its most recent settings, you can ing software. That requires a way to measure
It must be possible to sweep the sine wave carry on immediately from where you left off. the level externally (for example, with an
output in frequency. Other waveforms such oscilloscope). Unfortunately, the AudioTester
as triangle and pulse were not a sine qua non, A licence costs a reasonable €39. After experi- software cannot set the output gain of the
but nevertheless nice to have. These options menting for a couple of days, I bought a licence interface directly.
are straightforward to implement in software from the developer and received a key file to
and so add little to its complexity or cost. unlock the software. At this point my search for This difficulty also affects the input. Towards
a suitable software solution was over. Perhaps the top of the window, there is a kind of drive
The software must be able to acquire a signal you will find other useful programs? If so, feel level indicator for the ADC. By adjusting the
from the audio input and display it. The avail- free to get in touch with me via e-mail. gains on the interface or in its software, we
able frequency range must cover at least the can make sure that the ADC is adequately
audio band from 20 Hz to 20 kHz, and a wider Hardware driven, but not overdriven.
bandwidth is desirable. Digitization should be For my first tests, I used my PC’s internal
possible at sample rates of 44.1 kHz, 48 kHz audio hardware in loopback: I connected a Signal Generators
and their multiples up to at least 192 kHz. mini-jack cable directly from the audio output I first measured the output of the internal
to the line input (not the microphone input). sound card using a professional instrument
Software Since this was using the audio circuitry built (an Audio Precision APx555). Figure 1 shows
During my search, the software package into the PC’s motherboard, my expectations the output from the APx555 in purple: there
AudioTester V3.0 caught my eye. It runs under were not exactly high. The results, however, are no harmonics to be seen and the noise
Windows XP and later versions, and can be were not too bad, although not good enough floor is at around –150 dBV. The blue plot
downloaded for free at [1] along with its for my purposes. shows the output of the sound card. The
Audio Inputs
The second step was to connect the
high-quality output signals of the APx555 to
the audio inputs of the RME interface, display-
ing the result using AudioTester (Figure 7).
Operation
The RME interface can be controlled to some
Figure 9: Loopback on the Steinberg UR22 at a sample rate of 48 kHz. extent using its buttons and control knob.
Unfortunately, it is not possible to enable the
48 V phantom power supply or the attenuator
pad on the inputs in this way.
For full control of the interface, it is neces-
sary to install the ‘RME TotalMix’ software.
This software will automatically be launched
when the interface is connected to the PC.
This software allows us to set not just levels,
but also includes a parametric equalizer and
more besides. It is essential to read the
manual, and on YouTube there is a number
of videos explaining the fine points of the
interface.
Figure 13 shows the user interface of the RME
software. The dialogue box shown in Figure 14
lets you configure the basic settings such as
choice of input, sample rate and so on. This
latter value must agree with the sample rate
Figure 10: Frequency response of the RME Babyface Pro at a sample rate of 48 kHz. configured in the AudioTester software, or else
errors or possibly unwanted tones will appear
in the spectrum.
WEB LINKS
[1] Software AudioTester: http://www.audiotester.de
[2] Audio interface: https://www.rme-audio.de/babyface-pro-fs.html
[3] Information on the RME interface: https://www.thomann.de/gb/rme_babyface_pro_fs.htm
Figure 14: Basic settings of the Figure 15: Frequency responses of a 1.2 kHz lowpass filter and a 2 kHz highpass filter
RME Babyface Pro. (both Butterworth), logarithmic frequency axis.
(harmonics, non-harmonic tones and noise) quality of its signals and of the measurements
to greater accuracy. It also helps to reduce I made with it is convincing. About the Author
the harmonics introduced by the ADC itself 200604-01
when driven at a high level. An external notch Alfred Rosenkränzer worked for many
filter could be added if these advantages are years as a design engineer, originally in
important in your application. the field of professional television technol-
Questions or Comments? ogy. Since the end of the 1990s he has
Within the confines of this article it is of If you have technical questions feel free been developing high-speed digital and
course impossible to do more than scratch the to e-mail the author at analogue circuity for IC testers. Audio
surface of the capabilities of the AudioTester alfred_rosenkraenzer@gmx.de technology is his private passion.
software. To find out more you can experi- or the Elektor editorial team at
ment or you can delve into the documenta- editor@elektor.com.
tion. And you can try out everything you need
in advance, and the licence is in any case
reasonably priced, so you have nothing to lose.
The Elektor web archive from 1974! An online Elektor LABs account, with
6x Elektor magazine (Print) access to more than 1000 Gerber files
9x Digital (PDF) including and a direct line of communication with
Elektor Industry (EN) magazine our experts!
A 10% discount in our web shop and Bring a project to publication or even sell
exclusive offers it in our shop
Elektor’s annual DVD-ROM
www.elektor.com/member
project
r- L a b s . c o
to
m
Figure 1: Dieter
k
Ele
Laues’s design
with its
OF grid frequency
BEST
LED bar displa
y.
m
co
le s.
E
kto
r- L a b
By Mark Stevenson (United Kingdom)
The National Grid is compelled in the UK troller instead of the AVR in Dieter’s project.
The frequency of the mains to maintain the frequency of the supply to The LED bar from the old design is replaced
±1% of the nominal frequency of 50 Hz, with an LCD, and my meter also displays the
voltage is a good indicator these limits being 49.5 Hz and 50.5 Hz. mains voltage. It should be noted however
of the grid’s load. This grid However, it aims to keep this to within that this device shows trends of the power
frequency meter not only ±0.2 Hz normally (49.8 Hz ... 50.2 Hz). A grid values. It should not be regarded as a
very large power cut across parts of the UK highly accurate device measuring mains
monitors this important was caused by these limits being exceeded. voltage and frequency.
parameter of our AC line Two large generating plants failed almost
supply, but also the mains simultaneously and the sudden loss of Hardware
supply caused the remaining power plants The schematic diagram of the grid
voltage. to become excessively loaded, lowering frequency meter is shown in Figure 2. An
the frequency. To keep within the operat- AC plug-in power pack of 9 V ... 12 V RMS
A few years ago, I saw an article in Elektor ing limits, large parts of the country were AC is connected to K1. C1 filters any high
by Dieter Laues which showed how you essentially unplugged to allow the remain- frequency noise. D2 half wave rectifies
can determine the load on the National ing plants to continue to work. Reserve the supply to 5 V regulator IC1, two 470 µF
Grid electricity supply by measuring the power was brought online and power was capacitors smooth the supply. C5 (and C2, C3)
frequency of the supply [1]. In short: the eventually returned. supply the processor for long enough in the
greater the load, the more it slows down the event of a power failure to record the loss of
generators and so the lower the frequency I built the original meter (Figure 1) when voltage in EEPROM. R5, R8 and R9 pull up
of the supply; the lighter the load, the the project was just published. Some years the NO momentary calibrate switch and the
faster the generators and the higher the later, I decided to make my own version 120 V/220 V solder links to 5 V. If neither of
frequency. with a Microchip Technology PIC microcon- the links are soldered, the voltage scaling
+5V Vin
1N4007
LED+
LED–
GND
VCC
R/W
+5V
RS
D0
D1
D2
D3
D4
D5
D6
D7
R2
E
D5
R1 R6 R8 R9 R5
47
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16
3k3
10k
10k
10k
1k5
C7
100n
R4
1N4148
D3 D4 +5V
47
1 14
VDD GND
2 13
1N4148 1N4148 RA5 RA0
3 12
RA4 IC2 RA1 C8
4 11
C6 RA3 RA2
R11 5 10
RC5 RC0 470µ
10k 6 9 25V
100n RC4 RC1
7 8
RC3 RC2
T1
+5V Vin
120V 220V S1 PIC16F825 D2
R12 R3 R7 R10 7805DT 1N4007
47k
2k2
1k5
10k
IC1
C4 K1
BC547 CALIBRATE C5 C3 C2 C1
100n 9...12V AC
470µ 470µ 470µ100n
25V 25V 25V
200312-008
software is designed to automatically detect right of centre block changes to vertically sor. If the supply dips or drops for more than
a nominal 60 Hz supply frequency and extended “+” character, pointing upwards 500 ms, this event should be captured and
calibrate the bar graph display to centre or downwards in frequency as required. recorded. If the power cuts out totally, the
around 60 Hz. As I have no accurate means event should be recorded, when the power is
of generating 60 Hz, it remains untested. The centre two characters of the top line returned this will be shown, with the timing
are used for “Event” reporting. If the supply starting from the time that power returned.
Once the frequency has been measured, the voltage or frequency exceeds a limit (±5%
supply voltage is tested. The voltage applied for the voltage, ±0.6% for frequency) an Calibration
to pin 3 is a raw half wave, un-filtered AC event flag is shown, along with an indica- The processor used has its own internal
waveform. This is sampled 50 times at tor to show the reason for the event. For resonator. This is reasonably accurate, but
1 ms intervals with the peak reading used. example, a downwards arrow is shown for when trying to measure frequencies down
The peak reading taken is then scaled low supply voltage, an upwards arrow for to millihertz levels of accuracy, different
up by a factor to show the approximated excessive supply voltage. devices can show some variation. Calibra-
RMS supply voltage. The scaling factor for tion is achieved by adding a small amount
this can be selected by soldering a pair of When an event has occurred, once a minute of correction to the timing obtained by
jumpers as noted on the circuit diagram. or so the approximate time elapsed since measuring the on and off times of the pulses
This allows for a nominal supply of 120 V, the event happened is displayed in the derived from the AC input voltage. The
220 V or 240 V to be catered for. A 10-turn unused portion of the bar graph display correction factor is stored in EEPROM and
trimmer resistor allows for the use of an AC area. This is shown as hours and minutes for needs to be be adjusted only once. Calibra-
power supply of 9 V ... 12 V RMS to be used. the initial 24-hours, then days and hours. tion is done by pressing and holding the
With the correct jumpers soldered, a peak For example, the display in Figure 4 shows Reset/Calibrate switch S1 down. The initial
voltage of 4 V applied to pin 3 should show an undervoltage event flag, a symbol that calibration value is shown for a few millisec-
the correct supply. The voltage is averaged mimics a plug being removed from its onds, then the value starts to step upwards.
for eight counts to stabilise it and give some socket, followed by downwards arrow. The The range of adjustment is from -99 through
degree of noise immunity. second line shows the event occurred one to +99. After the calibration is increased
minute ago while the grid frequency was beyond +99 it wraps back to -99. A single
What the Display Shows above nominal value: the time indication step of adjustment adds or subtracts a value
Using the most common 16 x 2 LCD, under is on the left and the bar graph occupies equivalent to ±250 µHz (microhertz!) the
normal conditions, the left side of the top the right side of the line. Had the frequency full range of adjustment being just under
line shows the grid voltage, the frequency is been below the nominal, the event time ±250 mHz (millihertz). If you have access to
displayed across the six rightmost charac- would be positioned in the right hand side a stable signal generator capable of resolu-
ters, as in Figure 3. The bottom line of of the bar graph area. tion (and accuracy) down into the low milli-
the LCD displays a bar graph which shows hertz, you could use that, with D4 removed
segments lit progressively from the centre. The voltage events are automatically and the signal fed directly to pin 5 of IC2.
Segments lit from the centre towards the cleared after seven days, frequency events More practical is to wait until the early hours
right show that the frequency is above the are cleared after ten minutes. Events can be of the morning (2 AM to 3 AM) and assume
nominal value, from the centre towards manually cleared by pressing the Calibrate that the frequency and load on the grid is
the left show that the frequency is lower button briefly. The software will attempt balanced and then set the meter to read
than the nominal value. Each segment to store the most recent event in EEPROM. the nominal grid frequency, either 50 Hz
represents a 25 mHz step. With eight This is most likely to be a low voltage event. or 60 Hz. This is my favoured approach
segments in each direction this allows a When power is removed, the electrolytic and least likely to end in frustration! If set
display of ±200 mHz. When the frequency capacitors on either side of the 5 V regula- in this fashion, I would suggest keeping an
is very close to the nominal value the centre tor should maintain a supply to the proces- eye on the frequency noting whether it is
two elements each show a large square sor for at least a few milliseconds longer predominantly above or below the nominal
block character, as the frequency moves than that provided to the frequency or frequency, making slow, small adjustments
away from the nominal value, the left or voltage measurement pins of the proces- until it is.
WEB LINKS
[1] Dieter Laues, “Grid Frequency Monitor,” Elektor Magazine 01/2012:
https://www.elektormagazine.com/magazine/elektor-201201/19793
[2] This project’s page on Elektor Labs: https://www.elektormagazine.com/labs/electricity-grid-frequency-meter-v2
[3] W. Roth, “Measuring Pulse Width To Sub-Microsecond Resolution with PIC Capture & Compare,” Great Cow BASIC, 2015:
https://bit.ly/measuring-pulse-width
[4] Great Cow BASIC compiler: http://gcbasic.sourceforge.net/Typesetter/index.php/Home
[5] Mains frequency UK online: http://mainsfrequency.uk/fm-last10m
[6] Mains frequency EU online: https://www.gridwatch.templar.co.uk
A Modest
Inductance Meter
An Affordable Solution for Your Workbench le
kto
r- L a b
s.
co
E
m
BEST
OF
Ele
to
m
r- L a b s .c o
k
Vcc
By Philippe Le Guen (France)
K1 LCD1
C4 R11 1 1
P1 VSS
2 2
10k
10
VDD
100n 3 3
VO
4 4
RS
+5V 20 5 5
R/W
Principle of Operation
E
1 21 7 7
MCLR RB0 DB0
The operating principle of the inductance
22 8 8
IC2 RB1 DB1
2 23 9 9
meter is quite simple. The unknown 3
RA0/AN0
RA1/AN1
RB2
RB3
24 10 10
DB2
DB3
inductance is used to create an LC 4
RA2/AN2 RB4
25 11 11
DB4
5 26 12 12
oscillator. By measuring the oscillator’s 6
RA3/AN3 RB5
27 13 13
DB5
220
used (see Figure 1). The circuit uses a OSC1 OSC2
+5V
common-base transistor amplifier (Q1)
8 9 10 19
X1 S1
R5 R13 R12
with the input on the emitter and the Measure
1k
1k
C3 8MHz C1
R17
into details on how this oscillator works, LED1 LED3 LED2
10k
its output frequency is given by the
22p 22p
5k6
9
L = 1 / (4π² f²C) R1 47µH 0
C5 CTR12 7 100n
1
10k
11 6
CT=0 2
Here C is the value of the two capacitors
3n3 REL1 D1 5 Q3
5% 3 R8
Lx IC1 3
C6 and C7 in series: HE722 1N4148 HEF4040B
4
5
2
10k
CT 6
4 BC547B
C = C6 × C7 / (C6 + C7) C6 13
7
TP1 10 12
+
8
Q1 Q2 14
100n R4 9
With the value of these capacitors being
5% 15
220k 10
1
known — I measured them with my BC547B C2 BC547B GND
11
100
12k
0 22
0W5
6 7 8
D2 D4 VCC IS DC +5V
J1
1
SWC L2
2
4x 1N4007 SWE
220µH R15
IC3
7...23V AC MC34063AP
3k
D3 D5 5 3
9...32V DC FB TC
1%
GND D6 R1
C10 C11 C12
4
1k
330µ 220p SB120 330µ
25V 25V 1%
200592-29
Figure 3: The switched-mode power supply allows for a wide input voltage range.
L1 and the Relay The LCD shows what is going on. During Step 1 the yellow LED (LED1,
To ensure the fast starting of the oscillator irrespective of the value of Zero) lights up. If the inductance to be measured is disconnected, then
the unknown inductance Lx, another inductor L1 is placed in series the message “no coil detected” is shown and the red LED (LED3, Error)
with it. When taking a measurement, the frequency of the oscillator will be lit. If this happens check that the coil is correctly connected
is determined by these two inductances. However, we only want to and restart the measurement sequence by pressing the push button.
know the value of Lx. Therefore, the software first takes a measurement
with Lx short-circuited. This value, the zero reference, is memorized The use of the system is simple and comfortable as it is fully automatic.
and used later to calculate the value of Lx. The only thing to do is to press briefly (approx. 0.5 s) the push button
connected to RC5 to restart the procedure if needed. The display
The Power Supply shows an arrow to indicate a new measurement.
The power supply is based on an MC34063 (IC3), a switching voltage
buck regulator that delivers a nice supply voltage of +5 V (Figure 3). The Building Process
The power source applied to the input of the circuit is first rectified Once the prototype was validated, I designed a double-sided printed
and then filtered by capacitor C10 before entering IC3. The reason circuit board for it [2]. It is intended to fit into a Multicomp MCRH3135
for the rectifier D2..D5 is to allow both AC and DC power supplies case (Figure 5). Your trained eye may have noticed the small size of
without having to worry about their polarity. This way the device the pads. Most of them have a diameter of 1.4 mm for a 0.8 mm hole. I
accepts 7 VAC to 23 VAC or 9 VDC to 32 VDC at its input. Its working therefore highly recommend using a good soldering iron for mounting
frequency is about 30 kHz. The power consumption of the complete the components or reroute your board differently.
circuit is only 35 mA, not a problem for this power supply that can
deliver a maximum current of 1.2 A. The power supply connector’s Even though I did my best to come up with a good PCB design, it
center pin is 2 mm in diameter, which allows for the use of many ended up having two issues that I did not fix:
standard power adapters.
> I forgot to check the dimensions and the shape of the pads of
Firmware power connector J1. If you use the same model as I did, you will
I developed a small program in mikroC [2] that, like the original design, have to rework the PCB a bit with a Dremel-like tool (Figure 6).
allows for the measurement of any inductance, and displays its value As the connector is no longer correctly maintained by its
(in nH, µH or mH) on the LCD. The measurement range selection is soldered connections, I glued it to the board (after soldering).
automatic. Measuring the value of Lx is done in two steps: > There is no ICSP connector for in-circuit programming of the
MCU, which is rather impractical. It is, however, possible to
1. System calibration sequence (relay closed, Figure 4). program the MCU by removing it from the board and placing it
2. Measurement sequence with display of the calculated value. on a breadboard or prototyping board.
The MCU’s Timer1 is configured to start counting on the first rising The LCD is mounted on a single-row, 16-way connector, and it is firmly
edge on RC0; it will count for one second (controlled by Timer0). After fixed to the PCB with four M3 × 10 mm nylon spacers and suitable
one second, the value of Timer1 represents the frequency of the signal bolts and nuts.
present at its input. Now the processor can perform all the calculations
necessary to determine the value of either L1 (Step 1) or Lx (Step 2). The ICs are mounted on sockets which are, of course, not absolutely
Questions or Comments?
Do you have technical questions or comments about his article? RELATED PRODUCTS
Email the author at pleguen@gmail.com or contact Elektor at
editor@elektor.com.
> Elektor 2 MHz LCR Meter Kit (SKU 19883)
www.elektor.com/19883
WEB LINKS
[1] DIY inductance meter (in French): http://kudelsko.free.fr/inductance_usb/sommaire.htm
[2] This project with downloads at Elektor Labs: https://www.elektormagazine.com/labs/autonomous-inductance-meter
[3] Front Panel Designer: https://www.frontpanelexpress.com/
Acoustic Wave
HH
H oovveerriinngg
Hovering
A Look at the Makerfabs Acoustic Levitation Kit
WEB LINKS
[1] Eric Bogers, “Powerful tractor beam suspends people,” Elektormagazine.com: https://bit.ly/3IzO7uu
[2] Acoustic Levitator on Instructables: www.instructables.com/Acoustic-Levitator/
Figure 1: The half-wave rectifier. As for the perfectionists among you, we have rounded the result
to one decimal — that is accurate enough in this case. Since the
IC needs an input voltage of at least 18 V (we can find this minimum
Let us first have a look at our half-wave rectifier (Figure 1). The input voltage in the datasheet of the IC), the voltage is allowed to
larger the capacitance of the electrolytic capacitor, the less the drop by a maximum of 2.5 V during one period. We rewrite the
voltage will drop during the negative half-periods of the AC voltage; formula for the voltage across the capacitor and add the current,
and also, as the resistance gets smaller (and thus the current drawn voltage and frequency values:
by the load gets larger), the voltage will drop more during the
negative half-periods (‘collapse’, says the electronics engineer). I I
U
C
We can put this into a formula: f C f U
Q Q I T I 1A
U U C 8000 μF
C C C f C 50 Hz 2.5 V
We have assumed that the current is constant. Now suppose we The next larger standard value would be 10,000 µF, and for a current
have a 15 V transformer, a half-wave rectifier and a load with a of only 1 A, that is quite a ‘bulky’ capacitor. In principle, there are
current draw of 1 A. The voltage provided by the rectifier must be two methods of achieving a lower value (and thus a smaller and
stabilized by a regulator IC that requires a minimum input voltage cheaper electrolytic capacitor):
of 18 V to provide a stable output voltage of 15 V. (We’ll come back
to that IC in a future issue.) In that case, how large should the > We apply full-wave rectification, which means that the capaci-
capacitor be? tor is charged twice as often.
> We increase the transformer voltage and thus the permissible
First, we have to calculate the peak value of the AC voltage; in a voltage difference.
previous article in this series, we saw that for the peak value applies:
This full-wave rectification will be discussed later; below we will
first deal with ’increasing the transformer voltage’. If we use an
U eff 2
U peak
18 V transformer instead of the 15 V version in the example, we
will measure a peak voltage of about 24.7 V at the diode, and that
Pout 15 V 1A 15 W
The dissipation in the IC (the power converted into heat in the IC)
is equal to the difference between input and output voltage times
the current (in many cases — and also here — we can neglect the
IC’s own power consumption). Figure 3: The full-wave rectifier.
U in(min) U in (max)
Ploss U in U out
I U out I
2 U(t)
18 V 20.7 V
Ploss (15 V)
15 V 1A 4.35 W
t
2
U(t)
18 V 24.7 V
Ploss (18V)
15 V 1A 6.35 W
2 t
Editor’s Note: the series of articles “Starting out in electronics” is based on the
book, Basic Electronics Course, by Michael Ebner, published by Elektor.
Figure 5: This is how we create a symmetrical supply voltage.
Let us now calculate our earlier example (with the 15 V transformer)
with a full-wave rectifier. Due to the extra voltage drop across the Questions or Comments?
second diode, we now have a peak voltage of: Do you have any technical questions or comments prompted
by this article? Send an email to the author or to the editor of
Elektor via editor@elektor.com.
U peak 15 V 2 1.4 V 19.8 V
The next larger standard value would be 6800 µF, but it is question- RELATED PRODUCTS
able whether this is (widely) available. If not, we have to use an
electrolytic capacitor of 10,000 µF. At a transformer voltage of 18 V,
we end up with a calculated value of 1700 µF and a standard value
> B. Kainka, Basic Electronics for Beginners,
Elektor 2020. (SKU 19212)
of 2200 µF, which is at least one size smaller. Regarding our initial www.elektor.com/13950
expectation that the buffer capacitor should be only half the size,
the forward voltage of the rectifier diodes cancels this out. > B. Kainka, Basic Electronics for Beginners (E-Book),
Elektor 2020. (SKU 19213)
www.elektor.com/18232
It is clear that the current through the load plays a decisive role:
the greater the current, the larger the capacitor. This is the reason
why we often find a large number of big electrolytic capacitors in
the power supply of heavy power amplifiers.
We are looking for The organization cordially invites industry partners to be part of
start-ups and scale- this special edition of the fast forward awards. Show your support
ups in different for the future of our industry and become a sponsor for this unique
stages of early entre- event. Please contact the team at fastforward@elektor.com or ask
preneurship. With a few your direct contacts about the possibilities.
up-and-coming talents and
up to three companies that have
already achieved their first business
successes, e-ffwd 2022 promises to be a
combination of inspiration and aspiration. As we
do every year, Elektor invites the most interesting and
inspiring entrepreneurs, people, and products to showcase
themselves and to tell their stories at the e-ffwd booth in front of
the entire industry.
Get Started
With Your Oscilloscope
By Clemens Valens (Elektor) Of course, you already invested in a multi- can find online (Figure 2). They just do not
meter, which is great, but an oscilloscope offer the comfort and features of a low-cost
can do things you cannot do with a multime- but real bench oscilloscope. They may be
When you have been ter. However, oscilloscopes are also much practical when traveling or when you are
tinkering with electronics more complex instruments than multime- really tight on space, but that’s probably all
for a while and your projects ters, and so it takes some time and practice they are good for. I like my oscilloscope to
to get the most out of them. stay where it is when I pull a test lead, and
are getting more serious, it must have knobs and buttons that I can
chances are that you will What Do You Need? find quickly. To me, an oscilloscope without
need an oscilloscope. Oscilloscopes used to be expensive, but knobs for the horizontal and vertical axes
today prices have dropped so much that is not a real oscilloscope.
An oscilloscope is an almost anyone can afford one. For most
instrument that displays the hobbyist, tinker, and maker applications, Headless Oscilloscopes
evolution of one or more a basic oscilloscope is more than good Of course, there are headless oscilloscopes
enough. If your thing is Arduino- or Raspber- with excellent specifications (Figure 3),
voltages over time. But how ry-Pi-based projects or building and repair- but they require a tablet or computer and
do you choose one? And how ing audio amplifiers or musical instruments a mouse. Such devices are good for doing
do you use one? or guitar effects, there really is no need to remote measurements or for documentation
invest in a four-channel (or more) oscillo- or constant monitoring, for data logging and
scope with hundreds of MHz of bandwidth postprocessing (or for doing very precise
and many gigasamples. A two-channel, things that require a lot of fiddling). In
20-to-50-MHz oscilloscope is just fine my lab setup, the computer is needed to
project (Figure 1). show the schematic, modify firmware, read
Watch this eo! datasheets, and search the Internet. I don’t
on vid Not Too Small, Please want it to be an oscilloscope as well. And
However, even though it may seem tempt- I don’t want a second computer because
ing, I don’t recommend spending money on it takes up too much bench space. And, of
those cheap small DIY oscilloscope kits you course, because I want real knobs.
Figure 2: Even
though they
seem kind of
cool to have,
miniature
oscilloscopes
are not very
practical to use.
XY mode in this article; for us the horizontal A Word About Ground Triggering is what makes an oscilloscope
axis always represents time. Note that ground doesn’t have to be ground, it really useful as it allows you to focus on the
can be any voltage or signal in the circuit, but interesting part of a signal. A trigger is needed
Connecting the Probe it must be the same for every channel. Also to start a trace. If there is no trigger, the trace
Connect a probe to one of the channel note that probe ground is usually connected to will not start, and you will not see anything.
connectors, not to the Ext, Trigger, Aux or oscilloscope ground which can be connected This is why an oscilloscope features several
Z connector. Note that probes often have a to mains ground, so if you connect the probe options for triggering. One might even argue
switch to choose between 1:1 or 10:1. This is ground to something other than ground, short that the more trigger options an oscilloscope
an extra attenuation option that allows large circuits may be created and dangerous situa- has, the better it is.
signals to fit or to improve the precision of tions may arise (Figure 7). Therefore, always
measurements of sensitive signals. Some connect the crocodile clip to ground unless In my world, every oscilloscope features at
people always use 10:1 attenuation mode you know what you are doing. least automatic and normal triggering, adjust-
and there exist probes that are always in able trigger level, up and down or positive
10:1 mode. (Other ratios like 1,000:1 can be Horizontal or Timebase and negative trigger slopes and an external
had too.) Probes are also referred to as 1x With the knob in the section Horizontal, you trigger input.
and 10x where the ‘x’ means attenuation, not can zoom in and out on the time scale and
amplification. It is often possible to inform you can move the signal to the left or to the The first thing to do is select the source for the
the oscilloscope about the type of probe right. Usually, the center of the screen is zero. trigger signal. Usually it is one of the signals
you are using, so it can adapt the scales you want to look at, but it can be a signal
accordingly. Triggering generated by another device altogether.
Up to now, I was supposing that you did see
Before connecting the tip of the probe something on the display of the oscilloscope, Automatic Triggering
to the signal of interest, first connect the but maybe you didn’t? One reason can be Automatic triggering is easiest to use
crocodile clip attached to the probe to the that the trace is not on the screen. Use the (Figure 9). In this mode the oscilloscope
ground reference of the circuit under test. As vertical level control to find it. Another reason decides when to trigger, and the user can
a general rule, connect it as close as possible may be that the brightness is too low. If it is, set the trigger level and choose the slope
to the signal. However, in many cases this is crank it up. A third reason can be a trigger to trigger on. This mode is useful for quickly
not so important as long as it is connected problem. If your oscilloscope has an Auto seeing if something is “going on” on an input
to ground somewhere (Figure 6). It can Setup button or something similar (Figure 8), or to simply measure a DC voltage.
even be convenient to use the crocodile now is a good time to press it. After doing
clip of a second probe just for connecting so you may not see what you expected, but Normal Mode
to ground so you can remove the crocodile you should at least see something. Use the In Normal mode the oscilloscope only triggers
clip from the measuring probe and keep it vertical and horizontal knobs to bring the when the trigger level and slope conditions
out of your way. signal into range. are met or any other trigger condition that
you may have specified. After a trigger, the window, with delays and what not. As I said
trace will run until it falls off at the right side before, the more trigger options, the better.
of the screen. A new trigger is required to Questions or Comments?
start it again. If you set the trigger level too We will stop here. Your oscilloscope probably Do you have technical questions or
low or too high, the trace freezes or may not has several other buttons not covered in this comments about this article? Please note
appear as it is never triggered. This mode article. But now that you know how to get a that we are aware that it is incomplete and
is good for infrequent events or to focus on stable signal on its display, you can explore that some shortcuts have been taken. This
special events. these functions more in depth. article is not targeted at experts. Email the
author at clemens.valens@elektor.com or
Run/Stop & Single Whatever you do, always keep in mind that contact Elektor at editor@elektor.com.
It is quite probable that your oscilloscope before measuring anything, you should have
has a Run/Stop button and a Single button an idea of what to expect so that you can
(Figure 10). The Run/Stop button lets you compare the result to what it is supposed to
freeze the display, which is handy if you want be. If you don’t know what to expect, then you
to study a signal in detail without allowing a can’t tell if it is wrong or if it’s right.
new trigger to change it or make it disappear. 200661-01
Press the button again to leave this mode.
The Single button can be used when an event
happens only occasionally, for instance only at RELATED PRODUCTS
power-on or after pressing a button, or when
it is not periodic. After the trigger happens, the
trace will run only once and then the oscil- > Owon SDS1022 2-ch Digital Oscilloscope (20 MHz) (SKU 18898)
loscope enters Stop mode. You must press www.elektor.com/18898
Run or Single to restart the capture of a single
> LabNation SmartScope USB Oscilloscope (SKU 17169)
event. Press Single or Run again to go back to www.elektor.com/17169
normal mode (which button to press depends,
of course, on the oscilloscope). > PeakTech 1375 All-in-one 4-ch Oscilloscope (100 MHz, 1 GS/s)
(SKU 19316)
www.elektor.com/19316 J
Depending on the oscilloscope, there can be
more trigger options. Typical other options go > JYE Tech DSO Coral 112A Oscilloscope (SKU 18319)
from triggering on both slopes, or on a time www.elektor.com/18319
delay between slopes, a pulse so to speak, to
triggering on a sequence, inside or outside a
Raspberry Pi Pico
Makes an
MSF-SDR
Decode a Time Signal with a Pi Pico SDR
10k
5 36
BOOTSEL
GP3 3V3_OUT active
6
GP4 ADC_VREF
35 C1 antenna
7 34
Hardware
GP5 GP28
8 33
GND GND R1 10µ
9 32
First we will take a look at the hardware necessary to build the SDR. GP6 MOD1 GP27 10V
10k
10 31
GP7 GP26
There are just a few additional items to connect to our pico board. 11
GP8 RUN
30
12 29
GP9 GP22
13 28
Antenna Input: We use the analog input pin ADC2 (GPIO28, on the Pico 14
GND
GP10
GND
GP21
27
board pin 34) to receive signals from the antenna. The ADC uses the 15 26
Raspberry
GP11 GP20
16 25
internal 3.3 V as a reference voltage. This pin must therefore be biased
Pi PICO
GP12 GP19
17 24
GP13 GP18
at half the reference voltage. The two resistors in Figure 2 take care of 18
GND GND
23
this. The 10 µF capacitor C1 provides AC coupling for the incoming signal. 19
GP14 GP17
22
SWCLK
SWDIO
20 21
GND
GP15 GP16
RS232 Output: In its simplest form (without an LC display), the receiver 220006-004
uses a serial interface (115,200 bit/s) to output the data. The interface is Figure 2: Components required at the A/D signal input.
implemented by the circuit shown in Figure 3. We cannot use the USB
port to output the serial data because it would generate interrupts to
our software in an unpredictable way.
+5V 1
GP0
USB
VBUS
40
2k2
2k2
GND LED GND
4 37
GP2 3V3_EN
aid for debugging. We have set up two PWM DACs with the associ- 5 36
BOOTSEL
GP3 3V3_OUT
6 35
ated low-pass filters as shown in Figure 4. Using GPIO 2 and GPIO 3 D T1
7
GP4 ADC_VREF
34
RS232 GP5 GP28
as PWM outputs, for example, the demodulated signal and Bit-Timer 115200 Bd
G 8
GND GND
33
Raspberry
GP11 GP20
tion to the Raspberry Pi Pico is shown in Figure 6. 16 25
Pi PICO
GP12 GP19
17 24
18
GP13 GP18
23
GND GND
The received signal is shown on the LCD together with a waveform 19
GP14 GP17
22
SWCLK
SWDIO
GP15 GP16
in plain text above the waveform (Figure 7). If you do not need to display 220006-005
this information you can choose to simply omit the LCD without the Figure 3: The RS232 output from the Pico Board.
need to make any changes to the software.
Active Antenna: We have already covered the antenna connection;
the circuit of the active antenna can be seen in Figure 8. It is essen- C1
tially based on the LM6132 dual operational amplifier. This op-amp is
1 USB 40
GP0 VBUS
2 39
particularly suited for this application with an operating voltage of 2.7 100n GP2 VSYS
R1 3 38
GND LED GND
to 24 V, 10 MHz gain bandwidth product, rail-to-rail input and output A 1k 4
GP2 3V3_EN
37
PWM 5 36
signal capability and low current consumption of 360 µA per amplifier.
BOOTSEL
R2 GP3 3V3_OUT
B 1k 6 35
GP4 ADC_VREF
7 34
C2 GP5 GP28
8 33
GND GND
9 32
100n GP6 MOD1 GP27
10 31
GP7 GP26
11 30
GP8 RUN
12 29
cut-off GP9 GP22
13 28
frequency GND GND
approx. 14 27
GP10 GP21
1600Hz 15 26
Raspberry
GP11 GP20
16 25
Pi PICO
GP12 GP19
17 24
GP13 GP18
18 23
GND GND
19 22
GP14 GP17
SWCLK
SWDIO
20 21
GND
GP15 GP16
220006-006
Figure 1: The Raspberry Pi Pico board as a software-defined radio for MSF Figure 4: Two low pass filters for the PWM-DAC debug signals.
reception.
GND
RST
+5V
WR
CS
RS
RD
D7
D6
D5
D4
D3
D2
D1
D0
1 USB 40
GP0 VBUS
2 39
GP2 VSYS
3 38
GND LED GND
4 37 +5V
Figure 5: The PWM test signals. Top trace is the 5
GP2 3V3_EN
36
BOOTSEL
ampl-value, middle trace is the SecondTimer
GP3 3V3_OUT
6 35
GP4 ADC_VREF
showing Sampling trigger pulses and below is the 7
GP5 GP28
34
Raspberry
GP11 GP20
16 25
Pi PICO
GP12 GP19
17 24
GP13 GP18
18 23
GND GND
19 22
GP14 GP17
SWCLK
SWDIO
20 21
GND
GP15 GP16
220006-008
Figure 7: Receiver information on an LCD. Figure 6: Connections for the 3,5“ LCD.
V1 +5V
R1 R4
8 C7 C5
L2
10k
IC1
1k
10mH
4 100n 10µ
C1
IC1 = LM6132
500p R6
L1
470
3
1 5 ca. 4V5 receiver
IC1A C6
1mA
C9
2 7
C2 IC1B
6
1µ 10µ
R3 R5
10k 10k
R2
C3 C4 C8
10k
0.995
Figure 9: Diagram showing the MSF receiver signal paths in the Raspberry Pi Pico Board. 220006-011
Programming the Input Mixer Figure 10: The MSF seconds pulse showing Bit A and Bit B coding.
After the hardware, we come to the programming. The analogue paths
of the SDR is structured as shown in Figure 9. The Raspberry Pi Pico
can be programmed using several different languages. For this appli-
cation we chose C using the Microsoft Visual Studio Code develop-
ment environment running on a PC under Windows 10. Let’s look at
how the different parts function.
Year (BCD coded 0...99) Meaning
The ADC Sample Routine is triggered by the PWM and called 500,000 80 40 20 10 8 4 2 1 BCD
times per second via interrupt. The Offset ADCoffset = 2048 is weighting
subtracted from the ADC value and the result is then multiplied by 17A 18A 19A 20A 21A 22A 23A 24A Bit
ADCscale = 10 (Listing 1).
Month (BCD coded 1...12) Meaning
The local oscillator (LO-DDS) phase is updated and the input value is
10 8 4 2 1 BCD
multiplied by the cosine (in-phase or I signal) and the sine (quadra- weighting
ture-phase or Q signal). The products are summed over 1250 samples
25A 26A 27A 28A 19A Bit
(in Isum and Qsum). The values are then (in Listing 2) passed to a FIFO
for further processing, which then takes place at 500000/s/1250 =
Day of month (BCD coded 1...31) Meaning
400 samples/s. This sample rate is so low that all the further process-
20 10 8 4 2 1 BCD
ing can be carried out using double variable values.
weighting
30A 31A 32A 33A 34A 35A Bit
The values are read from the FIFO and passed through a fourth-order
Butterworth low-pass filter with a cut-off frequency of 3 Hz. During
development it was found that this low cut-off frequency was necessary Day of week (BCD coded 0...6) Meaning
because the author’s antenna received strong interference signals directly 4 2 1 BCD
adjacent to the wanted signal. This is followed by another down-sam- weighting
pling, this time by a factor of 4, so that 100 samples/s are then processed. 36A 37A 38A Bit
The msfSample() routine in Listing 3 then calculates the carrier ampli- Hour (BCD coded 0...23) Meaning
tude ampl from the I/Q components. The logarithm of ampl is derived 20 10 8 4 2 1 BCD
and in turn stored in ampl which makes it easier to decode the bits. weighting
39A 40A 41A 42A 43A 44A Bit
The switching level threshold is derived from ampl via a first-order
recursive filter calculation. The signal ampl is then compared with Minute (BCD coded 0...59) Meaning
the switching level threshold to determine its digital receive value 40 20 10 8 4 2 1 BCD
sigValue. Now with the analogue signal processing covered we can weighting
look at how the data is recovered from the received signal and how 45A 46A 47A 48A 49A 50A 51A Bit
this corresponds to the time-of-day information.
Minute marker Meaning
Reading the Bits 52A 53A 54A 55A 56A 57A 58A 59A Bit
The MSF transmitter sends out RF carrier pulses at each second as shown
0 1 1 1 1 1 1 0 Value
in Figure 10. At second 0 of every minute the carrier switches off for 500 ms.
The SDR uses this pulse for synchronization. The pulses emitted at each Parity bits
of the following 59 seconds contain two bits of information: A and B. At
Bit 54B with bit 17A to 24A results in odd number of bits
the start of each of these seconds the carrier is off for 100 ms (correspond-
Bit 55B with bit 25A to 35A results in odd number of bits
ing to 10 samples in our application). If Bit A = 1, the carrier remains off
for a further 100 ms, and if Bit B = 1, the carrier is off for another 100 ms. Bit 56B with bit 36A to 38A results in odd number of bits
Bit 57B with bit 39A to 51A results in odd number of bits
In SecondTimer, a timer, synchronised to each second, runs from 0 to 99.
Figure 11: MSF time coding scheme. Source: [5].
The software decoding works as follows: In Duration, the pulse length of
the current pulse is measured. If a 0.5 s absence of the carrier is detected,
Listing 2: Filtering the I- and Q- values and downsampling by a factor of 4 at 100 samples/s.
Isample=IntFifoI[IntFifoOutPtr] ; //get I-signal from FIFO
Qsample=IntFifoQ[IntFifoOutPtr] ; //get Q-signal from FIFO
IntFifoOutPtr=(IntFifoOutPtr+1) & IntFifoMask ; //increment FIFO pointer
IfilOut = tprun(IIfil,Isample) ; //lowpass filter I-signal
QfilOut = tprun(QQfil,Qsample) ; //lowpass filter Q-signal
kdown++ ;
if(kdown>=4){ //downsampling factor 4
msfSample(IfilOut,QfilOut) ;
kdown=0 ;
}
Listing 3: Calculating the amplitude ‘ampl’, the switching threshold, and the pulse duration to recover bits.
void msfSample(double ii, double qq){
ampl=sqrt(ii*ii+qq*qq) ; //get carrier amplitude
ampl=40*log(ampl+1) ; //log is better!
threshold=0.995*threshold+0.005*ampl*0.95 ; //recursive mean as threshold
if(ampl>threshold){ //comparator function
sigValue=1 ; //digital value = 1
}
else {
sigValue=0 ; //digital value = 0
}
doScope(ampl/2.0+20,threshold/2+20,sigValue*10+10, DAC/2.0+30) ;
if(sigValue==lastSigValue){
Duration++ ; //pulse goes on
}
else { //pulse end reached
tt=pulseForm(lastSigValue,Duration) ; //get pulse character
if(tt==’z’){
printf("sync on z") ; //signalize sync
SecondTimer=50-2 ; //sync SecondTimer
}
printf("%c",tt) ; //display pulse character
Duration=0 ; //new pulse length starts
lastSigValue=sigValue ; //update lastSigValue
}
SecondTimer is set to the value 50-2=48 so that the SecondTimer timer frequency or IF. The IF signal is then filtered with a relatively narrow
now runs synchronously with the second (Listing 4). At the same time, band filter. The IF signal of the MSF60 receiver can also be viewed
the minute is synchronized by setting the value of the current second to using an oscilloscope. Our receiver mixes the input signal down to IF =
0 in doMinuteSync(). 0 Hz. If you want to observe an AC IF signal, you can upconvert the 0
IF signal to an AC IF. The circuit block diagram is shown in Figure 12.
With the help of SecondTimer, the received signal is sampled at the mid-bit
position of Bit A and Bit B (SecondTimer==15 and SecondTimer==25) in The software to perform the necessary upmixing is shown in Listing 8.
order to determine the values of these transmitted bits. We simply output A PWM output is used as the DAC. The 100 Hz AM-modulated IF
the received digital value via GPIO-Pin 4 (Pico-Pin 6): signal is shown in Figure 13.
gpio_put(GPIO4, sigValue); // Output sigValue at This completes the design and construction of the MSF receiver. Only
// pico GPIO4=pin 6 one core of the processor is used in this application, leaving plenty
of computing power for expansion. The bit decoding, for example,
The value of SecondTimer is also output later for debugging purposes could be made more error-tolerant. A DCF77 receiver could be built
via PWM, as are the values of ampl and DAC. This is achieved with the in much the same way, only the bit decoding process would need to
following two statements: be adapted. The MSF signal reception here in Aachen (Germany) is
much weaker than the DCF77 signal with an equivalent SDR. This often
pwm_set_gpio_level(PWM_PIN1, ampl/5.0 ); // Output results in parity bits indicating errors in the received information but
// amplitude sufficient error-free messages still get through frequently enough to
pwm_set_gpio_level(PWM_PIN2, DAC ); // Output timing allow accurate time of day information to be displayed reliably.
Debug Signals
Classic superhet receiver designs mix the incoming RF signal with a
variable frequency local oscillator signal to produce a lower intermediate Figure 13: 100 Hz amplitude modulated IF Signal.
r
this Elekto
Questions or Comments? Check out bout the
If you have any technical questions regarding this article you can video a Pi Pico!
contact the author at ossmann@fh-aachen.de or the Elektor team Raspberry
at editor@elektor.com.
WEB LINKS
[1] “Time from NPL (MSF),” Wikipedia: https://en.wikipedia.org/wiki/Time_from_NPL_(MSF)
[2] “Time receiver for the Rugby MSF,” Elektor 9/1982: www.elektormagazine.com/magazine/elektor-198209/44950
[3] J. Buiting, “Retronics - Elektor Junior Computer,” Elektor 1/2005: www.elektormagazine.com/magazine/elektor-200501/17897
[4] 3.5” Display: www.lcdwiki.com/3.5inch_Arduino_Display-UNO
[5] NPL Time & Frequency Services, “MSF 60 kHz Time and Date Code”
www.npl.co.uk/products-services/time-frequency/msf-radio-time-signal/msf_time_date_code
Advertisement
Provided in all industry standard packages. Available with all binnings ex stock.
Samples free of charge: www.we-online.com/optocoupler
CWT-SOIL-H-S
Figure 5: CWT-SOIL-H-S Measuring principle: No information available regarding the measur-
sensor (from AliExpress; ing principle or measuring frequency.
source: [6]).
Disadvantage: Medium price range. Frequent failures after a short
time in the soil.
Advantages: Holds the promise of additional measurement of electri-
cal conductivity; various versions (see Figure 5).
Figure 6: SMT 50 high-frequency capacitive sensor
(source: [7]). SMT 50 High-Frequency Capacitive Sensor
Measuring principle: The soil moisture is determined using a capacitive
voltage divider. The circuit operates at 16 MHz or above.
Disadvantages: Medium price range. The influence of the soil type on
the measurement is still noticeable.
Advantages: The measuring frequency is high enough for reliable
moisture measurement in many types of soil. The electrodes are embed-
Figure 7: DAV-6440 ded in a multilayer circuit board, providing good mechanical protec-
sensor (source: [8]). tion and long lifetime in the ground. The circuitry is encapsulated in
epoxy to make it completely waterproof (see Figure 6). The 10 m long
connecting cable with a polyurethane sheath is suitable for under-
ground installation (resistant to microbes and hydrolysis).
DAV-6440 Tensiometer
Measuring principle: This Watermark sensor is an example of a tensi-
ometer, which measures the soil moisture tension (correlated to the
water content of the soil). For this the electrical resistance of a material
in hydraulic contact with the soil is determined (see Figure 7). Other
tensiometric sensors use a non-woven fabric in contact with the soil
and determine its water content by electrical heating while observing
the temperature (e.g. Gardena sensors).
Disadvantages: Tensiometers are sluggish and respond slowly to chang-
ing soil moisture. There is a hysteresis effect, resulting in different
measurements with the same soil moisture tension (with rising versus
falling water content). Under very dry conditions the sensor can lose
hydraulic contact with the soil. The stated lifetime of this sensor in the
ground is at least 5 years, which is not especially long.
Advantage: The soil moisture tension indicates the soil moisture avail-
able to the plants.
Figure 8: SMT 100 TDT Figure 9: Operating
sensor (source: [9]). principle of a TDT sensor. SMT 100 TDT Sensor
The moisture-dependent Measuring principle: This time domain transmission (TDT) sensor
pulse propagation time consists of conductor loops forming a high-frequency transmission
of the loop conductor is
line that is driven by pulse signals (see Figures 8 and 9). A ring oscil-
converted into a frequency.
lator is implemented by feedback to an amplifier, and its frequency is
measured by a microcontroller. The capacitance between the electrodes
is influenced by the soil moisture. The higher the moisture content,
sensor to the RS-485 interface: The white wire of the sensor cable is Along with the readily available ESP32-DEV-Kit, it consists of a small
ground, the green wire is RS-485 A, and the yellow wire is RS-485 B. A board that converts the RS-485 signal from the sensor into TTL levels
supply voltage in the range of +4 V to +24 V (with respect to ground) suitable for the microcontroller. Terminal DI is an input for serial data
must also be connected to the brown wire. transmission from the ESP32 to the sensor. Terminal RO receives data
from the ESP32 to be sent to the sensor. Terminals DE and RE are
After launching the Modbus tool, you first have to select the COM connected together here. When these terminals are pulled low, the
port. If you are using a USB adapter and no port is shown, you need to receiver in the MAX485 IC is enabled, and when they are pulled high
install the appropriate driver. If everything is okay, the window shown the MAX485 transmitter is enabled.
in Figure 10 appears.
Now let’s look at the test program [12]. The first part (before the setup
Now you can read out the individual parameters or change the Modbus routine) defines the pins and the variables for the sensors. In the setup
address. By default the sensor is accessible at address 253 (Broad- routine the pin for switching the transmitter/receiver is initialised, the
cast). If you want to connect multiple sensors, each sensor must have standard serial interface is defined as the debug interface, the serial
a unique address. In the example program the Modbus address is set interface to the sensor is initialised as ‘Hardware Serial Interface 2’,
to 1 by the instruction Set new MODBUS Address. To be on the safe and a subroutine checks whether the sensor is connected properly.
side, you can check communication via address 1, for which Modbus
Address on the left must be set to 1. Note that only one sensor at a In the main loop the sensor is polled every three seconds by calling the
time can be connected to the bus when setting the address. subroutine SUB_RECEIVE_HUMIDITY, and the result is output. Querying
the sensor values is handled by three subroutines: SUB_CHECK_HUMID-
A Test Program ITY checks the received sensor address for correctness to verify that
Now let’s see how this sort of sensor can be integrated into a watering a sensor is connected, SUB_RECEIVE_HUMIDITY fetches the sensor
system. The test setup is shown in Figure 11. value, and SUB_CALCULATE_CRC calculates the CRC checksum. The
WEB LINKS
[1] C. Hübner, U. Kaatze, Electromagnetic moisture measurement, Universi-
RELATED PRODUCTS tätsverlag Göttingen: https://doi.org/10.17875/gup2016-958
[2] YL69 conductivity sensor: https://bit.ly/YL69-soil-sensor
[3] Capacitive sensor: https://bit.ly/cap-sensor
> ESP-C3-12F-Kit Development Board with [4] Vegetronix VH400: https://www.vegetronix.com/Products/VH400
Built-In 4 MB Flash (SKU 19855)
www.elektor.com/19855 [5] Sensor comparison (German language): https://bit.ly/SMT50-vs-VH400
[6] CWT-SOIL-H-S sensor:
> MakePython ESP32 Development Kit https://de.aliexpress.com/item/1005001524845572.html
(SKU 20137) [7] SMT 50 sensor: https://www.truebner.de/en/smt50.php
www.elektor.com/20137 [8] DAV-6440 sensor: https://bit.ly/DAVIS6440
> Bundle: Getting Started with ESPHome + [9] SMT 100 sensor: https://www.truebner.de/en/smt100.php
LILYGO TTGO T-Display ESP32 (16 MB) [10] Modbus: https://modbus.org
(SKU 19896) [11] SMT 100 Modbus tool:
www.elektor.com/19896 https://www.truebner.de/download/ModbusTool_Installer_V3.zip
[12] Example code: http://www.elektormagazine.com/210684-01
Advertisement
Disruption in
Test and
Measurement Equipment
Innovation from the Smaller Players
FOCUS ON
Test &
Measurement
By Stuart Cording (Elektor)
Scouring the halls and stands of an electronics exhibition such as development. In such cases, a single tool may be locked into a setup
electronica or embedded world, it is very easy to get excited about for days or weeks, stopping others from using it.
the rows of test and measurement (T&M) equipment emanating
from the world’s foremost suppliers. Color displays, smooth and For some time now, the traditional T&M suppliers have been under
soft buttons, and knobs that provide a reassuring haptic bump on attack from disruptors. Startups and electronics industry veterans,
rotation exude quality, reliability, and accuracy in measurement. frustrated by the complexity of traditional tools, drab exteriors,
But this all comes at a price. Even entry-level, 50-MHz bandwidth and underperforming user interfaces, have been delivering some
oscilloscopes from the big names, like Rohde & Schwarz or Keysight, competent alternatives that deliver exceptional capability for a
won’t leave you much change out of €1,000. Signal generators fraction of the price of a benchtop alternative. This has changed
and spectrum analyzers start at around €2,000. And, if you want the way engineers equip their laboratories, and it is also changing
to be more mobile, perhaps with a handheld, you’re looking at how students learn.
significantly more.
Lab in a Box
The strain on budgets quickly becomes apparent when it comes Traditionally, sourcing an oscilloscope, power supply, spectrum
to equipping laboratories. This is exacerbated by the use cases analyzer, waveform generator, and voltmeter required a healthy
of the typical education or research and development environ- budget and a robust table, with each item supplied as an isolated
ment. While a student or engineer may spend all day at the bench, piece of equipment. Over the years, and linked to the growth in
individual items of T&M will see differing amounts of use. Some automated test systems, suppliers such as National Instruments
equipment may be used the entire day, while others are used only have developed modular hardware T&M solutions, such as PXI.
weekly. Oscilloscopes and spectrum analyzers are also cumbersome These consist of a chassis into which a range of measurement cards
items, making them awkward to keep moving around. With the can be inserted, enabling the creation of custom instrumentation
complexity of applications continuously rising, T&M equipment solutions. But what if the hardware could remain the same, with
is also regularly incorporated into test automation systems during just the software defining the measurement capability?
Figure 1: The Moku family uses an instrument-on-chip (IoC) approach, Figure 2: The Moku:Go is the entry-level, portable test and measurement
featuring highly capable analog coupled with a reconfigurable FPGA to instrument from Liquid Instruments. (Source: Liquid Instruments)
implement the various supported capabilities. (Source: Liquid Instruments)
This is the question raised by the five founders of Liquid generators, logic analyzer, and spectrum analyzer. Beyond this
Instruments, a team based just north of San Diego, California. The are advanced instruments, such as an FIR filter builder, data logger,
group of scientists, who had participated in experimental physics 20 MHz lock-in amplifier, and multi-input/output PID controller [2].
and research into gravitational waves, found the existing T&M This last instrument highlights the capability of such equipment,
offering to be inflexible and lacking in scalability. The availabil- enabling up to two PID controllers to be implemented, configured,
ity of powerful system-on-chip (SoC) field-programmable gate and monitored. The interactive Bode plot offers real-time control
arrays (FPGAs) made them feel there was a basis for developing a and multi-section PID builder configurations for superb insight into
common hardware platform that could be used in many different how it functions for those building or teaching control systems.
ways (Figure 1). Their goal became to enable users to build measure-
ment solutions that even the team hadn’t thought of. Talking to Michi Yoneda, one of the Liquid Instruments team, he
explains that the Moku line-up frequently finds a home in university
The result of their efforts is the Moku range of software-defined labs and research institutes. There it is used for everything from
T&M solutions. At the lower end of the price spectrum is the photonics and LiDAR, to spectroscopy and quantum computing.
Moku:Go (Figure 2), an engineering platform designed to fit easily The ability to change instrument on-the-fly and its programmable
in a student’s or engineer’s backpack. Measuring just 24 × 13 cm and interface make it a valuable alternative to costly, traditional T&M
just 3.8 cm high (9.4” × 5.1” × 1.5”), it features two 12-bit, 125-MSa/s equipment. Users can also develop their own instruments even
analog input channels, offers 30-MHz bandwidth, and has an input without access to traditional FPGA development tools. Thanks to
range of ±25 V. On the output side, there are two 12-bit, 125-MSa/s their Cloud Compile [3] platform, those proficient in VHDL can
analog outputs with 20-MHz bandwidth and a ±5-V range, plus 16 create the bitstream required. Currently, this capability is limited
channels of digital I/O. Four power supply outputs that support to the high-end Moku:Pro, but there is a chance that the feature
between 150 mA and 1 A and -5 V and 16 V, model dependent, will be rolled out to the rest of the range.
round off the tool’s features.
One concern of such tools is their accuracy. For sure, they are
Grab Your Tablet suitable for garnering a general view of signals on a printed circuit
Like similar tools of this kind, it relies on other equipment for the board (PCB), but could I base promises to a customer on the value
graphical user interface (GUI). While laptops and PCs can access measured? Yoneda ensures me that, yes, this is possible, thanks
the GUI through a browser, Moku is optimized for use with the to a third party who offers calibration together with a certificate.
touch screen of an iPad. Wi-Fi provides the Moku:Go M0 and M1’s
connectivity, while the M2 also features an Ethernet port. Thanks From Frustration to Logic Analyzer
to careful consideration for the GUI design, the interface looks Having set up probes on a serial interface and found a suitable
clean and is intuitive. decoder on your logic analyzer, one of the most frustrating things
is discovering that it requires a paid license. After all, the hardware
Out-of-the-box, the Moku:Go [1] offers 11 different instruments, is already capable of the job, and you’ve paid for the tool. And other
including an oscilloscope, standard and arbitrary waveform times, it is simply a lack of access to affordable test equipment
Smooth Moves
What really stands out is their Logic 2 software (Figure 4), the
user interface to the tool that runs on Windows, Linux, and Mac
OSX. The GUI is intuitive, allowing the user to enable and disable
channels, name them, and the color-coding used relates to the
colors used for the unit’s connecting cables. Decoding of standard
serial protocols is also supported, from I2C, SPI, and UART, to
MIDI, Modbus RTU, and even the HD44780 interface used on
Figure 3: The entry-level Logic 8 from Saleae offers eight channels of alphanumeric LCDs. The device is also frequently used for data
mixed-signal capture in a tiny machined aluminum package that is just 5.3 logging, with developers using the Python application program-
cm on a side. (Source: Saleae) ming interface (API).
However, compared to a traditional benchtop, the ease with which
signals can be reviewed in the software is what really blows the
which leads to the forming of businesses like Saleae, the devel- user away. Garrison explains that the ease of use of the Google
oper and manufacturer of the popular USB-based logic analyzers. Maps user interface had proven to be an inspiration at the time of
initial development. The GUI enables consecutive edges in the data
Mark Garrison, Saleae’s Vice President of Engineering, explains stream to be found easily, even when widely spaced. ‘Flicking’ the
that the initial trigger to develop their tools came when his brother data stream left or right scrolls the logic output until it slows to an
worked on an embedded design. Back then, a benchtop logic eventual stop if not held earlier. This is a vast improvement over
analyzer wasn’t financially viable, not even used on eBay, so he’d the knobs and buttons of traditional test equipment.
procured a USB-based device. The only issue was that this tool
required more debugging than the product he was building. Today, around 80% of sales are into professional engineering teams,
many of whom value the high-resolution data capture offered in
Over the years, their logic analyzer line-up has developed, but this modest device. The remaining customer base is makers and
Figure 4: Logic 2 provides the user interface for Saleae’s tools. It is exceptionally easy to use, enabling edges to be located quickly and serial interfaces to be
decoded.
WEB LINKS
[1] Moku:Go Product Page: https://bit.ly/35tKNmz
[2] “Multiple-Input Multiple-Output PID Controller,” Liquid Instruments: https://bit.ly/3NF3Zin
[3] “Moku Cloud Compile: A Getting Started Guide,” Liquid Instruments, September 2021: https://bit.ly/35tWR7m
[4] Saleae Logic Analyzers Product Page: https://bit.ly/3qWyt62
[5] Saleae User Forum: https://bit.ly/376dAyf
[6] ADALM1000 Product Page: https://bit.ly/3tXoFdE
[7] Pixelpulse Software: https://bit.ly/3NRfdkj
[8] ALICE Active Learning Interface (for) Circuits (and) Electronics Software: https://bit.ly/3tYFi96
[9] ADALM2000 Product Page: https://bit.ly/36G6IaZ
[10] Scopy Software: https://bit.ly/3Jcj2Nr
[11] Analog Devices Engineering University Program: https://bit.ly/3LE3OCt
[12] LTspice Product Page: www.analog.com/en/design-center/design-tools-and-calculators/ltspice-simulator.html
[13] “UL and Analog Devices partner on digital learning tool to recreate lab environment at home,” University of Limeric,
December 2020: https://bit.ly/3uOZVDB
Driving
sustainable
progress.
Discover the future today.
At electronica 2022.
2019 2028
It Is the
en nd
nso n
se and
Radar Sensor
sor
em xim or
rs
se itio
sor
r
nso
nso
nso
nso
nso
n a enso
nso
nso
he
ts a
s
en
en
pos
se
l se
se
se
se
se
en ity
ed er
Ot
es
es
s
Bio
speomet
r
re
el
ity
nd
a
da
uc
ag
v
tic
All Around
ssu
tu
d
Le
ac ro
To
Im
Ra
mi
ra
ler
Op
Pre
spl P
tio
Hu
pe
ce
Mo
m
Ac
Te
di
What is and will be the most promising
measuring device this decade? Or, to
phrase it slightly differently: who would think of autonomous cars? Radar sensors the total global sensor market. This would
have thought that radar technology would can not only detect an object, but can amount to around $70 billion (USD) in 2028.
become so important? Radar technology also determine its shape, its direction of
should no longer be associated with movement and even its speed. Roughly (Sources: Allied Market Research; Fierce
aviation and shipping alone. What to speaking, radar sensors make up 20% of Electronics)
Where Are They Going? Where are all these sensors going? Which
sectors make the most use of all these
sensors? One might think that IT and Telecom
Market Demand Sensors, by Sector, 2019-2028 represent the most significant market for
sensors, given the growth in broadband
2019 2028 communication. Following that line of thought,
another high-growth sector, automotive,
would probably come in second. Yes, IT
and Telecom, as well as automotive, are still
going strong globally. But it is (consumer)
electronics that most definitely takes the
ics
al
ve
nse
rs
ar
co
he
tri
oti
ron
hc
le
Ot
us
tom
ct
De
Te
alt
Ind
Au
d
He
an
an
ce
Covid-19 is an Impetus
for Growth?! Market Size Software Testing,
2021-2027 (USD Billion)
When compared to two years ago, marketing research firm Global
Market Insights is somewhat more optimistic when it comes to the 2027
global market of software testing. There are at least two reasons for > 60 USD Billion
that. Software applications in the cloud become more popular by
the day. Given the fact that these applications are updated regularly, CAGR 2020
software testing stays at the forefront of anyone’s mind. Another > 40 USD Billion
reason has to do with the pandemic. Covid-19 provides an extra 2021 - 2027
impetus for the growth of cloud applications. That is why Global
>7%
Market Insights thinks the software testing market will grow more
than 7% between 2021-2027 instead of the 6% estimate for 2020-
2026.
Inspiration,
That’s What It’s All About
Interview with Entrepreneur Walter Arkesteijn,
InnoFaith Beauty Sciences
In electronics, ideas, crude sketches and ‘triggers’ can prove more valuable than turnkey
circuits. Walter Arkesteijn explains how he applies this philosophy within his young
company.
Jan Buiting: In the electronics industry, development and Elektor product, it would be the collection of audio amplifiers
education, we come across many readers having a “Deja-vu” featured in the magazine. What fascinates me is how you can
when they see Elektor (Elektuur) again, often after making a specialize a lot within the same objective: audio amplification.
career. But it’s different with you since you are both “in e-busi- Through technology, there are multiple dimensions to the same
ness” and an active Elektor reader today. product. Here I find the conceptual insights and technical insights
Walter Arkesteijn: That’s right, I’m still an active reader of Elektor. very interesting.
There is a difference with the old days! While I am now a nostalgic
reader, I used to be a reader of Elektor at a fairly young age. It was the Jan: You started your own company called InnoFaith. Briefly
right place for me to pick up all the knowledge and feed my boyhood describe how that went. What were your main motivations?
dream of creating. I can truly say that Elektor has contributed to the Hopefully not Elektor’s Corrections & Updates section?
person I am today. Through your magazine, I was able to accumu- Walter: I started InnoFaith Beauty Sciences [1] out of entrepre-
late a lot of knowledge and use it to think in terms of solutions and neurial ambition. I felt the personal urge to jump into the “oppor-
options. It still stimulates my creative mind and I enjoy following tunity hole” within the Aesthetic Medicine industry. I found out
the innovations and different projects that are covered. that there was a lot to be gained when I was a teenager accompa-
nying my mother to a trade show — she is employed within the
Jan: What did you think and feel about the magazine? Be frank! beauty industry. I wanted to create the tool to help the industry
Walter: I found and still find the magazine a source of information. interpret and treat both skin problems and skin aging. This is how
Especially back in the day when I started with my passion for electri- Sylton was formed, the brand under which we sell these devices.
cal engineering and I still had to learn to understand each table. Elektor’s corrections were not an issue here. To me, Elektor really
is a breeding ground for imagination and knowledge.
Jan: What is your technical background and how has Elektor
helped or thwarted you? What were your favorite projects or Jan: Elektor as a magazine often propagates that it prefers to
articles and why? inspire rather than instruct. How did you experience that?
Walter: My technical background is from a higher professional What was your personal trigger condition, so to speak, to read
education study in electrical engineering. Elektor magazine helped an article or undertake a project?
me find my passion for e-engineering, which is why I decided to Walter: I experienced Elektor as inspirational and not ped-
follow this program. Reading the magazine whetted my appetite for antic. I still experience it as such. I didn’t do much building from
learning more, especially within the world of electrical engineer- Elektor articles; the fun was quickly gone when it was already
ing. I’ve always been given the scope to discover everything myself thought out by someone else. To me, the main trigger con-
and in this respect, Elektor has helped to inspire me. dition is this: after reading an article, a technological fascination
grows in me. Seeing different perspectives feeds my creativity;
Here my fascination goes mainly to the process of fantasy becom- it enables me to see opportunities that make me want to think
ing reality with the help of technology. If I had to mention an in new ways.
Normally, switching regulators cannot function without power inductors. However, if you
want to enhance their influence on EMC behavior, there are several places to start, including
shielding efficiency, winding start and the switching transitions.
WEB LINKS
[1] Würth Elektronik, “The Behavior of Electromagnetic Radiation of Power Inductors in Power Management”:
www.we-online.com/ANP047
Tic-tac-toe
Use your GUI to control a simple game
N
0w that you have learnt how to make a basic
GUI, let’s add some more programming
logic behind the scenes to make your GUI
work as the means of controlling a game of tic-
tac-toe (also known as noughts and crosses).
Create a new file with the following code:
app.display()
O’Hanlon like to move. To be able to lay out the buttons on a loop to generate them all automatically and give
grid, let’s create a new type of guizero widget called them co-ordinates. First, add PushButton to
Martin works in
a Box. your list of widgets to import and then add this
the learning team
at the Raspberry A Box is a container widget. This means that it code immediately after the code for the board
Pi Foundation, is used for containing other widgets and grouping you just created.
where he creates
them together. Add it to the imports at the top of
online courses,
projects, and your code: for x in range(3):
learning resources. for y in range(3):
@martinohanlon from guizero import App, Box button = PushButton(
board, text="", grid=[x, y],
Set the Box to have a grid layout and add it to your width=3
app – before the app.display() line, as with all )
widgets.
Notice that there are two loop variables: x from 0
board = Box(app, layout="grid") to 2 and y from 0 to 2. As we iterate and generate
buttons, each button will be added to the board,
def toggle_player():
global turn
if turn == "X":
Figure 3 turn = "O"
else:
turn = "X" Go back to your choose_square function and call the
toggle_player function – with toggle_player() –
Add the code in your functions section. Notice the once you have set the text and disabled the button.
first line in the function: global turn. You need to Your code should now resemble tictactoe4.py. Save
specify this so that you are allowed to modify the and test the program again and you should find
global version of the turn variable, i.e. the one you that you can click squares and they will alternately
already created. If you don’t specify this, Python will be designated either X or O.
create a local variable called turn and modify that
instead, but that change won’t be saved once the Do we have a winner?
function exits. Finally, you need to write a function which will check
You also need to make sure that the Text widget whether there is a row, column, or diagonal of three Xs
accurately reports the current player’s turn. After or Os, and if so will report the winner of the game.
the if/else statement in the toggle_player function, Although it seems very inelegant, by far the easiest
update the message like this: way to check if someone has won is to hard-code the
checks for each vertical, horizontal, and diagonal line
message.value = "It is your turn, " + turn individually.
# Diagonals
elif ( game was a draw. You could stop at this point, but if
board_squares[0][0].text == board_ you really want to put the icing on the cake, adding a
squares[1][1].text == board_squares[2][2].text few more little touches could make your game more
) and board_squares[2][2].text in ["X", "O"]: polished.
winner = board_squares[0][0] First, let’s add some code to detect whether the
game is a draw. The game is a draw if all of the
Notice that the function begins by creating a squares contain either an X or an O, and no one has
Boolean variable called winner. If by the time the won. In the functions section, create a new function
long if/elif statement has been executed, the value called moves_taken:
of this variable is True, you know that someone has
won the game. def moves_taken():
After adding the remaining winning line checks,
Create
add some code at the end of the function to change You’re going to use this function to count the number
Graphical
the display message if there has been a winner: of moves which have been made, so let’s start a
User
variable to keep count, initially beginning at 0.
Interfaces
if winner is not None:
with Python
message.value = winner.text + " wins!" def moves_taken():
moves = 0 For further
You now need to make sure that this function tutorials on how
is called each time an X or O is placed, which Now, remember when we created the to make your
corresponds to any time a button is pressed. Add board_squares, we used a nested loop to create all of own GUIs with
guizero, take
a call to check_win at the end of the choose_square the squares on the grid? We’re going to need another
a look at our
function, just in case the square that was chosen nested loop here to check each and every square and book, Create
was the winning square. determine whether it has been filled in with an X or Graphical User
Your program should now look like O, or whether it is blank. Add this code for a nested Interfaces with
tictactoe5.py. Run it and test the game. If you loop to the moves_taken function: Python. Its
wrote the tests in the check_win function correctly, 156 pages are
packed with
you should find that the game detects correctly for row in board_squares:
essential info
when a player has won. for col in row:
and a range
of exciting
Draw game Inside the loop, we need to check whether that projects.
At the moment, the game will allow you to continue particular square is filled in with an X or an O. If it is, magpi.cc/
playing even after it has been won, until all of the add 1 to the moves variable to record that square has pythongui
squares are selected. It will also not tell you if the been counted.
06-tictactoe.py
> Language: Python 3
Finally, once the loops have finished, add a return # Add this code
statement to return the number of moves taken. elif moves_taken() == 9:
message.value = "It's a draw"
return moves
Your code should resemble 06-tictactoe.py. When
Now, call this function inside the check_win run, the game will now check whether nine moves
function, to check for a draw. Add this code after the have been taken; if they have, it will change the
code that checks for a winner: message to report that the game was a draw.
Reed relays are versatile components that Figure 1: At the core of a reed relay is a reed switch that uses a magnetic field to
can be used for applications where the true operate it. (Source: Pickering Electronics)
isolation offered by a physical switch is
demanded. They are based upon a reed
switch, a device consisting of two lengths
of magnetic alloy, commonly 50:50 nickel switch than mechanical relays. Although operation at 10 mA. At such current levels,
iron. The contacts are held in a glass tube their switching is considered bounce free, they can be constructed to be reasonably
(the “reed”) such that they almost touch, under certain conditions they can still sensitive.
and their ends are plated with a contact suffer from contact bounce, especially if
material. When a magnetic field is the coil is driven from a voltage higher The coil and the reed can also be hermet-
brought close to the reed, the two lengths than specified. ically sealed inside a case, making them
of magnetic material become magne- remarkably rugged. Some types even have
tized, their ends attract, and, bingo, they The coil of a reed relay is usually imple- metal screening inside the case to ensure
make contact. When the magnetic field mented with a fine wire wrapped that external magnetic fields do not
is removed, they open again (Figure 1). around the reed. A typical reed requires result in the unwanted operation of the
50 Ampere-turns to operate. So, 50 turns device. Manufacturers also have a couple
Reed relays generate the magnetic field of wire cause it to operate if 1 A is passed of tricks with which reed relays can be
from a coil and are typically faster to through the coil, while 5000 turns cause built as normally-closed or changeover
Figure 2: A selection of reed relays. Top left is a changeover type (two contacts on the left-hand end). Bottom right is a bare
reed. The rest show the wide variety of sizes and packages available.
Simple Analog
ESR Meter
With Moving-Coil
Meter Precision
10k
R5
11 10 D2 5
10n 1 600 R8 R9 R17
+
10k
10
10
IC1F
R6 M1
13 12 100µA
1 600
Figure 2: The schematic of the ESR Meter is composed of design elements from various DIY examples found on the Internet.
My Circuit circuit because any other silicon junctions will not be forward
In the circuit I decided to build (Figure 2), I used several design biased by the relatively low AC signal. The low-level AC signal is
elements from the DIY examples I found on the Internet. For the DC decoupled with C3 and amplified by two operational amplifi-
oscillator and impedance converter, I used a single 74HC14 that ers, with a voltage gain of 4.7 for the first amplifier and a gain of
provides six inverters with hysteresis. One of the inverters acts as a 10 for the second. This provides an overall gain of 47 to the input
relaxation oscillator and the remaining five inverters operate as the of the absolute value circuit.
impedance converter. This part of the circuit came from Lawrence
P. Glaister VE7IT. His circuit and article can be found at [1]. The absolute value circuit was taken from the Burr-Brown
Application Bulletin “Precision Absolute Value Circuits” [2]. The
The detector portion of the ESR meter is the same as the detection absolute value circuit had plenty of drive for the 100 microamp
circuit in the commercial ESR meter built by Creative Electronics. meter I used.
Sadly, these meters are no longer made.
This ESR meter operates of a single 9-volt battery. The plus,
Diodes D1 and D2 clip the top and bottom of the 100 kHz AC to minus and ground voltages needed for the operational amplifier
one silicon junction drop. This allows capacitors to be tested in are derived using the opamp voltage follower with current boost
shown in Figure 3.
R22
3k3
R20 T1
R26
10k
10k
TIP41 R24
Bt1
D5
1 +4V5
10
3 7
5 1N4001
9V 6
IC4 R25
2
D6
4
–4V5
10
LF356 1N4001
T2
R21 R23
TIP42
10k
3k3
Questions or Comments?
Do you have technical questions or comments about this article? Figure 8: Calibrating the meter is easily accomplished with a few
Email the author at glydeck@aol.com or contact Elektor at 2-Ω resistors and a scrap of paper.
editor@elektor.com.
RELATED PRODUCTS
WEB LINKS
[1] Circuit by Lawrence P. Glaister (VE7IT): > Elektor 2 MHz LCR Meter Kit (SKU 19883)
http://ve7it.cowlug.org/esrmeter.html www.elektor.com/19883
[2]Burr Brown application note
> Peak Atlas ESR70 Plus Capacitor Analyser (SKU 17668)
http://glydeck.com/project/content/absolute_value_ www.elektor.com/17668
circuit.pdf
Sigfox CO2
Traffic Light
No Wi-Fi Network Needed!
1k5
C4 C2 C1 C3
VCC
220µ 220µ
GND
D2 100n 100n
+5V
R3 R2
USB
4k7
4k7
IC3 SCL
SCL
SDA
IC1
SDA
ARDUINO UNO R3 RST +5V
AREF
GND AREF 5V
A0
RESERVED 13 DAC0/A0 VIN
A1
IOREF 12 A1 VCC
A2
RESET 11 A2 GND
A3
3.3V 10 A3 RES
+5V
5V 9 A4 14 < TX
POWER
GND 8 A5 13 > RX
GND A6 12 SCL
DIGITAL (PWM)
DIO7 DIO0
VIN 7 0 11 SDA
DIO6 DIO1
6 1 10 MISO
A0 DIO5 DIO2
A0 5 ~2 9 SCK
A1 DIO4 DIO3
ANALOG IN
A1 4 ~3 8 MOSI
A2 ICSP DIO3 DIO4
A2 3 7
RESET
~4
MISO
A3 DIO2 DIO5
SCK
A3 2 ~5 6
SDA DIO1
A4 TX 1
SCL DIO0 MKR FOX1200
A5 RX 0
ANT
GND
MOSI
5V
DIO6
DIO7
DIO2
DIO7
DIO1
DIO0
DIO3
DIO5
DIO6
DIO4
A2
A0
A1
A3
SDA
SCL
SDA
SCL
R4
+5V +5V +5V +5V +5V
470
RESET 1 3 2 4 1 4 2 5 3 6 1 4 2 5 3 6 1 4 2 5 3 6 1 3 2 4
X2 C5 X4 X3 X5 X1
S1
1000µ
Figure 1: The CO2 traffic light circuit diagram showing both the Arduino Uno and the MKR FOX1200 board wiring.
can be connected to SDA and to SCL. The connections X3, X4 and X5. These connec-
OLED display [2] also connects via the I2C bus tors can be used to provide future additional
at the X2 double-level terminal strip. functionality to the system, for example to
switch on air conditioning units or actuate
In addition to a power supply connection we ventilation when measured values exceed
only need a single digital port pin to operate thresholds.
the NeoPixel LED matrix display [4]. Port pin
DIO7 is used here and the display connects Figure 2 shows the assembled circuit board
via the double-level terminal strip X4. NeoPixel onto which either the Arduino MKR FOX1200
displays with different numbers of LEDs can module or the Arduino Uno board is plugged
be driven from this single port pin. (face down) into its corresponding rows of
connectors. Only one of these boards
Additional sensors/actuators can be should be fitted to the motherboard at any Figure 2: The finished CO2 traffic light
connected to the unused digital/analogue time. Do not try to mount both boards, by motherboard PCB.
using extending headers. The board layout, connections to mitigate supply voltage supply can easily be provided via the Arduino
the assembly plan, a parts list and Arduino fluctuations as the LEDs are switched. on-board SMD voltage regulator. In this case,
firmware used can be downloaded from Use an electrolytic capacitor in the jumper JP1 on the motherboard must be
the Elektor project page [3]. The flat Sigfox range from 470 µF to 1,000 µF for smaller removed so that the 7805 will not become
antenna can be fixed in position using double- displays. The value used in this applica- reverse powered.
sided adhesive tape. Figure 3 shows both tion (C5) is 1,000 µF.
versions assembled. > Install a low value resistor in series with Add Some Libraries to the
the display control line to reduce inter- Arduino IDE
The Power Supply ference. The value used here (R4) is The CO2 traffic light software requires some
One important consideration when using 470 Ω. additional libraries to operate external
NeoPixels is their power requirements. In the > An external regulated power source will components like the CO2 SCD30 sensor, 1.3”
worst case when all three of the individual be required with a high-quality voltage OLED display and NeoPixel LED matrix. Two
LEDs in one NeoPixel is set to maximum inten- regulator (possibly even cooled) and additional libraries will also be required for
sity with a value of 255 to produce the bright- with appropriate reservoir capacitors Sigfox operation with the MKR FOX1200 board
est white light, each LED element will draw (here we use a conventional 7805 linear and an optional one for the on-chip RTC of
20 mA so a single NeoPixel requires 60 mA. regulator on the motherboard powered the SAMD21 microcontroller.
A matrix made up of 16 NeoPixels requires from a 9V/1A mains adapter). DC/DC
16 × 60 mA = 960 mA! That’s more than can switching regulators can also be used The SCD30 CO2 Sensor Library
be supplied by the 5V SMD voltage regula- here they offer better efficiency and are To install the SparkFun driver library for
tor (without a heatsink) fitted to the Arduino not much more expensive. the SCD30 sensor, go to Tools -> Manage
board. Powering it from the Arduino board > Under no circumstances should the Libraries... in the Arduino IDE, then look for
would overload the regulator which may shut uncooled on-board SMD voltage stabi- scd30 in the top right corner. The two most
down or in the worst case, release its inter- lizer of the Arduino boards be used, popular SCD30 libraries will be listed, one from
nal smoke. since failures can quickly occur, partic- Adafruit and one from SparkFun. As shown
ularly if you are using a cloned board, in Figure 4, we will use the SparkFun library.
Under normal operating conditions, you proba- due to overheating or switching current
bly will not be driving the NeoPixel so hard, but peaks. After installation, the library is automatically
reckon on an average current consumption of > The NeoPixel LED display matrix should integrated into our program in the IDE via
25 to 30 mA per NeoPixel, depending on the only be as large as absolutely necessary Sketch -> Include Library -> ... SparkFun
overall colour displayed. With a 4×4 LED matrix, and should not be operated at maximum SCD30 Arduino Library. You can get a detailed
you still get 400 to 480 mA, which again will brightness. The brightness of the round description of the library by clicking on More
be too much for an on-board Arduino voltage 7-element NeoPixel display used here is info in the bottom left of Figure 4.
regulator to cope with. controlled by the software using a range
of values from 4 to 16 out of 255 possible The 1.3” OLED Display Library
Therefore, the following should be observed levels. The extremely powerful and comprehen-
when using NeoPixel displays: sive U8g2 library built by Oli Kraus is used to
If the system is operated without a NeoPixel drive the 128*64 pixel 1.3” OLED display. This
> Install a reservoir electrolytic capacitor display for test or other purposes, and if the complete software package actually consists
directly at the NeoPixel power supply total power consumption is not too high, the of four individual libraries:
RELATED
PRODUCTS
WEB LINKS
[1] CO2-Sensor SCD30: https://bit.ly/34XbL5o
[2] 1.3“ OLED display: https://bit.ly/3fEP7AX
[3] Elektor Project Page: www.elektormagazine.com/200650-01
[4] NeoPixel LED displays Information: https://bit.ly/3qf1Y2k
[5] Frank Schleking, Bernd vom Berg, “Sigfox and the IoT (1),” ElektorMag 11-12/2019 (Parts 2 to 4 follow in the next 3 editions):
www.elektormagazine.com/magazine/elektor-114/56832
[6] Provide your dev kit details: https://buy.sigfox.com/activate/devkit/DE
[7] Sigfox backend login page: https://backend.sigfox.com/auth/login
[8] Build the dashboard using thinger.io: www.thinger.io
Women
in Tech
“It's All About Merit
Until Merit Has Tits”
Photo by Kelli McClintock on Unsplash
of women in tech. The biases that cause this situation are learned. > Flavia Ferreira (Young Padawan): In our house there is a
Which should mean that we can unlearn them. The same is true for group of women known as the ‘soldering ladies’ that roam the
any other underrepresented group of human beings in engineering. world of audio hardware doing fantastic assembly work and
repairs. Flavia is one of them. If your circuits are built to make
A very powerful part of forming your worldview is ‘normalising’. It sound, then these are the hands you want to work on them.
means that you think that whatever you are exposed to is normal. She also posts soldering tips, Let’s Talk Nerd interviews and
This is why representation and role-models matter so much. So makes music. The force is definitely strong in this one.
try giving yourself a women’s quota wherever you connect to your www.instagram.com/imyoungpadawan
particular field of engineering. Make an effort to get maybe a third
of your input from female engineers. (You get only half points for Please share with us which Women in Tech you would recommend
this article as I am a ‘woman in tech,’ but I am not an engineer.) to follow.
Try to fill your social media account with more women. And when 220200-01
you find interesting female voices; amplify them. To start you off
on your journey of normalising women in tech, I would like to
introduce you to three of my favourite femmes:
> Jeri Ellsworth: All-round inventor. Amazing programmer
and electrical engineer. Ran the R&D team at Valve, and has
recently been busy building Tilt Five. This is an AR board World Ethical Electronics
gaming system where players wear glasses with tiny projec- Forum 2022
tors that make holograms appear on a reflective gaming In November of 2021, Elektor
surface. After four years, the system is currently in production launched the World Ethical Electron-
and is about to explode onto the gaming market. ™ ics Forum (WEEF) in Munich,
www.jeriellsworth.com Germany. The event inspired global
innovators in electronics with an
> Naomi Wu (Sexy Cyborg): A tech reviewer and DIY maker of open discussion about ethics and sustainable development
all sorts in Shenzhen. Giving you a candid peek into the birth- goals (SDGs). In addition to Elektor engineers and editors,
place of most electronics. Worked on the Creality 3D conveyer the list of speakers and panelists included Dr. Stefan Heine-
belt printing mill and builder of the blinkini. Once made a mann (Professor of Business Ethics at the FOM University of
company uphold their code licencing by simply walking into Applied Sciences), Dr. Paula Palade (PhD, Jaguar Land Rover),
their offices. Called out tech facemasks for not being safe. Margot Cooijmans (Director, Philips Foundation), and several
Advocates and opinionates loudly so that those in the back other thought leaders, including Priscilla Haring-Kuipers. Visit
can hear. The tag line, “It’s all about merit until merit has tits,” the WEEF webpage (www.elektormagazine.com/weef) to stay
is hers. informed about Elektor’s plans for WEEF 2022, which will take
www.youtube.com/c/SexyCyborg place in November of this year.
WEB LINK
[1] Wikipedia, “Women in Engineering”: https://en.wikipedia.org/wiki/Women_in_engineering
Low-Budget
Tablet Oscilloscope ADS1013D
Good Value for Money?
If you are used to working with more expen- you do, of course. During testing proto-
sive oscilloscopes from renowned brands, it types and repairing electronic devices, for
is very difficult to look at a device from the example, accuracy and precision aren’t
lower market segment without prejudice. actually that important, a quick glance if
The device I’m going to discuss here looks the signal-under-test has about the correct
good, but — with all due respect — it ‘feels’ level or waveform will do. If that is what
cheap. You know in advance that in terms of you need, this affordable unit
specifications, it can’t compete with devices may be good enough for the
that cost a multiple of the ADS1013D. If you measurements you want to
want to do very accurate measurements, take, so why spend more
you’d better save up and buy something money than necessary?
really good.
But as with so much equipment and tools,
it doesn’t all have to be top of the bill to still
be useful. Let’s be honest: how often do we
really need a high-precision oscilloscope?
It strongly depends on the kind of work Figure 1: The box and its contents.
The original plan for this review was to The box also contains two P6100 1:1/1:10 base setting of 50 s/div will hardly ever be
test a Daniu ADS1013D, but when I was switchable 100 MHz probes — no high-qua- of practical use.
looking to buy one that I could get at an lity stuff, but they will do the job. The hook
acceptable price, at short notice, I came clips could have been a bit smaller, though. But instead of complaining what this oscil-
across the FNIRSI brand. They sell exactly loscope does not have, let’s have a look at
the same oscilloscope with even the same And then, of course, the most important what it does have to offer. First of all, a
type number, and apparently it is also part: the oscilloscope. 7” touchscreen, a bright 800 x 480 pixel
being sold as a KKmoon and Yeapook colour LCD with a good viewing angle,
ADS1013D. I wouldn’t be surprised if the The ADS1013D Itself nothing to complain about there. With this
product is available from other brands as As I said earlier, you shouldn’t buy an touchscreen, no knobs, buttons or switches
well. There are many online shops where oscilloscope in this price range if you need are needed to operate this instrument,
you can buy the ADS1013D, and with prices highly accurate measurement equipment, except for the good old-fashioned ON/OFF
ranging from a lower hundred to more and I’m even not going to test or verify switch. The good thing about this switch is
than €300, it certainly pays to search well the specifications of this one (see textbox). that it keeps the scope powered, without
before you actually buy. Most sellers are Other reviews on the Internet (like [2]) any auto power off timer that switches it off
advertising the ADS1013D as “Tablet oscil- show that these specs are — mildly put — during measurements; but of course, if you
loscope, 2-channels, 100 MHz bandwidth very optimistic, for example, by pointing forget to switch it off without the charger
and 1 Giga-samples/second.” Let’s see what out that the 8-bit A/D-converters at the connected, the battery will probably be
you get when you buy one. input of each channel (AD9288) are by no drained the next time you want to use it.
means fast enough for real time 1 GSa/s
What’s in the Box? sampling. Even more important: the The power switch is recessed in the top side
My FNIRSI ADS1013D is packaged in a 100 MHz bandwidth that is claimed for of the oscilloscope (Figure 2), just like the
sturdy cardboard box with protective both inputs is also unrealistic; in terms two BNC connectors for the probes, a 1 kHz
foam inside, and it contains the oscil- of true bandwidth, 20 MHz seems to be square wave output connection for probe
loscope, a 2 A USB-charger with a 1.5 m a more accurate value [2]. A maximum calibration, a red power indicator LED
long USB-C cable, two 100 MHz probes sensitivity of 50 mV/div for the inputs is plus a green LED to signal that the battery
and a small manual (Figure 1). To start a bit disappointing, and a maximum time is fully charged, and the USB-C connector
with the latter (you know: that booklet
that you never wanted to read anyway), I
can be very short: if you look inside, you
immediately hope that you’ll never need
to read it, with its small print, vague illus-
trations and very compact layout. I would
recommend to use the online documen-
tation instead [1].
The charger is a standard 5 V USB type, so
there’s no fast type C USB-charging on this
device. With a fully charged battery, the
oscilloscope works for about four hours,
Figure 2: Power switch, connectors and LEDs.
not bad at all!
RELATED PRODUCTS
Questions or Comments?
Do you have questions or comments
about his article? Email the author at > OWON SDS1102 2-ch Digital Oscilloscope (100 MHz) (SKU 18782)
www.elektor.com/18782
luc.lemmens@elektor.com.
> Micsig STO1152C Plus 2-ch Oscilloscope (150 MHz) (SKU 19372)
www.elektor.com/19372
WEB LINKS
[1] FNIRSI online documentation: www.fnirsi.cn/productinfo/556152.html
[2] ADS1013D tablet oscilloscope tested: https://bit.ly/3Doz6Kv
Ele
or
lab
ORIGIN
AL
Ele k
ab
rl rl
to
Smart Plug Teardown
• Ele k to
ab
Smart plugs or Wi-Fi-enabled sockets can be had for less than €15 these days. They
allow lamps and other consumer appliances to be controlled remotely (some units
can even record the appliance’s power consumption). For electronics engineers,
it’s not always that simple. Questions such as “I wonder what hardware they are
using there?” and thoughts like “I might be able to swap out the firmware and use
a different cloud platform to the one specified by the manufacturer” are always in
the back of our mind. To check out the internals of some of these smart sockets
and find out which ones are more hacker-friendly, I turned to my toolbox and took
out screwdrivers, a hacksaw, a camera, and a magnifying glass.
Table 1 contains the technical data of the Aoycocr EU6S circuit board, on which all components except
three sockets examined in more detail. The The EU6S housing is held together by four the power contacts are located. This layout
manufacturers specified a maximum load triangular socket head screws (Figure 9), makes reengineering easier.
current of 10 A (2.3 kW at 230 V≈) for the allowing fairly easy access to the internals.
EU6S and Tapo P100 models. With the S26R2, With the cover off, the PCB is held in place I divided the PCB into three basic functional
Sonoff pushes the limits of what is possible by two screws which screw into and make groups. Figure 13 shows the sections of the
and offers up to 16 A (3.6 kW at 230 V≈), contact with the live and neutral pins of the power supply function (yellow), Wi-Fi/MCU
which is useful for switching larger loads such plug. You will need a suitable tool which can module (orange) and relay including wiring
as kettles or electric heaters. be found in the iFixit kit from the Elektor Shop (magenta). The shunt resistor R7 and IC U3
[1] to access the screw heads. Figure 10 (Figure 14) are used here to provide a means
These items are not intended to be service- shows the two internal threads in the plug of measuring the current drawn by the appli-
able; they rely on the integrity of the casing to pins which are used to fix the PCB (Figure 11). ance switched by the unit. What’s obviously
provide electrical isolation from the user. I was Figure 12 shows the component side of the missing in this configuration is a transformer
only able to open (and reassemble) the EU6S
and S26R2 smart sockets without destroying Table 1: Technical data of three smart plugs
them. Unfortunately, the TP-Link Tapo P100 Name Max load Wi-Fi BLE MCU/SoC
uses a sealed housing, while getting inside
Aoycocr EU6S 2.3 kW (10 A @ 230 V≈) 2.4 GHz No ESP8266
is possible, it will be damaged in the process.
Incidentally, the TRÅDFRI socket from IKEA TP-Link Tapo P100 2.3 kW (10 A @ 230 V≈) 2.4 GHz Yes* RTL8720CF
was a job for the hacksaw, it could not be Sonoff S26R2 3.6 kW (16 A @ 230 V≈) 2.4 GHz No ESP8285
reused.
*Only used to configure Wi-Fi
Figure 12: Component side of Figure 13: Functional areas of the Figure 14: Close up of U3 and shunt
the EU6S PCB. EU6S PCB. resistor.
C1
R1
+5V
C3
8 1 D2
DRAIN U1 BP
7 2 AMS1117-3.3
DRAIN GND
6 3
F1 D1 1mH DRAIN FB
L1
5 4
L1 DRAIN C/S 2 U2 +3V3
L2
10 / 0W5 R19 R21
HP-01 2
R20
C8 C9 D3 C15 C7 C4 C5
MOV1
+3V3 +3V3
10k
10k
10k
N 1k
R7 R11 SW R3
1 8 10
0 1
VDD SEL
S1
680
2 7 R12
R5 VIP U3 CF1 10
3 6
N OUT 1k VIN CF2 R13
4 5 10
C12 C11 V2P GND
BL0937 LED
R8 R9
L1 1M2 1M2
R10
C14
1k
SEL
CF1
CF2
+5V
+5V
R17
1k7
Q1 1 14
R18
REL RX 2 13 TX
900
GPIO4 3 12 GPIO5
GPIO0 4 11 GPIO2
L1
GPIO13 5 10 GPIO15
Re1 D4 GPIO14 6 9 GPIO12
EN 7 8 TOUT
5V
F2
L1 OUT U4
10A
220170-015
that would normally provide galvanic isola- any data sheet for this device. I drew out the mains signal. C8, C9 and L1 are configured
tion in a switched-mode power supply design. circuit showing all the components wired to to form a pi filter to smooth the resulting DC
Let’s take a look at the power supply first. this chip to determine the pin functions. voltage. This voltage is applied to pins 5 to 8
of U1. The two parallel shunt resistors R19 and
The Power Supply Mains voltage is present on the left and enters R20, diode D3 and coil L2 together with the
In the upper area of Figure 15 you can see via F1, a 10-Ω resistor used here as a fuse with feedback network formed by D2, C1, C2, R1
the circuit of the power supply built around a 0.5 W power rating (Figure 17). The varistor and R2 indicate that U1 is most likely a buck
the IC U1 (HP-01 AL93PH.1, Figure 16). Unfor- MOV1 provides overvoltage protection. Diode switching regulator providing a 5 V DC output
tunately, an Internet search did not bring up D1 provides a cost-effective half-wave rectified smoothed by capacitor C7 from the 325 V DC
4k64
C1
R1
+5V
C3
8 1 D2
DRAIN U1 BP
7 2 AMS1117-3.3
DRAIN GND
6 3
F1 D1 1mH DRAIN FB
L1
5 4
L1 DRAIN C/S 2 U2 +3V3
L2
10 / 0W5 R19 R21
HP-01 2
R20
C8 C9 D3 C15 C7 C4 C5
MOV1
220170-016
Figure 16: Markings on the HP-01 AL93PH.1 (U1) are more readable using false colouration.
input on capacitor C9. The circuit requires 5 V microcontroller and Wi-Fi hardware which output voltage. It is reasonable to assume that
for operation of the relay K1 which switches cannot tolerate 5 V. U1 is used here in a similar way. The wiring
power to the appliance. and layout for an application using the MPS
I have seen similar power supply configura- MP4050A is similar to how U1 is configured
IC U2 is the familiar AMS1117-3.3 low-drop tions used by standard mains powered LED in the circuit of the UE6S smart plug.
linear regulator that converts 5 V into a stable lamps with an E14 or E27 base. Even though
3.3 V. This voltage level is required by the I couldn’t find a data sheet for this particular
IC (U1) I can deduce that it provides a similar
function to chips such as MPS MP4050A [2]
(Figure 18) or Power Integration LNK302 [3] Caution! This uses a non-insulated
(Figure 19) often used in LED lamps. Their power supply without galvanic isola-
data sheets give information about pin assign- tion, the ground of the circuit board can
ments and circuit wiring indicating they are have the same potential as the phase,
compatible with the function of U1. Figure 20 depending on the polarity of the socket
shows the block diagram of the internal struc- wiring. Touching the circuit ground and
ture of the MPS MP4050A. Although GND is almost all components and circuit board
the reference for the control signal and the pads is therefore life-threatening!
Figure 17: F1 is a 10-Ω resistor. gate driver, it is not the reference point for the
Figure 18: Example application circuit using the MPS MP4050A. Source: [2].
Figure 26: The TP-Link Tapo Figure 27: The pins down the Figure 28: The PCB can be divided into three
P100 forms a compact unit. middle are soldered. main sections.
Current is measured by the voltage drop The slow-blow mini-fuse F2 (Figure 23) is rated measure and read out the energy consump-
across a 1-mΩ shunt resistor R7 placed in at 10 A and protects the relay and circuit board tion of the connected device. However,
the neutral (N) path. The voltage across R7 from damage when excessive current is drawn the measurements from U3 should also be
connects to pins 2 and 3 of U3 through R6 by the switched load. The fuse can be easily and calibrated so that the data collected can be
and R5. Together with C11 and C12, they form cheaply replaced to get the unit working again. relied upon.
a low-pass filter for removing mains-borne
interference. LED1 uses a 680-Ω series resistor (Figure 15, All the programmer interface contacts of the
bottom middle). This low value of current can MCU are on the underside of the PCB so its
Pins SEL, CF1 and CF use series 10-Ω resis- be supplied directly from the MCU pin LED. necessary to take the PCB out of its enclosure
tors and 10-kΩ pull-up resistors for the signals The push button input uses a 10-kΩ pull-up if you wanted to flash ESPHome or Tasmota to
which then connect directly to the MCU pins. resistor R4. the MCU. The screws are not so easy to reach
The interface is as simple and as low-cost as — in particular, assembly is more difficult than
possible. The HJL-01 chip is probably cheaper The Wireless Microcontroller disassembly. You can, however, open the case
than a BL0937, which retails for less than ¢60. The MCU used in this unit is an ESP8266, without causing any damage, which is a bonus.
By comparison the HLW8012 alternative is which has built in Wi-Fi compliant to IEEE
about 30% more expensive. 802.11 b/g/n. Together with a few other compo- The TP-Link Tapo P100
nents it is on its own small PCB (Figure 24), The Tapo P100 socket (Figure 26) from TP-Link
The Relay, LED and Push Button fixed upright to the main PCB. Apart from a is significantly more compact compared to the
Appliances plugged into the socket are RESET, no other test point is labelled on the product from Aoycocr. No screws are visible
switched by relay K1. The type used is the module. Next to the MCU is the ZB25VQ80A- from the outside, because the Tapo P100 model
NHLC 932-5VCD-SL-AH with a maximum ITG 8 Mb capacity flash memory chip has a housing whose parts are held together
load capacity of 10 A at 250 V≈. Relays with (Figure 25). I unsoldered this small board with clamps or latches. Opening the case will
this spec generally cost around ¢50. The control to find which components connect to the leave marks, even if you are careful. With the
can be seen in the bottom left of the circuit in ESP8266. I was then able to determine the pin right tools, you can get to the inner workings
Figure 15. assignments of the module board and allocate quite quickly. Unfortunately, the circuit board
functions to them. This information is given in cannot be taken out of the housing that easily
The relay coil K1 is connected to 5 V and the circuit of Figure 15. because it is soldered to the contacts of the
switched by transistor Q1. This driver transis- plug pins (see Figure 27). I desoldered it to
tor switches 0.4 W from 5 V through the coil MCUs like the ESP8266 can easily be provided take a look at the bottom of the board.
from the 3.3 V signal output by the controller. with their own firmware. It is possible, for
D4 ensures the back-EMF generated when example to operate the MCU with ESPHome The PCB can be roughly divided into the three
switching the inductive relay coil is safely [5] or Tasmota [6]. In addition to simply switch- areas of power supply, relay and MCU based
discharged to the supply rail. ing the load via the relay, it is also possible to on functions, which are marked in Figure 28.
U1
+5V
RTL8720CF-VA
F2
30 VBAT_IN
D10 A1-1A-F
L SW1 D14
R5
100 23 GPIOA_9
L_OUT
C175 C174
24 GPIOA_10
SW1 = RJ-SS-105DM Q1
R155
500 21 GPIOA_7
R158
10k
R6
10k 31 VD33_OUT
SW3 R7
100 38 GPIOA_17
C6
220170-032
Figure 31: Realtek
RTL8720CF.
100!
N D1
R5
CE3 CE2 C6 CE4 C2 C1 C3 C4 C7
2k
3µ3 3µ3 470µ
400V 400V 10V
+3V3
LED1
R10
+5V +3V3
brother, the RTL8720DN [9], also offers Wi-Fi
in the 5 GHz band in addition to the usual
1k
+3V3 R12
L1 OUT
Q2
R8
2.4 GHz band.
1k
K1 D3
LED2
1k
S1
Push Button, LED, Relay and Fuse
C8
L1
R11
Control of the LED in this circuit (Figure 29)
Q1
R6 looks a bit strange at first glance. Resistor R5
1k
1k
A Helpful Hack
As we discovered, all three smart plugs are to assess other products and use the circuits
very similar. An un-isolated power supply as inspiration for future projects.
steps down the mains voltage to power an
MCU with Wi-Fi that controls a relay. There are If you have already tinkered with smart
some variations in the implementation such as sockets, share your experiences (whether
protective measures, the LED control method good or bad) with us. Any unusual findings
or the addition of a smart meter chip. Even and insights into the design of other smart
though IKEA’s TRÅDFRI only made a guest plugs are very welcome and may help
appearance here, I can tell you that there is others.
nothing out of the ordinary in its design also. 220170-02
Hacking into these products was definitely Questions or Comments?
instructive for me. I got a glimpse into some Do you have any technical questions
safety aspects of the design and how “optimi- or comments prompted by this article?
zations” can cut costs, which is a particularly Email the author at mathias.claussen@
important criteria in the design of high volume elektor.com or contact the team at
consumer products. I can use that knowledge editor@elektor.com.
WEB LINKS
[1] iFixit Pro Tech Bit Set: www.elektor.com/ifixit-pro-tech-toolkit
[2] MP4050A: www.monolithicpower.com/en/mp4050a.html
[3] Power Integrations LNK302: www.power.com/products/linkswitch/linkswitch-tn/lnk302dg
[4] BL0937: https://bit.ly/37KY7Uo
[5] ESPHome: https://esphome.io/
[6] Tasmota: https://tasmota.github.io/docs/
[7] MP2565: www.monolithicpower.com/en/mp2565.html
[8] RTL8720CF: https://bit.ly/3DbrJ8Z
[9] RTL872xD: https://bit.ly/3JESUf2
[10] AUPO A1-1A-F: www.tme.eu/en/details/a1-1a-f/thermal-fuses/aupo/
[11] N. Statt, “Nest is permanently disabling the Revolv smart home hub,” The Verge, April 4, 2016: https://bit.ly/3ICGi6O
[12] Tuya Convert: https://tasmota.github.io/docs/Tuya-Convert
[13] Tasmotizer: https://github.com/tasmota/tasmotizer
[14] ESPHome OTA Installation: https://bit.ly/3JIlps9
Skin Impedance
and Skin Capacitance
Small Experiments
Many years ago, I encountered some strange using an AC signal, or, more precisely, a short becomes very small and the internal imped-
effects involving wires in water and fingers positive pulse followed by an equally short ance is therefore dominant. This means that
touching metallic surfaces. At the time, I negative pulse. The result was astonishingly electric shocks are more dangerous than you
wanted to measure wood moisture content good conductivity values. A normal multi- might think from an ohmmeter reading.
using stainless steel screws in the wood. meter shows a resistance of around 1 MΩ
Unfortunately, the characteristics of the between the two contact electrodes, but the The other focus of such investigations lies in
contacts changed quickly, resulting in less microcontroller instrument gives values of the medical domain. The aim is to find out
current flow. It was even possible to build up around 10 kΩ.
a charge on the contacts, and I was able to
measure a voltage for several seconds after If you do an online search on this topic, you
the supply was disconnected. I decided to call will quickly discover that skin impedance
this a ‘wood battery’. Only later did I realise is frequency dependent. The higher the
that this involved a double layer of water frequency, the higher the conductivity. The
molecules forming a double-layer capacitor. impedance also drops with increasing voltage.
Now I have clarified this mystery with further Investigations like this are performed for a
measurements. variety of reasons. At one time it was about
the dangers of electricity. Researchers inves-
Measuring Skin Impedance tigated how much current could flow through
The starting point for the measurements was the human body under various conditions.
the development of a conductivity meter for This revealed that the internal impedance
human skin (Figure 1) using a microcontrol- from hand to hand is only a few thousand
ler, which was ultimately intended to be used ohms, and the skin impedance is dominant.
as a lie detector. I made the measurements With high AC voltages, the contact resistance Figure 1: Measuring skin impedance.
10k
An Equivalent Circuit for the
Skin 200621-006
FINGER
1k
1M
200621-013
is here assumed to be 1 kΩ.
200621-014 If you repeatedly increase the frequency,
the impedance of the skin capacitor drops
accordingly. Then the internal impedance
Figure 9: The simplified equivalent circuit. Figure 10: The more extensive equivalent circuit.
becomes more significant. I personally know
this from painful experiences in amateur radio.
If you accidentally touch the output connec-
comparable results, the wires should only be tor of a shortwave transmitter, you don’t get
ATtiny85 immersed about 1 mm into the water. an electric shock but instead a burnt finger.
B3 B4 B1 The burn effect, however, is totally different
The measurements (Figure 7 and Figure 8) from what you get from touching a hot solder-
show that the glass of water with two ing iron. There is no burn blister like you get
electrodes has more capacitance than my from a soldering iron, and it feels completely
hand. The capacitance can be calculated different. The heating clearly occurs beneath
from the waveform, but it can also be deter- the epidermis in the deeper skin tissue with
mined by comparison with other capacitors. higher conductivity, in particular where the
200621-015 The water capacitor has approximately the current density is highest.
same effect as a 47 nF film capacitor, despite
the very small surface area of the electrodes Application: Touch Sensor
Figure 11: An automatic Morse key with touch
sensors. immersed only about 1 mm into the water. If A possible application for the finger capacitor
is an automatic Morse key with touch sensors.
I used an ATtiny85 microcontroller (Figure 11)
together with two touch sensors from an
FM radio (Figure 12). In the radio the sensor
currents were amplified by transistors, which
means that the skin resistance was sensed.
This has the disadvantage that a certain
degree of soiling can lead to malfunctions.
An evaluation method in which the micro-
controller measures the charging time of the
Figure 12: The touch contacts. Figure 13: Signal on port B3. capacitor formed by the finger is significantly
From Life’s
Experience
No Local Business
You Can Catch More Flies with Honey Than With Somewhere in 2012, when we had established an entire range of
Vinegar products using vintage technology, but we were also among the
I used to love the Piet Pienter and Bert Bibber comics. The fact that first to offer enclosures and expansion boards for the Raspberry Pi
technology plays an important role in this series by Jozef Van Hove, computer. Our website was available in both Dutch and English and
alias Pom, who in real life was a qualified engineer at Blaupunkt in sales were made through our own web shop and eBay. However, the
Germany during the Second World War, obviously contributed to this. orders from Belgium just didn’t come... It was quite a lot of work to
If I remember correctly, one of the personalities once said, “You can keep the website up to date in two languages, and after a while we
catch more flies with honey than with vinegar.” It is the real truth, with decided to stop the Dutch site without much ado.
some elementary politeness, a business-like attitude and honesty one
can succeed in a foreign country. Since then, we have served countless foreign customers. Our products
I have been looking for a fairly basic data probes in red and black are to the left
logging device for some time now. When I and right and at the top right is a tiny
read the spec for the Pokit Meter, it looked spare fuse (Figure 3). This miniscule
as if it might just fit the bill. The design looked SMD component is a spare fuse on a
rather unconventional and interesting. I didn’t tiny PCB. Some versions of the packag-
have to wait long before the small cardboard ing include a pop out section which
box (Figure 1) was sitting on my bench. holds the fuse securely and allows it
Symbols on the outside of the box (Figure 2)
indicate the functions of the device inside.
On the right in Figure 2c, you can see what’s
inside. The 48 mm diameter 18 mm thick puck
shown in Figure 1 is the Pokit meter. Gripper Figure 1: The boxed Pokit Meter.
Figure 2: On one side it says that you can measure with it, anything and anywhere (a). Another
side is bursting with features (b). The opened packaging (c) showing what’s in the box.
to be safely stowed into one of the pockets in neath the battery. A link to the manufacturer
the carry pouch. I took it out completely and or QR code would have been useful here. On
taped it to the instruction sheet to ensure it the homepage [1] of the manufacturer Pokit
doesn’t get lost. Innovations there is hardly any further infor-
mation to be found; but there is a link to a
Let’s Fire It Up forum. At least I know now that this measur-
Figure 4 shows all the items spread out on the ing device was funded through a successful
bench. A zip up carry pouch has space for the crowdfunding campaign and that I have the
Figure 3: Keep it safe. The tiny spare SMD fuse
Pokit meter, spare fuse and gripper probes. black version from a range of four coloured on its mini PCB.
The 8 x 22 cm information sheet lists the basic versions and that there will soon be a Pokit
technical information for the device and lets Pro version and a Smartwatch app.
us know that the corresponding ‘pokitMe-
ter’ app is available to download for smart The Pokit meter’s retractable leads are termi- supplied. The leads extend (Figure 5) to a
devices running Android or iOS from the play nated in needle point probe tips which can be maximum reach between the gripper probes
or app store. It also gives battery information used directly for probing a circuit or can be of around 56 cm. The button on the bottom of
and indicates that the fuse is situated under- plugged into one of the spring loaded grippers the puck retracts the leads just like the power
Figure 4: The contents set out on the bench. Figure 5: With the two leads extended, Pokit is ready to measure.
WEB LINKS
[1] Pokit Innovations website: http://www.pokitinnovations.com
[2] The Pokit Meter in the Elektor store: http://www.elektor.com/pokit-meter-portable-multimeter-oscilloscope-and-logger
Price: €249.00
Member Price: €224.10
www.elektor.com/20206
Price: €319.00
Member Price: €287.10
www.elektor.com/20199
Price: €67.95
Member Price: €61.16 Price: €329.00
Member Price: €296.10
www.elektor.com/20196 www.elektor.com/20187
Andonstar AD203
Handheld
Digital Microscope
with 4“ LCD Screen
Traditionally, the last page of Elektor The Hexadoku puzzle employs numbers in the hexadecimal range 0
through F. In the diagram composed of 16 × 16 boxes, enter numbers
magazine is reserved for our puzzle with an such that all hexadecimal numbers 0 through F (that’s 0-9 and A-F)
electronics slant: welcome to Hexadoku! occur once only in each row, once in each column and in each of the
Find the solution in the gray boxes, submit it 4×4 boxes (marked by the thicker black lines). A number of clues
are given in the puzzle and these determine the start situation.
to us by email, and you automatically enter
the prize draw for one of five Elektor store Correct entries received enter a prize draw. All you need to do is
vouchers. send us the numbers in the gray boxes.
PRIZE WINNERS
The solution of Hexadoku in edition 04-05/2022 (May & June) is: 0FC3D.
Solutions submitted to us before June 15th were entered in a prize draw for 5 Elektor Store Vouchers.
The winners are posted at www.elektormagazine.com/hexadoku.
Congratulations everyone!
The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.
Dedicated
Reporting
Module
Tables automatically
populate with design
Pre-Production data
Checklist
Compliance status for
diff pairs and length
Set of board tests
matched routes
before Gerber Output
Make custom
Includes placement, reports with data
connectivity and object tables
clearance testing
Generate reports
Completely independant from templates
code for clearance checks
info@labcenter.com
+44 (0)1756 753440
electronica fast
forward is back!
Do
you
the wa
be nt
st to
wi sta see
thi rt- the
nt up bes
he sa to
ele nd f
ctr sca
on le-
ics up
sce s
ne
th ?
b o o
s a t o
s i t u t t
Vi o g e
.
0 t e m
. 4 4 t h
B4 n ow
k