EN202305
EN202305
95
*
1
*
IN
CE 196
SUPER
Servo
Tester
M
I
1256
1557
1971
1162
µs
Vcc 4.96
Inputs
FOCUS ON
Test &
Measurement
Automating Test Analog Signals and
and Measurement Microcontrollers
Tips for Programming ADCs, DACs, Current Measurement, and More
Test Equipment
(MSB) RF
R4
1k
VD 1k
R3
Digital Logic "1" VC 2k
Inputs or A
(4-bit) Logic "0" R2
VB 4k Analog
VOUT
output
R1
VA 8k
(LSB) 220047-075
Jens Nickel
Volume 49, No. 521 International Editor-in-Chief, Elektor Magazine
May & June 2023
ISSN 1757-0875
Become a Member
Programming a small database, setting up a server, or implementing similar nerdy things are
www.elektormagazine.com/membership unfortunately not often appreciated by all relatives and friends. However, the coolness factor
increases when something is measured, regulated, and controlled — especially when you can
Advertising & Sponsoring demonstrate how your solution makes everyday life easier.
Büsra Kas
Tel. +49 (0)241 95509178 Some young “makers” in particular quickly reach their limits. Anyone who has already written a
[email protected] few apps for the PC can quickly come to grips with the basic programming of microcontrollers,
www.elektormagazine.com/advertising thanks to languages like Python. But how do I connect a microcontroller to sensors, actua-
tors, and display elements? What must I consider? Incidentally, many electrical engineering
Copyright Notice
students are not quite sure about this either, as university teachers keep telling us.
© Elektor International Media b.v. 2023
Distribution
International Editor-in-Chief: Jens Nickel | Content Director: C. J. Abate | International Editorial
IPS Group, Carl-Zeiss-Straße 5 Staff: Asma Adhimi, Eric Bogers, Jan Buiting, Stuart Cording, Rolf Gerstendorf, Ton Giesberts,
53340 Meckenheim, Germany Hedwig Hennekens, Qiëlle Lont, Alina Neacsu, Dr Thomas Scherer, Clemens Valens,
Phone: +49 2225 88010 Brian Tristam Williams | Regular Contributors: Roberto Armani, David Ashton, Tam Hanna,
Priscilla Haring-Kuipers, Ilse Joostens, Prof Dr Martin Ossmann, Alfred Rosenkränzer | Graphic
Design & Prepress: Harmen Heida, Sylvia Sopamena, Patrick Wielders | Publisher: Erik Jansen |
Technical questions: [email protected]
6
stupnI
I
1256
1557
1971
1162
µs
Vcc 4.96
Inputs
M
Inputs Vcc 4.96 µs
1256
Regulars
1557
1971
1162
I
Features
62 Overvoltage Protection for Safe Operation
Transient Protection for Non-Isolated DC/DC Power Modules
FOCUS
FOCUS
66 Wiha Measuring Equipment
12 Analog Signals and Microcontrollers
Reliable Electrical Testers and Meters
ADCs, DACs, Current Measurement, and More
FOCUS
20 Embedded World 2023
68 Automating Testing and Collaborating on Test Results
Interesting Tech from the Fair
26 Android Smartphone Here, ESP32 There?
Practical Project Using the Android Wi-Fi API
56 89
FOCUS
103 Oscilloscope Current Probe for RF
RF Current Measurements Made Easy
• Elek
r lab to
to
r la
Ele
b
Super
TESTED
ab
Ele
to
rl
to
k
r la
b • Ele k
Servo
Tester Test Up to Four Servos
Stand-Alone or In-System
Figure 1: The quadcopter for which the
Super Servo Tester was designed.
> Manual: In this mode, the SST generates the pulses Servo 4
same time. The servos
Power
for four servos or for the flight controller. The widths Supply are powered by the
of the pulses are controlled by four potentiometers. tester and controlled by
In this mode, it is the SST that provides power to the the potentiometers.
servos (or ESC) and the model’s power supply must
not be connected to any of them. The supply voltage
Servo 1
of the SST must be between 7.5 V and 12 VDC.
> Inputs: In this mode, the lengths of the pulses Servo Tester
Servo 2 Figure 3: Configuration 2,
coming from the receiver or controller are flight controller test
M Flight Servo 3
measured. The signals are also forwarded to the Inputs Vcc 4.96 µs
1256
1557 controler (Manual Mode), allows
for testing a (drone’s)
1971
I
SST’s outputs to control the servos (or the flight
1162
Servo 4
flight controller without
controller). In this mode, the SST, and servos (or Power
Supply transmitter or receiver.
ESCs) are powered by the model’s power supply. The servos and the
The power supply may not exceed 7.49 V and the flight controller are
SST should not be connected to its own power powered by the tester
supply. Also, all four input channels must be and controlled by the
potentiometers.
connected, otherwise the SST’s LED and buzzer will
signal a fault.
Servo 1
Display Modes
Servo Tester
The display shows the duration of the pulses graphi- Servo 2
Emitter Receiver
1557
1971
1162
I
2000 µs). The bar graphs are limited to the range Servo 4
1000 µs to 2000 µs, but the numerical value is not. Battery
The display also shows the value of the servos’ supply Servo 1
voltage in either operating mode (Manual or Inputs).
Servo Tester
Indeed, the quality of the model’s power supply is Servo 2
important for the flight controller and for the safety of Flight M Servo 3
the pilot and the people admiring his/her flying skills. controler
Inputs Vcc 4.96 µs
1256
Emitter Receiver
1557
1971
1162
I
The measured supply voltage is boxed when its value is Servo 4
below 4.5 V. The LED will light up too, and the buzzer will Battery
beep, so you don’t have to watch the tester all the time.
Figure 5: Configuration 4, transmitter, receiver, and flight controller test (Inputs Mode), is
for checking the correct operation of the transmitter and receiver with the flight controller
The SST features two display modes, Stack and Square (in case of a drone). The tester, servos and flight controller are powered by the receiver’s
(see Figure 7). The second type is better suited for a battery.
quadcopter. The position of potentiometer P4 at power-up
determines the display mode. When P4 is turned all the Servo 1
way to the left before powering up, the SST will use the
Servo Tester
stacked display. Turning potentiometer P4 to the right Servo 2
before power-up selects the square display when the M Flight Servo 3
device is switched on. controler
Inputs Vcc 4.96 µs
1256
Emitter Receiver
1557
1971
1162
I
Servo 4
Now that we know how to use the tester, let’s have a Figure 6: Configuration 5, transmitter and receiver test (Inputs Mode), allows testing the
look at the circuit. This is shown in Figure 8. It is not too flight controller with the transmitter and receiver. The tester, servos and flight controller
complicated as it mainly consists of connectors. are powered by the receiver’s battery.
Vbat
+2V5
+5V +5V +2V5
Inputs
2 1
R2 4 3
10k
Vbat 6 5
P4A P3A P2A P1A
10k 10k 10k 10k 8 7
20 7 21
10 9
AVCC VCC AREF
R4 1 12 11
RES
10k
23 14 K1
C0 B0
24 15
R5 C1 IC2 B1
25 16
C2 B2
10k
26 17
C3 B3
27 18
C4 B4
28 19
R6 C5 B5
+5V +5V
ATmega328p
10k
SDA 2 13
D0 D7 ISP
R9 R10 SCL 3 12
D1 D6 VCC 2 1 MISO
4 11
10k
10k
D2 D5 MOSI 4 3 SCK
5 6
D3 D4 GND 6 5 RST
GND X1 X2 GND K3
8 9 10 22
1b 1a X1
2b 2a
Vbat
3b 3a
4b 4a C5 16MHz C6
Outputs
K4 * 22p 22p 2 1
+5V
4 3
6 5
8 7
R3
Vbat 10 9
S2 12 11
Vbat +5V
1k
K2
BUZ1 S1
LED1
R8 R1 Measure Control
(inputs) (manual)
22Ω
1k
RED
+5V +2V5
D
T1 K5
LM7805 D1
G
Figure 8: The Super IC1
D3 D2
Servo Tester has its LM385Z-2.5 C4
S 2N7000 C3 C2 C1 1N5817
10k
R7
ATmega328P brain 10µ 100µ
100n 100n
surrounded by many 5V1
16V 35V
connectors.
220069-001
Note that D2 comes in a tall package. To keep the assem- Strictly speaking, S1 does not have to be a DPDT type,
bly low, it may be folded to the PCB. On the other hand, it is but it must be capable of passing the power consumed
also possible to use it as a supporting stud for the display. by up to four servos and even more if there is also an
ESC or flight controller connected to the outputs. Suitable
The power supply voltage measurement must not be DPDT slide switches are often cheaper than single-pole
higher than 7.49 V as the MCU input’s maximum input types, which explains why it is used here.
voltage is 5 V. Therefore, the power supply to the receiver
and servos must never exceed this value. Miscellaneous
GPIO port PD2 of the MCU controls the alarm LED and
Display Issues buzzer. As they are connected in parallel, MOSFET T1
The SSD1306-based I2C OLED display is plugged on provides some extra oomph to drive them both without
connector K4. The display’s I2C port is not connected overloading the MCU. S2 is a second slide switch used to
to the MCU’s I2C port, but to PD0 and PD1. The I2C bus mute the buzzer, as it can be a bit annoying sometimes.
is emulated by the software. This is because on the This switch is a small, low-power type.
ATmega328 the I2C bus is shared with analog input
PC4 which is already used for measuring the supply The 5 VDC power supply for the SST in Manual mode
voltage. Therefore, the built-in I2C peripheral cannot be is obtained from a classic linear 7805 voltage regulator
employed here. (IC1). Make sure to use a TO220-type for this component,
as it must power up to four servos. To keep the assembly
R9 and R10 are pull-ups for the I2C bus. Officially they low, C1 and C2 may be mounted lying down.
should have a value of something like 4.7 kΩ, but 10 kΩ
works too and saves a line on the bill of materials, as Finally, connector K3, a boxed type, is available for
most of the other resistors too have a value of 10 kΩ. programming the microcontroller without removing it
from the circuit. It is wired in the same way as the Arduino
Note that K4 is drawn as an 8-pin connector with two ICSP (in-circuit serial programming) connector.
rows, but on the PCB, you should mount a single-row
4-pin socket in position ‘A’ or ‘B’, not both. The position Some Words on the Software
depends on your display. These displays have the GND For this project, I used the Arduino IDE, which proves
and VCC pins on pins 3 and 4, but not always in the that it can be used for complex projects. I first built a
#include "HW_AVR.h"
//noInterrupts();
Before Power-Up
If potentiometer P1 is at its minimum position (turned left)
when powering up, the screen displays a white frame.
This helps to position the cut-out for the screen and
WEB LINKS
[1] Joop Brokking’s drone website: http://www.brokking.net/ymfc-al_main.html
[2] OLED_I2C library: http://www.rinkydinkelectronics.com/index.php
[3] Project downloads at Elektor Labs: https://www.elektormagazine.com/labs/super-servo-tester
Analog Signals
and Microcontrollers
ADCs, DACs, Current Measurement, and More
Figure 1: AVR128DB voltage reference (Source: Microchip, AVR® DB Family datasheet [PDF] - https://elektor.link/AVR128DBDatasheet).
Six reference voltages of 1.024 V, 2.048 V, 4.096 V, 2.5 V, VDD and back and forth between zero and one if the signal value cannot
VREFA are available. The first three voltages can be represented as be matched exactly with the available resolution of the ADC. Taking
2N and allow the digital values from the ADC to be converted back the average of this least-significant bit will result in a fraction of
to volts very easily later. Something that can be found on almost a one, which means a higher resolution. However, this method
all MCUs is GND (ground) vs. AGND (ground for the analog part of reduces the effective sample rate. For each bit added by oversam-
the MCU). Since there can be high-frequency noise in the digital pling, there is a quartering of the sample rate. If, for example, an
domain that also travels through the ground path, anything that ADC with 12 bits can handle a maximum of 130 ksps (kilosamples
is an ADC or DAC has its own ground. Thus, in the circuit design, per second), four oversampling bits, i.e. 16 bits overall, would result
GND and AGND can be decoupled from each other to avoid inter- in only 507 samples per second:
ference. If it is expected that the measured quantity will not exceed
1 V, then 1.024 V can be selected as the reference. This would result
in a resolution of 1.00098 mV/bit. 452 mV would correspond to
the digital value 452; during further processing, the quantization In addition, depending on the ADC, the processor must perform
error would thus be significantly smaller than in the above example. the averaging necessary for oversampling, which means additional
However, the appropriate choice of reference voltage is not the computational overhead. Some newer ADCs, such as some STM32
only thing that can ensure that the results of the conversions are controller families, perform this task completely autonomously
closer to the physical (analog) value. The quality of the reference without additional load on the CPU.
voltage also has an influence.
ADCs come in a variety of designs. The most common ADCs in
In the AVR128DB, VDD and VREFA can be considered reference controllers are SAR (successive approximation) types. For high
voltages as well. VDD is the supply voltage of the chip, and VREFA resolutions of 24 bits and more at relatively low sample rates (in the
is an external pin on the AVR128DB which allows you to connect range of ksps down to a few samples per second), delta-sigma ADCs
your own external reference voltage source. Using VDD as the refer- are most commonly used. The details of delta-sigma conversion
ence can be an unfortunate choice, because this voltage is loaded and its implementation in a CPLD/FPGA (Complex Programmable
with noise from the digital part of the MCU, and it is difficult to Logic Device / Field-Programmable Gate Array) can be found in an
“filter away” this noise. The situation is different with VREFA: Here, Elektor article [1]. There are other ADC types, of which the Flash
an external high-precision voltage source can be used as the refer- ADC type promises the fastest conversion time, which is why it is
ence. Of course, it is still connected to the “dirty” supply voltage, often used in modern flash memory.
but as an external component, it can be filtered a lot better. A stable
and interference-free reference is the basis of a good analog-to-dig- Digital-to-Analog Converter (DAC)
ital conversion. With a DAC, you generate an analog value again from a digital value.
Not as commonly as ADCs, some MCUs have DACs built in. On the
There is another way to increase the resolution of an ADC without AVR128DB, it is a 10-bit DAC, which can thus output 1024 different
changing the reference voltage, which is called oversampling. voltages. If there is no DAC in the MCU, an external DAC chip like
Oversampling uses the least-significant bit, which is switched the Microchip MCP4922 can be used. Both are resistor string DACs,
SW1
R1
R
RF
(MSB) R4 1k
SW2 VD 1k
R2
R
R3
VC 2k
VCC Digital Logic "1" A
Inputs or
SW3 R2
VOUT Analog
R3 (4-bit) Logic "0" VB 4k output
R
R1
3 5 VA
DAC_OUT 8k
SW4 1 (LSB)
R4 IC1 220047-075
4
SW5
R5
R
R3 R5 R7
470Ω 470Ω 470Ω
SW6
R6 R1 R2 R4 R6 R8
IC1 = Rail-to-Rail Op-Amp VOUT
R
1k
1k
1k
1k
1k
SW7
R7
0V
R
(LSB) (MSB)
VA VB VC VD
SW8 230027-001
4-bit Binary Output 220047-074
the MCP4922 is a 12-bit DAC with two channels. While a resistor values, while in a binary weighted DAC N, there are mostly incon-
string DAC can be well integrated into a chip, it is hardly feasible venient fractional values. The schematic for such a DAC is shown
with discrete resistors. A look at the three-bit resistor string DAC in Figure 4.
in Figure 2 gives an idea why this is so: The DAC requires
However, if I/O pins are a scarce commodity on the MCU used, the
(N = Number of bits) PWM unit can also serve as a DAC with some external circuitry. The
analog.Write() function for the Arduino UNO produces analog
resistors and N switches. For a 16-bit DAC, this would thus be values this way using the digital pins.
65,535 resistors and 65,536 switches!
Figure 5 shows an example from the Elektor article at [3] for an
Just like an ADC, a DAC also requires a reference voltage that speci- Arduino UNO.
fies the range in which the output voltage can move. However,
the DAC itself can only drive a few milliamps, even if the output
is buffered by an operational amplifier.
However, if there is no internal DAC and enough pins on an MCU LM78L05 +7...24V
are still available, there are other ways to build an external DAC. One IC2
IC1
100n 10µ 4
25V
The values of the resistors are given by R1
330
ARDUINO UNO
IC1 = LM358
2 8 6 C2
3 6
R3 0...5V
1 200n 7
IC1A 100k R4 IC1B
2 5
and are thus doubled each time. Such a DAC can be used to generate IC3
100k
C4
analog VGA signals, for example, as shown in the data sheet at [2]. GND 3 7 5
100n
6N136
220136-001
U1 I IH
SCL Uout ADCn C S/H Vcc/2
Arduino Uno SDA
I
AREF
R2 1...100k 14p
GND
RESERVED 13
U2 I IL
IOREF 12
RESET 11
3.3V 10
230027-009
5V 9
POWER
230027-008
GND 8
GND
Figure 7: Unloaded voltage Figure 8: ATmega328P ADC input internal
DIGITAL (PWM)
VIN 7 R1 Out
6 divider. structure (Source: Microchip, Atmel
A0 5
C1
Atmega328P datasheet [PDF] - https://
elektor.link/ATmega328PDatasheet).
ANALOG IN
A1 4
ICSP
A2 3
RESET
MISO
SCK
A3 2
A4 TX 1
A5 RX 0
However, the current (I) must also be considered when choosing GND 8
MCP6001U GND
resistor values. Although 10 Ω for R1 and R2 would mathematically
DIGITAL (PWM)
VIN 7
5
result in the desired voltages for U1 and U2, a current of 500 mA
1
6
4
Vin IC1
would flow through the resistors. This could not only overload the
R1 A0 5
3
ANALOG IN
10k A1 4
MISO
SCK
dissipate in the form of heat, is far too high for most smaller sizes. A5 RX 0
GND
MOSI
5V
R3
10k
MCP6001U
1 5
R6
4
U1 10k
10k Raspberry Pi RP2040 cannot handle this. But, why would you want
to process audio with a 10-bit ADC at all? For example, the AVR
230027-011
and faster MCUs are quite capable of calculating and displaying
the frequency spectrum of an audio signal. For this application, we
Figure 10: DC offset with operational amplifiers. can take advantage of the fact that the DC portion is not of interest;
only the AC portion of the audio signal is needed (C1) and provided
with a DC offset of half the supply voltage for the ADC (R1 / R2) to
lift the audio signal into the positive range. A schematic for this
Raspberry Pi PICO is shown in Figure 11.
1 USB 40
2
GP0 VBUS
39 With such a signal, the (quite narrow) voltage range must be consid-
GP2 VSYS
3
GND LED GND
38 +3V3 ered. With a maximum voltage of less than 1 V, the signal must be
4
GP2 3V3_EN
37
amplified or the internal reference voltage of the ADC must be
R1
chosen appropriately to avoid unnecessarily large quantization
5 36
BOOTSEL
GP3 3V3_OUT
6 35
100k
7
GP4 ADC_VREF
34 errors.
GP5 GP28
8 33
GND GND
9
GP6 MOD1 GP27 32
C1 Audio Current Measurement
An ADC can usually only measure voltages. But, in many cases,
10 31
GP7 GP26
11 30
12
GP8 RUN
29
220n currents also need to be determined. The simplest method for this
GP9 GP22
13
GND GND
28 R2 is to use a shunt resistor. If the current consumption of a circuit
14 27
is to be measured, there are two options: low-side and high-side
100k
GP10 GP21
SWDIO
20 21
GND
GP15 GP16
D5 A4
in Figure 10.
USB
When evaluating the measured values later, it must be remembered 230027-014
that the zero point of the input voltage is now raised by half of the
supply voltage, i.e. 2.5 V in this example. Figure 12: High-side measurement.
0Ω1
GND LED GND
4 27 4 37
GND 5V GP2 3V3_EN
5 26 +3...5V 1W
5 36
BOOTSEL
D2 A7 GP3 3V3_OUT
6 25 6 35 R1 R4
D3 A6 GP4 ADC_VREF
7 24 7 34
D4 A5
10k
10k
RESET GP5 GP28
8 23 8 33
D5 A4 R1 GND GND
9 22 9 32
D6 A3 GP6 MOD1 GP27
10Ω
10 21 10 31
D7 A2 GP7 GP26
11 20 11 30 R2 R5
D8 A1 GP8 RUN LA1
12 19 12 29
D9 A0
2k7
2k7
GP9 GP22
13 18 13 28
D10 AREF LA1 GND GND
14 17 G4 20W
D11 3V3 14 27
GP10 GP21
15 16 15 26
D12 D13 GP11 GP20
16 25
GP12 GP19
17 24
GP13 GP18
18 23
USB GND GND
230027-014 19 22
GP14 GP17
SWCLK
SWDIO
20 21
GND
GP15 GP16
Figure 13: High-side measurement before and after the shunt resistor.
230027-015
The shunt resistor is placed between the positive supply voltage and Figure 14: Modified circuit with voltage dividers.
the load. To determine the current flowing through the resistor and
thus through the load, the voltage drop across the resistor must be
measured. If the (constant and known) voltage supplied to the load In this case, using a high-side current sense amplifier such as the
is less than or equal to the reference voltage of the ADC, the voltage INA138 from Texas Instruments or the MCP6C02 from Microchip is
drop across the shunt can be determined with manageable effort. a much better solution. In addition, the value of the shunt resistor
However, if the supply voltage of the load is variable (but still less can be considerably smaller in this case. The 10 mΩ shunt causes
than the reference voltage of the ADC), the voltages on both sides significantly lower heat dissipation than its ten times larger counter-
of the shunt resistor must be measured, as shown in Figure 13. part. Figure 15 shows the circuit with current sense amplifier.
Admittedly, this example is very idealized because the supply The output voltage is proportional to the voltage drop across the
voltage of the load is less than or equal to the reference voltage of resistor and can thus be easily processed with an ADC channel.
the ADC. If the supply voltage is greater than the reference voltage
of the ADC or even the MCU, things become more difficult.
GP3 3V3_OUT
a faulty lamp by the MCU. 6
GP4 ADC_VREF
35
R1
7 34
GP5 GP28
0Ω1
We could now use voltage dividers to bring the voltage before and
8 33 3
GND GND 6
9 32 1
MOD1 GP27
after the shunt resistor into a range that can be processed by the 10
GP6
31
IC1
4
ADC. Figure 14 shows a circuit that has been modified accordingly.
GP7 GP26 2
11 30
GP8 RUN 5
12 29
GP9 GP22
LA1
The MCU is supplied with 3.3 V and the resistors are selected so
13 28 C1 C2
GND GND
14 27
that, at 12 V, a maximum of 2.6 V is applied to the pins of the ADC. 15
GP10 GP21
26 2µ2 100n G4 20W
GP11 GP20
The value of the shunt resistor is 0.1 Ω. At 2 A, it causes a voltage
6V3
16 25
GP12 GP19
drop of 0.2 V, but still dissipates 0.4 W as heat. The method works 17
GP13 GP18
24
SWDIO
20 21 IC1 = MCP6C02-100
GND
GP15 GP16
The voltage divider reduces the measurement range even further,
so that the MCU’s ADC must be able to handle a maximum voltage
230027-016
drop of less than 0.05 V at 2 A. This is not a good idea. Also, the
fact that the voltage drop is measured via two ADC channels does
not make further processing easier. Figure 15: Circuit with current measurement amplifier.
1 USB 40
GP0 VBUS +6...12V
2 39
GP2 VSYS
3 38
GND LED GND
4 37
GP2 3V3_EN
5 36 LA1
BOOTSEL
GP3 3V3_OUT
6
GP4 ADC_VREF
35 Low-Side Measurement
Instead of placing a shunt resistor directly before the load, it can
7 34 G4 20W
GP5 GP28
8 33
9
GND GND
32 also be connected between the load and ground. Let’s stay with the
MOD1
example of the halogen lamp. Figure 16 shows such a low-side
GP6 GP27
10 31
GP7 GP26
11
GP8 RUN
30
measurement.
12 29
GP9 GP22
13 28
14
GND GND
27 Here, a 0.1 Ω resistor is used, which causes a voltage drop of 0.2 V
GP10 GP21
15
GP11 GP20
26
R1
at 2 A. The advantage now is that the potentials of the voltages
16
GP12 GP19
25
to be measured are below those of the reference voltage of the
0Ω1
ADC and the supply voltage of the MCU. However, at 25 mA, only
17 24
GP13 GP18
18 23
19
GND GND
22 2.5 mV can be measured (0.1 mV per mA). Under ideal conditions,
the 12-bit ADC with a 3.3 V reference voltage would still resolve
GP14 GP17
SWCLK
SWDIO
20 21
GND
GP15 GP16
0.8 mV per bit. However, a look should be taken at the effective
230027-017
number of bits (ENOB) of the ADC, which takes into account the
measurement errors that occur in practice due to quantization
error, distortion, noise, and similar adversities. For the RP2040, an
Figure 16: Low-side measurement. ENOB of about 9 is specified, which means around 6.44 mA per bit.
For this application, the resolution of the current measurement
would be just about sufficient. However, if a finer resolution is
needed, useful may be an op-amp, which would also allow for a
smaller resistance value.
Thermocouples
13 RESET AREF 18
D10
14 17
MOSI/D11 3V3
15
MISO/D12 SCK/D13
16 These elements consisting of two metals act as temperature-de-
+5V
pendent voltage sources. The widely used K-type thermocouple
shall serve as an example. At 21 °C or 69.8 °F, such a component
USB
outputs a voltage of 0.838 mV due to the Seebeck effect; at 22 °C
C1
or 71.6 °F, it is 0.879 mV. The difference of only about 40 µV per
MCP6001U 100n degree puts the ADC of an MCU to a hard test. In addition, using
thermocouples also requires cold junction compensation [4].
R3 5
1
1k
4
IC1
3
TC1
2
However, an operational amplifier can be used to amplify the
voltage of a thermocouple. Figure 17 shows an example of such
a circuit implemented for an Arduino Nano Every, where a tempera-
R2
200k
R1 ture range of 0 °C to 400 °C is expected (0 to 16.396 mV voltage
C2
Thermocouple
from the thermocouple).
Type K
1k
100n
R1 R2 C1
10k
10k
MCP6001U 100n 1 18
RST TX0
1 5 2 17
IO5 RX0
4 3 IC2 16
IC1 IO2 IO4
3 4 15
IO11 BL602 EVB IO3
2 5 14
IO12 IO1
6 13
R3 R4 IO14 IO0
TH1 7 12 +3V3
IO17 GND
850Ω
PT1000 10k
8 11
GND GND
9 10
5V 3V3
RST
L IO8 H
USB
230027-019
PT100 and PT1000 ADC is something everyone should try. The examples shown here
PT100 and PT1000 are temperature-dependent resistors, which are meant to be suggestions for your own attempts to let the micro-
have a resistance of 100 Ω (PT100) or 1000 Ω (PT1000) at 0 °C. In controller interact with the analog world outside its housing.
order to calculate the temperature, the resistance value of the sensor
must first be measured. A good option for precisely determining the Translated to English by J. Starkmuth — 230027-01
resistance value is a Wheatstone bridge. As with thermocouples,
the voltages are quite low with PT100 and PT1000, and the small
difference between two measuring points must be determined. Questions or Comments?
Again, an op-amp wired as a non-inverting differential amplifier Do you have questions or comments about this article? Email Elektor
provides the necessary assistance. The circuit for a board with a at [email protected].
3.3 V supply voltage, such as the Pinecone BL602 Evaluation Board,
is shown in Figure 18.
The voltage difference between the positive and the negative input
of the operational amplifier is amplified. But what if the tempera-
ture goes lower than 0 °C? In this case, the op-amp would have to
output a negative voltage, which is not possible. One option here
would be to replace 10 kΩ resistor R3 with an 850 Ω resistor. The
voltage between R1 and R2 would then be 0.3917 V, which would
Related Products
also apply to the point between R3 and the PT1000 at a tempera-
ture of -38 °C. Thus, the measuring window would start at -38 °C > Arduino Nano (SKU 17002)
with a voltage difference of 0 V. At 20 °C, the voltage difference in www.elektor.com/17002
the circuit would be 0.09444 V.
> Raspberry Pi Pico RP2040 (SKU 19562)
www.elektor.com/19562
Summary
The processing and output of analog values can be done with a > Pinecone BL602 Evaluation Board (SKU 19914)
microcontroller and a manageable effort. Even if the whole thing www.elektor.com/19914
doesn’t seem as simple as controlling a digital I/O pin, handling the
WEB LINKS
[1] Guido Nopper, “A Simple A/D Converter Using a PLD,” Elektor 9-10/2019:
https://elektormagazine.com/magazine/elektor-110/51146
[2] Hardware design with RP2040: https://datasheets.raspberrypi.com/rp2040/hardware-design-with-rp2040.pdf
[3] Giovanni Carrera, “Isolated Analog Output for Arduino Uno,” Elektor 11-12/2022:
https://elektormagazine.com/magazine/elektor-280/61046
[4] Cold junction compensation (Wikipedia): https://en.wikipedia.org/wiki/Thermocouple#Reference_junction
oxid[OS]
been the mainstay of
The C programming language has
des. But, for how much
the automotive industry for deca
spok e to Flavi a Opre a to learn why the up-and-
longer? We
as a way of avoiding the
coming language , Rust , is seen
kes inhe rent to emb edde d C programming.
traditional mista
has been deve loping a
Based in Romania, the startup
real- time oper ating syste m (RTO S) which was
Rust-based
troller at the trade
demonstrated on an STM32 microcon
ve deve lope rs are alrea dy showing interest
fair. Automoti
oved secu rity and
thanks to the promise of impr
of isola ted legac y C/C+ + code .
its support
https://oxidos.io/
Check out the interview:
1398
Siglent https://youtu.be/BNdvgJdN5_Q?t=
Elektor’s DC Dual LISN was put to
use at the Siglent
booth. The 5-µH, 50-Ω Dual DC LISN
supports voltages
up to 60 V and currents up to 10 A.
It measures RF
interference on both channels by way Axelera
of 5-µH blocking
inductances. The internal 10-dB atten The Dutch company Axelera provides modules which can
uation network
(one in each channel) contains a third process AI inference applications as image recognition
-order, high-pass
filter with a cutoff frequency of 9 kHz right on the edge. Boards come in different form factors
to protect the input
of instruments like a spectrum anal as M.2 (picture) or PCIe. Powered by a single Metis AIPU,
yzer from potentially
harmful DC voltages or low frequencie the M.2 module delivers up to 214 tera-operations per
s coming from the
equipment under test. second (TOPs) while minimizing power consumption and
simplifying integration through the downloadable software
Watch the demo at: stack. Price is USD/EUR 149.
https://www.elektormagazine.com/e
w-lisn https://axelera.ai/ai-product-solutions/
https://mikroe .com/planet-debug
re:
t c h t h e f ull video he
Wa be.com/
www.youtu 5lVKZx7Q
Od
watch?v=o
https://north.seco .com/en/products-and-services/
clea-iot-platform
Arm
As we’ve covered in our Elektor Engineering Insights
show, the world of automotive is changing dramatically. Digi
Today, once the software for an ECU is complete , it never The Digi XBee® XR 868 module is a compact and reliable
gets updated — unless a safety-related issue is found. solution that supports the use of long-range connectivity
But this is changing, as Robert Day explained with Arm’s applications in the European region. The pre-certified
new SOAFEE initiative. Drawing upon how orchestrators module operates between 863 and 870 MHz and supports
and containers are used in cloud software and CI/CD both point-to-point and mesh networking protocols with a
development processes, such methodologies are being line-of-sight range of over 14 kilometers. Of course, a dev
adapted for safety-critical automotive software . Currently, kit is also available (picture).
a range of semiconductor vendors, automotive OEMs, and
their suppliers are engaged. https://digi.com/products/embedded-systems/digi-xbee/
rf-modules/sub-1-ghz-rf-modules/digi-xbee-xr-868
230202-01
Elektor
Are you passionate about DIY electronics, embedded
programming, or engineering theory? Join Elektor Lab
team engineers and editors as they share engineering
tips, plan future electronics projects, discuss Elektor
Mag and answer community questions.
www.elektormagazine.com/elektor-lab-talk
Sub-Nyquist
Sampling in Practice
ies Using Subsampling
Reliably Capturing Higher Frequenc
) (Germany)
By Sebastian Westerhold (AI5GW The Problem
s will soon
Anyone dealing with sampling system
The Nyquist-Shannon sampling theorem is an
sed by the extremely important theorem when dealing
become aware of the limitations impo with sampling systems. The very simpli-
According
Nyquist-Shannon sampling theorem. fied version of the theorem states that the
encies higher
to this rule, signals containing frequ
sampling frequency needs to be at least twice
no longer the highest frequency occurring in the signal
than half the sampling frequency can to be sampled. You have certainly heard or
only half
be reliably detected. However, this is read something like this before.
ing higher
the truth. A reliable method for captur
pling, also What happens if you sample a pure sinusoi-
frequency signals is known as subsam dal signal of 120 kHz with a sampling rate of
icle presents
called sub-Nyquist sampling. This art only 100 kS/s (kHz)? This will result in what is
a simple
the method in a practical way, using
called aliasing at 20 kHz. The acquired samples
would therefore look as if a sinusoidal signal
Arduino UNO. with a frequency of 20 kHz (120 kHz - 100 kS/s)
had been sampled. And aliasing errors should
be avoided by all means. Or should they?
Power
it would be impossible to distinguish between
f2
f1
1 2 3 4 5 6
to about 462 kHz) using subsampling and
demodulate FSK signals (NAVTEXT, RTTY,
fs etc.) even with the relatively low-speed
0.5 1 1.5 2 2.5 3 Arduino UNO.
Figure 2: Nyquist zones 1 to 6. zone 1 = “normal range”, zones 2, 4, 6 = inverting ranges, zones Notes
3 and 5 = non-inverting zones. In order for subsampling to work as desired,
the ADC used must have the required analog
bandwidth. This is usually much higher than
The frequency range from 0 Hz (DC) to half Thus, the signal frequency is a few kHz higher the sampling rate. In the datasheet you typically
the sampling frequency (fs) is called Nyquist than the sampling rate itself, but less than 1.5 fs find this figure as “full-power bandwidth.” With
zone 1 (Figure 2). This zone is the “normal” (corresponding to Nyquist zone 3). Accord- the ATmega328P, subsampling seems to work
operating range for a sampling system. ingly, the aliasing to be expected due to subsa- very cleanly up into the MHz range, accord-
Nyquist zone 2 extends from 0.5 fs to fs. These mpling is between 6 kHz (160 kHz - fs) and ing to my experiments. Unfortunately, my own
zones then continue theoretically infinitely at 11 kHz (165 kHz - fs). experiments with the Raspberry Pi Pico did
0.5 fs intervals. The Nyquist zones with even not yield promising results.
numbers have a special characteristic: Within The Arduino code is structured so that the Translated by J. Starkmuth — 220629-01
these zones, an inversion of the frequency Arduino’s A/D converter uses an interrupt
spectrum takes place. service routine (ISR) to sample the signal at
Analog Input 0 until a buffer of 512 discrete Questions or Comments?
Therefore, if the bandwidth of a signal to be samples is filled. The (aliasing) signal Do you have questions or comments
captured is limited to the range of one of these frequency is then calculated from these values about this article? Email the author at
Nyquist zones, subsampling can be used to before the next 512 samples are sampled and [email protected], or contact
capture signals whose frequency components the game starts all over again. Elektor at [email protected].
significantly exceed the sampling rate.
To determine the frequency, the Goert-
A Practical Example zel algorithm was used, a resource-saving
For a project, the frequency of a signal in the special form of the discrete Fourier transform
Related Products
range of about 160 kHz to 165 kHz is to be [1]. The result is then output for demonstra-
reliably acquired with an Arduino UNO [2]. tion purposes via the serial interface, visually > Siglent SDG1032X 2-ch Signal
For technical reasons, the sampling rate formatted for Serial Monitor (Figure 4). Generator (30 MHz) (SKU 20276)
was set to about 154 kS/s using the appro- https://elektor.com/20276
priate registers (prescaler 1:8) (strictly speak- Using the same principle, one could, for
> OWON XSA810 Spectrum Analyzer
ing, it is 153,846 S/s; for the sake of clarity, example, capture a 455 kHz IF from a radio (1 GHz) (SKU 19714)
the rounded number is used in this article). receiver in Nyquist zone 6 (3 fs, equivalent https://elektor.com/19714
WEB LINKS
[1] Sebastian Westerhold (2022):
Goertzel library for Arduino:
https://github.com/AI5GW/Goertzel
[2] Download of the Arduino sketch
https://www.elektormagazine.com/
220629-01
Figure 3: Arduino / signal generator setup. Figure 4: The results are shown in Serial Monitor.
Android
Smartphone
Here, ESP32
There?
Practical Project Using
the Android Wi-Fi API
Yes Yes
Do you assert that
Has user granted Has user granted
Yes your app doesn’t No
NEARBY_WIFI_DEVICES ACCESS_FINE_LOCATION
use the permission
to the calling app? to the calling app?
to get location?
No No
Figure 1: The Android smartphone handles the GUI, while the Figure 2: Additional permissions may be required for wireless
ESP32 is responsible for hardware communication. communication under Android 13 (see image at [4]).
It is assumed the reader has previous experience with the ESP32 in targetSdkVersion. If an app is designed to only run on older OS
development environment. versions, Android Studio will alert you during compilation time with a
message in the format of “Google Play requires that apps target API
On the Android side, you should have two smartphones: one running level 30 or higher,” indicating that the Play Store backend will refuse
Android build ≥ 10, and one running Android 9 or earlier. Android to upload the generated APK. In the not-too-distant future, Google
Studio [3] serves as the development environment. Space is limited intends to phase out “very old” apps from the Play Store.
here, so I will also assume that the reader has some previous experi-
ence of the Android IDE. As a developer, you need to be aware of these limitations and possi-
ble pitfalls.
Configuration
The compilation-configuration of an Android project is quite a compli- Permissions
cated process. Usually, you will find a version of the build.gradle file You can roughly divide the world of Android into the time before and
belonging to the app module so that all of the app’s necessary settings the time after the new permission management system and/or Storage
and dependencies will be set up in Android Studio. This file will typically Access Framework: in the good old days, developers were generally
contain statements such as: free to do whatever they wished, but then Google got serious about
personal data security.
android {
compileSdkVersion 29 In the case of Wi-Fi, the situation is touchy, as location information can
buildToolsVersion "30.0.1" be gleaned from knowledge of the wireless networks in the area (for
defaultConfig { example, Apple’s first iPod touch, with no GPS or cellular capability,
minSdkVersion 26 could determine its location this way).
targetSdkVersion 31
It is now necessary to specify the following declarations in the Android
The minSdkVersion field allows the developer to specify the minimum app’s manifest file to request that certain permissions be granted to
version of the Android operating system for the target or end device the app.
with which the app is compatible. The value 26 refers to Android 8
(Oreo). compileSdkVersion specifies the version of the Software <uses-permission android:name=
Development Kit with which the app will be compiled, and build- "android.permission.ACCESS_FINE_LOCATION" />
ToolsVersion indicates which version of the Android build tools will <uses-permission android:name=
be used to compile the project. The line targetSdkVersion specifies "android.permission.ACCESS_COARSE_LOCATION" />
the version of the Android OS for which an app is being developed. <uses-permission android:name=
"android.permission.ACCESS_WIFI_STATE" />
This distinction, which sounds complicated and confusing at first glance, <uses-permission android:name=
is necessary because the “behavior” of many Android APIs changes "android.permission.CHANGE_WIFI_STATE" />
depending on which OS version it will be running under. <uses-permission android:name=
"android.permission.CHANGE_NETWORK_STATE" />
If targetSdkVersion is set to a certain value, the operating system <uses-permission android:name=
assumes that the developer has considered all the changes introduced "android.permission.ACCESS_NETWORK_STATE" />
in this version in the design of the app — if the value is smaller, the
compatibility mode is activated. If you want to support Android 13 in your application, you must make
an additional change: In the case of WLAN, the Android 13 permission
Unfortunately, Google has strict guidelines for the values specified logic works as shown in Figure 2.
<uses-permission android:name=
"android.permission.NEARBY_WIFI_DEVICES"
android:usesPermissionFlags="neverForLocation" />
<uses-permission android:name=
"android.permission.ACCESS_FINE_LOCATION"
android:maxSdkVersion="32" />
If we are dealing with an older version of Android that is not affected Your reward for all the effort is the message shown in Figure 3 appear-
by API changes, our program can turn on the phone’s Wi-Fi without ing at runtime. The user needs to toggle the button to authorize the
having to seek consent from the user. Unfortunately, this does not activation process.
apply to newer versions of Android — in these versions, user consent
is required. The snippet printed here fires a toast toward the user before sending
the Intent, informing about the need to activate the Wi-Fi.
To distinguish between the two variants at runtime, we rely on the
constant android.os.Build.VERSION.SDK_INT. It refers to the API If the action is not taken, it may be necessary to remind the user of
version supported by the firmware of the current phone. the need to activate the Wi-Fi.
The first step in location information processing is to check if we private void getWifiWorkerOld() {
already have access permission for the Manifest.permission. ...
ACCESS_FINE_LOCATION. Under Android 13, you should also include wifiManager.startScan();
the new permission in the analysis code: }
private void getWifi() { wifiManager is a system class that we obtained as part of Activating
if (ContextCompat. the Activity. The startScan() method then takes care of starting the
checkSelfPermission(MainActivity.this, scan process.
Manifest.permission.ACCESS_FINE_LOCATION) !=
PackageManager.PERMISSION_GRANTED) { The return of information captured by the scan run is done by Broad-
ActivityCompat. cast. For its reception, we need a Broadcast Receiver. Since we don’t
requestPermissions(MainActivity.this, want to create it in the manifest file, we write it in the Activity’s onPost-
new String[]{Manifest.permission. Resume() method instead:
ACCESS_FINE_LOCATION},
MY_PERMISSIONS_ACCESS_COARSE_LOCATION);
}
Remember that, for Android 6.0 and above, “sensitive” permissions are
only enabled by the operating system when the user explicitly agrees
to them. Dialogs are used for this purpose, as shown in Figure 4.
else {
if (android.os.Build.VERSION.SDK_INT <
Build.VERSION_CODES.Q) {
getWifiWorkerOld();
} Figure 4: Be aware of the new Permissions system.
connectivityManager.
requestNetwork(request, networkCallback);
Android GUI identify wireless network peers relevant to the use case. }
}
The next step is to build a NetworkRequest element, which is done }
as follows:
Is It Worth All the Effort?
final NetworkRequest request = There are often many ways to solve a problem in engineering. It’s true
new NetworkRequest.Builder() that real-time operating systems — I’m thinking here of the Azure RTOS
.addTransportType(NetworkCapabilities. — along with their embedded GUI stacks, running on a microcontrol-
TRANSPORT_WIFI) ler, will indeed realize powerful graphic interfaces in a single-device
.removeCapability(NetworkCapabilities. solution that will cover most advanced use cases.
NET_CAPABILITY_INTERNET)
.setNetworkSpecifier(specifier) To achieve the same functionality provided by the Android configura-
.build(); tion described here would incur higher hardware costs — there will be
no touchscreen for the GUI as the associated logic, such as a frame
The actual connection setup takes place as shown in Figure 5. The buffer memory, would add to the bill of materials. On top of this, we
user needs to enter the name of the Wi-Fi network that will be the need to think about the time and effort required to develop the system:
configuration target. If you wanted to implement, for example, the transfer of images and
sensor readings by email in a real-time operating system, you need
A side effect of this procedure is that the Wi-Fi connection must to set aside a few days for coding and be aware that the additional
be established asynchronously. Feedback on success and failure is loading may impact system latency. The Arduino combination offers
provided via a callback that must be created in the application respon- a slick GUI on a device that most of us already carry around in our
sible for activation: pocket. The idea of pulling out your phone and hooking up to a local
access point, for whatever reason, is pretty cool.
final ConnectivityManager connectivityManager =
(ConnectivityManager)getApplicationContext(). If you decide to develop this project, I hope that some of the exper-
getSystemService(Context.CONNECTIVITY_SERVICE); iments and tweaks described here will offer some pointers through
final ConnectivityManager.NetworkCallback the jungle. If you’re successful or find improvements, we would love
networkCallback = to hear how you got on; send us a reader’s letter.
new ConnectivityManager.NetworkCallback() {
@Override Translated to English by M. Cooke — 210229-01
public void onAvailable(@NonNull Network network) {
Related Products
> ESP32-PICO-Kit V4 (with female Headers) (SKU 20323) WEB LINKS
https://elektor.com/20323
[1] This article’s web page:
> ESP32-DevKitC-32D (SKU 18701) https://elektormagazine.com/210229-01
https://elektor.com/18701 [2] ESP-IDF: https://idf.espressif.com/
[3] Android Studio: https://developer.android.com/studio
[4] Android Documentation: Request permission to access
nearby Wi-Fi devices:
https://elektor.link/AndroidWiFiPermission
[5] Zen of Palm (2003) [PDF]:
https://cs.uml.edu/~fredm/courses/91.308-fall05/palm/
zenofpalm.pdf
Join the
Elektor C mmunity
The Elektor web archive from 1974! Take out a Ge mOb eLD
m rship
8x Elektor Magazine (print)
8x Elektor Magazine (digital) membership!
10% discount in our web shop and
exclusive offers
Access to more than 5000 Gerber files
www.elektormagazine.com/Member
Active 1-kHz
Filter for Distortion
Measurement
Better Measurements Through Optimization
of the Measurement Signal
By Alfred Rosenkränzer (Germany) With affordable signal generators below the professional class, however,
the quality of the generated signal often leaves much to be desired. A
The detection of low-level signal downstream filter can work a small miracle here and provide a partic-
distortions places great demands not ularly “pure” measurement signal by attenuating the distortions of the
signal generator.
only on the dynamic range and linearity
of the measuring device, but also on Requirements
the measuring signal supplied to the Since most audio measurements are made at the typical measurement
frequency of 1 kHz, a filter with a fixed passband or cutoff frequency at
component that is being tested. With this value is usually sufficient. The filter should allow the test frequency
a downstream filter, however, even to pass unattenuated, but attenuate the harmonics (the multiples of
average signal generators can deliver the test frequency) as much as possible. Another important require-
ment is that the filter itself must not produce any significant distor-
high-quality measurement signals. tion, of course!
For easy handling, it is useful if the filter itself is not too narrow-band,
In the article “A Fliege Notch Filter for Audio Measurements” in Elektor but has some bandwidth. That way, the frequency of the measurement
September/October 2022 [1], it was shown how to extend the measure- signal can be easily matched to the exact frequency of the narrow-
ment range for distortion measurements with a digitizer by using a band notch filter without level fluctuations, so that the filter removes
notch filter. In doing so, the test signal is suppressed, thus preventing the measurement signal before the measurement. Figure 1 shows the
the digitizer itself from generating distortions. A prerequisite for the principle of this measurement with both filters before and after the DUT.
valid detection of low distortion levels of the device under test (DUT)
is, of course, that the signal generator feeding the DUT produces a Filter
high-quality signal. Otherwise, in addition to the distortion of the circuit In principle, the reduction of signal generator distortion in the form
under test, the distortion of the generator is also measured and impure of harmonic attenuation can be achieved not only with a band-pass
measurement results are obtained. filter, but also with a suitable low-pass filter. The question is which
Figure 1: The optimized measurement principle for distortion with one filter before and one after the DUT. The upstream low-pass or band-pass filter (red)
removes distortion from the generator signal.
C1 C5 C9 C13
C2 C6 C10 C14
18n 22n 47n 100n
R2 R4 R8 R10 R14 R16 R20 R22
3 5 3 5
11k 6k19 8k25 3k83 8k25 4k64 10k R26
1 7 1 7
R3 R5 IC1a R9 R11 IC1b R15 R17 IC2a R21 R23 IC2b 220Ω
K1 1 2 6 2 6
5k11 129k 28k7
1 K9
IN R7 R13 R19 R25
3k48 3k48 3k48 3k48
OUT
R1 C3 C4 R6 C7 C8 R12 C11 C12 R18 C15 C16 R24
2
47k
2
15n 15n 12n 3n3
+12V
LED1
K2 K3 K4 K5 4 4
1 1 1 1 20V 20V
2 2 2 2
IC1, IC2 = NE5532A
3 3 3 3
R28
10k
220410-012 –12V
parallel in each case (no value shown in Figure 3), which allows the component. Now, if you enter a value of 103 nF into the software, you
calculated value to be hit as accurately as possible with the commer- will get the adjusted values for the other components of this stage at
cially available E series. It is particularly advisable to select the capac- a given frequency — and resistors can be obtained easily and cheaply
itors for accuracy before assembly to avoid subsequent replacement even with a tolerance of 1%.
of components. The board also provides space for additional resistors
(R6, R12, R18, and R24), which can be used for filter amplification, but The same procedure was followed for the band-pass filter (circuit:
these are not needed here, and are therefore omitted. Figure 6, layout: Figure 7, prototype: Figure 8). For the frequency-de-
termining components, additional components for a possible parallel
In general, it is recommended to read the article on the Fliege connection were again provided for, and an optional amplification was
band-pass [1] and, if necessary, also the article on filter software [2], realized with R8, R9, R18 and R19. Since the values of the frequency-de-
because they explain in detail the procedure for the exact adjustment termining capacitors are the same here, one should use components
of the filter frequencies and the component calculation software used from the same batch if possible, and compensate for the differences
for this purpose. An optimization example: The measured value of — which will likely be very small — using parallel capacitors. Here,
100 nF capacitor C14 is 103 nF, which is within the 5% tolerance of the entering the resulting value in the software is also recommended.
R26 R25
R10
220Ω
R5 R15
1k78 1k2
R6 R16
46k4 82k
C9
R23 R1 R11 100n
C3 3 C7 5
46k4 3k6 R24 0Ω R20
1 7 C10
R2 IC1a 46k4 R12 IC1b 220Ω
C4 2 C8 6
K8 1
100n 100n 1 K9
R7 R17
IN 1k 1k
R3 R4 R8 R9 R13 R14 R18 R19 OUT
C1 C2 C5 C6
511Ω
511Ω
1k78
23k7
13k9
1k62
19k6
10k
2
2
100n 100n
+12V
LED1
K2 K3 K4 K5
1 1 1 1 20V
8
2 2 2 2
IC1 = OPA2209AIDR IC1
3 3 3 3
4 R22
10k
C14 C12
In order to reach the required resistance values at the input of each and low inherent distortion. The author still has a few empty boards
stage as accurately as possible, a combination of one resistor in series left. If needed, you can contact him by e-mail (see “About the Author”).
to a parallel circuit of two resistors was provided for in each case.
Resistors R10, R25, and R26 are used to measure the characteristics The two filters presented here are not limited to 1 kHz, of course. One
of the individual stages as described in [1] and are therefore omitted. can easily make a whole set of suitable low-pass/band-pass and notch
For fine-tuning, simulating the circuit with the actual, measured values filters for different frequencies, applying the design considerations in
is recommended. [1], and use them to investigate the distortion behavior of audio circuits
at different frequencies.
Which Filter? Translated to English by J. Starkmuth — 220410-01
Now that you have the choice of using either a low-pass or a band-pass,
the question naturally arises: Which filter type is better suited for your
purposes? About the Author
Alfred Rosenkränzer worked for many years as a development
The low-pass needs a higher order for useful attenuation, and there- engineer, initially in the field of professional television technol-
fore requires four op-amps. This increases the inherent noise and, ogy. Since the end of the 1990s, he has been developing digital
of course, the distortion produced by the filter. On the other hand, it high-speed and analog circuits for IC testers. Audio is his private
achieves a better attenuation of higher-order harmonics from about hobbyhorse.
3 kHz than the band-pass does. The fact that it passes all frequencies
below the cutoff frequency can be favorable for other applications.
Questions or Comments?
The 4th-order band-pass, on the other hand, gets by with only two Do you have questions or comments about this article? Email the
op-amps and should therefore produce less inherent noise and distor- author at [email protected], or contact Elektor at
tion of its own. Since it only passes frequencies close to 1 kHz with a [email protected].
bandwidth of 100 Hz, it is hardly suitable for other applications. But,
since it attenuates all frequencies below 1 kHz and thus also undesired
phenomena such as mains hum, low-frequency inherent noise is also
reduced, which can benefit SNR measurements.
Related Products
Starting Out in
Electronics...
....Multivibrating Cheerfully Further!
First a brief preliminary remark, primar- As suggested by its name, this circuit In the circuit shown in Figure 2, the
ily aimed at new Elektor readers who are has two states, each with one of the two left-hand transistor is usually conducting.
experiencing their first episode of the series, transistors conducting (but not both). The Just like the flip-flop (Figure 1), we can cause
“Starting Out in Electronics.” This series pushbuttons can be used to switch between this transistor to switch off by briefly pulling
does not in any way claim to be a thorough the two states. It’s impossible to predict its base to ground by pressing the pushbut-
theoretical course in electronics. Our only which of the two transistors will start ton. This also causes the electrolytic capac-
aim is to give novice electronics enthusiasts conducting immediately after the power itor to discharge.
enough basic knowledge so that they can is switched on — the only thing you can
design and build circuits with a reasonable say for sure is that one of them will be on Then the right-hand transistor starts
chance of success, or modify an existing and the other will be off. conducting, but only temporarily, because
circuit with a workable result. In this, we
do our best to avoid serious calculations,
and sometimes we take shortcuts with the
details and niceties of the theory. We are
well aware that with this approach, we will
occasionally provoke strong criticism from
the perfectionists and theoreticians among
our readers. We apologize for that, but not
too much...
12
11
10
TECHNOLOGY
Adrastea-I is a Cellular Module with High Performance, Ultra-Low
Power Consumption, Multi-Band LTE-M and NB-IoT Module.
Despite its compact size, the module has integrated GNSS, integrated ARM Cortex
M4 and 1MB Flash reserved for user application development. The module is based
on the high-performance Sony Altair ALT1250 chipset. The Adrastea-I module,
certified by Deutsche Telekom, enables rapid integration into end products without
additional industry-specific certification (GCF) or operator approval. Provided that a
Deutsche Telekom IoT connectivity (SIM card) is used. For all other operators the
module offers the industry-specific certification (GCF) already.
www.we-online.com/gocellular
© eiSmart
Err-lectronics
Corrections, Updates and Readers’ Letters
Compiled by Jens Nickel (Elektor)
Grow It Yourself
Elektor Arduino Edition 2022,
p. 54 (220414)
I did read your article in Elektor with interest. I have planted seeds in
the past, but was not very successful because I failed to administer the
loving care that seeds need. I ended up donating my desktop green
houses to my girlfriend, who is more into plants and caring for them.
Anyway, I liked your article very much and want to build something
similar for my girl.
You mention that plants prefer 450 nm and 650 nm light. RGB LEDs
produce 460, 525, and 625 nm wavelengths (quick Google search). These
Low-Cost Audio Tester values do not quite follow the plants’ preferences. Are they close enough?
Elektor 7-8/2022, p. 6 (200604)
The REW software (roomeqwizard.com) is Elektor Magazine already published an article in 2019 together with
very widely used in the DIY community. Würth Elektronik about an LED-illuminated greenhouse (elektormaga-
REW is basically freeware, although you can zine.com/magazine/elektor-110/51138). Your article inspired me to pursue
(or should) make a donation to the author. this subject. I have had an ultrasonic mist generator lying around here
This software should be able to do every- for many years, so it may finally become useful.
thing mentioned in the article. For those
with significantly higher demands, there Michael Hompus
is also a Pro version, but it costs USD100.
There is a long thread on REW at diyaudio. Thanks for your question! Some time ago, after I published the GIY
com, which also deals with various inter- project online, I started researching this topic of LED lights for plant
faces and how to mod them. growth, and you are welcome to read my summary on that here:
instructables.com/DIY-Grow-LED-Light-Designing-a-Better-Sun
Frank von Zeppelin
To answer your question, and to help you practically apply the latest
know-how in the industry: use white color LEDs plus red or far-red
spectrum LEDs. The idea is to recreate a full spectrum similar to the
sun, and then boost its efficiency by adding some extra red / far-red
/ UV LEDs.
Check out cityfarm.md to see the final version of the GIY project.
Project 2.0
Elektor 1-2/2023, p. 110 (220601)
Unfortunately, an error crept into my
proposal, published as a reader letter in
the January 2023 edition.
Figure 1b: With the stated resistor values, the overall amplification When the transistor
(gain) should actually be 4.3 cubed (79.5), shouldn’t it? (And besides, switches off, reverse
3.3 cubed is about 36, which is a long way from 100.) And, is it even voltage V2 of the Zener
possible to talk about open loop gain in this situation? I think “overall diode adds to forward
gain of the amplifier path” would be a better term. voltage V1 of the recti-
fier diode. This causes
Harald Sonnemann the current through
the relay to drop much
faster. This can not
You are entirely right that no viable audio amplifier can manage only be measured, but
without any negative feedback because the amplifying components is also clearly heard.
are not sufficiently linear. Tube fans often use the term “no negative
feedback” as a loose synonym for “no overall negative feedback.” In this regard, it’s
important to remember that the voltage
What I did was to contrast overall negative feedback specifically with between the collector and emitter of the
the principle of local negative feedback per amplification stage; see transistor is the sum of the supply voltage,
Figure 1 in the article. the reverse voltage of the Zener diode, and
the forward voltage of the rectifier diode.
In the heat of the moment, however, I did indeed get the calculations With a 12 V supply voltage and a 10 V Zener
wrong. As you say, 4.3 cubed is 79, not 100, and 3.3 cubed is certainly diode, at switch-off time the transistor sees
not 100. I did not spot this error when proofreading the text, nor did a voltage of around 22.6 V, which must be
the author when the article was accepted. A revised circuit diagram considered when selecting the transistor
is shown here. and the Zener diode.
And of course, “open loop gain” in Figure 1b actually means a quasi Thomas Klingbeil
open loop gain.
The New
I3C Protocol
A Worthy Successor to I2C, or Just More Hot Air?
Hardly any bus protocol is as widely used as the I²C bus protocol
launched in the 1980s by Philips Semiconductor. However, the
weaknesses of this bus system have become apparent in the course
of recent years. A successor is waiting in the wings in the form of
the I3C protocol, and in this article we want to present it in detail.
The results, which are in line with the author’s of the reasons why Philips started collecting are therefore always necessary. First, though,
experience, show that Philips’ aim in collect- licence fees in the first place. With the expira- let’s look at who or what is behind the I3C
ing the licence fee was always to encourage tion of the Philips patents, however, it’s now standard.
licence holders to fully implement the I2C open season.
standard. This explicitly included the glitch I3C and the MIPI Alliance
filter, which in the past was a frequent bone Unfortunately, the interoperability of I2C A standardisation committee called the MIPI
of contention between Philips Semiconduc- devices in an I3C bus system can only be Alliance [2], which offers a variety of standards
tor and third-party manufacturers. This filter regarded as either best practice or wishful for general electronics, is responsible for the
(more about this later) may have been one thinking. Practical tests of such mixed systems I3C standard. The membership fees for this
The third annoyance is the relatively low SDA pin also changes to open-drain mode in This simplification is also accompanied by a
speed: Philips states a data rate of 3 Mbps some conditions. To avoid various problems simplification of the I/O pins on the microcon-
with an operating frequency of 3.4 MHz. in the placement of pull-up resistors, the troller or clock generating device. I2C requires
A consequence of this is that the leisurely standard specifies that they must always be dedicated GPIO pins due to the previously
behaviour of the transceiver leads to high located in the clock-generating device. mentioned 50 ns glitch filter, but the MIPI
power consumption, since the longer the specification only requires normal GPIO pins
data exchange between two devices takes, Another important thing (leaving aside special with the ability to drive 4 mA of current. The
the later they can enter a low-power standby cases) is that SCL is always and exclusively specification also explicitly states that glitch
mode. The diagram from MIPI (Figure 2) is, in controlled by the clock-generating compo- filters, which in the case of I2C are often
the author’s opinion, quite plausible. nent. If multiple potential clock generating problematic, are not required.
devices are present on a bus, the clock gener-
Last but not least, I2C devices have the fatal ating device currently in the active state is The Rewards of Speed
capability to disable other devices on the bus responsible for switching the SCL pin. Now let’s look at the waveforms of I3C. The
‘forever’. A corresponding circuit detail such previously mentioned glitch filter is only signif-
as that shown in Figure 3 can be found in Clock stretching by the slave device, which icant with I3C if the SCL signal on an I3C
quite a few I2C systems. is possible on a conventional I2C bus, is not bus does not have a duty cycle of 50%, as it
supported by the I3C specification. Operation usually does with I2C. With I3C the high period
Hello to I3C Improvements of such components is therefore not possi- is defined as shorter than 45 ns (Figure 4),
The first change in I3C is that both SCL and ble on a mixed bus. Then again, the author is which logically means that an I2C device imple-
SDA work in push-pull mode in most cases. aware of only very few use cases where clock mented according to the standard will not be
The SCL pin is always push-pull, while the stretching occurs in practice. able to do anything with the SCL waveform.
WEB LINKS
[1] Discussions about I2C: http://www.verycomputer.com/31_b0b5a85949fcce82_1.htm
[2] MIPI I3C web page: https://www.mipi.org/specifications/i3c-sensor-specification
[3] MIPI membership is expensive: https://www.mipi.org/join-mipi
[4] I3C Basic Specification: https://resources.mipi.org/blog/mipi-alliance-delivers-new-i3c-basic-specification
[5] List of MIPI members: https://www.mipi.org/devcon//membership/all-member-directory
[6] NXP soft core IP: https://bit.ly/3qWAvD3
[7] API in the Linux kernel: https://www.kernel.org/doc/html/latest/driver-api/i3c/protocol.html
[8] MIPI I3C white paper: http://bit.ly/2gId6BL
[9] Texas Instruments HDC2010 data sheet: http://www.ti.com/lit/gpn/hdc2010
[10] Diodes Inc PI3CSW12 data sheet: http://www.diodes.com/assets/Datasheets/PI3CSW12.pdf
BlueRC:
IR Remote Control with
Smartphone and ESP32
Adaptive and Universal
pin D14 as an output to drive my IR transmitter, while At first, I tried the standard IR library for Arduino. It worked
the shield’s IR receiver uses port pin D27 as an input fine, but is not fully supported on the ESP32, as the ESP32
by default. makes use of a proprietary on-board hardware Remote
Control Transceiver (RMT) with a lot of protocol and
You can see how I hooked it up in the basic schematic modulation logic built-in for IR signals. After much trial
in Figure 5. and error, I finally found a fully working IR library for
the ESP32, IRremoteESP8266, by Ken Shirriff et al [1].
The Software Thank you, Ken.
My software is relatively simple: The ESP32 acts as
Bluetooth server, and an Android app as client. The ESP32 Originally, I wanted to store the IR codes in EEPROM, but
simply awaits Bluetooth messages from the Android app. when I wrote my firmware, I realized that the ESP32 has no
There is minimal Bluetooth communication between the EEPROM at all. However, it does have the ability to save
two devices, as remote control key presses — as well data permanently in flash via the Preferences.h library [5].
as the command to begin the learning sequence (“^”)
— from the Android app are sent to the ESP32 as single Because my original remote control had RC5 coding,
characters. I only implemented the RC5 encoding scheme.
1. On your Android device, download BlueRC-app-V1.1.apk For ESP32 troubleshooting, your best bet is to turn it off
from the GitHub page at [3]. You will need to set your and back on again!
phone to allow downloading apps from external sources
(other than Google Play Store). You can see a video of it in action [4] on my YouTube
2. Power up the WeMos board running our BlueRC .ino channel.
firmware. 220103-01
3. Launch the Android app. If Bluetooth is not active, the
app will request permission; tap on Accept.
4. Tap on the “kebab menu” on the top-right, and then
on Connect BT Device. If this is your first time pairing !
with the ESP32, tap Scan for devices and wait for t h is p r o je ct on video z4
Watch dF84O
ESP32BlueRC-Shield to appear under Other Available
t t p s :/ / y o u tu.be/Kb-T
Devices. Tap on this, then confirm the pairing. h
5. In the Status bar at the top, you should now see
connected:ESP32BlueRC-Shield.
WEB LINKS
[1] IRremoteESP8266 library: https://www.arduino.cc/reference/en/libraries/irremoteesp8266/
[2] BlueRC Arduino sketch for ESP32: https://elektor.link/BlueRCESP32
[3] BlueRC Android app: https://elektor.link/BlueRCApp
[4] The BlueRC system in action: https://youtu.be/Kb-TdF84Oz4
[5] ESP32 Save Data Permanently using Preferences Library:
https://randomnerdtutorials.com/esp32-save-data-permanently-preferences/
Microcontroller
Documentation Explained
(Part 2)
Registers and Block Diagrams
Figure 1: Bit descriptions of registers can seem a little cryptic. (Source: Microchip Technology)
Figure 2: Block diagram for clock peripheral, highlighting clock selection multiplexer and controls that turn the clock source off.
(Source: Microchip Technology)
In C/C++, this can be done as follows: processor and the on-chip peripherals. It makes sense to take time to
review its structure, as found on page 110. Normally, this peripheral
myValue &= 0b00011111; // clear 3 most-significant bits is configured once at the start of the application’s code and is never
// = (unimplemented bits) changed. If it is changed, every peripheral may be impacted, from
STATUS = myValue; // write 'myValue' into the sampling rate of the ADC to the baud rate of the serial UART
// STATUS register and CAN interfaces.
Note: it makes sense to provide a comment to explain why this is In this example, we have some external sources (quartz or ceramic
being done to ensure that no-one tries to “optimize” your caution resonator oscillators) and some internal sources. The internal
away at a later date! sources may not be accurate enough (especially with tempera-
ture changes) to act as a reliable source for some interfaces, such
The bar over a bit name indicates that its value is inverted. This as the UART. The datasheet will probably mention this. Otherwise,
is the case for the “Time Out” bit, TO. Upon the occurence of a you need to check the accuracy in the section covering Electrical
time out, which you might expect to be flagged with a positive Characteristics.
response of “1,” the response you are looking for is actually going
to be “0.” Often such negated bits make little sense to the program- In the diagram, marked in orange, we can see that a group of three
mer; you just have to live with them and treat them appropriately bits, COSC<2:0>, in a register most likely related to the oscillator,
in your code. can be used to select between the available clock sources using a
multiplexer. For reasons unknown, only the group of bits is named
Sometimes, a group of bits is required to configure something, such in such diagrams and not the register they belong to. The best way
as the prescaler for a clock source, or the baud rate for a serial inter- to find out which register the group belongs to is to search the
face. Such groups of bits are then named BIT_GROUP<X:Y>, where datasheet PDF — they may be in a register of an unrelated periph-
X names the most significant bit, and Y the least significant bit in eral! Multiplexer diagrams are used frequently in block diagrams
the group. Also, beware: Sometimes one or more bits belonging to where signals can be switched.
the same group may be split across different regions in the same
register, or even across more than one register! The output of this block provides the System Clock, probably to
the processor, and the Peripheral Clock for the peripherals. The
Time to Deal with the Clock datasheet may reference both these terms in the remainder of
The most important part of the microcontroller is its clock periph- the document, especially when discussing any Low Power or Sleep
eral. This decides what will be used as the clock source for the modes. From the sections marked in green, we can already infer that
there is an Idle mode that removes the clock from the peripherals
only, and a Sleep mode that removes the clock from the peripher-
als and the processor.
WEB LINKS
[1] Stuart Cording, “Microcontroller Documentation Explained (Part 1),” elektormagazine.com:
https://elektormagazine.com/articles/microcontroller-documentation-part-1
[2] 8-bit PIC16F18877 microcontroller: https://microchip.com/wwwproducts/en/PIC16F18877
[3] Tam Hanna, “Programming PICs from the Ground Up,” elektormagazine.com:
https://elektormagazine.com/articles/programming-pics-from-the-ground-up
e-zine
Your dose of electronics
Automating Test
and Measurement
Programming Test Equipment to Do What You Want
For most developers, test and measurement (ISO 7637-2). Another common failure mode
equipment sits on the workbench, waiting to related to supply conditions is a voltage that
perform a task. But turn most of those devices slowly rises or falls. Under such conditions,
Figure 1: Two of the EL-R Series bench DC power
around, and you’ll often find a communica- circuits often fall into a brown-out condi-
supplies offer a serial interface (RS-232/virtual
tion interface on the rear. Coupled with the tion from which they cannot recover. Finally, COM using USB) to support test automation.
appropriate software, you’ll gain the power for automated test systems, it helps to have (Source: Aim-TTi)
to control measurements and gather results equipment that can be correctly configured for
for later analysis. This can be exceptionally both voltage and maximum current, especially
helpful when searching for sporadic events when the same setup is used for several differ-
and failures or testing an application over ent products. These bench supplies use low-noise linear
various system parameters. It is also how regulation to provide single, dual, and triple
end-of-line testing and component binning Laboratory power supplies have dropped outputs. They are fanless, relying on convec-
can be automated. significantly in price in recent years. To tion cooling, and range in power from 30 to
compensate for the influx of cheap equip- 130 W. With one or two red LED displays and
Remote Control of Lab Power ment, better-known brands typically expand analog controls, some models also include
Supplies their range of features to compensate, unwill- remote sense terminals. Two models of inter-
A good starting point is the power supply. ing or unable to compete on price alone. It est are the single output EL302P, with RS-232,
If nothing else, most applications require is unknown whether this is the case at Aim and EL302P-USB, featuring USB, both 60 W
power cycling to perform a hard reset. More and Thurlby Thandar Instruments (Aim-TTi) units with 0...30 V and 0...2 A outputs.
advanced testing will see the target applica- in Cambridge, UK, but they do deliver on their
tion operated at the extremes of the allow- promise of “measurably better value.” They The units come with software drivers for
able input supply specification, and it may be offer an extensive range of DC power supplies, the interface. In addition, the utility “PSU
necessary to perform overvoltage tests. This but their entry-level EL-R series (Figure 1) is Sequencer” is provided on the supplier’s
is common in automotive, where pulses of up worth a closer look, especially when toying website [1], allowing user-configured volt/
to 87 V must be withstood for up to 400 ms with the idea of a first automated test setup. current settings to be stepped through
manually or automatically (Figure 2). Addition- must occur, in a specific sequence, to trigger etary software or access to a web server for
ally, pre-prepared sequences can be imported them. Once your team has determined how to configuration. However, a USB class specifi-
from a spreadsheet. trigger the failure, the next stage is configuring cation for test and measurement is available,
the oscilloscope to capture relevant signals known as USBTMC [6]. Much like storage
Python for Power Control that will help determine the ultimate cause. devices, such as USB drives, and human-in-
Developing your own control software, tuned terface devices (HUD), like your mouse and
to your testing needs, is also simple. The Boards such as Arduino and Raspberry Pi keyboard, this class provides predefined
hardware RS-232 interface operates from 600 are great for the rapid development of a test commands suited to interfacing with test and
to 9,600 baud, and the USB interface appears harness that can repeatedly trigger the failure, measurement equipment.
as a virtual COM port. The commands are all using analog outputs and digital signals,
listed in the instruction manual [2], and with a sometimes complemented by a relay or Units such as the B&K Precision 2567B [7], a
bit of planning, it is straightforward enough to MOSFET when needed. They can also provide 200-MHz, 2-GSa/s mixed signal oscilloscope
develop a library that turns all the commands accurately timed trigger signals for an oscillo- (MSO), support this interface. With four analog
into clearly named functions or methods. One scope to ensure the correct portion of relevant channels, a 16-channel digital port, an in-built
option is to use an Arduino and an RS-232 signals is saved for analysis. 50 MHz arbitrary waveform generator, and
transceiver to control the power supply. This advanced triggers, it is simple to configure
has the advantage that other test functions Many oscilloscopes offer USB and LAN inter- using its large 10.1” capacitive touchscreen
can also be integrated, such as signal switch- faces, but some only offer support for propri- (Figure 3). But it’s just as easy via USB.
ing using relays or capturing analog and digital
signals.
Remote Configuration and measurement equipment. The control needed its own display. Thanks to a power-
Again, Python is the preferred programming commands are ASCII strings with various ful FPGA and Ethernet interface, your PC or
language thanks to the USBTMC project [8] by options, as described in the oscilloscope’s laptop forms the user interface. Liquid Instru-
Alex Forencich, which is hosted on GitHub [9]. programming manual [12]. If available, VISA ments has taken the same approach with
The module works on Linux but may require resource strings [13] can also be used. their Moku:Lab [14], an all-singing, all-danc-
the permissions to be appropriately modified. ing laboratory about the size and shape of a
On Windows, both PyUSB [10] and libusb [11] The VID and PID are unique to the product, dinner plate. It offers a range of analog inputs
will need to be installed first. not the individual unit. Thus, if two or more and outputs and is designed to be a lab in
of the same device are attached, they can be a box.
The first steps are relatively straightforward. independently addressed using a third param-
Before starting, the vendor (VID) and product eter, their serial number. This is usually on Recessed into the front are four BNC connec-
ID (PID), two USB-specific reference values a label or can be obtained using the *IDN? tors (Figure 5). The right pair provides the
that identify a USB product, are required. command (Example 2). analog outputs, supporting a sampling rate of
Using Linux, this is easily acquired from the 1 GSa/s per channel at a 16-bit resolution and
command line using lsusb once the device is There isn’t much to differentiate oscilloscopes a bandwidth (-3 dB) of >300 MHz. The left pair
attached. The resultant list provides the neces- these days beyond bandwidth, sampling rate, are the analog inputs, with a bandwidth (-3
sary details. On Windows, these values can be and memory depth. But occasionally, a little dB) of 200 MHz into 50 Ω and a sampling rate
determined via the Device Manager and the feature crops up that is of interest. The B&K of 500 MSa/s per channel at 12-bit resolution.
device’s properties. In both cases, the values Series features a runt trigger (Figure 4), a The internal timebase provides an accuracy
provided are 16-bit hexadecimal. capability that triggers when a signal passes better than 500 ppb. A trigger input is also
one threshold (e.g., high level) but not the provided, along with connectors that enable
All that remains is to import the usbtmc other (e.g., low level). When it comes to failure the synchronization of multiple units. Wired
module in your Python code and use the avail- analysis, every little helps. connectivity is provided via an Ethernet port
able programming interface (API). It is much and USB interface, and a second USB power
like printing text to the screen and evaluat- Headless Test Equipment port is available to charge a tablet. Finally,
ing keyboard input. USBTMC is really just a Red Pitaya broke the mold when it came to there is an SD Card slot and the DC power
wrapper to communicate with capable test test equipment, questioning whether a tool input.
WEB LINKS
[1] PSU Sequencer, Aim-TTi: http://bit.ly/40jGiCQ
[2] EL-R Series DC Power Supplies, Aim-TTi: http://bit.ly/3kWZmXk
[3] pySerial Module: http://bit.ly/3YgSJgZ
[4] pySerial TCP/IP Bridge Example: http://bit.ly/3kTDKem
[5] G. Clark, “RFC 2217 Telnet Com Port Control Option,” Cisco Systems, Inc., October 1997: http://bit.ly/3jcQGM4
[6] “Universal Serial Bus Test and Measurement Class Specification (USBTMC),” USB Implementers Forum, Inc., April 2003:
http://bit.ly/3YbJY7L
[7] Model 2567B-MSO, B&K Precision: http://bit.ly/3kN3rNy
[8] A. Forencich, “Python USBTMC,” July 2014: http://bit.ly/3HMLeZN
[9] A. Forencich, python-usbtmc, GitHub Project: http://bit.ly/3wK4i4r
[10] PyUSB Software: http://bit.ly/3WRFW3l
[11] libusb Software: http://bit.ly/3wLEvIY
[12] “Programming Manual 2560B Series,” B&K Precision, September 2022: http://bit.ly/3WRDYjs
[13] “VISA Resource Syntax and Examples,” National Instruments Corp., May 2022: http://bit.ly/3XK3okh
[14] Moku:Lab, Liquid Instruments: http://bit.ly/3WT6bXb
HELPFUL RESOURCES
</> > S. Cording, “Debugging Microcontrollers Without a Debugger,”
January 17, 2023. https://elektormagazine.com/no-debugger
> S. Cording, “The Full Gamut of Microcontroller Debugging
Techniques,” June 30, 2020. https://elektormagazine.com/
mcu-debug-20
> Functional test: test > Structural test: test > M. Horkan, “A Black-Box Approach to Embedded Systems
app functionality and app infrastructure. Vulnerability Assessment” (Elektor Business 4/2018).
behavior. https://elektormagazine.com/blackbox2018
> Pro programming insights
> Pro programming insights are required. > L. Labbe, “Tracing the Cause of Software Bugs Wirelessly:
Circular Buffer and Webserver on the ESP32,” September 29,
are not required. > Managed by developers. 2022. https://elektormagazine.com/trace-bugs-wireless
> Managed by testers. > Code access is required. > C. Valens, “Secure Communications – An Interview with Luka
> Code access is not Matic,” November 6, 2019. https://elektormagazine.com/
required. secure-comm-19
••
11% Position Sensor
39% Pressure Sensor $19.3
7.2% CAGR
36% Image Sensor
WEB LINKS
[1] Global Market Insights, “Software Testing Market Report,” 2022: https://www.elektormagazine.com/GMI-testing-software
[2] L. Nguyen, “Key Differences and Similarities Between Black Box and White Box Software Testing,” Orient Software, 2021:
https://www.orientsoftware.com/blog/black-box-and-white-box-software-testing/
[3] Verified Market Research, “Microelectromechanical System (MEMS) Market Size And Forecast,” 2023:
https://www.elektormagazine.com/vmr-mems-market
[4] Markets and Markets, “Micro-Electro-Mechanical System (MEMS) Market,” 2023: https://www.elektormagazine.com/mandm-mems-market
[5] Allied Market Research, “Microelectromechanical System (MEMS) Market,” 2022: https://www.elektormagazine.com/amr-mems-2022
[6] Fortune Business Insights, “Industrial Sensors Market Size, Share & COVID-19 Impact Analysis,” 2019:
https://www.elektormagazine.com/fortune-sensors
[7] Markets and Markets, “Top 10 Sensors Market by Type (2021-2026),” 2021: https://www.elektormagazine.com/markets-top-10-sensors
Overvoltage
Protection
for Safe
Operation
Transient Protection for Non-Isolated
DC/DC Power Modules
recommended, which attenuates the voltages that To make a proper design based on a TVS diode for a
exceed the maximum operating voltage of the DC/ transient protection of the power module, the follow-
DC converter. ing parameters are required.
Immunity Filter Design Limits > VDC supply voltage for the power module
The most critical parameter of a switching regula- > VBR voltage where 1 mA of current is flowing
tor needed for a transient filter design is the input through the TVS diode
voltage. In many cases, there are two different values > IPeak max.peak current flowing through the TVS
given in the datasheet. One is the absolute maximum diode @ VClamp max
input voltage, which, if exceeded, leads to permanent > PDiss max.allowed dissipated power for the TVS
damage to the power module. The other one is the diode
maximum operation voltage, which corresponds to the > VClamp max voltage where the diode carries the
maximum specified input voltage the manufacturer maximum specified current
allows the power module to be used with. For means
of transient overvoltage protection, it is recommended First Immunity Filter Stage
to design the immunity filter so that even in transient Determination of VDC
overvoltage events the power module input voltage For VDC, the determining value for immunity is the
never exceeds the maximum operational voltage limit. maximum DC bus voltage that can be present, not the
For further calculations the 173010535 Sip-3 power nominal value that means 24 V for a 24 V bus. In the Figure 2: Filter concept
module with an absolute maximum input voltage of industrial environment, a 24 VDC bus is specified for for EMC compliance of
MagI3C power modules
Vin = 44 V is used as an example [1]. 19.2 to 30 V. Resultantly, the max is VDC = 30 V.
with immunity and
emission filter.
Immunity Filter Design The selection of the TVS diode for the next steps
In this article, the use of a unidirectional power of calculation is based on the available parts in the
transient voltage suppressor diode (TVS) is consid-
ered as a protection element for the power module
input. Unidirectional operational behavior means
that the V-I characteristics are nearly the same as that
of a Zener diode. Consequently, the diode is normally
used in reverse direction. Exceeding the component’s
specific breakdown voltage causes the TVS diode to
enter into a conductive state. The clamping voltage
level is then determined by the current flowing
through the component. The following numerical
example provides a simplified, hands-on guide for
establishing a well-estimated filter. The filter estima-
tion enables a quick refinement cycle when conduct-
ing real application tests.
Wiha
Measuring Equipment
Reliable Electrical Testers and Meters
By Transfer Multisort Elektronik Sp. z o.o. in accordance with the DIN EN 612433 and
VDE 0682-401 standards. They can also
Electrical testing equipment is essential for any technician check continuity in a range of 0 Ω to 500 kΩ.
who doesn’t want to work in the dark. The range of Wiha The mid-range and high-end variants differ
the most. The mid-range model is suited for
measuring equipment here is just the start of the impressive photovoltaic system testing and offers the
range available from Transfer Multisort Elektronik. option of non-contact voltage measurement,
frequency (from 1 Hz to 950 Hz) and resistance
(between 0 Ω and 1999 Ω). On the other hand,
the high-end model is intended for the electro-
Measuring equipment is a set of tools which can detect voltage from a distance. In other mobility sector and can measure frequencies
may prove useful both in maintenance words, you don’t need to touch any danger- of between 40 Hz and 400 Hz.
workshops in large modern factories and in a ous surfaces.
DIY-enthusiast’s garage. As the name suggests, Digital Multimeter
measuring equipment is intended for measur- Wiha’s product range now includes three Volt Digital multimeters (Figure 3) are examples
ing distinct properties of electrical devices and Detectors, which differ in terms of price and of the most common measuring equipment.
installations. However, it may also be used for features. The base model is equipped with a Their popularity can be attributed to the fact
estimating environmental conditions. Thanks single LED that informs the user of voltage that they can measure multiple electrical
to such tools, it is much easier to detect a fault detection in the range of 90 V AC to 1000 V AC. properties and are easy to use.
in a malfunctioning device or check whether a The other two devices indicate voltage detec-
newly assembled circuit works properly. tion using an LED and an audible signal. What This product category includes two slightly
is more, the high-end variant is equipped with different meters. The more basic model,
While looking for the right measuring equip- a flashlight, and it can detect a wider voltage WIHA.45218, can check continuity in a range
ment [1], it is worth checking out the range of range (between 12 V AC and 1000 V AC) than of up to 30 Ω and detect resistances of up to
Wiha products [2]. This German manufacturer the base model. In addition, the high-end 40 MΩ. What is more, the device can measure
provides tools of impeccable quality, precision, variant, in contrast to the mid-range devices, voltages of between 0 V and 600 V (for both
and reliability recognized all around the world. is ATEX-certified. Therefore, it can be success- alternating and direct current), measure
This is evidenced in the number of prizes the fully used in explosion risk zones. current of between 40 mA and 10 A AC/DC,
brand receives every year for its innovative and frequencies of up to 5 MHz. Additionally,
ideas, design, and customer service. Now, their Two-Pole Voltage and
product range has been expanded to include Continuity Tester
measuring equipment. Another device that may prove useful in a
workshop is the two-pole Voltage and Conti-
A non-contact voltage detector (Figure 1) nuity Tester (Figure 2). The device can be
is considered to be a must-have for every used for testing electrical installations and
electrical engineer and technician. With such control cabinets.
a product, you can check whether a circuit is
Figure 2: The Voltage and Continuity tester can
charged with electricity. It’s incredibly safe to All three available testers have a measuring check continuity in a range of between 0 Ω and
conduct tests with such tools because they range of 12 V to 1000 V AC or 12 V to 1500 V DC, 500 kΩ.
the tool is equipped with a HOLD function to 1500 V at direct current. Additionally, the
and an automatic range measurement setting. tool can measure current at up to 400 A AC/
DC, frequency at up to 5 MHz, and resis-
The other multimeter, WIHA.45215, is a bit tance at up to 40 MΩ. The product has also
more advanced. It can check circuit conti- been equipped with TrueRMS, HOLD, and
nuity in a range of up to 30 Ω and detect Min / Max / Avg functions. What is more,
resistances of up to 200 MΩ. In addition, it the tool has an integrated flashlight and can
can measure voltages of between 0 V and be used, for instance, in photovoltaic system
1000 V AC/DC, measure current ranging testing and the electromobility sector. Figure 7: The result of the Continuity Tester is
from 40 mA to 10 A AC/DC, and frequencies indicated by an LED and an audible signal.
of up to 60 MHz. Moreover, the product has Mains Socket Tester
TrueRMS, HOLD, and Min/Max functions. It The WIHA.45220 is an interesting example of a
also offers the option of non-contact voltage mains Socket Tester (Figure 5). With this tool, meter is connected to the motor, the LEDs will
measurement, as well as automatic and you can test various types of sockets. Depend- indicate the direction of rotation and inform
manual measurement range setting. ing on the result of the test, the three LEDs on the user of an incorrect phase sequence. Such
the front panel will light up in a preset config- a rotational field indicator is a must-have for
Wiha Clamp Meter uration. The product can detect, for instance, maintenance workshops.
A clamp meter (Figure 4) may be useful when whether the L/N cables have been connected
you need to measure current without making the other way around, but also a phase loss or Continuity Tester
physical contact with a conductor. To test a lack of earthing. Such equipment may prove Even the best electrician can make a mistake
cable, you only need to place it between the immensely useful for electricians. while putting together an electrical installa-
clamps, and the meter will show you the value tion. To find the fault, you can use a Conti-
of the current. Due to this feature, such tools Rotational Field Indicator nuity Tester (Figure 7). The tool is intended
have gained a lot of popularity among electri- (Phase Sequence Tester) for professionals and offers two measuring
cal engineers and technicians. Phase sequence is crucial in three-phase ranges (up to either 10 Ω or 500 Ω, respec-
motor systems. An error in the sequence may tively). The test is compliant with the CAT II
The manufacturer offers a professional clamp cause damage to the motor and an undesir- 400 V standard. Continuity is indicated by an
meter, the WIHA.45219. With this device, able production line stoppage. A device that LED and a loud, audible signal. The manufac-
you can check continuity in a range of up to can help you check whether phases have turer claims that the signal can be heard in
30 Ω and detect voltages ranging from 0 V been connected in the correct order is the another room or even on another floor.
to 1000 V at alternating current, and from 0 V Phase Rotation Indicator (Figure 6). When the 230192-01
WEB LINKS
[1] Measuring instruments: https://tme.eu/dk/en/katalog/measuring-instruments_100164/p,wiha_248/
[2] Wiha products: https://tme.eu/dk/en/linecard/p,wiha_248/
[3] Article source: https://tme.eu/dk/en/news/library-articles/page/51790/wiha-measuring-equipment/
and outputs. These include a PID control- automated testing and data logging, all of and cold spots. Teledyne FLIR is well-known
ler with two fully configurable paths and which are supported with examples hosted in the field of visual temperature measure-
an FIR Filter Builder for finite impulse on GitHub [3]. A robust and straightforward ment, with its products supported by a
response filters with up to 14,819 coeffi- two-channel data logging application for wealth of software to simplify data analy-
cients (Figure 2). A Laser Lock Box is also Python requires only a few lines of code sis, collation, and collaboration. Equipment
included that utilizes the Pound-Drevel-Hall (Figure 3). such as the MR265 [4] (Figure 4) features
[2] technique to stabilize laser frequency Multi-Spectral Dynamic Imaging enhance-
— something used in gravitational wave Long-Term Testing of Thermal ment [5] (MSX®), which improves image
detectors, time measurement, and atomic Issues clarity over traditional infrared imaging
physics. Sometimes, you may wish to investigate tools. The unit achieves this by combining
long-term self-heating or heat dissipation a 160 × 120 (19,200 pixels) thermal camera
Application programming interfaces (API) for your device’s housing. In such cases, coupled with a 2 MP visual camera. Due to
are provided for MATLAB, LabVIEW, and infrared cameras can be a huge help, their lower resolution, cameras relying on
Python, providing many ways to implement enabling you and your team to pinpoint hot thermal image sensors alone tend to deliver
a very fuzzy image.
Figure 3: Example simple data logger capturing the signals from the two analog inputs written in Figure 4: Thermal cameras such as the Teledyne
Python for Moku:Lab. FLIR MR265.
couples the thermal output with a high-con- Where supported, dual streaming can also On-unit results are displayed on the 2.8",
trast image from the visible-light camera be enabled, allowing both visible light and 320 × 240-pixel color TFT.
(Figure 5). Together, the visible detail in radiometric video storage of the target
the image becomes clearer and the thermal being measured. Automated Measurement with
measurement more coherent. Traditional Lab Equipment
The MR265 offers a 9 Hz measurement While highly configurable, headless
These cameras are also supported by the update rate and measures temperatures measurement equipment is attractive in
FLIR Thermal Studio Suite [6] that can of 0 °C to 100 °C (32 °F to 212 °F) for objects some situations, the need to purchase an
collect both individual images and stream- at a distance of greater than 10 cm. Further- extra tablet or laptop to display the results
ing video. Deltas and formulas can be applied more, this unit also supports moisture may discount such tools. And, sometimes,
to provide image analysis, while measure- measurements of 7% to 100% via an what you know is quite simply better. The
ment alarms can be defined when required, in-built pinless measurement sensor or B&K Precision 2560 B Mixed Signal Oscil-
and results are easily shared with colleagues. separately available ball and pin probes. loscope series [7] doesn’t disappoint in this
Figure 6:
The B&K Precision
2569B-MSO offers
four 350 MHz
channels and a
16-bit digital logic
analyzer.
Figure 7: USBTMC USB support can be found in open-source projects. This code, written in Python,
accesses the oscilloscope based upon its VID and PID to acquire its name and serial number.
WEB LINKS
[1] The Moku:Lab from Liquid Measurement: https://bit.ly/3FI0BAW
[2] Pound-Drevel-Hall technique: https://en.wikipedia.org/wiki/Pound%E2%80%93Drever%E2%80%93Hall_technique
[3] Liquid Instruments GitHub: https://github.com/liquidinstruments
[4] MR265 : http://bit.ly/3Zb4OUK
[5] Multi-Spectral Dynamic Imaging enhancement: https://flir.com/globalassets/industrial/instruments/flir-msx-tech-note.pdf
[6] FLIR Thermal Studio Suite: https://flir.eu/products/flir-thermal-studio-suite/
[7] B&K Precision 2560 B Mixed Signal Oscilloscope series: http://bit.ly/40tFNW7
[8] National Instruments NI-VISA product: https://ni.com/en-gb/shop/software/products/ni-visa.html
[9] USBTMC devices in Python: https://github.com/python-ivi/python-usbtmc
[10] 2560B Series Programming Manual: https://bit.ly/40lx6gi
WEB LINKS
[1] Wikipedia: Programming language: https://en.wikipedia.org/wiki/Programming_language
[2] Elektor Labs: https://elektormagazine.com/labs
[3] OpenAI: ChatGPT research release: https://chat.openai.com
[4] OpenAI: Getting Started with Codex: https://help.openai.com/en/articles/6195637-getting-started-with-codex
[5] EEVblog: Sony Boombox REPAIR and Teardown: https://youtu.be/8ToVCAhLg8A?t=487
The logger presented here uses a meter with an S0 power circuits or also the yield of photovoltaic systems
output to record electrical power consumption. to be measured and “logged” or recorded using the
Suitable meters are available for less than €20 (e.g., electronics described here.
at Amazon, eBay or directly from the Far East). This
allows the energy consumption of connected mains After all, what was it that microcontrollers were
invented for? Pretty much for this kind of applica-
tion. Before the computer age, recording energy
consumption or generation over time would have
been difficult and virtually impossible for home
Features
use. Thanks to inexpensive microcontrollers with
> Accurate and safe due to meter with S0 interface and electrical all their great capabilities, not only is digital logging
isolation. no problem today, but even fancy things like a Wi-Fi
> Configurable acquisition of up to five 5 meters. connection and more become possible. What the
> Buffering of data in FRAM to protect the SD card. energy logger can do can be found in the Features
> Recording to SD card in CSV format. box. An impression of the finished solution is given
> Time resolution: 5 minutes. in Figure 1, showing the combination of meter and
> A separate file is saved per day. logger, including power supply units, installed in a
> Display of individual and aggregated data (current and previous day in plastic distributor box.
kWh).
> Display of Wi-Fi field strength and number of µC resets (start counter). Circuit
> Download of data via FTP. Thanks to the microcontroller, the circuit of the
> OTA: Update capability via Wi-Fi. energy logger (Figure 2) is quite simple. On the left
> Development environment: VSCode with PlatformIO. side, there are a number of optocouplers for electrical
isolation, through which the data from the meter’s S0
100Ω
1 4 +3V3
D5 R8 R7 R6 R5 R10
IC5 LED1
1
GND
10k
10k
10k
10k
10k
2
+3V3
3
+5V
4
2 3 CS
1 30 5
R1 EN D23 MOSI
2 29 6
300Ω VP D22 SCK
S0-Interfaces 1 4 3 28 7
D1 VN TX0 MISO
IC1 4 27 8
D34 RX0 GND
5 26
S0-1 D35 ESP WROOM D21
6 25
D32 D19
7 24
S0-2 2 3 D33 D18
FRAM Module
8 23
D25 D5 +3V3
R2
9 22
8k x 8
S0-3 300Ω D26 TX2
1 4 10 21
D2 D27 RX2 8
IC2 11 20 VCC
S0-4 D14 D4 7
12 19 GND
D12 D2 6
13 18 /HOLD
S0-5 D13 D15 5
14 17 SCK
2 3 GND GND 4
RST BOOT 16 MISO
+6V5 R3 15 3V3 3
VIN MOSI
300Ω 2
1 4 USB /CS
D3 1
IC3 +3V3 /WP
PS S0 2 3
PS Sec.
R4
+6V5 300Ω +5V
1 4
D4
2 3
220079-006
interface are sent to the corresponding inputs of the DC/DC converter and a voltage regulator would also Figure 2: The circuit of
microcontroller. These are interrupt-controlled to have been possible, but this would not really make the energy logger is
make sure that no pulse is lost. I used an inexpensive things easier nor cheaper. quite simple.
ESP32 module because it has enough computing power
and also a Wi-Fi interface. On the right side, there Data Storage and Transmission
are two memory modules — a slot for an SD card for As already mentioned, using two memory modules is
mass storage and an additional FRAM module, which not a luxury. The S0 interfaces can sometimes deliver
temporarily buffers the data of 5 minutes in order to several pulses per second. If the measured values were
reduce the number of write cycles to the SD card. collected in the internal memory of the microcontroller,
The electrical isolation by means of two separate power Figure 3: The copper on
supplies also allows that the ESP32 to be connected to the bottom side of the
breadboard between
the USB interface of a PC (e.g., to allow future updates
the inputs and outputs
to be sent to the installed controller). Instead of using of the optocouplers was
two power supplies, a solution with only one power removed with a small
supply with a higher current load plus an isolating cutter.
data could be lost during a reset. On the other hand, In addition, the number of restarts of the logger is
writing them immediately to an SD card would recorded to the FRAM, allowing you to check at any
massively shorten the card’s service life. With only time how often a reset was triggered. Furthermore, a
one value per second, 31.5 million write cycles would new file is created on the SD every day, and the data of
occur per year. However, the memory cells of an SD this day is saved to it. In order to save memory space,
card reach the end of their life after only 1,000 to the recording is only started if one of the meter values
3,000 write cycles. Even a high-capacity card would has changed since midnight. If the energy logger is
therefore almost certainly show defects before a year used to record power consumption, this feature is
has passed. actually superfluous. However, if the energy produc-
tion of a solar system is monitored, it is useful that the
To avoid this, a stable buffer is provided. The exter- recording only starts after sunrise (i.e., when the first
nal FRAM module used here has a storage capacity electricity is generated).
of just 8 kB, but that is easily enough to collect quite
a few values. The biggest advantage of FRAM is that Data Structure and More
it can be written to at least 1010 times, depending on Figure 4 shows a section of a spreadsheet where
the manufacturer — typically, such a memory can the data has been imported in CSV format. Cell A1
contains the date and time the file was created. Row 2
then contains the last values of the previous day as the
new starting point. The first change of a meter value
occurred at 05:55 (cell A3). From row 5 on, the new data
of this day follows. The columns contain the data of
the individual meters. Each row has a time difference
of five minutes to the next row. The data is recorded
on each day until midnight. Every day, a new file is
created. The amount of energy can then be calculated
from the difference between the counted values using
the pulse value of the meters (e.g., 0.5 Wh/pulse). The
CSV format is economical and suitable for importing
into any spreadsheet like Excel, OpenOffice/LibreOf-
fice Calc or Numbers on the Mac. The data can then
be further processed to your liking.
OTA
Once the energy logger is built into a housing and
installed, you will probably not want to remove
the electronics again in case of a software change.
Therefore, the data logger can be updated “Over The About the Author
Air” (i.e., via Wi-Fi). The complete software as well Georg Luber is a trained electrician who studied
as the file system — the web pages with JavaScript electrical engineering and worked for many years in
and the CSS file — can thus be reloaded if necessary. the fields of electrical safety and electrical installa-
tion. He has worked nationally and internationally in
If you want to do that, you enter the IP address with standardization committees (DKE/VDE, CENELEC,
appended “/update”. Figure 8 shows how this looks IEC and ISO). Another focus of his work was build-
like in my case. I implemented the OTA capability ing automation, particularly KNX. Georg Luber is
with the help of Ayush Sharma’s library [3]. involved in the development of software and electron-
ics projects in these areas.
A Simple Circuit
The circuit is so simple that a parts list is actually
unnecessary. Besides the ESP32 development board, Questions or Comments?
which is available everywhere, important components Do you have questions or comments about this article?
are an SD card slot, which is available on inexpensive Contact Elektor at [email protected].
breakout boards, and the FRAM module — also conve-
niently available on breakout boards. Since breakout
boards are available with different pin assignments,
you should not pay attention to the pin numbers, but
to the pin designations when connecting. For the SD
Related Products
card module, MOSI may be connected to DI or SI and
MISO to DO or SO. The meters can be any inexpensive > ESP32-DevKitC-32D (SKU 18701)
model for DIN rail mounting with an S0 interface. The www.elektor.com/18701
DDS5188 type I used (Figure 9) is easily available and
very inexpensive.
> PeakTech Stromzange 4350 (SKU 18161)
www.elektor.com/18161
WEB LINKS
[1] PlatformIO for VSCode: https://platformio.org/platformio-ide
[2] Article web page: https://www.elektormagazine.com/220079-01
[3] OTA library by Ayush Sharma: https://github.com/ayushsharma82/ElegantOTA
[4] ESP32 projects: https://randomnerdtutorials.com/projects-esp32
Assembling the
4tronix M.A.R.S.
Rover Kit
By Clemens Valens (Elektor)
The M.A.R.S. rover comes as a kit of parts, but doesn’t
Inspired by NASA’s Mars rovers, Curiosity and require any soldering. The kit is self-contained, includ-
Perseverance, the M.A.R.S. rover from 4tronix ing tools, although I preferred to use my screwdrivers
instead, as they fit better.
is an autonomous vehicle designed to drive
around on rough terrain on Earth instead of There are two versions of the kit: Raspberry Pi Zero and
on Mars. Indeed, in this case M.A.R.S. doesn’t BBC micro:bit. I tried the Raspberry Pi version. Note that
the Raspberry Pi Zero or BBC micro:bit aren’t included,
refer to the planet, but is an acronym for and neither are the four AA batteries. For the Raspberry
Mobile Autonomous Robotic System. Pi, you will also need a microSD card.
r la
Ele
to
k
r la
b • Ele k
(18 cm × 16 cm × 8 cm) but quite heavy
(600 g) and filled to the brim with
plastic bags containing parts. A
manual is not included. Detailed
assembly and programming
instructions are available on the
4tronix website, so you will need a
computer with an internet connection
to assemble the rover.
WEB LINKS
[1] M.A.R.S. rover assembly: https://4tronix.co.uk/blog/?p=2112
[2] Programming M.A.R.S. Rover on Raspberry Pi Zero (inc v2): https://4tronix.co.uk/blog/?p=2409
[3] MARS-Rover [GitHub]: https://github.com/4tronix/MARS-Rover
[4] “Assembling the 4tronix M.A.R.S. Rover Kit” — this review [video]: https://youtu.be/Np8ZQQd85oc
Parking Disk
with E-Paper Display
An Innovative Digital Replacement
The evolution of the automotive sector, from the point of view The E-Paper Display
of integrating electronic technology into vehicles, has reached A relatively recent invention (1996), e-ink (electrophoretic ink)
extremely high levels. Virtually every functional aspect is optimally technology, generally referred to as e-Paper [1], owes its success
managed by sophisticated sensors, digital interfaces, microproces- mainly to its use in eBook readers, the portable devices that offer an
sors and related software. In the cockpit of what can now be consid- electronic alternative to traditional books, thanks to its paper-like
ered ‘computers on wheels,’ however, it is still easy to find an indis- reading experience and perfect visibility even in high light condi-
pensable instrument, often made of humble cardboard and operated tions. However, the unique feature that has led to the spread of this
manually. This is the Time Disk, a device required to indicate the technology in other areas is the ability to maintain the display of
start of parking in regulated areas. Over the decades, this accessory information for a long time even in the absence of a power supply,
has remained almost unchanged — made of cardboard, plastic or allowing the realization of devices that potentially require power
other more noble materials — and only recently have some digital only for the duration necessary to update the screen (refresh).
models appeared on the market. The one proposed in the article Typical applications, increasingly popular in retail outlets, are
uses a modern e-Paper display with some special features, such as electronic labels and price tags, often difficult to distinguish from
setting the arrival time with a single button, a message in a choice paper ones, which can be updated when necessary, even remotely
of four languages, and the on-demand display of the current time using wireless technologies. To better understand how electronic
and date, the ambient temperature, and the battery level. ink works, Figure 1 helps us.
Display e-Paper
10k
C2 C3
BUSY
GND
VCC
RST
CLK
DIN
DC
CS
100µ 100n
R1 16V J3
VCC
330Ω
1
R11 2
3
4
5
6
7
8
C1 VCC
20 7 21
SW1 AVCC VCC AREF
100n 1
1k
/RES
C4 R4 R5
23 14
PC0 PB0
10k
10k
24 15
470n PC1 U1 PB1
VCC 25 16
PC2 PB2
R6 26 17
PC3 PB3
1 7 27 18
10k
3 12
DS3231M PD1 PD6 SCK 3 4 MOSI
C5 4 11
PD2 PD5 RST 5 6 GND
5 6
SW2 PD3 PD4
100n
R3 R12 J2
GND X1 X2 GND
330Ω
5k6
D1 8 9 10 22
VCC 8MHz
X1
BZ1
D2
SS34 BAT1
R7 R8 BLUE
F1
3V6 40mA
3k3
5k6
250mA
NiMH
D
Q1
J1
USB micro
D3 G
1 IRLD024
2 Q2
S
3 RED
4 BC546B R9
100Ω
230012-002
Figure 2: Schematic
diagram of the circuit.
In the simplest, black-and-white display version, positively (white) libraries for the various development platforms, and often fragmen-
and negatively (black) charged pigments are suspended in a liquid tary and insufficient information and support from the manufactur-
contained in microspheres representing pixels. Due to the polariza- ers themselves. Despite this, by choosing among the best supported
tion created by an appropriate electric field, the pigments, attracted products and stubbornly applying ourselves as Makers, it was possi-
by the charge of opposite sign (electrophoresis), position themselves ble to achieve a result that I believe could be interesting. Let us
to create black or white pixels, composing the desired image. At this therefore continue with the analysis of the circuit diagram, shown
point, even if the electric field is removed, the pigments remain in in Figure 2.
position until a new charge is applied. Visibility, from the partic-
ularly wide angle, is achieved by reflection from ambient light, Schematic Diagram
and in the absence of this, a special light source is required. Inter- An ATmega328P [2] microcontroller was chosen to manage the
estingly, however, under direct sunlight, the screen update does display, the same as the one used in the Arduino UNO board, given
not take place correctly. On the basis of this operating principle, the availability of a versatile library specific to this platform. The
numerous types of displays have been realized, even large and MCU operates at a clock frequency of 8 MHz, thanks to the external
full-color ones, which are, however, still very expensive. At the same ceramic resonator, and is normally in a power-saving state (SLEEP_
time, the affordable offer of smaller, black-and-white, grayscale or MODE_PWR_DOWN), to ‘wake up’ only if the display needs to be
limited-color displays by specialist retailers has increased. On the updated. The DS3231M [3] Real-Time Clock (RTC) integrated circuit,
other hand, the interest of DIY enthusiasts in these components on the other hand, remains active at all times, capable of maintain-
has not increased as much, from what I have been able to see on ing, as long as it is powered, the date and time with an accuracy
the Internet. In my opinion, the reason for this is to be found in of ±5 ppm (±0.432 seconds/day). Other notable features include
various critical points, which also became apparent during the a temperature sensor, a dual alarm and extremely low current
development of this project, due to factors such as the excessive consumption, in the order of microamps (µA) in the configuration
number of models, versions, sizes, drivers and color combinations used, Single Supply (VBAT Only). It communicates with the microcon-
on the market, the lack of well-documented and easy-to-implement troller via an I2C interface and dedicated library. The SW2 button
(blue in the prototype) ‘wakes up’ the MCU, which can thus receive Practical Realization
data on the current time and show it on the display, together with The prototype of the Parking Disk was made as usual on a proto-
the message ‘TIME OF ARRIVAL’ and the ‘P’ logo, before returning type board, as can be seen in Figure 4. Of course, this is only one
to sleep mode. A short beep from the buzzer confirms the operation of many possibilities; by using SMD components and a special
of the button while the blue LED D2 remains lit for the duration of printed circuit board, one could probably achieve a smaller size,
the event. SW1 (red in the prototype), on the other hand, produces slightly larger than the display. The battery and buzzer are located
a hardware reset of the ATmega328P, followed immediately by the under the e-Paper module, while the eight-pin connector of the
display of a screen showing the ‘P’ logo, the battery symbol and same is obtained from a section of male and female strip contacts.
voltage, the ambient temperature, the current time and date, and the The integrated circuits are socket-mounted, and a readily available
language selected for the message, as per the example in Figure 3.
where IAVG represents the average current, ION the activity current,
ISBY the stand-by current, TON the activity time and TSBY the stand-by
time.
The latter must be overwritten with the one supplied with the
project, which has modified fonts. The GxEPD2 library is a massive
A 40 mAh battery — leaving aside for the sake of simplicity the piece of work and unfortunately lacks a structured documentation,
reduction in capacity due to self-discharge, a drop in nominal which is to be found instead in the code of the available examples,
Final Considerations
Although offering features of undoubted interest, which make it
particularly suitable for the project presented, e-Paper technology
also has certain limitations, the most obvious of which is the
low refresh rate. The model used here performs the complete
Related Products
refresh cycle in 2 seconds and the partial refresh in 0.3 seconds.
These values cannot therefore compete with other display types > Waveshare 2.9” 3-color E-Ink/E-Paper Display Module
in the visualization of rapidly changing images, graphics and text. (SKU 18776)
Finally, as I often say, beyond the actual usefulness of the proposed www.elektor.com/18776
object, I hope that you have found some interesting ideas to elabo-
> Ynvisible Segment E-Paper Display Kit (SKU 20143)
rate and reuse with the attitude of a Maker, and that this article www.elektor.com/20143
has triggered your desire and curiosity to experiment with e-Paper
displays!
230012-01
WEB LINKS
[1] Electronic Paper (Wikipedia): https://en.wikipedia.org/wiki/Electronic_paper
[2] ATmega328P Datasheet: https://www.elektormagazine.com/atmega328p-datasheet
[3] DS3231M Datasheet: https://datasheets.maximintegrated.com/en/ds/DS3231M.pdf
[4] Waveshare - 296x128, 2.9inch E-Ink display module: https://www.elektormagazine.com/waveshareeink
[5] Battery Life Calculator – Online Calculator: https://www.omnicalculator.com/other/battery-life
[6] BitmapToByteArrayConverter: https://www.briandorey.com/post/bitmap-byte-converter-for-e-ink-display
[7] Measure VCC/Battery Voltage Without Using I/O Pin on, Microchip: https://www.elektormagazine.com/vcc/battery
[8] Basic operating principle of the e-Paper display: https://www.elektormagazine.com/bwcapsules
[9] Source code: www.elektormagazine.com/230012-01
eCO₂
Telegram bot
Air-Quality Measurement with Telegram Notification
Figure 1: eCO2 Telegram bot with an M5Stack Atom matrix and CCS811, including internal circuitry (image source: AMS data sheet).
In addition, the sensor’s sensitivity can change over time, and under
different environmental conditions such as temperature and humidity.
So, to provide reliable eCO2 readings, the sensor requires:
The data sheet [1] contains more detailed information on the gas sensor.
The Software
The program was developed with Annex32, a BASIC interpreter for
ESP32 [2]. After installing the interpreter in the ESP32 module’s flash
RAM via an installation program and a serial USB interface, the inter-
preter and its development environment run entirely on the ESP32.
Only a Chrome or Firefox browser is needed to load, edit, test and
(automatically) run the BASIC script. The minimum required Annex32
version is V1.435, as this includes CCS811 and Telegram messenger
support. The online help [3] for Annex32 is a very useful introduction
to this BASIC interpreter. The main tasks of the BASIC code are:
> Initializing the CCS811 and obtaining the eCO2 value once per
second.
> Classifying the eCO2 status of the ambient air as GREEN,
YELLOW, or RED. Figure 3: Warning message: The air is really bad!
The Telegram bot routine regularly queries the Telegram servers for Figure 4: Control via the Telegram bot.
incoming commands. It then responds to these commands, as shown
in Figure 4:
> /e returns the eCO2 value and the category [GREEN | YELLOW |
RED].
> /s saves the baseline value in /baseline.txt.
> /r restores the base value from /baseline.txt.
Related Products
> /i returns the local IP settings of the module.
> [Any other character] does the same as /e. > M5Stack AtomU ESP32 Development Kit (SKU 20184)
https://elektor.com/20184
Your Own Telegram Token
In order to use the Telegram features in the BASIC program, you must
> ESP32-PICO-Kit V4
Without headers: https://elektor.com/18423
first create your own Telegram bot by following the BotFather instruc- With headers: https://elektor.com/20323
tions at [4] in your Telegram app. This will give you your personal
Telegram token and a bot name. Important: You must include these > Dogan and Ahmet Ibrahim: The Official ESP32 Book
two pieces of information in the BASIC program to set the appropri- (PDF)
https://elektor.com/18330
ate variables.
The use of Annex32 BASIC, the current version of which you can always
find in the Annex RDS forum [5], certainly has at least the advantage
of being easy to read —even for inexperienced programmers — and
also to be adaptable to your own needs. For a better understanding of
the functions, the code [6] is nevertheless abundantly provided with
comments. This script must be pasted into Annex32’s web-based editor WEB LINKS
and saved to the ESP32 module as an auto-run file (/default.bas). [1] CCS811 data sheet: https://bit.ly/2qQKqKu
[2] AnnexToolKit 1.1 including release 1.48.22:
Translated to English by J. Starkmuth — 210566-01 https://bit.ly/3Gtf8RS
[3] Annex32 WIFI RDS Help Version 1.48.2:
https://bit.ly/3Gwhdg9
Questions or comments? [4] BotFather on Telegram: https://t.me/BotFather
Do you have technical questions or comments about this article? [5] Annex RDS forum: https://bit.ly/3VBTRK2
Then please contact the author by email at [email protected] [6] The Project on Elektor Labs:
or the Elektor editorial team at [email protected]. https://www.elektormagazine.com/labs/eco2-telegram
By Jan Buiting (Elektor) assembly less and less attractive. Electron- a multimeter will only get you so far. I am
ics has shifted to software development at a really content to have been able to use the
Meet the man behind the rapid pace. Microprocessor boards have been AP analyzer for many years. What matters,
Elektor Fortissimo-100 popular for a long time, but even building though, is how and what you measure. In
them is less attractive than buying ready- other words, know what you are measur-
power amplifier and many made modules, especially in recent years. ing! Without good experience and the right
other top-notch audio The software then determines the applica- conclusions, using that AP can accomplish
projects: Elektor Labs staffer tion, although obviously with some external little. You don’t learn that in a day.
(analog) components such as sensors etc.
Ton Giesberts. Jan: What are your main sources of
Jan: How is your work organized these inspiration for new designs, compo-
days, and what lab instruments and tools nents, and techniques?
Jan: Tell us briefly about your technical do you usually work with? Do you use a Ton: For novel designs, the oldies are very
background, your experience, and how simulation program for your designs? good sources of inspiration. You can find
and when you joined Elektor. Ton: Now that I work for a different depart- plenty of them on the internet. The devel-
Ton: After my studies, I was approached ment within Elektor [Books, Kits and Pillar opment of bipolar power transistors, for
almost instantly by an employment agency Products - Ed.], there are other tasks I have to example, has not been idle. So, what’s wrong
“to come over for a chat.” They offered me spend time on. These tasks frequently aren’t with picking up an old design again, tweak-
several jobs, including one at a school. That about developing new circuits or processing ing it here and there, and using up-to-date
did not appeal to me, but I did like a job at a raw material supplied to us directly. They are components to give it a new lease on life?
publisher of a technical monthly, located in about checking and obtaining components,
Beek. As a subscriber, I knew this could only supporting colleagues, and much more. Like Jan: Your work seems focused primarily
be Elektuur. I had already built several circuits most electronic engineers, I use a multime- on analog electronics possibly combined
from the magazine, and, after a job interview, ter and an oscilloscope most frequently. Of with digital stuff, but limited to “side
I first worked in the lab for a few months course, a couple of lab power supplies and a assistance.” How do you weigh the
through the temp agency before I was hired function generator are indispensable, not relative significance of analog and
permanently. Elektuur was just looking for forgetting an audio analyzer. In addition to digital within your designs?
someone who wanted to do analog engineer- a plain soldering iron, I use a reflow oven and Ton: I continue to like the bog-standard
ing, so that suited me just fine. hot air to solder SMDs. For prototype photo- logic series, also as drivers or in combina-
graphy, I have a small setup in the attic to take tion with analog circuits. But, I have come
Jan: Outside your profession, what are properly exposed photos. I’ve preferred to to appreciate that microcontrollers make
your favorite pastimes or hobbies? use Micro-Cap for simulation ever since the your design cheaper and smaller as far as
Ton: Electronics was and still is my pastime. DOS days. the hardware goes, while software makes
I also design some things outside of work. I a project more versatile. Programming has
like to read and watch documentaries or a Jan: We hear you own an Audio Preci- never been attractive to me; analog technol-
good movie. sion Analyzer. How do you like working ogy seems more tangible, but that may be
with an instrument that many audio an illusion. If I do use a microcontroller, it’s
Jan: Over the years, how have you seen enthusiasts can only dream of ? one from the AVR family, and then program-
the craft of “electronics” and its practice Ton: Without a good analyzer, designing ming with BASCOM is still doable even for
change? high-end audio circuits is almost impossi- me. Occasionally, it’s even a fun and welcome
Ton: Over time, the use of wired components ble. Of course, and thankfully, measurement change, sort of. Nowadays, it can be even
has decreased. I suppose the emergence and data aren’t everything, but they’re great to easier with tools such as CircuitPython and
standard use of mostly SMD parts made home reveal imperfections. An oscilloscope and a Raspberry Pi Pico.
WEB LINKS
[1] “LFA-150: A Fast Power Amplifier,” Elektor, 11/1988: https://elektormagazine.com/magazine/elektor-198811/47463
[2] “LFA-50-OA,” Elektuur, 10/1991: https://elektormagazine.nl/magazine/elektor-199110/37655
[3] “Medium-Power AF Amplifier,” Elektor, 10/1990: https://elektormagazine.com/magazine/elektor-199010/32233
[4] “Medium-Power HEXFET Amplifier,” Elektor, 12/1993: https://elektormagazine.com/magazine/elektor-199312/32952
[5] “IGBT power-amp,” Elektuur, 6/1995: https://elektormagazine.nl/magazine/elektor-199506/38437
[6] “Crescendo Millennium Edition,” Elektor, 4/2001: https://elektormagazine.com/magazine/elektor-200104/16985
[7] “ClariTy 2x300W,” Elektor, 6/2004: https://elektormagazine.com/magazine/elektor-200406/17714
[8] “200W Class-D Audio Power Amplifier,” Elektor Labs, August 10, 2016:
https://elektormagazine.com/labs/200w-class-d-audio-power-amplifier-150511
[9] “Q-Watt Audio Power Amplifier,” Elektor, 9/2013: https://elektormagazine.com/magazine/elektor-201309/23330
[10] “Fortissimo-100 High-End Amplifier,” Elektor, 11/2022: https://elektormagazine.com/magazine/elektor-280/61057
HomeLab Tours
Work in Progress...
Figure 1: This ping-pong ball floats in or on a water jet.
* During the COVID-19 crisis, the Chinese acquired virtually all remaining stocks of Russian Nixie tubes.
That is one of the reasons why Elektor’s six-digit Nixie clock is no longer available.
Due to a lack of Nixie tubes and Plexiglas (also a result up to 11 ping-pong balls, but a supply through a funnel
of COVID-19), Ilse wanted to change direction in terms of in the container is possible in addition to a longer tube.
electronics, but it had to be something special. And that’s A rotating plastic cam causes the ping-pong balls to
where the idea with the ping-pong balls came around the roll out from the container one by one. With each
corner again, with the idea of shooting them at home back-and-forth movement of the cam, one ping-pong
with air guns. Something similar can be seen at fairs: at ball is released while the remaining balls are automat-
Figure 3: This
shooting stalls where you can shoot at ping-pong balls ically blocked. The cam is held in a basic position by a mechanism ensures that
floating on water jets (Figure 1). tension spring with the cam being moved by a minia- the balls enter the air
ture servo using a string (see Figure 3).” stream one by one.
“Currently, I have only built an operating mechanical
prototype. As for the airflow, I used a 9BMC24P2G001
blower from Sanyo Denki. It is not a cheap one, unfor-
tunately, but it delivers a solid airflow and can be
easily controlled in speed by a PWM signal. This is
convenient because by modulating the airflow, we
can cause the ping-pong ball to move up and down
irregularly to make it a bit more challenging target.
Using a removable cabinet that also serves as a buffer
bin and a powder funnel from a chemical wholesaler,
a powerful constant airflow is generated. Any debris
(bits of projectiles) cannot enter the blower in this way,
and you can open the bottom of the cabinet to clean it.”
Questions or Comments?
Do you have technical questions or comments regar-
ding this article? Send an email to the editors of Elektor
at [email protected].
WEB LINKS
[1] Video 1 – Ping-Pong Ball Launcher: https://youtu.be/gTmytGPtHfQ
[2] Video 2 – Floating Ping-Pong Ball: https://youtu.be/iH6_5-zcddw
RFID
Tag Reading
and RFID
Door Lock
Sample Projects from the Elektor
Arduino Experimenting Bundle
RFID stands for Radio-Frequency Identification RFID technology utilizes electromagnetic fields to transfer data over
— a wireless technology covering devices for short distances. RFID systems are used mainly in security applica-
tions. For example, they can be used to open a door exclusively by a
security, access, and goods tracking purposes. person having the correct RFID tag.
In essence, an RFID system includes an RFID
reader and one or more tags. Both hardware The RFID reader supplied with the Elektor Bundle mentioned above
(comprising a book and a kit of parts) is known as the ‘RC522 Module’
devices are contained in a versatile kit of (Figure 1). It has the following specifications:
parts aimed at Arduino experimenting and
backed by a specially written guide. In this > Operating frequency: 13.56 MHz
> Operating voltage: +3.3 V
article, as an example of embedded project > Operation with both SPI bus and I2C bus
development from the ground up, Elektor
guide author Dogan Ibrahim explores RFID
technology and gets help from “our mutual
friend,” the Arduino UNO.
Figure 3 shows the circuit diagram of the project. Be careful not to > Start the IDE.
connect the supply voltage pin to +5 V. > Click File → Examples → MFRC522 → DumpInfo.
> Compile and upload the program to the development board.
Program Listing: Before using the RFID reader, you have to add the > Start Serial Monitor.
RFID library to your IDE. The name of the library is MFRC522, and the > Place the white tag on top of the reader and keep it there until the
steps to add it are as follows: data display stops in Serial Monitor.
Figure 2: Tag reader project block diagram. Figure 3: Tag reader project circuit diagram.
The third block of each sector (i.e., the top block) is called the Sector
Trailer, and it contains the Access Bits. These control the read/write
access to the remaining blocks in the sector. Therefore, only the bottom
three blocks (i.e., blocks 0, 1, and 2) of each sector are available for
user data storage. This means that you have 48 bytes (3 × 16 bytes)
per 64-byte sector for your use.
Figure 5: Access control project block diagram. Figure 6: Access control project circuit diagram.
#define SS_PIN 10
#define RST_PIN 9
MFRC522 mfrc522(SS_PIN, RST_PIN); // Create MFRC522 instance
String ValidCard = “23F058A7”; // Valid Tag ID
String TagID = “”;
int RELAY = 2; // RELAY at port 2
byte i;
void setup()
{
pinMode(RELAY, OUTPUT); // RELAY is output
digitalWrite(RELAY, LOW); // Deactivate RELAY
SPI.begin(); // Initiate SPI bus
mfrc522.PCD_Init(); // Initiate MFRC522
}
void loop()
{
if (!mfrc522.PICC_IsNewCardPresent()) // Look for card
{
return;
}
Questions or Comments?
Do you have any questions or comments related to this article?
Email the author at [email protected] or Elektor at
[email protected].
Related Products
> Arduino Uno Experimenting Bundle (SKU 20340)
Consists of:
• Elektor Guide: Arduino Uno Experimenting Kit -
Programming & Projects (238 pages)
• Makerfabs kit of parts including a genuine Arduino Uno R3.
www.elektor.com/arduino-uno-experimenting-bundle
WEB LINK
[1] Software Archive for Bundle: https://elektor.com/arduino-uno-experimenting-bundle
Oscilloscope
Current Probe for RF
RF Current Measurements Made Easy
Do you need to
measure the antenna
current of your HF
transmitter? Or, like I
do, the primary current
of your Tesla coil?
These projects require
some preliminary
Figure 1: A closeup photo of my RF current probe.
considerations. Here
are some design
guidelines and a real- In many cases, current measurements to high frequencies, which are really straight-
without a DC component are useful. The most forward to build. The formulas presented are
world example. common is the case of CTs (current transform- valid also for AC mains units.
ers) for AC mains. This article is about the
design of current transformers for medium Probe Principle
The probe in Figure 1 is designed to measure
up to 50 A peak in a frequency range from
7 kHz to tens of MHz. The schematic in
Figure 2 is quite simple: the wire whose current
Ix
must be measured is passed through the toroid,
FT 82-43 which is an ordinary Amidon FT 82-43 core
that performs well up to at least 50 MHz.
Probe
5x 1Ω, 1/4W The secondary winding consists of ten turns of
wire evenly distributed over the core. If avail-
able, use a medium-gauge stranded wire, but
this is not mandatory. Due to the ratio of 1:10
turns, the maximum current in the second-
ary is 5 Ap.
Secondary is 10 turns
The secondary side is loaded with 0.2 Ω, which
evenly distributed was realized by a parallel connection of five
20385-007
1 Ω resistors. At a peak current of 5 Ap, the
peak voltage across these resistors is 1 Vp,
Figure 2: My RF current probe’s simple circuit. which is very convenient for measurements
Conclusion
This example of an RF current transformer
together with the most important design crite-
ria proves that this matter is less complex than
it initially seems. I hope that the consider-
ations and formulas presented here are useful
in simplifying the handling of toroidal cores,
as well as serving as a basis for your own
developments.
Figure 4: Probe improved with electrostatic shield. 200385-01
• Elek
r lab to
to
r la
Ele
b
TESTED
ab
Ele to
rl
k r la to
b • Ele k
Everything Is Included
The robot arm comes as a self-contained kit of parts (Figure 2).
Besides a computer to do the programming on and a micro-USB
cable, nothing else is required. A 5 VDC, 6 A power supply is included.
Figure 1: A Raspberry Pi Pico board controls the six servos of the robot arm. Figure 2: The 6 DOF robot arm comes as a complete kit of parts.
There are quite a few parts and even more nuts and bolts, but not all
are used. Except for the acrylic baseplate and the steel arm bone, all
the parts are made from aluminum. When it’s put together properly,
you don’t end up with a wiggly plastic toy but a with strong, solid
metal arm. Even though everything is made of aluminum, the
assembled arm weighs 1.3 kg (without the power supply). Figure 3: The arm can hold a tool, but I wouldn’t trust it with one.
Educational Tool
The 6-DOF robot arm is mainly an educational tool to teach
programming in MicroPython. It is a fun object that can move in
many ways, and it can pick up small items like its own power supply
(approx. 6 cm × 4 cm × 8.5 cm). As a demo video [2] shows, you can,
for instance, use it to play the Towers of Hanoi game. The robot
is not suited for industrial applications or high-precision tasks. It
does have a grip, but I wouldn’t trust it with a tool in it (Figure 3).
Be Careful!
Do not naïvely assemble the arm and run the demo without having
tested every servo first. The arm may spin around and move wildly,
swiping things from the bench or hitting you in the face. Its servos
are powerful! I managed to make the arm snap its own 4-mm-thick
baseboard due to a servo pushing down on the bench instead of
going up. The red YF-6125MG servos move especially fast, so watch
out. I therefore strongly recommend fixing the arm to the bench
(Figure 6) or to a heavy plate, and keep the space around it clear.
Also note that the red YF-6125MG servos do not have end stops and
may go the wrong way around to reach their target position. This
may happen when the arm is folded down and then powered up. I
therefore also highly recommend stretching the arm to its upright
position before switching on the power; see Figure 7.
WEB LINKS
[1] 6 DOF Robot Arm at Elektor: https://www.elektor.com/makerfabs-6-dof-robot-arm-with-raspberry-pi-pico
[2] Demo video: https://youtu.be/8dB1W6Jd07g
[3] Assembly guide [Zip file]: https://www.makerfabs.com/desfile/files/Raspberry-Pi-PICO-6-DOF-Robot-Arm.zip
[4] Assembly video: https://youtu.be/NqL9n3avBbY
[5] MicroPython driver and example: https://github.com/Makerfabs/PICO_Merchanical_Hand_Driver
[6] Makerfabs website: https://makerfabs.com/raspberry-pi-pico-6-dof-robot-arm.html
Genius
The only autonomous wheel in the world.
Innovation that transforms anything into an
autonomous mobile robot with simple set up.
State of art
Remote access via App
sensor technology
Flexibility to adjust
In-process charging
your payload
Generative AI
ChatGPT [2], but this AI is trained on you too. On all
of us. Massive bodies of text and our written inter-
actions from all over the Internet are used to train
the linguistic model that is core to ChatGPT. If you
want to know more about these underlying linguis-
tic models, I recommend you listen to ”Speaking of
Who Made This Anyway? Intelligence“ by Hannah Fry [3] — an episode of her
DeepMind podcast series.
By Priscilla Haring-Kuipers (The Netherlands) One of the problems of the model is that it is unwit-
tingly racist, aggressive, and downright horrible. It
It’s all about AI. DALL-E and ChatGPT — both by is trained on the Internet and has no built-in value
OpenAI — have mesmerized many and landed system on which to judge content. How does it acquire
such values? Humans. Badly paid computer workers
generative AI in society. that spend their days looking at immoral text and
images and label them accordingly. So that the model
might learn to recognize bad content and stop produc-
ing it [4]. Moderation of social media content also uses
A Is for Art this process. That the model is getting better means
The biggest debate surrounding visual generative AIs hours of humans correctly labelling content as ‘rape’,
like DALL-E [1] is about the art that the AI trained on ‘racist content’, ‘child abuse’, ‘violence’ and the like.
without asking the original artists. For humans, we Much of the intelligence in AI is our own.
are fine with being inspired by art. We are even okay
with beginning artists copying art as a starting point, ChatGPT is also often factually wrong. Stack Overflow
but the general idea is that you then move into making banned the use of ChatGPT for now because, “The
original work. Why can’t a system use online artwork primary problem is that while the answers which
this way? One reason is that this wasn’t a general ChatGPT produces have a high rate of being incor-
consideration when the artist put their art online. They rect, they typically look like they might be good, and
did not make their art available for training, and no the answers are very easy to produce.”[5] Because the
one asked them if they could use their art this way. AI is giving information in a conversational style, we
The rules were suddenly changed on them, and now tend to process the information easier and judge it as
we have to all figure out together what we accept as more likely to be true if we judge it at all. For your next
the new rules and how they should be applied. interaction with ChatGPT, I would like you to keep in
mind that you are talking to the median of the inter-
Another reason is that AI is not inspired by art; it is net and trust it accordingly.
building a dataset on which it is training a model. We
understand intelligence mostly through the lens of AI Needs UBI
our own experiences, and expect AI to work in much We could take the sting out of this ongoing automa-
the same way as human intelligence does. This is not tion of work by providing everyone with a Universal
the case. We are multi-modal beings with direct and Basic Income. Just give everyone enough money to
indirect processing, associative learning, emotional live on. No strings and no questions.
WEB LINKS
[1] OpenAI, DALL-E 2: https://openai.com/dall-e-2/
[2] OpenAI, “ChatGPT: Optimizing Language Models for Dialogue,” November 30, 2022:
https://openai.com/blog/chatgpt/
[3] H. Fry, “Speaking of intelligence,” DeepMind: The Podcast (S2, Ep2), January 25, 2022:
https://youtu.be/21JSKHR7KWw
[4] B. Perrigo, “OpenAI Used Kenyan Workers on Less Than $2 Per Hour to Make ChatGPT Less Toxic,”
January 18, 2023: https://time.com/6247678/openai-chatgpt-kenya-workers/
[5] Stack Overflow, “Temporary Policy: ChatGPT Is Banned,” December 5, 2022:
https://meta.stackoverflow.com/questions/421831/temporary-policy-chatgpt-is-banned
Price: €199.95
Special Price: €99.95
www.elektor.com/20372
Price: €109.95
Special Price: €94.95
www.elektor.com/20440
www.elektor.com/20436 www.elektor.com/20405
www.elektor.com/20421 www.elektor.com/20426
Traditionally, the last page of Elektor The Hexadoku puzzle employs digits in the hexadecimal range 0
through F. In the diagram composed of 16×16 boxes, enter digits
Magazine is reserved for our puzzle with an such that all hexadecimal digits (that’s 0–9 and A–F) occur once
electronics slant: Welcome to Hexadoku! only in each row, once in each column, and in each of the 4×4 boxes
Find the solution in the gray boxes, submit it (marked by the thicker black lines). A number of clues are given in
the puzzle, and these determine the starting 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 digits in the gray boxes.
PRIZE WINNERS
The solution of the Hexadoku in edition 3-4/2023 (March & April) is: F13AB.
Solutions submitted to us before April 15th were entered in a prize draw for 5 Elektor Store Vouchers.
The winners are posted at 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
[email protected]
+44 (0)1756 753440