Elektor Mag - 2022-01+02
Elektor Mag - 2022-01+02
Elektor Mag - 2022-01+02
95
*
S2
with H-Bridges
WD
p. 6
K3 D7
D5
D3
D1 K1 FOCUS ON
Motor
M1 Control
Versatile Servo M In this edition
Tester
> DIY Master Power Switch for the Lab Bench
> The Raspberry Pi Zero 2 W GoesK4Quad-Core D8
D6 > The Elektor Lab Team
D4
K2 p. 73 > Sound Card for the Raspberry Pi Family
D2
> Practical Neurons
> Inside an Open-Source Processor
ELEKTOR INDUSTRY
Large
> Motor Control Complexity Simplified
> Impressions from the World Ethical
Electronics Forum
and
21 0491much
-004
more!
Electric Motors
p. 52
Elektor Magazine,
English edition
Jens Nickel
Edition 1/2022 International Editor-in-Chief, Elektor Magazine
Volume 48, No. 511
January & February 2022
www.elektor.com
www.elektormagazine.com
Stay curious!
Copyright Notice
The circuits described in this magazine are for
domestic and educational use only. All draw-
ings, photographs, printed circuit board layouts,
programmed integrated circuits, disks, CD-
ROMs, DVDs, software carriers, and article texts
published in our books and magazines (other
than third-party advertisements) are copyright
The Team
Elektor International Media b.v. and may not be International Editor-in-Chief: Jens Nickel
reproduced or transmitted in any form or by any
Content Director: C. J. Abate
means, including photocopying, scanning and
recording, in whole or in part without prior writ- International Editorial Staff: Eric Bogers, Jan Buiting, Stuart Cording, Rolf Gerstendorf,
ten permission from the Publisher. Such written Dr Thomas Scherer, Clemens Valens
permission must also be obtained before any Laboratory Staff: Mathias Claussen, Ton Giesberts, Luc Lemmens, Clemens Valens
part of this publication is stored in a retrieval Graphic Design & Prepress: Giel Dols, Harmen Heida
system of any nature. Patent protection may
Publisher: Erik Jansen
exist in respect of circuits, devices, components
etc. described in this magazine. The Publisher
does not accept responsibility for failing to
identify such patent(s) or other protection. The
Publisher disclaims any responsibility for the
safe and proper function of reader-assembled
Elektor is a member of FIPP, an organization that has “grown over almost 100 years to
projects based upon or from schematics,
descriptions or information published in or in include media owners and content creators from across the world.”
relation with Elektor magazine.
THIS EDITION
BWD
Volume 48, No. 511
S1 January & February 2022
FWD
Driving Motors
with H-Bridges
An Introduction to DC, Stepper, K3 D7
andD1Brushless Motors
D5
D3
K1
6
M1
M
K4 D8
D6
D4
K2
Regulars
D2
FOCUS
3 Colophon
52 Large Electric Motors
72 productronica Fast Forward 2021 Winners Basic Principles and Useful Information
Exciting Technologies and Creative Solutions -004 (Part 2)
68 Create GUIs21
with Python
0491
92 Starting Out in Electronics Spy Name Chooser
We Are Not Yet Done with the Coil
82 Understanding the Neurons in Neural Networks (Part 3)
96 Err-lectronics Practical Neurons
Corrections, Updates and Readers’ Letters
87 Inside an Open-Source Processor
110 Ethics Sample Chapter: Lattice and Xilinx FPGA Results
Poverty and Electronics
102 BattLab-One
114 Hexadoku Measure and Optimize the Battery Life of IoT Devices
The Original Elektorized Sudoku
Industry
Features 44 Notes From the 2021 World Ethical Electronics Forum
FOCUS
FOCUS
46 Motor Control
6 Driving Motors with H-Bridges How the Complexity of Motor Control Is Simplified
An Introduction to DC, Stepper, and Brushless Motors
16 The Elektor Lab Team
Our Approach, Preferred Tools, and More
28 IQaudio Codec Zero
The lektor Team
A Sound Card for the Raspberry Pi Family Our Approach, Preferred Tools, and More
31 The PiKVM Project and Lessons Learned
Interview with Maxim Devaev (Developer, PiKVM)
40 The Raspberry Pi Zero 2 W Goes Quad-Core
16
4 January & February www.elektormagazine.com
The Raspberry Pi Protect Yourself
Zero 2 W and Others!
DIY Master Power Switch
Goes Quad-Core for the Lab Bench
40 64
106 Motor
Control
lektor January & February 2022 5
background
Driving Motors
with H-Bridges
An Introduction to DC, Stepper, and Brushless Motors
Motor
Control
Source: shutterstock.com
The circuits shown in this article are intended to illustrate the individ- can press momentary switch S2 to engage relays K3 and K2. Then
ual sections and serve as starting points for your own designs, not current will flow into the negative terminal of the motor and out of
as finished designs that you can copy directly. First, let’s look at a the positive terminal, and the motor will run backwards. Note that
simple DC motor. In this case, it is a motor with a rated operating you should never press both momentary switches (S1 and S2) at the
voltage of 3 V to 6 V and a maximum operating current of 1 A. Motors same time. If relays K1 and K2 or relays K3 and K4 were engaged at
of this sort are included in many starter kits, such as the Basic Kit the same time, a large short-circuit current would flow through the
for Raspberry Pi Pico [1] (Figure 1). In the latter case, the supply relays and could damage them severely.
voltage is 5 V, as provided by a standard USB port. Some starter
kits also include a stepper motor or offer it as a low-cost additional From Slow to Fast
purchase. The 28BYJ-48 [2] (Figure 2), which can be powered from Using the H-bridge, we can now control the rotation direction of
5 V, is a common type. the motor. However, we are not yet able to control the motor speed.
Switching relays under load, especially with DC, considerably short-
Forwards and Backwards ens their life expectancy. In addition to the drawback of shortened
Let’s look at the circuit shown in Figure 3. Relay K1 acts as a switch lifetime with a large number of switching cycles, relays are neither
to power the motor on or off. The relay is controlled by momen- compact nor energy-efficient.
tary switch S1, so that the current required by the motor only flows
through the relay, not through the switch. Diode D1 is a snubber The first logical improvement is to use semiconductor devices. Let’s
diode and is there to prevent voltage spikes over the relay coil when look at a layout with NPN and PNP transistors. Figure 5 shows the
the switch opens. modified circuit diagram. Here the relays have been replaced by a
pair of PNP transistors (T1 and T3) and a pair of NPN transistors (T2
When momentary switch S1 is pressed, the relay K1 engages and the and T4). The drive circuitry has also changed. Now switch S1 pulls
motor M1 can start running. When momentary switch S1 is released, the bases of T1 and T2 to ground through the current-limiting resis-
the relay drops out and the motor is no longer supplied with power. tors R1 and R2 when the switch is closed, or ties them to the supply
The windings of DC motors can also generate voltage spikes, the voltage through R5 when the switch is open. Switch S2 performs
same as relay coils. Here diode D2 acts as a snubber diode for the the same actions for transistors T3 and T4.
motor to prevent the motor from generating an undesirable voltage
spike when it is switched off. With this circuit it is only possible to In the quiescent state of the circuit with switches S1 and S2 open,
run the motor in the forward direction. But what if you also want to the supply voltage is applied to resistors R1 to R4 through resistors
run the motor backwards (e.g., to drive a winch)? Then you have to R5 and R6. This means that transistors T1 and T3 are cut off and
modify the circuit so the motor can run backwards. therefore have very high impedance (in the megohm range). By
contrast, transistors T2 and T4 are driven into conduction by their
An H-bridge is a good option for this. An example is shown in Figure 4. base currents and therefore have low impedance. As a result, both
The name is based on the structure in the circuit diagram. The motor ends of the motor are connected to ground and no current flows
is connected in the middle of the H. If you press momentary switch through the motor.
S1 (motor forwards), then relays K1 and K4 will engage to allow
current to flow into the positive terminal of the motor and out of What happens now if switch S1 is closed and switch S2 is open?
the negative terminal. If you want the motor to run backwards, you Then resistors R1 and R2 will be tied to ground, so transistor T2 will
S1 S1 S2
ON FWD BWD
D1 K1
D1 K1 D3 D5 K3 D7
M1
D2
M1
M
D2 K2 D4 D6 K4 D8
210491-005
no longer have any base current because the base and emitter are motor needs to be operated with a higher voltage or the MCU can
at the same potential. Transistor T1, by contrast, will be conducting only tolerate 3.3 V on its I/O pins (as with the Raspberry Pi), the
because current can flow from the emitter to the base. As a result, circuit has to be modified a bit.
the positive supply voltage is applied to one terminal of the motor
while the other terminal is tied to ground, so the motor can start The result is shown in Figure 7 with two additional transistors (T5
running. If switch S1 is open and switch S2 is closed, then transistor and T6) driven by the PWM signals through base resistors. Thanks to
T3 will be conducting and transistor T4 will be cut off. In this case these transistors, it is possible to use MCUs that operate with a supply
the motor also starts running, but in the other direction. voltage lower than the voltage for the DC motor. Here it should be
noted that the PWM signals are now inverted. If a voltage is applied
But what if you want to be able to control the motor speed, for example to transistor T5 or T6, this transistor is driven into conduction and
using a microcontroller? Instead of the switches, you can use two pulls the inputs of transistors T2 and T1 or transistors T3 and T4 to
pins of a microcontroller. These are marked PWM_A and PWM_B ground. This must be taken into account in the drive signals from the
in Figure 6. If you want the motor to run forwards or backwards, MCU, since forwards and backwards are swapped now.
you simply have to set these pins High or Low as appropriate. If you
also want to control the speed, you can use pulse width modulation There are drawbacks to using PNP and NPN transistors in this appli-
(PWM). This way the speed is determined by the duty cycle (the cation. They need base currents, which means they consume energy,
On time relative to the period) of the PWM signal, and the direc- and the frequency of the PWM signal is limited. Switching between
tion depends on whether a pulse waveform is output on PWM_A the high-impedance and low-impedance states is not instantaneous,
or PWM_B. This layout is designed for a 5 V supply voltage, so the so there are switching losses. Furthermore, at the moment when T1
outputs of the MCU must be able to handle 5 V signal levels. If the and T2 or T3 and T4 change states, there is a brief interval in which
+5V
R5 R6
T1 T3
D3 D5
R1 R3
M1
M
T2 D4 D6 T4
PWM_A R2 R4 PWM_B
210491-010
Figure 5: H-bridge with NPN and PNP transistors. Figure 6: Driving with PWM signals from an MCU.
R5 R6
T1 T3
D3 D5
R1 R3
M1
M
T2 D4 D6 T4
R2 R4
T5 T6
PWM_A R7 R8 PWM_B
210491-009
both transistors of the pair are conducting. This allows a higher between the gate and the source must also be taken into account.
current to flow directly from the supply voltage to ground. This also If this voltage is exceeded, the FET will be damaged. With an NMOS
increases the power dissipation and can even lead to early failure. FET, the voltage on the gate must be more positive than the voltage
on the source to drive the FET into conduction. For T2 and T4, this
H-Bridges with FETs means that they are in the high-impedance state when the gate is
To avoid some of the drawbacks of bipolar transistors, a good choice pulled to ground, and they start to conduct when a positive voltage
is to use field effect transistors (FETs). They can achieve higher (relative to ground in this case) is applied to the gate.
switching frequencies and have lower power dissipation. All of the
H-bridges described above have the problem that the transistors can Diodes D4 to D6 are still present in Figure 8, but they are not needed
generate transient short-circuit currents, and this problem needs to when FETs are used because the body diodes of the FETs serve the
be eliminated. The H-bridge shown in Figure 8 is therefore built with same purpose. The FET symbol in Figure 9 for T1–T4 clearly shows
FETs that can be driven individually. the body diode as a component of the FET structure. This means
that diodes D4 to D6 can be omitted, resulting in the circuit diagram
Here T1 and T3 are PMOS FETs, while T2 and T4 are NMOS FETs. in Figure 10.
With a PMOS FET, the FET is cut off (high impedance) when the
voltage difference between the gate and the source is close to zero. If you only have a 5 V supply, couldn’t you simply connect PWM_A
In order to drive a PMOS FET into conduction (low impedance), to !PWM_A and PWM_B to !PWM_B? In theory, this is possible,
the voltage on the gate must be more negative than the voltage on but it would lead to even worse transient short-circuit currents than
the source. For T1 and T3, this means that when the gate is pulled with bipolar transistors. As a mental experiment, let’s suppose that
to ground, the FET conducts. The maximum permissible voltage PWM_A and !PWM_A are connected. With 5 V applied to T1 and
+5V
T1 S S T3
PWM_A D3 D5 PWM_B
G G
M1
D D
M
T2 D D T4
D4 D6
PWM_A PWM_B
G G
S S
210491-001
S S
PWM_A T1 T3 PWM_B
counterparts. This means higher power dissipation, especially with
G G
relatively high currents. Figure 11 shows a circuit with two half-bridge
driver ICs (ON Semiconductor NCP5901B) and a layout with four
M1
D D
M
NMOS FETs. There are no blocking capacitors in the circuit diagram;
D D
T2 T4
capacitors C1 and C2 are part of the charge pump of the NCP5901B.
PWM_A PWM_B
G G But why does the half-bridge driver IC need a charge pump? Here T1
S S
and T3 are NMOS FETs, which as previously described need a gate
voltage higher than the source voltage in order to start conducting. In
210491-002
the case of T1 and T3, this means that the voltage on the gate must be
higher than the supply voltage of the H-bridge. A charge pump is used
Figure 10: Circuit diagram without snubbing diodes.
to achieve this. Figure 12 shows the internal functional block diagram
of the half-bridge driver IC. There you can see the dead time gener-
ation function to prevent shot-through, which is labelled ‘Anti-Cross
Conduction’.
+5V +5V
C1 T1 D D T3 C2
G G
NCP5901 NCP5901
M1
1 8 8 1
PWM_A BST DRVH S S DRVH BST PWM_B
2 7 M 7 2
PWM IC1 SW SW IC2 PWM
3 6 6 3
EN GND T2 D D T4 GND EN
4 5 5 4
EN_A VCC FLAG DRVL DRVL FLAG VCC EN_B
G G
9 9
S S
210491-003
Figure 12: Internal block diagram of the ON Semiconductor Figure 13: L298N module as a dual H-bridge.
NCP5901B (source: ON Semiconductor).
Stepper Motors, Step by Step inside there is a rotor, consisting of permanent magnets and toothed
As the name says, stepper motors do not simply run, but instead rings made of soft iron. The rotor consists of a set of windings arranged
move in incremental parts of a full rotation. They are not intended so that the rotor always move one step at a time.
for high speeds in continuous operation, but they can perform incre-
mental motion with high torque. In most households, stepper motors In terms of drive, the most common stepper motors have two poles.
are most likely to be found in ink-jet printers. There they are used to Other pole counts are also possible, but are not considered here. In
move the print head or transport the paper. A stepper motor operates terms of structure, there are two types of this sort of stepper motor:
with a defined step size (increment of a full rotation), so it is very unipolar and bipolar. We will look at these below.
easy to calculate the exact position of the print head. Some of us
may also remember the sound of stepper motors in diskette drives, Unipolar Stepper Motors
where they were used to move the read/write head. As an example of a stepper motor, here we use the 28BYJ-48 shown
in Figure 2, which can be found in many starter kits. This small
But how do you drive a stepper motor, and why does it move in unipolar stepper motor additionally has a gear unit with a 63.68395:1
steps? Stepper motors are available in various forms: reluctance reduction ratio. The motor has a step size of 11.25°, so the number
stepper motors, permanent magnet stepper motors, and hybrid of steps for a full rotation of the gear unit output shaft is 2037.8864,
stepper motors. Here we consider hybrid stepper motors, which or approximately 2038 steps per rotation (rounded up). Five wires
have become established in many applications because of their good are needed to connect the motor: A, B, C, D, and the supply voltage.
torque characteristics and large number of steps per rotation.
Driving a unipolar stepper motor is very easy, and with a motor of
Figure 16 shows the structure of this kind of stepper motor. On the this size this can be done with a ULN2003, available from a variety
of manufacturers. The ULN2003 contains seven Darlington transis- sizes defined by the National Electrical Manufactures Association
tors, as shown in the block diagram in Figure 17. Snubber diodes are (NEMA). NEMA 17-03, for instance, designates the size of a type of
also integrated in the IC, making it quite suitable for driving inductive stepper motor that is produced and/or sold by a variety of compa-
loads. Figure 18 shows a circuit with a ULN2003, which can be used nies. The NEMA17-03 stepper motor from Joy-IT [5] is one example
to drive a 28BYJ-48 stepper motor. In addition to full step mode, the (Figure 19). A ULN2003 is not sufficient to drive this type of stepper
28BYJ-48 can be operated in half-step mode. According to the data motor, which requires two H bridges in the drive circuit. An L298N,
sheet, this is the recommended drive method. The sequence of the as previously mentioned for DC motors, provides two H-bridges in
drive signals for clockwise rotation is listed in Table 1. To make a step a single package and is used as a stepper motor driver in the circuit
in the backwards direction, you have to run through the sequence in Figure 20. As these H-bridges are made with bipolar transistors,
in reverse. Unipolar stepper motors have become rare now because snubber diodes are required at the outputs. The sequence in Table 2
they can deliver only about half as much torque as a bipolar stepper must be performed to generate one step in the clockwise direction.
motor of the same size. However, this is offset by the very simple
driver stage with a ULN2003. If you want, you can modify a 28BYJ- Unlike unipolar stepper motors, in this case the complete winding
48 stepper motor for bipolar operation. To learn how, read jangeox’s is used, instead of only half with a centre tap. This enables higher
blog post [4]. Then the stepper motor will be able to generate more torque than with a unipolar stepper motor of the same size. Driving
torque, but it will need a different driver. with H-bridges is very easy, and highly integrated drivers such as
the MP6500 from MPS or the TMC2300-LA from Trinamic make this
Bipolar Stepper Motors even easier. They contain part of the control logic that performs the
Bipolar stepper motors, which are installed in most 3D printers, have step sequences. The MCU only specifies the desired direction (clock-
only four leads. For these stepper motors there are standardised wise or anti-clockwise) and supplies a pulse for each desired step.
M
Red
ULN2003 9
Pink
CD+
Orange
1 16
Pink I1 O1
2 15
Orange I2 O2
Yellow
3
I3
IC1 O3
14 M1
4 13 M
Blue I4 O4
5 12
I5 O5
6 11
I6 O6 Yellow
7 10
I7 O7 Blue
GND
8
210491-007
The nice thing about stepper motors is that they have high torque rotor are possible: internal and external. Some brushless motors have
and do not need any brushes or commutators to carry the current integrated Hall sensors to determine the position of the rotor; motors
to the rotor, as with DC motors. with only three leads do not have this form of feedback. They require a
bit more complicated circuitry and more computation. For sensorless
Brushless DC Motors types of brushless DC motors, the AVR444 application note [6] is a good
If you combine the properties of a DC motor with the torque and low starting point for learning more about the subject.
maintenance of a stepper motor, you get a brushless DC motor. Brush-
less DC motors are ideal for drive tasks in a wide variety of applications. Figure 21 shows the structure of a brushless DC motor with an
In conventional DC motors, brushes provide a path for current to flow external rotor. In this case the external rotor is a permanent magnet.
into the rotor windings. With every rotation, these brushes wear and Inside the rotor there are six windings arranged in three pairs. Each
distribute conductive dust inside the motor, so the brushes of DC motors pair is wound such that one winding forms the north pole and the
must be replaced at regular intervals and the motors may need to be other the south pole when current flows through them. The poles
cleaned. Brushless DC motors do not need this sort of maintenance, and of the rotor tend to align with a pair of windings in which current is
they deliver high torque in a small package. However, driving brushless flowing. Figure 22 shows how the rotor is pulled by the magnetic
DC motors is complicated, and faulty drive can lead to damage. For field of the windings, causing it to rotate. However, only one of the
this reason, here we only give a very brief introduction to the theory of three pairs of windings is used at a time, so there is room for improve-
driving brushless DC motors. ment. When winding pair A is attracting the permanent magnet in
the first step, winding pair C can be used to repel the permanent
The structure of a brushless DC motor is very similar to that of a stepper magnet. In this way two windings contribute to the rotary motion,
motor. It has a stator (the non-moving part) and a rotor. Two types of increasing the torque and therefore the performance of the motor.
A B C D
1. 1 1 0 0
2. 0 1 1 0
3. 0 0 1 1
4. 1 0 0 1
9 4 D1 D3 D5 D7
5V VS
5
A A
7
B B
10 IC1 M1
C C Q1 2
12
D D
Q2 3 b a
6 M
INH1 13
11 Q3 c d
INH2 14
L298N Q4
1
SENSE1
15
SENSE2
D2 D4 D6 D8
R1 R2
GND
8
210491-006
Figure 20: L294N as a stepper motor driver. Figure 21: Structure of a brushless DC motor.
Figure 23 shows the rotation with two driven windings. The drive marked in Figure 23. If a voltage is applied between A and B, the voltage
signals must have the right timing. between the two windings can be sensed over winding C. At the point
in time when a voltage is applied between A and B, a timer is started
The windings are driven by three half-bridges. You have already learned and the voltage on winding C is monitored. When the voltage reaches
about these in the section on DC motors. The circuit in Figure 24 shows half the supply voltage of the motor, the rotor has travelled half of the
the theoretical layout of these three half-bridges, which are also available rotation distance between two winding pairs. This time can then be
as ICs from various manufacturers. In order to drive the motor, suitable used to calculate when the next windings should be driven and with
signals must be supplied to the inputs A, B and C. The NCP5901B has which polarity. As a result, the permanent magnet is kept in motion by
a voltage divider at each input, which biases the input pin to 2.0 V when the rotating magnetic field.
it is not being driven by the MCU. In the range between 1.3 V and 2.7 V,
the NCP5901B switches to diode emulation, which means free-wheel- The speed of the motor can be controlled by PWM signals, which must
ing mode, so the winding is not connected to ground or to the supply be applied accordingly to inputs A, B and C of the driver IC. The hardware
voltage of the motor. This allows the back electromotive force (BEMF) used in application note AVR444 is the ATAVRMC100 evaluation kit,
to be measured later in order to determine the rotor position. whose description and schematics can be found on the Microchip web
page [7]. More information is also available in application note AN1946
Assuming that the rotor is rotating and no Hall sensors are installed in from ST [8] and application note AN12435 from NXP [9]. Driving brush-
the motor, the BEMF of the non-driven winding can be utilised. This less DC motors requires a bit more software than with stepper motors
allows the position of the rotor to be determined, or more precisely the or simple DC motors. Rotor position detection, internal signal filtering
point in time when the rotor has travelled far enough that it is positioned and signal conditioning by the software make driving less intuitive than
between two winding pairs. The three winding pairs A, B and C are with conventional DC motors.
Figure 23: The rotor is driven by two of the three winding pairs.
C1 T1 D
R1
G
NCP5901
1 8
BST DRVH S
2 7
A R2
PWM IC1 SW
3 6
EN GND T2 D
4 5
VCC FLAG DRVL
they are for stepper motors, motors with brushes or brushless motors. +5V +12V ADC_B
You do not necessarily need to build them with discrete components; for
relatively small motors and low currents, you can use ready-made ICs C2 T3 D
M1 A
if available. Driving brushless motors is more difficult, and you should R3
B C
consider whether you want to acquire experience in building control-
G
NCP5901
1 8
lers for brushless motors or would instead be satisfied with ready-made BST DRVH S
2 7
B PWM IC2 SW
210491-01 S
R5
Translation: Kenneth Cox NCP5901
G
C R6
PWM IC3 SW
3 6
EN GND T6 D
4 5
VCC FLAG DRVL
Questions or Comments?
G
9
210491-008
RELATED PRODUCTS
> Geekcreit 5pcs 5V Stepper Motor with ULN2003 Driver > Cytron 10Amp 7-30 V DC Motor Driver Shield for Arduino
Board Dupont Cable (SKU 19783) (SKU 19063)
www.elektor.com/19783 www.elektor.com/19063
> Cytron 3Amp 4-16 V DC Motor Driver (2 Channels) > E-book: Power Electronics in Motor Drives (SKU 18517)
(SKU 18999) www.elektor.com/18517
www.elektor.com/18999
> Book: Motors for Makers (SKU 18194)
> Cytron 25Amp 7-58 V High Voltage DC Motor Driver www.elektor.com/18194
(SKU 19062)
www.elektor.com/19062
WEB LINKS
[1] Basic Kit for the Raspberry Pi Pico: https://www.elektor.com/basic-kit-for-raspberry-pi-pico-pico-included
[2] 28BYJ-48 stepper motor: https://www.elektor.com/geekcreit-5pcs-5v-stepper-motor-with-uln2003-driver-board-dupont-cable
[3] Cytron H-bridge motor driver boards: https://www.elektor.com/catalogsearch/result/?q=cytron%20driver
[4] Jangeox blog: http://www.jangeox.be/2013/10/change-unipolar-28byj-48-to-bipolar.html
[5] Joy-IT NEMA 17-03: https://joy-it.net/en/products/NEMA17-03
[6] Microchip AN AVR444: https://www.microchip.com/en-us/application-notes/an8012
[7] ATAVRMC100 Hardware User Guide: https://ww1.microchip.com/downloads/en/DeviceDoc/doc7551.pdf
[8] STM AN1946: https://www.st.com/resource/en/application_note/cd00020086-sensorless-bldc-motor-control-and-bemf-
sampling-methods-with--st7mc-stmicroelectronics.pdf
[9] NXP Semiconductors AN12435: https://www.nxp.com/docs/en/application-note/AN12435.pdf
The Team
Our Approach, Preferred Tools, and More
By Jens Nickel (Editor in Chief) uncover all the details of a project, includ-
ing the source code, whether it was a new
There are many electronics magazines around project from one of our engineers or it was
the world, but most of them just report on new from an enthusiastic reader’s home lab.
Why has this been Elektor’s approach? Our
developments and applications. Elektor is different. reasoning is clear. We want our readers
With our in-house Elektor Lab team of engineers, to be able to build the same projects, and
we are constantly developing, refining, and testing we invite them to modify, improve, and
expand everything we publish. Whether
electronic projects and products. you are a professional engineer or a
weekend maker, we want you to under-
stand how everything works. So, it is not
For six decades, Elektor magazine has electronics workbench for soldering, reverse an overstatement to say that Elektor has
featured a healthy mixture of theory and engineering, programming, and tinkering. been one of the long-time leaders in the
practice. It is in our DNA. It all started Elektor also maintains a useable electron- open-source movement!
more than 60 years ago with electronics ics workspace in its HQ that is stocked with
enthusiast Bob van der Horst who was handy lab equipment, components, and Most Elektor readers and community
bored by dry datasheets and theoretical engineering tools. Lab team members can members will also recognize that there is
articles full of formulas and diagrams. pop into the workspace at any time to test no strict line between our Lab engineers and
Instead, he wanted to publish a magazine designs or collaborate on projects. editorial team. All the engineers in the Lab
with circuits that readers could build and (Clemens Valens, Luc Lemmens, Mathias
modify [1]. From those early days, most The actual team comprises engineers of Claussen, and Ton Giesberts) are writing
of the circuits and projects were built and various ages, backgrounds, and personali- articles, and all the editors including me and
tested before they were published in Elektor ties. From the very beginning, the Lab has Content Director C. J. Abate also have fun
magazine. And as a result, the Elektor Lab included analog guys interested fiddling contributing ideas and input to Lab projects.
quickly became famous. The work of the around for months on big circuits as well
Elektor Lab continues to this day. Curious as programming enthusiasts interested As we kick off 2022, we encourage everyone
about the status of the Elektor Lab in 2022? contributing fresh ideas. To put it simply, to get to know the Elektor Lab team. On
Read on and join us! we have a diverse crew. these pages, you will find a short presenta-
tion about the Elektor Lab team members
What Is the Elektor Lab? Some magazines only report about kits or and some of the platforms and tools that we
The Elektor Lab is both a location and a new products. Not Elektor! We do much use. We invite you to contribute your ideas,
team. Each Elektor Lab member has a home more. We have always endeavored to feedback, projects, and articles!
Based in
Germany
Based in
France
Clemens Valens is an engineer who manages the Elektor Mathias Claußen started as a trained IT systems electronics
Labs online platform. He holds a BSc in Electronics and an MSc in technician and earned a BSc in Electrical and Information
Electronics and Information Technology. Clemens started working Engineering and a MSc in Microelectronic Systems. After this,
for Elektor in 2008 as Editor in Chief of Elektor France, and he has he worked as a project engineer for embedded development
also worked as an editor for Elektor UK/US and ElektorMagazine. and focused on ARM Cortex-M-based architectures and real-
com. Later, Clemens was head of Elektor’s design labs in the time operating systems. Mathias joined Elektor in 2018 as part
Netherlands, Germany, and India. Today, he is Elektor’s creative of the Elektor Lab team focusing mainly on software. Today, it is
technologist responsible for the Elektor Labs community website more than just software development in the background. Mathias
where electronics enthusiasts can publish their work and interact writes articles about hardware and software development, creates
with peers from all over the world. Besides contributing own videos for Elektor TV, and more. Want to learn about his home
projects and other articles to the magazine, he is also producing workspace? You can read about it online at Elektor [2]. You can
regular videos for Elektor TV and moderating webinars. His main see some of the instruments and tools Mathias is using for many
interests are sound generation and signal processing. daily tasks there.
Based in
Netherla the
nds
Luc Lemmens started working Ton Giesberts started
for Elektor in March 1990 after his working at Elektuur (now called
studies at the Technical University Elektor) after his studies when
the
Based in nds Eindhoven. At the time, he also they looked for someone with an
Netherla published Elex, an electronics affinity for audio. Over the years,
magazine aimed primarily at the he has worked mainly on audio
novice electronics hobbyist. Luc projects. Analog design has
designed and edited projects always been his preference. Of
for both magazines. He has course, projects in other fields
many interests, which means of electronics are part of the
that he knows a little about a job. One of Ton’s mottos is:
lot of topics in electronics. Of “If you want to have it done
course, he has also written or better, do it yourself.” For
edited software in a wide range example, a PCB design: for
of programming languages — and, especially in his early days an audio project with distortion
at Elektor, in assembly language. Nowadays, he usually limits figures on the order of 0.001%, a good layout is
himself to the Arduino IDE, which is perfect for most simple crucial!
projects. Over the years, Luc has also written and translated
technical text and even Elektor books. In his spare time, Luc likes
to play with pinball machines, especially repairing and restoring
both modern electronic machines and electromechanical ones
(with relays and stepper units).
In contrast to a lot of other magazines, articles and other and critical feedback! You also have the chance to get
interesting content does not flow one-way from Elektor to you. It backers for your project (please see the Elektor Jumpstarter
also goes the other way around. We encourage our growing textbox). On the Elektor Labs platform, ideas and questions
worldwide community of engineers and makers to contribute are welcome!
ideas, tutorials, tips and tricks, circuits and projects.
2) You can send your article/project to the editorial team
Can you teach others about a certain subdomain of by mail: [email protected]. You don’t have to have a
electronics or software? Have you developed a nice ready-made article text, but a circuit diagram and a short
electronics project? Do you have special area of technical description is a must to let us know what you have in the
expertise? Our readers may be very interested in that. works. Of course, we will not uncover any details of your
project without your ok!
There are 2 ways to share tips, tutorials and projects:
Elektor editors and Lab team members review all the
1) You post something on Elektor Labs (see Elektor Labs contributions during our weekly internal meetings. If we
textbox). Here you can immediately get in touch with other select your article to be published in print or online, we will
readers, maybe on the other side of the globe, to get positive let you know, and we will discuss the next steps with you.
Elektor Jumpstarter
www.elektor-labs.com
Elektor @ GitHub
Elektor loves open-source solutions, so the Elektor Lab team
members tend to use open-source tools. One example is
KiCad, which we use (besides Altium and Eagle) to design
schematics and PCBs. KiCad is free to use, open-source and
runs on all three major operating system. This enables you
to share your work with others so that they can also adapt or
modify your creation as needed.
You can find online articles and videos about KiCad at the
Elektor site: www.elektormagazine.com/tags/kicad
Elektor PCBs
Elektor readers are used to finding green drawings of (mostly
small) PCBs in the magazine. As a service for many years, The Elektor Lab uses the Elektor Labs platform (www.
almost all these PCBs were available in our Store for people elektormagazine.com/labs) to host its own projects and
who wanted to find and solder the components themselves. projects from external authors. You will find the files (software
From most of these naked PCBs, we only sold a few pieces, and hardware) required for the projects there.
and these figures have even decreased in the last years. We
have to face the fact that the electronics world is changing. It For larger projects that are continuously developed,
makes no sense to develop a microcontroller or a small audio managing the different versions can become confusing.
amplifier board (just to name two examples) from scratch This is where GitHub comes in, which brings a version
and produce it in small quantities for (too) high prices. Today, management system so you can easily revert to a specific
makers and professionals alike are used (and are even state or track changes made. GitHub also offers several other
expecting) to getting inexpensive modules with at least the advantages, such as experimental alternate versions, issue
most important components — as SMD blocking capacitors trackers for suggestions and comments, or community-
or pull-up resistors — already integrated. Time is money, so supplied patches in the form of pull requests.
most electronic developers want out-of-the-box prototyping
solutions. They expect to open the box, connect everything, Therefore, we will offer more and more software and also
and start working. CAD data for download on GitHub (https://github.com/
ElektorLabs). The corresponding web link can be found at the
However, this doesn’t mean that we do not sell any PCBs end of each project article.
or kits anymore! We focus on the most promising and
interesting projects, where we really invented something For GitHub beginners, Clemens Valens from the Elektor Lab
original which can’t be ordered for a few bucks everywhere. has created a video tutorial at on Elektor TV:
For these projects, we have set up collaborations with www.youtube.com/watch?v=X5e3xQBeqf8.
partners who are experienced at producing small and
also larger quantities when needed. Two of these partners
are Eurocircuits and SIMAC (Joy-IT).
WEB LINKS
[1] “Elektor @ 60”, ElektorMag May/June 2021 : http://www.elektormagazine.de/210025-01
[2] “An Elektor Engineer’s Workspace for Embedded Software Development”, Elektormagazine.com: https://www.elektormagazine.
com/articles/elektor-workspace-embedded-software-development
[3] 6-digit Nixie Clock: https://www.elektormagazine.com/magazine/elektor-146/58526
[4] Pinball Clock: https://www.elektormagazine.com/magazine/elektor-88/42431
[5] Weather Station with ESP32: https://www.elektormagazine.com/magazine/elektor-70/42351
[6] Audio DAC for Raspberry Pi: https://www.elektormagazine.com/magazine/elektor-201707/40496
[7] DIY LiPo Supercharger Kit: https://www.elektormagazine.nl/labs/diy-lipo-supercharger-kit-by-greatscott
[8] New LCR Meter 50 Hz - 2 MHz: https://www.elektormagazine.com/magazine/elektor-159/59096
Advertisement
•E
r lab lekto
to
r la
Ele
b
TESTED
ab
Ele
Raspberry Pi as a
to
rl
to
k
r la
b • Ele k
provision of virtual disks, so that a computer can not only The Pi-KVM Alternative
be controlled and maintained remotely, but a complete There is remote maintenance software, isn’t
reinstallation is possible. there? If you are using a Raspberry Pi or
a PC, you will surely have used a tool like
VNC, AnyDesk or TeamViewer. Besides
During the pandemic, I received information through dozens of installation steps with a these, there are quite a few other solutions
that my parents still had computers running mixture of phone call and video chat can for remote maintenance and control. All these
Windows 7 (some were even Windows XP) easily imagine that such a thing is not a good solutions are inexpensive or even free of
at their house. Because of the security gaps, idea for an operating system installation and charge for the private user. To help someone
which can no longer be fixed, these computers data backup. Remote access is what’s needed. set up new software or create social media
urgently needed to be updated. Unfortunately, And that’s exactly what is made possible with posts, something like this is a quick and easy
an update was not enough for these machines. a Raspberry Pi as a KVM remote control. solution. However, these helpers all require
They required a complete reinstallation, but a running operating system with an Internet
driving there was not an option, because of At this point in the text, you can replace connection.
the pandemic and more than eight hours of parents with customers, computers with
driving time. machine controls, and new installation with But what if the computer no longer boots or
error analysis. A pair of eyes with which one can no longer establish a network connec-
Anyone who has ever tried to guide someone can look at a system remotely, independent tion? Or if the operating system has to be
Virtual Disks
Something that gets complicated over Figure 3: Error message at boot.
longer distances (usually 2 m is enough) is
the insertion of USB bootsticks, or rotating
data media such as DVD or CD. You could
send a bootstick to the PC to be controlled
remotely and hope that someone onsite will
insert it correctly. Pi-KVM offers the option of
virtual disks (i.e., it can emulate a USB stick
or a USB-CD-ROM drive). To do this, you
can simply upload and mount the appropri-
ate disk image via a browser. Figure 6 shows
the virtual disk menu. Currently, CD emula-
tion is limited to ISO files, so they must not
be larger than 2 GB. For ISO files larger than
2 GB (Figure 7), hybrid ISOs must be avail-
able (i.e., those that could also be written to
a USB stick). These can then be used with
the Flash emulation type and appear as USB Figure 4: Error message in the browser with Pi-KVM.
mass storage.
An Affordable, Open-Source The Necessary Hardware HDMI capture dongle can be ordered for a
Solution The hardware needed for the Pi-KVM is quite few Euros from relevant mail-order compa-
Doesn’t something like Pi-KVM already exist? simple: nies. Even though the price of these dongles
The functions provided by a Pi-KVM are also may be tempting, they have some limitations
offered by other devices from other manufac- > A Raspberry Pi Model 4 (2 GB RAM or in terms of stability or supported resolutions.
turers, but usually much more expensive than more) (Figure 10) The HDMI-to-CSI bridge is the more stable
the Pi-KVM solution and with closed-source > One Micro SD card (16 GB and compatible choice.
firmware. With these devices some comfort recommended)
functions are then also subject to an extra > One USB power supply (5 V/3 A) For the connection between the Raspberry
charge. The Pi-KVM comes as an open-source > Optional housing Pi 4 and the computer to be controlled, the
project and can be assembled with common > HDMI to CSI Bridge or USB HDMI USB-C port of the Raspberry Pi 4 is used in
hardware. In the end, you have to budget about Capture Dongle (Figure 11) USB OTG mode. This allows the Raspberry
€100 for the DIY solution. > A USB Y-cable (Figure 12 and Figure 13) Pi 4 to behave like a keyboard, mouse or
mass storage device towards a PC. For
There are two ways to build a Pi-KVM, one While the first three components should be this, the Raspberry Pi 4 is connected to the
with an HDMI-CSI bridge and one with a available or easy to get for most readers, the computer with a USB-A to USB-C cable
USB-HDMI dongle. Figure 8 and Figure 9 last three are a bit more difficult to get. For and would also be supplied with power
show the data flow through the Raspberry Pi 4 the HDMI-to-CSI bridge (Figure 14 shows via this. Since 3 A @ 5 V is required here,
with the respective solution. At this point, we two available variants), on the other hand, you stable operation cannot be guaranteed, so
would like to present the required components have to search a bit for a European source an additional power must be provided by a
and give a few hints about how to build them. or resort to one from the Far East. A USB power supply unit.
Figure 14: Two variants of the HDMI-to- Figure 15: Assembled adapter board. Figure 16: Two robust USB-B sockets.
CSI bridge.
Figure 17: Micro SD card with 16 GB Figure 18: Finished setup with HDMI-to-CSI
memory. Figure 19: Finished setup with HDMI USB dongle.
bridge.
Since the USB-C port is used in OTG mode, you own risk. You can find a component list and Hardware Assembly
could feed 5 V into the Raspberry Pi 4 via the the circuit diagram at the end of the article. If the CSI-to-HDMI bridge is used, it is unfor-
40-pin header. However, these 5 V would then tunately a bit more difficult to find a suitable
also supply power to the computer connected Software Installation case. Either someone has already built such a
to the USB-C port. This is something that quite You can download the Pi-KVM software from case or you have to help yourself with a little
a few computers do not like and acknowledge the developer’s homepage [2]. An SD card FreeCAD and a 3D printer. For this article, the
with malfunctions. One solution is to use a with 16 GB memory (Figure 17) is recom- parts are therefore installed using flying wires.
Y-cable that splits the data and the power supply. mended for the installation. If an HDMI-to-
CSI bridge is used, the Raspberry Pi 4 v2 For the setup with HDMI-to-CSI bridge, you
So that two USB cables do not have to be platform image can be used for the HDMI-to- need a corresponding board and a Raspberry
soldered together to fit, the Elektor Lab has CSI bridge; if a USB-HDMI dongle is used, Pi camera cable. A suitably prepared SD
routed a small circuit board (Figure 15). Two use the HDMI-USB dongle image for the card with the latest image for Pi-KVM must
USB-B sockets (Figure 16) allow one connec- Raspberry Pi 4 v2 platform. be inserted into the Raspberry Pi 4 and the
tion to a power supply and one connection to HDMI-to-CSI bridge connected to the camera
a computer without feeding 5 V backwards. The downloaded file must be unzipped with a port. The USB-Y cable must be connected to
Both sockets have in common that a LED program like 7-Zip and then written to an SD the USB-C port of the Raspberry Pi 4. With
signals the presence of the 5 V bus voltage. card with a tool like the Raspberry Pi Imager. this, the Pi-KVM is ready for use (Figure 18).
The board is available as a KiCAD project and This completes the basic installation and you
can be downloaded from the Elektor GitHub can start assembling the hardware. If you want For the variant with HDMI USB dongle, this
repository [1]. However, the board has not yet to take a look at the source code, you can do must be connected to one of the USB 2.0 ports
been tested extensively, so rebuild at your so in the GitHub repository [3] of the Pi-KVM. of the Raspberry Pi 4B. If you use one of the
RELATED PRODUCTS
WEB LINKS
[1] KiCad files on GitHub: https://github.com/ElektorLabs/200523-Raspberry_Pi_4_with_PiKVM
[2] PiKVM Homepage: https://pikvm.org/
[3] PiKVM Github Repository: https://github.com/pikvm
[4] Mathias Claußen, “Imaging and Video-Streaming with a Raspberry Pi 4,” ElektorMag 9-10/2021:
www.elektormagazine.com/200582-01
R5 R1
C1
100k
1k
100n
K3 USB_A
1
VBUS
2
D–
3
1 2
SHIELD
D+
4
D1 VBUS D– K2 GND
GND D+
USB_B 5
RED
5 4 3
R4 R2 R3
C2 C3
100k
100k
1k
100n 100n
200523-005
Looking for a small and compact sound card for a Raspberry Pi?
Check out the IQaudio Codec Zero, which has a Zero form factor.
Figure 1: IQaudio Codec Zero (Source: Raspberry Pi Foundation). Figure 2: Contents of the IQaudio Codec Zero package.
If you only need a digital sound output via HDMI, you don’t need Zero can be found on the page [1] of the Raspberry Pi Foundation.
a sound card. A sound card becomes interesting if you want to
output analog audio in good quality or if you also want to process IQaudio Codec Zero: Almost Plug & Play
analog signals with the Raspberry Pi. The A and B models of the The IQaudio Codec Zero has an EEPROM according to the
Raspberry Pi still have a 3.5-mm jack connector that can output Raspberry Pi HAT specification, so a Raspberry Pi should automat-
analog audio; however, the quality is not the best and not really ically recognize the board and set it up appropriately. On a
suitable for listening to music. Raspberry Pi 3B+, this works fine; the current Raspberry Pi OS
(32 bit) recognizes the board and sets it up appropriately. Figure 4
The IQaudio Codec Zero (Figure 1) offers an integrated 1.2 W ampli- shows the IQaudio codec in the sound settings. However, there
fier for an 8 Ω speaker, an integrated MEMS microphone and an are still a few steps necessary that are not directly described in
analog AUX input and output with line level. This makes projects the IQaudio Codec Zero manual.
such as a smart speaker, a VoIP phone, or a custom jukebox quite
easy to implement. Figure 2 shows the hardware and the included First, the output volume should be reduced to a minimum. After
mounting hardware. The heart of the IQaudio Codec Zero is the the internal audio codec of the Raspberry Pi has been deactivated
DA7212 from Dialog Semiconductor. Figure 3 shows the blocks and according to the instructions, the IQaudio now remains in the
signal routing within the DA7212. The IC is a 24-bit codec with up system as the default sound card. If a terminal is opened now,
to 96 kHz sample rate. Integrated is a 5-band equalizer as well as an a speaker test can be started with speaker-test -t wav -c 1.
ALC and a noise gate. The documentation for the IQaudio Codec However, the speaker remains mute. It is necessary to adjust a
PiKVM software is a Raspberry Pi 4-powered tool for remotely accessing a PC, server or other
machine over a network connection. We were able to ask the developer of the PiKVM a few
questions about his project.
Figure 1: UI of PiKVM.
The PiKVM software [1] makes it possible to turn a Raspberry Pi 4 — all that is needed on the side of the controlling computer
into an inexpensive remote control for other computers. Locally, is a web browser. The PiKVM project (UI shown in Figure 1) is
the Raspberry Pi is connected to the computer to be controlled. open-source and the cost of the required hardware is less than
It grabs the monitor image and emulates a USB mouse, keyboard €100 for the DIY version, a fraction of commercial products.
and flash drive. The signals are then made accessible via the This raises a few questions that we put to the developer of the
Internet by the PiKVM software [2] running on the Raspberry Pi PiKVM, Maxim Devaev.
Claußen: How did you come up with the idea to start the PiKVM
project?
the Arduino. I also managed to build a virtual CD drive so I could I manned up and wrote to the RFBProto (de facto VNC standard
remotely reinstall an OS on the server. It was a moment when description) and TigerVNC repository maintainer with a proposal:
PiKVM came before most of the existing commercial devices in let’s create new encoding, it would be great for users with low
price and functionality. bandwidth. We discussed details for a long time and finally came
up with a format that suited us all. Then I went to IANA and asked
them to register this new VNC extension. I was worried they would
Claußen: Did you start the PiKVM as a part-time project or hobby? say no, as they already had a registered format with no description,
but they went for it and explained that it was legacy from a propri-
Devaev: It was a pet project of sorts. I enjoyed doing it, humour- etary client. Lo and behold, we’re developing an official TigerVNC
ing my perfectionism. I never thought anyone besides me would patch for a first ever open source H.264 over VNC extension. The
need it until I stumbled upon a similar half-abandoned project on beta version is running smoothly! It might be very new, but some
GitHub (DIY-IPMI). Its author had followed the same route, but VNC clients and servers are already interested in implementing it.
they dropped it on the proof-of-concept stage. I became excited. I
began advertising my project and committing like crazy, solving one The moral of the story is: Don’t be afraid to communicate with other
issue after another, adding more and more features and spending projects, even if they seem monumental. And one other thing: even
thousands of hours on the project. It was great to see how many one person can push forward development of the whole protocol;
people began using my software. I had been developing only small you just have to dream big.
utility scripts or heavy enterprise software before.
A USB dongle is a black box: you have no idea how it works, and Claußen: If someone likes to support your work, what would be
if something goes wrong, you can’t fix it. The bridge, on the other the best way in doing that?
hand, is much more open and almost all video processing is done
by the kernel and my software. Devaev: Besides donations, help is appreciated with things we
can’t handle on our own yet. Some of those problems are outlined
in our GitHub issues [4].
Claußen: The PiKVM is an open-source project that can (currently)
be used free of charge. How is its development financed? You now
seem to work full time on the project. Claußen: Are there any plans to commercialize your work?
Devaev: I would lie if I said I had a long-term vision, a plan and Devaev: Right now my main source of income are donations. I’m
understanding of the market. It all started last year, when I quit often told I could sell a commercial license to the PiKVM software
my job to take a break and to think about my career. I continued with advanced features, but I don’t want to do that for two reasons.
working on PiKVM as a hobby. The community was growing and I Firstly, PiKVM has direct access to the hardware and I wouldn’t trust
thought it would be great if PiKVM became my main job, and I’ve such a thing if it wasn’t open source. Secondly, a paywall would inevi-
seen some open-source projects whose authors made a living at it. tably lead to someone forking your open software and developing
It was a win-win situation: I would be doing what was really inter- pro features for free, getting part of your community to themselves.
esting to me, and users would get high quality software for a small
donation. As a test, I set up Patreon and announced I was accepting The other way to monetize, which will soon become primary, is
donations now, as I was now without a job and ready to improve selling my own hardware (PiKVM v3 HAT) (Figure 5]), you can
PiKVM upon request (in case you needed a certain feature quickly). use instead of that DIY version to get more stability and additional
To my surprise, several months later, I began making some profit. hardware features. But I don’t plan to abandon PiKVM DIY and force
It was way less than my previous salary, but considering I stopped users to buy the v3. I don’t pursue wealth at any cost, just enough
spending money on trips to the office, started getting enough sleep, money to feed me and my cat.
and even lost some weight, it was a fair trade. Users were also happy,
as it could now be half an hour between finding a critical bug and
a fix, and I was adding new features in a matter of days. Claußen: Can you tell us a bit about your hardware, the PiKVM
v3 HAT?
Claußen: How is the community supporting your project besides Devaev: To DIY a PiKVM, you have to use your hands and option-
helping you to afford full-time development? ally a soldering iron. I decided to make it a bit easier for the user, as
Devaev: The first batch should be available in the USA shortly. The
second batch will be available worldwide in autumn 2021.
RELATED PRODUCTS
Claußen: What plans for the PiKVM do you have for the future?
Devaev: We will continue developing both software and hardware. > Raspberry Pi HDMI to CSI-2 Adapter Board (supports up
We plan to implement 1080p 60Hz capture (you can’t do that now to 1080p25fps) (SKU 19707)
due to Pi 4 restrictions) and create a secure solution for cloud access www.elektor.com/19707
for users without an open external IP address.
WEB LINKS
[1] M. Claußen, “Raspberry Pi as a KVM Remote Control”, Elektor 1-2/2022: http://www.elektormagazine.com/200523-01
[2] Pi-KVM Homepage: https://pikvm.org/
[3] Pi-KVM on Discord: https://discord.com/invite/bpmXfz5
[4] Pi-KVM GitHub issues: https://github.com/pikvm/pikvm/issues
[5] Pi-KVM v3 HAT on Kickstarter: https://www.kickstarter.com/projects/mdevaev/pikvm-v3-hat
[6] Elektor Store: http://www.elektor.com
Autonomous Vehicle
with 2D Lidar to
r lab
• Elek
to
r la
k
Ele
b
O R IGINAL
Ele
ab
to
rl
to
k
r la
b • Elek
Lidar is an acronym for light detection and and traffic control towers on airports. 3D lidar ant. An ideal black body cannot be seen by
ranging. Lidar is like radar, except that it uses exists too and is used for instance by planes a lidar as it does not reflect any light at all.
light instead of radio waves. The light source to create three-dimensional renderings of
is a laser. A lidar sends out light pulses and the surface of the earth below them. For this Connecting the Lidar
measures the time it takes for a reflection project, a 2D lidar is used. For my experiments, I used the X4 from
bouncing off a remote object to return to Ydlidar (Figure 2). It features a range of up
the device. As the speed of light is a known Basically, a 2D lidar is nothing more than a to 10 meters and an angular resolution of 0.5°
constant, the distance to the object can be rotating 1D lidar. Instead of rotating both the (for distances up to 50 cm). It has an infrared
calculated from the travel time of the light laser and detector, it is often easier to shine laser with a wavelength of 785 nm. This device
pulse (Figure 1). the light on a rotating mirror. By sending out rotates the laser and detector assembly; it
light pulses periodically 360° can be covered does not use a rotating mirror.
Two-Dimensional Lidar and a distance map with the lidar at the center
Lidar can be one-dimensional (1D), like laser can be created. The X4 lidar outputs distance data as a
distance meters. It can also be two-dimen- continuous serial stream at 128,000 baud.
sional (2D), much like the radars used by ships Note that the reflectivity of objects is import- It is also controlled over this serial link. You
Figure 1: This is how you calculate distances. t is the travel time of the light pulse in Figure 2: The YDLIDAR X4 is a low-cost 2D lidar with
seconds and c is the speed of light in m/s. The factor 0.5 corrects the fact that the pulse more than enough range and precision to make a robot
must travel to the object and back and therefore travels twice the distance. move around without bumping into objects.
Build a Little Robot multiple control surfaces (Figure 7). One of degree. This table is then searched for the
As a next step, I built a simple remote-con- these is a gamepad, which was perfect for my 10-degrees-segment that has the highest
trolled cart on which I mounted the lidar. application. It is really easy to use and it let averaged distance (the width or aperture of
The cart has two motorized wheels in the me control the cart with my phone. 10 degrees is a rather arbitrary value). The
center and a stand-off on either end. I glued center degree of this segment is the direc-
ping-pong balls cut in half to the standoffs A Pathfinding Algorithm tion the cart should take. To achieve this, the
to improve sliding behaviour. Everything is My goal was to program the cart so that cart will turn so that the center degree, the
mounted on a sheet of double-sided copper it would drive around all by itself without direction, moves to zero degrees. We now
FR4 PCB material. The wheels with motors, bumping into objects like furniture and things. have a classic control algorithm that tries to
the motor driver board and the power supply, A popular approach is to let the cart run around minimize an “error” (Figure 8).
a 3S 11.1 V Li-Po battery, are mounted on the and back up or steer away when it comes too
bottom side (Figure 5). The ESP32 module close to an object, but this requires the cart to First Test Run
and the lidar are mounted on the top side make decisions. I wanted something simpler. To my great surprise, on its first run with this
(Figure 6). The plate is grounded and shields There are many examples of simple algorithms simple algorithm the cart managed to move
the ESP32 module from the noisy motors. that result in complex behaviour, for instance through our living room without bumping into
The center of the lidar is in the center of the the way a flock of birds stays together [2], and obstacles (Figure 9). It circled our couch and
mounting plate. The wheel axe too is in the I wanted something like that. passed through narrow passages without diffi-
center. This simple car can spin around and culties. The cart does not have any knowledge
is pretty agile and manoeuvrable. My idea was to make the cart always move of its environment or itself, like its dimensions.
in the direction of the greatest distance as Also, I hadn’t tried to optimize anything. All
Add Remote Control Over reported by the lidar. To avoid making it run parameters like forward- and turning speed
Bluetooth in circles, it only looks forward, in the range and search angle were just set to values that
As a remote control, I used the free and of -90° to +90°. Implementing this rule was I thought might be reasonable.
open-source Dabble library [1], which provides quite easy. For every scan, a table is updated
Bluetooth control for the ESP32 and Arduino with the average distance for each degree. The Bluetooth remote control turned out to be
together with a smartphone app featuring Therefore, the table has 360 entries, one per very handy for confusing the cart or to help
WEB LINKS
[1] Dabble: https://thestempedia.com/product/dabble/
[2] Flocking behavior: https://en.wikipedia.org/wiki/Flocking_(behavior)
[3] ESP32 Arduino sketch for this project: https://github.com/ClemensAtElektor/Lidar-controlled-autonomous-vehicle/
[4] Watch this project on video: https://youtu.be/BmNelv_gR9Q
[5] Lidar-based parking light by Rob Reynolds from SparkFun: https://youtu.be/KRfidalgJx8
The Raspberry Pi Zero with its ARM11 core is now getting a bit long in the tooth, and its
performance for many applications could be described as marginal.
Fortunately, the Raspberry Pi Foundation fairly recently announced a
much anticipated upgrade, the Raspberry Pi Zero 2 W. What does this
latest Raspberry Pi bring to the table?
A Drop-In Replacement specifications can be found in Table 1. Essentially, the quad-core engine
Nothing has changed about the board’s physical and its connectors. from the (five-year-old) Raspberry Pi 3 A/B+ has been shoehorned into
Figure 3 shows a Raspberry Pi Zero W and a Raspberry Pi Zero 2 W, side the Raspberry Pi Zero form factor and runs with a clock speed of 1 GHz.
by side. All accessories and enclosures for the original Pi Zero can still Anyone hoping for a Raspberry Pi 4-based Zero might feel a tinge of disap-
be used with this new board without any issue. As with the Raspberry Pi pointment but no doubt this will appear sometime in a future upgrade.
Zero W, we have two micro-USB ports, the usual 40-pin connector, and
a mini-HDMI output. One of the two USB ports is again a USB OTG to The Raspberry Pi 3A+ uses a BCM2837B0 clocked at 1.4 GHz. In the
which USB accessories can be connected via an adapter — or with which case of the RP3A0, this uses a BCM2710A1 that in the Zero 2 W is
the Raspberry Pi Zero 2 W itself can become a USB device. As usual, a clocked at 1.0 GHz. The lower clock rate reduces energy consumption
micro SD card is used for booting. A higher read speed smoothens the and heat generation. Further optimizations of the energy consump-
Raspberry Pi Zero 2 W’s operation. Figure 4 shows the underside of the tion for the Raspberry-Pi-3-based systems are in the pipeline, as
board which again has no mounted components. Figure 5 shows the Eben Upton revealed during his interview [1]. The use of a SiP from
topside of the Raspberry Pi Zero 2 W, where we can see the wireless the Raspberry Pi 3 series means that there is already a stable and
chips now have shielding, and the SiP labeled RP3A0-AU is the obvious broad software base available for use on the Zero 2 W. SD card
upgrade. The outline of this new SiP is only slightly larger than the one images for the Raspberry Pi 3 will boot on the Zero 2 W without any
fitted to previous Raspberry Pi Zero models. further tweaking.
The RP3A0-AU SiP Some of the important questions I put to Eben were: How has the power
The RP3A0 label on the SiP indicates ‘RP’ for Raspberry Pi, and ‘3’ for consumption changed? Can I still use my previous power supplies?
the SiP generation (i.e., it has a Raspberry Pi 3 at its core). The exact What new features are available and what about its performance?
Figure 4: A view of the underside of the Raspberry Pi Zero 2 W. Figure 5: The Raspberry Pi Zero 2 W component side.
RELATED PRODUCTS
WEB LINKS
[1] M. Claussen, “A Decade of Raspberry Pi: An Interview with Eben Upton,” Elektor Industry 03/2021:
www.elektormagazine.com/210464-01
[2] Web UI frontend for scanner: http://github.com/sbs20/scanservjs
[3] Elektor TV: The Raspberry Pi Zero 2 W
Notes From
the 2021
World Ethical
Electronics Forum
By Priscilla Haring-Kuipers (The Netherlands)
On the November 18, 2021, almost 200 WEEF 2021 Speaker Snapshots > Margot Cooijmans of the Philips
people came together virtually and physi- Let’s take quick look at what some of the Foundation discussed how to provide
cally to be involved in the first World speakers covered at the WEEF 2021 event. health tech to “under serviced regions.”
Ethical Electronics Forum (WEEF), which You can watch all of the WEEF talks online This cannot be done by dumping
was organized by Elektor and Elektronik at Elektor TV [2]. donated tech as this has no lasting
Praxis during productronica 2021 in health effects.
München. Among the speakers and partic- > Professor Dr. Stefan Heinemann
ipants of this industry-driven get- together opened WEEF with his keynote, > Dirk Akemann of SEGGER spoke of a
there was a sense that the time is right to “A Focus on SDGs in Electronics.” In “friendly licensing” approach where
see what we can do to make electronics this excellent talk, he encouraged their products are free to use for
more ethical. In the past decade, more electronic businesses to “do more” private, educational and prototyping
people have been thinking about ethical than the current legislation demands. purposes.
issues in electronics. Many have been He stated that good morals are good
discussing the different facets of our business and not to believe the > Felix Plitzko from AISLER is striv-
industry and applying ethical practices in naysayers. ing to “make hardware less hard” and
their own businesses. Now the time seems promised to make carbon neutral PCB
ripe to share these thoughts and practices > Dr. Paula Palade spoke on how we production available in the future. He
with the industry as a whole and to learn might establish policy around the is currently investigating this together
from each other. design and use of self-driving cars. She with the Frauenhofer institute.[3]
is working on a European project to
F 2021! >
Watch WEE
draft the first guidelines. The Brenner family (Johannes Brenner
and Markus Brenner) joined to talk
> Amir Sherman (Edge Impulse) about how integrating mindfulness at
pointed to the opportunity of using the core of your business, rather than
machine learning in smaller hardware chasing profit, sets you up to take good
to combine real life metrics with care of the people in your organisation.
advanced modelling.
WEB LINKS
[1] WEEF Webpage: https://www.elektormagazine.com/weef
[2] ElektorTV, “World Ethical Electronics Forum 2021”: https://youtu.be/ELpxR6SuLb8
[3] A
ISLER, “AISLER Plans to Ship the First World-Wide Carbon Neutral Circuit Board in 2022,” November 18, 2021:
https://www.elektormagazine.com/news/aisler-plans-to-ship-first-world-wide-carbon-neutral-circuit-board-in-2022
M t r Control M M
M
By Stuart Cording (Elektor) be applied to the windings (Figure 1). The
position of the commutator on the shaft
The electric motor continuously reinvents is critical for ensuring optimal efficiency.
itself to meet new application requirements Ideally, the commutator-brush position,
from electronic toys and home appliances to known as the commutating plane, must
enable the magnetic field generated by the
power tools and electric vehicles. However, rotor windings to be at right angles to the
equally important are the diverse range of stator’s magnetic field. However, during
electronic control solutions that go hand- operation, this plane moves due to distor-
tions in the stator’s magnetic field. For
in-hand with the motor to meet the needs simplicity, a commutating plane is selec-
of such applications. Integration has been ted that provides the highest efficiency at
key, ensuring that the full performance of a specific rotation speed.
the motor can be attained. In the 1970s, the With the motor’s commutation solved
integrated H-bridge revolutionized home mechanically, only speed and direction of
electronics, such as video cassette recorders. rotation need to be implemented electrically.
If only speed adjustment is required, a pulse-
Today, highly optimized microcontrollers with width modulated (PWM) signal together
dedicated motor-control capabilities ensure with a suitably dimensioned power device,
efficient operation using brushless motors. such as a MOSFET, is all that is required
(Figure 2). Most microcontrollers (MCU) also
feature a timer block that, once configured,
can generate a PWM signal without regular
interaction from the processor. An N-chan-
Small permanent magnet brushed DC view, even if they are not the most efficient nel MOSFET as a low-side switch is preferred
motors are found almost everywhere. option on the market. Such motors remain in such cases, as the gate can typically be
Often termed fractional horsepower (FHP) in regular use except for applications requi- driven directly in low-power applications.
motors, the majority sold provide motion ring continuous operation, such as pumps Should high-side switching be needed, an
control in automotive and home appli- and fans, that have moved to more efficient N-channel MOSFET must be used together
ances. Thanks to the increase in comfort brushless motor technology. with a MOSFET driver to generate the requi-
features, cars have augmented their electric red gate voltage [1].
motor-powered features beyond windscreen Controlling Basic Brushed DC
wipers and fans to include electric mirrors, Motors Monitoring Speed and
window openers and sunroofs, doors, and Simple permanent magnet DC motors Controlling Direction
adjustable seats. The DC motors used are construct their stator from a can within For speed control, the control loop used
simple to control, from an electrical point of which typically two magnets are found. requires the current rotation speed of
brake to slow the rotor speed. Speed control ters. These provide feedback on shorts to tely, such MCUs are not well known for their
is again implemented using a PWM signal the supply or ground, open load conditions, math performance. This makes it tricky to
to one or both MOSFETs. However, it should or undervoltage. If desired, speed and direc- implement a PID controller that responds
be noted that there is potential for a short tional control can be switched to control promptly to changes in the speed setpoint
circuit if both high- and low-side MOSFETs via SPI rather than the direction and PWM or load variations. To tackle this, some PIC
are engaged simultaneously. input pins. The risk of an unintentional MCUs feature an integrated PID accelerator
short circuit of the H-bridge is thus elimi- block (Figure 6) with a 35-bit accumula-
Most major silicon vendors offer highly nated, and further protection features, such tor, such as Microchip’s PIC16F1619. Using
integrated H-bridge solutions, simplifying as over-temperature and overcurrent, are the standard s-domain PID controller
its use and offering a host of protection included. Those looking to quickly proto- equation, three constants — K1, K2, and
features and diagnostics. The IFX9201SG type a design can acquire the H-Bridge Kit K3 — are written to the module’s registers
[3] from Infineon is one such device, targe- 2Go [4] that integrates with Infineon’s DAVE before writing the desired setpoint and
ting currents of up to 6 A for motor control software development environment. engaging the PID calculation module. The
in industrial applications. The device can be PID module reduces the number of clock
controlled using general-purpose I/Os and Optimizing the PID Controller cycles required to 9 from around 1,000 for
a PWM signal, allowing motor speed and The selection of an MCU that meets the a software PID on the same MCU [5].
direction control. In parallel, an SPI inter- desired price point for the application can
face provides access to the diagnostic regis- often result in an 8-bit device. Unfortuna- The Advantages of BLDC and
PMSM
While the simplicity of FHP DC motors
is attractive, increasingly other design
factors, such as efficiency, acoustic noise,
and increased power density are pushing
applications towards brushless DC (BLDC)
motors and permanent magnet synchro-
nous motors (PMSM). When driven
optimally, BLDC and PMSM are much more
efficient and, with their electrical windings
in the stator, heat dissipation is simpler.
PIDxSET PIDxK1
Kd
Difference Z0 Multiplier
K1 = K + K T +
p i
T
PIDxIIN
2Kd
PIDxK2 K2 = -K -
+ +
p T
+ +
PIDxZ1 Multiplier Adder Accumulator PIDxOUT
Kd
+
K3 =
PIDxK3 T
PIDxZ2 Multiplier
210523-006-94 KD
Figure 6: The PID block from the PIC16F1619 together with the equations to calculate the three standard constants used. (Source: Microchip Technology)
Sensorless Determination of
Rotor Angle
The next challenge is determining the
position of the rotor to ensure the next
commutation point is output at the correct
moment in time. Many BLDC motors integ- Figure 8: The back-EMF from the open phase can be measured and used to determine
angular rotation, avoiding the need for a Hall or other sensor. (Source: Microchip
rate Hall sensors that indicate the rotor Technology)
angle to a reasonable level of accuracy. The
rising and falling edges of such sensors can
be linked to many MCUs with edge-trigge-
red interrupts, allowing the correct drive of As already stated, sensors add to the cost of While the theory seems simple, the practi-
the motor coils to be implemented simply the bill-of-materials and there may simply cal implementation is exceptionally
in interrupt routines. Such signals can be no place to accommodate them. Like challenging. Firstly, motors do not generate
also be captured into a timer/counter to brushed DC motors, BLDC motors also back-EMF at a standstill, requiring an appro-
determine the rotational speed and feed generate back-EMF. However, in these ach for spinning them up to a speed where
the input of a PID controller. Motor speed devices, this signal can be used to deter- an algorithm has enough back-EMF signal
is also controlled using PWM outputs. So, mine rotor position. As the back-EMF of to measure. Next, the code required to
while the commutation of such motors the undriven phase crosses the zero-cross evaluate the back-EMF data and apply filte-
falls upon the shoulders of the responsible threshold (half of the current supply ring can have a significant execution time.
development engineer, the approach is not voltage), the rotor angle can be determined This can mean switching between different
that different from using their brushed DC by measuring the time between these algorithms and commutation approaches
counterparts. zero-crossing events (Figure 8). as the motor changes between lower and
1 Shunt
Trigger Trigger
Phase SIN sin Generator
0 Generation
Timer COS cos
= + *T
PWM
Ia
Id Coordinate
Trans- 3 Phase Input AD Ib
Calculation formation 2 Phase Correction Converter
n (Rotating Conversion Ic
Iq Coordinates)
Angular Velocity Estimation 210562-009-94 KD
Figure 9: Highly integrated motor control modules, such as Toshiba’s Advanced Vector Engine Plus, enable quasi-autonomous permanent magnet motor
control. (Source: Toshiba Electronics Europe)
higher speeds. Suppliers of intelligent BLDC module that is tightly coupled with the
motor control solutions have solved many PWM and ADC modules (Figure 9). Inside
of these issues, enabling a new motor to be the A-VE+ module, the complete three-
attached and ‘learned’ by attaching it to a With so much phase to two-phase and reverse Clarke/
motor controller with little input required Park transformations are implemented
from the design engineer. complexity, leaders in hardware, requiring only a PI control-
in motor control are ler and angular velocity estimation in
Implementing Sinusoidal Motor software and some housekeeping. The rest
Control focusing on simplifying of the time, the modules operate together
PMSM motor control algorithms have their solutions so quasi-autonomously.
an additional layer of complexity. These
demand that the PWMs of the MCU are that developers can Driving Innovation in Motor
modulated continuously to generate concentrate on creating Control
a sinusoidal output that energizes the With so much complexity, leaders in motor
motor windings. Such control approaches differentiating features control are focusing on simplifying their
use field-oriented control (FOC), using the in their applications. solutions so that developers can concen-
three-phase windings’ currents to deter- trate on creating differentiating features
mine the current rotor angle. Using Clarke/ in their applications. According to Jonas
Park transformations, this control method P. Proeger, Director Business Manage-
aims to maintain a 90° angle between the ment at Trinamic, now part of Analog
rotor and stator magnetic fields at all times, manufacturers have developed dedicated Devices (Figure 10), the core themes they
thus achieving maximum torque at all hardware modules that automate much see revolve around improving efficiency,
times. of the complexity. One family of devices reducing noise, and increasing intelligence.
are the TXZ4A+ MCUs from Toshiba [6]. Efficiency improvements are needed to
While such complexity can be imple- These Arm® Cortex®-M4 devices feature support the growing raft of battery-operated
mented in software on some MCUs, many an Advanced Vector Engine Plus (A-VE+) autonomous vehicles, such as Autonomous
Questions or Comments?
bipolar stepper motor [8]. The resultant Do you have technical questions or
reduction in ripple current also lowers the comments about this article? Email the
power dissipation in the motor. The final author at [email protected].
growth area is in intelligent motors, where
industrial installations require ‘self-aware’
motors. Such motor solutions contribute Contributors
to the growing use of artificial intelligence Design and text: Stuart Cording
at the system level by delivering real-time Editing: C. J. Abate
data from the very edge of the factory floor. Illustrations: Patrick Wielders
Layout: Giel Dols, Harmen Heida
Power Is Nothing Without
Control
It is easy to develop the perception that
Figure 10: Jonas P. Proeger, Director Business everything is moving to BLDC and PMSM
Management at Trinamic, now part of Analog
motors. However, this is not the case.
Devices. (Source: Analog Devices)
There remain plenty of applications
where traditional FHP DC motors remain
fit for purpose. And, with the wealth of
H-bridge motor drivers and low-end MCUs
Mobile Robots (AMR), used in logistics. with clever peripherals on offer, it is clear
The motors used are also changing, with that the semiconductor industry still sees
higher power densities and weight savings plenty of potential too. However, as appli-
resulting in lower inductance motors. As a cations target ever-higher efficiencies,
result, the motor control algorithms have move to battery operation, or require close
to change with the control loops opera- to silent operation, engineers will need to
ting at up to 100 kHz. Devices such as their get to grips with BLDC and PMSM. While
TMC4671 [7] achieve this using dedicated many of the techniques used to control
hardware, displacing alternative approa- DC motors still apply, there are plenty of
ches requiring DSP or FPGA performance. pitfalls surrounding the finer aspects of
the controller implementation. A sound
Silent operation is another growing requi- basis in the theory remains helpful and
rement, offering a perception of higher enables motor control solutions to be
quality compared to alternative products debugged. But, to save time, it makes sense
RELATED
with their grinding motors and gearboxes. to draw upon the experience of experts in
PRODUCTS
Here Jonas highlights their stealthChop this dynamic field and review the highly
technology that uses a voltage-control- integrated silicon solutions the market > E-book: Power Electronics in Motor
led chopping technique to reduce audible has to offer. Drives (SKU 18517)
noise by up to 10 dB in conjunction with a 210562-01 www.elektor.com/18517
WEBLINKS
[1] C. Valens, “How to Choose Between High-side and Low-side Switching,” Elektor, August 2019: https://bit.ly/3H38uA5
[2] “Understanding PID Control, Part 1: What Is PID Control?,” The MathWorks, Inc., May 2018: https://bit.ly/3CZfcor
[3] Infineon IFX9201SG Product Page: https://bit.ly/3CZfEmD
[4] Infineon H-Bridge Kit 2GO Product Page: https://bit.ly/3ww91FZ
[5] D. Hou, “PID Control on PIC16F161X by using a PID Peripheral,” Microchip Technology Inc., 2015: https://bit.ly/3DbGCHy
[6] Toshiba TXZ4A+ Series MCUs: https://bit.ly/3bXUSId
[7] Trinamic TMC4671 Product Page: https://bit.ly/3bWO2CA
[8] B. Dwersteg, “stealthChop Performance (qualitative),” TRINAMIC Motion Control GmbH & Co. KG, February 2018:
https://bit.ly/3CZgxvt
Large
Electric Motors
Basic Principles and
Useful Information
Motor
Control
By Dr Thomas Scherer (Elektor)
Electric motors come in all shapes and sizes and have found use in a vast range of
applications for many decades. With the foreseeable widespread replacement of internal
combustion engines by electric drive trains in vehicles, electric motors will soon be seen as
the primary way to create mechanical motion. That alone makes them worth a closer look.
Electric motors can be found wherever electrical energy is to be Motor Types and Some Rules of Thumb
turned into mechanical energy of whatever kind. They have many As mentioned above, this article will not look a lower-power motors,
advantages over internal combustion engines and other non-elec- in particular the types of motor (shaded-pole, capacitor-run, stepper
trical methods for producing mechanical energy such as water and servo motors) that are commonest at lower power levels. We
mills and windmills. Principal among these are small footprint, will also not consider linear motors, although they are commonly
low weight, long service life and high efficiency. In larger machines, used in hard disk drives for head positioning, and, at rather higher
efficiency can be considerably more than 90%. The tiniest examples power, in other types of actuator. High-power linear motors (in the
can be found in luxury non-mechanical watches. At power levels up megawatt range) are also outside our scope: their military appli-
to 100 W, we find the conventional ‘universal’ motors, and special cations (e.g., in railguns) to accelerate projectiles require highly
variants such as stepper motors, servos, shaded-pole motors, small specific drive techniques, and we will not delve into this exotic
synchronous and induction motors and the increasingly popular subject.
brushless DC (BLDC) motors are widely found. An article by Mathias
Claussen elsewhere in this issue of Elektor [1] describes how to drive Instead we will confine ourselves to the four types of motor listed in
smaller motors, and my article from three years ago [2] discusses Table 1. In practice these cover more than 90% of application cases
motor drive techniques in general. Below we will be concentrating at power levels from under 1 kW to tens or hundreds of megawatts.
primarily on the principles behind the larger motors increasingly In principle each motor type could equally well be made in small or
found not just in appliances (e.g., vacuum cleaners and washing large versions, but because of their different electrical and mechan-
machines), but also in electric vehicles and, most importantly, in ical characteristics, each is differently suited to particular appli-
industry (e.g., in machine tools). cation areas, with considerable differences between each type.
From this simple motor design we can derive practically all other become not only costly, but also very large and heavy. In the classical
motor types. If the permanent magnet of the stator is replaced by universal motor the field winding in the stator is connected in series
a winding (creating another electromagnet) then the resulting with the rotor winding, forming what is known as a series-wound
design is known as a ‘universal’ motor. If the motor is equipped motor. The main advantage of the series-wound universal motor
with multiple phases, then we can build induction, synchronous over the less widely used shunt-wound motor (not illustrated),
and BLDC motors which employ an electrically-generated rotat- where the stator winding is connected in parallel with the rotor
ing field. The simple motor has poor coasting properties when no winding, is that it has a very high starting torque.
voltage is applied, since the field lines of the permanent magnets
always give rise to a braking effect. Separately excited motors exhibit Both variants can be operated either from DC or AC supplies.
this problem to a lesser degree. Designs optimized for AC operation at high rotational speeds
use a core for the stator and rotor consisting of a stack of metal
The various principal characteristics of these motor types are sheets isolated from one another in order to reduce losses due to
shown (in idealized form) in Figure 2, including a comparison with eddy currents and hysteresis. Changing the polarity of the applied
current designs for internal combustion engines. The contrasting voltage during operation does not affect the direction of rotation in
behaviours of torque as a function of rotational speed are particu- either design. To achieve this, it is necessary to reverse the polar-
larly noteworthy. This comparison is far from exhaustive, and all the ity of either the stator winding or the rotor winding, but not both
various characteristics have a significant influence on the suitabil- simultaneously.
ity of various types of motor in different application scenarios.
Larger universal motors (in the kilowatt range) have a high starting
The Universal Motor current, and so, in order to protect the motor itself (and to prevent
Figure 3 shows the universal motor, invented over 117 years ago, its fuses from blowing!) a start-up controller is used. In the simplest
which is the closest design variant to the simple motor shown in case this initially powers the motor via a series resistor to reduce
Figure 1. Here we simply replace the permanent magnet by a further the inrush current. After a short period of time, or when a certain
winding which acts as an electromagnet. The advantages of the rotational speed is reached, power is applied directly to the motor
universal motor show themselves most in high power designs, connections. Not only must the value of the series resistor be chosen
where the permanent magnets required in the simpler design according to the particular operating conditions, but also its load
rating must be sufficient to cope with the integral of the current
curve over the start-up period. The required start-up resistor can
end up being rather physically large, and special constructions, or
even devices such as liquid rheostats, can be used. For very large
Figure 3: Principle of operation universal motors a single resistor is not sufficient: instead, several
and construction of a universal resistors are used in series. As the rotational speed reaches a series
motor, where the permanent of thresholds, these resistors are short-circuited one by one. The
magnet of a simple motor is
replaced by an electromagnet.
simplest form of start-up protection controller is the time delay
(Modifications from Figure 1: shown in Figure 4. More intelligent approaches measure the
Dr. Thomas Scherer) rotational speed, shorting the protection resistors as required,
possibly in conjunction with slowly raising the operating voltage
gradually using an electronic controller.
amount that depends on the load. Like the other types, this kind The torque-versus-speed characteristic is also superior. If a PWM
of motor can be operated as a generator. Synchronous motors are controller is added, the no-load rotational speed can be adjusted by
made with multiple poles to give a more steady torque over each changing the mark-space ratio of the control signals. If the PWM
rotation; here also the number of poles is inversely proportional signal is regulated using the supply current as a reference signal,
to rotational speed. the current will correlate very linearly with torque at a given load
and speed.
The big advantage of the synchronous motor is hinted at by its
name: it is possible to achieve very precise, constant and load-in- Both types of motor, over a wide range of power ratings, are used in
dependent rotational speed without a controller. Since, unlike in fixed machines. BLDC motors are in general better suited to vehicle
a universal motor, the slip rings are unbroken and the excitation drive trains because of the possibility of building commutator-free
energy is relatively small, the carbon brushes experience very little solutions and because of the sophisticated degree of control that is
wear. If permanent magnets are used in the rotor then it is possible available. A special variant is the ‘wheel hub motor’ (see Figure 12)
to construct extremely robust motors in small form factors. One which is frequently used in electric bicycles and other low-to-me-
disadvantage is that it can be relatively difficult to start the motor: dium power drive applications. These motors feature an external
for this reason larger synchronous motors sometimes include an rotor assembly, usually fitted with permanent magnets. The large
extra rotor winding that is short-circuited, so that the motor can number of poles results in a low rotational speed and high torque.
be brought up to speed as if it were an induction motor. At start-up Torque is constant as a function of rotational position and reliability
the same protection techniques can (and, in some cases, must) be is excellent. However, for higher-power applications, the necessary
used as in the case of the induction motor, including the protection permanent magnets are both expensive and heavy. A wheel hub
features offered by modern variable frequency drives. motor therefore represents a considerable unsprung mass, which
impairs ride comfort. It is for this reason that electric vehicles more
The rotating field in the stator windings of a synchronous motor can usually employ high-speed and compact induction motors which
be generated by driving the windings from a DC power source using drive the wheels via flexible couplings.
three half-bridge drivers, rather than from a three-phase AC power
supply (see Figure 11). The half-bridge drivers are electronically Moreover...
controlled to create the three-phase waveform, just like in a variable Even though electric motors are in widespread use and seem likely
frequency drive. The result is called a brushless DC (or BLDC) motor. to supersede all other motor technologies, there are still a few things
In this case we need a sensor to detect the angular position of the to be aware of when using them. Today’s electric motor designs
rotor, and we use this information to clock the half-bridge driver are very refined and there does not seem to be scope for further
circuit. This forms a quasi-synchronous motor that autonomously significant innovation. However, there will doubtless be many
creates its own rotating field and whose rotational speed depends evolutionary optimizations: these will come not only from improve-
on the supply voltage and on the load. In contrast to the univer- ments to existing materials and to construction and manufac-
sal motor the construction is straightforward, and if permanent turing technology, but also, most importantly, from intelligent
magnets are used then the motor is practically maintenance-free. electronic control. Power semiconductors are improving all the
WEB LINKS
[1] M. Claussen, ‘Motor Drive using H-Bridges’, Elektor January/February 2022: https://www.elektormagazine.com/210491-01
[2] T. Scherer, ‘Electric Motor Control’, Elektor January/February 2019: https://www.elektormagazine.com/magazine/elektor-70/42362
[3] Simple electric motor: https://commons.wikimedia.org/wiki/File:Animation_einer_Gleichstrommaschine.gif
[4] Rotor of a universal motor: https://commons.wikimedia.org/wiki/File:Kommutator_universalmotor_stab.jpg
[5] Cut-away induction motor: https://commons.wikimedia.org/wiki/File:Rotterdam_Ahoy_Europort_2011_(14).JPG
[6] Variable frequency drive: https://commons.wikimedia.org/wiki/File:Small_variable-frequency_drive.jpg
[7] The market for electric motors: https://www.grandviewresearch.com/industry-analysis/electric-motor-market
[8] Ranking of electric motor manufacturers: https://blog.technavio.com/blog/top-20-electric-motor-companies
Amongst other things, the revision 2 suffers from insomnia — that is, Purchasers of dev kits based on the ESP32-C3 should be supplied
it draws a high level of power in deep sleep mode, and the USB/JTAG with the latest rev.3 version of the chip, as can be read in the forum
serial adapter in the chip doesn’t function. The more recent revision 3 entry at ESP32.com [4]. The preliminary rev.2 buggy version was only
version should have these problems resolved, as I noted on Twitter [3]. fitted to a limited numbers of the first dev kits supplied.
The Espressif ESP-IDF repository supporting the ESP32-C3 is also The ESP32-C3 DevKitC-02
a work in progress and may contain bugs. Since Arduino support is First, we will take a look at the ESP32-C3 and the DevKitC-02 (Figure 1).
based on it, any bugs will migrate onto this platform too. At the time The ESP32-C3 chip is effectively a successor to the Espressif ESP8266
I am writing this article, the Development Release of the Arduino microchip. Like the ESP8266, it also uses a single core processor
Support Package will need to be installed in the Arduino IDE you are which can be clocked at up to 160 MHz and has a 2.4-GHz BGN Wi-Fi
running. To do this, enter the following link under Preference in the communications chip with full TCP/IP stack implementation. But the
Additional Boards Manager URLs: similarities with the ESP8266 end there. The ESP32-C3 includes many
WEB LINKS
[1] @ElektorMathias on Twitter: https://twitter.com/ElektorMathias/status/1386623477604626433
[2] Elektor lab notes June 2021: www.elektormagazine.com/news/elektor-lab-notes-june-2021
[3] Tweet about USB Serial / JTAG support on ESP32-C3: https://twitter.com/ElektorMathias/status/1392475706647584776
[4] Forum Thread concerning ESP32 C3 revisions: https://esp32.com/viewtopic.php?t=21040
[5] Wikipedia - Cadence Tensilica Products: https://en.wikipedia.org/wiki/Tensilica
[6] ESP32 C3 DevKitC-02 circuit diagram:
https://dl.espressif.com/dl/schematics/SCH_ESP32-C3-DEVKITC-02_V1_1_20210126A.pdf
[7] ESP32 Data uploader for Arduino IDE (patched version): https://github.com/lorol/arduino-esp32fs-plugin/releases
[8] ESP32 Data uploader for Arduino IDE: https://github.com/me-no-dev/arduino-esp32fs-plugin
[9] Github Repository Mini NTP Server with GPS: https://github.com/ElektorLabs/180662-mini-NTP-ESP32
[10] Mini NTP Server with GPS at the Elektor Lab: www.elektormagazine.com/labs/mini-ntp-server-with-gps
[11] Materials for this article: https://bit.ly/3CD6iNs
void setup() {
Serial.begin(115200);
}
void loop() {
delay(5000);
Serial.println(“esp_chip_info()”);
Serial.println(“----------------------------------------------------------------”);
esp_chip_info_t info;
esp_chip_info(&info);
Serial.print(“Chip Model: “);
switch(info.model){
case 1:{
Serial.println(“ESP32”);
}break;
case 2:{
Serial.println(“ESP32-S2”);
}break;
case 4:{
Serial.println(“ESP32-S3”);
}break;
case 5:{
Serial.println(“ESP32-C3”);
}break;
case 6:{
Serial.println(“ESP32-H2”);
} break;
default:{
Serial.print(“Unknown Chipmodel”);
Serial.println(info.model);
}
}
Serial.print(“Featues :”);
if(info.features&CHIP_FEATURE_EMB_FLASH){
Serial.print(“ Embedded Flash “);
}
if(info.features&CHIP_FEATURE_WIFI_BGN){
Serial.print(“ WiFi(BGN) “);
}
if(info.features&CHIP_FEATURE_BLE){
Serial.print(“ BLE “);
}
if(info.features&CHIP_FEATURE_BT){
Serial.print(“ BT CLassic “);
}
if(info.features&CHIP_FEATURE_IEEE802154){
Serial.print(“ IEEE802.155.4 “);
}
Serial.println(“”);
Serial.print(“Cores: “);
Serial.println(info.cores);
Serial.print(“Chip Revision: “);
Serial.println(info.revision);
Serial.println(“----------------------------------------------------------------”);
Serial.println();
}
Protect Yourself
and Others!
DIY Master Power Switch for the Lab Bench
X3 X4
D1
1 1
S1 R6
T1 LD1 2 2 390Ω
1N4007 3 3
BC516
4 4
R1 R2 R3 R4 K1
5 5
100k
10k
2k2
820Ω
6 6 1/L1
IC1
1 6 MOC3041M A1
ZD1 C1
S2 TRI2 S
BTA08-600 A2
100µ
A2
BZX55C15
25V
S3 ZC G A1 2/T1
A
TRI1
2 4
G BT169
K
R5
390Ω
200475-002
L N PE
Figure 2: The left part of the circuit, the control box, is powered from the right part, the power switching stage.
Editor’s note: Switching off the N conductor to disconnect from the mains does not make sense in all cases and is also not allowed, since
the energy stored in a switched-off (for example inductive) consumer can in this case not flow away via the N conductor. For this reason,
only a single-pole contactor is shown in the circuit diagram. If you still want to switch off the N conductor, a contactor with a leading/
lagging N contact should be used.
touch everything they can, I wanted to protect switch are housed in a small polycarbonate The Low-Voltage Supply
the bench power supply with a key. Power off case. I chose this enclosure because I already The cable transports the 12-VAC supply
should remain possible in all cases. had it, and because it fits perfectly in my lab. voltage for the control box and its output
signal. The AC voltage is rectified by D1
Specifications I don’t have a reference for the keylock switch and filtered by C1. A 15-V Zener diode (ZD1)
For extra safety, I wanted the control circuit as it was scrounged off something. It should protects against overvoltage.
to be low voltage (12 V) with the power stage be a non-momentary type, lockable in both
galvanically isolated by an optocoupler. All positions. You can refer to [1] for inspiration. The 12-VAC power supply used to be a 12 VDC
this had to be a DIY electronic system, easy to power adapter until its rectifier died. Today
build and repair thanks to the use of standard The power stage is housed in a small DIN it is nothing more than a transformer with
components only. rail enclosure fixed on one of the rails of the Class II insulation. A 12 VDC supply will work
electrical switch board. It is assisted by K1, a too. In this case D1 would serve as a protec-
I could very well have used one of these 230-V, 20-A contactor for off-peak rates. This tion against polarity inversion. C1 provides
commercially available no-volt-release (NVR) allows switching on the bench manually (with filtering. Of course, nothing prevents you from
safety switches as used on machine tools, but ‘s‘ inside K1) in case of failure of the control increasing its value to make the circuit less
I wanted to design it myself and furthermore, circuit (you never know what happens). sensitive to noise and glitches.
I wanted it to fit inside the electrical switch Besides, I had one lying around.
board that I installed in my lab for this reason. Thyristor Memory
The complete circuit is shown in Figure 2. The On state — after pressing the green
A Design in Two Parts The control box is located at some distance pushbutton S3 — is memorized by means
I designed a simple electronic system using from the contactor and its interface, and the of a thyristor (TRI1), which drives Darlington
only standard components (Figure 1). The two are connected by a cable with RJ11-type transistor T1 and optocoupler OK1. The pulse
green and red pushbuttons for switching the plugs on both ends. I used standard Cat 5 produced by the pushbutton through resistor
bench on and off together with the keylock Ethernet cable for this. R1 causes TRI1 to conduct, which will remain
R2
a negative pulse to its gate or by removing its in the datasheet of OK1.
2k2 supply. The latter method was easily imple-
mented with the red Off pushbutton. No Snubber Circuit
A
R5 Using a triac with an inductive load such as
When TRI1 is conducting, the base of T1 is a motor or relay normally requires a protec-
10k
T2 pulled to 0 V and so it conducts too. R3 polar- tive snubber circuit, typically consisting of a
BC557B izes T1, while R2 limits the current flowing low-value RC network placed between the two
through the thyristor. The LED LD1 and the anodes of the triac. This is not needed here
S3 G T3 LED of OK1 both turn on, switching on triac because TRI2 is a so-called snubberless type.
BC547B
TRI2 that in turn activates the power relay.
R4 The current through the LEDs is limited by Your trained eye will have noticed the absence
R4 to about 10 mA. of fuses and circuit breakers. In fact, the power
10k
Figure 5: The power stage is built into a DIN rail module. The black
thing is the RJ11 connector to which the control box is connected.
Figure 4: The insides of the control box. The small
circuit board can be fixed next to the pushbuttons
with a drop of hot glue.
WEB LINKS
[1] Keylock switch examples: https://www.mouser.com/datasheet/2/140/KO-345961.pdf
[2] Design files, datasheets & BoM: https://www.elektormagazine.com/labs/4209
[3] Author‘s website: https://www.pleguen.fr/index.php/securiser-sa-paillasse
S
o far in this series, you’ve learnt how
Figure 2
to customise your GUI with a variety of
different options. It’s now time to get
into the really interactive part and make a GUI
application that actually responds to input from the
user. Who could resist pushing a big red button to Figure 2 You now have a button
generate a super secret spy name?
Laura Sach Since you already know how to create an app, why Underneath the Text widget, but before the app
MAKER
not go ahead and create a basic window and add displays, add a line of code to create a button.
Laura leads the some text if you like? Here is some code to get you
A Level team at started, and this code also includes some comments button = PushButton(app, choose_name,
the Raspberry
Pi Foundation,
(the lines that start with a #) to help you structure text="Tell me!")
creating resources your program:
for students Your code should now look like spy1.py. Run it and
to learn about
# Imports --------------- no button will appear, but you’ll see an error in the
Computer Science.
from guizero import App, Text Shell window:
@CodeBoom
# Functions ------------- NameError: name 'choose_name' is not defined
O’Hanlon # Display --------------- because the order in which the commands are run in
app.display() the program depends entirely on the order in which
Martin works in the user presses the buttons, moves the sliders, ticks
the learning team
Run this code and you should see a window with the the boxes, or interacts with whichever other widgets
at the Raspberry
Pi Foundation, text (Figure 1). you are using. The actual command is almost always
where he creates the name of a function to run.
online courses,
projects, and
Add a button
learning resources.
Let’s go ahead and add a button to the GUI. Add Create a function
PushButton to your list of imports so that you can Let’s write the function choose_name so your button
@martinohanlon
use buttons. (Be careful to use a capital B!) has something it can do when it is pressed.
Look at your program and find the functions
section. This is where you should write all of the
functions which will be attached to GUI widgets, to
keep them separate from the code for displaying the
widget. Add this code in the functions section:
def choose_name():
Figure 1 Displaying
the text in a window
Figure 1 print("Button was pressed")
spy2.py
statement with the actual code for the task you
would like your button to perform.
Inside your choose_name function, type a # symbol
in front of the line of code that prints “Button was > Language: Python 3
pressed”. Programmers call this ‘commenting out’,
and what you have done here is told the computer
001. # Imports ---------------
to treat this line of code as if it were a comment, or 002. from guizero import App, Text, PushButton
in other words you have instructed the computer to 003.
004. # Functions -------------
ignore it. The benefit of commenting a line of code 005.
out instead of just deleting it is so that if you ever 006. # App -------------------
want to use that code again, you can easily make 007. app = App("TOP SECRET")
008.
it part of your program again by removing the # 009. # Widgets ---------------
symbol. 010. title = Text(app, "Push the red button to find out your spy name")
011. button = PushButton(app, choose_name, text="Tell me!")
012.
Add some names 013. # Display ---------------
On a new line, add a list of first names. You can 014. app.display()
choose the names in your list and there can be as
many names as you like, but make sure that each
name is between quotes, and the names are each This tells the program that you would like to use a
separated by a comma. A collection of letters, function called choice which chooses a random item
numbers, and/or punctuation between quotation from a list. Someone else has written the code which
marks is called a string, so we say that each name does this for you, and it is included with Python for
must be a string. you to use.
In your code for the choose_name function, just
first_names = ["Barbara", "Woody", below your lists of names, add a line of code to
"Tiberius", "Smokey", "Jennifer", "Ruby"] choose your spy’s first name, and then concatenate
it together with the last name, with a space in
Now add a list of last names as well: between. Concatenate is a fancy word that means
Now you will need to add a way of choosing a At the moment, your button is not big or red! You used properties in part one
of this tutorial series to change the appearance of your text on the ‘Wanted’
random name from each list to form your spy name.
poster, so can you use the properties of the PushButton widget to change the
Your first job is to add a new import line in your background colour and the text size?
imports section: Note that it may not be possible to change the colour of a button on macOS,
as some versions of the operating system will not allow you to do so, but you
from random import choice should still be able to alter the text size.
spy3.py
Figure 4 Outputting a spy name
> Language: Python 3
‘join two strings together’ and the symbol in Python
001. # Imports ---------------
002. from guizero import App, Text, PushButton
for concatenation is a plus (+).
003. from random import choice
004. spy_name = choice(first_names) + " " +
005. # Functions -------------
006. def choose_name(): choice(last_names)
007. #print("Button was pressed") print(spy_name)
008. first_names = ["Barbara", "Woody", "Tiberius", "Smokey",
"Jennifer", "Ruby"]
009. last_names = ["Spindleshanks", "Mysterioso", "Dungeon", Your code should now resemble spy3.py. Save and
"Catseye", "Darkmeyer", "Flamingobreath"] run it. When you press the button, you should see
010. spy_name = choice(first_names) + " " + choice(last_names)
011. print(spy_name)
that a randomly generated spy name appears in
012. your console or Shell, in the same place where the
013. # App ------------------- original “Button was pressed” message showed up
014. app = App("TOP SECRET")
015. before (Figure 4).
016. # Widgets ---------------
017.
018.
title = Text(app, "Push the red button to find out your spy name")
button = PushButton(app, choose_name, text="Tell me!")
Put the name in the GUI
019. button.bg = "red" That’s good, but wouldn’t it be nicer if the spy name
020. button.text_size = 30 appeared on the GUI? Let’s make another Text
021.
022. # Display ---------------
widget and use it to display the spy name.
023. app.display() In the widgets section, add a new Text widget
which will display the spy name:
Editor's note: This article originally appeared in MagPi magazine. Elektor publishes the Dutch, French, and German editions of MagPi.
£10
for 3 issu
es
You also
recieve
a FREE bo
your chooi k of
ce
From an ap
proved se
lection
www.elektor.com/TW www.elektor.com/Insta
As it remained long unclear if productronica 2021 was €25,000 Elektor marketing budget
going to take place as a real, live tradeshow or not, the Reedu GmbH & Co. KG — Reengineering Education
only way forward was online. Therefore, instead of pitch- aka Reedu aka re:edu from Münster, Germany is known
ing in front of a live jury and audience, the 2021 produc- for senseBox and openSenseMap.
tronica Fast Forward Award candidates from countries SECOND PRIZE www.elektormagazine.com/news/
such as Hungary, Germany, Israel, and France had to reedu-gmbh-co-kg-productronica-fast-forward-2021
record their presentations and submit them online.
Supplementary information about each electronics-re-
lated start-up was provided in the forms of business €15,000 Elektor marketing budget
plans and pitch decks. Pozi Development Ltd — Pozi from Budapest, Hungary
provides full visibility in manufacturing and logistics,
After watching the pre-recorded elevator pitches and and identifies and eliminates lean waste throughout the
studying all the documentation, the productronica Fast THIRD PRIZE entire supply chain.
Forward jury — which included Benjamin Klingenberg www.elektormagazine.com/news/
(NCAB Group, Platinum Sponsor of the event), Elektor pozi-development-ltd-productronica-fast-forward-2021
engineering and editorial representatives — selected
three winning start-ups.
The winning three start-ups were chosen by the jury because of their high commer-
Watch the cial potential and the quality of their teams, two important criteria for a start-up
pFFWD ceremony! to grow into a successful business. Congratulations to the winners!
Motor
Control
Knowing the precise behavior of a servo, particularly when the datasheet is not available, is
fundamental to make sure that the end application will have the expected performance. This
is even more relevant nowadays, with the proliferation of all sorts of servos varying in price,
quality, and performance.
The pulse amplitude, in volts, is usually the same as the servo power
supply; the most common supplies are 4.8 V and 6.0 V, although
nowadays other amplitudes are possible, from 3.7 V up to 14 V and over.
Period
Why a Servo Tester?
While the manufacturer’s datasheet gives all the specifications of the
servo in terms of maximum displacement, speed, dead band, etc., the
Figure 1: Servo control pulses. datasheet is not always available. And this is particularly true for the
wide range of low-cost servos currently available on the market. In
many cases, although some data may be available, testing the actual
performance may give quite different results. At the end of the day,
what matters is the actual performance of the servo you will use, not
in common: they can be controlled by the same electrical signal, for its theoretical behavior.
all practical purposes.
Designing a Servo Tester
This signal consists of pulses, of variable width, spaced by a fixed period A simple servo tester is something very easy to build, and there are
of time (Figure 1). The fixed period is usually 20 milliseconds (ms), plenty of examples on the web. Suffice to say that with a 555 (very
and the pulse width is what effectively controls the servo rotation. The popular integrated circuit) and a few other components, you can create
center position is set at 1500 microseconds (µs) for most servos, while an analog servo tester. However, if you want to measure the servo
the extreme positions could reach up to 500 µs on the lower end and behavior in a precise way, and with visual indication of the pulse being
2500 µs on the upper end. Usually these extremes correspond with sent to control it, a slightly more complex approach is required. One
+3V3
R8 R9
10k
10k
R3 11
A
U3 CAI3461AH
1 150
R11 7
VDD 16 150 B
RC0 R6 4
15 150 C
19 RC1 R4 2
RA0 14 150 D
18 U2 RC2 R1 1
RA1 7 150 E
17 RC3 R5 10
RA2 6 T1 150 F
4 RC4 R10 5
RA3/MCLR 5 150 G
3 RC5 10k 3
RA4/CLKOUT 8 DP DIG1 DIG2 DIG3 DIG4
2 RC6
RA5/CLKIN 9 CC1 CC2 CC3 CC4
RC7
12 9 8 6
U1 Q1
R2
PIC16F1829-I/P
1k 2N3904
13 Q2
RB4/SDA1 R7
12
32MHz RB5/SDA2 1k 2N3904
11 Q4
C5 C6 RB6/SCL1 R13
10
RB7/SCL2 1k 2N3904
VSS Q3
18p 18p C1 R12
20 X1 X2 1k 2N3904
100n
+4V5...6V
D5
1k
U4
J5 3 3 J4
1N4007
C2 C3 C4 Q5
2 2
DC IN OUT
1 10 100n Figure 2: Circuit
1 10V 10V 2N3904 1 schematic diagram.
200491-004
Hardware
The full circuit schematic is shown in Figure 2. The external connec-
tions are shown in the lower part; to the left is the power input (J5 COMPONENT LIST
– DC IN), which can be connected to the ESC of the RC model, or
Resistors Semiconductors
to any power supply capable delivering the required current for the
R1,R3,R4,R5,R6,R10,R11 = 150 Ω D5 = 1N4007
servo under test. The unit uses less than 15 mA, so it will not impose
R2,R7,R12,R13,R14 = 1 kΩ Q1,Q2,Q3,Q4,Q5 = 2N3904
a considerable load to the supply. The voltage can be anything from
R8,R9,R15 = 10 kΩ U2 = PIC16F1829-I/P
4.5 to 6.0 V, depending on the servo requirements.
T1 = 10 k potentiometer U3 = 4-Digit 7-segment CC LED
display 3461AH
Please note: The servo will receive the full voltage supplied by
Capacitors U4 = 3.3 V LDO LP2950-3.3
the power source. Be careful not to exceed the servo maximum
C1,C4 = 100 nF
ratings! To comply with most manufacturers specifications, the center
C2 = 1 µF/10 V radial Miscellaneous
connector is always the +V terminal, while the extremes are GND
C3 = 10 µF/10 V radial U1 = 32 MHz crystal
and SIGNAL.
C5,C6 = 18 pF X1,X2 = switch SPST
The power input only requires two lines, +V and GND, but a 3-terminal
connector has been mounted to receive any standard ESC connec-
tor. On the right side of the schematic is the servo output (J4 – OUT),
with the three lines connected (+V, GND and SIGNAL). This will be
connected to the servo under test.
The top‐mid left shows the microcontroller (U2) and the user interface,
a single potentiometer (T1) and two SPST switches (X1 and X2). The
rotation of the potentiometer will change the pulse duration, while the
switches will select the four operation modes, as shown in this chart
(the various modes will be explained in the software section):
Finally, the top right is U3: the 4‐digit 7‐segment display, with its
required components.
Board Layout
While this hardware can work mounted on a breadboard, a proper PCB
design will make it more durable and reliable. A possible PCB layout Figure 3: Mounted board layout; the potentiometer is J3, and
is presented in Figure 3. The design (NI Multisim) and Gerber files to the switches are J1 and J2.
order the PCB at your preferred supplier are available for download at [1].
These four parameters add huge versatility to the tester, which cannot
be found in any cheap commercial unit. If you mount the microcon-
troller in a socket, you can easily remove, reprogram, and have a new
tester whenever you need it; or, if you are satisfied with one set of
parameters, just keep the same program forever.
Each digit is fully defined within a function (num) and can be selected
using a switch statement; each time this function is called with a
Here we also check the status of the switches to decide if we are in auto Questions or Comments?
mode (SW1 = 0). If so, SW2 will determine the speed of the automatic Do you have technical questions or comments about this article?
sweep (from MIN to MAX and back to MIN continuously): SW2 = 1 Email the editor at [email protected] or contact Elektor
means normal speed (the pulse varies 1 µs at a time) and SW2 = 0 at [email protected].
means high speed (the pulse varies SPD µs at a time). You may recall
that SPD can be any number from 1 to 100; if set to 1, then normal and
high speed will be the same (not very useful indeed).
Finally, main brings all together; besides the initialization of the Analog
to Digital Converter (ADC), TIMER1 and interrupts, the main program RELATED PRODUCTS
loop resides here. This loop will read the ADC (thus the value of the
potentiometer) and set the pulse duration accordingly.
> FeeTech Mini 360 Degree Continuous Rotation Servo
If we are in manual mode (SW1 = 1), then SW2 is evaluated; if “1”, the FS90R (SKU 19784)
low resolution mode is active, and the potentiometer will be able to www.elektor.com/19784
sweep the full range of the pulse width (MIN – MAX). This mode is
called “low resolution” for a simple reason: the ADC can only acquire
1024 different levels, but the pulse width range may be 1400 or more µs,
so it is not possible to achieve a 1 µs resolution within the full range. If
SW2 = 0, then the high resolution mode is enabled. Here the full pulse
width range is limited from 1469 to 1531 µs. The potentiometer can
easily be moved to change 1 µs at a time, which is extremely useful to:
WEB LINK
[1] Software, PCB and 3D-design dowloads: http://www.elektormagazine.com/200491-01
Built around an Espressif NodeMCU board, the module described in the first part of
this series enables you to use the Modbus protocol over a WLAN. This article covers
the software and Modbus module configuration.
In the first part [1] of this article series, we dealt with the project Preparing the Modbus WLAN Module
hardware. The module is built around a NodeMCU board fitted with In order to use the WLAN module with the Modbus protocol, you first
an ESP8266 microcontroller, with an additional baseboard providing have to load the required firmware. For this, remove the NodeMCU
industry-compatible ports. After a brief introduction to the operating board from the Modbus board and connect it to a USB port on your
principle of the Modbus protocol, here we focus on how the module is computer. Then open the Arduino IDE, configured as described in the
controlled and the software used for this purpose. The lift door control- first part of this article. You can download the firmware, which turns
ler from the first part is again used in the example. the module into a Modbus client, from the Elektor project page [3].
For more detailed information and protocol descriptions, visit the “Holding Registers” inputs/outputs
Read/write 16
Modbus website [2]. (analog/digital)
Figure 1: The EasyModbus client reading data from the module. The Linux version is shown on the left, and the Windows version on the right.
Our Python program needs a library [8] in order to access the Modbus. To run the program, enter the command line python tor.py. As usual,
This is nothing unusual; there are Modbus libraries for virtually all you can stop the program with Ctrl-C.
programming languages. If necessary, you can even generate the bit
sequences of the commands yourself and send them over the network. AdvancedHMI
However, we don’t want to go into that here. Convenient remote control with visual feedback that you can adapt
to your own purposes can be realised with a variety of PC frame-
First, you should make sure that the Python package installer pip is works. The program AdvancedHMI is open-source software for creat-
on board, which should always be the case with fairly recent Python ing human-machine interface (HMI) applications that communicate
installations. You can check this with either $ python -m pip – with your PLC or other I/O devices. This software differs from other
version under Linux or C:\> py -m pip –version under Windows. standard packages in that it allows you to create executable files
instead of just configurations that are interpreted by a runtime engine.
If the pip installer is not present, you can install it via Python with This results in very fast and efficient applications.
Get Control
Figure 2: The AdvancedHMI software generates human-machine interface
The Modbus WLAN module makes it easy to control Modbus-compliant
applications.
devices from a PC or a smartphone. This module is also a good learn-
ing project if you want to get the hang of the Modbus protocol. The
hardware design, however, is so robust and error-tolerant that you
can also use it in your own ESP8266 projects if you want to control
and read industrial devices such as solenoid valves, motors, and other
kinds of sensors or actuators.
200507-B-01
RELATED PRODUCT
Questions or Comments?
Do you have any technical questions or comments? If so, please > NodeMCU Module (SKU 17952)
contact the author at [email protected] or the editorial staff at www.elektor.com/17952
[email protected].
Contributors
Idea, Design and Text: Josef Bernhardt, Martin Mohr
Editor: Rolf Gerstendorf
Layout: Giel Dols
WEB LINKS
[1] Modbus over WLAN (Part 1), ElektorMag 9-10/2021: http://www.elektormagazine.de/200507-01
[2] Modbus website: https://modbus.org/
[3] Elektor project page: https://www.elektormagazine.de/200507-B-01
[4] EasyModbus website: https://bit.ly/2QDIDJz
[5] EasyModbus client download: https://bit.ly/3d2zzFp
[6] OpenJDK download: https://bit.ly/2OVK4m6
[7] Lift door model on YouTube: https://youtu.be/VHIBQswdA0E
[8] Modbus library for Python: https://pypi.org/project/pyModbusTCP/#description
[9] get-pip.py: https://bootstrap.pypa.io/get-pip.py
[10] Modbus library examples: https://pymodbustcp.readthedocs.io/en/latest/
[11] AdvancedHMI: https://www.advancedhmi.com/index.php?main_page=page&id=14&chapter=0
[12] More infos by the author: https://bit.ly/3ch1PFl
Understanding the
Neurons in Neural
Networks (Part 3)
Practical Neurons
There have been many predictions regar- markings, and vehicle types and people. or macOS with an integrated or external
ding self-driving cars [1], none of which Now that we have a working neural network camera.
have come to fruition. Much of the comple- in the form of our multilayer perceptron, we
xity arises from attempting to understan- will use it to detect a traffic light’s colors. Finding Your Camera
ding the intent of other road users and Before we can get started, a new library
pedestrians. However, a lot of the autono- One of the great things about the Processing needs to be added to Processing that provi-
mous driving system is about classifying environment we have used thus far is the des access to any attached webcams. From
everything the many sensors and cameras ease with which it can access webcams. The the menu, select Sketch -> Import Library…
‘see’ around the vehicle. This ranges from examples used here will run on just about -> Add Library… (Figure 1), which opens the
traffic lights and road signs, to street or road any laptop or PC running Windows, Linux window shown in Figure 2. Ensuring that
the Libraries tab is selected, enter “video” Video library but has no impact on the be a high R and G value as, together, red
into the search box. From the list that code’s functionality. and green make yellow. To get a better
appears we select Video | GStreamer-based feel for additive color mixing, the project /
video library for Processing and then click How Do Cameras See? trafficlights/addititive/additive.pde may be
on Install. As before, we will be using the Perhaps one of the most important aspects of interest (Figure 5).
code from the GitHub repository prepared of using neural networks is to develop an
for this series of articles [2]. understanding of how a computer can With this knowledge, it would seem to make
interpret the incoming data. In the case sense to determine how our camera “sees”
With the library installed, we can run the of camera input, the computer image is the colors of our traffic light and note the
project /trafficlight/findcamera/findca- displayed by mixing the three primary RGB values it reports. We can then teach
mera.pde. This code simply requests the colors, red, green, and blue. This is our neural network the three traffic light
list of available cameras connected to the commonly termed the RGB format. The colors so that it may classify them as red,
computer and allows the user to select three values vary between 0 and 255 (or amber, and green.
one by entering a number between 0 and 0x00 and 0xFF in hexadecimal). If we
9. Make sure the small findcamera window point the camera at something blue, we Determining RGB Values
has the context (click inside the window) would expect the B value to be relatively The project trafficlight/computer_vision/
before pressing a number. If the Processing high and the other values quite low. Point it computer_vision.pde is the next project
IDE window has context, you will simply at something yellow, and then there should we will need. This displays the selected
end up typing a number somewhere in the
source code.
camera’s output next to the RGB values it is the dashed circle), note the color seen (top) set. Finally, we could improve the incoming
reporting. Using this project, we can record and the RGB values that define it (Figure 6). data from the camera, perhaps by adding
the RGB values the camera sees. Before The RGB values are actually the average of an infrared image of the traffic light (which
starting the code, don’t forget to paste the all the pixels the camera captures in the lamps are hot) or some other clever filte-
line of code you determined in findcamera. center’s red bounding square. Despite being ring. However, don’t despair! We shall add
pde to line 22 in this project. This ensures an average, the RGB values will change up some robustness into our training data to
your chosen camera is used. and down rapidly. To capture a single value, handle some variation in the color of our
press ‘p’ on your keyboard, and the code traffic light input.
While pointing the camera at the red traffic pauses on a single set of values. Be sure to
light (keep the ‘light’ approximately within click inside this window before pressing ‘p’ The critical task at this point is to collect
to give it the context. Pressing ‘s’ restarts the RGB data for the red, amber, and green
the camera capture and RGB generation traffic lights using your camera and your
Table 1: RGB values captured for the again. lighting conditions. The data collected
three traffic light colors. using the author’s setup is shown in Table 1.
The traffic light printout used here was
laminated so there are some reflections Detecting Traffic Lights
Light color R G B in places. If you have printed your traffic Armed with our data, we can now train
Red 220 56 8 light image out using a laser printer, you the neural network the colors of our
may also have a slightly reflective surface. traffic light. For this final stage we will
Amber 216 130 11
As a result, although the camera is pointing need the project trafficlight/tlight_detect/
Green 123 150 128 at the red traffic light, the “Color seen” may tlight_detect.pde open in Processing. Start
be pinkish or even close to white. This is, by ensuring that the correct camera initi-
obviously, not much use for the neural alization code is pasted into line 30 (from
network. It needs to know the color ‘red find_camera.pde).
traffic light’ under optimal conditions, so
move the camera or change the lighting This project uses a three-input, six-hid-
until you feel you have achieved an RGB den, and four-output (3/6/4) node MLP.
value representing the color optimally. The three inputs are for the three colors,
R, G, and B. Three of the four outputs are to
Figure 6: computer_vision.pde provides us with This also raises another issue concerning classify the ‘red,’ ‘amber,’ and ‘green’ of the
the RGB values the camera ‘sees’ for each traffic- accuracy. Drivers will know how difficult traffic light. The fourth will be used later.
light color. it is to discern the active traffic light lamp The use of six hidden nodes was chosen
when the sun is shining into our eyes or arbitrarily as ‘enough’ to handle the classi-
directly into the lamps. If we humans fication task. We will see that this configu-
cannot distinguish which lamp is lit, how ration does work and, as before, readers are
can a neural network figure it out? The encouraged to experiment with fewer or
answer is, it can’t. If we need a more robust more hidden nodes.
algorithm, we need to train it with ‘poor
visibility’ data. We may also need to provide If you run the code ‘as is,’ the neural
another input, such as where the sun is network operates without any learning.
Figure 7: The response of tlight_detect.pde prior shining from, so that the neural network The results (Figure 7) show that any color
to learning any colors. knowns when there is ‘poor visibility’ and is classified as all the colors the network is
that it should use the ‘poor visibility’ data defined to detect.
The teaching of the neural network takes The decision on the color seen is then made
place around line 51. Uncomment the first starting at line 171. The output of each
three methods and add the RGB values you output node is evaluated. If classification
acquired earlier. The three methods used to certainty is above 90% (0.90), the color
define red, amber, and green are: seen is displayed in a circle along with the
classifier ‘Red,’ ‘Amber,’ or ‘Green’.
teachRed(159, 65, 37);
teachAmber(213, 141, 40); // If likelihood of ‘Red’ > 90%...
teachGreen(128, 152, 130); if (network.getOutputNode(0) >
0.90) {
Each time these functions are called, the fill(200, 200, 200);
network is trained to classify that RGB // …write “Red”…
combination as the associated color text("Red", 640+(100), 320);
(Figure 8). To allow for some variation in // … and set color to the
lighting and automatic changes in exposure color seen.
setting by the camera, a small amount of fill(r, g, b);
variation (±4) to the RGB values is applied } else {
using a randomise() function (line 336). // Otherwise, set color to
Again, you can experiment with the effec- black
tiveness of this approach and the amount fill(0, 0, 0);
of randomization applied. }
// Now draw the color seen in a
Training of the network is swift compared circle
to previous projects as we are no longer ellipse(640+(50), 300, 40, 40);
writing the error values during learning Figure 10: Misclassification of other colors as
to a file. Simply run the project and, after a You can experiment with the accuracy ‘green.’
few seconds, the neural network will start of the MLP by pointing the camera at the
evaluating the color in the red bounding different traffic light at different angles and
square of the camera window (Figure 9). under different lighting conditions. Also,
try pointing the camera at objects in your
The traffic light in the view of the camera is vicinity that, in your opinion, approximate
determined on line 156 onwards. The RGB the colors the MLP has learnt.
colors captured are applied to the inputs
of the MLP and the network’s output is One thing you may notice is the misclassifi-
calculated: cation of a wide range of colors as a known
color. In the author’s example, the ‘green’
network.setInputNode(0, (float) r classification is also given for the traffic
/ 255.0); light surround, frame, and overall image
network.setInputNode(1, (float) g background (Figure 10).
/ 255.0);
network.setInputNode(2, (float) b Tightening-Up Neural Network Figure 11: Misclassification of other colors as
/ 255.0); Classification ‘green’ resolved using ‘other’ output node.
network.calculateOutput(); From the RGB values displayed, it is clear
WEB LINKS
[1] M. Anderson, “Surprise! 2020 Is Not the Year for Self-Driving Cars,” IEEE Spectrum, April 2020: http://bit.ly/2ZSwm5f
[2] GitHub repository - simple-neural-network: https://bit.ly/2ZHLv9p
[3] H
. Zhang et al., “StackGAN: Text to Photo-realistic Image Synthesis with Stacked Generative Adversarial Networks,” CVF,
December 2017: https://bit.ly/3qZccCs
Inside an Open-Source
Processor
Sample Chapter: Lattice and Xilinx FPGA Results
Alchitry FPGA development boards mentioned in this article. Left to right: Cu — Au — Au+.
This instalment of Elektor Books presents material excerpted from Monte Dalrymple’s book
Inside an Open-Source Processor published by Elektor. FPGA technology in combination with
(V)HDL is hot among electronicists and RISC-V adds the open-source path to professional
applications In this article, we examine some side-by-side comparisons and results obtained
from an example application running on both Lattice and Xilinx FPGA boards of the
‘Alchitry’ series now available from Elektor. But first, a few tips!
Editor’s Note. This article is an excerpt from the book Inside an described elsewhere in the book) most of the work has already
Open-Source Processor — an Introduction to RISC-V, formatted been done.
and lightly edited to match Elektor Magazine editorial standards
and page layout. Being an extract from a larger publication, some Just be aware that large projects, or projects taking maximum
terms in this article may refer to discussions elsewhere in the origi- advantage of the capabilities of the FPGA, will inevitably be much
nal. The Author and Editor have done their best to preclude such more complex.
instances and are happy to help with queries. Contact details are in
the Questions or Comments? box. In the case of both Lattice and Xilinx, besides selecting the appropri-
ate FPGA target for the project only two or three files will need to be
In the past, setting up a project in an FPGA tool flow was a daunt- linked in the tools. All of the project files need to be in the same direc-
ing task, but as the technology has matured this setup has gotten tory in this simplified approach. As mentioned previously, readers
much simpler. In the case of the example here (a 24-hour clock are strongly encouraged to review the Alchrity tutorials for FPGA
There are even more warnings in the log files for these devices, but The Xilinx tools do not give a separate speed estimate at logic
again, none of them should be important enough to require action. placement, but the reported speed is nearly identical between
logic synthesis and the final result. From the point of view of a
FPGA Results designer, this is preferred.
This example project has been implemented on all three target
FPGA development boards and the individual results will be covered Table 2 shows the resources required for the project as well as
in the following sections. But at this point it is interesting to do a the maximum clock frequency for the CPU itself. These results do
side-by-side comparison of some of the results. Table 1 shows the not include any of the 64-bit counters that are part of the RISC-V
reported clock speed for the 100 MHz divider. Privileged Architecture.
The 100 MHz divider was designed for maximum speed with only The second line of this table demonstrates why comparing FPGA
one level of logic between flip-flops. This means that this result results can be complicated. From the table, it appears that the Xilinx
should represent the capabilities of the technology. implementation requires less than half of the resources required
by the Lattice implementation. But a Xilinx logic element contains
The reported speed for the Lattice device, if true, is impressive. significantly more logic than a Lattice logic element. In addition,
What is most interesting is that the reported speed gets better, the Xilinx design uses the dedicated DSP blocks which the Lattice
and presumably more accurate, as the implementation goes from device does not have.
The speed rows show that all three FPGAs provide roughly the
same performance, which is somewhat surprising given that the
Lattice FPGA does not contain the dedicated DSP blocks that are
used in the Xilinx implementation.
Figure 1: Lattice Floorplanner View (Alchitry Cu).
Alchrity Cu Details
Listing 1 is extracted directly from the Lattice implementation
report, showing the details of the resource utilization. Figure 1 is report is much larger, covering all of the dedicated hardware avail-
taken from a screenshot of the Lattice floorplanner tool, showing able in the FPGA.
the usage of logic elements as distributed across the device. This
distribution is fairly even across the entire device even though the Figure 2 is taken from a screenshot of the Xilinx floorplanner tool,
overall usage is only about 60 percent. showing the usage of logic elements as distributed across the device,
along with how the dedicated logic blocks are distributed through-
Alchrity Au Details out the device. It seems that placement tools always start in the
Listing 2 is extracted directly from the Xilinx implementation lower-left corner of a device. It is not clear why the logic seems to
report, showing details of the resource utilization. The full Xilinx be split into two pieces.
1. Slice Logic
--------------
+-------------------------+------+-------+-----------+-------+
| Site Type | Used | Fixed | Available | Util% |
+-------------------------+------+-------+-----------+-------+
| Slice LUTs | 2189 | 0 | 20800 | 10.52 |
| LUT as Logic | 2189 | 0 | 20800 | 10.52 |
| LUT as Memory | 0 | 0 | 9600 | 0.00 |
| Slice Registers | 1377 | 0 | 41600 | 3.31 |
| Register as Flip Flop | 1377 | 0 | 41600 | 3.31 |
| Register as Latch | 0 | 0 | 41600 | 0.00 |
| F7 Muxes | 3 | 0 | 16300 | 0.02 |
| F8 Muxes | 0 | 0 | 8150 | 0.00 |
+-------------------------+------+-------+-----------+-------+
Hardware Programming
Downloading the FPGA bitstream to an Alchrity development board
is simple when using the Alchrity Loader program. This stand- Labs software available from Alchrity. Figure 4 shows the user
alone program is automatically installed as part of the Alchrity interface for this program.
By default, the program looks for a bitstream file of type .bin, which
is the default used by the iCEcube2 software. The Vivado software
generates a bitstream file of type .bit, so keep that in mind when
loading the Xilinx bitstream file.
210347-01
Figure 4: Alchitry Loader View.
1. Slice Logic
--------------
+-------------------------+------+-------+-----------+-------+
| Site Type | Used | Fixed | Available | Util% |
+-------------------------+------+-------+-----------+-------+
| Slice LUTs | 2185 | 0 | 63400 | 3.45 |
| LUT as Logic | 2185 | 0 | 63400 | 3.45 |
| LUT as Memory | 0 | 0 | 19000 | 0.00 |
| Slice Registers | 1377 | 0 | 126800 | 1.09 |
| Register as Flip Flop | 1377 | 0 | 126800 | 1.09 |
| Register as Latch | 0 | 0 | 126800 | 0.00 |
| F7 Muxes | 3 | 0 | 31700 | <0.01 |
| F8 Muxes | 0 | 0 | 15850 | 0.00 |
+-------------------------+------+-------+-----------+-------+
RELATED
PRODUCTS
Questions or Comments?
Do you have any technical questions or comments related to this > Book: M. Dalrymple, Inside
an Open-Source Processor
article? Then email the author at [email protected] or Elektor
(Elektor 2021) (SKU 19826)
at [email protected]. www.elektor.com/19826
1 We see that we can divide the entire frequency range into four
XC X L 2 fR L regions. The first region is below the resonance frequency — in
2 fR C
1
fR
2 L C
Impedance measurement
Series circuit
Parallel circuit
This formula is valid for both series and parallel resonant circuits.
In Figure 2 you can see the impedance characteristics as a function Inductor Capacitor
of frequency. A series circuit can be used in (among other things!)
a loudspeaker box to attenuate a small frequency range in order
to linearise the overall characteristic of the box. For this purpose,
in most cases, a resistor has to be connected in series with this
series-resonant circuit. Figure 2: Impedance characteristics of series and parallel resonant circuits.
1 0.1125
C
2 2 f Z f Z
Z 0.2251 Z
L
2 f f
(INT0)PD2 1-WIRE
4 2
VCC T1
6 3
VCC BSN20
C3 C4 C5 18 30 K2
100n 100n AVCC (RXD)PD0 RXD
100n 3
31
electronics projects
PB0(ICP1) (AIN1)PD7
13 PB1(OC1A)
1 MOSI L1 MOD1
14 PB2(SS/OC1B) 23
(ADC0)PC0
3
15 24
FERRITE BEAD RXM-433-LR
PB3(MOSI) (ADC1)PC1 LED1
5 16 25
PB4(MISO) (ADC2)PC2 R3 R7 R1 1 16
7 SCK 17 26 NC ANT
9 MISO
all sizes / all levels / all sorts 7
PB5(SCK) (ADC3)PC3
27
2
NC GND
15
220
10k
PB6(XTAL1)
10
(ADC4/SDA)PC4 3 14
8 28 NC NC
X1 PB7(XTAL2) (ADC5/SCL)PC5 4 13
GND NC
8MHz 1 5 12
(INT1)PD3
at www.elektor-labs.com
VCC NC
9 S1 C9 6 11
(T1)PD5 PDN NC
21 7 10
RSSI NC
GND
1 5
IN
www.elektor-labs.com 3
EN
OUT
NC
4
200136-007 KD
design > share > sell R2
100
C6
100n
C7
1µ
GND
2
Err-lectronics
Corrections, Updates and Readers’ Letters
Compiled by Ralf Schmiedel and Jens Nickel (Elektor)
An In-Depth Look at
Mains Transformers
Elektor 09-10/2021, P. 34
(200587)
A connection to earth is missing from the
schematic of the test rig shown on page 35
(see picture).
B4
B1 KBPC3510
F1
Tr1 MGND
AC Motor Drive
K4
1
K2 S1 C1 L
12V 470µ S 2
L P (N)
Elektor 1-2/2020, P. 62 (191142) N
P 50V
O
3
(N)
S2
RE1 2 1
12 V B2
A mistake was found in the DB107
1
The diodes in the bridge rectifier B4 are 1 3 5
R2 4 5W
560
10k
2 4 6 2 3
drawing correct, the four-diode symbol
+5V
should be rotated 180°. The ‘+’ and ‘-‘ sym- T2
STW26NM60N C3
bols on the drawing are correct and the PCB 220n
630V
IC2
is correct also. 1
4 R3 D2
1k
R4 12V R5
10k
1 3 5 ZCross
2k2
1W 2W
3
K3
2 PC817X4J000F
2 4 6
Gate
MGND
150199-11 KD
Dear Mr Derrmann,
Thank you for your detailed information.
You are of course right that we did not
set out to reinvent the wheel. The original
developers of this project deserve great
respect for their fantastic idea and the
work they put into its design. Our com-
pany not only develops its own original
equipment, but also takes great ideas and
tries to build them into a quality finished Questions or Comments?
product for developers and makers at If you have any questions
the most attractive price possible. Our or comments, please let us know.
development department is often You can reach us by email at
responsible for adding the ‘finis- [email protected].
hing touch’ here.
Volker Bode, SiMAC/Joy-IT
210560-01
Color to Sound
How to Read Out a Color Sensor via I2C
By Annika Schlechter (Germany) and
Volker Ziemann (Sweden)
How can a seeing-impaired person select clothes with matching colors Arduino IDE. As a second prerequisite, we need to install python [5],
in the morning? Well, by converting the color information into a sound which is likewise available for all systems. Windows and MAC OS
signal, which is the idea behind this project. The color is converted to binaries can be found on [5] and practically all Linux distributions have
the pitch of a sound and the brightness to its duration. packages in their repositories. Again, follow the instructions for your
system. But, enough of the preliminaries, let’s get started!
Figure 1 shows the schematics of a prototype, with a piezo buzzer
and an ams TCS34725 color sensor mounted on a small breakout The Color Sensor
board [1]. Both are connected to an Arduino Nano. This prototype The heart of this project is the TCS34725 color sensor [6], which
system was developed as part of the course “From Sensor to Report” comprises a 3x4 photo-diode array (Figure 2). Color-sensitive filters
at Uppsala University [2], which teaches basic data-acquisition skills mounted in front of the diodes make them sensitive to red, green, and
including interfacing of sensors and microcontrollers to the outside blue light. Moreover, a clear diode without a filter provides information
world. Therefore, we do not use ready-made libraries to interface the
sensor, but code the basic functions to read out the sensors ourselves.
Moreover, the logic to assign the sounds to the colors initially resides
in a Python script on a laptop, rather than on the microcontroller. The
PC and microcontroller are communicating via a serial interface. We
developed a communication protocol to send sensor values from the
Nano to the PC; commands are going in the other direction to activate
the buzzer with the right frequency. Later, however, we extended the
functionality to allow stand-alone operation on the Nano. Still, this is
not a production-ready system, but a prototype that shows the basic
functionality and invites the reader to experiment further.
about the brightness. The analog signal from the diodes is converted to read out two 8-bit registers and assemble the received bytes to a
to digital form by on-board analog-to-digital converters. The color 16-bit word - following the instructions from the data sheet. This is
information is made available via an I2C interface that connects to shown in the following code snippet for the red color:
a microcontroller using only two wires for the communication, one
for the clock signal (SCL) and one for data (SDA). The color sensor b3=I2Cread(TCS34725,0x16); // raw data, red
is then controlled by writing and reading registers on the device, but b4=I2Cread(TCS34725,0x17);
more on that later on where we describe the software. red=b4*256+b3;
The hardware is assembled on a solder-less breadboard (Figure 3), Here b3 contains the least-significant byte and b4 the most-signif-
pretty much following Figure 1 with the Nano shown on the left-hand icant byte, which we multiply by 256 and add to b3 to obtain the
side and the TCS34725 color sensor on the right. The latter is connected 16-bit variable red. We treat the other colors likewise; only the register
by black and red wires to Ground and the 5 V rail at the bottom. addresses are adapted.
Likewise, the corresponding pins of the Nano are connected to the
power rails. The green and yellow wires connect the data (SDA) and Additionally, we use the brightness reported from the un-filtered diode
clock (SCL) pins to the corresponding pins on the Nano, which are and store it in the variable clea. This will determine the duration d of
situated on A4 and A5, respectively. The blue wire that connects the the sound. If the value of clea is less than 1000, we emit a 0.5 s long
digital output pin D2 to the pin labeled LED on the color sensor allows to tone; and if it is larger, we use 1.5 s.
control a white LED that is mounted on the breakout board. The buzzer
is connected to pin D8 on the Nano. The button that connects pin D3 Now we read the received command and copy the result into a charac-
to ground with the brown wires triggers a conversion when operat- ter array line, so we can use the standard C function strstr() to
ing the Nano in the standalone mode of operation, discussed below. find out which command was sent. The following code snippet illus-
trates this:
This circuit is brought to life by an Arduino sketch that first includes
the wire.h library to provide low-level functions to communicate over Serial.readStringUntil(’\n’).toCharArray(line,30);
the I2C lines. These functions are used right away in our own two if (strstr(line,"color?")==line) {
functions I2Cread() and I2Cwrite(), which encapsulate all commu- Serial.print(clea); Serial.print(" ");
nication with the sensor. Serial.print(red); Serial.print(" ");
Serial.print(green); Serial.print(" ");
I2Cread() is used to readout a sensor value or parameter, stored in
Serial.println(blue);
so-called registers. As parameters, the function gets the address of
} else if (strstr(line,"tone_red")==line) {
the sensor on the I2C bus, here 0x29, and the register address (it took
tone(buzz, 262, d);
us a while to find out that 0x80 has always to be added to the latter).
The function returns the contents of that register. ...
The function I2Cwrite() is used to send commands from the control- We see that the command color? causes the Nano to send the values
ler to the sensor, for example to set configuration values. This function of the four signals clea, red, green, and blue back across the Serial
gets the sensor and register addresses and, additionally, the new value line. If tone_red is received, the built-in tone() command is used to
that should be written to that register. No value (void) is returned activate the piezo buzzer - in that case with the frequency which is
from this function. assigned to the red color. Several equally constructed strstr() blocks
follow and trigger the appropriate actions.
The Application
Let’s return to our specific sketch. In the setup() function, we initialize Note that we use a simple protocol, based on sending character strings
the serial communication, the basic I2C functionality and the sensor back and forth; a request from the laptop is terminated with a question
(via function color_begin()). Inside the loop() function, which is mark, for example “color?”, and the Nano responds by sending the
executed indefinitely, we first check whether any command from the values back. An instruction is based on just sending the command, for
PC has arrived on the serial line. If that is the case, we read the register example, “tone_red", which causes the buzzer to sound with 262 Hz for
contents from the sensor, for all three colors. For one color, we have the duration specified by d. The communication vaguely mimics the
In a third stage, we can make the system portable by using a bare plots were recorded just before Christmas and made us painfully aware
ATmega328, flashed with an Arduino bootloader, connected to the of how short the days can get in Uppsala. Further data acquisition
sensor. Powered from a battery as long as a button is pressed, the projects, following the same spirit, are described in [8].
system starts up and continuously converts color to sound until the 210051-01
button is released to disconnect the battery. The software is also avail-
able from the article’s web page. Building the system is left as an Questions or Comments?
exercise for enthusiastic readers. Do you have technical questions about this article? Please email
the editors at [email protected].
In the “Sensor to Report” course the color sensor was quite popular.
A second student, who wanted to monitor the color of the sky over a
longer time to later analyze the data, used essentially the same setup Contributors
with the Nano communicating with a host computer via the Serial Design and Text: Annika Schlechter, Volker Ziemann
line. She used a python script on a Raspberry Pi to store the data in Editor: Jens Nickel
a MySQL database, also running on the Pi, and later used Octave to Layout: Sylvia Sopamena
prepare plots of the colors that were recorded over about a week. The
WEB LINKS
[1] TCS34725 breakout board: https://www.adafruit.com/product/1334
[2] “Sensor to Report” course: https://ziemann.web.cern.ch/ziemann/teaching/s2r19/
[3] Arduino website: https://www.arduino.cc/
[4] Arduino tutorials: https://www.arduino.cc/en/Tutorial/HomePage
[5] Python website: https://www.python.org/
[6] TCS34725 Color Sensor datasheet: https://ams.com/tcs34725#tab/documents
[7] Software Download: http://www.elektormagazine.de/210051-01
[8] V. Ziemann, A Hands-on Course on Sensors using the Arduino and Raspberry Pi, CRC Press, 2018.
BattLab-One
Measure and Optimize the Battery Life of IoT Devices
Obtaining a consistent measurement of the energy consumed by makes accurate measurements of power consumed over defined
a device running a microcontroller is not a trivial task. As with periods of time. Professional examples of SMUs are manufactured by
any computer chip, power consumption depends heavily on the Keithley and Keysight. The BattLab-One from Bluebird Labs aims to
instantaneous processing load and operational status. It is not fulfill a similar function, but for a price of less than €100. The device
only necessary to consider normal operation and standby or deep (including metal enclosure) is available from the Elektor shop [1].
sleep states, in which the current consumption of common micro-
controllers can vary between less than 1 µA and several hundred Refer to Figure 1 to see the USB type B socket on the left together
milliamps (mA). Some peripherals in the device may also only with a BNC socket that accepts a trigger input signal. On the right
be active at certain times so that current consumption will not are the two 4-mm sockets from which the DUT can be powered.
be constant. A specialized tool like BattLab-One is very useful in Figure 2 shows the plastic collars, which can be unscrewed to allow
this respect and can take this dynamic behaviour into account to croc clips to be attached to the posts. A closer look at the case end
make a reasonably realistic estimate of the operating time of the caps shows a surface texture consistent with 3D printing.
device when powered by different battery types.
BattLab-One is powered from a computer USB port and is able to
What Is BattLab-One? supply devices with a range of supply voltages from 1.2 to 4.5 V
In the field of power consumption measurements, a source measure and currents up to a maximum of 450 mA. The discharge profiles
unit (SMU) is a useful tool to have on the workbench. This type of of frequently used battery types (such as Li-Ion, LiFePO4, alkaline,
power supply provides power to the device under test (DUT) and also NiMh and NiCd technology) are included in the software and used
tamhan@TAMHAN18:~/BattLabonespace/
BattLab-One$ sudo apt install pipenv
tamhan@TAMHAN18:~/BattLabonespace/
BattLab-One$ which python3 Figure 3: PipEnv error message.
/usr/bin/python3
tamhan@TAMHAN18:~/BattLabonespace/BattLab-One$ pipenv
install --dev --python /usr/bin/python3
Now let’s consider the process of creating a virtualenv for this project.
The software issues warnings (Figure 3) when the commands are Unfortunately, Bluebird Labs does not comply with the setup tools
entered. The virtual environment is therefore activated according specification but explicitly includes a library that is only available
to the following scheme. It will remain active like a normal venv in a few versions of the setup tools. The .py file must be edited to
environment until the terminal window is closed: remove the following statement:
Execution of the three .py files with the software is now possible (BattLab-One-CK7P-15V) tamhan@TAMHAN18:~/
using to the following method: BattLabonespace/BattLab-One$ python
BattLab-Release_V1.2.1.py
(BattLab-One-CK7P-15V) tamhan@TAMHAN18:~/ . . .
BattLabonespace/BattLab-One$ python3 _tkinter.TclError: error reading bitmap file "icons\
BattLab-Release_V1.2.1.py bbirdlogo.xbm"
Traceback (most recent call last):
The solution is to modify the TK-Inter-GUI by removing the line:
File "BattLab-Release_V1.2.1.py", line 59, in
<module>
root.iconbitmap(bitmap=GetIconPath())
import pkg_resources.py2_warn
ModuleNotFoundError: No module named ’pkg_resources.
to remove the program icon. On this occasion you can adjust the
py2_warn’ file path using:
provided under [3]. The ZIP archive includes, among other things,
img = PhotoImage(file=’/home/tamhan/BattLabonespace/ the SOC_profiles subfolder, which contains the various battery
BattLab-One/icons/bbirdlogo_png1.png’) profiles in tabular form. You will need to unzip the archive.
The next attempt to execute it shows that the TK-Inter environment When BattLab-Release_V1.2.3.exe file is executed, the user inter-
is looking for the bblogo.gif file in the wrong folder face display looks similar to the Linux version in Figure 4. The
Windows version behaves largely in the same way but has fewer
_tkinter.TclError: couldn’t open "/home/tamhan/. rendering errors. First, we can select the battery type up in the top
local/share/virtualenvs/BattLab-One-CK7P-15V/lib/ left area. The associated battery data is used to create the character-
python3.8/site-packages/matplotlib/mpl-data/images/ istic discharge curve shown at the bottom right. To the right of the
bblogo.gif": no such file or directory PSU Output field, On and Off buttons switch the integrated voltage
converter to power the DUT connected at the two output sockets.
You can therefore copy any GIF file into this directory and give it the
appropriate name. If you now comment out the following line, you can I have been working on my own IoT sensor project called HygroSage
start the program with a slightly limited range of functions (Figure 4): for some time now. With its colour display and powerful processor, it
would be an ideal candidate to test out BattLab-One. I connected the
#toolbar.children[’!button8’]. sensor. By clicking on the option Capture Active, the software shows a
config(command=select_range) flikering green progress bar labeled Active Event Current and then does
nothing visible for 10 seconds. During this time, the system measures
Deactivation of the measuring range button turns out to be uncrit- the information and finally displays it as shown in Figure 5.
ical in practice, because the MatPlotLib diagram is problematic in
terms of usability anyway. Many labels appear cut off and the size The value of any point of the waveform can be displayed using the
of the window cannot be adjusted. cursor. In practice, however, this does not work quite as convinc-
ingly because the value indicated in the text box below does not
As we will see, the program has fewer problems running in Windows show the measured value, but the position of the mouse pointer
10. Before changing the operating system, we can tidy up to remove the on the graph. This means you need to move the mouse pointer to
created virtual environment and thereby free up mass storage space: a point on the curve. In addition, there is no really convenient way
to zoom into the diagram (generated by MatPlotLib). Despite the
(BattLab-One-CK7P-15V) tamhan@TAMHAN18:~/ full HD resolution of my screen, I wasn’t able to expand the user
BattLabonespace/BattLab-One$ exit interface screen but it is possible to select an area of the waveform
exit using the Zoom to Rectangle option.
tamhan@TAMHAN18:~/BattLabonespace/BattLab-
For testing purposes, I connected a calibrated, high-quality multi-
One$ cd /home/tamhan/.local/share/virtualenvs/
meter in series with the DUT, which measured a current of around
BattLab-One-CK7P-15V
32 mA. BattLab-One did not agree with this; it would seem the type
tamhan@TAMHAN18:~/.local/share/virtualenvs/BattLab-
MCP1640 switching regulator in BattLab-One generates noise that
One-CK7P-15V$ rm * -rf actually interferes with BattLab-One. As a second test, I used a 1-kΩ
tamhan@TAMHAN18:~/.local/share/virtualenvs/BattLab- resistor as a load for BattLab One and specified output voltage of 3 V.
One-CK7P-15V$ ls The result is the trace showing measurement quantisation noise
in Figure 6. Connecting a 100-µF electrolytic capacitor in parallel
BattLab-One Running in Windows 10 to the HygroSage did not result in any significant improvement of
The situation here is simpler in that ready-made .exe files are the quantised current consumption waveform.
Sleep Mode Capture and Optimization gives you the opportunity to explore BattLab’s inner workings and
Once the active current consumption has been captured in Step even to adapt and improve the software as required so that BattLab-
2, we can move on to Step 3 to measure sleep current. Here we One fits your own requirements. When it comes to hardware,
need to ensure the DUT will be in sleep mode when the measure- BattLab-One does a lot of things right and very little wrong. Its
ment is taken. We now enter parameters as we did in Step 2 for the low price and high performance makes it a good addition to the
active mode capture. Unless things went badly wrong with your test bench for those developing IoT devices.
design the device will always consume significantly less power 210473-01
in sleep mode. BattLab-One gives you the option to switch the
current range in sleep mode between 10 uA – 800 µA or 800 µA Questions or Comments?
– 500 mA to improve measurement resolution. Be aware that the Do you have any technical questions or comments about this article?
device shouldn’t draw too much current in the lower measuring Contact the author at [email protected] or Elektor at
range. According to the documentation, a load current exceeding [email protected].
250 mA can damage the hardware. With the DUT running in sleep
mode we can now press Capture to record the current.
Contributors
The results after a test with Hygrosage are shown in Figure 7. In Text and illustrations: Tam Hanna
Step 4, the system displays the calculated values. Using this data Editors: Dr. Thomas Scherer, C. J. Abate
we can play around with the battery characteristics and capacity Translation: Martin Cooke
together with the active/sleep times and then click on Optimize Layout: Giel Dols
to easily see what sort of battery life we can expect for the device
when it is deployed in the field.
To Sum Up
The BattLab-One hardware is quite usable. This software however > BattLab-One – Battery Life Optimizer, with Enclosure
(SKU 19757)
has scope for improvement. The design is open-source so we can www.elektor.com/19757
expect its evolution to benefit from community support. This also
WEB LINKS
[1] BattLab-One: www.elektor.com/battlab-one-battery-life-optimizer-with-enclosure
[2] Software at Github: http://github.com/petersdw1/BattLab-One.git
[3] Software for Windows 10: https://github.com/petersdw1/BattLab-One/releases/tag/V1.2.3
WARNING. Working with mains voltage can be fatal. The circuit described here is
not for beginners. Do not build or use it unless you are experienced in dealing with
mains voltages!
socket, this is unlikely to happen with more modern electrical instal- R2b
2k2
R4
lations. A residual-current device (RCD) detects current differences 10Ω
100k
between the Live (L) and Neutral (N) leads (i.e., if current leaks via Bt1 96V M1 R3
the earth). If this difference is more than 30 mA, the residual-current 11k
How to Measure At first, another consideration for the use of these batteries in this
In case of isolation issues in mains circuits, measuring resistance design was that, according to some sources (although it is difficult to
with a standard multimeter simply does not work. Anyone who has find conclusive data on this!), CR2032s can deliver only a relatively
measured the resistance of their skin with a multimeter will know the low current, on the order of 10 mA. A voltage of 96 VDC is potentially
paradox: it shows a resistance of around 1 MΩ (depending on how dangerous, for direct current (DC) the lethal current for humans is
wet or sweaty your hands are). That would mean that if you touch about 100 mA. But, according to the datasheets, the batteries cannot
230 V mains voltage, the current would be well below 1 mA, which deliver such a high current; so in theory, the batteries would make a
is far from lethal; you cannot even feel a current of this magnitude. safe power supply for the earth-leakage tracer. In practice, however,
However, the resistance is very much dependent on the voltage that the author measured (peak) currents of a few hundred milli-amps
is applied to perform the resistance measurement, with most multi- that could be sustained long enough to be potentially dangerous (see
meters this will not exceed 9 V. At 230 V, however, the resistance of textbox about the CR2032s). Therefore, for safety reasons, this design
the human body is in the order of kilo-ohms, which leads to currents includes a current limiting resistor.
of a few hundred milli-amps, which can certainly be harmful or even
lethal. This voltage dependency of the resistance is caused, among The Hardware
other things, by electrochemical reactions in the human body. For the measurement of the leakage current, the author used an
old-fashioned panel current meter that he still had lying around. The
So in order to make an accurate measurement of the leakage current, advantage of an analog meter is that it reacts faster than a (standard)
we must not measure at a low voltage — as a multimeter does — digital meter, so peak currents when switching on are also visible. The
but ideally with 230 V, which is the mains voltage in most European resistance of this meter (Rm) is 2.4 kΩ and the full-scale current (IFS) is
countries. The challenge for the author was to do this in a cheap, but 60 µA. With resistors, we must ensure that the meter has the correct
range. But it is also wise to protect the meter against high currents > R3 is 11 kΩ (10 kΩ and 1 kΩ in series). This limits the meter to
with a diode. A diode will limit the voltage across the meter and its value ‘7’ on a full-scale of ‘8’: the diode limits the voltage across
series resistor R3 to 0.7 V. R3 and the meter to 0.7 V, resulting in a maximum current of
approximately 53 µA, while the full-scale value is 60 µA. The
Figure 1 shows the schematic of this earth-leakage tracer. R1 is the author therefore uses two diodes in series with a total voltage of
current limiting safety resistor; to be on the safe side, a resistor of 2.2 kΩ 1.4 V, so that full-scale range can be obtained, while the current
is used, which limits the current to around 45 mA. If this maximum through the meter stays within limits.
current flows, 4 W will be dissipated in resistor R2. So, either use a > R2a is 100 Ω (for 8 mA range)
power resistor or let the current only flow for a short time. > R2b is 10 Ω (for 80 mA range)
With the shunt resistor R2, the resistor R3, and the internal resistance Given the simplicity of the circuit and the small number of components,
Rm of the meter we can, under the condition that R2 is much smaller no circuit board is required to build this project, Figure 2 shows the
than R3 + Rm, use Ohm’s law to calculate the correct range of the meter: inside of the earth-leakage tracer built by the author. At the bottom
of this picture, you see the two stacks of CR2032 batteries wrapped
Vdiode Rm R3 I FS in tape, in a standard dual C-cell battery holder. The plus and minus
R3 Rm R2
I FS terminals of these home-made 46 V batteries are marked with red
I scale
and black tape, respectively.
Vmains
I actual
Vbatt
Rint
Im related products
Plotted in a table this is: > PeakTech 2710 Digital RCD Tester (SKU 19318)
www.elektor.com/peaktech-2710-digital-rcd-tester
Im [mA] Iactual [mA] > PeakTech 2715 Digital Loop / PSC Tester (SKU 19078)
0 0 www.elektor.com/peaktech-2715-digital-loop-psc-tester
1 2
2 5
3 8
4 11
5 14
6 17
7 20
8 24
10 31
20 100
30 >200
And what the issue was with the electrical installation of my parents’
sunroom? A cable to an outdoor lamp had a isolation leakage that
indicated 4 mA during the troubleshooting with this earth-leakage
tracer, which would in practice be about 11 mA with the mains voltage
switched on. Probably the leakage became worse during the rain. The
best way to solve the problem was to replace the cable.
200576-01 CAUTION! HIGH VOLTAGE!
There are always safety risks associated with working on
circuits or systems that are (potentially) connected to mains
power. Elektor and the designer of this project accept no
WEB LINK liability for any damage (in whatever form) caused by using
this earth leakage tracer. As with all projects involving mains
[1] Residual-Current Device: power, we offer the following sincere advice: If you don’t know
https://en.wikipedia.org/wiki/residual-current_device what you are doing, don’t do it!
Poverty
and Electronics
Sustainable Development Goal 1
By Priscilla Haring-Kuipers (The Netherlands)
Poverty Targets
The first target is to end extreme poverty,
which is determined as people living on less
than $1.25 a day. If you want to know what
that looks like, go to Dollar Street [2] and
take a look at families with an income up to
$38 per month. Sadly, because of Covid-19,
for the first time in our generation poverty
has risen. Effects of the global pandemic
have pushed around 120 million people back
into this bottom category during 2020.
WEB LINKS
[1] UN Department of Economic and Social Affairs, “SDG Good Practices - A Compilation of Success Stories and Lessons Learned in
SDG Implementation,” First Edition, 2020.: https://sdgs.un.org/publications/sdg-good-practices-2020
[2] Dollar Street: https://www.gapminder.org/dollar-street
[3] The Borgen Project, “10 Technological Solutions to Poverty,” 2014.: https://borgenproject.org/10-technological-solutions-poverty/
Creality HALOT-SKY
Resin 3D Printer
Price: €849.00
Member Price: €764.10
www.elektor.com/19745
Price: €109.95
Member Price: €98.96
www.elektor.com/19869
www.elektor.com/19926 www.elektor.com/19916
Price: €14.95
Member Price: €13.46
Price: €29.95
Member Price: €26.96 www.elektor.com/19971
www.elektor.com/19913
Traditionally, the last page of Elektor The Hexadoku puzzle employs numbers in the hexadecimal range 0
through F. In the diagram composed of 16 × 16 boxes, enter numbers
magazine is reserved for our puzzle with an such that all hexadecimal numbers 0 through F (that’s 0-9 and A-F)
electronics slant: welcome to Hexadoku! occur once only in each row, once in each column and in each of the
Find the solution in the gray boxes, submit it 4×4 boxes (marked by the thicker black lines). A number of clues
are given in the puzzle and these determine the start situation.
to us by email, and you automatically enter
the prize draw for one of five Elektor store Correct entries received enter a prize draw. All you need to do is
vouchers. send us the numbers in the gray boxes.
PRIZE WINNERS
The solution of Hexadoku in edition 11-12/2021 (November & December) is: 53974.
Solutions submitted to us before December 17th were entered in a prize draw for 5 Elektor Store Vouchers.
The winners are posted at www.elektormagazine.com/hexadoku.
Congratulations everyone!
The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.
Dedicated
Reporting
Module
Tables automatically
populate with design
Pre-Production data
Checklist
Compliance status for
diff pairs and length
Set of board tests
matched routes
before Gerber Output
Make custom
Includes placement, reports with data
connectivity and object tables
clearance testing
Generate reports
Completely independant from templates
code for clearance checks
[email protected]
+44 (0)1756 753440
Join the
Elektor C mmunity
Take out a G O LD
membership
membership!
The Elektor web archive from 1974! An online Elektor LABs account, with
6x Elektor magazine (Print) access to more than 1000 Gerber files
9x Digital (PDF) including and a direct line of communication with
Elektor Industry (EN) magazine our experts!
A 10% discount in our web shop and Bring a project to publication or even sell
exclusive offers it in our shop
Elektor’s annual DVD-ROM
www.elektor.com/member