En202003 PDF

Download as pdf or txt
Download as pdf or txt
You are on page 1of 124
At a glance
Powered by AI
The magazine discusses developments around the LoRa radio protocol for long-range wireless data transmission. Specifically, it introduces the Elektor LoRa Node module for enabling LoRa connectivity in custom projects and describes how to connect a board to the open LoRaWAN network to transmit sensor data worldwide.

The magazine discusses two introductions to LoRa technology - the Elektor LoRa Node, which is a flexible and configurable module for enabling LoRa compatibility in custom projects, and an article on connecting to the LoRaWAN network.

The Elektor LoRa Node is a flexible and configurable module that allows projects to be made 'LoRa compatible'. As an example, the magazine describes how they developed a remote control using it that can switch electric appliances over distances of several hundred meters with feedback.

Edition 2/2020 | March & April | www.elektormagazine.

com

lektor
8-Page S
uppleme
Start-up nt:
s at
productr
o
Fast Forw nica
ard 2019

magazine
DESIGN SHARE SELL ELECTRONICS

The Elektor
Edition 2/2020 – March & April 2020

LoRa Node

Versatile, long-range, 868-MHz remote control


with state feedback and STM32 Inside

ESP32 Doorbell The Meadow F7 Board


via Telegram

“The UPS Man


Always Rings Once” A great board for .NET developers

Andonstar AD407 Analogue Electronics Design BASIC for the ESP32 and ESP8266 Developer’s Zone The Elektor ‘Intelekt’
Chess Computer (1981) The Elektor LoRa Node The Enviro+ RPi-HAT ESP32 Doorbell via Telegram Europe’s Most Successful
Start-up Accelerator? Hexadoku Homebrew PC for the Electronics Lab How-To: Calculate the PSCC Joy-IT DMSO2D72 Portable
3-in-1 Oscilloscope Lab, Sweet Lab Locating Wayward Wires The Meadow F7 Board My First LoRaWAN … and more

190356-B Cover 02-2020 EN.indd 1 06/02/2020 14:10


C

CM

MY

CY

CMY

Untitled-4 1 06/02/2020 09:21


Elektor Magazine,
English edition
Edition 2/2020
Volume 46, No. 500
March & April 2020

Data Transmission
with Ease
ISSN 1757-0875 (UK / US / ROW distribution)
In last November’s issue I hinted at our laboratory working on projects using
the LoRa radio protocol. This protocol allows data to be transmitted over
www.elektor.com
wide distances in a highly energy-efficient way. In the present issue you will
www.elektormagazine.com
find two introductions to this exciting technology. The Elektor LoRa Node is a
Elektor Magazine, English edition flexible and configurable module that enables you to render your own projects
is published 6 times a year by “LoRa compatible“. As an example application - also suitable of course for full
Elektor International Media replication - we developed a remote control capable of switching an electric
78 York Street appliance over distances of several hundred meters, with feedback on the
London W1H 1DP
United Kingdom
sender. As befits LoRa, such a node can be operated autonomously in the field
Phone: (+44) (0)20 7692 8344 (using Li-Ion cells).
If you are keen to send sensor data to the Internet for access and use any-
Head Office:
Elektor International Media b.v. where in the world you should take a look at the article My First LoRaWAN.
PO Box 11 Here we describe how to connect a board to the open “The Things Network“
NL-6114-ZG Susteren
The Netherlands with minimal effort. You can either use an existing gateway in your area, or
Phone: (+31) 46 4389444 install your own inexpensive gateway which receives the sensor data over
LoRa.
Of course there are many more intriguing developments in the world of
Memberships:
Please use London address microcontrollers. One of them is Artificial Intelligence, and you can count on
E-mail: [email protected] my colleagues and me to discover some innovations at the Embedded World
www.elektor.com/memberships
exhibition, which we will report on later this year. Already available in our

Advertising & Sponsoring:


online store is the MAix BiT Kit that permits entry-level explorations into the
Margriet Debeij fields of speech and image recognition, all programmable through the comfy
Phone: +49 170 5505 396 Arduino IDE! More about it in the next issues and of course up-to-date at
E-mail: [email protected]
www.elektormagazine.com!
www.elektor.com/advertising
Advertising rates and terms available on Jens Nickel
request.
International Editor-in-Chief, Elektor Magazine
Copyright Notice
The circuits described in this magazine are for domes-
tic and educational use only. All drawings, 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 Circuit
Elektor International Media b.v. and may not be repro-
duced or transmitted in any form or by any means, International Editor-in-Chief: Jens Nickel
including photocopying, scanning and recording, in
whole or in part without prior written permission from
Editor-in-Chief, English edition: Jan Buiting
the Publisher. Such written permission must also be
Membership Manager: Denise Bodrone
obtained before any part of this publication is stored
in a retrieval system of any nature. Patent protection International Editorial Staff: Eric Bogers, Rolf Gerstendorf, Denis Meyer,
may exist in respect of circuits, devices, components
etc. described in this magazine. The Publisher does Dr Thomas Scherer, Clemens Valens
not accept responsibility for failing to identify such
patent(s) or other protection. The Publisher disclaims Laboratory Staff: Mathias Claussen, Ton Giesberts,
any responsibility for the safe and proper function
Luc Lemmens, Clemens Valens, Jan Visser
of reader-assembled projects based upon or from
schematics, descriptions or information published in or Graphic Design & Prepress: Giel Dols
in relation with Elektor magazine.
Publisher: Don Akkermans
© Elektor International Media b.v. 2020
Printed in the Netherlands

www.elektormagazine.com March & April 2020 3

190364-B EN colophon_editorial.indd 3 06/02/2020 08:30


This Edition
Volume 47 – Edition 2/2020
No. 500 March & April 2020
6

Regulars
16 Interactive
Corrections & Updates || Questions & ESP32 Doorbell
Answers

18 Analogue Electronics Design


via Telegram
Case Study #1 — Section 2: Preamplifier
optimized for MEMS microphone

34 Small Circuits Revival


Capita Selecta from the Elektor Project
Suggestions Box

29
74 Steeped in Electronics
Ordering components from Ukraine and
Russia

78 Lab, Sweet Lab


A glimpse of The Holy Place —
“The UPS Man
no unauthorized entry Always Rings Once”
84 How-To: Calculate the Prospective Short-
Circuit Current or PSCC
and choose the proper circuit breaker

87 Peculiar Parts, the series

Features
TMS1000 Series Microcontrollers

88 Starting Out in Electronics (2)


Easier than imagined!

90 Developer’s Zone 45 electronica Fast Forward 2020


Tips & Tricks, Best Practices and Other Sign up for the Start-up Platform Powered
Useful Information by Elektor

104 Retronics: The Elektor ‘Intelekt’ Chess 46 “A Strong Supporter of Open Internet”
Computer (1981) Interview with Wienke Giezeman,
Tiny Chess 86 ported to the Intel 8088 initiator of The Things Network

110 Beyond Electronics 49 The Meadow F7 Board


PCB Art — Pushing the Limits of Industrial A great board for .NET developers
Manufacturing Interview with
67 Raspberry Pi
120 Elektor Store Bash Command Cheat Sheet Wienke Giezeman,
what’s available @ www.elektor.com
68 Europe’s Most Successful Initiator of
122 Hexadoku Start-up Accelerator?
The original Elektorized Sudoku HighTechXL, Eindhoven, The Netherlands The Things Network

4 March & April 2020 www.elektormagazine.com

190365-B EN Contents_Preview.indd 4 06/02/2020 08:34


The Elektor lektor
LoRa Node DESIGN

26 BASIC for the ESP32 and ESP8266


SHARE

Programming with Annex WiFi RDS


SELL ELECTRONICS

29 ESP32 Doorbell via Telegram


“The UPS Man Always Rings Once”

36 My First LoRaWAN
With Blue Pill, LoRa Breakout Board and
The Things Network

Versatile, long-range, 54 Practical ESP32 Multitasking (2)

868-MHz remote control


Task priorities

60 Sigfox and the IoT (3)

with state feedback First steps on the network

80 Optical Probe for Oscilloscopes


and STM32 Inside Measure brightness fluctuations of lighting
systems

82 The ’TABULA’ Project — An Update

The
Tangibles with user feedback

93 Locating Wayward Wires


Meadow F7 Track and trace concealed and defective
cables with ease and certainty

Board 100 Homebrew PC for the Electronics Lab


Tips on component choice and construction

49 productronica 2019 Start-up Guide


(8-Page Supplement)

112 Distrelec - Powering the Future


Education is the foundation for
innovation, and innovation needs
advocates.
A great board for .NET developers 114 They’re All Winners!
Start-ups @ productronica 2019

117 Fast Forward Award Finals


The FFA 2019 Jury report
71 Review: The Enviro+ RPi-HAT
Measure air quality with a Raspberry Pi and 118 FFA 2019 Sponsors
the Enviro+ HAT Weller / Kurtz Ersa / Berstein / Almit

76 Review: Andonstar AD407


Better than its predecessor?

98 Review: Joy-IT DMSO2D72 Portable 3-in-


1 Oscilloscope Next Edition
Elektor Magazine 3/2020
Weather Station 2020 • Experiments with AI • Nixie

Projects
Bargraph Thermometer 2.0 • Visualizing Sigfox Data •
E-Scooter Dismantled • Balancing Robot with Arduino
• Basic for ESP32: Applications • Triac Meets ATmega •
FreeRTOS and ESP32: Timers • Single-Chip ARM A7 and

46
6 The Elektor LoRa Node M4 • Retronics • Small Circuits Revival • and more.
n, Versatile, long-range, 868-MHz remote
control with state feedback and STM32 Inside
Elektor Magazine edition 3/2020 covering May & June 2020 is published
21 My IoT Button: A Button for the Web around 7 May 2020. Delivery of printed copies to Elektor Gold Members is
Part 1: IoT architecture subject to transport. Contents and articles subject to change.

www.elektormagazine.com March & April 2020 5

190365-B EN Contents_Preview.indd 5 06/02/2020 08:34


LABS PROJECT

The Elektor LoRa Node


Versatile, long-range, 868-MHz remote control with
state feedback and STM32 Inside

6 March & April 2020 www.elektormagazine.com

180666 EN The Elektor LoRa Node.indd 6 06/02/2020 08:37


PROJECT DECODER
LoRa
Arduino
By Mathias Clauβen and Luc Lemmens (Elektor Labs) STM32

entry level
Convinced of the combined power of open-source hardware and Æ intermediate level
expert level
software, Elektor smashes the myth that LoRa is for pros only. This
article not only tells the story of persistence in electronics design in
the face of real challenges, but also of a 3-element LoRa Node you 4 hours approx.

can easily replicate for reliable on/off control with status feedback and
covering distances 10 to 20 times those of consumer-level WiFi and USB UART,
433-MHz ISM LPR. Arduino IDE,
lab tool set

€150 approx. excl. cases

The Elektor LoRa Node was born from the consumption, and size. the LoRaWAN Node Experimental
idea to have a compact PCB with support Read here how we did it. The story that Platform, stuffed for ‘local’ LoRa
for rechargeable as well as non-recharge- follows is kind of chronological, since with only.
able batteries, a common microcontroller this project we like to share not just the • LoRa Button. Board no. 180666-2.
like the LQFP48-cased STM32, and a type final product and a quality write-up, but Two required for this project.
RFM95 LoRa module, also, the PCB was also the real-life problems we ran into, • LoRa AC Power Switch. Board no.
to fit in an enclosure that’s easily sourced and the tools used to develop the project. 180666-1.
from one of the bigger distributors, also, We do so at the request of many readers. Together the three elements form not
for the STM32 compiler, we… STOP! only a remote control with a range of
As the enclosure will co-determine the What’s being described 10 to 20 times that of a consumer-level
space available or the energy source, we In this article we cover the three WiFi link on 2.4 GHz, but also a LoRa
need to discuss this first. The initial idea elements mentioned above: development platform with potential
was to power the device from non-re- • LoRa Node. Board no. 180516-1, for LoRaWAN. We kick off with the main
chargeable batteries. This was rejected
since Elektor wants its contribution to
battery waste to be as small as possible.
So, a rechargeable battery solution was Quick Features
sought, as well as ease of replacement Lora Node
by the user. This would result in a small, • LoRaWAN Experimental Platform board with minimum parts stuffed
serviceable, water-resistant node capable • Li-Ion battery powered
of operating not only in Elektor Labs’ • User changeable cells
comfy conditions, but also “out there in • STM32F072C8T6TR ARM Cortex-M0 MCU
the wild” and conveying real-life environ- • SPI F-RAM or Flash (optional)
mental data. Further design aspects • Crypto co-processor (optional)
heavily debated during the project devel- • GPS module (optional)
opment period were the battery lifetime • USB interface (optional)
and the sensors to accommodate on
or off the board. Clearly, we aimed to LoRa AC Switch (slave device)
have a flexible and useful platform to • Relay state feedback to Node central
explore LoRa and potentially LoRaWAN, • Switch contacts rated 5 A (1000 W at 230 VAC; (500 W at 115 VAC)
not for ‘academic’ use in the airco’d and LoRa Button (master device)
carpeted lab but ready to use in any • Low-energy design
(rough) place out there for the purpose • Optional OLED display
of remote device on/off switching. From • Integral helical coil antenna
here, the challenge is the ‘squaring of • 100–500 m range to LoRA slave
the circle’ in terms of flexibility, power

www.elektormagazine.com March & April 2020 7

180666 EN The Elektor LoRa Node.indd 7 06/02/2020 08:37


attempt to show the versatility of the
board.

PCB design and challenges


After building the first prototypes some
adjustments seemed in order. For the
GPS module we needed some tweaks
to get better reception. For sure, you
can build a miniaturized antenna but
you need to take the ground plane into
account. The GPS module datasheet
states a minimum PCB size for the
antenna to work. Still, we were not satis-
fied with the signal reception.
After Version 1 of the board we ditched
the Quectel L96 GPS module and replaced
it with the GPS Module from the Elektor
Store [2] as this was both cheaper
and, easier to connect to the board as
a quasi-external part. This caused further
Figure 1. The LoRa Node control board with ’real estate’ allocated to functional blocks. Actually, you
redesigns for the connectors used, so
are looking at a minimally-stuffed LoRaWAN Node Experimental Platform.
everything is now in a 0.1-inch raster
allowing you to plug the module onto a
breadboard.
element: the LoRa Node. To meet certain design aspects and Then we have the RFM95W LoRa module
requirements we stuck to thinking that needs an antenna for sure. With
The early beginnings ‘modular’. With the full complement the size and enclosure we selected, we
The PCB was designed using KiCad, of components fitted you’d have a wanted to use a DIY helical coil antenna
a free, open source, multi-platform, LoRaWAN device with a GPS module, for 868 MHz. If you desire even better
electronics design tool that’s gaining crypto coprocessor, SPI F-RAM or Flash reception, an external antenna is an
users every day, and not just hobby- storage. All features are “nice to have” option. We realized the design was a
ists. If you’d like to start out with KiCad but you may not need them. It also compromise between space, functionality
we have a fine book available in the implies that components not populated and RF performance. Lessons learned.
Elektor Store [1]. on the board will save money in the We already mentioned the use of Li-Ion
After a false start with “another” proces- basic version, and no need to pay for batteries in 10440 (AAA) format, as
sor, and some more stumbling in the features you’ll never need. As the found in e-cigarettes. These are easy to
dark, a board for the STM32F072 in pinout for the SPI F-RAM and SPI Flash replace by the user and charged outside
LQFP48 case was designed, benefiting modules is standardized, you can add the device with a proper Li-Ion charger.
from that MCU’s Arduino IDE compat- your favourite module. The same for To protect the cells from deep discharge
ibility. This makes development pretty the crypto coprocessor, an ATECC608a: a voltage monitor IC was included switch-
easy as you can now use most of your you can also choose to just add an ing off the LDO for the 3.3-V supply.
well-known Arduino libraries. As we didn’t I²C-EEPROM or an F-RAM chip, meaning Also added at this point was a 2-mm
have any incarnation of a quartz crystal you have a very flexible and use-con- pinhole part to attach LiPo battery packs
on the board we resorted to the internal figurable device available. commonly used for drones. These small
oscillator options. Here, this defaulted The LQFP48-cased STM32F072 MCU and flat cell packs come with a Molex
to 8 MHz for the MCU in order to reduce now on the PCB is a Cortex-M0 based 510005 or JST connector and offer a
the power consumption, but ready for device with 64 kB of Flash and 16 kB of fine capacity/space ratio. This makes the
cranking up to 48 MHz if desired. RAM, allowing you to even have USB for whole design more flexible and allows
firmware updates or for use in your own the use of off-the-shelf rechargeable
The modular approach applications. batteries that can be sourced from big
The Elektor LoRa Node board pictured in The nice thing about the STM32 series warehouses starting with an A.
Figure 1 (early version) is not only the is the utter pin compatibility, meaning Reverse-current protection was imple-
basis for the present project but will be you can change the MCU without chang- mented using a ‘loadswitch’ device.
used in spin-off projects to be published ing the board layout. For example, the Eventually we used the MAX40200 ‘ideal
later this year in Elektor magazine. even lower power STM32L072, or an diode’ for this purpose, as it will discon-
That’s why we will first take a tour of STM32L151 in case you need more nect the supply voltage if it passes a
the components and other options that computation power and Flash. The certain amount of reverse current. A
may be assembled on the board. The STM32F103 you commonly find on the second one was added for the power
hard-core electronics fans among you ‘Bluepill’ board can be fitted on the PCB, supply towards the GPS module (K4),
may want to do a parallel tour by way of too. enabling the MCU to cut the power to the
the circuit diagram printed in Figure 2. The Quick Features box is just an module in order to extend battery life. If

8 March & April 2020 www.elektormagazine.com

180666 EN The Elektor LoRa Node.indd 8 06/02/2020 08:38


F1 D1 F2
K2 0ZCK0050AF2E PMEG3010EJ 0ZCK0050AF2E
3 2 1 VIN OUT 5 1 OUT 5
VBAT + IN 3V3
UVL IC7 IC2
GND T1 JP2 C4 C16 C19 C20 C21 C18
SI2347DS 1 3 MAX40200 TLV75533PDBV
3 OFF 470µ 100µ 100µ 100µ 100µ 100n
BT1 BT2 VDD 3 4 3
2 EN NC EN
IC1 GND GND C6
C3 ON C5
1 2 470n
100n TLV809K33 2 4µ7
R1 ______ 2 C15

100k

180666 EN The Elektor LoRa Node.indd 9


GND RESET 4µ7
1

3V3 R7 R6
3V3
150k 150k
3V3 C8 C9 C10 C11 C17 VSupply
3V3
4µ7 100n 100n 100n 100n
or disable other external circuitry.

1 5
R8 R9 R5 VIN OUT
C14 IC6
K5 4µ7 MAX40200

4k7
4k7
10k
24 36 48 1 9 11 EN NC K4
17 ____ GND C13
Powering the device from NiMH cells
you forfeit the GPS module you can have
the MCU control that 3.3-V rail to power

V BAT 7 2 GPS_ACTIVE_IN 3 4 1
16 RST PA1 PC13 100n VCC
NRST

VDD
VDD
GND 2

VBAT
VDDA
15 2 GND

VDDIO2
3V3 12 GPS RXD 3
14 25 PA2 GPS RX
PB12 PB12 13 GPS TXD 4
13 26 PA3 GPS TX
PB13 PB13 5
12 27 R11
PB14 PB14

10k
11 28
PB15 PB15 3V3
10 30
PA9 PA9
9 31 IC4
PA10 PA10
8 I2C_SCL STM32F072C8Tx
SCL/PB6 5
7 I2C_SDA PF0
SDA/PB7 6 3 7 8 C7
6 CAN_RX PF1 ___ _____
PB8 WP/IO2 HOLD/IO3 VCC 100n
5 CAN_TX
PB9 3V3

SPI_NOR_NCS
4 22 1 __
GND PB11 CS
3 IC3
3V3
2 SWDIO 34 AT255F081-SSHD-X
SWDIO PA13
1 SWCLK 37
SWCLK PA14 C1 C2 ANT1
Reset 4µ7 100n 868 MHz

GND
3V3 3V3

SCK
SO/IO1
SI/IO0
S1
6 2 5 4

S2 PB0 18
C12 44 19
PB1
100n BOOT0
Boot PB10 21
13
R4

10k
8 6
10 16
circuitry, in this case a DC/DC boost
stage. As the boost stage will consume

PA0
would be feasible but needs additional

power all the time this may reduce

RESET DIO2
VCC
15
DIO1
IC5 20 MOD1 14
PB2
DIO0
ATECC608A RFM95W 7
40 14 CS 5 DIO5
1 NC
R3 PB4 PA4 NSS 12

4k7
2 41 15 4 DIO4 ANT1
NC PB5 PA5 SCK
6 I2C_SCL 11
42 PA6 16 2 DIO3
3 SCL PB6 MISO K3
NC 5 I2C_SDA 43 PA7 17 3 9
SDA PB7 MOSI ANT 1
VUSB
7 NC 45 29 2
GND

GND

1
GND

GND PB8 PA8 K1 USBDM


3V3 46 3
4 PB9 1 8 10 USBDP
4 GND
32 USBDM
JP1 PA11
PA12 33 USBDP
2 3 4
OE VDD K6
1

www.elektormagazine.com
X1
3
ASH7KW RST
PB3 39 2
2 1 3 PC14 JTDO
GND OUTPUT 38 1
4 PA15 JTDI
PC15 R2 R10
VSS VSS VSS VSSA
the under-voltage lockout.

23 35 47 8
680
680

LED1 LED2

March & April 2020


Figure 2. Circuit diagram of the LoRa Node control board. This is basically the LoRaWAN Node Experimental Platform board with a specific outfit of ICs.
ting fine, the biggest challenges at this

9
With our home-made antenna transmit-
runtime, and we also need to reconsider

06/02/2020 08:38
the input is below 2.97 V, it disables the
HS switch IC7 and the supply voltage is
cut as well for a period of 20 ms.
Without a large buffer capacitor, high
currents at start-up upset the UVLO and its
input voltage will drop below 2.97 V, result-
ing in a permanent loop of enabling and
disabling the LDO. Adding a ‘big’ electro-
lytic like C4 (Figure 3) made the power
path work as expected. Fit it only if you
find the two 100-µF MLCC solid caps too
expensive. Also according to the datasheet,
we don’t have a FET or diode protecting the
batteries from being charged from the VUSB
side. This job is done within the MAX40200
— if a reverse current flows the chip will
Figure 3. Board space reserved for electrolytic cut power. This is also true if the voltage
Figure 5. A special method for mounting the
capacitor C4, one of the largest parts on the LEDs is applied on the LoRa Button board. coming from VUSB exceeds that provided
board. by the system batteries.
The two LEDs on the board flag the board
status reported by the MCU on port lines
PB3 and PA15 a.k.a. ‘JTDO’ and ‘JTDI’
point appeared to be within the project Down at the component level a few on pinheader K6.
software. Undeterred though we ran problems arose, including one with a
point-to-point communication in the RAW 470-µF capacitor previously ahead of Software: the groundwork
mode offered by the LMIC library. the undervoltage lockout device, IC1. If Although system software increasingly
defines hardware functionality, to some
it’s just black magic that needs to be
‘flashed’ into a chip. A comparison of lab
time spent on software versus hardware
3V3
shows many more hours dedicated to the
K5
K4
1 17
former. How come?
VBAT
GND
2 16 As already mentioned, you can program
15
14 the board with your favourite Arduino
13
12 IDE. For this the stm32duino project [3]
11
10
did especially well in supporting a wide
R3 R4 range of STM32 MCUs and STM32 boards.
680

680

9
8
7 Formally adding the Elektor LoRa Node
6
5 Experimental Platform was the first ‘cleri-
LED1 LED2 4
3
cal’ task that needed to be done. In the
K8 R1 2 Arduino core for the STM32 we had to
1 1
LED BLUE 270
GND
2
R2
edit a few files and add the board defini-
3
SW 10k
K6 tion. After some errors and unexpected
K2 1
GND
2 2 software behaviour we got the template
1
SW 3
running and were able to start coding the
first few lines.
One thing you normally don’t care much
K7
GND
1 about is the way the MCU generates the
2

VBAT
3 clock. On the older AVR chips you had
4
FTDI_TXD
5 a crystal and that was it. On the more
FTDI_RXD
6
LCD1 recent MCUs though you have more
0.96 ’’
options to generate the MCU main clock,
K3
3V3 OLED 1 often from internal PLL / FLL sources or
GND 2
SCL 3 high-speed internal RC oscillators. We
SDA 4
5 decided to use the internal clock sources.
They’re not great for frequency stabil-
180666-022-94 KD ity, but good enough to get us going. By
allowing us to change the clock speed
during runtime, going ‘slow’ saves power
Figure 4. LoRa Button schematic. This is the ‘sending’ or ‘master’ part of the Elektor LoRa Node. The and going ‘fast’ yields higher throughput.
OLED display is optional and its use requires deep thought about energy use! The default value of 8 MHz for the core

10 March & April 2020 www.elektormagazine.com

180666 EN The Elektor LoRa Node.indd 10 06/02/2020 08:38


Figure 6. Use sharp cutters to snap into the plastic material between the Figure 7. Using a flat screwdriver blade, carefully lever up the plastic
pins until they are no longer held together. remnants surrounding the pins, and remove them.

Figure 8. You now have a ‘naked’ pin row. Figure 9. The almost completed LoRa Button board.

and peripherals keeps power consump- nal blocks, pinsockets, and pinheaders. (Figure 6), then slowly lever the plastic
tion modest yet is fast enough to process These parts are essential for the basic upward over the pins using a screw-
the LoRa stack. version of the Elektor LoRa Node. The driver blade (Figure 7). If everything
For accuracy in the RTC domain a 32.768- OLED display from the Elektor Store [3] goes well, the metal pins will be exposed
kHz oscillator was added (X1). It is (component: LCD1) is optional. (Figure 8).
optional. At the cost of a µA of current we When assembling the board, there are a The OLED display can then be inserted
gain UARTs that can be clocked from the few things that need to be considered. flat into the intended position, followed
crystal as well as an RTC that can wake The LEDs, for example, have their bodies by the pinheader sockets, the angled
up the MCU after a given timeframe. bent over and inserted in PCB holes so pinheaders, and the PCB screw termi-
their faces are at the board underside, nal blocks. This almost completes the
The LoRa Button see Figure 5. construction, less the real button of
For a simple input device to convey its For the OLED display more delicacy is in course (Figure 9).
state over radio and learn about things order because you either have to unsol-
we propose the second component in the der the entire pinheader block or bodge Interlude:
project, the ‘LoRa Button’. a bit by removing the plastic shroud- a DIY 868-MHz antenna
The schematic in Figure 4 shows that ing around the pins in the pinheader. The LoRa Button now needs an antenna
the LoRa Button has just a few resis- To remove the excess plastic, first bite for transmitting and receiving at
tors, a pair of LEDs, PCB screw termi- into the plastic part between the pins 868 MHz. A quarter-wave ‘Marconi’

www.elektormagazine.com March & April 2020 11

180666 EN The Elektor LoRa Node.indd 11 06/02/2020 08:38


equal a rod antenna or wound into a sive solution for the project. Although the
coil and compressed with 1-mm spaced documentation with the SMPSU does not
turns. Either way, the wire is soldered to mention the need for a fuse at the AC
the ANT connector (Figure 10). side, we added F1 just to be sure. NTC
(negative temperature coefficient) resistor
The LoRa AC Switch Slave R1 limits the supply inrush current, which
As an example of a slaved “output can soar in these inverters. C1, C2 and
device’’ controlled by the Elektor LoRa common-mode filter L1 at the output of
Node as well as ‘listening’ to the LoRa the AC/DC converter may appear overkill,
Button, a power switch was developed but we did not rely on Mean Well’s state-
for mains operated equipment consum- ment that the module contains enough
ing up to 1 kilowatt (kW). An optocou- internal EMI interference suppression.
pler returns the (on/off) state of the
AC Switch Slave to the Lora Node. The Power switching. For this application
board also houses a 100-230 VAC to a device from Omron’s G5RL-K1 series
5 VDC power converter allowing the of bistable relays was chosen. These
Lora Node and the AC Switch Slave to have a Set and a Reset coil, and a short
be powered directly from an AC power excitation of either is enough to toggle
outlet. the contacts. Although the relay contacts
The real intelligence of the LoRa Switch are rated for a maximum current of 16 A,
Slave resides in the LoRa Node hardware fuse F2 melts at about 5 A to protect the
Figure 10. The feedpoint of the home-wound, and software, which is connected as a copper tracks on the circuit board from
quarter-wave antenna for the 868-MHz band plug-in board. None the less, the Switch burning out.
is soldered to the ANT pad on the LoRa Button Slave provides these functions:
board (early prototype shown). Note the coiled • a 5-VDC supply rail; Feedback. Theoretically the microcon-
construction of the antenna. • load switching dimensioned for troller on the LoRa Node board should
115/230 VAC, 1 kW max.; be able to keep track of the last action
• switch state feedback; sent to the Slave device, i.e. is it on or
antenna made from 1-mm diameter • a local control (on/off) pushbutton. off? But to be really sure of the condi-
enamelled copper wire (AWG #18) is a tion, a physical feedback of the output
good and low-cost option. Assuming a The schematic of the LoRa Switch Slave is no luxury thing, also because the
ground plane is present the wire should is given in Figure 11. We’ll look at the position of a bistable relay is not certain
have a length of 8.635 cm in a vacuum main components and the construction. when the project is reset. Remember:
but 8.2 cm in practice! That’s because the circuit around optocoupler IC1 only
of the air velocity factor of 0.95 [4]. Power supply. A 5-V, 2-W, AC/DC indicates that RE1 is closed and that
Depending on the space available, the converter from Mean Well proved to be the mains voltage is present on termi-
antenna wire may be left straight to a compact, safe and relatively inexpen- nal block K2. Whether the load actually
works (i.e. whether it consumes power)
is not revealed by the state feedback and
should therefore be checked for real and
+5V
K1 F1 R1
MOD1 L1
ACM4520-231-2P-T
on the spot.
1 3
L ACin DCout +
1 4
N 60 mA T -T C2 C3
C1
PE 100n 100n 1µ
16V
Manual operation. The idea behind this
2 4 2 3
ACin DCout -
project is to be able to switch a load
+5V IRM AC/DC 2W
K3 from a (large) distance by pressing a
Re1
F2
G5RLK1AEDC5
button. But if you are around anyway
K2
5A at the receiver end it’s great to be able
PE S R S1
N D1 D2 to operate it manually without needing
1N4148 1N4148
SW
the LoRa Button and the LoRa Node.
Moreover, if the LoRa connection is lost
+3V3 15 16
T1
BS170
T2
BS170 13 14 for whatever reason, it’s comfy if you
on 11 12
can still switch gears.
100k

R5 R4 R3
47k

reset 9 10
10
set 7 8
on
R2 R7 5 6
R8 +3V3
R6 C4 3 4 Mounting and installation. The solder-
47k

10µ 1 2
10

1k

1k

D3
16V +5V
ing of the board has few challenges.
1N4007 IC1
CNY65 Apart from the common-mode filter
and (possibly) connector K3, it’s all
180666-1 KD
plain sailing with through-hole compo-
nents only. K3’s connector pads are quite
Figure 11. Schematic of the LoRa AC Switch. This is not a ‘dumb’ device but it feeds the actual relay large and even L1 is unlikely to throw a
on/off state back to the LoRa Node. spanner in the solder works.

12 March & April 2020 www.elektormagazine.com

180666 EN The Elektor LoRa Node.indd 12 06/02/2020 08:38


COMPONENT LIST

COMPONENT LIST

www.elektormagazine.com March & April 2020 13

180666 EN The Elektor LoRa Node.indd 13 06/02/2020 08:38


COMPONENT LIST

K3 employs only seven of the sixteen housing. We had to take the second row Software installation
pins on this PCB. It has two options of contacts for granted — we simply The complete software package for the
as discussed below but both assume couldn’t find a single-row socket strip Elektor LoRa Node is available at the
the LoRa Node board has a standard with a suitable height. expected place [6]. The archive file also
0.1-inch pitched, angled connector in includes a detailed installation proce-
position K5. The seven pins in positions However, the footprint on the PCB for dure which cannot be printed here due
11 through 17 (see board 180516-1) connector K3 was adjusted in such a to lack of space.
are enough, but K3 can also be a 17-pin way that normal 0.1-inch through-hole
pinheader (cut to length) over the full socket strips can also be used. They are When it comes to firmware development
length of K5. useful if you choose a different, taller for the LoRa Node board you can choose
The Würth Elektronik connector identi- housing. You can also omit K3 altogether the hard-core “C” way using either the
fied as K3 in the parts list may be and solder the LoRa Node’s right-an- STMCubeIDE, or the easy-peasy way
more difficult to obtain compared to a gled connector the to both PCBs, but with the Arduino IDE. For the latter, you
custom cut pinheader. Still, we went then you can’t easily separate the PCB need to download the Arduino IDE and
for it because of its low height allow- anymore. the STM32 Arduino Core. In the Arduino
ing the two boards, mounted at right Pushbutton S1 is mounted on the housing IDE, add this url to the Additional Boards
angles, to be fitted in the recommended and connected to the PCB with two wires. Manager:

Web Links
[1] KiCAD Like a Pro book: www.elektor.com/kicad-like-a-pro
[2] GPS module from Elektor Store: www.elektor.com/open-smart-gps-serial-gps-module-for-arduino-apm2-5-flight-control
[3] STM32duino project: https://github.com/stm32duino/Arduino_Core_STM32
[4] Velocity factor: https://en.wikipedia.org/wiki/Velocity_factor
[5] STM32CubeProgrammer: www.st.com/en/development-tools/stm32cubeprog.html
[6] Project software: www.elektormagazine.com/180666-01
[7] STM32 boards adding: https://github.com/stm32duino/wiki/wiki/Getting-Started

14 March & April 2020 www.elektormagazine.com

180666 EN The Elektor LoRa Node.indd 14 06/02/2020 08:38


Figure 12. Espy and copy these board settings. Figure 13. This was just one of the the steps taken by Elektor Labs to
get the LoRa Node (an incarnation of the LoRaWAN Node Experimental
Platform) approved and registered as an STM32Arduino device. Elektor
readers do not have to “enjoy” this administrative process; the project
software is ready to roll.

https://github.com/stm32duino/ toggling the Reset button. Now you can STM32duino ‘gremium’ (Figure 13 —
BoardManagerFiles/raw/master/ upload new firmware to the board. thanks guys). As a happy consequence,
STM32/package_stm_index.json you no longer need to patch anything
For your benefit as described above, and you can simply
and install the STM32 Boards following At the start of the article we said that select the Elektor LoRa Node board from
the instructions posted at [7]. the story was going to be partly chrono- the list of approved items.
Now you have the STM32 core but for logical. Since mid-December 2019, the (180666-01)
the Elektor LoRa Node you need to add Elektor LoRaWAN Node Experimental
a few things to your local filesystem. For Platform board definitions have been
Windows go to: merged into the official STM32Arduino
Git repository, after complying with
%localappdata%\Arduino15\packages\ the rather strict conditions set by the
STM32\hardware\stm32\1.7.0

and at the end of ‘Boards.txt’ add the


contents of the file called Add_To_Board.
txt we wrote for you. Also copy the 4 SALE @ WWW.ELEKTOR.COM
folder:
ªLoRaWAN Elektor Lora Node, 180516 V3.1
ELEKTOR_LORA_NODE_CORE_F072xC www.elektor.com/180516-1
to the ’Versions’ folder. Now you should
ªLoRa Button board, 180666-2 v 1.2
be good to go and ready to compile the
www.elektor.com/180666-2
software for the board. At the end you
ªLoRa AC Switch board, 180666 1 V 1.1.
need to define the Boardsettings shown
www.elektor.com/180666-1
in Figure 12.
ªRFM95W-868S2 LoRa Transceiver, Elektor SKU 18715
www.elektor.com/18715
At this point you are good to go to
compile software for the board. To ªKiCAD Like a Pro book:
www.elektor.com/kicad-like-a-pro
do an upload you need to install the
STM32CubeProgrammer [5]. If you now ªGPS module (optional):
www.elektor.com/open-smart-gps-serial-gps-module-for-arduino-apm2-5-flight-control
wish to upload code, put the board into
bootloader mode by pressing Boot and

www.elektormagazine.com March & April 2020 15

180666 EN The Elektor LoRa Node.indd 15 06/02/2020 08:38


Interactive
Corrections & Updates || Questions & Answers
By Clemens Valens

Updates of and additions to projects published in ElektorLabs Magazine spiced up with tips & tricks, tech
advice, and answers to reader's questions.

Arduino Uno issues involving the bootloader

Q: I recently bought the Elektor book C Programming with Arduino and started
working with it enthusiastically. For this I also bought an Atmel ICE programmer
from Microchip which works very well with Atmel Studio 7.0 (AS7), the IDE
used in the book. Now I have noticed that the Arduino Uno can no longer be
programmed by the Arduino IDE. Another Uno that I have still works well with
the Arduino IDE software. Reconnecting the board, restarting the computer
or the software and similar manipulations, doesn’t make any difference. I’ve
searched several forums on the Internet, but I can’t find a solution to this
problem. Do you have a suggestion or, even better, a solution?
A: The thing that turns a microcontroller into an Arduino-compatible micro-
controller is the Arduino bootloader. This is a small piece of software inside
the MCU’s memory capable of writing a program it received somehow (mostly
across a serial connection), to the MCU’s memory without overwriting itself.
The Arduino IDE knows about the bootloader and employs the serial port
(across USB) to program the Arduino board.
Atmel Studio is totally unaware of Arduino or the Arduino bootloader, hence
a special programming adapter is required to burn a program into the MCU’s
memory. The programming adapter, like the Atmel ICE, connects to the
MCU’s in-system programming (ISP) interface to gain direct access to the
MCU’s memory. Without special measures
it will overwrite all the memory contents
including the bootloader. This explains why
the Arduino Uno stopped working with the
Arduino IDE: the bootloader is gone!
AS7 with Atmel ICE can be used to repro-
gram the Arduino bootloader. The file
needed is [Arduino]\hardware\arduino\
avr\bootloaders\optiboot\optiboot_
atmega328.hex where [Arduino] is the
folder containing the file arduino.exe.
Once in AS7, open ‘Device Programming’
(Shift-Ctrl-P). Then, on the ‘Memories’
tab in the ‘Flash’ section, click the
‘Browse for file’ button and navigate to
the bootloader’s HEX file. Click ‘Program’
to flash the bootloader into the MCU.
There are many ways of configuring
AS7 to make it work with Arduino
without deleting the bootloader every
time you hit ‘Program’. Methods range
from installing AS7 extensions to
adapting linker settings. Search the
Internet to find the method that suits
you best.

16 March & April 2020 www.elektormagazine.com

190379-B EN Interactive.indd 16 06/02/2020 08:43


AVR Playground running from a 16-MHz crystal. AVR Playground running from its internal 8-MHz RC-oscillator.

Q: Is it possible to use the ATmega328 of an Arduino Uno board changes, the serial port speed changes too. Unfortunately, the
on the AVR Playground and vice versa? Arduino IDE does not allow the user to specify the speed of the
A: Even though the Arduino Uno and the AVR Playground are serial port for uploading sketches. When you select an Arduino
based on the same ATmega328 microcontroller, you cannot Uno board in the Arduino IDE, the IDE supposes that it runs at
simply swap them. That’s due to the way the clock oscillator is 16 MHz and requires an upload speed of 115,200 baud. If an
used on the boards. The Arduino Uno runs off a 16-MHz clock Uno doesn’t run at 16 MHz, uploading a sketch will therefore
driven by its 16-MHz crystal. By contrast, the AVR Playground fail. Similarly, an AVR Playground is expected by the IDE to
defaults to using the MCU’s internal 8-MHz RC-oscillator. run at 8 MHz with an upload speed of 57,600 baud.
You can replace the MCU on an Arduino Uno by one used on The simplicity of the Arduino IDE is appreciated by most of its
an AVR Playground. The Uno will then work exactly as an AVR users, but sometimes it can get in the way. The adventurous
Playground running at 8 MHz. However, the other way around, IDE user can try to modify the file boards.txt which contains
i.e. replacing the MCU on an AVR Playground by one taken from all the information about the boards. However, there may be
an Arduino Uno, is only possible when the AVR Playground is more than one of these files in your Arduino IDE installation.
equipped with a 16-MHz crystal (X1) and when its jumpers on The keys to change are [Board].upload.speed and [Board].
K5 are on pins 1-3 and 2-4. With these conditions satisfied, build.f_cpu (where [Board] is the name of the board). The IDE
the AVR Playground will function exactly as an Arduino Uno. has to be restarted to take any changes to this file into account.
But there is more to the story. The bootloader programmed
in the MCU of an Arduino-compatible board is tuned to the www.elektormagazine.com/labs/avr-playground-129009-2
MCU’s clock speed in order to configure the speed of the serial
port used for uploading sketches. When the clock frequency

New GPS for New Precise Nixie Clock

It appears that the Maestro type A2035-H GPS module used in avoid a short circuit between the shielding of the module and
this project is no longer in production. However, Lantronix, who a via underneath it.
acquired Maestro in the summer of 2019, offers the A2235-H,
a newer albeit smaller GPS module that does fit on our PCB. www.elektormagazine.com/labs/150189-6-digit-nixie-clock
It needs two additional 2.2-kΩ pull-up resistors from the I2C 190379-B-01
pins to the 1.8-V output of the module. You may also need
some (Kapton) isolation between the PCB and the module to

www.elektormagazine.com March & April 2020 17

190379-B EN Interactive.indd 17 06/02/2020 08:43


all–analogue

Analogue Electronics Design


Case Study #1 — Section 2:
Preamplifier optimized for MEMS microphone
By Ton Giesberts (Elektor Labs)

In this article series, experts in the field explore aspects of analogue electronics design that should benefit
an increasingly ‘digital-only’ audience, and underpin that analogue is not black magic. In Case Study
#1, Section 1 we discussed the MEMS microphone used for the first time in an Elektor project called
Bat Detector-PLUS. In this installment we continue with design aspects of the sophisticated microphone
amplifier in the project.

This sub-installment in the Analogue Electronics Design article But back to the number of opamps needed. That’s difficult to
series provides a documented and commented evaluation of calculate because you should assume that the bandwidth per
the original microphone preamplifier used in the Bat Detec- amplifier may not track that of a first-order low-pass filter. In
torPLUS project [1], and discusses solutions to optimizing it for addition, with more amplifiers in series, the bandwidth is also
use with the MEMS microphone examined in Section 1 of this smaller than is the case with one amplifier. But for the sake of
Case Study [2]. convenience, let’s consider this response to be like a first-order
For a full appreciation of the electronics design task done it’s RC network. This certainly applies to equal sections used to
useful if not mandatory to refer to the circuit diagram of the dimension the lower limit; more sections then means a higher
microphone preamplifier mentioned a number of times, so for roll-off point for the lower limit.
convenience it is shown as the highlighted section in Figure 1. For a first-order high-pass RC filter, the transfer function is
We purposely reprint the entire schematic of the Bat Detector- expressed as:
PLUS
to explicitly show the way the preamplifier is:  
jωRC / (1 + jωRC) (eq. 1)
• driven (from the microphone connected on K1);  
• loaded (by IC4A); Due to the phase rotation, the actual voltage distribution is
• powered (symmetrically at ±4.5 V by IC1). then:
   
So you have ’the full picture’. But first, an evaluation of the ωRC / √(1 + (ωRC)2) (eq. 2)
original circuit. After all these years, the low-power opamp type  
TL062 with its 200 µA of quiescent supply current per amplifier For the roll-off point this equals ½√2. That’s the well-known
is not so bad compared to many current low-power versions ‘–3 dB point’ but for sticklers we note:
almost exclusively to be found in ever smaller SMD versions.  
Evidently there are now (much) better ones. The gain-band- 20log ½√2 = –3.0103
width product (GBW) is 1 MHz and that is a stumbling block  
in the design, especially because substantial amplification is However, we want to know what the actual bandwidth will be
needed: here a whopping 1845 times. If we include the 400 Ω when more sections are connected in series. Instead of ½√2
of the MEMS microphone in the total gain, then using only one we take the factor x. Rearranging, we get:
opamp would yield a measly 540-Hz bandwidth. To increase the  
bandwidth, more successive amplifiers, each with less amplifi- ωRC = x / √(1 – x2) (eq. 3)
cation and therefore more bandwidth are needed, here, three  
pieces. But how many should there be in practice, and does For example, for a –3 dB point, enter the value ½√2 for x
this outweigh the proportionally higher power consumption and it turns out that this results in 1 exactly and with it the
than a much faster opamp with higher power consumption? well-known standard formula that applies to the frequency of
Nowadays there are “wicked-fast“ fast opamps like the OPA2889 the –3 dB roll-off point:
dual opamp with its 75-MHz GBW at 20 times amplification and  
a current consumption of 0.92 mA for both amplifiers. f = 1 / (2πRC) (eq. 4)

18 March & April 2020 www.elektormagazine.com

191230 EN All-Analogue.indd 18 06/02/2020 08:44


+4V5

IC5
+4V5 LP2950ACZ-5.0 +5V_PIC
IC1 C7 C9
BT1 R1 1 3
2
100n 10µ 8 8 8

47k
7 R35 TP1
6
C1 C2 C3 C4 100R IC2 IC3 IC4 0V 2
9V 3 5 C22 C23 C24
4 4 4 4
R2
220µ 100n 100n 100µ C5 C6 1 C8 C10 100n 100n 10µ
47k TL061CP
10µ 100n 100n 10µ TP2
-4V5 -4V5
-4V5

C13 C15 C17


+4V5
R16
R3 4p7 4p7 4p7 10k R19
R6 R9 R12 D1 36k
4k7

K1 100k 100k 82k


C12
+ 1n R4 C14 R7 C16 C18 BAT43 6
R10 R13
2 6 2 2 D2 7
7k5 7k5 7k5 10k R17 IC4B
1 7 1 1 5
D3 R5 IC2A 1n R8 IC2B 1n R11 IC3A 470p R14 IC4A 10k
C11 3 5 3 3
10k 10k 10k 10k BAT43 R18
C19
MIC. R15
100n

10k
3V 0W5
10n

30k
IC2, IC3, IC4 = TL062CP
+5V_PIC
-4V5
T1
P1 R20
50k
10k
C21
+5V_PIC +5V_PIC Mod. BC C20
TP3 548B
R26 -4V5
1n 10n
R21
10k

14 R32 -4V5
10k

VDD +4V5

4k7
S1 6 17
RB0 IC6 RA0 T5
6 T2 1 16 7 18 R29
R24 RB1 RA1 R34
7 2 15 8 PIC 1 +4V5
IC3B 47k RB2 RA2 BC
47k

16F1827 RA3 T4

47k
5 3 14 9 2
RB3 548B
R22 BC 4 13 10 -I/P 3 1 6
548B
RB4 RA4 BC
R23 5 12 11
RB5 RA5/MCLR/Vpp
4
548B -4V5 C26 R33
4
MODE VCC
5 LS1
100k

1M 6 11 12 15 10k IN- OUT-


R25 RB6 RA6 R30 R31 IC7
7 10 13 16 10n
RB7 RA7
R27 R28 TDA8541T
10k

4k7

39k

8 9 /N1
VSS 3 8
P2 C28 K2 IN+ OUT+
5 T3
10k

10k

100k SVR GND


10n 2 7
C25
LED1 LED2
BC P3 C27
-4V5 558B
Line out
10n
SIGNAL MUTE 10k 47µ
150346 - 11

-4V5

Figure 1: Full circuit of the Bat DetectorPLUS with the 3-stage microphone preamplifier highlighted.

However, we want to learn the new roll-off if it’s known from First simulate...
one section. For example, if we take three sections as in the and only then design a PCB, or build a prototype on bread-
circuit, we should find the frequency where the attenuation is board or on a piece of veroboard. If only to find out if more
1 dB. For convenience, we don’t take –3.0103/3 but just –1. sections are needed or if something else needs to be adjusted.
From 20log x = –1 it follows that: Often, simulating a circuit is faster than doing the maths on it.
  Simulation on the preamp showed that the final frequency range
x = 10(-1/20)  (eq. 5) was 23 kHz to 58 kHz — too low! In our prototype, the upper
  frequency limit was even slightly lower at about 44 kHz. This is
The attenuation to be found for the –1 dB point then works probably due to tolerance on the opamps as well as the lower
out at 0.891251. supply voltage than stated in the datasheet for the GBW. The
Entering it into equation 3, ωRC equals 1.96523. Consequently, 1-MHz GBW rating for a TL062 is a typical value; maximum
for three equal sections, the new low roll-off will be almost twice and minimum are not specified. And as already mentioned,
as high. In the case of a low-pass filter, the roll-off is then almost the response of each section is probably not purely first-order.
a factor of two lower. For n sections, the following applies:
  How many sections then...
x = 10((-3/n)/20) (eq. 6) ... in case we want to use that good old TL062? It is recom-
  mended not to have the desired bandwidth determined by the
In the case of the TL062, a gain of 13.3 times (i.e. 100 / 7.5) limit of the opamp, its GBW rating being subject to consid-
for the middle section, means a roll-off at 75 kHz. The additional erable spread. The equally negative effects on distortion and
4.7-pF capacitor in the feedback path further lowers the intermodulation are not much of a problem here. It is better
roll-off frequency to about 60 kHz per section and changes that this limit be substantially higher than necessary before
the frequency response to a higher order. the filtering, say a factor of 2, preferably 3, and let a capac-

www.elektormagazine.com March & April 2020 19

191230 EN All-Analogue.indd 19 06/02/2020 08:44


itor in the feedback circuit determine the desired bandwidth.
Let’s see where we end up. The higher limit of the opamp’s
effective frequency range — and consequently the lower
maximum gain that can be set per section — naturally has an
impact on the number of sections required. With the conser-
vative use of a 3 times higher bandwidth, the amplification per
section should not exceed:
 
1 MHz / 360 kHz = 2.78 times.
 
Intuitively, it means a lot of sections will be needed! Let’s call
the amplification per section A (rounded off at 1850) and the
number of sections, n. Then:
 
An = 1850 (eq. 7)
 
To calculate n back we write: Figure 2: The graph shows the effect of eight identical amplifiers in series
  (source = 0 Ω).
n = (log1850) / (log A) (eq. 8)
 
Substituting 2.78 for A, then n equals 7.36. In that case at least cation of 2.561), eight sections in series provide a bandwidth
eight sections are needed, or two quad opamps, i.e. TL064 ICs of 107.3 kHz, as shown in Figure 2. It’s not the best solution.
with a total current consumption of 1.6 mA. This is not very Also, the 1-nF coupling capacitor has to be tweaked; if we really
practical and using a faster (dual) opamp seems a much better assume 10 kHz this would result in an ‘awkward’ 7 nF. Using
choice, especially in regard of the number of parts and their a readily available 10-nF capacitor, the low roll-off frequency
space consumption on the circuit board. The advantage of more will be 6.6 kHz. Another concept could be: fast opamp(s) and
opamps is a larger physical distance between the relatively active filters as an amplifier, with a Butterworth or Chebyshev
large output signal and the amplifier input, resulting in less characteristic, for example.
risk of oscillation due to parasitic coupling. With the lighting
fast SMD opamp it is recommended to use SMDs for the other Signal to noise ratio
parts too. Parasitic coupling to the microphone has no effect For the signal-to-noise ratio this will not be a good design
as it is a shielded device. In really bad cases only, the effect either, the first stages ruling the roost. At the input a non-in-
can occur on the connections such as connectors and cables verting amplifier may have suited better. It results in hardly any
to and from the circuit boards. attenuation due to the input resistance and the resistors in the
feedback of the first stage can be chosen considerably lower,
Wanted: bandwidth! which benefits the signal-to-noise ratio and dynamic range.
As a check, the theoretical bandwidth can be calculated again. The MEMS microphone used has a maximum output resistance
With eight sections, less gain is needed per section. In the case of 400 Ω. With an electret microphone, the value is even higher.
of n sections, the amplification per section is: The frequency response is not matched to the microphone.
  Unfortunately, most manufacturers do not specify the frequency
A = n√1850 (eq. 9) response above 20 kHz or so. Often it is only specified up to
  10 kHz, which is exactly the information we need for our appli-
With eight sections, the amplification needed per section is just cation! It would be nice if we could measure and verify that
2.561 times. Equation 6 yields 0.95775 for x. Using equation 3 personally. Absolute accuracy is not needed — a comparison
you can calculate that the new roll-off shifts by a factor of 3.33. with the known response of a wideband ultrasound source is
So the expected new roll-off frequency, without capacitors in adequate. The ramifications though for home construction are
the feedback circuit, becomes: another problem.
 
1000 / (2.561 × 3.33) = 117.3 kHz. Outlook
  The closing Section 3 of this Case Study will be published in
This is just shy of the desired bandwidth while we have already edition 2/2020 (March & April) of Elektor Magazine. It will
gone from three to eight sections. Yet it is not enough for discuss more all-analogue challenges and solutions including
the previously mentioned reasons, because it is still short of preamplifier dynamic range, input noise, opamp bias currents,
the desired bandwidth. In a simulation with 7.5 kΩ at the and 2- and 3-pin microphone modelling. Stay tuned.
input and 19.2075 kΩ for feedback (for a theoretical amplifi- 191230-01

Web Links
[1] Bat Dectector-PLUS article: www.elektormagazine.com/magazine/elektor-201607/29128
[2] Analogue Electronics Design (1): www.elektormagazine.com/191143-01

20 March & April 2020 www.elektormagazine.com

191230 EN All-Analogue.indd 20 06/02/2020 08:44


My IoT Button:
A Button for the Web
Part 1: IoT architecture

By Dr Veikko Krypczyk (Germany)

There’s a never-ending stream


of new applications in the IoT
environment. One of them
is the IoT button – a button
that can be programmed
and used for any desired
purpose. It requires a
network connection
and draws its logic
from the cloud. The
first article of this
series is about the
IoT architecture based
on serverless cloud
computing, as well as the
interaction of hardware
and software.

Ideas for new applications in the inter- The potential ment, and the same is true for using
net of things (IoT) are arising all the applications are manifold and could be cloud services. In the second article of
time. Many ideas are experimental or in the personal realm as well as the this series, we will use a bit of hardware,
are unlikely to quickly find a home in business realm. The basic idea is to use a some software and several configurations
the actual IoT. The vision of a self-re- hardware module in the form of a button to perform our first experiments, which
plenishing refrigerator will probably fail to send a signal. Where the signal is sent, will enable us to try out our own ideas
to materialise because most of us prefer what actions are associated with it and with this sort of IoT.
to do our food shopping according to which systems are involved, as well as
our current taste and in a trusted shop. whether it actually consists of a single IoT architecture
The IoT button is an interesting idea button, are initially undefined. The architecture of a modern IoT appli-
somewhere between a serious applica- First we should take this idea as an cation, regardless of its specific purpose
tion and a playful pastime. An IoT button opportunity to describe and under- or the ultimately chosen service, can be
could be used, for example, to: stand modern IoT architecture. In the represented as shown in Figure 1. The
first article of this series, we focus on individual devices on the left side of the
• start or stop something; the interactions of the components and figure can be sensors, actuators, or a
• order something; explore the functions and possibilities of combination of the two. Sensors measure
• call someone; cloud services. Very simple experiments parameters – for example, environmental
• count something. can be performed in the IoT environ- conditions such as temperature, monitor

www.elektormagazine.com March & April 2020 21

190303 EN My IoT-Button – Part 1.indd 21 06/02/2020 08:47


Company IT

Device Backend Services


IoT Cloud as
Pre-Integration
Stage

Device

190303-005 EB

Figure 1: Basic architecture of an IoT application with a cloud backend.

the status of systems – or send a signal • Device-based authentication: It and MQTT, for communication with the
when the state of a monitored system enables multiple login and authenti- devices.
changes. Actuators, by contrast, carry cation of devices, for example based
out responses – such as opening or on tokens or certificates. IoT cloud services
closing a radiator valve. Some IoT appli- • Secure communication: It provides The major cloud providers also offer
cation use both sensors and actuators. a secure communication channel functions that are adapted to the specific
In a certain sense, these applications through which data can be requirements of IoT. The market leaders
act as closed-loop systems operating exchanged with the IoT devices. for IoT solutions are the Windows Azure,
under the control of a remote application • Data forwarding: Some data can be Amazon Web Services, Q-loud and Oracle
system. Other IoT scenarios only involve evaluated and processed directly Cloud platforms. Choosing the right
the acquisition or monitoring of a state in the cloud, while other data must platform is not easy, and it is strongly
or status. In the case of our simple IoT be forwarded to other services for dependent on the intended purpose in
button, the only thing that is monitored further processing. In the figure each case [1]. The following criteria
is pushing the button. these services are shown as backend should be considered when choosing a
services of an existing company IT platform:
The information, which is that the state system. That would be the case with
of the button has changed, is transmit- an industrial IoT application. Simpler • Platform features: Which specific
ted over a network, which is usually the applications only forward the data features are available — such as
Internet. The signal is received by a to a program for evaluation and device management, authentication,
service on a server. The specific services visualisation. authorisation and data forwarding.
tailored to the requirements IoT appli-   • Platform attributes: This includes
cations are grouped in what is called In the case of the IoT button, the the aspects of data protection,
an IoT cloud. This IoT cloud plays a key responses triggered by pressing the encryption, and the user interface
role in all of this – it acts as a server, button must be defined. For example, (dashboard).
making it the communication partner of another IoT device in the form of an • Integration: Supported programming
the IoT devices. This is called server- actuator could be driven. languages, SDKs and interfaces.
less computing because only selected Along with these tasks, the IoT cloud • Other: This includes criteria such
functions are used in this case, rather should be as communicative as possible, as community and documentation,
than a complete server. Of course, the which means it should be able to function support, costs and the price model.
services run on the server of a service with a large number of devices. It should
provider, but you don’t have to worry be flexible enough to offer programming Most IoT cloud services can be tested
about configuration, administration, interfaces for a variety of systems. These free of charge up to a certain level of
or any other secondary activities. At a interfaces should preferably be provided use. Documented examples in the form
higher load level, for example with a by easily integrated SDKs (libraries) in of source code and configuration param-
large number of calls to the service, various target languages, such as C, eters are usually available on the provid-
additional resources are provided Python and Java. Generic communica- er’s website.
automatically (horizontal scaling). This is tion via a REST interface (see the inset
also something that you normally don’t “What is REST?”) should also be possible. IoT device integration
have to worry about as a user. The core The IoT cloud should additionally support The IoT devices are connected to the
functions of the IoT cloud are: various protocols, such as HTTPS, AMQP cloud service over the public Internet.

22 March & April 2020 www.elektormagazine.com

190303 EN My IoT-Button – Part 1.indd 22 06/02/2020 08:47


How this connection is established is not devices and the Azure cloud portal. It is a MQTT and HTTP protocols, enabling a
important in the first instance. Along cloud-hosted backend that supports the large degree of compatibility with many
with direct wired connection of station- connection of a large number of devices. devices. The integrated device manager
ary devices (LAN), wireless connec- The devices are integrated through SDKs, is a core function of Cloud IoT. The
tion over a local network (WLAN) or a which are available for various platforms managed devices can be modified using
mobile communication network (LTE) and programming languages. The IoT a dashboard, and control by software
is possible. This depends on the appli- hub also offers functions for manag- code is also possible. The device manager
cation, the available infrastructure, ing the connected devices. Each device determines the identity of a device and
the selected hardware, and the power has its own identity with access data provides unambiguous authentication.
consumption. For our IoT button, we or certificates, and each device can be End-to-end encryption is used for secure
assume the simplest possible integra- independently activated or deactivated data transmission. In technical terms,
tion into an existing local WLAN. The directly in the browser via the dashboard. Cloud IoT Core is a serverless service
IoT button should be versatile and the This functionality is also offered through that can be scaled horizontally with
housing should be compact (for example, APIs, to allow developers to manage IoT quantitative growth of demand without
similar to a light switch for a floor lamp), devices in their own applications The noticeable delays. It is based on a REST
so there are clearly defined require- online documentation provides compre- interface, making it largely independent
ments for the hardware. This means our hensive step-by-step instructions. For of the device systems. The fees for the
choice is limited to hardware platforms example, reference [3] describes how service depend on the usage and are
(boards) with easy WLAN connectivity to integrate a Raspberry Pi with the IoT graduated. Cloud IoT Core from Google
and the lowest possible power consump- hub and receive data from the device. is free up to a maximum monthly data
tion, especially in standby mode. These The Azure IoT Hub can be used free of volume of 250 MB. This service is there-
aspects will be addressed in more detail charge for prototyping and for commer- fore suitable for experiments, proto-
in the second article of this series, in cial or personal use, as long as you can typing, personal projects, or relatively
the descriptions of the experiments and live with a restricted number of calls. The small commercial projects. Similar cloud
initial prototypes. Free Edition does not incur any charges services for IoT — but almost exclusively
if you do not exchange more than 8,000 for industrial customers — are offered by
If we ignore the restrictions with regard messages per day with the device and Oracle [5], Amazon (AWS) [6] and the
to size, power supply and wireless the size of an individual message does Q-loud platform [7].
connection to the network, there is a not exceed 0.5 KB.
significantly larger selection of poten- The services from ThingsBoard [8]
tial platforms for our IoT device. For The Cloud IoT Core service from Google also deserve mention. They offer an
example, if the IoT button is intended to [4] has similar characteristics. This is a open-source cloud platform for IoT
be persistently located in one place, then fully managed service that can be used purposes. It can be used entirely free
it can be powered from the AC mains, so to manage devices and exchange data of charge if you install the associated
the power consumption in standby mode over the Internet. Cloud IoT Core can software on your own computer. In
is less critical, and a wired LAN connec- also interact with other cloud services manner of speaking, you create your
tion is also an option. from Google, such as Google Big Data own IoT backend, which is known as
Analytics, or ML services such as ‘on-premise’. You are personally respon-
IoT cloud providers Dataflow, BigQuery, BigTable, ML, Data sible for installation, maintenance and
Next we have to choose a provider for Studio or BI tools from partners. This operation. An attractive feature is the
the IoT cloud services. The Azure IoT Hub enables effective evaluation, process- variety of supported systems – among
service from Microsoft [2] is intended for ing and visualisation of IoT data in real other things, everything can run on
bidirectional communication between IoT time. The service supports the usual various Linux distributions (Ubuntu,

Advertisement

Extruded enclosures
standard and heatsink
More than 5000 different enclosure styles:
hammfg.com/electronics/small-case

01256 812812
[email protected]

www.elektormagazine.com March & April 2020 23

190303 EN My IoT-Button – Part 1.indd 23 06/02/2020 08:47


What is REST?
When a client and server communicate with data. An endpoint is composed of a
each other over the Internet, the relevant root endpoint, a path, and optional
API is usually based on REST [9][10]. REST parameters. For example, https://
Request URL
is the abbreviation of REpresentational api.github.com is the root endpoint
State Transfer. RESTful APIs are based on of GitHub and /users/veikkoef/
standardised protocols such as HTTP(S), repos is the path to the author’s
URI, JSON or XML. The following criteria are repository. Together they form the
decisive: HTTP Method endpoint https://api.github.com/
  users/veikkoef/repos. Parameters
• Client-server model: Communication takes can also be added – for example,
place on the basis of a client-server model. ?query1=value1&query2=value2.
The objective is flexible and generic use of For the methods you can choose from
the services across platform boundaries. Request Headers GET, POST, PUT/PATCH and DELETE.
• Stateless: Communication is always GET stands for read operations, which
stateless. Every request from the client to means reading data. GET requests
the server must be complete. The server only access the server for reading, so
cannot access any data from previous they can be sent as often as desired.
requests. Request Body GET is the default method. POST is
• Caching: Clients can store (cache) used for create operations, which
responses from the server. The allows means creating a data set. POST can
190303-006 EB
network outages to be bridged over and have side-effects. For example, a POST
enables temporary offline operation. The call can change fields in a database or
cached data can be used as an alternative Structure of a RESTful request. launch processes on the server. PUT/
for renewed requests, instead of using a PATCH is used for update operations,
new response from the server. and DELETE is used to delete data.
• Uniformity: The services use a uniform The third component of a request is
interface that is decoupled from the provided service. the header. The header serves to provide information for the
  client and the server. This can be used for many purposes,
A RESTful API is usually implemented with HTTP or HTTPS. such as authentication or provision of information about the
To use the services, the client sends a request to the server subsequent content.
and receives a response from the server. This is done by URL The fourth and final component of a request is the body,
using HTTP methods such as GET, POST and PUT. A request which is the data to be sent to the server. The body area is
consists of four components: endpoint, method, header, and only relevant for the POST, PUT, PATCH and DELETE methods.

CentOS, Red Hat), Windows, or a The software from ThingsBoard is also The functions of this server or cloud
Raspberry Pi 3. The latter option could offered as a managed cloud solution with service include the typical tasks of an
be particularly attractive for maker and graduated fees based on the volume IoT backend, which means managing
community projects or prototyping. of use, starting at USD 10 per month. devices, collecting and visualising data,

Web Links
[1] Platforms comparison:
www.informatik-aktuell.de/betrieb/virtualisierung/iot-in-der-cloud-erkenntnisse-und-erfahrungen-eines-plattformvergleichs.html
[2] Microsoft Azure IoT Hub: https://azure.microsoft.com/en-us/services/iot-hub/
[3] RPi in Azure: https://docs.microsoft.com/en-us/azure/iot-hub/iot-hub-raspberry-pi-kit-c-get-started
[4] Google IoT Core: https://cloud.google.com/iot-core/
[5] Oracle IoT cloud: www.oracle.com/internet-of-things/
[6] Amazon IoT cloud: https://aws.amazon.com/de/iot/
[7] Q-loud cloud: www.q-loud.de/
[8] ThingsBoard: https://thingsboard.io/
[9] REST: www.codecademy.com/articles/what-is-rest
[10] RESTful API: https://restfulapi.net/

24 March & April 2020 www.elektormagazine.com

190303 EN My IoT-Button – Part 1.indd 24 06/02/2020 08:47


Figure 2: Event processing can be defined graphically (source: ThingsBoard).

processing events, and remote proce- you a much better understanding of the
dure calls for controlling devices. The relationships and makes it easier to
functions are provided via a REST API, design your own devices.
making them system and device agnos- 190303-03
tic. Graphic layers for processing incom-
ing events can be defined conveniently
using the Rule Engine (Figure 2).

Conclusion and outlook


We have presented an overview of the
architecture of an IoT solution whose
core component is a cloud service for
managing IoT devices and for receiv-
ing and forwarding data. In the second
article of this series, we aim to put this
knowledge into practice by designing a 4 SALE @ WWW.ELEKTOR.COM
prototype of an IoT device in the form
of an IoT button. Although such devices ªMy Journey into the Cloud (book): 
www.elektor.com/my-journey-into-the-cloud
can be purchased ready-made, experi-
mentation is worthwhile because it gives

Advertisement

www.driven-by-kurtzersa.com

191007_Ersa_Anzeige_Elektor_Productronica-2019_185x59mm.indd 1 09.10.2019 13:00:13

www.elektormagazine.com March & April 2020 25

190303 EN My IoT-Button – Part 1.indd 25 06/02/2020 09:19


BASIC for
the ESP32 and ESP8266
Programming with Annex WiFi RDS

By Peter Neufeld (Germany)

Annex WiFi RDS (Rapid Development Suite) is a development environment originally designed to use the
BASIC programming language on inexpensive ESP8266 modules. Meanwhile an ESP32 version is also
available. Those who have so far programmed the 8-bit controllers from Atmel/Microchip with AVR-BASIC
now have access to the 32-bit performance class.

Since an ESP32 is practically an ESP8266 with more power, after BASIC variant for non-commercial, private use does not incur
the introduction of the first version for ESP8266, a function- any costs. You might be tempted to give it a try?
ally identical version was also designed for ESP32. At the time
of writing this article, it is still in beta stage, but it should be Annex BASIC
final by March. Annex WiFi RDS [1] is based on the original concept of
If you like to develop small projects with network connection, ESPbasic [2], on which the developer Francesco Ceccarella
you don’t have to struggle with the Arduino IDE and C/C++ a.k.a. “chicciocb” collaborated at the time. However, Annex is
anymore. BASIC is just simpler. In addition, the use of this not just another BASIC variant, but a completely revised suite

Features
Annex WiFi RDS comprises these functions: • Access to all I/O pins, 1-Wire, SPI, I2C, PWM, Servo,
NeoPixel, USART.
• Integrated IDE via web server, use with web browser
• Error handling, watchdog.
(optimized for Chrome and Firefox).
• TCP (HTTP GET and POST).
• BASIC interpreter with floating point (double precision) and
• UDP communication.
string variables, multidimensional arrays (float and string)
• Sending e-mails via SMTP SSL server.
and subroutines.
• AJAX, ESP-NOW, MQTT and FTP communication (client).
• Syntax highlighting with context-sensitive help.
• IMU/AHRS fusion algorithms 6 and 9 DOF (Madgwick and
• Programmable web and file server. Mahony).
• Supports OTA updates (firmware updates via WLAN). • PID controller (4 channels).
• Supports asynchronous events (interrupts, timers, web • Windows-based utility suite (Annex Toolkit) with:
access, UDP etc.). • Flasher, File Manager, Backup/Restore, HTML Converter,
• Breakpoints, immediate execution of commands, display of Serial Port Monitor, OTA Update Server, UDP Console and IP
variables, single step. Scan Tool.

26 March & April 2020 www.elektormagazine.com

190400 EN BASIC for ESP32.indd 26 06/02/2020 08:49


Installation
The installation and commissioning in your own WLAN is
described in detail at [4]. Below is a brief summary of the
most important points:
• The firmware and any other files are transferred to
an ESP module via the serial interface or USB and its
memory may be deleted beforehand.
• Log in in the access point mode (delivery status) of the
ESP module or better integrate the module into your own
WLAN as a WLAN client.
• Set basic configurations such as LAN parameters,
passwords, time zone/DST, Autostart BASIC program,
OTA server, etc.
Now everything is ready for browser-based loading, editing,
Figure 1: The Annex Serial Flasher tool for transferring the firmware to debugging and execution of BASIC programs.
an ESP module.

that offers improved functions, higher reliability and optimized support — on the other hand, these functions also consume
use of the capabilities of the Espressif controllers. In addition, memory and therefore limit the scope of your own programs.
appropriate documentation was also created. However, the necessary means are available to communicate
with external devices on the protocol level from your own
The functional range of the IDE including the BASIC inter- BASIC subroutines. For example, it is also feasible to address
preter is amazing (see Features box). The complete software peripherals not listed here via SPI or I2C with your own code.
is in the microcontroller and runs in the web browser, which Annex WiFi RDS is only available in English. However, the
shows the integrated website. The ESP module provides either developer is very active and responds quickly to feedback in
a WLAN access point and a web server under the IP address the forum on the project website [1]. From the project website
192.168.4.1 or you connect the module to your WAN via [3] the IDE for Windows systems can be downloaded as a
(static) DHCP and note the IP address received from the ZIP archive and unzipped anywhere. The included application
router or configured there. Using the latter, the ESP can also ANNEX-toolkit.exe allows the installation of the BASIC inter-
synchronize the time and date with an Internet time server preter on ESP modules. Hints for the installation are given in
without an additional hardware clock. the Installation box.

IDE Once the firmware including interpreter and IDE as well as


Unlike compiler-based approaches for ESP controllers such as optional examples have been installed on the ESP controller
the Arduino IDE, the Annex firmware contains a fixed, non-con- and the controller is accessible via WLAN, everything can be
figuration-dependent, integrated set of functions and drivers done completely on the PC in the window of the browser which
for common peripherals (see Hardware Support box). This has loaded the IDE website in the controller. The software is
is both a blessing and a curse: On the one hand, everything is specially optimized for Firefox and Chrome. In addition, it is
already stored in the module to address all common hardware also possible to communicate over the serial interface using
and immediately run any script code using this with full language the Annex Toolkit during development, which is helpful for

Hardware Support
The following devices, actuators and sensors are • LCD with ST7920 with 128 × 64 pixels monochrome.
directly supported with dedicated commands and • Graphic OLED display with SSD1306 or SH1106;
functions: 128 × 64 pixels monochrome.
• DHT11, DHT21 and DHT22 temperature/humidity sensors. • Graphical LCD with ILI9341; 320 × 240 pixels in 16 bit
• DS18B20 temperature sensor. color.
• BME280 Temperature, humidity and air pressure sensor. • 7-segment display with TM1637; 4 digits.
• APDS9960 Distance, light (intensity and colour) and • 7-segment display with TM1638; 8 digits plus 8 LEDs and
gesture sensor. 8 buttons.
• BNO055 absolute orientation sensor. • 7-segment display with MAX7219; 8 digits.
• HC-SR04 ultrasonic sensor (distance measurement). • Dot-matrix display with MAX7219; 8 × 8 dots.
• DS1307 and DS3231 RTC clock module. • Color LEDs Neopixel WS2812.
• PCA9685 PWM/SERVO module. • Dot-matrix display with neopixel WS2812; 8 × 8 dots.
• LCD with HD44780 via I2C; 1/2/4 lines of • Infrared interface; bidirectional (common RC protocols).
16/20 characters each.

www.elektormagazine.com March & April 2020 27

190400 EN BASIC for ESP32.indd 27 06/02/2020 08:49


troubleshooting. In parallel to the output of data via the serial
interface, there is also an output to an area of the IDE called
Wlog, which allows development e.g. with a notebook without
a cable connection to the ESP module. It is even possible to
work with several modules in parallel.

Further aspects
To ensure that the BASIC interpreter requires as little RAM
as possible, the BASIC script is copied from SPIFF memory
to a designated area in flash memory for execution, so that
only the list of program lines, the branch identifiers and the
list of user-defined subroutines need to be loaded into the
scarce module memory. This is slightly slower than direct
execution in RAM, but it saves RAM in favour of variables,
thus allowing relatively large programs. This is less of a
problem with ESP32, which has four times more RAM than
the ESP8266.
Another performance consideration is that an ESP controlle
rmust always be able to execute multiple activities in the
background (web server, file server, etc.). It therefore needs
sufficient free RAM for these tasks. Parallel-performed actions
inevitably affect the execution speed of its own code.
The developer says that Annex-BASIC is largely compatible with
the well-known PC variants GW-BASIC and Visual Basic and
shares many concepts, ideas and syntax with these models.
There is also compatibility with the Micromite project [5], a
Figure 2: The Annex Editor in the browser window with the example BASIC variant for PIC32 microcontrollers. The interpreter is
“Hello World”.
based on the MiniBasic project [6] and the text editor on the
EditArea project [7].
Naturally the execution speed of the interpreter cannot keep
up with that of BASIC compilers. But for the usual tasks the
interpreted BASIC is well suited on ESP controllers, suffi-
ciently fast, reliable and very easy to use thanks to its brows-
er-based nature. Again according to the developer, the BASIC
on an ESP8266 in the “1980s BASIC benchmark” is about
two to four times slower than under Micromite at 48 MHz
clock. Relative to what this IDE has to offer, this is not a
Figure 3: Output of the example “Hello World”.
bad performance.
In the article “Hourglass with ESP8266 and Annex WiFi RDS” in
the next Elektor edition there is an instructive practical example
based on this attractive IDE. The version for ESP32 has been
4 SALE @ WWW.ELEKTOR.COM equipped with some useful extensions for this SoC.
190400-03
ªESP32 solo
www.elektor.com/esp32-solo-1-wifi-bt-ble
ªESP32 DevKitC
www.elektor.com/esp32-devkitc

Web Links
[1] Annex WiFi RDS: https://sites.google.com/site/annexwifi/home
[2] ESPbasic: www.esp8266basic.com
[3] Downloads: https://sites.google.com/site/annexwifi/downloads
[4] First Steps: https://sites.google.com/site/annexwifi/home/first-steps
[5] Micromite: http://geoffg.net/micromite.html
[6] MiniBasic: https://malcolmmclean.github.io/minibasic/web/MiniBasicHome.html
[7] EditArea: www.cdolivet.com/editarea/

28 March & April 2020 www.elektormagazine.com

190400 EN BASIC for ESP32.indd 28 06/02/2020 08:49


LABS PROJECT

ESP32 Doorbell via Telegram


“The UPS Man Always Rings Once”

By Luc Lemmens (Elektor Labs)

It happens to all of us — you’re at home and there’s a caller at the door but for some reason or other you do
not hear the doorbell buzz or ring! No problem if the person at the door has your phone number handy as he
or she will be able to get hold of you. In all other cases, Catch-22 governs, which is especially annoying when
you stayed home desperately waiting for a parcel delivery within a certain time frame. Here now comes a DIY
project to end such inconvenience.

Delivery folks and some postmen don’t note in your mailbox either advising of the Telegram for you!
usually have the patience or the time to parcel pickup location, or of a scheduled As soon as the doorbell rings, the circuit
call again, and later in the day you’ll find a alternative for the second delivery attempt. we’re about to describe sends a message

www.elektormagazine.com March & April 2020 29

191145 EN ESP32 Doorbell via Telegram.indd 29 06/02/2020 08:51


PROJECT DECODER
ESP32
Arduino IoT
M5Stack

entry level
Æ intermediate level
expert level

3 hours approx.

Arduino IDE,
Figure 1: The M5Stack ESP32 Basic Core module available from the Elektor Store.
regular lab tools

monochrome cartoons [1]. project we had to grapple with a most


€85 approx.
Back to the doorbell, how could we unusual phenomenon that ultimately
forget? Provided your Telegram app is took a lot more time to overcome than
active and connected to the Telegram expected and planned, see the ‘Close
server (by Wi-Fi or mobile network), it Encounters’ text frame.
will alert you of a visitor at your doorstep
no matter where you are. If you are dead Hardware:
to your smartphone or computer on sure who it is and completely trust that M5Stack ESP32 Basic Core
which an app called Telegram is running. person, you can even return a ‘message’ With minor modifications to the software,
Telegram, its makers say, "is a cloud- that operates an electric door opener, this project can be used with any ESP32
based mobile and desktop messag- meaning you don’t even have to scurry or -8266 module. For this project though
ing app with a focus on security and to the front door, or, as they used to do we went for the delightful M5Stack ESP32
speed.” For sticklers, the official name in certain cities on Holland, holler down Basic Core module available from the
is Telegram Messenger. Like many 100% the stairwell and pull the door rope. Elektor Store, see the @ www.elektor.
Internet driven communication tools for com promotion and Figure 1. It’s a
the masses, Telegram comes in various Telegram meets ESP32 — compact module in a neat housing with
guises. Like mobile apps for: with a hiccup all ot his thrown in:
• Phone/iPad; In this article we will see that Telegram • a graphics display;
• Android; is easy to set up and link to a ‘bot’ our • a set of pushbuttons;
• Windows phone; automated intelligent processing. In our • a loudspeaker;
case we mean remote communication • a built-in rechargeable battery.
as well as desktop apps for: and control using an ESP32, specifically,
• PC/Mac/Linux; to send a message when a key is pressed The I/O lines on the M5Stack ESP32 Basic
• MacOS; and to translate a (possible) answer into Core are accessible on connectors at the
• Web-browser. the activation of a relay. Naturally the outside. However, if you open the back
options are not limited to this relatively of the box and remove a plug-in board,
Telegram is an instant messaging service simple application — the concept can you’ll find a 30-way extension connector
not unlike WhatsApp in terms of function- easily be adapted and expanded to meet for your homebrew hardware.
ality. Both services are linked to your personal requirements. For small extensions like this one, the
mobile phone number. On top of that, extra hardware fits on a board equal in
Telegram also offers to register your The ESP32 (and its predecessor called size to the M5Stack module itself. With
username, enabling your account to ESP8266), continues to get exten- an extra part for the housing, for which
migrate with you when you get a new sive coverage in many Elektor projects designs for 3D printing can be found
mobile number. There are more subtle and books. Here, we’ll be using the abound on the web [2], you have a neatly
and less subtle differences between the ESP32 as a smart module that interacts finished device with not much extra effort
two messaging services and as expected, with the outside world through Wi-Fi. to boost the project from an experimen-
the Internet abounds with comparisons, Together with the well-known Arduino tal prototype to a box that also looks
bashing, glorification, fans, haters, and development environment and the good in the living room. In short: this
debate. UniversalTelegram bot library, develop- M5Stack module is great as a foundation
If you are curious now, stop reading here ing ‘simple’ applications like our doorbell for many ESP32 designs, ranging from
for a moment and experience the sparse should be a piece of cake. In reality project development platforms to ‘closed’
if not Spartan, Telegram website with its though, during the development of this or ‘turnkey’ devices (start-ups,-r-u-lis-

30 March & April 2020 www.elektormagazine.com

191145 EN ESP32 Doorbell via Telegram.indd 30 06/02/2020 08:51


tening?). In principle, you can also use
the M5Stack and our extension board to
+3V3
build a complete doorbell installation. The 2 1
4 3
built-in loudspeaker can compete with a 6 5
R1 R2

2k2

10k
‘real’ doorbell in terms of volume, and a K1 8 7
separate doorbell button can be wired in 10 9
button +3V3
12 11
parallel with, or in lieu of, the optocou-
14 13
pler’s output transistor. The ringing IC1
FOD814 GPIO17 16 15
signal should be added in the Arduino 18 17
GPIO5 20 19
sketch, and the logic level at GPIO17
22 21
inverted if the button is connected like 24 23
this. However, this will not be discussed +5V 26 25
+5V
here, we will limit ourselves to a doorbell 28 27
K3
RE1 30 29
extension that’s connected to an existing opener D1
1N4148
installation! G5V-H1 5DC K2

BT1
Schematic R3
Figure 2 shows the schematic for the 10k

‘Telegram’ed’ doorbell — it couldn’t be T1


BC337
simpler. We assume that the M5Stack 191145-1 KD
module is externally powered on USB,
meaning the additional hardware only
provides the control of a door opener
Figure 2: Schematic for the doorbell using the powerful combination of Arduino, ESP32 and the free
via T1 and RE1, as well as connection
online messaging app and service called ‘Telegram’.
to the doorbell button via optocoupler
IC1. Our doorbell extension can there-
fore be connected directly to an exist-
ing doorbell system, so the two wires inserted from the copper side (‘bottom’ starts by downloading the Telegram
of the doorbell button are connected of the PCB) upwards and get soldered on app from the App Store or Google Play.
to K1 of our circuit. Traditionally, an the component side. The short pins are Installing that app is plain sailing — the
electric doorbell is normally supplied inserted into the M5Stack module socket account gets linked to the mobile phone
with an AC voltage, but the bell voltage and the plastic part of K2 also serves as number. Once that’s done, it’s best to
has never been a standard. Depending a spacer between the two circuit boards. install the corresponding Telegram
on the installation, this can be anything app on your PC or Mac as well, which
between 6 V and 24 V and there will Telegram installation works out differently once the connec-
probably also be exotic variants outside The next step is to create an account on tion between Telegram and the ESP32
this range. This alternating voltage is Telegram on your mobile phone, which sketch is made.
present on the button wires as long
as the button is not pressed and on
K1 as well. The optocoupler translates
the presence of this voltage into a logic
level at the ESP32’s GPIO17 line — the
level at rest (i.e. when not ringing)
is low, and high when the button is
pressed. Then there is the BT1 connec-
tion which is intended to optionally (re)
connect the 3.7-V lithium battery fitted
as standard in the M5Stack module.
Note the polarity: the red wire at the
positive, and black wire at the negative
terminal of BT1.
The extension board contains only
through-hole components and should
be easy to assemble. However, do pay
special attention to K2 because it’s
mounted in an unusual way for such a
standard part (Figure 3). Normally the
short sides of the pins get inserted into
the PCB from the component side and
then soldered. In this case though we do Figure 3: Recommended method of mounting K2: the long pins are inserted from the copper side
it the other way around: the long pins are (‘bottom’ of the PCB), pushed in upwards, and soldered at the component side.

www.elektormagazine.com March & April 2020 31

191145 EN ESP32 Doorbell via Telegram.indd 31 06/02/2020 08:51


API. Keep this token in a safe place, as
Close Encounters of The ESP32 Kind it can be used by anyone to control the
Just imagine: your carefully crafted source code compiles without error doorbell bot. Consequently, we blurred
messages, gets uploaded to the ESP32 just fine, and the circuit initially seems to the token in the setup dialogue of our
work as expected. Seems. Further research though reveals the microcontroller own bot pictured in Figure 4.
is always resetting when a message arrives via Telegram! All checked & tried — In this dialogue with BotFather, click on
no obvious mistake found. So, you recompile and test the program on another the framed link (‘t.me/...’) to open a chat
computer and to your amazement the ESP32 does just what’s expected of it! You window for the new bot which will also
check again if both computers run the same versions of the Arduino IDE and the be added to the contact list. This bot is
libraries — no discrepancies to be found. At your wit’s end, on the first computer, now ready for use, although it still needs
you completely remove ‘Arduino’. That’s no ordinary uninstall, which apparently to be linked to the Arduino sketch for the
leaves debris in hidden folders anyway. You do a fresh install of ‘Arduino’ and all doorbell extender.
problems are gone.
The exact nature of the problem at Labs? We still have no idea and we won’t be Arduino sketch
bothered to find out. Since then we learned that the Arduino IDE _may_ behave In the software download of this project
erratically. Even if it was the first occasion ever we ran into such an issue, as far you can find the sketch DOORBELL.INO, i.e.
as Elektor Labs are concerned, it was the last occasion too! the source code for the ESP32 firmware
[3]. This sketch can be touched up and
in its current form is mainly intended
to showcase how Arduino/ESP32 and
Using the mobile phone number, opener. This bot has to be created first Telegram work together to simplify
sign in to the Telegram app on your in Telegram and this is done by search- control systems. Especially the operation
computer. The app on the phone will ing for ’BotFather’ in the contacts list. of an electric door opener is a “vulnera-
display a verification code that needs to BotFather itself is a bot that helps to bility” as people could hack into the bot
be typed back into the computer, after create your doorbell bot using a chat and open the door with no more than
which Telegram will be active there. dialogue. After entering the command their smartphone or computer. Elektor
The sketch on the ESP32 will work /newbot the dialogue commences, accepts no liability whatsoever for any
with a ‘bot’, which is easy to imagine asking for a name (displayed later in damage that may result from the appli-
as a kind of automatic answering the Telegram contact list) and for a bot cation of this project!
machine. It can respond to commands username. The latter should always end In the sketch, our M5Stack module
received via a Telegram chat message with the characters ‘bot’. Note the slash requires registering on the local
or send messages via Telegram that ( / ) at the start of each bot command. wireless Wi-Fi network, and access
are triggered by events in or near the When this process is successful, the to the Telegram-bot you just created.
ESP, such as reporting a key press or BotFather will notify you and display a The credentials of your Wi-Fi network
sending an ADC value. In this project, code (‘token’) needed to authorize the are entered in lines 17 and 18, while
the commands may control a door new bot to send requests to the Bot the token reported back by BotFather
has to be entered in line 21. Hence the
above advice to create the bot on your
computer, permitting the token to be
easily copied into the sketch. After all,
it’s not exactly a set of characters you
can easily recall and retype.
Once the Arduino IDE installation is
successfully completed, the sketch will
compile without any problems. In the
Tools menu — when the M5Stack gets
connected to a USB port of the computer
— the correct board (M5Stack-Core-
ESP32) and the virtual COM port have
to be set in order to upload the sketch
to the ESP32. That done, the sketch
will launch, connect to the network,
and the name of the Wi-Fi network and
the IP address of the doorbell extender
will appear on the M5Stack’s LCD.
The bot has to be activated after each
restart of the sketch by sending the
/start command via the chat window in
Telegram. The bot must then provide
Figure 4: Screendump showing how we fared in the lab with the use of BotFather. Token details feedback including an overview of the
struck out on purpose. commands it supports.

32 March & April 2020 www.elektormagazine.com

191145 EN ESP32 Doorbell via Telegram.indd 32 06/02/2020 08:51


COMPONENT LIST

Daily use [4], and with the


When the doorbell rings, a message e xa m p l e s t h a t
gets sent via the Telegram app to your come with it,
computer or smartphone. You can it doesn’t t ake
respond by opening the door yourself much effort to
or by using the /Open button to operate get started. Our
an electric door opener (if there is d o o r b e l l s ke t c h
one). The /Ignore button waives is based on the
this option, and the /status button ‘custom keyboard’
(busy checking the connection to the example, showing
doorbell extender) appears again at how to send
the bottom of the chat screen. These control buttons to
commands can also be typed and the Telegram app,
sent via the chat window, be aware which is a very
though they are case sensitive! handy option, so
The UniversalTelegram bot library you don’t have to
actually does most of the work in bother typing control
this project. This library and its commands yourself in
documentation can be found at the chat window. The
must-have subrou-
tine is handleNewMes-
sages doing the processing of incom-
ing messages. In four If statements the
@ WWW.ELEKTOR.COM commands and messages are handled
ªM5Stack ESP32 Basic Core which our bot understands:
www.elektor.com/m5stack-esp32-basic-core-development-kit • Start;
• status;
ªPCB no. 191145-1 V1.0
www.elektor.com/191145-1 • Ignore;
• Open.

To be able to send messages, the sketch


needs the chat ID which gets saved in the
Web Links variable ThisChat after receiving the first
[1] Telegram Messenger: https://telegram.org/ ‘/start’ command. The pushbutton (i.e.
doorbell) is captured in an interrupt; note
[2] 3D printer files for M5Stack case:
the IRAM_ATTR attribute that’s required
https://github.com/m4k3r-net/M5Stack-3DPrintFiles
for the declaration of an ESP interrupt
[3] Arduino sketch: www.elektormagazine.com/191145-01 service routine, all for correct handling
[4] UniversalTelegram bot library: of course.
https://Github.com/witnessmenow/Universal-Arduino-Telegram-Bot (191145-01)

www.elektormagazine.com March & April 2020 33

191145 EN ESP32 Doorbell via Telegram.indd 33 06/02/2020 08:51


Small Circuits Revival
Capita Selecta from the Elektor Project
Suggestions Box
Compiled by Eric Bogers

In the November & December 2019 issue we described an extremely luxurious soft-start circuit, designed
specifically for (big) audio amplifiers sporting countless bells and whistles and built from a myriad of
components. That it can be done in a much simpler way is demonstrated by one of the contributions below...

Idea: Elektor Labs overloaded, the inrush-current will remain so high that either
Simpler Inrush Current Limiter the fuse or the resistor will burn out. In the latter case a pungent
The schematic is drawn in Figure 1. The operation really speaks burning smell will be your reward, but a dangerous situation
for itself. Let’s assume that we want to switch on a big ampli- cannot really arise.
fier, one with a couple of giant electrolytic capacitors in the Depending on the size of the load, the values of the fuse and
power supply. You can imagine what happens the instant it is the resistor can be changed as appropriate.
switched on: for a short time, a massive current flows until
these electrolytic capacitors are charged up. And that sound
that you hear in the distance, that is the circuit breaker in your Idea: Ton Giesberts (Elektor Labs)
distribution board tripping... Automatic Gain Control (AGC)
When this circuit is added in front of the amplifier (or any load This circuit automatically adjusts the amplification of (small)
in general) the problem disappears. The 33 Ω resistor limits input signals such that the output signal remains constant over
the inrush current to a maximum of about 7 A. Because of this a wide range. The required control voltage is obtained from a
current, there is a (substantial) voltage drop across the resis- ‘cascade’ circuit.
tor, so that the 230V relay cannot close. Such an automatic gain control (AGC) can be useful for the
After a short time (a fraction of a second, of the order of detection of weak signals. One example that comes to mind is
5 to 10 cycles of the mains AC voltage), the inrush current a bat detector: the (ultrasonic) sounds from bats picked up by
has dropped to the normal operating current of the load. The a microphone is amplified and shifted into an audible range.
voltage drop across the resistor reduces ratiometrically and In the first instance it is necessary to detect any signal at all;
the relay can close. This effectively bypasses the series circuit ‘high-fidelity’ amplification is not relevant here.
of the fuse and the resistor – hey presto, we have obtained a The uncomplicated circuit is drawn in Figure 2. For the actual
normal, stable operating state. gain stage we use both halves of a dual opamp type TL072
The resistor is a ‘power’ version (50 watts in the schematic). (IC1A and IC1B). A non-inverting amplifier is built around
During the peak of the inrush current it will dissipate more IC1A; the gain G of which is:
than 50 W, but because this lasts for only a short time it can
handle that without any problem. G1 = R4 / (R2 + R3 || T1) +1
If, because of a defect, the load has a short circuit or is

Fuse C4 K2
R10
3A T 47R
1
-15dBV max.
P P R6
33R K1 1u ≈ 63xUin max.
C1 22k
2

gain ≈ 0...36dB
50 W 1 3
R5
IC1A 1 6 C5 K3
1u 1k R11
2 7 1
2

IC1B 47R
R7
OUT 230 V AC

5
R4 1u ≈ 1400xUin max.
IN 230 V AC

10k gain ≈ 36...63dB


1k

R1 R2
IC1=TL072 +9V
C2
100R
10k

D2 9V
R9 R8 1u C6
Re 1M 1M
8
230 V AC R3 T1 BAT85 100n
C3 D1 0 IC1
C7
4
*

N N 1u BAT85 100n
J113
9V
PE PE * see text 200004-52 -9V
200004-51 KD

Figure 1: It is hard to make this inrush-current limiter even simpler. Figure 2: An automatic gain control does not have to be extremely
complicated.

34 maart/april 2020 www.elektormagazine.nl

200004 EN From the Elektor Suggestion Box.indd 34 06/02/2020 08:53


In contrast, IC1B is configured as an inverting amplifier; the
gain of which is:

G2 = –R6 / R5

The ‘trick’ of this circuit is the two diodes D1 and D2; together
with capacitors C2 and C3 these form a cascade circuit (voltage
doubler). It is used to derive a control voltage from the output
voltage of IC1B that is used to turn T1 (a JFET) on by a variable
amount.
As you probably know (and if not, then you do now), JFETs
are great as a variable resistor; their drain-source resistance
depends on the voltage applied to the gate. In this circuit we
have connected a resistor R3 in parallel with JFET T1, to guaran- Figure 3: In practice, the AGC behaves surprisingly well.
tee a minimum gain for IC1A. There is room for experimenta-
tion: you can omit R3 altogether or play around with its value.
In the circuit as drawn in Figure 2, a type J113 is used for the tation! The very first receivers
JFET; both diodes are Schottky types. The circuit will also work [1] were really like this, only
with other types of FETs; the diodes don’t need to be Schottky we have replaced the origi-
types either, ordinary devices such as 1N4148 should also work. nal crystal detector [2] with
The construction of the circuit is not particularly critical and a diode. As a starting point,
for experimenting you can easily build it on a breadboard. for the coil you can wind
Prototyping board is perfectly appropriate for a ‘definitive’ about 85 turns of enamelled
version. (varnished) copper wire of
Here are a few more details about the circuit (if you want to 0.2 mm diameter around a
get started right away with the soldering iron then you can ferrite rod with a length of
skip this part with impunity). about 10 cm. The diode is a
The input impedance of the AGC circuit is fixed at 10 kΩ by germanium type AA119 or
R1; the low-pass corner frequency is at 16 Hz (C1). The value similar connected to a tap on
of R2 plus the minimum resistance of T1 (100 Ω at UGS = 0 V, Figure 4: This is where the history the coil. The crystal earpiece
according to the datasheet) determines maximum gain of the of radio began... has to be a high-impedance
circuit. In our prototype the minimum resistance of T1 was type of about 2000 Ω! The
actually a little lower (about 60 Ω), so that the maximum gain tuning capacitor is a type with
G of the circuit (at UGS = 0) is: a value of around 200 pF and
the antenna is connected through a small capacitor of about
G = (1 + R4 / (R2 + RDS)) × (R6 / R5) ≈ 1400 3.9 pF. For the detector capacitor (connected to the anode of
the diode), you can use a value of about 10 nF.
The speed at which the AGC reacts (‘attack’) is determined by This receiver definitely needs a ‘real’ antenna — a long-wire
R7 and is of the order of milliseconds. Don’t make R7 smaller antenna a few meters long is an absolute minimum. For reliable
than the value shown in the schematic, otherwise the distor- operation a ‘real’ earth is also a necessity. Connect this to a
tion at output K3 will increase to an unacceptable level. The water pipe or the central heating system!
recovery time of the circuit amounts to several seconds (deter- In the next instalment we will jazz this circuit up a little with
mined by R8+R9, C2 and C3). active components.
This circuit is designed to operate from a pair of 9 V batteries (200004-04)
(plus and minus 9 V) and its current consumption is around
3.5 mA.
Naturally we have subjected this circuit to a few tests in our
lab; in Figure 3 you can see that the output level (blue line)
is nearly constant across a wide input range (horizontal axis).
4 SALE @ WWW.ELEKTOR.COM
Idea: Elex Team ªElectronic Circuits For All
Direct Conversion Receiver www.elektor.com/electronic-circuits-for-all
We conclude this instalment with a treat from halcyon days:
a direct conversion receiver. Whether you believe it or not:
you can use this (without any ‘active’ components) to receive
Web Links
broadcast transmissions!
The principle is arguably simple: a variable capacitor together [1] Crystal radio:
with a coil forms a tuning circuit; the (amplitude-modulated) https://en.wikipedia.org/wiki/Crystal_radio
signal it picks up is detected by the diode and capacitor and [2] Crystal detector:
can be heard on a crystal earpiece. https://en.wikipedia.org/wiki/Crystal_detector
This extremely elementary radio receiver invites experimen-

www.elektormagazine.nl maart/april 2017 35

200004 EN From the Elektor Suggestion Box.indd 35 06/02/2020 08:53


LABS PROJECT

My First LoRaWAN
With Blue Pill, LoRa Breakout Board and
The Things Network

By Mathias Claußen (Elektor Labs)

The LoRa radio technique developed by Semtech covers data transmission combining long range
and low energy consumption. This makes LoRa particularly suitable for networked sensors having to
economize with their energy source. A popular and open network that can receive sensor data and
make it available worldwide is called The Things Network. For initial experiments, a few small boards
for little money are sufficient.

36 March & April 2020 www.elektormagazine.com

191065 EN LoRaWAN.indd 36 06/02/2020 08:55


PROJECT DECODER
LoRa LoRaWAN
BoB
The Things Network

entry level
intermediate level
Æ expert level

30 minutes approx.

PC,
A LoRaWAN, as the name suggests, able on the Internet. A popular, rapidly breadboard,
utilizes LoRa radio technology to expanding LoRaWAN is “The Things jumper wires
transport data in a Wide Area Network Network”, a free, community-based
(WAN). It provides the remote station network with good coverage. To actively
for LoRa sensor nodes by receiving the use this network, all that’ s required €30 approx.
data using so-called gateways (base is a registration and of course suitable
stations) via LoRa and making it avail- hardware. There is no monthly fee or

www.elektormagazine.com March & April 2020 37

191065 EN LoRaWAN.indd 37 06/02/2020 08:55


MOD1 MOD2
RFM95W-868S2 AE1 BluePill MOD3
13 Antenna USB-Serial (CH340)
3V3 1 40
VB 3V3
2 39 1
C13 GND GND
9 3 38 2
C14 5V RXD
C1 C2 ANT 4 37 3
C15 B9 TXD
100n/10V 10µ/10V 6 5 36 4
RESET A0 B8 3V3
7 6 35 5
DIO5 A1 B7 VCC
12 7 34 6
DIO4 A2 B6 5V
11 8 33 USB
DIO3 A3 B5
5 9 32
NSS A4 B4
4 10 31
SCK A5 B3
2 11 30
MISO A6 A15
3 12 29
MOSI A7 A12
16 13 28
DIO2 B0 A11
15 14 27
DIO1 B1 A10
14 15 26
DIO0 B10 A9
16 25
GND
GND
GND

B11 A8
17 24
R B15
1 8 10 18 23
3V3 B14
19 22
GND B13
20 21
GND B12

191065-001-94 KD

Figure 1. Circuit diagram of the Low-cost LoRa Node.

per-message billing; you just have to • “Blue Pill” STM32 Controller board cost-optimized (to put it positively), so
follow the Fair Use Policy in the network. [1] that unfortunately problems with the
This policy is intended to allow all partic- • RFM95 LoRa radio module [2] port occur again and again. Therefore
ipants to transport their data and to • USB-to-serial converter [3] the socket is used here for simple power
prevent gateway overload. • Jumperwires supplying only. To program the chip,
• Breadboard the integrated bootloader is used. New
In for a penny software can be programmed reliably via
The solution presented here is not fully For a start we use an Arduinoid Blue the serial UART interface of the board.
compliant with the LoRaWAN specifica- Pill board with a powerful STM32 ARM The few components, the LoRa module,
tions and is therefore only suitable for Cortex controller on it. The board the Blu Pill board and a USB-to-serial
experimentation. The costs are limited is available for a few euros includ- converter are connected as shown in the
to around €23 for the sensor node plus ing debugger, yet offers 64 kB Flash, schematic (Figure 1). Since the LoRa
possibly a pinboard and some jumper 16 kB RAM and a USB port. The latter module with its grid spacing of 2.00 mm
wires. The ingredient list for the LoRa should be used with caution, because is not exactly plug-in board friendly, the
sensor is quite short: the circuitry on these boards is very Elektor laboratory has developed a small

MOD1
RFM95W-868S2

13
K1 K2
1 3V3 9 1
ANT
2 2 2
MISO
Connector 1 x 8 male
Connector 1 x 8 male

3 3 11 3
MOSI DIO3
4 4 12 4
SCK DIO4
5 5 5
6 6 NSS 14 6
RESET DIO0
7 7 15 7
DIO5 DIO1
8 16 8
DIO2
GND

GND

GND

1 8 10 C1 C2
100n 10µ
10V 10V

191069-004-94 KD

Figure 2. breakout board for the LoRa module.

38 March & April 2020 www.elektormagazine.com

191065 EN LoRaWAN.indd 38 06/02/2020 08:55


COMPONENT LIST

Figure 3. The hardware on the plug-in board with the wired LoRa module.

Figure 4. Installation of the LMIC library.

breakout board (Figure 2), with which Well prepared...


the module can not only be conveniently First of all, some software is needed: the
plugged onto a plug-in board but also Arduino IDE, the library MCCI LoRaWAN
allows the assembly of the two capaci- LMIC and the support package Arduino-
tors C1 and C2. Core-STM32 Board.
What is still missing is an antenna. A
piece of copper wire with 1 mm diame- The LMIC library can be installed as
ter is perfectly adequate. The necessary usual from the libraries (Figure 4). In
length of a λ/4 antenna for the frequency the config file in the library folder of the
range of 868 MHz, in which the LoRa LMIC library (under Windows usually
module works, is under the user documents), you have
to specify the part of the world you are in
λ / 4 = (c0 / 868 MHz) / 4 and whether it is an SX1276 LoRa module
= (299792458 m/s) / (8680000 x 4 / s) (which is the case with the RFM95). To
= 8.635 cm do this, enter the following in the file \
project_config\lmic_project_config.h for
However, this formula is only valid for Europe:
Figure 5. The board information is determined.
propagation in vacuum. and a shortening
factor of 0.95 for air must be taken into // project-specific definitions                                              
account. The resulting antenna length is #define CFG_eu868 1
approximately 82 mm. //#define CFG_us915 1 #define CFG_sx1276_radio 1
As can be seen in Figure 3, not much //#define CFG_au921 1 //#define LMIC_USE_INTERRUPTS
hardware is needed for the construc-
//#define CFG_as923 1
tion of our LoRa sensor. During the first
//#define LMIC_COUNTRY_CODE LMIC_
tests no external sensors are used, In order for the Arduino IDE to support
COUNTRY_CODE_JP /* for as923-
rather, we show how a sensor node the Blue Pill board, a URL [4] must be
JP */
(also called node ) is set up and put added to the file Preferences Additional
into operation. //#define CFG_in866 1 board manager URLs. Then we can

www.elektormagazine.com March & April 2020 39

191065 EN LoRaWAN.indd 39 06/02/2020 08:55


search for “STM32” in the board manager and install STM32 In APB mode, the device address and keys for the device are
cores. Now all required libraries are included. The last step is stored in the code. While this makes it easier to get the node up
to select the board, as shown in Figure 5. and running, however, it weakens the security of the node. For
Before we get to the first code, we have to mention the differ- more details on this topic, it is worth looking at the documen-
ence between OTAA (over the air activation) and APB (activation tation [5] provided by The Things Network.
by personalization). With OTAA, the LoRa node actively joins The example program ttn-abp from the LMIC library is used
the network. It receives a device address from the network as a starting point. The code sends a “Hello, world!” every
and exchanges keys with the network. For The Things Network 60 seconds and needs some hardware-related adjustments.
this is the preferred method to participate in network traffic. Starting at Line 86 of the Arduino sketch the pin mapping is
replaced by the following lines:

/*
 
 * Pin-Mapping for the RFM95 LoRa Module
 */
const lmic_pinmap lmic_pins = {
   .nss = PA4,

Figure 6. Welcome to the console of The Things Network.

Figure 7. Add Application!

Figure 10. Here the data of the new node are specified.

Figure 8. Registration of an application.

Figure 9. Request to register nodes in the application. Figure 11. Change the activation method and (temporarily) disable the
frame counter checks.

40 March & April 2020 www.elektormagazine.com

191065 EN LoRaWAN.indd 40 06/02/2020 08:55


Figure 12. In the device overview, only the data format (LSB/MSB) must Figure 13. The device is completely set up.
be set correctly.

   .rxtx = LMIC_UNUSED_PIN,
   .rst = PA0,
   .dio = {PB10, PB1, PB0},
};

Registration on
The Things Network
In addition to the pins, the network data for the sensor node
also needs to be set up. To obtain this data, a new node is first
created in The Things Network. At first you have to create a
user account under [6], in which the nodes are created and
managed. In order to keep track of all nodes, they can be
grouped under Applications according to their purpose. After
logging in, applications and gateways can now be managed Figure 14. The node is transmitting!
via the console, as shown in Figure 6.
If there is no usable gateway nearby, you can also run your
own and make it available to other users nearby. How to do
this will be explained later. Network Session Key and App Session Key. The data formats
To generate data suitable for the node, an application must first are a stumbling block: you should correctly specify whether the
be created. To do so, click the icon APPLICATIONS and then fields LSB or MSB must be transferred. For the Sketch, Device
the item add application (Figure 7). The window is filled in as Address and the Network Session Key are required as the LSB
in Figure 8, then the process is completed with Add applica- and the App Session Key as the MSB array. The settings can
tion. In this freshly created application no node is registered be toggled by clicking on “< >”; the settings are displayed in
yet. This is done by clicking on the register devices item in the the windows on the left (Figure 13).
window that opens (Figure 9). In the dialogue that now opens In the Sketch you enter the Network Session Key in NWKSKEY,
(Figure 10), enter the name of the node and under Device the App Session Key in APPSKEY and the Device Address in
EUI click on the crossed arrow symbol at the left, making the DEVADDR.
text “this field will be generated” appear.
By pressing Register you send these specifications to The // LoRaWAN NwkSKey, network session key
Things Network, which then registers the new node and enters static const PROGMEM u1_t NWKSKEY[16] = { Network
the access data. Under Settings (Figure 11) the “Activation Session Key };
Method” is changed from OTAA to ABP and for the first experi-  
ments the checkmark at Frame Counter Checks is deactivated.
// LoRaWAN AppSKey, application session key
In “real” productive operation this setting is risky; the check
static const u1_t PROGMEM APPSKEY[16] = { App Session
mark should be reset immediately at the first opportunity after
Key };
the first successful steps!
 
After the settings have been saved, click on the Overview tab to
get all data necessary for the node at a glance (Figure 12). We // LoRaWAN end-device address (DevAddr)
are not interested in the Device EUI, which roughly corresponds // See http://thethingsnetwork.org/wiki/AddressSpace
to a MAC address [5], nor in the Application EUI assigned by // The library converts the address to network byte
TTN, which is required for the OTAA procedure. Only the content order as needed.
of the following three fields is relevant for us: Device Address, static const u4_t DEVADDR = 0xDEVICE_ADDRESS;

www.elektormagazine.com March & April 2020 41

191065 EN LoRaWAN.indd 41 06/02/2020 08:55


But with this RPi gateway you can only operate a node in ABP
mode; a transfer of messages from the LoRaWAN to the node
is not possible. The channel and the spread factor must also
be set permanently in the node. If you want to get started
faster and with less stumbling blocks, you should invest some
moneyand use Dragino’s LG02 gateway, which also allows
OTAA mode and sending data to nodes from the LoRaWAN.
For convenience (and some bad experiences with the RFM95
and jumper wires) we raided the Elektor Store and used a
Dragino LoRa HAT on a Raspberry Pi 3B+ with a freshly installed
current Raspbian image for the test run (Figure 15). All this
is quickly assembled, the SD card is inserted into the slot
and monitor, mouse, keyboard and Ethernet cable for Internet
access, and the first boot is ready. The system boots directly
into the desktop, but first the terminal has to be opened and
some hardware settings have to be adjusted.
With sudo raspi-config you can access the configuration menu
for the RPi. Under Interface Options select P4 SPI and activate
this interface with a Yes. After the reboot the SPI interface is
active, so you can continue with the configuration.
Again a terminal is opened to download some packets and
the source code for the packet forwarder. The source code
is provided by GitHub, so the command git clone https://
github.com/hallard/single_chan_pkt_fwd.git will download
the latest version. More libraries have to be installed. The
command sudo apt-get install wiringpi installs the WiringPi
library we need for compilation. Using cd single_chan_pkt_fwd
we change to the directory of the downloaded source code,
compile the source code into a program with make first and
Figure 15. A Raspberry Pi with Dragino-LoRa-HAT acting as gateway.
then install it with make install.
Now the gateway is basically set up, but the pin configuration for
the LoRa-HAT in the file global_conf.json has to be adjusted.
The following configuration can be used for the Dragino HAT:
// Change this address for every node!

If a LoRa gateway is nearby, the Sketch can be compiled and {


uploaded without any further changes. In the TTN console  
you can immediately see that the node sent data last time a "SX127x_conf":
few seconds ago (Figure 14). A click on Data shows the user   {
data of the node.
    "freq": 868100000,
    "spread_factor": 7,
Configuring your own gateway
    "pin_nss": 6,
If no gateway is within range, you can set up your own. There
    "pin_dio0": 7,
are various possibilities from completely finished commer-
cial solutions to a (non LoRaWAN compliant) single-channel     "pin_rst": 0
gateway, consisting of a Raspberry Pi with LoRaWAN HAT. A   },
fully compatible gateway is the LPS8 indoor LoRaWAN Gateway   "gateway_conf":
from Dragino [7], which is available in the Elektor Store for   {
about €120 (see box). It can receive on all frequency bands     "ref_latitude": 0.0,
used by LoRaWAN in the 868 MHz range simultaneously. The     "ref_longitude": 0.0,
Dragino LG02 version with two LoRa modules is slightly limited     "ref_altitude": 10,
in terms of reception, but at €80 it is somewhat cheaper. The  
gateways are based on the Linux OpenWRT distribution which
    "name": "Enter your Gatewayname here",
is especially designed for routers, with a few adjustments for
    "email": "[email protected]",
the operation as LoRa gateway.
    "desc": "Dragino Single Channel Gateway on RPI",
If you own a Raspberry Pi, you can equip it with a LoRa module
 
and use it as a gateway. Under [8] the software for a gateway
is provided which supports the Dragino-LoRa-HAT [9]. It is     "servers":
even cheaper to connect the RFM95 module directly to the     [
RPi using a few jumper wires. With the breakout board this is      {
very easy to do, you can follow the pin definition for the Dragi-        "address": "router.eu.staging.thethings.
no-LoRa-HAT [8] for the wiring and installation. network",

42 March & April 2020 www.elektormagazine.com

191065 EN LoRaWAN.indd 42 06/02/2020 08:55


       "port": 1700,
       "enabled": true
     },
     {
       "address": "router.eu.thethings.network",
       "port": 1700,
       "enabled": false
}]}} Figure 16. Screenshot of the terminal: Service okay!

With these settings the gateway listens at 868.1 MHz with


spreading factor SF7. In order to send the data to the TTN,
some minor settings have to be made. First the Gateway must
be restarted to activate the changes just made. To do this, enter
systemctl stop single_chan_pkt_fwd in the terminal and then
systemctl start single_chan_pkt_fwd. Now the gateway is
set up as a service or can be run directly under the root user.
With systemctl status single_chan_pkt_fwd you can query
the status of the service (Figure 16).
The gateway is now ready for operation. It only needs to be
set up in the TTN so that the packets can also be assigned and
the Gateway can be administered. To do this, click on the icon
Figure 17: In the TTN, this is the gateway setting.
GATEWAYS (Figure 17) in the console of The Things Network
and then register gateway (Figure 18).
On the Register Gateway tab (Figure 19), check the “I am using
the legacy Semtech packet forwarder” box. For the Gateway
EUI, enter the MAC address of the Raspberry Pi (determined
with cat /sys/class/net/eth0/address) and fill it with FF FF in
the middle. For example, if you determine b8:27:eb:12:34:56
as the MAC address, enter B8 27 EB FF FF 12 34 56 in the
Gateway EUI field in the console of The Things Network. By
Figure 18: Gateway registration in TTN.
clicking on the Gateway tab, the Gateway is now ready for use.
To ensure that LoRa node and gateway work in conjunction, a
transmission frequency must be specified in the source code
and the spreading factor must be established. In addition, the
node is limited to the frequency defined in the gateway. The
extract from the source code shows the adjustments for the
LoRa node. A complete example can be downloaded from the
Elektor Labs page [10].

// Disable link check validation


 
LMIC_setLinkCheckMode(0);
 
// TTN uses SF9 for its RX2 window.
LMIC.dn2Dr = DR_SF9;
 
// Set data rate and transmit power for uplink (note:
Figure 19: Here the gateway data is entered.
txpow seems to be ignored by the library)
LMIC_setDrTxpow(DR_SF7,14);
 
// FOR TESTING ONLY!
//If we have a single channel one module gateway we
for(int i=0; i<9; i++) { // For EU; for US use i<71
need to add these lines
  if(i != channel) {
// Define the single channel and data rate (SF) to
    LMIC_disableChannel(i);
use
  }
int channel = 0;
}
int dr = DR_SF7;
 
 
// Set data rate (SF) and transmit power for uplink
// Disable all channels, except for the one defined
LMIC_setDrTxpow(dr, 14);
above.
 

www.elektormagazine.com March & April 2020 43

191065 EN LoRaWAN.indd 43 06/02/2020 08:55


// Start job
do_send(&sendjob);


In this example the node is set to 868.1 MHz and SF 7. These
values are also used in our gateway. Gateway and node are
now supplied with software, so that the test can start. After
a little while new messages should arrive in the TTN console
from our node (Figure 20).
Figure 20: The data from the node is arriving!
Conclusion and outlook
For the first steps with LoRaWAN, a node at around 25 euros
and a gateway based on a Raspberry Pi and an RFFM95 module
4 SALE @ WWW.ELEKTOR.COM
are all you need. However, this solution is very limited and not
suitable for productive operation. If you are eager to do more ªRFM95 LoRa Module
www.elektor.com/18715
with LoRaWAN after experimenting, you should exchange the
gateway for a fully LoRaWAN-compatible commercial device ªLoRa RFM95 Breakout Board
www.elektor.com/191069-1
which is now available for under 120 euros [7]. With such a
gateway the full potential of the LoRaWAN can be used, includ- ªCH430 USB/Serial Converter
ing messaging from gateway to node. www.elektor.com/19151
One point we have not yet considered is the collection and ªDragino LPS8
processing of data from The Things Network. This will be the www.elektor.com/dragino-lps8-indoor-lorawan-gateway
subject of another article in one of the upcoming issues of ªDragino LG02
Elektor magazine. www.elektor.com/dragino-lg02-dual-channels-lora-iot-gateway
191065-03 ªDragino HAT for RPi
www.elektor.com/dragino-lora-gps-hat-for-raspberry-pi-868-mhz

Web Links
[1] Blue Pill controller board: www.amazon.com/UNIVERSAL-SOLDER-SIMPLY-SMARTER-ELECTRONICS-STM32F103C8T6/dp/
B07S2VF1PZ/ref=sr_1_2?keywords=STM32+Blue+Pill&qid=1579529166&sr=8-2
[2] RFM95 LoRa Module: www.elektor.com/rfm95-ultra-lora-transceiver-module-868-915-mhz
[3] CH340 USB-to-Serial Converter (3.3 V): www.elektor.com/19151
[4] Board support: https://github.com/stm32duino/BoardManagerFiles/raw/master/STM32/package_stm_index.json
[5] LoRaWAN Adressing and Activation: https://www.thethingsnetwork.org/docs/lorawan/addressing.html
[6] TTN account creation: https://account.thethingsnetwork.org/register
[7] LPS8 Gateway: www.dragino.com/products/lora-lorawan-gateway/item/148-lps8.html
[8] Gateway HAT Software: https://github.com/hallard/single_chan_pkt_fwd
[9] Gateway HAT: www.elektor.com/dragino-lora-gps-hat-for-raspberry-pi-868-mhz
[10] Project support page: www.elektormagazine.com/191065-03

44 March & April 2020 www.elektormagazine.com

191065 EN LoRaWAN.indd 44 06/02/2020 08:55


electronica Fast Forward 2020
The Start-up Platform Powered by Elektor
By The Elektor Team

Is your electronics-related start-up ready to dis-


rupt? Would you like a chance to bring your young
company to the attention of potential customers
and investors? electronica fast forward (e-ff-
wd), the start-up platform powered by Elektor,
offers you a unique opportunity to present your
company and technology to the world. You could
win a €75,000 marketing package from Elektor
and gain international recognition at electronica
2020! Register for the e-ffwd 2020 competition at
www.elektormagazine.com/fastforward.

Launching and successfully running an electronics-focused service, etc.


start-up is not an easy task. Smart start-up executives know - Receive a listing in the trade fair catalog (print and online).
they need more than an innovative product, a novel technology, - Show off your innovative products and network with poten-
or super code. They work tirelessly to cultivate relationships with tial investors, partners, and customers on-site.
key industry leaders and experts. They recognize the value of - Generate new leads, and receive great international
affordably communicating their products’ features, functions, exposure before, during, and after electronica 2020.
and benefits to the proper audiences. And they understand the - Learn more about your company’s strengths and
importance of implementing targeted marketing campaigns weaknesses.
that deliver actionable leads and drive sales. - And more!
In 2020, Elektor and Messe München are partnering again to
give innovators an opportunity to move their companies forward
and to promote their products to an international audience.
electronica fast forward, the start-up platform powered by
Elektor, is your chance to win a global marketing campaign from
Elektor, as well as gain international exposure at electronica
2020 (https://electronica.de) — the world’s leading trade fair
for electronics — in Munich, Germany (November 10-13, 2020).
The most promising start-ups will have a shot to promote their
solutions to potential customers, industry experts, and possible
investors. Are you ready to compete?

• Registration Deadline: July 1, 2020


(www.elektormagazine.com/fastforward)
• The Finals: electronica 2020 (https://electronica.de) in Does your start-up have a superior AI solution, a game-changing
Munich, Germany (November 10-13, 2020) IoT application, or a cutting-edge robotic design? Perhaps your
• Prizes and Benefits: team recently developed a new embedded system or a useful
- First Prize = €75,000 marketing package from Elektor, measurement tool? Did you invent a super-affordable rapid
plus a booth at electronica 2022. prototyping platform or handy electronic gadget? Register for
- Second Prize = €50,000 marketing package from Elektor. electronica fast forward, the start-up platform powered by
- Third Prize = €25,000 marketing package from Elektor. Elektor (www.elektormagazine.com/fastforward), and prepare
- Get exclusive, specially priced (only €1,905!) booth space to tell the world!
(5 m²) at electronica 2020, including basic furniture,
lighting, power supply, daily cleaning and waste disposal Good luck.

www.elektormagazine.com March & April 2020 45

202002 EN FastForward.indd 45 06/02/2020 08:59


interview

“A Strong Supporter of
Open Internet”
Interview with Wienke Giezeman,
Initiator of The Things Network
Questions by Mathias Claußen and Jens Nickel

IoT cannot exist without low-energy, wireless transmission of sensor data. LoRaWAN is a protocol that
enables flexible communication between sensor/actuator nodes and gateways acting as base stations and
interfaces to the Internet. However, potential users have to build their own network infrastructure, which can
be a burden for educational and private users. Existing networks are often closed or otherwise inaccessible.
The Things Network is a solution to overcome these obstacles. Across the globe, volunteers install gateways
which are open to other users keen to transfer data, while commercial participants can also open their
gateways to the network. The Things Network also hosts LoRaWAN network servers and offers affordable
hardware and a lot of support.

Elektor: Wienke, how come you founded TTN?


Wienke: Johan Stokking and I founded The Things Network
(TTN) in 2015 after both of us were looking to build a new busi-
ness. Johan has been an IT entrepreneur since he was 12. In
2015 I just sold my previous company and we joined for coffee
and there the idea emerged. I was always a strong supporter
of open source and open Internet, both personally and as an
entrepreneur. I started the Startups for Net Neutrality cam-
paign [2] when that was a risk in Europe.

Elektor: What do you think are the advantages of LoRa?


Wienke: The advantage of LoRa as a plain RF technology are
simple. The devices are low-power so you have to replace the
battery only every 2 or 3 years. And the coverage can be miles.
TTN founders Wienke Giezeman (left) and Johan Stokking (middle left)
All of course related to the conditions.
with co-workers. (photo: Rebekka Mell / The Things Network).
The other advantage is that there is a well governed network
protocol available called LoRaWAN. This network protocol allows
devices to connect to networks and allows LoRaWAN networks
to connect to each other. This upgrades the technology from gateways in more than 700 cities across the world and almost
just a last-mile tool to an Internet technology. Because any- 100,000 developers are active on the platform.
body can build a LoRaWAN network, the growth comes from Elektor: Can you imagine applications where one defi-
the networks businesses and people build. LoRaWAN allows nitely should not use LoRa? And why not?
it to easily connect these networks, creating a global Internet Wienke: Many. You see that Internet of Things technologies by
of Things. themselves always touch their own niche or segment. Although
At The Things Network we embraced this vision from the start. some marketing campaigns make you believe their technol-
We started out in Amsterdam but soon we grew to hundreds of ogy can serve every use case. For sure that is not the case.
cities around the world. We are now running more than 10,000 There should be a match between the business requirements

46 March & April 2020 www.elektormagazine.com

191193 EN Interview with Wienke Giezeman.indd 46 06/02/2020 09:00


and what the technology has to offer. Because the strength of developer board for under 100 euros. Connect your device and
LoRaWAN is low power and long range, the compromise is that gateway on: www.thethingsnetwork.org.
it can send very little data. For the strength that it has very
low cost gateways available, the compromise is that you need Elektor: How do participants get support from your side?
a network server in the cloud which handles the network pro- Wienke: We provide support through our business called The
tocol. For the strength that you can build the network yourself Things Industries. At the moment we help hundreds of enter-
with little vendor lock-in, the compromise is that you have to prises around the world building their LoRaWAN networks.
invest to build the network. From national railway organizations, global maritime companies
right up to large real estate corporates. This is done through a
Elektor: Isn‘t it slightly dangerous for everything to paid proposition where businesses get support and enterprise
depend on one supplier of chip technology? tools to manage their network. We are pretty proud of how
Wienke: The LoRa RF protocol is owned by Semtech. Looking we are able to pull off a business model on an open platform
at any IoT stack or software stack there are always depen- without compromising on commercial success and our belief
dencies and vendor lock-in risks. This case is no exception: if in open technologies.
you build your IoT solution you should take this in to your risk
assessment. When you benchmark a typical LoRaWAN stack Elektor: How can you earn money? Is there a business
to, say, a Sigfox, NB-IoT or LTE-M stack, you would discover model behind TTN?
that building something in LoRaWAN will have the lowest ven- Wienke: We make our money by selling services and prod-
dor lock-in risk. With our software we try to focus on reducing ucts through our company The Things Industries. TTN now
the vendor lock-in risk by using open APIs, open source core only costs money at the moment. We will be looking for ways
components and using as much of the LoRaWAN open stan- how to fund the overhead costs more fairly over time but the
dard as possible. balance is right at the moment and we are able to finance it
through our commercial activities.
Elektor: TTN is built on a community of volunteers who
install gateways. How can they join? Elektor: Can users have their own network servers and
Wienke: The Things Network got built out of people and busi- also join the network?
nesses setting up LoRaWAN applications. The gateway is just Wienke: Yes, for businesses we have our new LoRaWAN net-
work server called The Things Enterprise Stack. This allows you
to set up a professional LoRaWAN network server with complete
control of your own Quality of Service and level of security. In
the meantime you can turn on network peering with the other
open networks for mutual network and spectrum efficiency.
We also have an open source version that allows you to set up
the network yourself entirely.

Elektor: How many gateways do you need for a city like


Amsterdam?
Wienke: This question is hard to answer. It all depends on
what is in between. The good thing is that the gateways are
very cheap, 500 to 700 euros for an outdoor version and 60 to
100 euros for an indoor version. This allows for a lean approach
where you add connectivity as you need it. To give at least
ballpark answer: say that for a city like Amsterdam you’d need
On The Things Conference, users are reporting on TTN projects, here
100 outdoor gateways and you would add 300 indoor gateways
Deutsche Bahn. (photo: Rebekka Mell / The Things Network).
to fill the gaps. Total gateway costs would be around 50,000
euros, a very small figure for this scale. Considering what is
happening now around the world with gateways and networks
a means to an end. The protocol is designed for networks to being connected, this cost is distributed over many applications.
share the network capacity to optimize the common ground:
the scarce open spectrum. LoRaWAN allows for very efficient Elektor: Are there gateways you can definitely not rec-
spectrum usage as the networks are shared and LoRaWAN traf- ommend to use with TTN?
fic is offloaded to abundant IP networks as soon as is possible. Wienke: All gateways that use the Semtech gateway chips
So, sharing a gateway or a network does not have much to and their reference design are compatible. At the moment I
do with being a volunteer. It has to do with optimizing your am not aware of any particularly bad gateways. Mostly the
own network capacity and access through joining the network. cost relates to the value they bring. A simple indoor gateway
It is very easy to join. You can already get a gateway and a is cheaper because it creates a smaller network.

www.elektormagazine.com March & April 2020 47

191193 EN Interview with Wienke Giezeman.indd 47 06/02/2020 09:00


Industries users will be able to use this
The Things Indoor Gateway - Spec global network.

Elektor: What is your contribution to


Power Plug the LoRaWAN Alliance?
Setup button
Wienke: We are a very active member
contributing on both the technical and
Reset
marketing part. We organize the largest
LoRa GW Board
- 868 or 915 bands global LoRaWAN conferences in Amster-
- 8-ch ref. design v1.5
(with LBT) dam, Hyderabad, Adeleide, Slovenia, and
- Integrated Antenna
in the UK. Also we contribute to the LoRa
ESP8266 SoC Alliance‘s technical committee by build-
USB - C Port
- 32bit RISC @80 MHz
- WiFi 802.11 b/g/n ing the first firmware over the air update
- PCB Antenna
solution, for example.

Elektor: What are the plans for further


network coverage? What do you do to
enhance this?
Wienke: We are launching our latest net-
An easy to use indoor gateway. work server and will be contributing it to
the thethingsnetwork.org. We see a solid
100% annual growth. And even a faster
growth in connected devices.

Elektor: Do you also plan to support Class-B devices? Elektor: What do you see as the future of LoRaWAN?
Wienke: Yes, we have that currently in our latest software. Wienke: The future of LoRaWAN depends on how the WAN
part works out. As I said, there are plenty of last-mile IoT solu-
Elektor: Do you also roam messages to other networks tions that can bring your data from A to B. There is only one
servers and the other way round? that, through an open standard, allows enterprises to build
Wienke: Yes, for that we launched the concept of the Packet devices, networks and applications that are all interoperable
Broker ( www.packetbroker.org). As I said, the beauty of and extend their addressable market.
LoRaWAN is that you can build a real Internet of things of Commercially, the fact that LoRaWAN is solving problems
interconnected gateways and networks. With the Packet Broker across all industries, farming, real estate, metering, smart
we try to simplify exchanging traffic among networks. cities, logistics, maritime, etc. means that LoRaWAN is here
to stay. The strength of the ecosystem will determine how fast
Elektor: Are there partnerships with companies? it will scale up.
Wienke: If you look on www.thethingsnetwork.org and click Thats’ exactly why the theme of our upcoming LoRaWAN con-
on Market Place you will see all our partners. The strength of ference, www.thethingsconference.com, is interoperability. We
the LoRaWAN ecosystem is that there are many. show how partners and even competitors are working together
to push for a global interoperable LoRaWAN network.
Elektor: Can you say something about the partnership 191193-01
with Dutch KPN?
Wienke: KPN is an incumbent telco setting up LoRaWAN gate-
ways across The Netherlands and charges around 30 to 40 euros
per year per device to have it connected.

Elektor: At the moment in Europe the 868 MHz band


is used. Are there any plans to extend this to the 433
MHz band?
Wienke: Not at the moment.

Elektor: We saw there are now Semtech chips coming


for the 2.4 GHz band. How could this be integrated in
the current infrastructure?
Wienke: No comment for now.
Web Links
Elektor: Can you say something about LoRa in space? [1] The Things Network Homepage:
Wienke: This is super exciting! We are big fans of Lacuna space www.thethingsnetwork.org/
because of their technical superiority in sending LoRaWAN [2] Startups for Net Neutrality:
message directly from the earth to a satellite. Keep an eye www.startupsfornetneutrality.eu
on this company as soon The Things Network and The Things

48 March & April 2020 www.elektormagazine.com

191193 EN Interview with Wienke Giezeman.indd 48 06/02/2020 09:00


The Meadow F7 Board
A great board for .NET developers

By Tam Hanna

The variety of process


computer boards available for
developing new applications
is astonishing but if you want
to write code using Visual
Basic or C#, options start
to drift away like sand
between your fingers. The
new Meadow F7 board
stands out here. It uses an
STM32F777 for executing
the .NET runtime, while
an ESP32 module
takes care of Wi-Fi
connectivity.

(Image: Wilderness Labs)

During his time as VP at Xamarin, Bryan Costanich was busy download the two-file operating system. Next you need the
porting the .NET environment to Android and iOS. He went on ‘dfu’ utils, which you will find at [2].
to purchase the rights to intellectual property from a company A look at the board documentation shows that the boot loader is
run by Chris Walker and set up Wilderness Labs. The latest started by pressing the boot button. Press and hold the button
product from them is the Meadow F7 process computer, which while you connect the board to your Windows workstation with
can be seen assembled in the title picture. The Meadow F7 a micro USB cable. We use the list command to determine the
aims to provide .NET developers with ‘first-class’ access to serial number of the process computer:
the IoT ecosystem.
C:\dfu-util-0.9-win64>dfu-util --list
Architecturally, this is, by the way, an analogy of what has been dfu-util 0.9
achieved so far by combining Raspberry Pi or Orange Pi and a  
real-time processor core. An STM32F777 clocked at 216 MHz . . .
is responsible for executing .NET runtime environment while
Cannot open DFU device 0483:df11
an ESP32 module takes care of Wi-Fi connectivity.
Oops — that works fine under older versions of Windows but
Let’s get going fails under Windows 10 because of the error described in [3].
In its delivered state the Meadow F7 board has an operating However, it can be fixed without difficulty: simply follow the
system that is either out of date or just not installed at all. instructions to reset the driver. After that is done, the serial
Installation takes place via the STM boot loader. Visit [1] and number can be determined by trying again with:

www.elektormagazine.com March & April 2020 49

191190 EN Meadow F7.indd 49 06/02/2020 09:02


Figure 1: Meadow is no fun without .NET Framework 4.7.2 SDK development tools.

we need in the next step to load the kernel and runtime. You will
C:\dfu-util-0.9-win64>dfu-util --list need to update the command lines shown here to use the details
dfu-util 0.9 of your own device. Make sure that you type the hexadecimal
. . . addresses correctly and place the two files Meadow.OS_Kernel.
bin and Meadow.OS_Runtime.bin in the correct folder:
Found DFU: [0483:df11] ver=2200, devnum=4,
cfg=1, intf=0, path="5-3", alt=3, name="@
C:\dfu-util-0.9-win64>   dfu-util -a 0 -S
Device Feature/0xFFFF0000/01*004 e",
346B38733536 -D Meadow.OS_Kernel.bin -s 0x08000000
serial="346B38733536"
dfu-util 0.9
C:\dfu-util-0.9-win64>   dfu-util -a 0 -S
A successfully recognized Meadow board will appear not just
346B38733536 -D Meadow.OS_Runtime.bin -s
once but will in fact have four end points in the Windows device
0x08040000
list. For us, however only the serial number is important, which
dfu-util 0.9

To ensure that it starts correctly, press the RST button: The


RGB LED will start to flash a little erratically. As a development
environment on the desktop, I used Visual Studio in the free
community version 2019.8. To install the files, the compo-
nents shown in Figure 1 are selected and downloaded by the
installation wizard, which is available in the start menu under
Visual Studio Installer.
Then start Visual Studio as usual. By clicking on Continue
without code option on the left the start wizard allows you to
escape from the window when the IDE is started without a
project that is already open.
Wilderness Labs delivers the actual SDK in the form of a Visual
Studio plugin. Click Extensions Manage Extensions to load the
plugin wizard. Then we switch to the Online section, as shown
in Figure 2, and search for the String Meadow.
After the mandatory restart there is a new template called
Figure 2: Visual Studio automatically obtains updates from the Internet Meadow Application, which serves as the basis for your own
on request. experiments. Create a new program called ‘ElektorSample’ to

50 March & April 2020 www.elektormagazine.com

191190 EN Meadow F7.indd 50 06/02/2020 09:02


view the code for the flashing LED example supplied as part
of the boot loader. The code in the MeadowApp.cs file should
be self-explanatory.
Developers switching from Arduino should only make sure
that the Framework itself does not have any loop structure.
The example above simply initializes the two methods from
the constructor: an endless loop is implemented in BlinkLeds:

public MeadowApp() Figure 3: That window needs to be closed, use the enter key.
{
    ConfigurePorts();
    BlinkLeds();
}

Start and Ping test


If a process computer has to cope with hard real-time tasks,
the operating system should be able to offer ‘guaranteed’
response times. Systems based on managed languages such
as Java or C# generally fall short in this respect. This is not
only due to runtime inefficiencies — if the garbage collector
(automatic garbage collection) is running, no other task can also
be running. Our small test program therefore manages almost
completely without dynamic memory allocation. However, if a
control task allocates and releases a lot of memory, there is a
higher risk that the garbage collector will kick in.
To test the behaviour of the Meadow F7 board, we can write
a small routine that just toggles an output pin to produce a
continuous output waveform. To do this, both ConfigurePorts Figure 4: Toggling an output pin takes around 32 ms.
and BlinkLeds are used as follows:

public class MeadowApp : App<F7Micro, MeadowApp> {


        IDigitalOutputPort myOut;
 
        public MeadowApp()
. . .
        public void ConfigurePorts() {
            Console.WriteLine("Creating Outputs...");
            myOut= Device.
CreateDigitalOutputPort(Device.Pins.D05);
        }
 
        public void BlinkLeds() {
            var state = false;
 
            while (true) {
                myOut.State = true;
                myOut.State = false;
Figure 5: After a reset (upper trace) it takes almost 30 s to get going
                myOut.State = true; again.
                myOut.State = false;
            }
        } the new peripheral device.
    } To look at the waveform used a 500-MHz Tektronix TDS754D
digital storage scope which has been ‘hacked’ to boost its
Meadow software uses abstraction classes to interact with bandwidth up to 1 GHz. This bit of kit was imported from the
physical elements. Our digital port is created, for example, by US and comes with a fresh service and is even supplied with
an interface of the IDigitalOutputPort - type - if you were an optional LCD, not too bad for the price.
to offer an extension that also exposes GPIO pins, you could Since the Meadow F7 is seen as just a COM port from the point
(with a suitable driver) move code between the ‘ordinary’ and of view of the Windows operating system, you have to prompt

www.elektormagazine.com March & April 2020 51

191190 EN Meadow F7.indd 51 06/02/2020 09:02


The next step is a group of named parameters that describes the
output pins used. Values from the Enum Device.Pins are trans-
ferred to it - it contains a separate bit field for each hardware
peripheral of the STM32 processor, which makes control easier:

public void ConfigurePorts()


{
    Console.WriteLine("Creating Outputs...");
    myDisplay = new CharacterDisplay(
        Device,
        pinRS: Device.Pins.D05,
        pinE: Device.Pins.D07,
        pinD4: Device.Pins.D08,
        pinD5: Device.Pins.D09,
        pinD6: Device.Pins.D10,
        pinD7: Device.Pins.D11,
        rows: 4, columns: 20 
        );
}
Figure 6: Hook the LCD up on a plug board (Image: Wilderness Labs [5]).

At this point, we notice that Visual Studio cannot resolve the


reference to the CharacterDisplay class. This is due to the
modular delivery of the framework - right-click on Search the
Visual Studio with the installation. In the first step, click on: project in the Solution Explorer and choose the NuGet package
View Other Windows Meadow (oder Ctrl+Shift+M), manager. Then look for the string Meadow*Character - the
to activate the device selection window called ‘Meadow Device wildcard asterisk captures any text. The Meadow.Foundation.
Explorer’. Choose your Meadow to then command a debug Displays.LCD.CharacterDisplay, package is worth installing
run. Each time the program is started, the window in Figure. which can be done like a normal NuGet-Package installation.
3 appears, which you need to close by pressing the Enter key. The only thing missing is the actual output function that sends
After installation, connect the oscilloscope to pin D05 and take text to the display. Wilderness Labs uses the infrastructure
a look at the waveform shown in Figure 4. It is normal for the provided by the .NET framework; the syntax of the WriteLine
runtime to generate some errors in relation to date classes statement may seem familiar to you. The additional numerical
during program execution. parameter defines in which line of the display the delivered
The time differences between the waveform edges are very string is to be shown. If you pass the value ‘1’, it gets written
small. This indicates that the majority of the time is taken to the second line from the top:
up switching the state of the pin - a situation that could be
remedied by optimizations. public void BlinkLeds()
The reset connection not only goes to a pushbutton but also {
to a pin of the long header strip (first connection next to the     var state = false;
voltage converter). If your scope has a Roll-Mode option and you  
have the patience you can use the reset to see that the board
    while (true)
takes almost 30 s before the program starts running(Figure 5)!
    {
For initial tests it’s ideal if we hook up a simple display (see
        myDisplay.WriteLine("Hello Elektor", 1);
Figure. 6) to the Meadow F7 board so that some simple
        System.Threading.Thread.Sleep(1000);
messages can be displayed. The design paradigm of the
abstraction classes described above is also continued with the     }
CharacterDisplay.Firstly we need to add another instance to }
the MeadowApp class that will be responsible for communicat-
ing with the display: Download the program to the Meadow again and see how it
looks on the display. If you are using the module included in
public class MeadowApp : App<F7Micro, MeadowApp>  { the hack kit and the display appears to be blank try adjusting
        CharacterDisplay myDisplay; the contrast control; if it’s turned down too much the displayed
characters disappear. It is also worth noting that writing to
The structure of hardware drivers always follows the same the screen occurs relatively slowly — there is still potential to
pattern under Meadow. The constructor first accepts a refer- optimize the code at the time of going to print.
ence to a device object - whoever transfers the device instructs
the driver to use the output hardware of the process computer. The Gadget is dead… long live the gadget!
Analogous to Microsoft’s Kinect SDK, this is a measure to The plan by Microsoft when they introduced their (now defunct)
increase flexibility (theoretically, you could also implement a .NET Gadgeteer platform in 2011 was to enable developers
GPIO extender). inexperienced with hardware design to quickly and easily create

52 March & April 2020 www.elektormagazine.com

191190 EN Meadow F7.indd 52 06/02/2020 09:02


Figure 7: The development hack kit is packed with goodies (Image: Wilderness Labs [6]).

prototypes. The system consisted of a plug-and-play proces- have a choice between the outdated NetDuino or the Meadow
sor-based mainboard and a range of sensor and IO modules F7 board. Applications compatible with the IO performance
which plugged into it using ribbon cables. offered by the board will find a very extensive driver library to
The same engineering spirit lives on at Wilderness Labs. The facilitate the speedy assembly and testing of prototypes — the
scope of delivery of the ‘Meadow F7 Micro Development Kit future of the gadget looks bright!
w/Hack Kit Pro’ (Figure 7), available for pre-order on their 191190-02
website [6], includes a Meadow F7 board, two prototyping plug
boards, a very high quality 4 x 20 alphanumeric LCD, a whole
bunch of active and passive components, actuators and sensors
as well as a development breadboard made from wood (MDF).
On top of that there is a very extensive driver library. At the
time of going to print, the driver for the (high-quality) colour 4 SALE @ WWW.ELEKTOR.COM
LCD is not ready for release but the kit itself should be avail- ª Book: Visual Basic for Electronics Engineers
able in March 2020. Check out the range of sensors listed in www.elektor.com/
the Wilderness Labs hardware list [4]. visual-basic-for-electronics-engineering-applications-e-book
An old English proverb says beggars can’t be choosers. Those
who want to use .NET in an embedded application currently only

Web Links
[1] Meadow F7: http://beta-developer.wildernesslabs.co/Meadow/Getting_Started/Deploying_Meadow/
[2] dfu-utils: http://dfu-util.sourceforge.net/releases/dfu-util-0.9-win64.zip
[3] A Windows bug:
www.hanselman.com/blog/HowToFixDfuutilSTMWinUSBZadigBootloadersAndOtherFirmwareFlashingIssuesOnWindows.aspx
[4] Peripherals: http://developer.wildernesslabs.co/Meadow/Meadow.Foundation/Peripherals/
[5] Character Display:
http://beta-developer.wildernesslabs.co/docs/api/Meadow.Foundation/Meadow.Foundation.Displays.Lcd.CharacterDisplay.html
[6] Meadow Kit /w Hack:
https://store.wildernesslabs.co/collections/frontpage/products/meadow-f7-micro-development-board-w-hack-kit-pro

www.elektormagazine.com March & April 2020 53

191190 EN Meadow F7.indd 53 06/02/2020 09:02


Practical
ESP32 Multitasking (2)
Task priorities
By Warren Gay (Canada)

In microcontroller projects, developers


often face the problem that many
processor tasks need to be performed at
a time. ESP32 and Arduino IDE make
task programming easy, as the popular
FreeRTOS is already integrated into the
core libraries [1]. In this second part of the
series we are especially dealing with task priorities.

Figure 1: The Lolin ESP32


with OLED Display is used again.

Within the ESP32 implementation of the FreeRTOS sched- to become unlocked (we will discuss the mutex concept later
uler, tasks are executed according to their priority. Priority in this series). A task that is ready to execute is inserted into
is assigned when the task is created but can be altered later. the scheduler’s ready list according to its priority and is exe-
Higher-numbered tasks are considered first for the configured cuted when its turn comes. Because it is a priority sorted list,
CPU, while zero-priority tasks are considered last. Execution the highest-priority tasks are considered first.
priority may be a familiar concept but the FreeRTOS real-time Tasks with equal priorities are scheduled using a Round-Robin
scheduler works differently than what you might be used to approach. Three ’ready’ tasks at priority-9 (a, b and c) will
with Linux or Windows. This article will explore the difference take turns:
using a demonstration. • task9a
The ESP32 implementation includes a maximum of 25 priority • task9b
levels, ranging from zero to 24. By default, the Arduino setup() • task9c
and loop() functions run at priority level 1 (recall that these • task9a
functions are from the same main task [1]). • task9b
• etc.
Vive la différence
How different can task scheduling be? On a Linux system for Unless they become blocked, this continues forever. Only a high-
example, priority affects the relative urgency of the process er-priority task can pre-empt them. For example, the high-pri-
or thread. Even a low priority process gets some CPU time — ority ESP32 task named idc1 (for CPU 1), may pre-empt your
normally taking longer to run. But the process does always priority-9 tasks to take care of some business. Once the idc1
execute eventually. This is where the difference lies. task becomes not ready again, the priority-9 tasks resume
In a real-time system like FreeRTOS, the scheduler does not where they left off.
guarantee that lower-priority tasks will ever get executed. For
example, if you have priority-9 tasks that are always ready to Here are some examples of how a FreeRTOS task becomes
execute, then no priority-8 or lower task will get scheduled on not ready:
that same CPU. In other words, the priority-9 tasks will starve • sleep or delay for a time (waiting for a timer);
all lower priority tasks. • waiting for a mutex or semaphore;
• waiting to receive a message from an empty queue;
Ready to execute • waiting to insert a message into a full queue;
It is important to understand what ’ready’ means to FreeRTOS. • waiting for a FreeRTOS event or event group;
A task is ready when it is not blocked waiting for something, • waiting for an I/O to complete;
whether it is an event, an entry pushed into a queue or a mutex • suspended (either by the task itself, or by another task).

54 March & April 2020 www.elektormagazine.com

191195 EN Practical ESP32 Multitasking - part 2.indd 54 06/02/2020 09:04


One of the ways to become blocked is to wait to receive a mes- static Display oled;
sage from an empty queue. When empty, there is nothing for static InchWorm worm1(oled,1);
that task to do so the scheduler removes that task from the static InchWorm worm2(oled,2);
ready list and searches for others to run. Only tasks on the static InchWorm worm3(oled,3);
’ready’ list will be considered. If no tasks are found, the sys-  
tem’s idle task is run instead. Each worm takes a C++ reference (like a C pointer) to the dis-
Notice that taskYIELD() function call is not one of the reasons play class in the first argument and the number of the worm
listed. When a task yields control, either by exhausting its time as the second. The reference to the display allows for a future
slice or by voluntarily yielding by calling taskYIELD(), con- enhancement like the support of multiple displays. The worm
trol returns to the FreeRTOS scheduler so that it can choose number determines where on the OLED it is displayed (1, 2
another task to run for the next slice. Yielding is not blocking and 3 are first, middle and bottom lines respectively).
because these tasks remain ready to execute and will be given The task behind each worm, is simply a CPU time wasting loop
CPU again at the next opportunity. and a message send call:
 
ESP-IDF FreeRTOS SMP changes void worm_task(void *arg) {
FreeRTOS was designed for single-CPU microcontrollers.   InchWorm *worm = (InchWorm*)arg;
Because the ESP32 consists of a dual-CPU arrangement (except    
ESP32-S2), Espressif customized the scheduler component. As   for (;;) {  
review, the following ESP32 CPUs are present:
    for ( int x=0; x<800000; ++x )
• CPU 0 known as the PRO_CPU (Protocol CPU);
      __asm__ __volatile__("nop");
• CPU 1 known as the APP_CPU (Application CPU);
    xQueueSendToBack(qh,&worm,0);
 
    // vTaskDelay(10);
Espressif states that the “two cores are identical in practice
and share the same memory”.   }
To support symmetric multiprocessing (SMP), they state that }
the “scheduler will skip tasks when implementing Round-Robin  
scheduling between multiple tasks in the Ready state that are It is important to leave the vTaskDelay() function commented
of the same priority”. This comes from the limitation of using out for now. It will be used in a later experiment.
a ’ready’ list designed for a single CPU, on a platform that The same task function is used for all three inchworm tasks,
has two [2]. with the argument named arg specifying which instance of
The problem that they faced was that when a CPU required a the worm that we want to wiggle. The address of the worm is
task context change (to run the next ready task), the CPU has converted from a void pointer and stored in the local variable
only one task ready list to search. So if the current list index worm. It is only used within this task to be sent as a message to
points to ready tasks for the other CPU, then those entries have indicate to the display task (main task) which worm to wiggle.
to be skipped until an entry for the required CPU can be found. Note that when xQueueSendToBack() is called in this demon-
This can make the Round-Robin scheduling less than perfect. stration, the time-to-wait parameter has been specified as zero
The bottom line for the developer is that the Round-Robin (argument three). This directs FreeRTOS to queue if it can but
scheduling is not completely fair in the dual-CPU ESP32. For immediately fail if the queue is full. This is intentional because
many projects, this will not be a noticeable but if it does become if the queue becomes full, we don’t want our inchworm task to
problematic, there are ways to code around it. Just be aware block its execution. The task must not release the CPU for this
of this in your task planning. demonstration, so it can truly monopolize the CPU.
The outer for loop has the task performing its operations
Demonstration forever. The inner CPU time wasting for loop executes a no
An Arduino demonstration program is available for the Lolin operation (nop) operation 800,000 times. The __volatile__
ESP32 OLED Display Module (Figure 1). By changing a few keyword prevents the compiler from optimizing this loop state-
macros in the program, you’ll be able to alter task priorities ment away. Despite what the compiler might think, we really
of four different tasks within it. The program is designed do want to do this wasteful thing.
to display three inchworms, which inch (wiggle) back and Upon completion of the time wasting loop, we send the address
forth along the horizontal dimension of the OLED. Each of of the worm to be wiggled to the queue identified by handle qh.
the inchworms will only hump along if the driving tasks get Once the message is received by the display task, it will cause
CPU time. CPU starved tasks will leave the worm sitting still our worm to be advanced and movement displayed.
or moving slowly. The main Arduino loop() task is used as the display task to
Each worm is driven by a task that eats CPU time and then perform the worm wiggling:
sends a message to the fourth task. This fourth task is respon-  
sible for making that worm inch and be displayed. void loop() {
The code for drawing and managing the state of the inchworm,   InchWorm *worm = nullptr;
is defined in the InchWorm class (not shown here). For this arti-  
cle, we’ll simply focus upon the effect of the InchWorm::draw()   if ( xQueueReceive(qh,&worm,portMAX_DELAY) )
method for each worm. Each instance of the InchWorm class
    worm->draw();
manages its own state and progress. The display and worm
}    
instances are declared in the program as follows:  

www.elektormagazine.com March & April 2020 55

191195 EN Practical ESP32 Multitasking - part 2.indd 55 06/02/2020 09:04


This loop blocks execution until one of the tasks sends the worm tasks. The setup() function alters the priority of its own
address of the worm to be drawn. Once that class pointer is task as follows:
received, the InchWorm::draw() method is invoked to draw the  
worm and advance it. static int app_cpu = 0; // Updated by setup()
The setup() function is illustrated in Listing 1, showing how ...
the three worm tasks and the queue are created. void setup() {
  TaskHandle_t h = xTaskGetCurrentTaskHandle();
Changing priority
 
FreeRTOS permits a task to change its own or another task’s
  app_cpu = xPortGetCoreID(); // Which CPU?
priority using the vTaskPrioritySet() function. By default the
  ...
task invoking setup() and loop() runs at priority level 1 (these
  vTaskPrioritySet(h,MAIN_TASK_PRIORITY);
functions are called by the same main task). For this demon-
stration we need that priority to be higher than the other three  
As shown, the setup() function obtains its own task han-
dle by calling xTaskGetCurrentTaskHandle() and stor-
ing it in h. By changing the main task priority in the call to
Listing 1 – The setup() function.
vTaskPrioritySet(), the task priority used by loop() is also
void setup() { affected. This is an example of how task priorities can be
  TaskHandle_t h = xTaskGetCurrentTaskHandle(); adjusted.
  In the first experiment, the worm tasks are assigned task pri-
  app_cpu = xPortGetCoreID(); // Which CPU? orities 9, 8, and 7. This requires that our display (main) task
  oled.init(); to be at priority 9 or above (we will use 10). If this were not
  vTaskPrioritySet(h,MAIN_TASK_PRIORITY);
done, the main task loop() will starve of CPU and be unable
to animate the inchworms.
  qh = xQueueCreate(4,sizeof(InchWorm*));
 
Which CPU?
  // Draw at least one worm each:
From the setup() snippet shown, another ESP32 API function
  worm1.draw(); named xPortGetCoreID() was illustrated to discover which CPU
  worm2.draw(); the application is running on. This is assigned to static variable
  worm3.draw(); app_cpu in the program so that the code knows which CPU to
  create new tasks for. For the dual core ESP32, the value of
  xTaskCreatePinnedToCore(   app_cpu will be 1 (run on CPU 1 in a dual-core configuration).
    worm_task,  // Function  For single-CPU platforms, app_cpu will be set to zero. Coding
    “worm1”,    // Task name it this way normally allows it to portably run on single or dual
    3000,       // Stack size platforms.
    &worm1,     // Argument
This particular demonstration however, will not function well on
    WORM1_TASK_PRIORITY,
a single-CPU platform because of the way the CPU is monop-
    nullptr,    // No handle returned
olized. That will trigger the watchdog timer and cause resets.
    app_cpu);
But the technique of using xPortGetCoreID() does illustrate
  how portability can be achieved for other applications.
  xTaskCreatePinnedToCore(  
    worm_task,  // Function  Demo configuration
    “worm2”,    // Task name The demonstration source code is available at [3]. At the top
    3000,       // Stack size of the demonstration program are macro definitions, which
    &worm2,     // Argument configure each experiment:
    WORM2_TASK_PRIORITY,  
    nullptr,    // No handle returned // Worm task priorities
    app_cpu); #define WORM1_TASK_PRIORITY 9
  #define WORM2_TASK_PRIORITY 8
  xTaskCreatePinnedToCore(   #define WORM3_TASK_PRIORITY 7
    worm_task,  // Function   
    “worm3”,    // Task name // loop() must have highest priority
    3000,       // Stack size #define MAIN_TASK_PRIORITY  10
    &worm3,     // Argument  
    WORM3_TASK_PRIORITY, Initially leave those as shown for the first experiment.
    nullptr,    // No handle returned
    app_cpu); Custom OLED display
} If you’re not using the recommended Lolin ESP32 with its built-in
OLED, your custom display settings can reconfigured here:

56 March & April 2020 www.elektormagazine.com

191195 EN Practical ESP32 Multitasking - part 2.indd 56 06/02/2020 09:04


 Display(
    int width=128,
    int height=64,
    int addr=0x3C,
    int sda=5,
    int scl=4);
 
If your settings are correctly configured, the OLED should
immediately turn white upon program initialization. Other-
wise, recheck the connections and settings.

Demonstration 1 Figure 2: When tasks are executed, the demo worms move.
Using the downloaded code, simply compile, flash and run the
application. Your OLED should immediately display white, with
three black inch worms drawn (see Figure 2).
The configuration (again) for this experiment is:
  They will march across the screen at the same pace (or nearly
#define WORM1_TASK_PRIORITY 9 so). When the demonstration is allowed to run long enough,
#define WORM2_TASK_PRIORITY 8 some worms might get ahead of the others by a little bit.
#define WORM3_TASK_PRIORITY 7
#define MAIN_TASK_PRIORITY  10 Demonstration 3
  In this experiment, modify the configuration to give the three
This configuration will cause the top worm to wiggle its way worms all the same priority (as in the last demonstration) and
across the top, while the lower two remain still. The question set the main display task to that same priority. I’ll use prior-
is: why don’t the middle and bottom worms move? ity-9 for all of these tasks:
   
                      _-_ #define WORM1_TASK_PRIORITY 9
_-_ #define WORM2_TASK_PRIORITY 9
_-_ #define WORM3_TASK_PRIORITY 9
  #define MAIN_TASK_PRIORITY  9
Recall that we left the main task at priority 10. So it enjoys the  
highest priority in our application set of tasks. The first worm, After recompiling, reflashing and running the code, what did
which displays on the top line of the OLED was able to progress you observe? Was there a difference? Why are they progress-
because it was the only CPU consuming task able to run. This ing at different rates?
priority-9 task is able to execute because the priority-10 display  
task performs I/O to the OLED and then waits for messages to        _-_
arrive in the message queue (becomes blocked). When the display                _-_
task is blocked, other lower priority tasks are able to schedule.                                  _-_
The priority-8 and -7 tasks (for middle and bottom worms)  
are starved of CPU and never get executed because the prior- When I run this, the bottom worm seems to get the most CPU
ity-9 task completely monopolizes the CPU. This is the nature (i.e. wiggles the fastest). The top worm moves the slowest.
of real-time scheduling within FreeRTOS. Unlike Linux or Win- Again, the Espressif noted limitation of round-robin unfair-
dows, lower priority tasks are not given a chance to execute. ness is to blame for this. Ideally, the display task should only
steal a little CPU while drawing the inch worm. Otherwise, the
Demonstration 2 remaining CPU time should be equally shared among the three
For the second experiment, modify the configuration to give other tasks driving the worms.
the three worms all the same priority but leave the main dis- Yet we see that the scheduling is unbalanced. Both CPUs are
play task at priority 10. Set all three to the same priority of 9, responding to timer and other interrupts. The flawed sched-
8 or 7. I’ll use 9 here: uler code is responsible for disrupting the fairness of Round-
  Robin scheduling.
#define WORM1_TASK_PRIORITY 9
#define WORM2_TASK_PRIORITY 9 Demonstration 4
#define WORM3_TASK_PRIORITY 9 Each demonstration so far has had each worm task consume
#define MAIN_TASK_PRIORITY  10 as much CPU time as it can muster. How  does the behaviour
  change if we introduce a small delay (to block) within the loop?
When you recompile and reflash the ESP32, what did you Reset the configuration so that the main display task has pri-
observe? ority 10, and each of the worm tasks have priorities 9, 8 and
  7 respectively:
         _-_  
         _-_ #define WORM1_TASK_PRIORITY 9
         _-_ #define WORM2_TASK_PRIORITY 8

www.elektormagazine.com March & April 2020 57

191195 EN Practical ESP32 Multitasking - part 2.indd 57 06/02/2020 09:04


#define WORM3_TASK_PRIORITY 7 The header defines the following priority macro values. The
#define MAIN_TASK_PRIORITY  10 compiled values are shown:

Then uncomment the line where vTaskDelay() is called so that configMAX_PRIORITIES = 25


the task loop looks like this: configKERNEL_INTERRUPT_PRIORITY = 1
configMAX_SYSCALL_INTERRUPT_PRIORITY = 3
void worm_task(void *arg) {
  InchWorm *worm = (InchWorm*)arg; The first macro defines the maximum number of priorities avail-
  able. This means that valid priority numbers range from 0 to 24.
  for (;;) { The second macro defines the priority used by the kernel itself
for interrupts. Connected with this is the third macro, which sets
    ...
the highest priority used by kernel interrupts. Any FreeRTOS
    for ( int x=0; x<800000; ++x )
API call made from within an Interrupt Service Routine (ISR)
      __asm__ __volatile__("nop");
must only call FreeRTOS API functions with names ending in
    xQueueSendToBack(qh,&worm,0); FromISR(). Further, with the values shown, those functions can
    vTaskDelay(10); // Uncommented only be called from interrupt task priorities 1 to 3 inclusive. If
  } no FromISR() calls are made, the ISR may freely operate at
} priorities 4 through 24 inclusive.

Now each worm task will consume CPU, try to queue up a worm Summary
and then block for 10 milliseconds. Compile, flash and run this What can we conclude from these experiments? What may
example. What did you observe? have seemed like a simple concept of priority was not so sim-
The top worm will move the fastest and the bottom worm will ple after all. The consequence is that if your task priorities are
move the slowest. The top worm with priority-9 gets first crack not well planned, there can be surprises — some tasks can
at the CPU due to its high priority (while the display task is become CPU starved. We haven’t discussed watchdog timers
blocked). When the worm task is blocked in the vTaskDelay(10) yet but this impacts them also. For example if the watchdog
call, the next lower priority task (the middle worm) gets to timer triggers in CPU 0, then your ESP32 will reset and restart.
consume some CPU and it eventually calls vTaskDelay(10). For the dual-core ESP32, there is the additional issue that
This in turn allows the even lower, priority-7 task to get some Round-Robin scheduling at the same priority level can lead
cycles. This has a trickle down effect, dividing up CPU from to unequal execution time. This can be problematic in some
highest to lowest levels. applications and yet be problem free in others. The problem
But note that the priority-8 and -7 tasks do get pre-empted depends upon the nature of your ’system’.
whenever the higher priority-9 task becomes ready again. This For many applications, you can simply create tasks to run at
is why the top worm moves the fastest. The middle worm can priority 1. This is the priority configured for the Arduino setup()
sometimes pre-empt the priority-7 task, so it tends to be faster and loop() task. Higher-priority tasks can safely be utilized if
than the bottom worm. they block on a queue, semaphore or some other event. When
a task blocks or is suspended, the CPU is shared with other
More experiments equal or lower priority tasks. An application with properly con-
What happens if you make the vTaskDelay() time much longer figured task priorities will operate like a well oiled machine.
than 10 milliseconds? Try to imagine the answer and then run (191195-01)
it. Why did you get that result? What happens if you reduce
the delay time to a 1-millisecond delay? These explorations
are left for the reader.

Priority configuration
While we have not yet covered interrupt use within the ESP32,
be aware of the header file named FreeRTOSConfig.h, which
@ WWW.ELEKTOR.COM
configures priorities for the platform, found here:
ªLolin ESP32 OLED Display Module
www.elektor.com/lolin-esp32-oled-module-with-wifi
$IDF_PATH/components/freertos/include/freertos/
FreeRTOSConfig.h

Web Links
[1] Practical ESP32 Multitasking, Elektor Magazine 1/2020: www.elektormagazine.com/190182-01
[2] Symmetric Multiprocessing: https://thc420.xyz/esp-idf/file/docs/en/api-guides/freertos-smp.rst.html
[3] Project source code: https://github.com/ve3wwg/esp32_freertos/blob/master/priority-worms1/priority-worms1.ino

58 March & April 2020 www.elektormagazine.com

191195 EN Practical ESP32 Multitasking - part 2.indd 58 06/02/2020 09:04


Ready to learn and innovate? The Elektor Arduino Home Automation Bundle is not
just limited to RFID applications. It contains 30+ components, devices and modules!
When it comes to expanding the capabilities of the basic Arduino board, the developer is still largely on his own. To build innova-
tive projects, it’s often necessary to get down to the component level, which can present many beginners with major problems.
That is exactly where the book – Home Automation Projects with Arduino – in this bundle begins. It explains how a wide variety of
practical projects can be built using the included “RFID Starter Kit for Arduino”.

Elektor Arduino Home


Automation Bundle
Description:

lektor
In addition to simple components, such
as LEDs and resistors, you also receive
complex and sophisticated modules that
employ the latest technology, such as:

• A humidity sensor
• A multicolor LED
• A large LED matrix with 64 points of light
• A 4-character 7-segment LED display
• An infrared remote controller unit
• A complete LCD module
• A servo
• A stepper motor and controller module
• A complete RFID reader module and
security tag

OW6
N 8,4
€5
rs
be
mem
r
fo

On top of that, you will get to build precise


digital thermometers, hygrometers,
exposure meters and various alarm
systems. There are also practical devices
and applications such as a fully automatic
rain sensor, a sound-controlled remote
control system, a multifunctional weather
station and so much more.

Learn more:
www.elektor.com/elektor-arduino-home-automation-bundle

Bundle-Adv-EN-A4-ArduinoHomeAutomation.indd 1 06/02/2020 09:10


HOMELAB PROJECT

Sigfox
and the IoT (3)
First steps on the network

By Frank Schleking and Bernd vom Berg (Germany)

With the MKR FOX 1200 board now registered to the Sigfox network, nothing stands in the way of trying out
our first communication experiments. We will make our Sigfox device transmit the customary ‘Hello World!’
greeting message using the cloud.

First of all let us take a look at how our station appears in the • Device type: It is possible to sort and arrange stations
Sigfox cloud. To do this log in to the Sigfox backend [1] as usual within a group which have identical type (that is, stations
with your e-mail address and password: this will take you to having the same structure and the same functions). This
the homepage of the Sigfox portal (see Figure 1). Now click allows you to collate temperature measurement stations,
on the ‘Device’ tab, which will give
you an overview of the Sigfox devices
you have registered and possibly
activated (see Figure 2). In this case
the MKR FOX 1200 should be the only
station shown. The columns of the list
have the following meanings.
• Group: The group name is
automatically assigned by Sigfox
on the basis of the information
you have provided to it, and it
is not possible to change it. The
group contains all of your Sigfox
devices. By clicking on the group
name you will see further infor-
mation about the group (which
also cannot be changed here). Figure 1: The Sigfox portal.

60 March & April 2020 www.elektormagazine.com

190281-C EN Follow that Fox.indd 60 06/02/2020 09:16


stations for reading analogue
sensor values, stations for
reading digital signals, and so
on. In our case we of course
only have one type of station, or
‘Device type’, called ‘Arduino_
DevKit_1’. Later on you can
change these names and make
them better reflect their roles.
• Id: This shows the unique ID
number of the station.
• Last seen: Here the backend
shows the date and time at
which the station was last seen
on the network: more precisely, Figure 2. The registered Sigfox devices.
the last time a message was
received from the station. The
string ‘N/A’ indicates that the
backend has yet to receive any message from the station.
• Name: This displays the name of the station.
• Token state: A token provides authorization for a station
to access the Sigfox network. If you sign up to the Sigfox
service (and pay the corresponding charges for the use
of their network) then you will receive a certain number
of tokens that you can use. If a station wishes to become
an active participant in the Sigfox network, it must be
supplied with one of these tokens. Then it can send and
receive data over the network without any difficulties. The
purchase price of an MKR FOX 1200 board includes (once
you have registered with the Sigfox backend) a token Figure 3. The pull-down menu attached to the ‘Name’ field.
that allows access for one year. The MKR FOX 1200 board
can thus operate as an individual station on the network
for one year; and Sigfox supplies a new unique token
with each new MKR FOX 1200 board. The ‘Token state’
indicates whether the station has already used its token
at least once, or in other words whether the station has
already used the Sigfox network to send data. Since in the
example shown in the figure this has not yet happened, a
question mark appears in this column. As soon as the first
message is sent (and hence the station’s authorization to
send has been used) a tick will appear here in its place. It
is only at this point that a token is irrevocably associated
with a particular station.
 
If you now click your mouse on the ‘Name’ field a small
drop-down menu will appear (as shown in Figure 3), from
which you can select ‘Edit’. In the ‘Edition’ page that appears
(Figure 4) it is possible to change some of the properties of Figure 4. The device editing page.
the device. Here (if necessary) we can change the name of the
Sigfox station to ‘MKR FOX – 1’ for example; the other fields
should be left unchanged. Finally, click on ‘Ok’.
Hello World!
You can now go to the ‘Device Information’ page (see Figure 5), To complete the activation process and thereby allow the station
which brings together all the information about the Sigfox to be used in the Sigfox network, it is necessary to send a
module in one place. From this page it is only possible to view first valid message. This moment will then mark the begin-
the information, not change it. ning of the one-year free Sigfox subscription, which includes
up to 140 uploaded messages per day and four downloaded
If you click on the ‘Device’ tab at the upper left you will be messages per day.
returned to the device overview, where you should see that For our first message we will send the familiar ‘Hello World!’
the device name has indeed been changed. Now you can close standard test text to the Sigfox backend. This string contains
the Sigfox backend. exactly twelve ASCII characters, and so fits exactly in the

www.elektormagazine.com March & April 2020 61

190281-C EN Follow that Fox.indd 61 06/02/2020 09:16


Figure 6. Sending a test string.

twelve-byte Sigfox message payload. In the previous install-


ment of this series we described the Sigfox functions that are
required to send a message, and so the core of the transmit
routine in Listing 1 and the function calls within it should be
easy to understand.

Figure 5. There is an information page for each device.


• SigFox.begin: This function call initializes the Sigfox
library and the Sigfox modem, returning an error code if
something goes wrong.

Listing 1. Transmitting the “Hello World!” text.


• SigFox.debug: This function
enables debug mode. The
  // enable Sigfox modem and check for errors power-saving functions of the
  if (!SigFox.begin())        // error occurred? microcontroller and the modem
  { are disabled, and the yellow LED
    Serial.println("Error in Sigfox module!"); on the MKR FOX 1200 board will
  flash to indicate the reception or
    while (1);  // after error, drop into infinite loop transmission of data.
  }
  • SigFox.beginPacket: This
  // enable Sigfox modem debug mode function marks the beginning of
  SigFox.debug(); the process of sending a Sigfox
  packet.
  // now we will send the string "Hello World!"
 
• SigFox.print: The value or string
  // prepare to transmit a packet
to be transmitted is stored in the
  SigFox.beginPacket(); payload area of the packet and it
 
is transmitted. Numerical values
  // assemble string (sequence of characters) into a Sigfox message
are also represented as ASCII
  SigFox.print("Hello World!");
  strings. To send binary data (that
  // final step in packet assembly and transmission; check for errors is, ‘real’ numbers, not just their
ASCII codes) use the function
  // return code in variable ret
SigFox.write (on which more
  int ret = SigFox.endPacket();
  later).
  Serial.print("\nError status (0 = no error): ");
  Serial.println(ret); • int ret = SigFox.endPacket:
  This is the final step in the
  // close Sigfox library and shut module down assembly and transmission of
  SigFox.end(); the Sigfox packet and returns a
status code: 0 indicates that no

62 March & April 2020 www.elektormagazine.com

190281-C EN Follow that Fox.indd 62 06/02/2020 09:16


error occurred, while 1 indicates
that something went wrong.
• SigFox.end: This function closes
the Sigfox library and shuts down
the Sigfox modem.

This example shows how straightfor-


ward a complex data transmission
task can be when a powerful library
Figure 7. The device message page.
is available to help out!
Load the Sigfox sketch onto the MKR
FOX 1200 board, open the serial
port monitor and launch the sketch.
The serial port monitor window will
show the main menu of the sketch:
choose the second menu option
(‘Transmit ‘Hello World!’’). The
process described above to send the
test message will be carried out, with
certain status information reported
in the serial port monitor window. At
the same time you should be able
to see the yellow LED on the MKR
FOX 1200 board flashing to indicate
that communication is taking place. Figure 8. The information page for each device type.
The whole process should complete
without any errors (see Figure 6).

Back to the backend


As long as you are within the Sigfox
radio coverage area, the Sigfox
backend will receive the data within
a very short time. This is straight-
forward enough to verify: open the
Sigfox backend, log in, and click on
the ‘Device’ tab in the home page.
In the list of active Sigfox devices
click (accurately!) on the ‘Id’ field
of the station, which will display the
information page associated with the
device in question. On the left-hand
side of that page click on ‘Messages’.
The page that appears (see Figure 7)
Figure 9. The device type editing page.
shows all the messages that the
Sigfox backend has received from the
station. The ‘Time’ field is self-ex-
planatory; the ‘LQI’ (link quality indicator) field gives an idea 48 65 6c 6c 6f 20 57 6f 72 6c 64 21
of the field strength of the received signal carrying the message H  e  l  l  o     W  o  r  l  d  !
as measured at the base station. Hovering over this field with As you can see, the string consists of the ASCII codes for
the mouse reveals a description of the received signal quality the characters in the test text ‘Hello World!’ (including ASCII
and the name of the local operator of the Sigfox network: 0x20 for the space character). The way the raw data should be
depending on what country you are in, this could be Sigfox decoded can be configured from the Device List page (Figure 2).
itself or one of its partners. Clicking on ‘Location’ brings up a Just click on the name ‘Arduino_DevKit_1’ in the ‘Device type’
(rather rough) map showing approximately where the Sigfox column, which takes you to the ‘Information’ page for this
station is located. device type (see Figure 8); then click on ‘Edit’ to call up the
We now come to the important information in the field ‘Data/ corresponding ‘Edition’ page (Figure 9). Here change (only) the
Decoding’, which shows the contents of the message payload, ‘Payload parsing’ setting in the ‘Payload Display’ box to ‘Display
either in raw form or in decoded form. Initially the backend in ASCII’ and confirm the change. Back on the ‘Messages’
does not know how the raw payload data should be interpreted: page you should now see an extra line displaying the payload
this is something that needs to be configured. Let us look a contents interpreted as ASCII values (see Figure 10).
little closer at the data field: There are two basic steps that must be taken when transmit-

www.elektormagazine.com March & April 2020 63

190281-C EN Follow that Fox.indd 63 06/02/2020 09:16


Table 1. Number of bytes
occupied by various data types.
Bytes
Data type
required
char / unsigned char 1
int8_t / uint8_t 1
int16_t / uint16_t 2
int / ​unsigned int 4
Figure 10. Decoding the payload contents as ASCII characters. int64_t / uint64_t 8
float 4

Table 2. Possible arrangement


of various data types in the
Listing 2. Organization of the Sigfox data type Sigi_Dat_1.
payload.
// structure and data type 1 for our example: Value in
Data type Bytes
// transmission of fixed numeric values payload
typedef struct __attribute__ ((packed)) sigfox_message { unsigned
1 1
unsigned char value_1; // first value in payload: 1 byte long char
unsigned int value_2; // second value in payload: 4 bytes long unsigned
2 4
float value_3; // third value in payload: 4 bytes long int
unsigned char value_4; // fourth value in payload: 1 byte long 3 float 4
} Sigi_Dat_1; unsigned
4 1
char

Listing 3. Transmitting fixed numeric values. ting raw numerical values within a
// definition of four fixed numeric values payload. First you must decide what
  unsigned char AIN_1 = 0x1f ;        // first value, 1 byte long data types will need to be carried in
  unsigned int pressure = 0x12345678; // second value, 4 bytes long the twelve-byte payload: each data
  float         temp = 1233.56;        // third value, 4 bytes long type comprises a different number
  unsigned char AIN_2 = 0x55;        // fourth value, 1 byte long of bytes and therefore occupies
  a different number of bytes in the
  // enable Sigfox modem and check for errors payload. The most important data
  if (!SigFox.begin())        // error occurred? types are listed in Table 1. One
  { possible organization of values in a
    Serial.println("Error initializing Sigfox module. RESET to continue"); payload is shown in Table 2: in this
    while (1);  // after error, drop into infinite loop example a total of ten out of an avail-
  } able twelve payload bytes are used.
  else The second step is to define a
  { dedicated data type to encapsulate
      Serial.println("Sigfox modem OK\n"); the above collection of data, making
  } it easy to assemble the desired data
  into the payload format in one place.
  // enable debug LED and disable power-saving modes A suitable definition for our example
  SigFox.debug(); is shown in Listing 2. Fully under-
  
standing the construct used here
  // deal with all pending interrupts
requires an in-depth knowledge of
  SigFox.status();
C or C++; we will give a simplified
  delay(1);
explanation.
 
The line struct ……… sigfox_message
  // now we write the current values that are to be transmitted into
and the lines that follow enclosed
  // the SF_send structure variable
within curly brackets together
  // this process assembles the payload contents
describe what is called a ‘structure’
  SF_send.value_1 = AIN_1;        // unsigned char value:  1 byte
of type sigfox_message . A struc-
  SF_send.value_2 = pressure;     // unsigned int value:   4 bytes
ture like this is nothing more than a
  SF_send.value_3 = temp;         // float value:          4 bytes collection of pieces of data brought
  SF_send.value_4 = AIN_2;        // unsigned char value: 1 byte together under a single overarching
Continued on the next page name. It is therefore rather like an
array, except that an array consists

64 March & April 2020 www.elektormagazine.com

190281-C EN Follow that Fox.indd 64 06/02/2020 09:16


of pieces of data all of the same
Continued from the previous page:
type; in a structure, in contrast,
the members can all be of different   // next we use the Sigfox library to transmit the data we have
types. In this example we have two // assembled in the structure variable SF_send, which will become the
members of type unsigned char, one // payload contents
of type unsigned int, and one of type  
float. The types of the members of   // prepare to transmit a packet
the structure must correspond exactly   SigFox.beginPacket();
to the organization of the payload  
and occur in the correct order in the   // pass structure variable to the Sigfox library
structure definition.   SigFox.write((char*)&SF_send, sizeof(SF_send));
Accessing a given member of a struc-  
ture is very straightforward:   // error check: if endPacket() returns 1, report an error
structure_name.member_name   int ret = SigFox.endPacket();
So, for example, if we write   if (ret > 0)
sigfox_message.value_3 = 25.78;   {
the floating-point member value_3     Serial.println("Error: transmission failed. RESET to continue");
will be set to the value 25.78.     while(1);     // infinite loop
Now we can take this one step further   }
and use the structure to create a   else
completely new data type. You will   {
of course be familiar with the built-in     Serial.println("Sigfox transmission OK");
C data types such as unsigned char,   }
int and float. With the addition of  
the keyword typedef at the begin-   // close Sigfox library and shut module down
ning of the structure definition we   SigFox.end();
can create a new data type that

Advertisement

small area ratio,

big Active tip technology


Features a built-in sensor and perfect heat transfer, for
the fastest heat-up and recovery time. Reduce your
downtime for a faster workflow and better results.
One intelligent WX platform
Run any active tip from one WX station, meeting
all operational hand soldering needs such as motion
sensing or traceability with digital data storage in

performance
the soldering tool and station.
Patented tip and grip design
Precise control, ergonomic grip
Fast and hassle-free tip changing without needing
The boomerang handle design allows for precise
any tool.
handling while providing an ergonomic and secure grip.

World‘s first:
MR-NH
Discover a new dimension
to smt production – the new
solder paste MR-NH. Even
for applications with an
area ratio smaller than 0.6.
For nearly all stencils.

A performance which
convinces everyone.

Almit GmbH Unterer Hammer 3 64720 Michelstadt Learn more at:


weller-tools.com/nocompromise/
+49 (0) 6061 96925 0 www.almit.de [email protected]

www.elektormagazine.com March & April 2020 65

190281-C EN Follow that Fox.indd 65 06/02/2020 09:16


Table 3. Received payload. Listing 4. Definition of a new data type “Sigi_Dat_2” for the transmission of
1f 78563412 ec319a44 55 sensor readings.
(A) (B) (C) (D) // structure and data type 2 for our example:
// transmission of sensor readings
  typedef struct __attribute__ ((packed)) sigfox_message_2 {
precisely encapsulates the following     float value_1;     // first value in payload:   4 bytes long
structure. This new data type will of     float value_2;     // second value in payload: 4 bytes long
course require its own new name,     uint16_t value_3;     // third value in payload:   2 bytes long
which must be specified at the end
 
of the definition. In this example we
    // this structure therefore occupies a total of ten bytes
have given it the name Sigi_Dat_1.
 
The specification __attribute__
} Sigi_Dat_2;
((packed)) ensures that the compiler
does not insert unnecessary padding
bytes in the structure layout, so
that only the bytes we require will
form part of the payload and be Listing 5. Writing the sensor readings into the structure variable.
transmitted.     // now we write the current values that are to be transmitted into
The whole structure definition can be // the SF_send_mw structure variable
placed right at the beginning of the     // this process assembles the payload contents
sketch as if it were a global variable,
    SF_send_mw.value_1 = temp;        // float value:        4 bytes
allowing the data type to be used
    SF_send_mw.value_2 = pressure;    // float value:        4 bytes
wherever we like in the code. To make
    SF_send_mw.value_3 = LDR;         // uint16_t value:    2 bytes
use of the data type it is of course
necessary to declare a variable having
this type. That is done exactly as you
would expect: A new function in the sketch brings the three readings together
into the structure variable ready to transmit (see Listing 5).
data_type variable_name; Verification output over the serial port and on the e-paper
display gives the current sensor readings as well as Sigfox
The line Sigi_Dat_1 SF_send; declares a variable called SF_send, communication status. Further explanation will be found in the
having exactly the structure we have just described. It is most thoroughly-commented program listing of the sketch.
convenient to declare this as a global variable. The individual
members of the variable can be accessed using a statement Outlook
along the lines of SF_send.value_1 = 12;. That brings us to the end of our brief introduction to the Sigfox
‘0G’ IoT network, in which we have used the Arduino MKR
Transmission FOX 1200 maker board. The programs and functions we have
In order to examine how the numeric values are packed into presented should provide a solid foundation for realizing your
the Sigfox payload, we can write a function that sends a fixed own projects using the Sigfox network.
sequence over the Sigfox network (Listing 3). This function is What remains to be done is add visualization of the data for the
called when the third menu option in the demonstration sketch is user, in the form of a freely-configurable dashboard displayed
selected. We do not have space to explain this function in great on the user’s PC, laptop or smartphone. That will be the topic
detail: suffice it to say that because we are now sending raw of the next (and final) installment of this series.
values rather than characters, we use the function SigFox.write 190281-C-03
to generate the payload. If all works correctly, the backend
should display the payload as shown in Table 3.
Finally we have developed a function, activated by the fourth
menu option in the demonstration sketch, that sends real sensor
readings. These are the temperature reading from the BMP280
sensor (float, four bytes), the atmospheric pressure reading 4 SALE @ WWW.ELEKTOR.COM
also from the BMP280 sensor (float, four bytes), and a reading ªArduino MKR FOX 1200: www.elektor.com/19096
from the LDR over analogue input A2 (uint16_t, two bytes). ªArduino Antenna 868 MHz: www.elektor.com/19095
For this last reading jumper JP5 on the motherboard must be
fitted in position 1-2. These readings occupy ten of the twelve
payload bytes.
We define a further data type for this collection of data (see Web Link
Listing 4) and declare a new variable called SF_send_mw:
[1] Backend login:
https://backend.sigfox.com/auth/login
// variable of type Sigi_Dat_2:
Sigi_Dat_2 SF_send_mw;

66 March & April 2020 www.elektormagazine.com

190281-C EN Follow that Fox.indd 66 06/02/2020 09:16


Raspberry Pi
Bash Command Cheat Sheet
By Clemens Valens (Elektor Labs)

Because it is virtually impossible to work on the Raspberry Pi, or, for that matter, on Linux in general, without
ever needing to enter commands in a terminal, here is a list of frequently used Bash commands.

A terminal is that black window in which you can only type all about you can add ‘--help’ (two dashes) to it, e.g.:
text. Sometimes it goes by the name Command Line Interface rm --help
or CLI. The commands you enter here are executed by the In the following ‘[path]’ refers to a relative or absolute path.
command interpreter ominously called Bash. An absolute path starts with ‘/’, e.g. ‘/home/pi’.
191250-01
There are many commands and most commands accept all sorts
of parameters and arguments. To find out what a command is

pwd Display the name of the present working directory.


ls List the content of the current directory.
ls [path] List the content of the specified directory.
ls -l List the content of the current directory with additional information.
ls -a List all files including hidden files beginning with ‘.’ (i.e. dotfiles).
cd [path] Change the current directory to [path].
cd .. Change to parent directory (note the whitespace between ‘cd’ and ‘..’).
cd / Change to root directory (note the whitespace between ‘cd’ and ‘/’).
cd ~ Change to home directory (determined by $HOME environment variable).
mkdir [name] Create the directory [name] in the present working directory.
rmdir [name] Remove the empty directory [name] from the present working directory.
rm [name] Remove the specified file.
rm * Remove all the files from the present working directory.
rm -r * Remove all the files and directories from the present working directory.
cp [from] [to] Copy a file from source [from] to destination [to].
cp -r [from] [to] Copy everything including directories from source [from] to destination [to].
mv [from] [to] Move a file from source [from] to destination [to].
mv -r [from] [to] Move everything including directories from source [from] to destination [to].
find Search for files matching certain patterns.
sudo [command] Superuser do. Execute [command] with elevated privileges. Allows you to do things you are not
entitled to. Common examples are:
sudo raspi-config Launch the Raspberry Pi configuration tool.
sudo reboot Safely restart your system.
sudo shutdown -h now Safely shut down your system now.
sudo apt-get ​install [package] Install a package.
sudo apt-get update Update the list of packages without installing anything.
sudo apt-get upgrade Upgrade the installed packages to the versions obtained with ‘apt-get update’
sudo ​chown pi:root [name] Change the owner of [name] to ‘pi’ and set the group to ‘root’.
sudo su Become Superuser for more than one command.
sudo ku Undocumented.
cat [name] Show the contents of a file.
head [name] Show the beginning of a file.
tail [name] Show the end of a file.
chmod [who][+,-,=][permissions] [name] Change the permissions for a file.
chmod u+x [name] Add execute permission for the owner of the file.
chmod 777 [name] Allow every user to read, write and execute the file [name].
tar -cvzf [name] [path] Create compressed file [name] from the contents in [path].
tar -xvzf [name] Extract the contents of a compressed file.
wget [uri] Download a file from the Internet.
man [command] Show the manual page for a command.
man man View the manual page of the ‘man’ command.
grep 'string' [name] Search inside one or more files for occurrences of ‘string’.

www.elektormagazine.com March & April 2020 67

191250 EN RPi Cheat Sheet.indd 67 06/02/2020 09:24


start-up zone

Europe's Most Successful


Start-up Accelerator?
HighTechXL, Eindhoven, The Netherlands
By Terry Boyd, HighTechXL

HighTechXL is a deep-tech venture-building company supported by Philips, Eindhoven University of


Technology and other big players. To build teams around innovative technologies from CERN and other
research institutions, HighTechXL holds two FasTrackathons each year, attracting talents ranging from
engineers to business managers and marketers. After just five years, HighTechXL is one exit away from
becoming Europe’s most high-profile venture-building effort.

By almost every metric, HighTechXL is not just a success but an tem. Eindhoven has produced foundational semiconductor
economic-development engine for Eindhoven and the Brabant companies such as ASML, the behind-the-scenes semiconductor
region: at least 2,000 new jobs created in the Netherlands company making the essential machinery powering industry
and other countries; more than 60 successful companies up giants such as Intel.
and running in next-gen tech industries and new technologies But the original effort, which dates back to 2013, has an
taken to market. unequalled record of success.
After only five years, HighTechXL [1] is one exit away from Yes, Y Combinator and 500 Startups have birthed bigger names
becoming Europe’s highest-profile venture-building effort. And and billion-dollar exits. But both have been operating longer...
the 2018 pivot to deep-tech makes a breakout even more likely. and both have far higher failure rates: about 90 percent.
In 2018, HighTechXL CEO and founder, Guus Frericks announced In six years, more than 60 percent of HighTechXL companies
the high-tech accelerator would transition to a deep-tech have survived. Seventeen sell their products globally, are in
venture building effort, more relevant to Eindhoven’s ecosys- the ’Star Portfolio’, and on course for ’10×’ returns.

Successful start-ups
About HighTechXL • Accerion [2], based in Venlo, The Netherlands, makes
HighTechXL is a deep-tech venture-building company positioning technology for mobile robots and autono-
supported by the Eindhoven Startup Alliance members, mous guided vehicles. Accerion sells their products in
including ASML, Philips, NTS-Group, Eindhoven University of several global markets and recently received a signifi-
Technology (TU/e), Brabantse Ontwikkelings Maatschappij cant A Round [3] backed by Phoenix Contact Innovation
(BOM), High Tech Campus, EY, HVG Law and ABN AMRO.  Ventures, based in Germany, in syndication with the
HighTechXL, through a partnership with the Dutch research economic development agency for the Limburg Province
center Nikhef (National Institute for Subatomic Physics), has (LIOF).
access to some of the most advanced technology in the world, • Amber Mobility [4], based in Eindhoven, has created
including agreements to take it to market. To build teams a ride-sharing network of electric vehicles, with plans
around these technologies from CERN and other research to introduce autonomous vehicles in the future. Amber
institutions, HighTechXL holds two FasTrackathons each year, has raised millions in capital including from Pala Group
attracting talents ranging from engineers and physicists to BV since its initial €500,000 from a friends-and-family
business managers and marketers. At the FasTrackathons, the round, expanding beyond Eindhoven with hubs all over
new technologies are presented to participants who then join The Netherlands.
teams in their areas of expertise and interest. • Bambi Medical [5], based in Eindhoven, has developed
HighTechXL takes an equity stake in each of the teams that a wireless vital signs monitoring device for premature
comes out of the nine-month venture-building program, babies. Bambi has raised at least 4 million euros from
then continues to work closely with them in a scale-up private investors and 2.4 million euros from Horizon2020.
program. • byFlow [6] makes 3D food printers for the restaurant
industry. The Eindhoven-based company received inter-

68 March & April 2020 www.elektormagazine.com Sponsored Content

191194 EN Start-Up Zone.indd 68 06/02/2020 09:25


Seventy-five people attended the second HighTechXL FasTrackathon in June, where teams formed around advanced technologies from CERN, TNO and Philips. Far
left: Corne Rentrop, TNO project leader in the field of hybrid printed and flexible electronics, was on hand to discuss in detail the printed electronics technology teams
could take to market. (Photo: HighTechXL)

national media coverage including flashes on BBC, CBS particle physics lab.
Morning and on industry and tech websites. Frericks: “CERN replied: ’Well, if there’s a region in Europe where
• LifeSense Group [7] makes sensors and health-tech you can make a difference in certain areas, it’s Eindhoven.’
wearables used to detect urine loss in women, men, and There was a high level of trust we could do something spectac-
children. The company has raised several millions in ular with those CERN technologies.”
investment capital using operations in Asia and plans to The pivot involved moving from accelerating teams building
expand into the U.S. market. high-tech products to sourcing technology from research insti-
• Manus VR [8], based in Geldrop, The Netherlands, has tutions, then finding the right people for teams to take the
developed virtual-reality gloves for VR training, and built tech to market.
an environment for testing. Clients include NASA and The new HighTechXL “is powered by the local ecosystem,”
several gaming companies. Based in Eindhoven, Manus Frericks said. The previous five years accelerating high-tech
raised a 2-million euro A round from Eindhoven Venture startups helped develop “very close relationships in the region”
Fund II in 2019. with everyone in the ecosystem.
• Sustonable [9], based in Amsterdam, developed a process Having the trust of the major players — entrepreneurs, corpo-
for combining recycled PET waste from plastics with quartz rate leaders and tech talent — meant it was easier to mobilize
to produce the world’s first circular composite stone for the collective technical might of the Brabant region for the new
kitchen surfaces and other uses. The company has raised HighTechXL approach.
several million euros in later-stage capital, including Here’s how it works.
2.2 million euros from Horizon2020. The company has
plans to expand in other global markets. Engineers, physicists and other professionals
• ULU [10] develops IoT technology for vehicles, includ- invited
ing Cartracker for tracking delivery fleet data. The First, HighTechXL sources technologies from research institu-
company has more than 15,000 subscribers and offices in tions such as CERN [11], TNO and Philips.
Amsterdam, Ljubljana, London and Shenzen. Then, they hold a FasTrackathon — a reverse-hackathon —
where technologies and potential application areas are up for
Alliance with CERN grabs. HighTechXL promotes FasTrackathon, inviting engineers,
In July 2018, HighTechXL pivoted from a high-tech startup physicists and professionals such as business development
accelerator with a successful track record to a deep-tech experts, finance managers and entrepreneurs to join the teams.
venture-building effort. Individuals and teams attend a half-day idea session, build a
Guus Frericks: “We said, what would happen if we only worked business model canvas and pitch their business ideas at the
with propositions where we as a region can make a difference? end of the day.
Do we start with high tech start-ups or take it one step further HighTechXL recruits additional team members interested in taking
and take ground-breaking technology as a starting point?” the technology to market and holds pre-program sessions to
That’s when HighTechXL made an historic alliance with CERN further strengthen the teams. They go through a selection process,
to take to market the latest tech from the world’s largest then teams begin the nine-month venture building program.

Sponsored Content www.elektormagazine.com March & April 2020 69

191194 EN Start-Up Zone.indd 69 06/02/2020 09:25


At FasTrackathon, every space in every room was full of people as well as PostIt Deep-tech venture team Incooling does what they do best: cooling down during
notes as everyone brainstormed application areas for advanced technologies. the Dutch dogdays of summer. From left to right: Karen Huaracha Magaña,
(Photo: HighTechXL) Helena Samodurova, Hossein Beikaii, and Hejran Mehrtak. (Photo: Incooling)

First deep-tech cohort • Aircision [15] uses laser technology to build the most
• Incooling [12], who are developing new technology for reliable link in the 5G communications matrix and is in
cooling CPUs and GPUs in data centres, are preparing for talks with telecom industry leaders to build partnerships.
CES 2020 [13] in Las Vegas. Incooling team members Aircision was selected as a Deep Tech Pioneer at Hello
travelled to Taiwan several times as well as across Europe Tomorrow, taking place in Paris in March 2020.
attending tech and startup events in 2019.
Incooling team members, including Helena Samodurova, The next group of deep-tech ventures have been in place
have won pitch competitions in Amsterdam, Berlin and since April 2019, with several promising startups built around
Taipei. The team has raised more than 600,000 euros technology from TNO and CERN.
from private investors. "The success of the first cohort proves Eindhoven is all about
• Dynaxion [14] team members have been to the USA deep tech", Frericks said. “But it’s the quality of putting
twice as finalists of the Opioid Detection Challenge, the network and the local region in motion behind these
funded by the Department of Homeland Security, U.S. propositions.”
Postal Inspection Service and U.S. Customs and Border Deep-tech venture building is the right idea in the right place
Protection. They also received $100,000 as part of this at the right time.
effort. “And of course, a bit of luck.”
Dynaxion uses CERN’s small particle accelerator to scan (191194-01)
packages and freight at the atomic level, helping to stop
the shipment of drugs and other illicit materials.

HighTechXL team members introduce themselves to the new cohort of deep-tech ventures as they embark on the nine-month venture building program.

[4] https://driveamber.com/en/ [10] https://driveulu.com/en


Web Links
[5] www.bambi-medical.com/ [11] https://home.cern/
[1] www.hightechxl.com/
[6] www.3dbyflow.com/ [12] www.incooling.com/
[2] https://accerion.tech/
[7] www.lifesense-group.com/ [13] https://www.ces.tech/
[3] https://accerion.tech/news/ac-
cerion-closes-series-a-invest- [8] https://manus-vr.com/ [14] https://dynaxion.nl/
ment-plans-major-expansion/ [9] www.sustonable.com/ [15] www.aircision.com/

70 March & April 2020 www.elektormagazine.com Sponsored Content

191194 EN Start-Up Zone.indd 70 06/02/2020 09:25


REVIEW
The Enviro+ RPi-HAT
Measure air quality
with a Raspberry Pi and the Enviro+ HAT
By Dr Thomas Scherer (Germany)

Building a small weather station to take


measurements of the main environmental variables
could hardly be simpler; grab an off-the-shelf
microcontroller board and plug in an expansion
board with all the necessary sensors on-board.
Choosing an Raspberry Pi (RPi) significantly
simplifies the design, add a HAT like the Enviro+
from Pimoroni and you already have all the sensors
you need to get the job done.

Nowadays you don’t need to start from scratch with a handful the web and appropriate (Python) libraries are available to
of discrete components to build a unit for recording important handle sensor interfacing.
environmental variables. Just grab a suitable µC board, add
some sort of shield or expansion board with all the appropri- The Enviro+
ate sensors and the only brain work left to do is to write the As you can see the Enviro+ [1], is a small HAT in the same
code to handle measurement data coming in from the sensors. form factor as the Raspberry Pi Zero W [2] and has all the
If you want extra features, such as an on-board WiFi link, sensors needed for the job. It uses the standard 40-pin GPIO
etc., then a good extension header, which means it can be used with almost all
choice for the control- of the RPi models.
ler board would be a The HAT board (Figure 1) comes in a small antistatic bag with
Raspberry Pi which a sticker surrounded with some packing material - nothing else.
is quite cheap and In an effort to cut down on wastage no paperwork is included,
has a lot of power on not even a small slip of paper. All documentation is available
tap to handle almost online but you first need to be directed to the correct address…
any application you You can enter the address provided by hand but in the age of
have in mind. The the ubiquitous smartphone, it would be more convenient if the
added benefit for URL pointing to the documentation could be accessed via a
any developer is that QR code or something similar. The barcode does not actually
there are a range of contain a link. It would also have been nice if the printed URL
ready-made plug-in had been run through a URL shortener so that you didn’t have
boards in the form such a long address to type. Lastly it would have been even
of HATs (Hardware nicer if the URL provided actually pointed to a useful website
Attached on instead of provoking an ‘HTTP / 1.0 404 Not Found’ response.
Top) that bring a Sarcasm, of which I am guilty, is the lowest form of wit but
smorgasbord of this simple error should surely have been ironed out a long
different sensors time before the kit hit the shelves.
to the setup. The
popularity of this Key features
platform ensures The Enviro+ HAT is equipped with the following electronics:
that lots of • BME280, sensor for temperature, air pressure and air
B in a ba g. coding examples humidity [3]
package: a PC
Figure 1. The can be found on • LTR-559, light and proximity sensor [4]

www.elektormagazine.com March & April 2020 71

191248 EN Review RPi-HAT Enviro.indd 71 06/02/2020 09:27


• MICS6814, analogue gas sensor [5]
• ADS1015, A/D converter [6]
• SPH0645LM4H-B, MEMS microphone
[7]
• 0.96“ OLED colour 160 × 80 pixel
display
• Connection for an optional particu-
late-matter air sensor type PMS5003
[8]

Figure 2. Together with an RPi Zero W it makes Figure 3. With an RPi 3 or 4, the lid needs to be
Plug in
a neat assembly. left off if the board is built into an opaque or
Connecting the board to the Raspberry metal housing.
Pi couldn’t be simpler; take it out of the
bag and plug it onto the 40-way header
connector on the RPi — done and dusted.
Well almost…
If you are using it with an RPi Zero W,
then you just need to plug it together
(with suitable spacers) to produce a
beautifully compact module (Figure 2).
The complete assembly can then be
installed in a small housing. The standard
type of case is less than ideal because
there needs to be provision for air circu-
lation otherwise sensor measurements
will be inaccurate. If you intend to take Figure 4. A piece of insulating tape on the Figure 5. The Enviro+ with added tape on an
light level measurements a transparent bottom of the Enviro+ prevents short circuits. RPi 3B+.
or lidless housing will also be necessary.
Since Enviro+ fits on a standard RPi, I
chose to pair it up with RPi 3B+ that just
happened to be sitting around on my
bench collecting dust. It quickly became obvious I would need pads where you can access a few of the relevant signals.
to leave the cover of the aluminum housing open (Figure 3)
so that enough air and light can get to the sensors on the Documentation and a few examples
Enviro+ HAT. Extensive documentation for the board is available on the
You can see that some of the chips on my RPi3B+ have been Pimoroni website [9], just ignore the faulty link printed on the
fitted with heat sinks. The larger one on the SoC in particu- bag. It is very well put together and also provides basic informa-
lar can cause issues with some types of HATs - including the tion about the sensors and how their values can ​​ be interpreted.
Enviro+. As a precaution, you will need to insulate the small It is particularly good that there are also links to instructions
PCB with a piece of tape (Figure 4) so ​​that no short circuits explaining how to easily install the basic RPi, which will be very
are created when you plug it on to the RPi. helpful for many beginners. It shows how, with the help of a
Now the Enviro+ can be plugged into the 40-pin RPi header few terminal commands you can install the additional software
(Figure 5). This header is not the only way to connect to signals for Enviro+ including the Python library and some ‘Examples’.
on the board; the front edge of the board has some labelled It’s quick and easy to get the examples running. Figures 6

Links and literature


[1] Enviro+: www.elektor.com/enviro-environmental-monitoring-station-for-rpi
[2] RPi Zero W: www.elektor.com/raspberry-pi-zero-wh-with-pre-mounted-header
[3] BME280: https://ae-bst.resource.bosch.com/media/_tech/media/datasheets/BST-BME280-DS002.pdf
[4] LTR-559: http://optoelectronics.liteon.com/upload/download/ds86-2013-0003/ltr-559als-01_ds_v1.pdf
[5] MICS6814: www.sgxsensortech.com/content/uploads/2015/02/1143_Datasheet-MiCS-6814-rev-8.pdf
[6] ADS1015: www.ti.com/lit/ds/symlink/ads1015.pdf
[7] SPH0645LM4H-B: https://media.digikey.com/pdf/Data%20Sheets/Knowles%20Acoustics%20PDFs/SPH0645LM4H-B.pdf
[8] PMS5003: http://www.aqmd.gov/docs/default-source/aq-spec/resources-page/plantower-pms5003-manual_v2-3.pdf
[9] Getting Started: https://learn.pimoroni.com/tutorial/sandyj/getting-started-with-enviro-plus
[10] Air Quality Station: https://learn.pimoroni.com/tutorial/sandyj/enviro-plus-and-luftdaten-air-quality-station

72 March & April 2020 www.elektormagazine.com

191248 EN Review RPi-HAT Enviro.indd 72 06/02/2020 09:27


Figure 6. Output of temperature, air pressure and humidity, measured by Figure 7. Another example compensates for the heat from the RPi and
the BME sensor. The RPi’s SoC heats up the sensor quite a bit. outputs a more realistic air temperature reading.

Figure 8. This example with the light and proximity sensor outputs the Figure 9. The gas sensor actually consists of three sensors to detect
lighting in lux - the output did not react to proximity. different air components. The output in Ohms is unusual and would need
to be converted.

through 9 show the screen output from four of these examples.


The small in-built OLED display (Figure 10) is particularly
helpful if the system is deployed in the field and you want to
quickly check system status or measured values on site.

To sum up
The Enviro+ provides all you need to build an inexpensive
weather station for collecting measurements of environmental
conditions. Thanks to the Python library routines, reading the Figure 10. The display can be used to show any content. Python functions
sensors etc. is fairly easy. The examples provided, consisting are also available for this.
of a few lines of code, help with this greatly so you can tinker
with the code to make the system behave as you would like.
That’s not all; on the Pimoroni website you can find complete
building instructions for an air-quality measurement station
[10] with connection to the cloud ‘luftdaten.info’. Its no
surprise there are so many of these stations registered to
users in my country. IM ELEKTOR-STORE
All in all, I would say this is a very useful bit of kit.
ªEnviro+ (Environmental Monitoring Station for RPi)
191248-03
www.elektor.de/18975

www.elektormagazine.com March & April 2020 73

191248 EN Review RPi-HAT Enviro.indd 73 06/02/2020 09:27


Steeped in Electronics
ordering components from Ukraine and Russia
By Ilse Joostens (Belgium)

Sometimes, when in a nostalgic mood, I have melancholic thoughts about the time when you could cheerfully
ride your bike to the electronics shop on the corner to buy parts for a small project. In the past everything
was better, it is sometimes said, but the hard reality back then was nevertheless a little less rosy. How
often have I defied atrocious weather and strong headwinds only to return home bitterly disappointed.
Unfortunately the electronics retail business is as good as dead and ordering online is now the norm. These
days (out of necessity) I order everything from any of the well-known ’wholesalers’.

For the more exotic components, the supplier from a friendly horror films and my occasionally miserable geographic knowledge).
neighbouring country is often inadequate and sourcing from Packages from the former Eastern Block generally have a
some distant country becomes the only option. This is also characteristic and recognisable appearance and every individual
true for the better glassware that’s still readily available from vendor also has their own style. Here follows a brief summary
mainly Russia and the Ukraine. Buying components from the of the common characteristics:
former Eastern Block has its charms but there are also traps...
The Latin expression caveat emptor is here more relevant than • a drab and grubby general appearance;
ever (and yes indeed, I had to look that up). • the use of twine;
• cardboard box wrapped in grey or brown paper, or dented
Russian packaging techniques — an introduction packages made from thin, weak cardboard, taped with
So, around 2007 I built my first nixie clock, using IN-14 tubes. colourless packing tape;
That was still a hobby back then, but for one reason or another • decorated with an excessive number of postage stamps,
I’m currently still busy with nixie tubes and other vintage often also neatly cancelled by the local post office
components. To be honest, this business runs quite well when (occupational therapy);
compared to other electronics stuff. • sheets of foam or foil, polystyrene foam, newspaper or
Over the years I’ve got to know quite a few of the vendors of plastic bags as filler material;
these little tubes on eBay. Most of these reside in the Ukraine or • contains strange notes with incomprehensible Cyrillic
Russia, but I have also done business with vendors in Bulgaria, scribbles;
Romania and Moldavia (the latter country always makes me think • reused boxes of consumer products, mostly toiletries for
automatically of Count Dracula; I blame that on my addiction to ladies, but also toys, coffee pods and even paint.

Neatly packaged in foam sheet. Creative reuse of old boxes.

74 March & April 2020 www.elektormagazine.com

191266 EN Tips and Tricks.indd 74 06/02/2020 09:29


 
Some vendors carefully pack the tubes in foam sheets, while
others throw everything together in a plastic bag. Occasionally
the contents of the package looks more like a rubbish skip that
you have to rummage through to find the components. Despite
the sometimes insane packaging it all works out fine nine times
out of ten. Every now and then I receive some broken tubes,
and one time was so bad that the delivery van from the post
office was full of glass shards. I’ve also occasionally received
extremely dirty components, just as if they had spent years in
a damp cellar, and one time the tubes were completely worn
out. In most cases you can get redress from the vendor and get
your money back. But it is nevertheless annoying, of course,
and in all these years I have never been actually defrauded.
If you are buying tubes in quantity, then you should take into
account that potentially some ten percent will be unusable.
That is just simply the nature of vintage components that are
often decades old. These are therefore broken...

Payment
Payment is normally done through PayPal. There are often paid during importation cannot be reconciled properly. Mistakes
restrictions, particularly in Ukraine, on PayPal accounts, so are common and usually to your disadvantage. Complaining
that most vendors have to employ intermediaries such as is pointless because your package is returned to the sender
Western Bid in order to receive money from PayPal. Others quicker than your case will be processed. It is possible to
use foreign accounts, from friends or otherwise. Therefore rectify an incorrect payment after the fact, but only after a
do not be concerned if you receive a PayPal invoice from and payment of 85 euros for a documentation fee — ka-ching! I
unknown person or even from Thailand or Japan. won’t dwell on that one time that I had 180 back-orders because
a package with components was hopelessly stuck at customs.
Customs, your friend and helper Calling and begging is only counter-productive in such cases,
When you buy goods from outside the EU, you generally have because your package will promptly go to the bottom of the
to pay VAT on importation and sometimes also import duties. pile (’where does she get the nerve...’). Strangely enough, I
With shipments via courier services such as DHL, UPS and have never needed to pay anything for packages from China,
FedEx this transaction is normally very straightforward. Courier when received through the normal postal service. It appears
services are prohibitively expensive in the Eastern Block and that they want to encourage trade with China, which is not
most packages are simply sent using air mail. This means that even an EU country.
they (in my case) will be delivered by the Belgian postal service. Belgian governments, if you (n)ever read this, do something
It appears that the Belgian government and its companies are about this! I will use this opportunity to boast that I can
increasingly creative each year when it comes to the subject of also be creative and my packages in the future will be sent
’entrepreneur harassment’. Not only does the customs clearing to the Netherlands. The Dutch postal services are nowhere
period take an extraordinary period of time, count on three to near as difficult...
four weeks but the necessary documents to account for the 191266-04
costs in your bookkeeping are usually missing so that the VAT

Clearly labelled. Food for philatelists.

www.elektormagazine.com March & April 2020 75

191266 EN Tips and Tricks.indd 75 06/02/2020 09:29


Review:
Andonstar AD407
Better than its predecessor?
By Luc Lemmens (Elektor Labs)

For some time now, cheap USB devices have been available that are pitched as ‘microscopes’, but the early
models were really too flimsy for practical use in the electronics lab, while the focus distance was generally
too small to be able to solder under it. So for that fine-pitch soldering work (SMD) you needed to make do
with a magnifying glass (lamp) or reading glasses - sadly, other optical aids were either unusable or not
affordable.

In terms of implementation and price, this new microscope is


closest to its predecessor, the ADSM302, and for this reason the
characteristics and specifications of the AD407 are compared
to this model and the other models are not considered here.

Image display and storage


When you put the two microscopes side-by-side (Figure 1),
the difference in screen size is immediately obvious. The screen
diagonal for the LCD of the new model is more than 5 cm (2")
bigger, which is an enormous improvement. While in most
cases it was reasonably comfortable to work with the 5” screen
of the older model, in our lab we nevertheless connected an
external 10” monitor via HDMI for the more detailed fine work.
When it comes to the image quality, the limited documen-
tation from Andonstar is somewhat vague. According to the
manufacturer, the AD407 has a 4-megapixel sensor, while the
ADSM302 doesn’t get any further than 3 megapixels.
According to the specifications, both microscopes offer a photo-
Figure 1. The Andonstar AD407 (right) next to its (slightly) smaller graphic resolution of 12 megapixels (4032 x 3024), and these
sibling. values also show up when you open the photos (JPEG files)
on a PC. Apparently extra pixels are added, where you would
expect that the image quality of the new Andonstar is better
than that of the older one. To make the choice even more diffi-
For me, the first time I saw one that started to look like it cult: the old one has a digital zoom up to 4x, while the new one
could actually be useful, was when the Andonstar A1 arrived doesn’t get any further than 3x. When it comes to the ability
on my workbench. Finally. an affordable and reasonably stable to display details, the difference isn’t that great, but the image
microscope you can connect to a PC via USB, so that you from the AD407 is clearly sharper.
could manipulate and inspect your circuit boards and solder- Concerning the video output via HDMI, the older one clearly has
ing workmanship. Quite quickly this manufacturer followed to concede superiority to its successor, both in terms of resolu-
up with models with a built-in LCD, which removed the neces- tion and frame rate. Now I don’t think this is very important
sity (partially) of a connection to a computer: an enormous for the types of jobs we do here, but these specs are of course
improvement. With every new addition to the Andonstar family important when you want to do presentations or demonstra-
that has appered since, a few things got changed, added and tions using a large screen.
improved – you would expect that by now a point has been With the AD407 there is no longer the option of transferring
reached at which a new model is little more than ‘more of the the image to a computer via USB, which I certainly do not
same’. There are already four different models in the Elektor experience as a shortcoming. With the large LCD and the HDMI
Store, and there is now the next version: the Andonstar AD407. output you do no longer need USB for a real-time image display
What changes has the manufacturer made that justifies the — and in any case this didn’t always work all that smoothly
existence of number five? with the older models from Andonstar. And if you want to keep

76 March & April 2020 www.elektormagazine.com

191154 EN Review Andonstar AD407.indd 76 06/02/2020 09:32


Figure 2. It’s also possible to look at objects ‘from the side’. Figure 3. The cable will last longer thanks to the right-angle USB plug.

the images, you can store photos and/or videos on a micro-SD Both microscopes are supplied with an infra-red remote control,
card, and subsequently process them further on a computer. that in my experience is only useful when you want to take
pictures and want to prevent the image from shifting or blurring.
Stand What is experience? I have only handled the microscope when
Both microscopes have a sturdy, robust stand about which there unpacking and writing this review. In normal use of the micro-
is little to say. For the illumination of objects they are provided scope (and in our lab that means ‘soldering and/or checking of
with two LED spotlights on flexible arms, and while these do solder joints’) the remote has no additional value, in my opinion.
provide light, they also are, in my experience, ‘always’ in the Furthermore, the AD407 contains a hex wrench for assem-
way or in the wrong location. When you want to work under bling the stand and – according to the manual — a UV filter.
the microscope, your hands or tools interfere with the lights The latter was missing from the microscope that I received
or you block the light so that you cannot see properly what for this review, but to be honest, I cannot immediately think
you are doing. Directing the spotlights is not that easy either, of an application for it.
because they spring back when you release them. It actually Then remains the question: if you already have an older
puzzles me why Andonstar persists with this system: a ring Andonstar model, would you consider the purchase of the
of LEDs around the lens is, in my experience, much better in new AD407? With the A1, V160 and ADSM201 my answer will
all aspects. be a resounding ‘yes’, but in the case of the ADSM302 I’m a
The stands for the ADSM302 and the AD407 exhibit considerable little more reserved.
differences from a mechanical perspective that – depending on It is quite handy to be able to inspect an object from an angle,
the objects you want to examine – can be decisive when you but: you do not necessarily need such a stand for that (you
have to make a choice. Firstly, the great advantage of the stand can also place the object at an angle). The large LC display of
for the ADSM302: the maximum object distance (that is, the the new model finally turns it into a real stand-alone micro-
distance between object and lens) is about 12 cm, while with scope. As already mentioned, in the Elektor lab we usea (small)
the new stand the lens doesn’t reach more than 8 cm above additional monitor next to the ADSM302 in many cases, but with
the object table. With a little bit of improvisation a solution the AD407 this additional clutter on the work bench becomes
can certainly be found for this, but during ‘normal use’ the unnecessary. To me, that’s more than sufficient reason to give a
new version is a little less capable than its predecessor. On the clear preference to the new Andonstar, if I were to make a new
other hand, the AD407 has a neat feature that could be very purchase. And if I already had an ADSM302, and the budget
handy: you can tilt the entire stand on an angle (Figure 2) so permitting, then I would certainly replace it with an AD407.
that you can also examine solder connections from the side. A (191154-04)
useful option that is missing from its predecessor.

Accessories
Just as the ADSM302, the AD407 is supplied with a power supply
and a cable with a jack for the light source and a micro-USB
plug for the power supply for the microscope itself. There is a
@ WWW.ELEKTOR.COM
small improvement here too: the USB connection now has a ªAndonstar AD407 HDMI Digital Microscope
right-angle plug, with the result that the power supply cable is with 7” LCD Screen
less likely to break, a fault that tends to appear with the older www.elektor.com/19079
models after a period of time (Figure 3).

www.elektormagazine.com March & April 2020 77

191154 EN Review Andonstar AD407.indd 77 06/02/2020 09:32


Lab, Sweet Lab
A glimpse of The Holy Place —
no unauthorized entry.

By Eric Bogers (Elektor Netherlands)

Back in July 2019, Elektor


hosted a competition on
the Labs website in order
to find out who has the
nicest/unattractive/
interesting/most curious
home laboratory. In
this second episode,
we present the
winner: Philippe
Demerliac.

Figure 1. The winning photo.

Philippe (or Cyrob, as he is known to confreres) writes: I want to be able to repair or improve them, and design new
ones myself.”
“My dad worked for a big electronics firm and he gave me “In the 1980s I bought a farm south of Nantes, not far from
some used equipment. That was the beginning of my love of the Atlantic coast, because my wife breeds horses and there-
measurement instruments — I want to know how they work, fore needs space.”

78 March & April 2020 www.elektormagazine.com

191265 EN Lab Sweet Lab.indd 78 06/02/2020 09:33


Figure 2. In the beginning, the lab was without form, and void... Figure 3. Workbench and console.

“For many years I actually had very little equipment — a waveform generator.”
Tektronix 2225 oscilloscope, a homebuilt power supply and “It won’t surprise you that my biggest concern again is lack
a ditto generator and so on; I guess most of us are familiar of space; I have to control myself (or try to push those thick
with that.” walls out...) because of course there has to be some space
“In 2004, I decided to expand my small home lab a bit; I opted left for parts and such.”
for an unused pigpen with 80 cm thick walls. I isolated the floor “Feel free to contact me for more information on info@cyrob.
and covered the walls with plastic panels.” org. And of course you are very welcome on my website [1]
“Then came the workbench with a lot of plug boxes, plus a and on my YouTube channel [2]”.
console for my servers and CCTV system.” (191265-03)
“My lab has three independent power circuits: one for light-
ing only (so I don’t sit in the dark when a fuse blows), one
that I turn off when I leave the lab (so the equipment doesn’t
remain live), and one that stays permanently (for alarms,
servers and the like).”
“My lab is well insulated and is heated with a few electric
Web Links
radiators. An electric ’humidifier’ prevents the whole thing
from getting damp.” [1] Philippe Demerliac’s Website: www.cyrob.org
“I own a lot of equipment - a lot more than I need, but that’s [2] Philippe Demerliac’s YouTube channel
because I’m also a collector. But not only is there ’old’ stuff in www.youtube.com/c/PhilippeDemerliac_Cyrob
my lab, I also have modern equipment like a fantastic AFG31000

Figure 4. Servers and CCTV system. Figure 5. A great generator...

www.elektormagazine.com March & April 2020 79

191265 EN Lab Sweet Lab.indd 79 06/02/2020 09:33


HOMELAB PROJECT

Optical Probe
for Oscilloscopes
Measure brightness fluctuations of lighting systems

By Alfred Rosenkränzer (Germany)

Do you want to measure not only electrical signals but also optical signals? Then you need an optical probe
that converts light intensity into voltage fluctuations that can be evaluated by an oscilloscope. This article
shows how to build such a probe yourself inexpensively.

You may remember this story about the (100 Hz) and the switching frequency of ing retrofit LED lamps. Although the noise
problems with LED lamps, which was their switching power supply. levels emitted by them were very low,
published as an article Electromagnetic they flickered noticeably at the mains
Interference from LED Lamps in Elektor’s Flickering frequency or a multiple of it.
March & April 2018 edition. During my At that time I built a prototype of an Everyone could easily notice this for
EMC measurements for this article I optical probe on a breadboard. A while themselves, as the LC displays of our
also checked the brightness variations later, the fluorescent lamps in our office telephones suddenly seemed to
of lamps with double mains frequency open-plan office were replaced by match- flicker. The reason was an interference
of the lamp flickering with the display
refresh rate. Most digital cameras also
show such interference between lamp
+12V
IC1
78L12
flicker and the refresh rate of the sensor
+15...24V
1 3 (and the screen).
As the lamp flicker spread to more and
D1
6k8

2
MBR0540 R1
more areas, I wanted to get to the
C1 C4 C5 C6 D3 C8
bottom of this new phenomenon of
10µ
35V
100n 10µ
25V
10µ
25V
MBR0540 100n LED1 modern lighting. This was motivation
0V 8

IC3
enough to make a more sophisticated
C2 C7 4 version with PCB, housing and cable
10µ C3 10µ D4 C9
R2
connection out of the flying construc-
6k8

35V 100n 25V MBR0540 100n

tion of the optical probe.


D2 1 LED2
-15...24V MBR0540
2 3 The circuit
The circuitry of the probe (Figure 1) is
IC2
79L12 super-simplified: the conversion of light
-12V
into an electrical signal is done by the
K R4
5
photodiode D5 (in my case a BPW34, but
10k R7
7
50 other typ also do it) together with the
6 IC3B
D5 2 TL072D opamp IC3a. The voltage thus generated
1M

R3
BPW34 (optional) 1
is amplified tenfold by another opamp
10k

A
3 IC3A
TL072D R6 (IC3b). The 50-Ω resistor R7 is used for
impedance matching to the coaxial cable
1k1

R5

connected to the output.


180710-003-94 KD
IC3 is a dual opamp variant in the SO8
package, which allows the use of other
Figure 1: Circuit diagram of the optical probe. types than those specified. The fast

80 March & April 2020 www.elektormagazine.com

180710 EN Optical Probe for Oscilloscopes.indd 80 06/02/2020 09:34


Figure 2: The layout of the scanner board including power supply. Figure 3: My optical probe with milled circuit board. In the front you can
see the photodiode.

and low-noise TL072 used here has the


benefit of extra high impedance FET
inputs. The resistor R3 in parallel to the
photodiode is optional and not populated
here.
The photodiode and the opamps must
also be powered. This is done by a
symmetrical and stabilized voltage of
±12 V, which is provided by two linear
voltage regulators types 78L12 and
79L12. For IC1 and IC2 the leaded
version was chosen to allow a wider
choice. If the opamps can handle it,
you can also use versions with an output
voltage of 5, 8, 9 or 15 V. The input
voltages must be at least 3 V higher. D1
and D2 on the inputs serve as reverse
polarity protection, while D3 and D4
prevent the positive voltage from becom-
ing negative and the negative voltage
from becoming positive when switching Figure 4: Oscillogram of the 100-Hz ripple of light, superimposed with higher frequency
on or off. LED1 and LED2 indicate the components.
presence of the operating voltages.

Layout be examined perfectly. The cable does half-wave. The current is easily ’scoped
The double--sided circuit board (Figure◦2) not need to be terminated input of the as a voltage drop on the series resistor.
has been designed to fit into a housing ’scope with 50 Ω for these frequencies. At The result is a pulsating light with adjust-
reminiscent of a USB stick, which has also high amplitudes most opamps would be able minimum and maximum brightness.
proven itself for other self-made probes. overstrained with a termination, because If your generator is of a simpler nature,
The vias are positioned in such a way the typical maximum 20 mA results in for simplicity’s sake a square wave
that the board can also be produced with just 1 V across 50 Ω. voltage will also do. With sine or trian-
a circuit board plotter. The through-hole The function test can be easily performed gular voltage interesting clipped curves
vias must then of course be assembled using an LED, which is fed directly from are obtained. It goes without saying that
manually and soldered on top and bottom. a function generator. A suitable series the LED must illuminate the photodiode.
resistor should be used for low imped- The polarity of the output signal can be
The finished probe ance outputs. If not only the amplitude reversed by turning the photodiode. On
Figure 3 shows my fully assembled of the AC voltage but also the offset has the Elektor website for this article [1] you
optical probe. Using the BPW34 photo- to be set on the function generator used, can find layout files of the circuit board
diode and a TL072 I got a frequency then the offset and amplitude can be in Eagle format and a video that clearly
response of several 100 kHz. This is set so that the maximum current of the shows the interference of flickering LED
adequate to view not only the mains LED (typically 20 mA) is not exceeded illumination with the camera sensor.
frequency (or its double frequency), and that a very small current (<1 mA) 180710-02
but even to be able to measure the flows through the LED at the negative
high-frequency brightness variations
(Figure 4), which result from the ripple
of the switching power supply of some Web Link
LED lamps (typically 30-60 kHz). Also [1] Video, CAD data: www.elektormagazine.com/180710-02
the flickering of dimmed LED lamps can

www.elektormagazine.com March & April 2020 81

180710 EN Optical Probe for Oscilloscopes.indd 81 06/02/2020 09:34


student demonstration time

The ‘TABULA‘ Project - An Update


Tangibles with user feedback
By Christian Cherek, Chair of Computer Science 10 (Media Information and Human-Computer Interaction) at RWTH Aachen

The TABULA project at RWTH Aachen University has made


further progress in the last two years. The hardware of the
Tangibles now seems to be perfect to cope with the various
tasks of different apps, including feedback by buzzer and RGB
LEDs. From now on the main focus is on the development of
(learning) programs for all conceivable areas of application.

In the September & October 2017 edi- support the software of


tion we presented an interesting research the table. These include
project of the Rheinisch-Westfälische a Tangible that sends a
Technische Hochschule (RWTH) in regular presence signal to
Aachen, Germany, supported by Elektor. the system via Bluetooth
The ’TABULA’ project is based on objects when it is on the table. In addi-
that can be touched, so-called Tangibles, tion, the surface of the touch table
which can be placed and moved on a sends flashes of light to the detected tan- are used for user feedback. They can be
large capacitive multi-touch surface [1]. gibles, which detect this signal by light extended to the top of the housing by
The system should be able to determine sensor. This is the only way to ensure light channels made of fluorescent acrylic
at any time where on the surface each individual identification. glass that scatter the light. If four LEDs
individual Tangible is located and pass are used at the same time, the proba-
this information on to the attached com- New features bility of covering the complete feedback
puter. The fact that this use of capacitive In the last two years, the hardware and by hand is low.
touch recognition is not just an academic software has been developed further. An The buzzer and vibration motor also pro-
gimmick is proven by the lively interest important innovation is the feedback for vide feedback for the user. The three
of potential users: the range of appli- the users. This is shown by a look at feedback variants (and even the four
cations extends from computer science the not quite finished circuit board of LEDs) can be addressed individually. In
education to music production and learn- the „new“ Tangible in the title picture. this way, different modes can be tried out
ing simulation. In the project we found that especially or different things can be output depend-
introverted, insecure people withdraw ing on the application. The motor and
Recapping from learning games faster and longer the buzzer can also be adjusted in inten-
The most important functions and prop- if they make a mistake than more open, sity and simple patterns/melodies can
erties of the Tangibles are briefly reca- confident people [3]. Through different be played. This way the tangibles can
pitulated. The Tangibles have electri- channels the feedback can be adapted attract more attention both when a user
cally conductive, individually arranged individually, allowing a person making a holds them and when they are simply
„marker feet“, which make the objects mistake not to fear that he or she will be placed on the table. This also supports
distinguishable for the touch table in this „ridiculed“ in public and hopefully partic- the cooperation of the users at the table,
way. However, reliable recognition is any- ipate in the learning process again more because they notice faster what is going
thing but trivial, as described in detail in quickly. on with the other users [5].
the Elektor article of 2017 [2]. In order to enable a variable haptic feed- An LED (D4) has also been added on
In certain arrangements on the table, or back, we added some LEDs, a buzzer and the underside of the board, towards the
if the tangibles are too close together, the a vibration motor on the top of the board touch table. It is directly controlled by
marker feet are not sufficient to clearly (Figure 1). The four NeoPixel RGB LEDs the controller and lights up when the
distinguish the Tangibles. Therefore, D5-D8 [4] distributed along the middle Tangible is switched on. The new micro-
hardware measures must be taken to of the four board edges on the top side USB socket can also be used to charge

82 March & April 2020 www.elektormagazine.com

190100 EN Student Demonstration Time.indd 82 06/02/2020 09:36


+3V3

+3V3 +3V3 4 18 20
J2 C4
+5V 12 VCC AVCC AREF 100n
USB_B_Mini PB0
13
AVR-ISP-6 PB1
1 1 4 2 14 ATmega88 - 20AU
PB2
3 EN V+ VCC 15
D+ N2 PB3
4 R3 1 16
ID H2 X2 MISO PB4
VBUS +3V3
GND antenna +3V3 20MHz U5 MOSI
3 17
PB5
10k

3 4 19
OUT SCK R6 ADC6
5 22
GND RST ADC7

330
6 GND
SHIELD 2
D- 2 6
7 XTAL1/PB6
GND
T3 R9 R7 8
5 XTAL2/PB7

540k

47k
NPN photo transistor 3V3 D4
LED 23
12 4 U5A PC0
2 GN 24
+BATT +3V3 14 MCP6569 PC1
25
1 13 PC2
TLV70233 (SOT23-5) R11 3 1 26
PC3
2 P2 3V3 4 27
100k

1 3 5 U5D 11 PC4
P3 10k 3 28
IN EN OUT MCP6569 PC5
3 100k J6 2 29
C2 C3 RESET/PC6
U3 R10 R8 TWI 1

540k

47k
10µ GND 100n
3V3 4 30
2 PD0
3 31 PD1
J7 2 32
COM PD2
1

+BATT +5V +5V 3V3


J3 R4 +BATT 3 1
PD3
J8
power switch

3 D8 D7 D6 D5 2
330

2 1
MCP73831-2-0T D2 5 3 5 3 5 3 5 3
1 3 4 more LEDs
VDD VCC VDD VCC VDD VCC VDD VCC
VBAT

VDD

J4 1 2 1 2 1 2 1 2 2
1 LED DOUT DIN DOUT DIN DOUT DIN DOUT DIN PD4
conn_Lipo

2 STAT OG 9
PD5
1 U2 D3 VSS VSS VSS VSS 10
PD6
6 WS2812 6 WS2812 6 WS2812 6 WS2812 11
PROG VSS +BATT PD7 GND +BATT
5 2 LED 3
GN
BZ2
R2 R5
M
330
5k6

M2
Buzzer DC motor C6
100n
C5
100n
T2B T2A
IRF7309|PBF IRF7309|PBF
Figure 1: The final circuit diagram of a Tangible. 190100-004-94 KD

the Tangible in the new housing. There First applications with feedback tions NOT, AND, OR, NAND, NOR or XOR
is charging electronics for a LiPo bat- In Dem 1 (a basic version of this app and thus assembled to digital circuits. In
tery and a slide switch to switch between is already finished) regular expressions this app the Tangibles indicate by means
charging and operation. Two further LEDs should be assigned to matching words. of the LEDs whether the node switches
(D2, orange, and D3, red) indicate the The tangibles are used as a tool and feed- or not. Furthermore, it can be indicated
charging/operating mode. The clunky back too. Wrong or correct entries can whether the circuit is currently in edit or
light sensor with its „board peephole“ now be displayed directly on the Tangible. simulation mode, for example, by the RGB
from the first model has given way to a The app is to be modified later and used LEDs lighting red/green during simula-
small SMD variant on the underside of for teaching German in the lower grades tion and white in edit mode. Even if the
the board. (assignment of animal names) and in hardware is finished, there is still a lot to
the upper grades in chemistry classes. do. The next step would be to finance fol-
The new feedback functions can play an With Dem 2 propositional logical circuits low-up research in which the applications
important role in the first TABULA appli- can be designed. The tangibles are pro- can actually be used and tested.
cations (Demonstrator 1 and 2). grammed as gates with the logical func- 190100-02

Web Links
[1] RWTH Aachen: https://hci.rwth-aachen.de/TABULA
[2] TABULA Article: www.elektormagazine.com/160123
[3] Ehlenz et al. The lone wolf dies, the pack survives?:
Analyzing a Computer Science Learning Application on a Multitouch-Tabletop.
Koli Calling ‚18. ACM, New York, NY, USA, Article 4, 8 pages:
https://doi.org/10.1145/3279720.3279724
[4] NeoPixel-LEDs: www.world-semi.com/DownLoadFile/108
[5] Cherek et al. 2018. Tangible Awareness: How Tangibles on Tabletops Influ-
ence Awareness of Each Other‘s Actions. CHI ‚18. ACM, New York, NY, USA,
Paper 298, 7 pages: https://doi.org/10.1145/3173574.3173872

www.elektormagazine.com March & April 2020 83

190100 EN Student Demonstration Time.indd 83 06/02/2020 09:36


How-To Calculate the Prospective
Short-Circuit Current or PSCC
and choose the proper circuit breaker

By Clemens Valens (Elektor Labs)

The prospective short-circuit current (PSCC) is the maximum current that can flow through a shorted
electrical circuit. The PSCC value is needed for selecting devices like circuit breakers and fuses to prevent
damage such circuits. So how does this work?

Before we go any further, let’s make clear that this article covers What about the trip current?
electrical engineering, not electronics. So, when a ’circuit’ is The breaking capacity of a circuit breaker is not the same thing
mentioned here, it refers to an electrical supply circuit connect- as its trip current. The latter is the maximum current a circuit
ing lamps, switches, power outlets, and machines, including breaker ’considers’ safe to pass; the breaking current on the
all wiring. other hand is the current the device can withstand without
getting damaged. For instance, the type SN201 L C32-L 1+N
What is the PSCC? pole miniature circuit breaker (MCB) from ABB has a rated
The prospective short-circuit current or PSCC is the maximum trip current (In) of 32 A and a rated short-circuit current (Icn)
current that can flow through a shorted electrical circuit. It is of 4.5 kA (at 230 / 400 VAC). This is because the short-circuit
also known as ’available fault current’ or ’short-circuit making current depends on the capacity of the power source and is
current’, and, as with any current, it conforms to Ohm’s Law. unrelated to the current drawn by the load protected by the
Therefore, the circuit’s supply voltage and its impedance circuit breaker.
together determine the PSCC value we crave to know.
Measuring the PSCC
Why would I want to know the PSCC? You can measure the PSCC of an electrical installation with a
To select devices like circuit breakers and fuses that will effec- PSC Tester. This is an easy-to-operate instrument that calcu-
tively protect an electrical installation, you need the PSCC lates the PSCC value of a circuit in ampères (A) and kiloampères
value. Such protective devices must be able to sustain the (kA). Although pressing the ’Test’ button is usually enough
PSCC to provide a reliable protection. If the breaking capacity to obtain a value, connecting the instrument properly to the
or interrupting rating of the protective device is too low, the system requires knowledge of what you are trying to measure.
PSCC may destroy it or cause an electric arc (Figure 1). In Generally, a PSCC test is conducted at the distribution board
either case, the breaking device may not operate correctly, between phase (P) and neutral (N). In the case of a power
and dangerous situations may arise. outlet using the moulded test cable supplied with the tester,

84 March & April 2020 www.elektormagazine.com

191160 EN HOW-TO.indd 84 06/02/2020 09:37


Table 1. Loop resistance measurement characteristics
of the PeakTech 2715.
Full-scale
Range Resolution Test Period
Accuracy
20 Ω 0.01 Ω 25 A / 20 ms ±2% of F.S. ±5 d
200 Ω 0.1 Ω 2.3 A / 40 ms ±2% of F.S. ±5 d
2000 Ω 1 Ω 15 mA / 280 ms ±2% of F.S. ±5 d

Table 2. Prospective short current measurement


characteristics of the PeakTech 2715.
Full-scale
Range Resolution Test Time
Accuracy
200 A 0.1 A 2.3 A / 40 ms ±2% of F.S. ±5 d
2 kA 1 A 25 A / 20 ms ±2% of F.S ±5 d
20 kA 10 A 25 A / 20 ms ±2% of F.S. ±5 d

the test is done between the Phase and Protective Earth (PE; Figure 1: This is what can happen to a miniature circuit breaker (MCB)
E) conductors. Before pressing the ’Test’ button, make sure when it cannot withstand the short-circuit current.
the tester indicates that it is safe to do so.

What does a PSC tester do?


A PSC tester first measures the open-circuit voltage at the
terminals (VS, see Figure 2). Then it applies a small load for
a short time to make a current of a known value flow through
the circuit (IT, Figure 3). With the test current flowing, the
instrument again measures the voltage V at the terminals. Due
to the impedance (ZLN) of the circuit, V will be a bit lower than
VS. That impedance is expessed as
 
ZLN = (VS - V) / IT [Ω] Figure 2: Open-loop voltage measurement (left) & closed-loop short-
  circuit current (right).
By assuming ZLN to be constant, the tester calculates the PSCC
as: VS / ZLN.
The value of the test current depends on the selected measure-
ment range and goes from, say, 2 A, up to 25 A or more. The
duration of the measurement also varies with the range and is
usually in the order of a few tens of milliseconds. see Table 1
and Table 2 for some real-world data from a real PSC Tester.

What is Loop Testing?


PSC testers can also measure the Earth fault loop impedance
ZS or ZE or the prospective fault current PFC (also known as
Figure 3: The PSC Tester causes a test current of a known value to flow to
PEFC). This corresponds to the impedance of the circuit between calculate the circuit’s impedance.
the P and the (P)E conductors in the event of a short between
the two (Figure 4). A low impedance will result in a high fault
current, making a protective device trip quickly. It also helps to
ensure a small potential difference between the (P)E conductor
at the outlet and the earth you are standing on.
When measured at a power outlet, the Earth fault loop imped-
ance is called ZS. When taken at the supply’s entry point, it is
called ZE. As such:
 
ZS = ZE + RL + RE [Ω]
 
with RL and RE the respective impedances of the P and (P) Figure 4: Calculating the prospective earth fault impedance ZS (or ZE) or
E conductors between the supply entry point and the outlet. the Earth fault current P(E)FC.

www.elektormagazine.com March & April 2020 85

191160 EN HOW-TO.indd 85 06/02/2020 09:38


Note that even with a small test current a residual current
device (RCD) may trip when it is sensitive or when there is @ WWW.ELEKTOR.COM
leakage in the circuit under test. To avoid this from happening
ªPeakTech 2715 Digital Loop / PSC Tester
you may want to bypass the RCD temporarily (do not forget
www.elektor.com/peaktech-2715-digital-loop-psc-tester
to restore its connections when done!).

Calculate the PFC


The Earth fault loop impedance is measured in the same way
as the PSCC, but again depending on the selected range, the
test current can be much smaller (as low as tens of milliam-
peres). Also, take the measurement between the phase and
the earth conductors instead of between phase and neutral.
The P(E)FC is obtained by calculating VS / ZLE.

Notes
Depending on the wiring it can happen that the PSCC and P(E)
FC values differ. If this is the case, use the highest value of the
two for specifying a circuit breaker. Web Link
Working on live electrical installations can kill you. We warned
[1] Video: Unboxing and Trying the PeakTech 2715
you.
Loop & PSC Tester: https://youtu.be/9dBhz3acowc
191160-01

Electrical Distribution Network Types


When working with electrical circuits TN networks are common in residential to form a TN-C-S network. They are
or networks you will often encounter and industrial systems in Europe. Such also known as PME (protective multiple
abbreviations like TT, TN or TN-S. a network has a single protective earthing), MEN (multiple earthed
The origins of these are French (in earth (PE) connection at the input or neutral) or MGN (multi-grounded
alphabetical order): generator side to which the consumers neutral) networks.
are connected. In a TN-S network the In a TT network both the generator
• C- ’Combiné’, i.e. Combined; connection is by means of separate and the consumer have their own
• I- ’Isolé’, i.e. Isolated; N and PE wires. This is the safest protective earth connections (e.g. earth
• L- ’Ligne’, i.e. Line; topology. In a TN-C network the PE rods); there is no earth or ground wire
• N- ’Neutre’, i.e. Neutral; and N wires are combined into a single running between them.
• S- ’Séparé’, i.e. Separated; PEN wire. To complicate matters, TN-S Finally, an IT network does not have
• T- ’Terre’, i.e. Earth. and TN-C networks may be combined an earth connection at all.

86 March & April 2020 www.elektormagazine.com

191160 EN HOW-TO.indd 86 06/02/2020 09:38


TMS1000 Series Microcontrollers
Peculiar Parts, the series
By Neil Gruending (Canada)

Microcontrollers are used in many of the electronic devices that we use every day. But the multibillion-dollar
market for microcontrollers had a humble beginning when several LSI chips were condensed into one. Let’s
take a closer look at some of the first commercially available microcontrollers, which were the TMS1000
series from Texas Instruments.

Microprocessors were starting to appear


on the market in the 1970’s as a new way
to implement complex functions without
needing custom engineered logic chips.
They were very powerful for the time,
but they needed a group of chips (RAM,
nonvolatile memory, etc.) which were
expensive. Texas Instruments needed a
much lower cost solution for a new calcu-
lator so in 1971 Gary Boone and Michael
Cochran designed the TMS1802. It was
a breakthrough at the time because
it included all of logic necessary for a Figure 1. TMS1000 computer on a chip. Figure 2. TMS1100 inside a Parker Brothers
Image: Christian Bassow, Wikimedia Commons, Merlin Game. Image: ‘Binarysequence’ - own
four-function calculator into a single chip
CC BY-SA 4.0. https://upload.wikimedia.org/ work, Wikimedia Commons, CC BY-SA 4.0.
except for the keyboard and display. The
wikipedia/commons/d/d1/TI_TMS1000NP_1.jpg https://upload.wikimedia.org/wikipedia/
TMS1802 did all of that with 3000 bits commons/a/ad/Tms1100-merlin.png
of program memory and 128 bits of
random-access memory.
but a register was provided to store quite limiting by modern standards but
It was later in 1974 when Texas Instru- the program counter and carry flag for the TMS1000 series was always intended
ments commercially released the first 1-level deep subroutines. This sounds to be a single-chip system without exter-
TMS1000 series microcontroller nal interfaces like a UART.
which integrated 1024×8 bits of
ROM, 64×4 bits of RAM, a CPU About 100 million TMS1000 series
(the ‘microprocessor’) and clock- parts were produced in approxi-
ing into a single chip. The ROM mately 40 different variations which
wasn’t modifiable so a ROMless were mainly used in consumer
TMS1000 would be used to develop electronics products like calcula-
the program memory which would tors, games and appliances. The
then be used to generate a masked- only way you will find a TMS1000
ROM part for production. This had a series part now is in a piece of
high initial cost, but the production vintage electronics, but they paved
costs were quite low. the way for the modern microcon-
trollers that we all know and love.
All of the data paths in the
TMS1000 parts were 4 bits wide 190383-B-01
with a separate ROM and RAM
data bus like is common in today’s
Harvard Architecture microcontrol-
lers. A 6-bit program counter was
also provided which supported up
to a maximum 2048×8 bits ROM. Figure 3. TMS1000 die. Source: State of the Art, by Stan
The CPU didn’t support interrupts, Augarten. http://smithsonianchips.si.edu/augarten/i38.htm

www.elektormagazine.com March & April 2020 87

190383-B EN Peculiar Parts.indd 87 06/02/2020 09:40


Starting Out
in Electronics (2)
Easier than imagined!
By Eric Bogers (Elektor Netherlands)

There are some hobbies that never require calculation - those who work with paint and brush don’t first have
to work out how green the grass is (which, by the way, always seems to be greener on the other side). This is
very different in electronics: there (accurate) calculation is of the utmost importance to prevent blown parts,
tripped fuses and worse.

Conductance R=U/I
In the previous episode we talked about voltage and current;
now let’s see what cool things we can do with that. And this is (finally!) Ohm’s famous law, which even people who
We all know from experience that certain materials (such as don’t know anything about electronics might have heard of.
metals) conduct an electric current better than others; and
there are also materials that hardly conduct current, or not at Intermezzo
all. In the latter case, we speak of insulators. Glass is a good In daily electronics practice the ohm is a rather small unit,
example, and it may surprise you, but water is also an excellent usually we are dealing with much larger values, for example
insulator (it has to be distilled or better still, doubly distilled 8200 Ω. The farad on the other hand (the unit of capacitance;
water - aqua bidest). we’ll come back to that in a later episode) is again unwieldy.
A quantity has been defined in physics that specifies this In order to avoid having to write and pronounce unwieldy
material property: conductivity or specific conductance. values in full all the time (“here we mount a resistor of eight
thousand two hundred ohms” or (even worse) “here comes a
capacitor of one eighteen-millionth farads”) we use decimal
Conductivity prefixes, the most important of which are summarized in the
There is a nice linear relationship between the voltage across, following table.
and the current through, a conductor, which can be cast in
formula form as follows:

Multiples
κ=I/U
name symbol multiplier

In other words, the quotient of current and voltage is conduc- tera T 1012
tivity — the more current flowing at a given voltage, the better giga G 109
the conductance and the greater the conductivity κ. Conductivity mega M 106
κ is expressed in the unit Siemens (S). kilo k 103
hecto h 102
Resistance
deca d 101
Now, in practice, the voltage is usually numerically greater
Fractions
than the current, so the value of the conductivity will nearly
always be (much) smaller than one. And electricians too are name symbol multiplier
only human beings — they do not like to calculate with very deci d 10–1
small values. centi c 10–2
milli m 10–3
That is why, in practice, they usually calculate with the reverse
micro µ 10–6
of conductivity: resistance. The better a conductor conducts
nano n 10–9
the electric current, the lower its resistance. The resistance R is
pico p 10–12
expressed in the unit ohm (symbol: Ω). The following applies:

88 March & April 2020 www.elektormagazine.com

200003 EN All Beginnings - part 2.indd 88 06/02/2020 09:41


Thus we speak of a resistor of 8.2 kΩ and a capacitor of 18 µF. ous episode, we saw how we can calculate the power converted
Because the Greek uppercase letter omega (Ω) and lower- into heat in the resistor (“is dissipated” quoth the old hand):
case letter mu (µ) are often difficult to find on a standard
keyboard, the decimal prefix is often written instead of the P = U I = U2 / R =
decimal comma; but beware: we only do that when there is
no danger of misunderstanding! So..: 812 V / 2200 Ω = 0.0368 W = 36.8 mW

8200 Ω = 8.2 kΩ = 8k2 or 8kΩ2 That’s not a lot - in our example it was a very modest electric
0.0000000056 F = 5.6 nF = 5n6 or 5nF6 heater. But suppose we had used a 220 Ω resistor - so 10 times
smaller. Then we arrive at a dissipation of 368 mW (ten times as
The electric circuit much) and then it gets interesting. Many electronic circuits use
Now an electric current doesn’t ’just run’: it comes from as small (and cheap) resistors as possible, which are specified
somewhere and it goes somewhere. In the simplest case, the for a (maximum) power of 250 mW (see also the parts lists for
current comes from (the plus pole of) a battery and flows to the DIY projects in this magazine). However, such a resistor
the minus pole of that same battery, creating a closed circuit. would burn up in no time at all, with all the consequences...
In an ’open’ circuit no current can flow!
A last example to conclude. We want to connect a 1000-watt
Note: it is actually the electrons that move in exactly the spotlight to a wall socket using an extension cable. How much
opposite direction; the generally accepted flow direction from current should that cable be able to handle as an absolute
plus to minus that we count on is a legacy from the past, when minimum without setting the place on fire?

+
R U

I
200003-51

Figure 1. Possibly the simplest (closed) circuit imaginable.

electrons were not yet known.


Now let’s look at the most elementary circuit we can imagine: P = UI ž I = P / U =
it consists of nothing more than a battery and a resistor 1000 W / 230 V = 4.35 A
(Figure 1). We see the battery on the left and the resistor on
the right. The connecting wires from the positive pole of the Note: this is not a safety advice.
battery to the top of the resistor and from the bottom of the Next time we will continue with more intricate circuits involv-
resistor to the negative pole of the battery are assumed to be ing resistors.
’ideal’, so they don’t have a resistor (that’s not true in reality (200003-02)
of course), but in simple circuits this assumption is usually not
a problem. Across the resistor is exactly the battery voltage
U, as indicated by the voltage arrow (pointing from the minus
to the plus). In this circuit, a current I flows, which is also
indicated by an arrow (don’t forget: the current with which we
calculate runs from the plus to the minus).
Now (finally!) we are going to do a bit of math. We assume a
9-V battery (like the block/6LR22 type) and a resistor of 2200 Ω
(2kΩ2). The question then is which current flows in the circuit.

R=U/IžI=U/R=
9 V / 2200 Ω = 0.00409 A = 4.09 mA

This ’circuit’ doesn’t do much of course - a current flows through


a resistor. But what happens in that resistor? It becomes hot -
that’s actually the principle of an electric radiator. In the previ-

www.elektormagazine.com March & April 2020 89

200003 EN All Beginnings - part 2.indd 89 06/02/2020 09:41


Developer’s Zone
Tips & Tricks, Best Practices and Other Useful Information
By Clemens Valens (Elektor Labs)

From Idea to Product


The development of our new product is progressing
slowly. Now that we have a working proof of concept
(PoC), the time has come to start creating the design
Part 4
documents for it.

Document your work


The PoC we came up with in the previous
installment was built on one or more breadboards
and / or prototyping PCBs soldered and wired to
a bunch of evaluation and development kits and
boards. There may even be parts hanging on thin It is never too early to
start documenting your
save you trouble later work. Spending some tim
e on it now will
wires. It works, as that was the goal of the exercise,
but it probably looks messy. Continuing to work with
it is both impractical and bound to result in loose contacts and parts falling off. It is therefore primordial to
consolidate it somehow and document your work.

Can you trust your parts?


Libraries of schematic capture tools contain many parts but
Keep the PoC alive for some reason... not the parts you need! Consequently,
Creating a schematic from a PoC is a perilous exercise, you will have to create them yourself. Searching the
especially when the PoC is complex and/or contains Internet may be a quick solution, but can you trust
components that do not exist in the libraries of the clemo12345? Buying them from a commercial schematic/
schematic capture software tool being used for the task. PCB part supplier (yes, they do exist) may be better, but
It is probable that the PoC was based on a prototype will cost money. In any case, you should carefully check
schematic, but it may have evolved since. If it did, then every component before dreaming of relying on it. This is
the changes must be carefully ported back into the also true for standard library parts as libraries may contain
schematic without making mistakes. Since this is a human errors. Note that at this point we are not (yet) talking about
task, Murphy’s Laws apply. For instance, it’s quite easy footprints for printed circuit board (PCB) design — we will
to miscount pins on a fine-pitch package, or to make a come to those later.
typing error. Pay attention when undoing connections or
removing parts to get a better view. Make very sure to redo
everything exactly as it was as the PoC is your reference
design until you have built a better one. It must continue to
work until then and, if possible, even afterwards.

Are the parts you are plan


ning to use really
available today and tom
orrow? Do you know
what they look like? Get
samples so you can
verify footprints and size
s.

90 March & April 2020 www.elektormagazine.com

190369-B EN Developers Zone.indd 90 06/02/2020 09:52


Do not use placeholders
A mistake many people make during schematic capture is more subtle problems may appear when the capture tool
using library parts that have the same function or pins as is used to export the BoM (bill of materials). Placeholder
a placeholder for the desired part. This may speed up the parts often have attributes that do not correspond at all
drawing process, but errors are bound to slip in. A classic to the desired part. Or do they? The time gained by using
mistake is forgetting to set the value of the placeholder placeholders during drawing is now lost because all the
part to the right value. This may be obvious for parts like attributes have to be checked. (Remember, we will deal with
microcontrollers, but less so for, say, connectors. However, footprints later).

Complete and correct


At this point in the electronic product design process, the will generate a correct and complete document. The same
schematic is the main design document. Therefore, it must must be true for the exported netlist. Place comments where
contain as much information as possible and it must be applicable. For instance, if a transistor needs cooling, or a
correct. A good schematic capture tool lets the user specify net carries a high current, add a note so that the information
all sorts of attributes for components and the nets that will not be lost. Remarks about component placement can be
connect them. Use these functions so that exporting the BoM useful too.

Design for production


Besides the costs of the components that make up Supposing it can (at a reasonable cost), how will the product
the product, another important cost factor lurks in be tested? How are programmable components programmed?
manufacturing, i.e. production costs. Can what you have What about hardware options? Test points or, if possible, a
in mind be manufactured? special test connector may be necessary. A test procedure is
needed too. You want testing to be as simple yet as complete
as possible. Maybe the design must be adapted for this?
Maybe the software can handle it? Will it break the PoC? Mark
test values and procedures in the schematic. Don’t forget
assembly (‘board stuffing’) options either.

a machine similar to
bably have to go through
Since your design will pro ble.
they are com pati
this one, better make sure

Design for certification


Depending on the application, your product may have to For instance, EMC measures like shielding and filtering were
obtain certain certificates before it can be commercialized. probably not part of the PoC, but they must show up in the
CE and FCC come to mind, but there are many more. To pass schematic (without breaking the PoC).
certification tests, a design must be prepared from the start.

Version control
It is just not possible to come up with a perfect schematic
right from the beginning. Things will change and evolve
What’s next?
when your knowledge and experience grow. Several The results of the design stage described above are —
iterations will be necessary to get it right. Keep track of besides a nice document for future reference — a bill of
these revisions to avoid making the same mistake again. materials (BoM) and a netlist, both complete and correct.
This is even more important when a design forks into With these documents in hand, you can embark on the
multiple versions. Use unique and clear identifiers for design of a printed circuit board (PCB).
versions and iterations and be consistent. 190369-B-01

www.elektormagazine.com March & April 2020 91

190369-B EN Developers Zone.indd 91 06/02/2020 09:52


Best Practice: The Hybrid relay
Triacs and SCRs or thyristors are great devices for switching AC loads. They
are fast, small and cheap. A drawback, however, is their relatively high ‘On’
resistance which results in power losses and makes cooling necessary when the
load draws more than a few ampères. Relays are also great devices for switching
AC loads. They have a low ‘On’ resistance, are easy to control and their control
signal is isolated from the load’s supply. Why not use a relay in parallel with a
triac to switch a load together? That way we can have the best of both worlds.

Switching on
It starts by turning on the triac to apply the supply voltage to the load. Because
the triac is fast, it can switch the load on and off around a zero crossing of the AC
supply voltage and thus keep electromagnetic interference (EMI) to a minimum.
Furthermore, a triac can be used in phase angle control mode which allows soft
starting a load.
Once the load has been started, the relay is turned on too. Because the
mechanical switch has a much lower ‘On’ resistance than the triac, most of the
current will start flowing through the switch. The triac is no longer needed and
can be switched off.

Switching off
Switching off the load starts by switching the triac back on, then the relay is
switched off. Since the triac is conducting at this moment, the voltage over the mechanical switch contacts remains low.
Opening the switch is now safe and will not produce sparks and arcs. Again, EMI production will be low, and the switch
contacts do not burn. Once the relay is open, triggering the triac is stopped and the load will switch off as soon as the triac
stops conducting.

Advantages
A hybrid relay constructed and operated this way has many advantages. The power losses are low thanks to the relay’s low
‘On’ resistance. This also saves costs and space as the triac doesn’t need a large heat sink. EMI noise level stays low because
the triac avoids contact bounce. Also, operation is fast and spark-free, making switching safer and more robust.
The main inconvenience of a hybrid relay is the number of parts needed to build one. Controlling it is more complex too and
requires a microcontroller in most cases.

Post your ideas and


electronics projects
all sizes/all levels/allsorts,
at www.elektor-labs.com
and become famous!
Elektor Labs: www.elektor-labs.com
Design, Build, Share... Electronics!

92 March & April 2020 www.elektormagazine.com

190369-B EN Developers Zone.indd 92 06/02/2020 09:52


Locating Wayward Wires
Track and trace concealed and defective cables
with ease and certainty
By Dr Thomas Scherer (Germany)

Which way do the wires run? This conundrum regularly faces electricians working in older buildings and do-
it-yourself enthusiasts alike – in other words everyone who enjoys (?) doing work in his or her home and
garden. Sometimes finding concealed cable runs is far from easy, which is why we are discussing ways and
means of locating these hidden copper wires even when they are non-continuous (interrupted).

It all began two years ago. In springtime


the grass began to grow on my lawn
and the lawn mower had to be awak-
ened from its hibernation, given a quick
overhaul, refuelled and then used as
intended. But already during the pre-
vious year I noticed how evenly the
lawn next door had been cut
by a robotic lawnmower or
lawn robot. Why mow
yourself, if this can
be done automat-
ically? Thought,
bought, but
still far from
finished...

Lines and
lawns
Eagerly holding the
monstrous box of a newly
acquired the new piece of
technology, you are faced with problems
that are easily – and grossly – under-
estimated. While researching which
machines would be suitable for my
Figure 1. My lawn robot (Photo: Gardena).
U-shaped garden (with several pinch-
points barely one metre wide), I natu-
rally also discovered the quirks of these
potential mowing slaves. I knew that
robotic mowers of this kind are actually As robots go, they are rather stupid, its charging station, the robot needs an
quite ‘unintelligent’ and make their trips because they have no camera or inbuilt extra search line – laid on the lawn or
through the grass fairly randomly. If cognitive map to make intelligent deci- better, in the ground. Through all of these
they bump into something, they reverse, sions. In order to prevent them from wires flows a pulsed current, and thanks
turn a little (again randomly) and try leaving your property altogether and to to built-in sensors that detect the mag-
once more until their daily time allow- exclude areas that are not to be mowed, netic fields, the robot knows where it is.
ance for mowing is finished (or the bat- you have to lay a boundary wire all With my robot (Figure 1) the signal is
tery is running low). around for their guidance. And to find also password-encrypted with a unique

www.elektormagazine.com March & April 2019 93

180352 EN Detecting hidden cables.indd 93 06/02/2020 09:58


Figure 2: To protect the charging station and Figure 3. The wire was laid here with plastic ‘tent peg’ markers on the lawn above.
the robot mower robot I adapted a dog kennel
without further ado. My dog quickly learned
that this was not his new home!

secret code, making a stolen Robby The to make things easy for yourself, lay Cable breaks
Robot also a Robby that’s unusable by the line directly on the grass and tack it My luck didn’t last long, however. When
anyone else. At least that’s a deterrent down every 50 cm with a kind of plastic you are involved so intensively with your
to any thieves who can add up to three. tent peg (see Figure 3). Over time, the lawn, you also take good care of it. In my
On the other hand, the only additional wire disappears into the undergrowth case this was waging war on the dandeli-
luxury with my example is a radio con- of the lawn. So says the manufacturer. ons. Since I knew where the cables were,
nection to the Internet via a modem. This And in general, it’s true. However, this I was the only one allowed to tackle these
means I can check on my smartphone, is only practicable in areas where you pesky opponents. At first, things went
from anywhere in the world, what the rarely set foot, otherwise you create trip quite well. But then, at some point, it
robot is doing and send it back into its hazards for yourself. Around paths and happened: while slicing the stem of a
little house (Figure 2) in heavy rain, flower beds it is better to lay the line magnificent dandelion, I found myself
for example. 10 to 20 cm below the earth, stones or adrift by several centimetres and the
No gain without pain, though. Before I (concrete) slabs. Alternatively, you can lawn robot stopped dead in its tracks.
could enjoy the reward of watching mow- (laboriously) make slits in the lawn with I had sliced the cable as well. No big
ing carried out robotically, the gods now a flat (straight) spade and press the wire problem, because I knew exactly where
set me the task of cable laying opera- into the earth with your fingers. Or you I had been gardening in perilous prox-
tions. For me, this involved putting down can hire a professional with a cable-lay- imity to the buried power source. After
a green single-core conductor of approx. ing machine to do this sweaty job in a some digging, I saw the severed cable
1.5-square millimetre cross-section, a short time. ends. If there is some slack, you put the
good 500 m long in fact. If you want I had to contend with all four methods, ends into a special, gel-filled, waterproof
because just after I had finished my connector (Figure 4), squeeze the clamp
labours, I discovered the consequences and all’s well again.
of an incorrect statement in the manual.
This said that the distance between the This mishap was not a one-off occur-
cable and any edges or obstacles could rence, though. In the second year of the
be set between 15 and 50 cm. Trusting autonomous lawn mowing I apparently
this guidance, I laid the cables at a dis- became more careless, because I had
tance of 20 cm from the actual bound- been rooting out some undesired plant
ary. Subsequently, when configuring my growth at the edge of the garden, spread
robot, I noticed the minimum distance across several metres. Then I noticed
was now stated to be 25 cm. However, that Robby had stopped helplessly, hav-
my cursing bore fruit, as the manufac- ing lost its orientation entirely. This was
turer kindly sent out a professional with right at the edge where the professional
a laying machine, who then re-buried cable-laying machine had been used.
the 250 m of wire that I had already laid, Here the wires were particularly deep
this time at a distance of 30 cm. Every- and not buried in the ground by myself.
Figure 4. Gel-filled (watertight) crimp
thing was fine and the mower mowed So, what to do? Unearth every possible
connector. I bought a bulk pack of these…
excellently, as I had schemed and hoped. location, one after the other? Or seek

94 March & April 2019 www.elektormagazine.com

180352 EN Detecting hidden cables.indd 94 06/02/2020 09:58


aid using technology? even with small changes in distance. This
As an electronicist, I have a natural lean- even works with wires buried at 20 cm
ing towards technical solutions. So, with depth. I then needed only three to four
my brow furrowed by anxious thoughts, test runs at ground level to find the point
I did the obvious. I took a coffee break where the signal stopped abruptly. I was
and then put Google to the test. more than relieved and while repairing
the point of damage, I swore in grati-
Trial and error tude that I’d buy Google a beer if I ever
My first thought was to disconnect all met “it”.
cables from the charging station (Fig-
ure 5) in the re-purposed dog kennel and Other instances
to connect them directly to mains volt- Those who occasionally need to drill
age via a ‘series resistor’ (in fact a lamp holes in walls in order to hang up a pic-
bulb). Then arcing and sparking noises ture or fix a shelf using wall plugs and
ought to be heard at the defective place screws will always have a queasy feeling,
– if the ground was damp enough. This even if they observe the normal rule of
expectation turned out to be over-opti- thumb that cables embedded in walls
Figure 5. The charging point normally
mistic: it didn’t work! Standing upright, always run vertically or horizontally from
concealed in the kennel (here removed for
nothing was to be heard, no matter which a socket or switch. Even though this rule inspection) with associated cables.
cable end I connected to the mains. And has been followed quite well in Germany
down at lawn level and turning my ear and elsewhere since the 1950s, there
towards the blades of grass was a bit too are a) exceptions and b) older buildings
risky for me, because an ear is fastened with ‘unfettered’ wiring. In addition, in
on the outside of the thought-process bathrooms and other wet rooms the elec-
enclosure and neurons are incompatible trical installation is not the only thing
with 230 V. [Editor’s note: We strongly you have to worry about. Ultimately, you
advise against using AC powerline volt- have to know if there is anything metal-
age as a test tool — experiments of lic hidden in the wall before you use the
this kind can be fatal!] hammer drill.
What next? I would have liked Hall sen- If it is only a question of whether a cable
sors, but with cable breaks there is no or pipe is located near the planned bore-
current flow and where there is no cur- hole, then one of the ‘metal detectors’
rent, there is no magnetic field. The robot available in every DIY store will be suit-
had already proved this! able for this purpose. The decision pro-
Google mentioned that robot mowers cess these devices adopt for whether you
or their charging stations inject pul- can risk drilling runs along the lines of
sating signals into the wires, the har- ‘possibly some obstacle there or proba-
monics of which can be received with a bly nothing’. Somewhat better devices
long-wave radio. VHF would not work so like mine (Figure 6) have different oper-
well, because damp soil screens (shields) ating modes and can allegedly detect
higher frequencies quite well. So, it had wood (in my experience, between rather
to be long-wave. But where do you get badly and not at all) and/or its humidity,
such an antique device unless you steal metal (the regardless of whether iron or
it? In my home I get my radio from the non-ferrous — that works half the time)
Internet and/or the cable network socket. as well as electrical alternating fields (this
But my mother had an analogue porta- also works half the time). For the normal
ble radio in the kitchen. So, I tried with household installations, a device of this
this radio on a temporary loan basis. type is sufficient and is at least better
You can only connect one end of the than nothing.
cable to the charging station at a time, Recently, however, I tested a ‘real’ metal
because if both ends of the cut cable detector for Elektor, the type CS-400
are fed with this signal, you will never from Velleman (Figure 7) [1]. I found
find the breaking point. After all, loca- out that such a device is particularly suit-
tion by electromagnetic radiation means able for detecting hidden metal pipework.
is hardly ultra-precise. But to cut a long A ‘treasure detector’ like this is very well
story short: it all worked! suited for locating studs (wooden beams)
You can clearly notice a change in the behind plasterboard precisely. Even inex-
background noise or crackling when you pensive variants of correct metal detec-
bring the radio close to a wire carrying tors are much more accurate and reli-
this signal. You then adjust the volume able than the simple devices found in Figure 6. Simple metal detector, sold in DIY
control to make the audible note change DIY stores – but also more expensive stores as a cable finder.

www.elektormagazine.com March & April 2019 95

180352 EN Detecting hidden cables.indd 95 06/02/2020 09:58


and somewhat more unwieldy.
With a metal detector — no matter
whether it’s super-sensitive like the one
from Velleman or cheap and basic like
the one from the DIY store — you can
find hidden metal and more in walls or in
the ground. But what is still impossible is
locating cable breaks, because the sepa-
ration points are typically so narrow that
the spatial resolution is not sufficient. So,
we need to use the radio method there.
But what if there’s no RF signal or none
with fast rise and fall edges?
In that case you build yourself a
generator!

A solution for all situations


My experience with under-lawn wires
Figure 7. Display on a ‘proper’ metal detector. This is the CS-400 model by Velleman [1].
(and other previous considerations)
led to a growing desire for a method
that would work (almost) always and
everywhere. This holds good also in
cases where a lawn robot does not pro-
vide steep-edged signals that can be
detected with a radio. Or indeed where
a power cable runs below-ground for
other reasons (such as for powering an
outside lamp) and ends up making inti-
mate acquaintance with a spade or a
motor hoe. In all cases involving severed
cables we need something electronic to
generate the necessary signal for detec-
tion by a suitable receiver.
It is not difficult to build something like
this. But first you should define some
criteria. It is clear that the soil (or solid
walls) attenuate higher frequencies more
than they do lower frequencies. And since
Figure 8. I bagged this basic portable radio with LW reception for a ridiculous amount on eBay. It
radios already exist, you don’t have to
serves as a universal receiver for detecting breaks in concealed wires. build a receiver from scratch. Ideally
you should buy a radio with a long-wave
range. The fact that in Germany, as in
some other European countries, the sale
of purely analogue radios may soon end
+3...5V
is unproblematic, because the integrated
14 C1 digital receivers in newer radios do not
IC1 generate interference. And in any case,
R1 R2 1
7
16V you still have eBay. There I bought a
150k

3k9

4 10 long-wave radio (Figure 8) of my own


6 R 8 R for a stupidly small price — and you can
TR TR
IC1A IC1B C6 R3 OUT
1 5 13 9 do the same if you don’t already have
DIS OUT DIS OUT 470
1n
one of these devices standing around.
2 12
THR THR
CV CV By the way, it doesn’t necessarily have
3 465Hz 11 185kHz to be a radio with LW range. Medium
C2 C3 C4 C5 P1
1k wave usually works as well, as long as
4n7 100n 1n 100n IC1 = TLC556 the edges of the signal to be detected
are steep enough. Just give it a try...
180352-006

Signal injector
Figure 9. A signal injector based on the 556 dual CMOS timer. It generates an amplitude modulated An amplitude-modulated signal for recep-
LW signal on 465 Hz (185 kHz). tion on a long-wave radio does not take

96 March & April 2019 www.elektormagazine.com

180352 EN Detecting hidden cables.indd 96 06/02/2020 09:58


long to make. You could use a standard
Web link
small microcontroller and a few lines of
code would suffice. But if we are already [1] Velleman CS-400 Review :
dealing with analogue technology, then www.elektormagazine.com/news/review-velleman-cs-400-metalldetektor
an analogue circuit ought to be used too.
So how about the IC of all ICs, the 555
timer?
This works in principle. But if you want above the concert pitch of A. In this way medium wave receiver. If you are unlucky
an amplitude modulated signal, you need a 185 kHz square wave signal, ampli- enough to live near strong transmitters
two timer ICs – one for the AF and one tude-modulated by 465 Hz and fixed by operating around 185 kHz, you can of
for the HF. There’s something like this R2 and C4, is generated via the reset course use R2 to achieve some slightly
in a single package: the 556 is a dou- input of IC2A. With P1 you can adjust the differing frequency. The following applies:
ble 555. It would be so nice and simple, amplitude of the signal fed into the wire f = 0.725 / (R2 C4).
except that a normal 555, just like its in such a way that it can still be received 180352-02
dual colleague 556, has the disadvan- well on the radio. R3 serves purely for
tage that it needs 5 V for power supply, short-circuit protection.
in some quantity, which is bad news for The component values chosen are not set
a battery supply. Fortunately, however, in stone. The third or fifth harmonic of
a CMOS version of the 556 is available. Timer 2 should still have enough ampli-
The IC TLC556 works great from 2 V tude to be received close up with a
upwards and can therefore be powered
adequately by two AA or AAA cells or a
CR3032 lithium coin cell.
For this reason, this IC was used for the @ WWW.ELEKTOR.COM
circuit of the universal signal injector in
ª Velleman CS-400 Metal detector
Figure 9. Along with R1 and C2, Timer 1 www.elektor.com/velleman-cs400-advanced-metal-detector-with-lcd
(IC1A) generates a symmetrical square-
wave signal of 465 Hz, i.e. a semitone

Advertisement

Join the Elektor Community GOLD


MEMBERSH
Take out a GOLD Membership now! ✔ 6x Elektor Ma
IP
gazine (Print)
✔ 6x Elektor Ma
gazine (PDF)
✔ 3x Elektor Indu
stry Magazine
(PDF)
✔ Access to Elekt
or Archive
✔ Access to over
1,000 Gerber files
✔ Elektor Annual
DVD
✔ 10% Discount
in Elektor Store
✔ Exclusive Offer
s

GREEN
MEMBERSHIP
✔ 6x Elektor Ma
gazine (PDF)
✔ 3x Elektor Indu
stry Magazine
(PDF)

Also available: ✔ Access to Elekt


✔ Access to over
or Archive
1,000 Gerber files
The all-paperless GREEN Membership! ✔ 10% Discount
in Elektor Store
✔ Exclusive Offer
www.elektor.com/member
s

EN A5 member advertisement 2020.indd 1 06/02/2020 09:56

www.elektormagazine.com March & April 2019 97

180352 EN Detecting hidden cables.indd 97 06/02/2020 09:58


REVIEW
Joy-IT DMSO2D72
Portable 3-in-1 Oscilloscope
By Harry Baggen

When performing measurements away from your electronics workbench, a


portable instrument is exceedingly convenient, particularly if you have one
that combines three measuring tasks. The Joy-IT DMSO2D72 offers the
functionality of an oscilloscope, a multimeter and an arbitrary waveform
generator in one convenient package. We had a go with it.

Side by side: the screen of the oscilloscope, AWG and multimeter.

rubber bumper and on the back are four function buttons, the functions
is a fold-out stand that allows the of which are displayed on the screen. The
meter to be placed upright. On the back colour display is easy to read and with a
What is it actually? there is also the battery compartment resolution of 320 x 240 pixels it shows
With so much functionality packed in a that contains two standard 18650 Li-ion a lot of information. I believe it should
single instrument you will naturally ask cells. These are therefore always easy to have been a little bigger, but then the
yourself what its main function actually replace. A cover on the right side protects instrument would probably also have to
is. This is obviously the oscilloscope, in a USB-C connector that serves as power be more expense.
this case a two-channel version with a supply input and for communication with The four cursor buttons are used for,
bandwidth of 70 MHz and a sampling rate a PC. On the top are three recessed BNC among other things, setting the time
of 250 Msamples/s (half that when using connectors for the oscilloscope inputs base, sensitivity, DC level and trigger
the two channels simultaneously). These and the AWG output. On the front we level. This is initially not all that straight-
are very reasonable specs for a measur- find a 2.8-inch display at the top with forward because the functions of the
ing instrument that costs less than the operating controls below that and the buttons changes after pressing the
€200 euro (for Elektor members). Add multimeter inputs right at the bottom. Channel or Time button. Unfortunately
to that the AWG (arbritrary wave gener- The meter is supplied in a generous case I could not find an indication anywhere
ator) which also has decent characteris- with many accessories. on the display that showed which of the
tics (sampling rate of 250 Msamples/s) Channel or Time buttons was pressed
and an autoranging multimeter with its Oscilloscope last.
own dedicated inputs. What more do you The operation of the DMSO2D72 The oscilloscope possesses virtually all
want? succeeds largely without having to the functions that an ordinary ’scope has,
The DMSO2D72 is supplied with a sturdy consult the operating manual first, but such as an auto setting that automat-
case, a power supply adapter and various some things you will find only after some ically adjusts the settings to obtain a
types of test leads. All these features are trial and error. Three of the blue buttons stable scope display, the use of cursor
housed in a robust enclosure measur- are used to switch between the different lines and the display of various measure-
ing about 20 x 10 x 4 cm. The whole functions, the fourth blue button gives ments. The trigger options are somewhat
thing resembles a substantial multime- access to a menu with various configu- limited, but are sufficient for most
ter. The enclosure itself is fitted with a ration options. Directly below the display practical applications. The ’scope has

98 March & April 2020 www.elektormagazine.com

191264 EN Review Joy-IT DMSO2D72.indd 98 06/02/2020 10:00


a data memory of 6 (1 channel) or 3
(2 channels) kSamples, the contents of
which is shown at the top of the screen.
Once sampling is completed you can use
the cursor buttons to scroll through the
memory.

AWG and multimeter


The built-in AWG offers a few standard
waveshapes and has four memories for
waveforms you can program yourself. The
latter is possible using the accompanying The DMSO2D72 is supplied with many The BNC sockets are recessed quite low in the
PC software. The maximum frequency accessories. top of the cabinet.
differs for each waveform. The range for
the sinewave goes up to 25 MHz, for the
squarewave to 10 MHz and for the trian-
gle only up to 1 MHz, while the range
for the arbitrary waveform increases to
5 MHz again.
The frequency can be adjusted with
the cursor buttons. After pressing the
frequency function button twice, a
keyboard appears on the screen that
allows you to enter a value. It is possible
to use the AWG and scope at the same
time. After setting the AWG and activating
its output you can switch to the oscillo-
scope and the AWG continues to be active.
This is ideal for testing the signal propa-
gation in a circuit; you apply a signal on
the input and subsequently examine the
signal in the circuit or at its output. Note
that the value of the indicated output
voltage is only valid when the output is All three functions of the DMSO2D72 can be operated with the corresponding PC software.
terminated into 50 Ω, otherwise you will
get double that value!
The supply voltage is provided by two but once running an error message Conclusion
standard 18650 Li-ion cells. The multi- (“read allset failed”) appeared regularly. For around €200 you get a very handy
meter is a nice addition. This meter As a consequence many settings were and sturdy measuring instrument
operates as you would expect from a wrong and some didn’t work at all. with three functions, meaning practi-
typical multimeter but the accuracy is Some searching on the Internet revealed cally everything you need for general
not all that high (display 4000 counts, that this fault is not unfamiliar: the electronics use. The ’scope and generator
basic accuracy 0.8%). But this is gener- software is unable to read the character- features are relatively extensive and the
ally not that critical with measurements istics of the connected instrument. This instrument is quite easy to operate once
‘in the field’. could be solved by installing an older you have become familiar with it. It is not
The automatic range switching works version (1.1.10) of the software, after a very accurate measuring instrument,
well and the display also indicates which everything worked as it should and but then you don’t expect that for this
which sockets you have to use for which then changing back to the current version price and the intended application. The
measurement. There are separate inputs 1.1.11. Unfortunately the data transfer combination of the three measurement
for the mA and A ranges. Beware: the speed in ’scope mode is quite slow, but functions makes this a very convenient
10-A range is not fused! Furthermore, the otherwise the software offers quite a few instrument that I would not hesitate to
multimeter also has a resistance meter, features; you can program waveshapes purchase if I had the need for an all-in-
diode tester and a continuity tester on and send them to the DMSO2D72. one solution.
board. And finally, you can also measure (191264-02)
capacitance.

PC software
The accompanying PC software is avail-
@ WWW.ELEKTOR.COM
able from the Joy-IT website and can be ªJoy-IT DMSO2D72 Portable 3-in-1 Oscilloscope
used to operate the instrument from your www.elektor.com/19157
computer. The installation went quickly

www.elektormagazine.com March & April 2020 99

191264 EN Review Joy-IT DMSO2D72.indd 99 06/02/2020 10:00


Homebrew PC
for the Electronics Lab
Tips on Component Choice and Construction
By Dr Thomas Scherer (Germany)

When it comes to kitting out a small electronics lab


it sometimes feels like you are the youngest sibling
in the family: unless money is no object you need to
rely on hand-me-downs. Re-purposing an old cast off
PC as a general lab computer is not always the best
solution, even budget off-the-shelf PCs may not give
you everything you need.  To make sure you end
up with a machine that’s really useful while keeping
Figure 1: All the innards (motherboard, RAM, SSD, CPU and thermal
costs low; why not build your own custom PC? paste) waiting to be assembled to make a lab PC.

Old PCs consigned for use in an electronics lab have some • Power supply
advantages: Firstly it is not such a loss if you mistreat them and • Case
they fail. They will not be the most recent model so often they
provide connectors for some of the older, redundant interfaces Small parts such as slot plates with serial and parallel interface
that may be used by some old projects. The disadvantages of connectors are also an option if you think they will be useful,
an old PC however are manifold. these are often not included with boards. If you have specific
First, we need to accept lower reliability; even though PCs graphic-intensive requirements (3D renderings, etc.), you can
occasionally last ten years, it’s reasonable to assume that choose a powerful dedicated graphics card instead of using the
their typical useful lifespan is around three years. It’s not just graphics processor integrated into many CPUs. Of course, you
that something can break or wear out but old PCs often run an could fire up a search engine and look for an off-the-shelf PC that
old unsupported OS, which poses a security risk. Okay, hand does everything you need. It is however a good exercise to con-
on heart: Do you have a PC somewhere running Windows sider the properties of all the necessary components in advance
XP? Newer operating systems often cannot be installed on old to see how you can build something that you can really use.
machines because of lack of space, no compatible drivers or
the result would be an achingly slow PC which brings me to the Motherboard
third drawback: poor performance. To get round this why not The basic choice we need to make here is between Intel or AMD.
build your own PC? For relatively little money, you can quickly AMD’s new processors currently deliver a little more ‘bang for the
put together something that fits the bill exactly. buck’ which has encouraged Intel to price their products more
competitively. If you intend to only run Windows 10, then an
The PC components AMD processor is a good choice. I install Windows 10 on several
For an electronics engineer, building a PC yourself should be a volumes and also use Linux and macOS so I need to go for Intel.
breeze. Anyone who knows that red ≠ blue and plus ≠ minus If you need space for plug-in cards, the next decision for the
and what static electricity can do to modern electronics hardly board format is in favour of standard ATX. Alternatively, you
needs to be instructed how to plug the various components can also choose µATX but standard ATX also provides (proba-
together (Figure 1). I managed to build a lab PC in one eve- bly for not much longer) a PCI slot, useful if you want to use
ning; if I can do it, anyone can… an older board with a PCI connector. Otherwise you will be
What you will need: limited to more modern PCIe cards.
• Motherboard If you plan to use an Intel CPU, you can choose from boards
• CPU with a number of variants of the X3XX chipsets. Here you
• CPU cooler should not be tempted to penny pinch; avoid the H310, B360
• RAM modules and B365 chipsets. These variants, which are intended for sim-
• SSD (electromechanical hard drives are out) ple office PCs, have a reduced number of usable PCIe lanes,

100 March & April 2020 www.elektormagazine.com

191191 EN DIY PC.indd 100 06/02/2020 10:02


Figure 2: Motherboard with Intel’s H370 chipset for socket 1151-2 Figure 3: A ‘boxed’ Intel i3-9100F — a fast quad-core CPU without
(image: Gigabyte [1]). integrated GPU.

which slows down the system throughput, especially when


using M2 NVME SSDs and graphics cards. It doesn’t need to
be an expensive Z390 board either. The H370 or Z370 vari-
ants will be good enough. The ‘Z’ indicates a free CPU clock
but I’m not interested in overclocking the lab PC so I will go
with the less expensive H370. My choice fell on the Gigabyte
H370 HD3 (Figure 2). It has the PCI slot mentioned and is
available for around €100.

The CPU
After selecting either Intel or AMD, the next thing to consider is
processing power, which these days is largely governed by the Figure 4: CPU cooler supplied with the ‘boxed’ version of the processor.
number of CPU cores. Although Intel offers modern ‘Celeron’ or
‘Pentium’ processors for just under €50 these are feeble dual-core
CPUs which may be sufficient for less demanding applications
but won’t cut the mustard for what we have in mind here. You If you opt for a more powerful processor you need to pay more
don’t need to stump up much more money to get a powerful, attention to drawing off the extra heat it generates. A wide
fast quad-core version of the processor for around 100 Euros. choice of cooling arrangements is available, some fans can be
For AMD devices we would be looking at the Ryzen 3 or 5 pro- quite noisy but for our application this is not such a serious
cessors — older, slower or even completely different CPUs that drawback. You can expect to pay at least €20 for a cooler with
don’t use the AM4 socket should be avoided. For Intel a good heat pipes and a 120-mm fan (Figure 5). The selection is huge
processor to consider is the i3-9100. The F version is a bit but a water cooled system would be overkill, after all nobody in
cheaper because it has the integrated video controller disabled. the lab would ever use the machine for gaming… would they?
After a recent upgrade to my main PC I have a fairly modern
AMD graphics spare so it makes sense to choose a ‘boxed’ RAM
i3-9100F for around €80 (Figure 3). This has four cores clocked When it comes to RAM, the first question is: how much? 16 GB
at 3.6 GHz (Turbo = 4.2 GHz). Five years ago you would have seems to be the standard these days and is almost always
shelled out over €400 for this CPU. Processors can also be pur- sufficient for the majority of applications. You can order this
chased as OEM/Tray processors; these are bought in bulk by a as a kit consisting of two 8 GB cards so they can be accessed
manufacture (in trays) and will not be supplied in the usual retail faster i.e. ‘interleaved’. A 32 GB, made up of 2x16 uses less
packaging when resold individually as a Tray CPU. They are not energy than the same capacity made from 4x8.
significantly cheaper so I opted to buy one in its original box. CPUs have long used DDR4 memory; these 260-pin mod-
At the time of going to print, there may already be successors. ules are required for Ryzen CPUs with a maximum clock of
In this case, I would prefer the i3-10100. For those requiring 2,933 MHz. For the Coffee Lake processors from Intel (iX-8XXX
processors with more cores, CPUs of the i5, i7 and i9 type are and iX-9XXX), 2400 MHz is sufficient. More is always possible
popular choices. and can be activated via BIOS (XMP = eXtreme Memory Profile).
XMP is an Intel technology that allows you to use higher than
CPU cooler standard memory speeds by choosing a different profile for
The ‘boxed’ i3 CPU also comes with a heat sink and fan the RAM during BIOS boot.
(Figure 4) which runs not particularly quietly but in a lab In addition to the clock speed, the access latency is also rele-
environment that’s acceptable. vant for RAM modules, which is specified as ‘CLXX-XX-XX-XX’

www.elektormagazine.com March & April 2020 101

191191 EN DIY PC.indd 101 06/02/2020 10:02


A not so obvious criterion is the possible I/O operations per sec-
ond; this determines the responsiveness when running modern
operating systems which make many accesses to the mass stor-
age unit. The ACE-A80 I chose from Silicon Power (Figure 6)
offers 500/600 k/s (read / write), which is five times the stan-
dard SATA-3 device. At 3400/3000 MB/s (read / write), the
data throughput is very respectable, and not far short of the
theoretical limit. This SSD costs just €45, it really is not worth
considering any conventional, electromechanical hard drive.

Note: avoid QLC SSDs! These ‘Quad Level Cells’ actually work
with 16 voltage levels per cell and can thereby store 4 bits per
cell. That makes them cheaper to produce for a given capacity,
but makes the read/write cycles relatively slow and also impacts
on cell longevity. Without some nifty tricks by the memory con-
troller (‘wear leveling’ and ‘reserve blocks’) a memory sector
would become unstable after only about 200 write operations
(compared to 2000 for more standard Triple-Layer cell (TLC)
SSDs). The cost savings are really not worth it!
Figure 5: Typical cooler: Artic Freezer 34 with four heatpipes (Image:
Arctic [2]). The power supply
An increasingly more important criterion to consider here is the
efficiency of the power supply. More energy wasted equates to a
in the description. Less is more. I decided to go down the con- larger carbon footprint. Power supplies using the ‘80PLUS’ rating
servative route and opted for a 2x8-GB kit rated at 1.2 V from system are divided into categories of bronze, silver and gold. You
the G.Skill ‘Value’ range with the description CL15-15-15-35. shouldn’t buy anything with an efficiency rating less than bronze.
This set me back around €55. The power rating is also relevant. If you have a CPU consum-
ing 65 W with an integrated CPU graphics, it will be difficult
SSD to exceed 100 W for the entire system even under full load.
The two obvious criteria here are: capacity and speed. Everyone Graphics cards are notoriously power hungry. Top of the range
has an idea how much memory they want and a bank state- cards used by serious gamers consume several hundred watts.
ment that tells them how much they really can get away with. A fairly average graphics card in the lower-mid range class will
Personally, using a Windows 10 machine running various devel- take 200 W. As a rule, the graphics card in an average lab PC
opment environments with CAD software installed plus an office will be jogging along at 20 to 40 W if it has nothing special to do.
package on top of that I think 250 GB is more than ample for Unfortunately, there are no longer any usable 250 W ATX power
my needs. supplies available. A power supply with an output rated much
The crucial question is the interface; although my board has six higher than necessary will be operating below its optimal level
SATA-3 interfaces the data throughput is ‘only’ a maximum of of efficiency. I chose a 350 W LC-Power LC420-12 (Figure 7)
600 MB/s. SSDs with an M2 NVME interface are better and not which is a compromise but costs just € 25. Its connections
much more expensive, the board we are using here offers two slots comply with the ATX standard V2.31. The power supply runs
for this. Thanks to four 3 lane PCIe slots, gross data throughput with an efficiency rating of 88% and is very efficient in sleep
of up to 4 GB/s is possible. Standard SSDs easily offer 3 GB/s. mode. Its integrated 120 mm cooling fan is not too noisy (gen-
erally the larger the fan the quieter it runs).

It’s an open-and-shut case


The case for the PC is more or less a matter of taste. You could
really go to town here but I opted for the Aerocool model
CS-1103, no frills, but good value at €20 . It has two USB 2.0
and one USB 3.0 socket on the front and also has a black alu-
minium front panel (Figure 8). What more could you want?

Odds and ends


The graphics card already mentioned is a Radeon 560 from
Sapphire with 2 GB RAM. That is enough for a 4K monitor with
smooth 60 Hz. In addition, there was a simple 90 mm fan with
low speed for the back of the case. If you need to shift loads of
air, it would be better to choose an enclosure with more cut-
outs for several 120 or even 140 mm fans. Finally I wanted
to make use of the serial and parallel output port header pins
Figure 6: Fast M2-NVME-SSD ACE-A80 from Silicon Power (Image: Silicon available on the motherboard — you never know when you
Power [3]). will need these in the lab environment — so I fitted a slot plate

102 March & April 2020 www.elektormagazine.com

191191 EN DIY PC.indd 102 06/02/2020 10:02


mounted with the connectors including the ribbon cables and
header plugs. An emulated serial interface using a USB port
often causes problems in situations where lots of fast transfers
consisting of relatively few bytes are required.

Assembly
It’s usual for most of the components to be supplied in bags
with an antistatic coating. A professional work bench will pro-
vide an earthing point to connect a (high impedance) conduc-
tive wriststrap via a flexible coiled wire.
You can also take some simple precautions to reduce the risk of
accumulating a static charge on your body. Firstly do not slide
or walk across synthetic floor coverings immediately before
handling static-sensitive parts. Sit at a bench and touch a
surface like a metal instrument case that has a connection to
earth to disperse any charge. Wear clothes made from natu-
ral (not synthetic) fibres. Working in an environment with a
humidity level of at least 30% will reduce the risk of a static
charge accumulating on any surface.
Figure 7: 350 W power supply LC420-12 from LC-Power (Image: LC-
Before the motherboard is installed in the case first mount the
Power [4]).
CPU in its socket. Once sure your body is not harbouring any
electrical charge you can release the lever over the CPU socket,
remove the black plastic cover and place the CPU on its socket.
Notches and markings on the CPU package ensure that it’s diffi- First impressions indicate that this low-cost lab PC runs almost as
cult to fit it the wrong way round. Once in place and level carefully fast as my much more expensive main PC. Now I need to install
bring down the lever to lock the CPU in place. The motherboard and configure all the necessary software packages, experience
can now be positioned and fixed in the case with screws. The has shown that this phase of the build usually takes significantly
case usually has a bag with six to nine screws included. longer than the time needed to put the PC together.
Now we can mount the CPU cooler in place. Its heat-conductive 191191-04
surface already has a coating of thermal paste (almost always
too much). Press the cooler onto the CPU, twist it slightly and
pull it away again, use a tissue to wipe away any paste stick-
ing to the CPU. Now the amount of paste remaining should
be about right. I decided to dispense with the supplied paste
completely and used a better product; it contains metal-par-
ticles to improve heat transfer; I used a hobby knife blade to
spread it thinly over the surface.
Now the SSD and the two RAM modules can be slotted in place.
The manual explains which sockets should be used together so
that RAM interleaving works. Now take some care to connect
up all the cables in the case according to the manual.
Run the power leads from the PSU to the boards. Note that the
six-pin (2x3) connector from the PSU usually plugs into the
graphics card. The additional 12 V supply for the board requires
a 4- or 8-pin connector. This is very important!
The graphics card is now plugged into the PCIe slot with 16
lanes; this is the one nearest the CPU.
Once you are happy everything is connected as it should be
turn the PC on and watch as the BIOS messages appear on
the connected monitor. Windows 10 installs without problem
in the standard configuration but other OSs may require a cer-
tain amount of tweaking. Figure 8: Outside and inside the finished e-lab PC.

Web Links
[1] www.gigabyte.com/de/Motherboard/H370-HD3-rev-10#kf
[2] www.arctic.ac/de_de/freezer-34.html
[3] www.silicon-power.com/web/product-P34A80
[4] www.lc-power.com/produkte/pc-netzteile/office-serie/lc420-12-v231/

www.elektormagazine.com March & April 2020 103

191191 EN DIY PC.indd 103 06/02/2020 10:02


RETRONICS

The Elektor ‘Intelekt’


Chess Computer (1981)
Tiny Chess 86 ported to the Intel 8088

By Jan Buiting (Elektor Retronics Editor)

Do you play chess? Are you looking for an


opponent who is always available … never gets
impatient … plays a reasonably strong game ...
and even allows you to cheat a little, if you really
want to? If so, it’s time you met Intelekt!
So much for the advertising blurb.

104 March & April 2020 www.elektormagazine.com

190382-B EN Retronics.indd 104 06/02/2020 10:05


The above text piece comes verbatim from Elektor magazine
Retronics is a regular section
April 1981, and the sole reason for reprinting it here is the happy
covering vintage electronics including
coincidence that the pristine prototype of the ‘Intelekt’ chess
legendary Elektor designs.
computer was not thrown away back in June 2006 when Elektor www.elektor.tv Contributions, suggestions and
vacated its ‘Beek’ offices to move to Castle Limbricht, also in
requests are welcome; please
the Netherlands. As one of the final activities of the move, on
telegraph [email protected]
a hot June afternoon the Elektor lab was cleared out big time
and a ton of lab equipment, demos, databooks, magazines,
artwork originals, PCBs and prototypes all deemed “unfit for
future use” by the then management was thrown out of two
large windows to land in a large dumpster. rest of the case is a plain metal type with the on/off switch,
Luckily some of the presentable prototypes made by the lab the IEC mains connector and the serial I/O on a 5-way DIN
team and found in various nooks and crannies were saved at socket (!) at the rear side (Figure 3).
an appropriate moment to compile the small collection named
‘Retronics’, and stored in the Castle attic where the items were Oh boy, 16 bits
remained safely for about 10 years until the next move, this The April 1981 edition of Elektor had a special section on 16-bit
time to Aachen, Germany. microcontrollers which were quite new at that time and not
I do not remember who actually rescued the Intelekt proto- widely known to the grand audience of hobbyists. This publi-
type from the landfill, but that must have been due to the case cation came at a time when the 8-bit CPUs like the 6502 and
the unit was housed in. After 30 years it is still as new with its Z80 ruled the roost in DIY land, although 16-bit processors
acrylic cover specially made for the many electronics hobby were known to operate in professional and industrial control
shows and exhibitions all over Europe where Elektor had a stand systems. The 16-bit special section in the magazine mainly
during the 1980s. I do know who made the case: it was my showed the architecture of a few big crunchers including te
colleague Jan Visser who still works in the Elektor lab. Jan was Intel 8088.
delighted to see the Intelekt unit again after so many years.

Presentable it was
The casing made for the Intelekt reveals that it was made for
showing to an audience …. and survive! It was a time when
large numbers of readers would flock to the Elektor stand at
shows especially in Holland and Germany which were easy to
reach out of Beek. In contrast to today’s ‘professional’ shows
like Embedded World, productronica and electronica, the Elektor
stand was beleaguered by readers. Long queues and shouting
were not uncommon especially if there were PCBs and books on
sale, demos available, or authors or designers on the stand to
have fierce discussions with. It was a time when readers were
keen to meet the Elektor editors, publishers and sales staff if
only to see the people behind that weird publication “coming
out of Holland’ — and grab a bargain, of course.
Back to the Intelekt case, the recessed switch is the Interrupt
control, and the 12 × 17 mm size of the rectangular clear-
ance cut by Jan Visser in the acrylic cover should preclude
any thick-fingered or thumbed ruffians at the show to disturb
Figure 1: Intelekt case with the cover removed. The Interrupt pushbutton
a game of chess on demonstration. The switch is secured on is a ‘Digitast’ type witn tactile feedback!. Here it can be seen soldered
a small piece of perfboard you can see dangling on its wires on a small piece of perfboard with two standoffs, and connected to the
when the cover is removed (Figure 1). circuit board with wires.
Second remarkable thing is the product label that reads
‘intelekt’ (sic). It’s a single rectangular piece of acrylic plate
which could be reversed depending on the language required.
Figure 2 shows the trick. For the Dutch version, Jan photo-
copied the Dutch article title only, added the month of publi-
cation in rather normal typeface, and then stuck his paper
creation on one of the plates. For the more refined looking
German plate, Jan said he first ripped the front cover off a
German april 1981 magazine and cut out the piece where
Intelekt was announced.
Only the cover of the case is made from 3-mm thick acrylic
plate (“perspex”) bent to size with a machine I still remember Figure 2: The Intelekt screw-on product descriptor plate set is reversible
seeing in the old workshop in 1985. That cover is bash-proof to show one of two languages: Dutch or German, depending on the show
and certainly served its purpose: to drool over electronics. The or demo location.

www.elektormagazine.com March & April 2020 105

190382-B EN Retronics.indd 105 06/02/2020 10:05


Figure 4: Scanned reproduction of the Intelekt schematic. From: Elektor magazine April 1981.

106 March & April 2020 www.elektormagazine.com

190382-B EN Retronics.indd 106 06/02/2020 10:05


In the Intelekt article itself, a lengthy part of the text explains
(to an 8-bit oriented audience) how the second chunk of 8 bits
that forms a 16-bit data word is conveyed outside of the 8088
chip (yes the CPU in the original IBM PC). After all, how can
you cart around 16 bits in parallel with so few pins available
on the chip? The answer is: Intelligently, by multiplexing with
the address bus using processor-generated timing signal.
The rest is ... history as the 8088 architecture failed to win
many hearts as opposed to the 8086 and the (8-bit!) 8085,
at least in Elektor.
The ‘Intelekt’ article goes to great lengths to reason that 16-bit
data processing is a must to have oomph in a chess machine.
Figure 3: Elements installed on the back panel of the Intelekt case and
As far as computer chess is concerned, the article also refers
not normally accessible to the audience. Also note the PCB space reserved
to earlier Elektor publications of the “contemplative” type and for the INT pushbutton which is wired as an external part.
having performed the groundwork: How I beat the monster
by David Levy and Computers and Chess, both from January
1979. With the April 1981 issue, then, came the happy union
of a 16-bit Intel CPU and the noble game of chess. Back to the EPROMs, I went through all ‘ESS/EPS’ lists of
Elektor’s entire 1980-1989 volume and did not find any software
The roots related to the Intelekt project, only the PCB, which disap-
The Intelekt is quite famous, at least to the extent of being peared though after 3 years or so. The handwritten ‘505’ on
mentioned on the Chess Programming Wiki [1]. There we also the green labels still present on the two 2716s in the Intelekt
read that Intelekt was an 8088-adapted version of Tiny Chess did not help me further as no ESS item with that number was
written for the 8086 by Dutchman Jan Kuipers. ‘TC86’ was listed in the UK magazine, or mentioned in any “Missing Link”
written in assembly code (!). The ‘Elektuur’ Intelekt board section all through 1989. Possibly, Elektor’s UK edition was not
reportedly first went public at the 1981 Dutch Open Computer allowed to sell, let alone mention Mr. Kuiper’s firmware due
Chess Competition (DOCCC). Possibly, maybe, just maybe… it to copyright or contractual restrictions. Surprisingly though,
was the very box I am describing here! some kit advertisers like Technomatic and Cricklewood cheer-
I only found the lead to Tiny Chess through a small mention in fully listed the Elektor Intelekt kit “complete with software” in
the 1981 article, in the section on communicating with Intelekt. adverts in later months.
The text says: By the way, did you know that Elektor’s 1980-1989 magazine
content is available front to back on a DVD?
“[…] Intellekt will respond by displaying the following message:
TINY CHESS V1.O (sic) The hardware
LEVEL IS 1 CHANGE TO _ The author of the Intelekt article, supposedly Jan Kuipers, had
  already explained that intricate clock timing was required for
Without this hint I would have been clueless where the project the 8088 CPU to do its bit of magic with the extra 8 bits of data.
software running out of two 2716 EPROMs would have come And sure, in typical Intel fashion a separate clock oscillator
from. chip is used in the project, here a type 8284. It can be seen
Intelekt communicates its moves, and reads yours, over a in the Intelekt circuit diagram reproduced in Figure 4 and on
3-wire serial link to a dumb (passive) terminal.

The elusive ‘Intelekt’ software


Until about 10 years ago, firmware running in Elektor micro-
controller and microprocessor projects was supplied through
the Elektor Software Service (ESS) in the form of EPROMs,
often burned for you on a Junior computer by… Jan Visser.
However, there is not a word in the 1981 Intelekt article or in
the parts list about the availability of the two 2716 EPROMs,
at least not in the English edition. The article text has this
bizarre piece:
“ In this article we will give a brief description of the ‘hardware’
that is involved (circuit and printed circuit board) but no indica-
tion of the ‘software’ (the actual program). Instead, we will
attempt to give as clear an impression as possible of his chess
skills. After all, that is what counts! ”
In this day and age of open source that would have been an
outrage. Remarkably, the article keeps referring to Intelekt
as a male person (“him” and “his”) which leads me assume it
was a poorly localized version of the Dutch original (“hij” and Figure 5: The 8088 has no on-chip clock generator but requires a special
“zijn” respectively). IC, the 8284.

www.elektormagazine.com March & April 2020 107

190382-B EN Retronics.indd 107 06/02/2020 10:05


Digitast
The 1981 article also highlights a PCB-mount pushbutton of thing about these digitasters is that they have a common
a type called Digitast. When I started out as an assistant PCB footprint although some models have an internal wire
editor for Elektor’s UK edition in 1985 I received link. So, if you mount a digitaster off the board
letters from my readers puzzled by “digitast”. you have to install one small wire link
I had a standard answer advising that it was in its PCB footprint area for proper
a German coinage made from “digital-taster”, continuity. If not, your 8088 may not
where Taster has nothing to do with taste work despite hours of debugging 8- or
but is German for pushbutton (a keyboard 16-bit! Fortunately, this oddity specific to
is a Tastatur in that country). Intelekt has digitast-style pushbuttons is discussed
two digitasters, Reset and Interrupt. On the clearly in the article, just as the
show prototype, only RES is on the PCB while necessity to bend and solder no fewer
INT is connected with wires and secured under than 43 wire links on the single-sided (!)
the anti-tamper hole as discussed. Now the sad printed circuit board.

the board pictured in Figure 5, near the 15-MHz crystal. The like changing players (CTRL-X), autoplay (CTRL-A), and setting
cost of this small chip was ludicrously high compared to the the level (CTRL-N).
8088 in its 40-pin DIP case. The original article has a long section at the end where a sample
Although the circuit diagram proudly shows a 25-pin D-sub chess game played against Intelekt is discussed and analyzed,
connector for the serial link to the terminal, and ‘RS232’ (sic) complete with move lists, exciting mini battles on the board,
printed alongside, the interface certainly does not deserve and comments. The conclusion of the article is interesting to
that name as it has only two lines effectively: RxD and TxD, no read as it hints at modifying the software for such purposes as
handshaking implemented, and 0-5 V swing instead of ±10 V. “improving the end game” and “pawn promotion to other pieces
This type of ersatz RS-232 with one BC54x was to appear in than a queen”. Readers were warned though that “ [software
many Elektor projects in later years, often causing despair mods] involve additional memory and slower response”, which
with readers using professional terminals and other equipment is amusing because the Intelekt board is prepared for fitting
designed for the real RS-232 thing and failing to communicate larger EPROMS type 2732.
with the d%^@ projects. Remember, this was long before the All in all, the 1981 article does a good job in discussing both
arrival of the MAX232 and its likes with their charge pumps the strengths and the weaknesses of Elektor’s first self-con-
taking care of the negative swing. tained and dedicated computer running Tiny Chess. For two
positive notes like “… he presents a good challenge at reason-
How good was it? ably short response times”, and “… he uses brute 16-bit force
Intelekt is not a fully graphical chess computer. After the welcome to overcome the shortcomings of a straightforward ‘mini-max’
message it does display the initial board position though on the procedure”, we read one sobering thought like “Intelekt is
terminal screen in a very primitive manner as you can expect intended as a chess opponent. He doesn’t like solving chess
from a dumb terminal like the Elekterminal with 20 rows of 40 problems on his own.”
characters. There is an extremely primitive representation of the I plan to power up our Intelekt some time and see if it still
chess pieces on the “board” using crosses and dots mostly and plays, possibly against a 32-bit opponent. But first, those blue
I believe most players would forfeit the screen altogether and tantalum capacitors have to go to prevent an explosive move
simply read the moves as text and move the relevant pieces on by Intelekt before the game begins.
a real chess board. To enter your move, you key in: 190382-B-01

• the square containing the piece to be moved;


• a space;
• the destination square;
• CR (carriage return). 4 SALE @ WWW.ELEKTOR.COM
Intelekt’s response to your move may take from 25 seconds DVD Elektor 1980 through 1989
ªDVD
www.elektor.com/dvd-elektor-1980-through-1989
(at the lowest level of skill: 1) up to, ermm, anyone’s guess...
possibly an hour at ’his’ highest level, 8. Here’s an example
of a man-machine dialogue:

01W: e2 e5 — that’s an illegal move, so:


01W: e2 e4 (CR)
01B: c7 c5
02W: (waiting for your next move)

The software has a few game configuration commands built in

108 March & April 2020 www.elektormagazine.com

190382-B EN Retronics.indd 108 06/02/2020 10:05


Win up to a
€75,000
marketing package from
Elektor and exposure at
the electronica
trade fair
COMPETE TO

LAUNCH
YOUR STARTUP AT
ELECTRONICA
2020
Is your electronics-related startup ready
to disrupt? It is time to introduce your
company’s solution to the global market!

ENTER NOW! IT’S FAST AND SIMPLE


Visit elektormagazine.com/fastforward to read the
Rules, Terms, and Conditions and to start an application.
Good luck!

FINALIST BENEFITS
First Prize = €75,000 marketing package from Elektor,
plus a booth at electronica 2022.
Second Prize = €50,000 marketing package from Elektor.
Third Prize = €25,000 marketing package from Elektor.
Get exclusive, specially priced (only €1,905!) booth
space (5 m²) at electronica 2020.
Get great exposure before, during, and after
electronica 2020. (10.-13.11.2020)

>Sign up
here
electronica Fast Forward is brought to you by
elektormagazine.com/fastforward

ADV-FAST 1FORWARD START-UP AWARD-2020-A4 vs04 (1).indd 1


Untitled-6 24-01-2020 10:07
06/02/2020 13:05
Beyond Electronics

PCB Art
Pushing the Limits of Industrial Manufacturing
By Tessel Renzenbrink

Saar Drimer creates PCB art. Combining engineering and artistic skills, Drimer produces beautiful circuit
boards that push the boundaries of traditional electronics design. He teamed up with PCB manufacturer
Eurocircuits to manufacture his designs. At first the collaboration was bumpy. Drimer was frustrated with the
limitations imposed by the industrial manufacturing process. At Eurocircuits, Drimer’s unconventional designs
earned him the nickname troublemaker. But over the years the designer and the manufacturer grew closer by
learning from each other’s point of view. I spoke to both Eurocircuits’ Managing Partner Dirk Stans and Saar
Drimer about their partnership. From these two conversations a common theme emerges. Both men are on a
mission to make electronics design more accessible and bring color to the industry.

is square or looks like an amoeba.”


Dirk Stans: “Saar’s design software
enables him to quite literally draw
like an artist. When you look at
Saar’s designs with a purely indus-
trial mindset you think: this man
is a dreamer. Not a thing he does
conforms to standards. From an
industrial point of view, it just doesn’t
make any sense. But then you start
looking at it from a different perspec-
tive: these are really nice projects
and they’re very innovative. The
collaboration with Saar gives us
an opportunity to try new things at
Eurocircuits. Over the years we’ve
learned from each other. We have
Panels of the Scarab. (Photo: courtesy Eurocircuits). to understand what he is trying to
achieve, and he has to understand
the limitations of industrial manufac-
Free-form circuit boards turing. Keeping an open mind has enabled us to make nice
To realize his ideas, Drimer wrote his own circuit board design things together that cheer you up.”
software PCBmodE [1]. “I created my own tools because the
existing ones have limitations”, says Drimer. “At the time CAD The Marking Editor
(Computer Aided Design) tools were created, limited computer Dealing with product numbers is one example of that growing
resources imposed constraints. One of them is that you can understanding. When Drimer received one of the first boards he
only make straight lines and 45-degree angles but no curvy ordered at Eurociruits, a product number was printed seemingly
tracks. And it is still very difficult to do creative free-form circuit randomly on his meticulously thought out design. He was not
boards with traditional tools. I wanted something that allows pleased. After he brought up the issue, Stans explained that the
me to put anything on the board, no matter how complex. product number was essential to full traceability, i.e. the ability to
So I created my own open source design software. And the trace every PCB and every component back to its source. Having
beauty of it is: the circuit board machinery and medium can learned the reason why, Drimer readily accepted that the indus-
do all those things without modification. It is just that people try’s traceability requirements trumped his sense of aesthetics.
haven’t used it because the designer tools did not allow them But Drimer’s remarks did give Stans an idea: what if designers
to. But the machines can do it, they don’t care if something had the freedom to place the number wherever they wanted?

110 March & April 2020 www.elektormagazine.com

191263 EN Beyond Electronics.indd 110 06/02/2020 10:09


The Monarch, with black and red solder mask colors. The Gent, a blue and green chameleon that lights up in the dark.
(Photo: courtesy Saar Drimer). (Photo: courtesy Saar Drimer).

“One of the challenges of printed circuit boards is understand- an opportunity for them to explore the industrial production
ing what the developer wants” says Stans. “The most import- environment and discover new possibilities.”
ant step is translating the CAD data to CAM (Computer Aided
Manufacturing) data. You want to filter out all possible mistakes Colour in the industry
before you take anything in production. To achieve this, we “Working with Saar brings some colour in the somewhat gray
offer developers a set of free online tools to check the design world of electronics”, says Stans. “And I don’t just mean multi-
before it goes to manufacture [2]. We decided to add a tool colored solder masks. More generally, the open mind to look
called Marking Editor that enables developers to place the at things differently and come up with original solutions. Most
product number anywhere on the board. The conversations engineers focus solely on functionality. But adding some colour
with Saar did contribute to this idea. But to say we built the to functional solutions makes it more enjoyable for everyone.
tool just for him would be bit of an overstatement. Other people Take for instance the demonstration boards given away on
had made similar requests. Some developers want to add their big trade fairs — they’re the dullest boards you can possibly
own number or add their logo or a photo to the PCB. So, we imagine. Why not brighten them up with an artistic touch? It’s
built the Marking Editor to offer all these capabilities in one a small extra that sets you apart from others. You always have
tool. But it’s true that Saar brings up issues that most devel- to take care that life remains interesting.”
opers don’t pay attention to. Or at least, they don’t complain Drimer: “Dirk cares a lot about making people enthusias-
about it. Working with Saar has made us look differently at the tic about engineering. If you want to get people excited and
production process. Adding multiple solder mask colours on a motivated, it’s helpful if the object that comes out is interesting.
single board for instance, is a new functionality that came out There is a whole spectrum of ‘interesting’ — it doesn’t neces-
of our collaboration with Saar.” sarily have to be ‘good looks’. I think the industry needs better
tools if you want to get people into electronics design. You must
Two-pass solder mask provide tools that aren’t intimidating. Tools that guide rather
Drimer’s company Boldport provides electronics craftsmanship than enforce. You shouldn’t expect people to fight through
as a service: clients can commission or license designs. But learning these incredibly hard tools. You have to remove the
it is best known for its exquisite DIY kits [3]. It has a large barrier and ease people into the world of designing electron-
offering of electronics projects such as the insect-themed kits ics. That way you enable them to design the things they want
that include a butterfly and a ladybird. A purchase comes with to create.”
an invitation to join the Boldport Club— an active community (191263-01)
that hangs out on a Discord server maintained by Drimer. The
latest edition to the bug series that Boldport and Eurocircuits
are working on is the Scarab. A beetle-shaped circuit board
with a multi-coloured solder mask.
Stans: “You can’t apply solder mask on a few specific places.
You always have to apply it to the entire surface of the board. Web Links
So, if you want to use multiple solder masks, you have to
[1] https://boldport.com/pcbmode
repeat the process several times. In an industrial environment
that means cleaning the installation entirely and filling it with [2] www.eurocircuits.com/online-smart-tools-services-
new ink. Technically, it is also quite difficult to neatly align the products/
various colour areas and keep the tolerances low. But it is an [3] https://shop.pimoroni.com/collections/boldport
interesting experience for the engineers in our factories. It’s

www.elektormagazine.com March & April 2020 111

191263 EN Beyond Electronics.indd 111 06/02/2020 10:09


productronica 2019

Start-up
Guide
8-page Supplement with Elektor Magazine
edition 2/2020

Distrelec
– Powering the Future
Education is the foundation for innovation,
and innovation needs advocates.

By Steve Herd - CEO, Distrelec

Technology is rapidly transforming the way we interact, the way Fundamental to the success of these concepts is an under-
we live and the way we work.  Its progression in the 21st century standing of the technology already available, and having the
so far has seen dramatic developments including the rollout tools, products and resources to prototype and innovate for the
of the 5G network, the Internet of Things (IoT) and renew- technology that is yet to exist. Like this, start-ups, innovators
able energy solutions predicted to save the planet. With such and visionaries are shaping future technological landscapes.
progressive technologies shaping our existence, humans are But where can motivated individuals gain the necessary knowl-
becoming increasingly aware of the opportunities for industrial edge and resources to turn an inspiring concept into an indus-
growth that these innovations give rise to, and are invested in try-changing development? 
using them as a platform to conceptualize the next generation
of groundbreaking developments. Central to Distrelec’s core proposition is igniting the internal fire
that propels solution seekers towards the latest technological

112 Fast-Forward Start-ups 2019

Extra Katern StartUp 8pag.indd 112 06/02/2020 10:19


breakthrough. In nurturing a network dedicated to propelling
the future of technology, our team is closely attuned to what
the industry needs, and who can provide it. Not only does
our community have first access to the latest technologies
designed to enhance innovation, but we also go the extra mile
and offer a high-quality, low-cost range of products with our
own brand, RND.

With RND comes a promise to provide our network with a


cost-effective, quality product assortment, allowing expan-
sion to development and maintenance possibilities. Students,
developers, aspiring solution seeker as well as large and small
businesses benefit from RND products in the production phase,
as well as when refilling workshops for research, development
and prototyping.

But it is not enough to simply offer the right tools and products.
Innovation is based on education and industry insight. Distrelec
has cultivated a vast resource and information hub on a platform The Author
called ‘KnowHow’. KnowHow is a space for engineers, indus-
Steve Herd, CEO at Distrelec, has been fundamental to
try professionals and leading manufacturers to find insights,
the delivery of Distrelec’s customer and product proposition
resources and a wealth of knowledge about the technologies
since 2015.
affecting our world. This is a platform where our network can
not only hear from the companies behind cutting-edge technol-
ogies, but also discover innovative applications used to design
Distrelec
the future of production in different fields. The KnowHow hub
seeks to uncover opportunities and inspire possibilities for all Distrelec is a leading distributor of electronics, automation
unique projects. and measurement technology with a local presence in
7 European countries. Here, Steve Herd, CEO at Distrelec,
Every notable individual in the industry has to start somewhere, discusses the ways Distrelec advocates for innovation,
and at Distrelec, we want to be the next generations’ spring- and in turn is shaping the future of technology.
board into success. By championing great ideas from the start
and aspiring to make the latest technologies completely acces-
sible to all skill sets, we demonstrate a dedication to advocating
the latest and greatest in technological innovation. Through
empowering the next generation of solution seekers, innova-
tors and industry experts, these individuals can radically alter
the future of technology alongside Distrelec.
191210-01

powered by 113

Extra Katern StartUp 8pag.indd 113 06/02/2020 10:19


They’re All Winners:
Start-ups @ productronica 2019
At the productronica 2019 trade show in Munich,
eight contestants battled fiercely to win the coveted
Fast Forward Award. Their “business cards” are
printed here in honour of everyone’s enthusiastic
presence and to show the innovative force,
persistence and sheer ingenuity of these daredevils in
the electronics industry. They’re all winners, really.

Prospeum Next Industries


Prospeum is a fledgling start-up company based in Stuttgart The company Next Industries from Milan, Italy, is active in
(Germany), which is primarily dedicated to strategic procure- the field of motion sensors or wearables and has accumulated
ment. With the help of proprietary software, support is offered know-how in AI, hardware and firmware in the area of motion
primarily for projects in the areas of collaboration, procurement detection within various IoT fields.
and tendering in the IT, engineering and servicing sectors. Next Industries develops and produces high precision data
The offers are aimed at both smaller and larger, established acquisition loggers, gateways and sensors equipped with IoT
high-tech companies. technology. These devices have Cloud connectivity over radio
to send alarms or messages.

The product scope includes a data logger or gateway family


with different types (Ni100, Ni200, Ni400, NI816, NI2400 and
Ni4866) under the collective term ’’RuggedDAQ’’ as well as
Specifically, support in the areas of project specification is two IoT-Wearables (Tactigon Skin, Tactigon ONE) for gesture
rendered by means of a Sourcing Wizard, which operates on control using integrated motion detection. The latter commu-
the basis of modern computer linguistics by using question- nicate via Bluetooth LE allowing easy connection to mobile
and-answer procedures. The process of soliciting offers is devices. Furthermore, they are equipped with programmable)
implemented as well as the collaboration of team members. buttons and can be modified and adapted to user applications
The latter facilitates the exchange between departments and via integrated Arduino-DIE.
with suppliers. Open feedback rounds can be conducted before www.nextind.eu
bids are submitted. Communication with suppliers and team
members occurs via various functions (e.g. FAQ tool or chat) “ It was a nice show-form for startups that have
centrally on solutions from Prospeum. A supplier management to invest the majority of money in R&D and
is also integrated. All in all, Prospeum enables a more optimal development. “
and efficient decision making on important project parameters.
https:// prospeum.com

114 Fast-Forward Start-ups 2019

Extra Katern StartUp 8pag.indd 114 06/02/2020 10:19


The modules are easy to assemble using standard aluminium
Touchless Automation profiles and are therefore easily adapted to existing production
The industrial outfitter Touchless Automation from Biel (Switzer- lines. A single type of cable provides data and power supply,
land) produces innovative positioning devices and manipulators thus offering unmistakable plug and play. Due to the graphi-
that can handle parts made of any material without touching cal user interface and a graphical language of the software, no
them. The Touchless Automation machines are designed for programming skills are required. Even complex applications can
manipulation, assembly and inspection of optoelectronic, MEMS be created within a few hours.
and microoptical components. The contactless technology used With this system, users can implement individual automation
is based on a combination of airflow and pressure. This enables solutions on their own without having to rely on external automa-
the manipulation of components made of any material and in tion experts. In addition, an application can be adapted to chang-
various shapes in a highly accurate way. ing production requirements after commissioning, and modules
once designed can also be reused for completely new applications.
The top product Levio is a fully automated die sorter that can https://robodev.com
perform the entire process flow from wafer to carrier in a com-
pletely contactless manner. The automatic inspection system can “ The start-up platform was well organized and
then analyze each component and place it in different carriers gave us the perfect stage to show how easy
and trays, all without touching their surfaces. This enables a automation can be realized. “
clean process with a noticeably higher yield and quality.
https://touchless-automation.ch

Meta Smart Factory


The fledgling company Meta Smart Factory from Ljubljana
(Slovenia) deals with solutions for production processes. Its
intelligent MES (Manufacturing management and Execution
System) helps manufacturers to solve production problems
and to adapt their plants to the requirements of Industry 4.0.
The offer includes the management of the entire manufactur-
ing process from production to delivery and the optimization
of production equipment.

“ Thanks to Elektor we have been able to be at


productronica and present Levio, our first fully
automatic machine. “

Robodev
Robodev is a spin-off of the Karlsruhe Institute of Technology
(Germany) and is active in the field of industrial automation.
Its main product is a modular, flexible and versatile automa-
tion kit consisting of hardware modules, a uniform cabling and The MES solution uses IoT technologies for Internet or Cloud
a software assistant. communication. Big Data Stream Processing and Machine Learn-
ing are used to analyze the cloud data and to generate meaning-
ful visualizations. Thanks to SAP/ERP integration, seamless
management of the entire production process is also supported.
The combination of hardware (Meta Industrial Panel) and
software (Meta Web and Mobile Application) is used to collect
data from machines in order to count produced products and to
record and use machine status, order status, employee perfor-
mance per order and much more useful data. The software
allows production to be controlled and monitored at every level
from planning to delivery via the Internet.
https://metasmartfactory.com



   

“ Important investors asked us to enher into
cooperation to sell our product in U.S. market
and China. “

powered by 115

Extra Katern StartUp 8pag.indd 115 06/02/2020 10:19


KONEKT
KONEKT is a project team of IAVT (Institute of Packaging
Technology) at the University of Dresden (Germany). KONEKT
is itself an acronym and stands for “Kontaktierung eingeb-
etteter Komponenten als Technologielösung”. In terms of
content, it is about the production of adaptively manufactured
3D assemblies in market-ready dimensions.

full control of the development process from early development


to prototype ordering and beyond.
www.contunity.eu

“ productronica was a great opportunity to us to


gather new leads and also to get in touch with
other high-tech start-ups and share experiences. “

The special feature of KONEKT’s solutions is that ( RF ) electron-


ics are not mounted on a circuit board, but as a compact 3D Arkite
module. This type of manufacturing not only saves space, but The newly founded company Arkite from Genk (Belgium) is
also cuts down on production steps. This is not only intended for specialized in the field of HMI (Human Machine Interface).
production in large series, but also for the automated manufac- Arkite’s Human Machine Interface transforms workstations
ture of individual individual single pieces. into a digital and interactive environment.
Simplified process sequences enable a fast, automated produc- Arkite’s HMI uses augmented reality to provide the employee
tion of various assemblies by RF-suitable connections of the with the appropriate picking and assembly instructions in real
components with simultaneously reduced process, energy and time and provides a proactive warning in case of errors. Intel-
material costs. Medium-sized companies are therefore offered ligent sensors validate the correct execution of picking and
the opportunity to establish new business fields through Rapid assembly tasks, ensuring quality and good performance by
Electronic Manufacturing without high set-up costs. Within the avoiding human error. Modern technology guides employees
scope of the project, KONEKT GmbH also exploits the “Packaging through their work without errors, thus not only increasing
-as-a-service” commercially. efficiency but also improving the flexibility and quality of the
www.avt.et.tu-dresden.de/forschung/projekte/konekt

“ Our pro-active strategy to engage with the


audience proved to be the decisive factor for
our very positive feedback. “

Contunity
The start-up company Contunity is a spin-off of the Technical
University of Munich (Germany) and is active in the field of
electronics development. Automation processes from software
development were adapted to the requirements of electronics assembly processes.
production.
Manuals, checklists or hand-written protocols are a thing of the
Contunity’s B2B SaaS platform automates the complete past with Arkite’s HMI. The HIM software’s user-friendly inter-
electronics development process from functional description face allows engineers to create projects without programming
and component selection through to mechanical dimensions and knowledge. The system is able to integrate into the customer’s
prototyping. Circuit diagrams and board layout are generated at ecosystem, incorporating the existing workstation environment
the push of a button. Complex algorithms and AI reduce devel- and securing important aspects of the process.
opment time and time-to-market by up to 90%. In addition, www.arkite.be
know-how barriers are lowered, and existing electronics IP and
development knowledge can be exchanged across projects, “ The show was an eye-opener for discovering the
locations and times. The fully integrated solution can be fully future of electronics production. “
integrated into CAD tools of the user’s choice and so provides 191253-01

116 Fast-Forward Start-ups 2019

Extra Katern StartUp 8pag.indd 116 06/02/2020 10:19


Fast Forward Award

By Clemens Valens
Finals
Day One of the Fast Forward Award finals at productronica The names of the lucky three contestants were announced at
2019 saw the pitching competition. Each of the eight finalist the beginning of Day Three:
start-ups had exactly five minutes to present themselves, their • Konekt – 3D manufacturing, miniaturization and rapid
product and their business plan. A three-headed Jury consist- prototyping;
ing of professionals active in the electronics industry watched • robodev – easy to set up and program modular
and listened carefully, made notes and asked critical questions. automation solution;
On Day Two each Jury Member interviewed the candidate start- • Touchless Automation – moving small objects without
ups to gain a deeper insight into their offerings and potential. touching them.
After adding in the observations and results from Day One,
the three most promising start-ups were selected to compete These three contestants had to pitch once again in a final
on Day Three for the Grand Prize, a marketing budget of no effort to convince the Jury. After a short deliberation, the Jury
less than €25,000 (€45,000 in total). announced the winner: Touchless Automation! Konekt was
Choosing these three ‘best’ candidates turned out to be a tough runner-up, robodev came in third.
job for the Jury as all eight finalists had presented high-quality
and well thought-out projects. There could have been eight Well done and congratulations to all!
winners if the rules had allowed it. 191233-01

powered by 117

Extra Katern StartUp 8pag.indd 117 06/02/2020 10:19


Successful Spectacular Performance
productronica 2019 for Ersa
Strong interest in Weller‘s smart soldering solutions at productronica
Global, Ahead, Sustainable
Once again, Weller can look back on a successful presenta-
tion at productronica 2019. As a globally active company,
productronica gives us access to international target groups As the Number 1 system supplier, Ersa took up 600 square
and is a great opportunity to network further with our metres with its trade fair stand in order to be able to
existing customers. present its uniquely comprehensive range of products and
The digital transformation is in full swing. Mobile and cloud services in an appropriate manner. “Even the generous 600
computing, the Internet of Things, artificial intelligence square meters were not enough to present all the innova-
and machine learning transformed our work environment tions as exhibits. Therefore, the trade fair visitors had the
enormously. Our Weller specialists took the opportunity to additional opportunity to literally immerse themselves in
give an insight into numerous new soldering solutions on our products in our Virtual Reality Studio,” said Rainer
current topics such as digitalization, automation, connec- Krauss, a completely satisfied Ersa General Sales Manager.
tivity and robotics. Highly qualified leads were generated Many visitors brought concrete questions with them to
and many interesting discussions were held. Munich, which had already been discussed further as a
We are very pleased to have received the Global Technology kind of project. With the highlights presented - from the
Award for our new active RT soldering tips at the show. By EXOS vacuum reflow soldering system to the VERSAFLOW
winning the award we have once again been able to demon- selective soldering world, from automation solutions such
strate our innovative strength. Whether in the electronics as ROBOPLACE and SOLDER SMART soldering robots to
field, medical technology or aerospace field, the industry is the new family members of the rework family HR 500, HR
moving faster and the components are steadily becoming 550 XL and HR 600/3P — Ersa once again confirmed its
smaller, more complex and more powerful. The solder- leading position in the electronics manufacturing industry.
ing industry is no different and we met these increasing Also and especially in view of the increasing share of technol-
demands. “As always, Weller makes No Compromise: we’re ogy trends such as 5G mobile communications, autonomous
offering maximum performance, power and precision with driving, e-mobility, robotics and automation, Ersa presented
our new RT Lines of tips. They also provide maximum comprehensive solutions for innovative customers.
protection to the PCBs and the components you are solder- “Despite the tense overall economic situation, we expect
ing, improving yield and ultimately reducing cost”, says Ersa and electronics production to continue to increase
Philippe Buidin, VP Marketing, Weller & General Manager, sales in view of the increasing need for digitization. Our
Weller Tools GmbH. presence here at productronica was impressive proof that
If you missed Weller’s presentation at the productronica our systems and products are at the pulse of electronics
2019 show, we cordially invite you to take a tour of our production and meet the needs of our customers all along
virtual booth at: weller-tools.com the line. Learn more: www.driven-by-kurtzersa.com
191241-01 191246-01

118 Fast-Forward Start-ups 2019

Extra Katern StartUp 8pag.indd 118 06/02/2020 10:19


Bernstein Fast Forward with
at productronica 2019 Almit
Looking back on the productronica 2019 show
At last year’s productronica electronics trade fair in Munich,
Bernstein once again impressed its booth visitors with
many new products. In addition to torque screwdriving
tools, tweezers and ESD workplace equipment, the main Productronica 2019, the internationally most important
product highlight was the multifunctional SPANNFIX 4.0. trade show for the electronic production sector, was one
Revised and with a completely new design, the company of the big annual highlights for Almit. We were proud to
presents its product innovation - currently the largest ball be a co-sponsor of the productronica Fast Forward Award.
joint vice on the market — the SPANNFIX 4.0. As pioneers of solder material, we always think one step
ahead. Regarding the development of innovative solutions,
In addition to the SPANNFIX, various torque tools were we not only concentrate on current demands of our custom-
also presented, such as the mini torque adapter with which ers, but focus on the bigger picture: how can we anticipate
any bit holder can be turned into a torque screwdriver. potential problems? Which solutions can we offer to future
The torque is predefined, so misapplications due to incor- market requests?
rectly set torque are excluded. The adapters are available
for 4 mm and ¼” with torque ranges of 0.1 - 0.6 Nm and Almit’s new MR-NH solder paste constitutes one of these
0.6 - 3.0 Nm. pioneer performances. It sets new standards concerning
the size of the area ratio: due to the special flux charac-
teristics of MR-NH, optimal results can be guaranteed
even for applications with an area ratio under 0.66. In this
way, MR-NH enables an application for nearly all stencils
and modular combinations. This offers in particular new
possibilities for the automotive sector where a high mix of
components can be found very often in modular design.
Taking a “fast forward” view into the future, the produc-
tronica 2021 show is just around the corner – and we are
already looking forward to present as well as view the
latest innovations. www.almit.de
191236-01

As a co-sponsor of the 2019 Fast Forward Award, we were


pleased about many visits of innovative start-ups and wish
the winner all the best! www.bernstein-werkzeuge.de/en
191242-01

powered by 119

Extra Katern StartUp 8pag.indd 119 06/02/2020 10:19


welcome in your
ONLINE STORE Elektor Bestsellers
1. Microcontroller Basics with PIC
www.elektor.com/19188
EDITOR’S CHOICE

JOY-iT 3-in-1 Handheld Oscilloscope, Signal Generator


and Multimeter
With so much functionality
packed in a single instrument
you will naturally ask yourself
what its main function
actually is. This is obviously
t h e o s c i l l o s c o p e, i n t h i s
case a two-channel version 2. Learning Python
with a bandwidth of 70 MHz and a sampling rate of with Raspberry Pi
250 Msamples/s (half that when using the two channels www.elektor.com/19106
simultaneously). These are very reasonable specs for 3. Raspberry Pi 4 B (4 GB)
a measuring instrument that costs just over €215 (for www.elektor.com/18964
Elektor members). Add to that the AWG (arbritrary wave
4. Elektor SDR Hands-on Kit
generator) which also has decent characteristics (sampling
www.elektor.com/19041
rate of 250 Msamples/s) and an autoranging multimeter
with its own dedicated inputs. What more do you want? 5. The Ultimate Compendium
of Sensor Projects
www.elektor.com/19103
Harry Baggen, (Elektor Labs)
6. The State of Hollow State Audio
www.elektor.com/19170
www.elektor.com/ad407-hdmi-digital-microscope-with-7-lcd-screen

Elektor Ultimate Sensor Kit IoT Home Hacks with ESP8266 SDR Hands-on Book

This bundle consists of a high-quality sensor kit and There are many so-called ‘Arduino compatible’ platforms on Elektor’s SDR-Shield (SKU 18515) is a versatile shortwave
comprehensive project book. It has been specifically developed the market. The ESP8266 – in the form of the WeMos D1 Mini receiver up to 30 MHz. Using an Arduino and the appropriate
to enable use of sensors across multiple open-source Pro – is one that really stands out. This device includes WiFi software, radio stations, morse signals, SSB stations, and
microcontroller platforms including Arduino, Raspberry Pi, Internet access and the option of a flash file system using up digital signals can be received. In this book, successful author
and ESP32. The bundle contains a total of 40 different sensors to 16 MB of external flash memory. Furthermore, there are and enthusiastic radio amateur, Burkhard Kainka describes the
that are applied in multiple projects. All described projects are ample in/output pins (though only one analogue input), PWM, modern practice of software defined radio using the Elektor
supported with software examples. I²C, and one-wire. Needless to say, you are easily able to SDR Shield. He not only imparts a theoretical background but
construct many small IoT devices! also explains numerous open source software tools.

Member Price: €71.96 Member Price: €31.46 Member Price: €26.96

www.elektor.com/19104 www.elektor.com/19158 www.elektor.com/18914

120 March & April 2020 www.elektormagazine.com

EN store 02-2020.indd 120 06/02/2020 10:21


SHOPPING BOOKS CD/DVD DIY PROJECTS DEVELOPMENT TOOLS SALE

Explore the Raspberry Pi


in 45 Electronics Projects
(3rd Edition)
The completely revised 3rd edition describes 45 exciting and
compelling projects, such as a flashing lights, driving an electromotor,
processing and generating analog signals, a temperature control and
a lux meter. More complicated projects are also included, such as a
motor speed controller, a web server with CGI (Common Gateway
Interface), and client-server applications.
After a short introduction to the Raspberry Pi you proceed with
installing the required software. The SD card that can be purchased
in conjunction with this book contains everything to get started
with the Raspberry Pi. The book continues with a concise

NEW
introduction to the Linux operating system, after which
you start programming in Bash, Python 3 and Javascript.

Member Price: €31.46


www.elektor.com/19190

Microcontroller Basics with PIC The State of Hollow State Audio Learning Python with Raspberry Pi

In this book the author presents all essential aspects of Audio tubes are currently experiencing a comeback, especially This book is about teaching the Python programming
microcontroller programming, without overloading the in the music and high-end audio industry. This new book language using the Raspberry Pi 4 computer. The book makes
reader with unnecessary or quasi-relevant bits of information. provides answers to the following questions, among others: Do an introduction to Raspberry Pi 4 and then teaches Python
Having read the book, you should be able to understand as tubes produce better sound and how do hollow-state circuits with the topics: variables, strings, arrays, matrices, tuples,
well as program, 8-bit microcontrollers. The introduction work? How do you design hollow-state audio circuits? Can lists, dictionaries, user functions, flow of control, printing,
to microcontroller programming is worked out using you recreate some of the classic hollow-state audio devices keyboard input, graphics, GUI, object oriented programming
microcontrollers from the PIC series. for modern listening rooms and recording studios? How can and many more topics.
you intelligently modify hollow-state amplifiers to your taste?

Member Price: €31.46 Member Price: €31.46 Member Price: €31.46

www.elektor.com/19188 www.elektor.com/19170 www.elektor.com/19106

www.elektormagazine.com March & April 2020 121

EN store 02-2020.indd 121 06/02/2020 10:22


PLAY & WIN

Hexadoku The Original Elektorized Sudoku


Traditionally, the last page of Elektor Magazine is reserved for our puzzle with an electronics slant: welcome
to Hexadoku! Find the solution in the gray boxes, submit it to us by email, and you automatically enter the
prize draw for one of five Elektor book vouchers.

The Hexadoku puzzle employs numbers in the hexadecimal thicker black lines). A number of clues are given in the puzzle
range 0 through F. In the diagram composed of 16 × 16 boxes, and these determine the start situation.
enter numbers such that all hexadecimal numbers 0 through
F (that’s 0-9 and A-F) occur once only in each row, once in Correct entries received enter a prize draw. All you need to do
each column and in each of the 4×4 boxes (marked by the is send us the numbers in the gray boxes.

Solve Hexadoku and win!


Correct solutions received from the entire Elektor readership automatically
enter a prize draw for five Elektor Book Vouchers worth $60.00 / £45.00
/ €50.00 each, which should encourage all Elektor readers to participate.

Participate!
Ultimately April 5 2020, supply your name, street address
and the solution (the numbers in the gray boxes) by email to:
[email protected]

Prize Winners
The solution of Hexadoku in edition 1/2020 (January & February) is: C7A13.
The book vouchers have been awarded to: Francis Biette (France); Annie Tigchelaar (Netherlands);
David Turnbull (UK); Sabine Lamprecht (Germany); Gabi Kirchhof (Germany).
Congratulations everyone!

The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.

122 March & April 2020 www.elektormagazine.com

190377-B EN Hexadoku.indd 122 06/02/2020 14:12


Defend Your IP, Brand
and Revenue Stream
Security Solutions That Are Simple to Add, Hard to Break

Let Microchip help you secure not only your designs, but your brand and revenue
stream as well. With two decades of security experience, our experts take the
fear out of integrating security and remove the need for costly in-house expertise.
Combine that expertise with our secure factories and provisioning services and
you’ll understand why many top companies trust Microchip’s experts to help guide
their designs.

From secure encryption to trusted execution environments, find the security


implementations that meet your unique needs with our wide range of hardware-
and software-based solutions.

Secure your design at www.microchip.com/Secure

The Microchip name and logo and the Microchip logo are registered trademarks of Microchip Technology Incorporated in the U.S.A. and other countries. All
other trademarks are the property of their registered owners.
© 2019 Microchip Technology Inc. All rights reserved. DS00002767A. MEC2236Eng01/19

Untitled-7 1 06/02/2020 10:24


PROTEUS
DESIGN SUITE
High Speed Design Features
• Differential Pair Routing • Automatic Phase Matching
• Length Matching / Net Tuning • Use for USB, Ethernet, DDR3 etc.

Performance without the price premium.


Find out more and
configure your package on our
website or call the team on (+44)1756 753440

Untitled-2 1 06/02/2020 08:10

You might also like