Elektor 05-06 2022
Elektor 05-06 2022
95
*
1
*
IN
CE 196
ESP32-C3
I oT Project
A Wi-Fi Button
and Relay
p. 6
FOCUS ON
Internet
of Things
p. 54 The Challenges in Bringing
IoT Solutions to Market
Worries Around Security, Scalability,
and Competition
p. 12
IoT Cloud à la Arduino p. 74
Dragino LPS8 Indoor
Convenient Solution for Gateway
Application Developers Speedy LoRaWAN Gateway Setup
The Elektor web archive from 1974! An online Elektor LABs account, with
6x Elektor magazine (Print) access to more than 1000 Gerber files
9x Digital (PDF) including and a direct line of communication with
Elektor Industry (EN) magazine our experts!
A 10% discount in our web shop and Bring a project to publication or even sell
exclusive offers it in our shop
Elektor’s annual DVD-ROM
www.elektor.com/member
colophon editorial
Elektor Magazine,
English edition
Jens Nickel
Edition 3/2022 International Editor-in-Chief, Elektor Magazine
Volume 48, No. 513
May & June 2022
www.elektor.com
www.elektormagazine.com Writing an editorial means always being a few weeks ahead of your publication date. By the
time you read these lines, I very much hope you have already seen the first signs of peace in
Ukraine. And perhaps the discussions about COVID-19 measures and high incidence rates
Elektor Magazine, English edition
is published 8 times a year by
will have died down.
Elektor International Media What does the news (much of it bad) from around the world have to do with electronics? In
the last few months, we have all had to realize that our world is highly interconnected and
Head Office:
Elektor International Media b.v. globalized. Prior to the recent geopolitical issues and the COVID-19 crisis, things seemed to
PO Box 11 be going well for a few years in row! Even large corporations like the international carmakers
6114 JG Susteren had become so accustomed to the comfortable situation that few had a Plan B in the drawer
The Netherlands just in case a global catastrophe emerged.
Phone: (+31) 46 4389444
Once the current crises have been overcome, many companies will certainly not make the
Memberships: same mistakes again. Increased product availability and shorter transport routes — such
E-mail: [email protected]
things will take on a higher priority than simply securing the lowest price. This will also be
www.elektor.com/memberships
good for the electronics industry.
Advertising & Sponsoring: In many areas of electronics, the steady upswing has weakened, but things are still moving forward
Raoul Morreau
— for example, in the Internet of Things, which is the main topic for this issue. My colleague
Phone: +31 (0)6 4403 9907
E-mail: [email protected] Robert van der Zwan has put together some interesting infographics about this on page 60. Of
course, we have a variety of background articles and interesting projects for you as well!
www.elektor.com/advertising We’ll stay tuned.
Advertising rates and terms available on request.
Regulars FOCUS
68 Narrowband Internet of Things
Standards, Coverage, Agreements, and Modules
3 Colophon
FOCUS
40 Developer’s Zone 86 Circuit Simulation with TINA Design Suite & TINACloud
Tips & Tricks for Testing Components Sample Chapter: Sinusoidal Oscillators
111 Ethics
Industry
The 10-Year Smartphone
114 Hexadoku
The Original Elektorized Sudoku
FOCUS
54 The Challenges in Bringing IoT Solutions to Market
FOCUS
60 Infographics
FOCUS
Facts and Figures About the Internet of Things
12 IoT Cloud a la Arduino
Convenient Solution for Application Developers
32 MonkMakes Air Quality Kit for Raspberry Pi Dual Geiger-Müller Tube
Measures Temperature and eCO2
Arduino Shield
FOCUS A High-Sensitivity
Radiation Sensor
18
4 May & June 2022 www.elektormagazine.com
Light Switch DeLux
A Solution for High-Precision Light-
Controlled Switching
50
FOCUS
83 LoRa GPS Tracker Update
Receive and Show Location Using a Raspberry Pi FOCUS ON
Internet
of Things
lektor May & June 2022 5
training
The IoT is not a closed book of hidden secrets. Powerful controllers like the new ESP32-C3
and newbie-friendly development environments like the Arduino IDE make developing
small projects a piece of cake.
When we speak of the Internet of Things (IoT), we acknowledge that Select the Components
more and more things in our daily lives are becoming connected to As with all projects, the right components must first be selected.
the Internet. It starts with lights, heaters and sensors in the home This is where the ESP-C3-12F kit (Figure 1), which is available in the
and continues with cars, traffic lights, shipping containers and much Elektor Store, comes into play. This board features a Wi-Fi-enabled
more. Small network-capable components are installed in each of the ESP32-C3 microcontroller from Espressif. The ESP32-C3 is a replace-
connected things, which enable exchange of information. ment for the proven ESP8266. In addition to a modern CPU core, the
chip offers a good mix of integrated peripherals that are both begin-
The best way to get to know how to connect your own applications ner-friendly and powerful. (Refer to our review about the ESP32-C3
to the IoT is to start out with a simple practical example. In this article [1].) An overview of the integrated hardware blocks are depicted in
we create a link between a Wi-Fi enabled push button and a Wi-Fi Figure 2. In addition to the ESP32-C3, a RGB LED and a USB serial
enabled relay; the relay can be activated remotely by the button and converter are also integrated on the board. We will need two ESP-C3-
reports its status back to the push button. 12F kits for our project.
In addition to the ESP-C3-12F kits, a sensor and an actuator are also Pi Zero 2 W bundle (box). For our purposes, it doesn’t however need
required. That’s where the Elektor 37-in-1 sensor kit comes in handy, to be a Raspberry Pi. Any PC running a Linux distribution such as
this kit includes 35 sensors (the original version had 37, but two of them Ubuntu [3] will also prove perfectly adequate.
contained mercury and have since been omitted on safety grounds). An
overview of the sensors of the kit (Figure 3) can be found in Figure 4 Before we get into the project, let’s take a closer look at how the control
and the information document [2]. First of all, we will take the Joystick and exchange of data takes place in this setup.
module and use its push button feature to provide control input to the
system. The relay module can now connected to the other microcon- MQTT
troller board and acts as the actuator in the system. A few (female/ Any IoT device, whether it’s a sensor or actuator, needs to transfer data.
female) flying leads are required to connect the modules. These are For this purpose, we can either go the long way around by developing
included in the Pimoroni “Mini Breadboards & Jumpers” maker kit. our own proprietary communication protocol or we can use standard,
(See the Related Products box.) established protocols. One such system which has become widespread
is MQTT. Originally, it was an acronym for “Message Queuing Telemetry
We also need a computer, such as a Raspberry Pi, which will act as Transport,” but as the system developed, the title no longer accurately
a local server for the IoT devices to exchange their data. An original described its function. In 2013, it was officially decided that MQTT
Raspberry Pi version 1 would in fact do the job, but we recommend would be a label [4].
at least a Raspberry Pi 2 for this application. On-board Wi-Fi was not
included until Raspberry Pi model 3B, so to use earlier versions, a The MQTT protocol takes care of the exchange of messages using a
simple Wi-Fi dongle or Ethernet cable will also be required. If you need broker (server) without specifying what the messages look like. You
to buy a small but powerful Raspberry Pi, take a look at the Raspberry can compare this to sending a letter: the logistics and the format of
Figure 3: The Elektor 37-in-1 sensor kit. Figure 4: A whole bunch of sensors and actuators are included.
USB USB
220017-011 220017-008
Figure 8: Circuit diagram of the ESP32-C3 and Joystick. Figure 9: Circuit diagram of the ESP32-C3 and Relay.
board. Note the relay board is powered from the 5 V supply pin. These three #defines at the beginning of the Arduino sketch must
Figure 10 shows all the modules and controllers connected together. be adjusted for your own network. The SSID and PASSWORD of your
network need to be entered in the appropriate position between the
Software Setup quotation marks. The IP address of the Node-RED computer in its own
The source code for this project is also available on GitHub [12]. The network is specified for the MQTT server. Once both sketches (for the
sketches for the two ESP32-C3 controllers can be downloaded from relay and for the button) have been edited they can be uploaded to the
there. It will be necessary to enter some information about your local respective ESP32-C3. Both ESP32s can then be powered up and the
network to these files before we can upload them to the ESP32s. large LED on each board should start flashing white. This indicates
Everything must be set appropriately so that the two controllers can that the ESP32-C3 is attempting to connect to the Wi-Fi network.
exchange data with the local MQTT broker. For this purpose, #define The LED should then light continuously when a board successfully
directives are present at the beginning of the two Arduino sketches: connects. The LED colour will depend on the board’s function: the
board with the relay connected will light up white. The board with the
#define WIFI_SSID "changeme" pushbutton connected will light up red (relay off) or green (relay on)
#define WIFI_PASS "changeme" — i.e., according to the relay status.
#define MQTT_SERVER "test.mosquitto.org"
This now shows that both ESP32-C3s are operating successfully. interested in a certain topic will receive the messages sent under this
Pressing the button will change the state of the relay and the colour topic. The sender, on the other hand, does not have to worry about
of the LED will change from red to green or vice versa. The button distribution. It only sends (“publishes”) its messages to the broker.
of one ESP32-C3 can thus successfully control the relay of the other
ESP32-C3, and it also receives feedback on the status of the relay. The ESP32-C3 with the relay subscribes to the BUTTON topic in its
Time to celebrate. Your first IoT application is running! But how exactly code using client.subscribe(MQTT_TOPIC_IN); , where MQTT_
does the data exchange work? TOPIC_IN is “BUTTON” here. Every time a message is triggered by the
button, it goes to the MQTT broker. It is then delivered to the ESP32-
To the Relay and Back Again C3 with the relay, causing the relay to toggle.
First, let’s look at the path a button press takes to the relay. Figure 11
shows how the message is packed layer by layer and then sent to When the relay changes it state, its controller sends a message to the
the broker via Wi-Fi. In the source code, this is done using client. MQTT broker under the topic “RELAIS” (RELAY), in which the current
publish(MQTT_TOPIC_OUT, (const uint8_t*)buffer, n, true);. state (whether on or off) is included. The ESP32-C3 with button, in turn,
has subscribed to the “RELAIS” topic at the MQTT broker and thereby
Why is this function called publish and not simply send? This is due receives the message with the new status, as shown in Figure 12. This
to the way the data is later distributed in MQTT. On an MQTT broker, causes the LED colour to be set to red or green.
messages are distributed based on a topic; in this case, the topic
(MQTT_TOPIC_OUT) “BUTTON”. When connecting to the MQTT broker, The nice thing about this structure is that a second button and control-
the client (i.e., the ESP32-C3 of our relay) can indicate which topic is ler can also be integrated into the network to send messages under
of interest (i.e., to “subscribe” to this news channel). the topic “BUTTON” — just like the first button. The ESP32-C3 with
the relay will then respond to the control data from either button and
Each participant who has informed the MQTT broker that they are carry out the appropriate switching operation. If you’re interested in
Questions or Comments?
Do you have any technical questions or comments about this
article? Email the author at [email protected] or
contact the Elektor team at [email protected].
WEB LINKS
[1] M. Claußen, “Getting Started with the ESP32-C3 RISC-V MCU,” Elektor 1-2/2022: www.elektormagazine.com/210466-01
[2] Elektor 37-in-1 Sensor-Kit Documentation: www.elektor.com/amfile/file/download/file/1170/product/6171/
[3] Ubuntu Linux Distribution: https://ubuntu.com/
[4] OASIS MQTT TC Minutes from 25.04.2013:
www.oasis-open.org/committees/download.php/49028/OASIS_MQTT_TC_minutes_25042013.pdf
[5] JSON.org: www.json.org/json-de.html
[6] Mozilla Web Docs: Working with JSON: https://developer.mozilla.org/en-US/docs/Learn/JavaScript/Objects/JSON
[7] Node-RED: https://nodered.org/
[8] Node-RED Installation on the Raspberry Pi: https://nodered.org/docs/getting-started/raspberrypi
[9] Node-RED Installation on a PC: https://nodered.org/docs/getting-started/local
[10] Arduino IDE download: www.arduino.cc/en/software
[11] Espressif Arduino-ESP32 Installation instructions: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
[12] Elektor GitHub Repository: https://github.com/ElektorLabs/220017-ESP32-C3-and-IoT_First-steps
[13] R. Aarts, “ESP32 Weather Station,” Elektor 1-2/2019: www.elektormagazine.com/magazine/elektor-70/42351
[14] M. Claußen, “A Monster LED Clock with Wi-Fi and Temperature Display,” Elektor 5-6/2019:
www.elektormagazine.com/magazine/elektor-96/42659
[15] J. Nickel, “My Journey into the Cloud,” Elektormagazine.com:
www.elektormagazine.com/search?query=My+journey+into+the+cloud
Source: https://dronebotworkshop.com
The Arduino IoT Cloud offers IoT application platforms such as Amazon AWS IoT Core, Microsoft IoT Hub, or
developers a convenient solution for Yandex IoT Core. If you have large numbers of devices and data to
manage, these more established IoT cloud services are the way to go.
implementing a cloud back end without
having to struggle with MQTT. Curious? Let’s At the introduction of the latest incarnation of The Arduino IoT
take a look. cloud, Massimo Banzi, CTO at Arduino, expressed his ambitions for
the platform saying that: “Arduino now offers a complete platform
Lots of microcontroller applications nowadays involve an Internet with the MKR family; providing a streamline way to create local IoT
of Things (IoT) application where information is disseminated via nodes and edge devices. These use a range of connectivity options
IoT cloud services and an MQTT broker. Creating this type of appli- and compatibility with third-party hardware, gateway and cloud
cation using a local development environment like the traditional systems. The Arduino IoT Cloud allows users to manage, configure
Arduino IDE can sometimes be awkward. The Arduino Cloud and connect, not only Arduino hardware but also the vast majority
shifts the IDE up into the cloud so that your browser becomes a of Linux-based devices — truly democratising IoT development.”
window into the IDE. We tried it out by sending a variable value
to the cloud to make an LED flash on the bench. Then we tried Its support of the MKR IoT-targeted range of Arduino boards and
to break it. some other popular third-party boards is a welcome addition and
would make many IoT system developers give this accessible devel-
The basis of all IoT devices is of course the Thing. In the Arduino opment platform a second look.
IoT Cloud development environment, the Thing is a virtual object
that exists in the cloud. In the real world, it is as an object such as Setting Up the Hardware
a server, a controller board, or a similarly “intelligent” device [1]. Only the most basic plan of the four possible versions of the Arduino
Here your Thing is built in the cloud using an online editor to write Cloud is free to use. You can check out the various plans and their
a Sketch describing how it should behave and respond by using a features in Figure 1 and decide which package best meets your
whole range of Variables. needs. Of interest to the maker community generally is Arduino
Cloud’s support of third-party boards, such as the popular ESP8266
Who Will Use the Arduino IoT Cloud? and ESP32 family of devices (Table 1), and the list of compati-
Before we begin, it’s important to acknowledge that the Arduino ble platforms [2]. Driver libraries also allow various Linux-based
IoT Cloud is not an alternative for other dedicated cloud computing systems to upload and download information to the Arduino cloud.
An Arduino Nano RP2040 Connect module is used here as the target
board to test the Arduino Cloud functions. This board is based on Table 1: Boards supported by the Arduino Cloud
the RP2040 microcontroller from the Raspberry Pi Foundation
and includes a u-blox Wi-Fi module. Before setting up the Arduino WLAN
cloud, the board is connected to a computer via a USB cable. > MKR 1000 WiFi
> MKR WiFi 1010
First, we need to visit the website [3] and apply for a new Arduino > Nano RP2040 Connect
account. For our purposes, we will stick to the basic free plan which > Nano 33 IoT
is explicitly aimed at newcomers to the system. First, we click on > Portenta H7
the Create Thing button to create a new thing. LoRaWAN
> MKR WAN 1300
The overview in Figure 2 now shows the configuration of the three > MKR WAN 1310
basic components of the development environment. I have removed GSM/NB-IoT
a previous Arduino account and all configuration parameters so that > MKR GSM 1400
I start with a fresh device setup. The following steps are performed > MKR NB 1500
on a machine running Windows 10, but the process is identical on ESP32/ESP8266
the Ubuntu Linux environment and I have found that hardware > wide range of third-party boards
detection usually works better under Unix.
Now we can click on the shortcut icon in the Device section and
choose to Set Up an Arduino Device. A few seconds after clicking
this option, the back end will point out that the component called
Arduino Create Agent is missing. Click the Download button to
download the software and install it in the normal way.
Note that Create Agent is browser-specific: if you install under
Chrome, you will need to reinstall. Any firewall warnings that pop
up should be acknowledged. Make sure that you allow access to
Figure 2: The IoT Cloud leads the developer step by step through to the goal.
private and public networks alike. As a result, the Arduino Create code and sends it to the connected RP2040 using the Arduino Cloud
Agent is now resident in your taskbar — in some cases it may need Agent. If the compiled code is delivered successfully, the message
to be called up again from the start menu but that now completes "Untitled_dec25a uploaded successfully on board Arduino Nano RP2040
the driver installation. Connect (/dev/ttyACM0)” is displayed.
In the next step, we will refresh the view until the Arduino cloud Now after the obligatory Reset, the RP2040 will start phoning
informs us that our Nano RP2040 Connect board has been recog- home using its Wi-Fi transmitter. After a while and pressing F5
nized. Next, click the Configure button to launch the configuration several times the device will appear with “Status: online” as shown
wizard — it will ask you to enter a ’friendly” name and then initial- in Figure 3.
ize the target system’s secure element with the basic communi-
cations software. If you chose to subscribe to one of the more comprehensive Arduino
Cloud plans, you can receive software updates directly via Wi-Fi;
Problems sometimes arise during network provisioning under but for our simple experiments using the free plan, a wired connec-
Windows. The more reliable and successful method is to do this tion is necessary.
using Linux instead. Incidentally, the Network section is not
automatically enabled by the Arduino cloud. It is only available A Closer Look
when you create one of the variables intended for data exchange. The basic editor tool of the Sketch tab is not so useful, but by clicking
on the Open full editor button, we get a fully-fledged cloud-based
We can now click on Variables, to open a dialog and add a new IDE that allows us to edit smaller projects more comfortably. First,
variable. First we assign the name ledIntenBool and assign Boolean let’s look at the contents of the thingProperties.h file, which contains
in the data type field. Funnily enough, the Arduino cloud not only structural elements of the sketch.
supports C programming units, but also implements wrappers
around real world variables. First, we see the following declarations that provide the elements
required for Wi-Fi access:
If you want to limit yourself to C only, we recommend selecting the
Basic Types option. Theoretically, we could then make settings in const char SSID[] = SECRET_SSID; // Network SSID (name)
the Variable Permission and Variable Update Policy fields, but the const char PASS[] = SECRET_PASS; // Network password
default settings will be sufficient for our purposes, which is why // (use for WPA, or use as key for WEP)
we now close the dialog. In the next step, we then create a field of
the Integer Number type, to which we give the name ledIntenInt. The Arduino cloud takes care of entering the name and password
using the settings already entered in the Network section. The next
Preparing the Code part contains the following two variables the names of which should
After creating the variables, red dots in the Sketch tab, indicate be familiar from their declaration in the Variables section:
changes to the program structure. Now it is possible to click on the
shortcut icon in the Network section to enter the Wi-Fi settings. My int ledIntenInt;
preference is to enter the values u sing a command line tool such bool ledIntenBool;
as iwlist on a Linux machine and then copy them to the clipboard.
The Arduino cloud implements the variables “in the back end" as
In the next step, we switch to the Sketch tab and click on the Verify standard C variables equipped with additional properties. These
and Upload button. The Arduino Cloud then starts compiling the properties can be found, among other things, in the initProperties
A Convenient Option
It’s clear that the Arduino IoT Cloud is still a work in progress and
is under constant development and improvement. It does however
have great potential and offers the IoT application developer a
convenient and low-threshold option for implementing a cloud
back end without having the need to struggle with MQTT and Co.
Figure 8: The Scheduler is configured using the Dashboard. Despite the odd hiccup I can thoroughly recommend this product!
210550-01
The time parameters for this variable are configured via the Contributors
dashboard. The settings page shown in Figure 8 show the control Idea, Illustrations and Text: Tam Hanna
elements provided for this purpose. Editor: Rolf Gerstendorf
Translation: Martin Cooke
In the following step, we need to take care of the “local” processing Layout: Harmen Heida
of the values c ontained in tamsSchedule:
void setup() {
. . . Questions or Comments?
Do you have any technical questions or comments about this article?
pinMode(LED_BUILTIN, OUTPUT); Contact the author at [email protected] or the Elektor
pinMode(LEDB, OUTPUT); team at [email protected].
pinMode(LEDR, OUTPUT);
}
void loop() { WEB LINKS
ArduinoCloud.update(); [1] Digital twin: https://en.wikipedia.org/wiki/Digital_twin
// Your code here [2] Boards supported by the Arduino Cloud:
if(tamsSchedule.isActive()){ https://bit.ly/3t8Vl3W
digitalWrite(LEDR, HIGH); [3] Arduino Things: https://create.arduino.cc/iot/things
}
else{
digitalWrite(LEDR, LOW);
}
RELATED PRODUCTS
}
It is important here that the “writing out” of the information > Arduino MKR WiFi 1010 (SKU 19935)
supplied in tamsSchedule is the exclusive task of the developer. The www.elektor.com/19935
cloud is just limited to periodically updating the value contained
in tamsSchedule. The continual polling procedure shown here > Arduino Nano RP2040 connect (SKU 19754)
www.elektor.com/19754
in the loop structure may not be optimal from a resource point of
view, but it works without problem. The program can now be sent > Arduino Nano 33 IoT (SKU 19937)
to the Arduino where you can watch for the periodic red flashes www.elektor.com/19937
coming from the RGB LED.
tor-labs.c
ek
om
El
BEST OF
E le
kt
m
o r-la b s.c o
With two tubes for increased sensitivity, this Geiger-Müller tube shield can turn your Arduino
Uno into an instrument for measuring and recording nuclear radiation. It can even be combined
with a Dragino shield for LoRa-connectivity. Collect radiation data in the “field” — and get access
to it from all over the world!
Like many other hobbyists, I have always been fascinated by radio- > Geiger-Müller Tube. The tube has two terminals and is filled
activity and the sensors to detect it. Geiger-Müller tubes [1] are a with a low-pressure gas mixture. When biased with the appro-
common and relatively inexpensive way to measure radiation. My priate voltage the gas will ionize and briefly conduct electricity
“GRAD” project is a complete solution for radiation counting in an every time it is hit by radiation. Depending on the tube type it is
Arduino shield form factor. Its main features are dual tube support to possible to detect alpha, beta and gamma particles. The SBM-20
increase sensitivity and very low power consumption. used in the GRAD is sensitive to gamma and high energy beta
radiation.
Introduction to Geiger-Müller Counters > High-Voltage Power Supply. The tube must be operated in the
Every Geiger-Müller counter requires four essential functional blocks. so-called Geiger Plateau. This is a region where the pulse count is
470
470
8 6
RESERVED 13
POWER
3 1
GND 8 220µ
point is around 400 V. 2
GND J4 6V3
DIGITAL (PWM)
1 8
VIN 7
7
J2 6 R20
of the tube are very short and 1
2
A0 5
6
5
470
ANALOG IN
A1 4 R18
3 ICSP 4
A2 3 470
RESET
SPK2
detector conditions the signal
MISO
4 3
SCK
A3 2
5 2 * *
so it can be easily counted by
A4 TX 1 SPK1
6 1
A5 RX 0
GND
MOSI
5V
> Pulse counting. Pulses are
counted over a fixed time inter- HV VCC VCC VCC VCC HV
330k
5M6
5M6
per minute) value. This can be
U1E U1F
C6 R11 22p 22p C7
R16
11 10 12 13
roughly converted to a dose
330k 1 1 330k
100p 100p
rate by using the parameter on * see text 1000V GM1 GM2 1000V
+ – – +
5M6 5M6
the tube datasheet. An Arduino R3 Geiger Tube 400V Geiger Tube 400V R13
logging. R1
330k
D1 L1
4mH7
D2 RGP02-20
Power Supply
100V
D3
There are many circuits on the
U1B
100V
3 4
D4 1
web for Geiger-Müller tube power 100V
U1C U1D Q2
supplies. Many are boost convert- * C16 * C3 * C15 * C2 D5 100V 5 6 9 8
C4 C14
14
C1 C12
1 1 U1
ers built around the 555 timer, some 4n7 4n7 4n7 4n7 R5 10n 1µ 7 220µ 100n
1000V 1000V 1000V 1000V U1A
open loop, some with feedback.
MJ13003 6V3
10M
R4 R6
Q1 1 2
2M2 1 1k
The open-loop designs were not
considered as they require tuning R8 C5
2M2
2N3904
Tube Options
The board is designed to work with 105-mm Soviet SBM-20, STS-5
and the Chinese J305 or the 90-mm J305 and M4011. Any other 400-V
to visually show when ionizing radiation hits the respective tube. Pin tube will also work with some customized tube mounting. In case of
D4 is connected to piezo speaker SPK1 to provide audible feedback. custom mounting, to minimize parasitic capacitance, it is important
to keep the positive wire as short as possible. For tubes requiring
Finally, digital output D5 is connected to a low-pass filter formed by different voltages, the Zener diode(s) should be changed to obtain the
R20, R21 and C20 to connect a simple analog 10 mA panel meter (J9). required voltage. Any diode with 0.5 µA or less of leakage should work.
COMPONENT LIST
Resistors
R1,R2,R11,R14,R16 = 330 k
R3,R9,R13,R15 = 5.6 M
R4,R8 = 2.2 M
R5 = 10 M
R6 = 1 k
R7,R12,R18,R20,R21 = 470 Ω
Capacitors
C1,C20 = 220 µF, 6.3 V
C2,C3 = 4700 pF, 1000 V
C4 = 10 nF, 6.3 V Figure 3: The PCB layout.
C5 = 100 pF, 50 V
C6,C7 = 100 pF, 1000 V
C12 = 100 nF, 50 V Semiconductors U1 = 74HC14
C14 = 1 µF, 6.3 V D1 = diode 1 A, 800 V
C15,C16 = 4700 pF, 1000 V D2,D3,D4,D5 = Zener diode 100 V 1.5 W Miscellaneous
C18,C19 = 22 pF, 50 V D6,D7 = red LED 3 mm (Marked T1 and T2 GM1,GM2 = Geiger-Müller tube, e.g. SBM-20
on PCB) J1,J2,J3,J4 = set of Arduino Uno shield
Inductors Q1 = 2N3904 connectors
L1 = 4.7 mH Q2 = MJ13003 SPK1 = AC piezo buzzer, e.g. AC-1205G-N1LF
board must be modified. For the Dragino shield, R5 and J_DIO0 must be Measuring Radiation
removed. A wire should be used to connect the radio DIO0 to Arduino D7. To verify the correct function of the Geiger counter a radiation source
is required. These can be purchased online from special suppliers.
For the GRAD board R7, R12, C20 and the two LEDs should be removed. Alternatively, specific vintage items that were built using small quanti-
R21 should be replaced with a short, and a single LED should be placed ties of radioactive materials can be purchased at a thrift store or Ebay.
at the J9 site (replace the analog meter output). Common radioactive items include: uranium glass items, thorium
lantern mantles and selected colors of vintage fiestaware items.
A sketch that communicates to the The Things Network (TTN) and
posts tube counts every 60 seconds is available for download. It uses Lacking any of these, another simple way is to check the decay product
the LMIC Arduino library to drive a Dragino LoRa shield and it will of Radon captured by the air filter from an air conditioner or an air purifier
connect to The Things Network using Over The Air Activation (OTAA). (Figure 8). These have a relatively short half life (in the order of tens of
A simple Node-RED flow is used to display the data (see Figure 7). minutes) so make sure you run the AC for a couple of hours and then
measure the filter immediately. If the filter is fine enough to it will emit
radiations at a rate many times higher than background in your area.
> Arduino Uno SMD Rev3 (SKU 19938)
www.elektor.com/19938
Questions or Comments?
Do you have technical questions or comments about this article? > MightyOhm Geiger Counter Kit (incl. Case) (SKU 18509)
Email the author at [email protected] or Elektor at [email protected]. www.elektor.com/18509
WEB LINKS
[1] Geiger-Müller tubes: https://en.wikipedia.org/wiki/Geiger%E2%80%93M%C3%BCller_tube
[2] Theremino Geiger adapter (pls see three last designs on this page): www.theremino.com/en/technical/schematics
[3] This project on Elektor Labs: https://bit.ly/3giMntz
Advertisement
.2
101.6
96
127.0 m
m
m
mm
.6
.0
*RACM600-L/OF, RACM1200-V
1
76
10
Ele
lab • ktor
or
lab
t
Elek
TESTED
CO2 Guard
la b
Ele
kt
or
or l kt
a b • Ele
+3V3 +5V
K1 R6 * C2
+3V3 0R
C3*
FAN 100n
+5V
100u
+5V 50V MOD1 FAN
VIN +3V3 0 +5V C3
Vo RX R6
R7 S1
SR TX R5
S1
AOT PWM
1k5
GN D
D1
T1 HD A
LE D
GND K
C1 M OD 1
BZ1 D1 C1 R3 R2 R1 M OD 2
LE D 3 LE D 2 LE D 1
+5V
T1
BAT85 100n R4
MOD2 R5 *
1 16 R7
RST TX
0R
R1 C2
2 15 S1 S1
LED1 330R A0 RX
3 14
D0 SCL/D1 S1
R2 4 13
D5/SCK SDA/D2
LED2 330R 5 12 EL EK TOR
D6/MISO D3 A 210 043-1
6 11
R3 D7/MOSI D4 K
7 10
LED3 330R D8 GND
8 9 LED_S1
+3V3 3V3 5V +5V
WEMOS_D1_MINI
210043-001
Figure 2: PCB of the CO2 Guard.
Figure 1: Schematic of the CO2 Guard.
optional pin headers for the switch and LEDs). To mount the D1 Mini placed correctly on the screw fixings, maybe use two screws tempo-
module (MOD2), first solder the two eight-pin male headers to the rarily, the position of the notch can be marked. It’s slightly off center.
side of the module where the USB connector and most of the other
components are located (see Figure 3). We advise not using sockets No holes need to be made for the fan’s airflow; it is glued to the
on the PCB for MOD2, since there’s some force on the module when bottom side of the enclosure with super glue or epoxy adhesive
plugging and unplugging the USB connector. It’s best to solder the (Figure 3). To avoid resonance the fan should not touch the lid of
D1 Mini onto the PCB. Also, using sockets could limit airflow through the enclosure. The fan should blow air out of the enclosure. Before
the ventilation holes of the enclosure. mounting it, check the direction of the airflow by connecting it to
a 3.3…5 V power supply or check if there is an arrow on the side
When the PCB is fixed with four screws to the bottom half of the of the fan’s frame depicting the flow direction. Pay close attention
enclosure and the fan glued (see below), the sensor module can be to the polarity of the wires. The wrong polarity will damage the fan.
plugged into the corresponding sockets. Never touch the top of the (Modern ones often have some circuitry inside.)
sensor, as stated in the datasheet [2]: “Please avoid the pressure of
its gilded plastic chamber from any direction, during welding, installa- Connecting the Front Panel Parts
tion, and use. Especially never touch the air intake (white dust filter).” To connect the LEDs, only four wires are needed. The ground connec-
tion from the PCB to three LEDs on the front can be one common
The four and five pins sockets for the sensor will probably be supplied connection, simply connect three cathodes of the LEDs and use
as one 10-pin SIL socket. Cut this socket strip at the location of the one single wire.
fifth pin to get a separate four- and five-pin socket.
Make sure no wires lie on the antenna of MOD2 when the lid of the
Preparing the Enclosure enclosure is finally placed on the bottom part. Keep them as far away
Use a copy of the front panel design as a template for the correct as possible from the Wemos module, but don’t make them longer
positions for the four holes (three LEDs and the switch), and use a than necessary. Wires to the switch can be as short as 8.5 cm and
punch tool to mark the four centers. On this project’s page on Elektor the wires to the LEDs about 12 cm. With this length of the wires, you
Labs [3], there are some tips and tricks to prevent damage to the can remove the top of the enclosure and place it on its side next
case when drilling larger holes in the plastic front panel. With this to the bottom with all wires still attached. No screws are needed to
type of enclosure, pay special attention to the long pins that are used close the enclosure; four long plastic pins of the lid slide into four
to close it; they can break if not handled properly! long mounting bosses.
A notch must be made in one side of the bottom half of the enclosure Of course, feel free to create your own front panel design. You can
to access the micro-USB connector of the D1 Mini module, which use a separate blue LED and switch for instance. But be aware of
serves as the power supply for the CO2 Guard. Make sure the notch the placement of the LEDs and switch; they should not be located
is big enough for the USB-plug of your power supply. Place the D1 too close to the modules.
mini module on the PCB to mark the correct place for the notch. No
need to solder the module with the accompanying male headers Getting Firmware to the Wemos
to the PCB yet. With the module placed on the PCB and the PCB The firmware for the ESP8266 on the Wemos module is written using
the Arduino Framework, so you need the sketch and a set of libraries.
For the development of the code of this CO2 Guard, PlatformIO and
Visual Studio Code are used. Libraries, project, and upload settings
are combined so that compiling the code should not be that much
of a problem.
To install Visual Studio Code and PlatformIO, you can follow the
guide [4] PlatformIO provides. After the installation, you need to
grab the source code from the Elektor GitHub Repository. If you
Figure 6: Small ant head shows more options.
are in doubt how to get the code, have a look at the video that our
colleague Clemens Valens [5] created. Also, if you would like to
know more about GitHub and the usage of Repositories, take a look
at the Elektor Webinar about GitHub [6]. After you have the code
and open it with the PlatformIO IDE, it should look like what you
see in Figure 4. Connect the Wemos to your computer and hit the
upload button (Figure 5). PlatformIO will download all the required
libraries, tools, board support packages and start compiling and
afterwards uploading.
PlatformIO now has built and flashed the firmware. As with most
ESP8266 projects, there is a second part to it. As the firmware
offers configuration through a webserver, we need also to write
the webpages to the ESP8266 in a second step. Click in Visual
Studio Code on the small ant head and a list of tasks should appear
(Figure 6). First click on Build Filesystem Image and afterwards on
Upload Filesystem Image. This will write the content for the Webserver
to the ESP8266. If you get errors like “can’t access COM port,” make
sure you don’t have a serial terminal somewhere open that will block
the port. Afterwards, firmware is ready to be configured and used.
Figure 10: New generated ThingSpeak channel. Figure 11: ThingSpeak settings.
MQTT Connection
MQTT is a versatile way to distribute your data to other systems Figure 13: MQTT Settings.
that can store or process it. You don’t need an external service to
collect data or process it, and you can keep the data within your own
Software
For the software that was originally provided by the developer on Inside the software, the dataflow is quite simple, as you can see in
the Elektor Labs platform, there were a few areas that could use the picture. Every two seconds the sensor values are queried and
improvement. For example, hard-coded credentials for your Wi-Fi moved back to various code modules. For the local supervising
network work only if you never change the network name or the of the CO2 level, we have the limits class, which will control in the
password the device is connected to. Also having your credenti- end our three LEDs, and we have the alarm class, which will sound
als somewhere in some code files is not the safest way to store the buzzer if a certain level of CO2 is exceeded. Those classes are
them. The same is true for the ThingSpeak API Key. If you need to built in a generic way that makes it easy to change the LED arran-
change this key, it means you need to recompile the whole code gement for a different way of displaying the values. Same goes for
and upload it to the device. the buzzer. If you like to use an active one or even a sound module,
this class is flexible enough to accomplish this.
What the Elektor lab left hardcoded (as #defines in /configure/
configure.h) is the pin mapping, as well as the CO2 tresholds for the For the cloud connectivity, where possible, pre-built libraries have
three LEDs and the buzzer. In the file /configure/configure.h, you been used, especially for ThingSpeak. This makes the data exchange
have all hard coded settings in one place and can change them if with this service a lot simpler than on the ESP32 Weatherstation
needed. If you change any settings in this file, you must rebuild the [13] we published [14] a few years ago.
firmware and upload it to the ESP8266, of course.
RELATED PRODUCTS
> WeMos D1 mini Pro – ESP8266 based WiFi Module (SKU 19185)
www.elektor.com/19185
WEB LINKS
[1] Elektor GitHub Repository: https://github.com/ElektorLabs/210043-CO2-Guard
[2] Winsen MHZ-19 datasheet: www.winsen-sensor.com/d/files/infrared-gas-sensor/mh-z19b-co2-ver1_0.pdf
[3] “CO2 Guard,” Elektor-Labs.com: www.elektormagazine.de/labs/co2-guard
[4] PlatformIO install guide: https://platformio.org/install/ide?install=vscode
[5] “How to Code (Download) or Clone Something From GitHub,” Elektor TV: www.youtube.com/watch?v=X5e3xQBeqf8
[6] “GitHub Webinar: My Way Into GitHub,” Elektor TV: www.youtube.com/watch?v=j_LgvVhBdwQ
[7] MathWorks ThingSpeak: http://thingspeak.com
[8] MathWorks ThingSpeak Help: https://bit.ly/ChannelPropertiesMATLAB
[9] Node-RED installation guide: https://nodered.org/docs/getting-started/raspberrypi
[10] D. Ibrahim, Programming with Node-RED, Elektor 2020: www.elektor.com/programming-with-node-red-e-book
[11] AISLER B.V: http://aisler.net
[12] M. Claußen, “DIY Christmas Fireplace: A 3D Puzzle with PCBs, LEDs, and Raspberry Pi Pico,” ElektorMagazine.com:
www.elektormagazine.com/articles/diy-christmas-fireplace-3d-puzzle-pcbs-leds-raspberry-pi-pico
[13] “ESP32 Weatherstation,” Elektor-Labs.com: www.elektormagazine.com/labs/esp32-weather-station-180468
[14] R. Aarts, “ESP32 Weatherstation,” ElektorMag 1-2/2019: www.elektormagazine.com/magazine/elektor-70/42351
MonkMakes
Air Quality Kit for
Raspberry Pi
Measures Temperature and eCO2
By Luc Lemmens (Elektor) Thermometers have long been used to monitor room temperature, and
in recent years, (e)CO2 meters have become increasingly popular for
Most of us are now stuck in monitoring air quality. Too much carbon dioxide (CO2) has a negative
(private) rooms, so modules effect on concentration, and at even higher levels it is bad for your
for measuring the air quality health. This kit measures the quality of the air in a room (how stale
the air is) as well as the temperature. It is meant as an add-on for the
cheaply are gaining popularity. Raspberry Pi, but it also can be used as a stand-alone device. The board
The MonkMakes Air Quality has a buzzer and a bar of six LEDs (two green, two orange, and two
Kit measures equivalent CO2 red) that displays the air quality. Temperature and air quality readings
can be processed by a Raspberry Pi. The buzzer and LED display can
and temperature. It is especially be controlled by the host.
designed to be used with a
Raspberry Pi 400, but it can also be The kit comes without printed documentation, but it provides a link to
the MonkMakes website where the datasheet and instructions can be
connected to other Raspberry Pi downloaded [1]. These documents contain all relevant information; they
models using the jumper wires and help the user to connect and use the board. Example applications in
an included GPIO template. Python are available for download on Github [2].
The Hardware
Besides the six indicator LEDs and the buzzer — the big square compo-
nent in the middle of the PCB in Figure 1 — the board contains a power
A Nice Design
Only some basic knowledge of the Raspberry Pi is required to get this
Air Quality kit working. What is a great advantage for some, will be less
attractive for others: knowledge of the sensors and control of buzzer and Figure 4: Raspberry Pi screen output for one of
LEDs is not required. The (source code of the) firmware of the on-board the examples. (Source: MonkMakes)
The table below shows the levels at which CO2 can become unhealthy.
Contributors The CO2 readings are in ppm (parts per million).
Text: Luc Lemmens
Illustrations: MonkMakes, Luc Lemmens
Editors: Jens Nickel, C. J. Abate
Layout: Harmen Heida Level of CO2
250-400 Normal concentration in ambient air.
400-1000 Concentrations typical of occupied indoor
spaces with good air exchange.
RELATED PRODUCTS 1000-2000 Complaints of drowsiness and poor air.
2000-5000 Headaches, sleepiness and stagnant, stale,
> MonkMakes Air Quality Kit for Raspberry Pi (SKU 19913) stuffy air. Poor concentration, loss of attention,
www.elektor.com/19913 increased heart rate and slight nausea may
also be present.
> Raspberry Pi 400 – Raspberry Pi 4-based PC (US) +
FREE GPIO Header (SKU 19429) 5000 Workplace exposure limit in most countries.
www.elektor.com/19429 >40000 Exposure may lead to serious oxygen
deprivation resulting in permanent brain
> Raspberry Pi 4 B (1 GB RAM) (SKU 18966) damage, coma, even death
www.elektor.com/18966
WEB LINKS
[1] MonkMakes webpage with instructions: http://monkmakes.com/pi_aq
[2] Software on Github: https://github.com/monkmakes/pi_aq
[3] TMP235 datasheet: https://www.ti.com/product/TMP235
[4] CCS811 datasheet: https://www.sciosense.com/products/environmental-sensors/ccs811-gas-sensor-solution/
We commence our discussion of the active components with the If we were writing a ‘real’ textbook, we would have to fill many
diode and related components. Granted, you could argue endlessly pages with information about semiconductor materials (silicon,
about the question whether a diode is an active or a passive compo- germanium, selenium and others), doping, PN-junctions and many
nent — active components are called that because they are able to other things; but this series of articles is targetted at the begin-
amplify a signal, and a diode does not do that. But because they are ning electronics enthusiast and not at physicists or semiconduc-
semiconductors components (or, in the past, electron tubes, but tor manufacturers. The beginning electronics enthusiast is mostly
these are outside the scope of this series of articles) we put them interested in the question of what function a particular compo-
in the same heap with transistors and other active components. nent accomplishes and how they can use it in their designs — and
much less in the question of how and why a particular component
does what it does.
In Figure 1 you can see a few common implementations of diodes.
At top left are two ‘ordinary’ diodes: a 1N4148 and a 1N4001. At
bottom left are three LEDs (light emitting diodes), with diameters
of 3 mm, 5 mm and 10 mm. On the right you can spy a set of four
bridge rectifiers — these are combinations of four diodes in a single
housing. These are used in large numbers in (mains) power supplies.
The example at bottom right has a metal housing and is intended
to be bolted to a heatsink; this rectifier can handle a current of no
less than 25 A.
0,1 0,2 0,3 0,4 0,5 0,6 0,7 U[V] 0,1 0,2 0,3 0,4 0,5 0,6 0,7 U[V]
Figure 2: Schematic symbols for a few Figure 3: The V/I-characteristic of a diode. Figure 4: V/I-characteristics of four
common diodes. resistors.
U(t)
Figure 6: Single-sided t
(half-wave) rectifier.
One-Sided Rectifiers
The term ‘one-sided’ (see Figure 6) has nothing to do with sides,
but means that only one half of the two half periods of the AC input
voltage is let through — and only the positive half period — and
then only for the relatively short time that the transformer output
voltage is higher than the voltage across the electrolytic capaci-
tor plus the forward voltage drop of the diode (which amounts to
about 0.7 V). This type of circuit is appropriately called a half-wave
rectifier. RELATED PRODUCTS
We have sketched this in Figure 7. The top graph shows the AC
voltage as it is supplied by the transformer. If we think away the > B. Kainka, Basic Electronics for Beginners,
Elektor 2020. (SKU 19212)
buffer or smoothing electrolytic capacitor for a moment, then
www.elektor.com/13950
across the resistor (the load) there will be a pulsing DC voltage, as
is drawn in the middle graph. > B. Kainka, Basic Electronics for Beginners (E-Book),
Elektor 2020. (SKU 19213)
www.elektor.com/18232
The bottommost graph is actually the most interesting. This
graph shows the voltage across the buffer capacitor. During the
positive half periods of the AC voltage this capacitor is charged very
briefly each cycle; during the remainder of the cycle the capacitor
is discharged by the load. In practice this load is generally not a
simple resistor but a complete electronic circuit that likes to be
powered from a DC voltage.
In the next instalment, we will start to calculate things for these
(and other) rectifiers.
220003-01
Transformers
Transformers are just a special case of inductors. Identify the windings
with a multimeter, then get the inductances. For a small power trans-
former, any winding with resistance above about 50 Ω and induc-
tance over about 10 H may be a mains winding. And as inductance is
proportional to the square of the number of turns, take the square root
of the ratio of the windings’ inductances to get the transformer ratio.
For example, a transformer with inductances of 10 H and 50 mH has
a turns ratio of around (10 / 0.05)0.5 = 14, so if it’s a 240 VAC mains
transformer, you’d expect the secondary to give about 15 V. But many
mains windings will have a higher inductance than your LCR meter
Capacitors and Inductors will measure, so you can’t always do this.
When I was about 20 (that was many years ago now), I built myself a
capacitance meter. A 555 astable triggered a 74121 monostable with
the test capacitor to give a pulse train with duty cycle proportional
to the test capacitor. I used a preset pot on each range and used 1%
capacitors to calibrate it. It measured from around 1 pf to 100 µF and
is one of the most useful gadgets I’ve ever built.
Many digital multimeters now have a capacitance test function, and I
found one in a recent electronics magazine for around €40 ($40/₤30)
that measures capacitance and inductance, albeit with fairly limited
ranges. I had a basic but adequate LCR meter that was about the same
price but recently invested in a more versatile one. You very much get
what you pay for with this type of test equipment and what you get
will depend on your budget and requirements. It’s really not worth
building your own testers anymore. But in some circumstances, you Diodes
may need to make more esoteric measurements, such as the Equiv- Diodes are easy to test with any multimeter — they conduct one way
alent Series Resistance (ESR) of a capacitor, or the Q of an inductor, and not the other. Digital multimeters may have a diode test range
and for this, you may need more advanced test equipment. Elektor and this will give you an indication of the voltage across the diode
has published many designs over the years for devices to measure all when conducting — around 0.6 to 0.7 means it is a standard silicon
aspects of capacitance and inductance and a search on the magazine diode, 0.3 to 0.5 means it is a Schottky diode, and as low as 0.2 means
site may lead you to a design that fulfils your needs. The Elektor store a germanium diode. The position of the decimal point may vary, but
has some reasonably priced testers as well (see textbox). it’s the first figure you need to look at.
Supercapacitors are just a special case of electrolytic capacitors but Zener diodes are a bit more difficult. They will behave as normal diodes
beyond the range of most testers. They are usually rated at 5.5 V, so when tested with a multimeter, as a multimeter is unlikely to apply
be careful not to exceed this. Test them using a resistor of 100 Ω to a enough voltage to make it conduct in reverse (Zener) mode. To test
5 V supply, and count the number of seconds for a fully discharged Zeners, use your lab power supply on its maximum voltage, with a
cap to get to 3.5 V. Divide that by 100 and you’ve got a rough estimate very low current limit (say 10 mA), or a series resistor that will pass
of the capacitance in farads. This uses the RC time constant — the around 10 mA at the full voltage. Apply this to the Zener and measure
time for the capacitor to reach 0.7 of full charge (5 V x 0.7 = 3.5 V). the voltage across it with your multimeter (Figure 1). This will only
A 1-F capacitor will take 100 Ω x 1 F = 100 seconds to get to 3.5 V. work for Zeners with voltages less than your power supply, but a 30 V
100/100 = 1, so 1 farad. power supply will cover most Zeners.
LEDs can be tested much like Zeners, but turn the power supply
voltage down to 5 V or so — LEDs have quite a low reverse break-
down voltage. Test any LED with a clear case both ways — it may be
a bicolor type. Limit the current to 10 mA; it is enough to make any
LED light and is safe even for small LEDs.
Transistors
When I was about 13, I saw an article somewhere for a simple transistor
tester, checking function and giving an Hfe (gain) value. It gave reason-
able accuracy on small-signal silicon transistors, but was inaccurate
for germanium transistors — hardly a problem these days! It has had
a lot of use and I still use it today. But again, most multimeters have a
transistor tester built in, and generally, they do a good job.
Bear in mind also that a transistor behaves as two diodes, so identi-
fying the base is fairly easy. Transistors like Darlingtons and power
transistors are more difficult to test as they need higher base-emitter
voltages or larger collector currents to do a proper test. But for the Figure 2: A simple Power Semiconductor Tester tests MOSFETs,
transistors, SCRs and Triacs.
hobbyist, a basic functional “go/no go” test is all that’s needed.
MOSFETs
MOSFETs have become ubiquitous, and a simple transistor tester will anode or the positive supply, the SCR should turn on (draw current)
not be able to test them. Most of them require gate-source voltages and continue to do so even after the gate drive is removed. You have
of 5 V or above to switch them on fully. Fortunately, there is an easy to interrupt the anode connection to switch it off. Triacs are the same
way to do a functional test of a MOSFET using only a current-limited but will work with the power both ways.
power supply (or a power supply and a resistor, or even better a light
bulb) and your fingers or a high-value resistor (a megohm or so). The test requirements for MOSFETs, transistors, and SCRs are similar,
Putting the resistor (or your fingers) gate-to-positive should switch it and you can build yourself a basic tester that will test all of them. The
on and gate-to-source should switch it off. Because MOSFETs have one I built is shown in Figure 2.
appreciable capacitance on the gate, it may take a second or more to
switch off and on. Use 12 V to apply enough gate voltage, and limit the VDRs
current to 100 mA or less, or you may burn your fingers if the MOSFET Voltage-Dependent Resistors (VDR), sometimes called tranzorbs,
is not on a heatsink! and other surge protectors such as the gas types and the P6KE
semiconductor ones are among the more difficult components to
test. A 460-volt VDR will only start to conduct at over 500 V. But, if
you have access to an electrician’s megger or insulation tester, you
can do a quick check of these.
Most insulation testers have three test voltages: 250 V, 500 V, and
1000 V. A 460 V VDR should give no deflection or reading at 250 V,
some deflection at 500 V and show low resistance at 1000 V. Results
may vary with the model of tester used but should be good enough for
a go / no go test. Non-working VDRs are either shorted or completely
open-circuit, and this test will show either of those conditions. And
keep your fingers away from those voltages!
DIP Switches
Used DIP switches may have some switches faulty so test them before
use. You can test any switch with a multimeter of course, but if you
have a lot of them to test, you can make a DIP switch tester with an
IC socket, resistors, and LEDs to indicate if each switch pole is open
or closed.
Source: David Ashton
In addition, you can use it for testing LEDs. Put an LED where one of
the switch poles should be and both it and the tester LED should light
if it’s good. One I built is shown in Figure 3. The TL866 is primarily a programmer of a very wide range of devices.
At this it seems reasonably competent and many reviews are avail-
Integrated Circuits able, including Elektor’s [6]. However, I will concentrate on its ability
These are more difficult to test, as there are so many varieties. But there to test Logic ICs.
are easy tests you can do. Op-amps usually have the same pinouts, so
you can make a simple op-amp tester by configuring it to work as an The TL866-II – the current version - presents in a plastic case with
astable multivibrator with a couple of LEDs on the output. It will work a good quality 40-pin ZIF socket and a couple of LEDs, and a USB
for many comparators as well, but bear in mind that some comparators connection. I had to download the software from the manufactur-
only have a bare transistor on the output and will not source current. er’s site – something I’m not keen on, but it is the manufacturer’s
site so the risk is not high. The TL866 has a good printable PDF
You could make testers for double and quad op-amps as well. Use manual. The software is fairly well laid out and you can quickly find
a decent quality socket — a Zero Insertion Force (ZIF) type if your most devices and functions.
budget runs to that. You can do the same for the much-loved 555 —
have it running as an astable with LEDs on the output. In the Device tab on the main menu is the item Logic Test. This
brings up a long list of CMOS 4000 and TTL 74 series IC types to
Digital ICs are more difficult. If you need to test these a lot, your best choose from, and even some Intel 8080 peripheral devices. I spent
course of action is to buy a suitable tester. There is a device called a happy half hour with my boxes of CMOS and TTL ICs trying a
the TL866 [2] (see inset), usually widely available at under $50, which good many of them and the TL866 tested most of them with no
is an EPROM programmer but also tests logic ICs. There are a few problems. However 74LS21s consistently brought up an error - a
different models available so look at the specifications before you buy. bit disappointing on such a basic IC.
The TL866II is the current version.
But now for the fun part. The TL866 software displays the test
sequence it uses, and you can copy and edit them (though you
have to store them with a new name). Looking at the 7421 datasheet
and the programmed test sequence, I noticed that pins 3 and 11
had “H” (high level expected) marked for those pins. These pins are
not used, so they should be ignored. If I changed those pins to “x”
(ignore) the test worked, and I successfully tested all my 74LS21s
with no errors. I’m now confident I can test just about any digital
IC, even if I have to write my own test sequences for some of them.
Some other ICs gave errors, primarily monostable multivibrators
which would be difficult to test without timing components.
For testing SMD ICs, you can find sets of SMD-to-DIL adapters on
eBay and other sites, and in fact you can buy a TL866 with various
Figure 3: A DIY DIP Switch / LED tester shown testing a 4-way DIP adapters included for less than $50 – a very handy tester for a good
switch and a couple of LEDs.
price, and a good addition to any hobbyist’s collection of test gear.
They come with a ZIF socket for most sizes of through-hole ICs but
often come with handy adapters for testing various SMD package
components as well. Some models do ICSP programming if that’s
useful for you, but the newer ones don’t program very old EPROMs.
(For this old-timer, that’s important!) For just testing digital ICs neither
of those is very important. You can write your own testing programs
too, for ICs not in the database or those for which the included
programs don’t work (there are a few).
Quartz Crystals
Quartz crystals and oscillators are some of the more common compo-
nents you will find when stripping professional equipment. Usually,
these components are marked with their frequency and a simple go/
no go test is required. This can be done fairly simply. To verify the
frequency, or to test crystals that are not marked, a frequency counter
will be needed. You need only two inverting gates to make a crystal
oscillate, and another one to detect that it is oscillating. You can use
the 4th gate in a quad gate IC as a buffer to feed a frequency counter. Figure 4: Tweezer probe for multimeter. (Source: Sparkfun)
32,768-Hz crystals are commonly used in real-time clocks, but crystals
for microcontrollers are typically in the MHz region, so you may
need two oscillators to check all crystals. Then add a DIP socket
to check oscillators; you just need power and a connection to the
output. SMD crystals and oscillators are more difficult. You may 3-terminal semiconductor device and is highly recommended. If you
need a test jig for them. need to do more detailed tests than the simple tests outlined above,
it is worth investing in test gear like this. Elektor has recently started
Relays stocking the Joy-IT LCR-T7 Multi-function Component Tester [5]
Relays are still widely used. For isolation and high current handling which, while not offering the specifications of Peak’s tester, is about
they can’t be beaten. Test the contacts with a multimeter with a a quarter of the price and represents outstanding value.
continuity buzzer which will show low resistance, and operate the
relay with your power supply set to the appropriate voltage and A desk or hand-held lens with LED illumination, and/or a USB micro-
make sure the contacts open or close. If you have a lot of relays of scope, is handy for checking small components for value, polarity,
one type it may be worth making a test jig for them, using a load of or orientation.
up to a few amps (e.g., a car light bulb) to weed out any with high
resistance contacts. A power supply has been mentioned above in many of the tests. At
a minimum, a 0‑30 variable supply with a variable current limit of
Other Tools 10 mA or less up to 500 mA or more will be adequate.
If you can only afford one piece of good test equipment, make it a
decent multimeter, with transistor test, capacitance, and other ranges Using these simple techniques and some DIY test gear will make
(frequency, temperature…). It will be really useful until you can buy your life a lot easier if you re-use components for your projects.
or build better test equipment. 210279-01
One of the most useful things you can buy if you do any SMD work is
a tweezer-style probe (Figure 4). This plugs into your test meter and Contributors
allows you to very quickly and easily test SMD resistors, capacitors, Text and Photographs: David Ashton
inductors, and diodes. They are made by Sparkfun and are widely Editor: Clemens Valens
available. You can get meters built into tweezers if you really do a Layout: Harmen Heida
lot of SMD testing. For example, the DT71 is available in the Elektor
Store (see textbox) and a good review is at [3].
Questions or Comments?
Peak makes a line of “Atlas” hand-held component testers which have Do you have technical questions or comments about this article?
good reviews and are reasonably priced. In particular, their DCA75 Contact Elektor at [email protected].
Semiconductor Analyser (see inset) will identify just about any 2- or
RELATED PRODUCTS
WEB LINKS
[1] D. Ashton, “Component Identification,” Elektor 3-4/2022 : https://www.elektormagazine.com/210024-01
[2] Review: MiniPro TL866A programmer: https://www.elektormagazine.com/news/review-minipro-tl866a-programmer/14585
[3] H. Baggen, “Miniware DT71 Digital Tweezers,” Elektor 7-8/2021: https://www.elektormagazine.com/210182-01
[4] H
andheld Advanced Semiconductor Component Analyser: PEAK DCA75:
https://www.elektormagazine.com/news/handheld-advanced-semiconductor-component-analyser
[5] Joy-IT LCR-T7 Multi-Function Tester: https://www.elektormagazine.com/news/joyit-lcrt7-multifunction-tester
[6] Review: MiniPro TL866A programmer: https://www.elektormagazine.com/news/review-minipro-tl866a-programmer/14585
or-labs.co
kt
m
Ele
BEST OF
om
ek
t o r-la b s.c
El
Mole hills can ruin your carefully manicured lawn in no time at all. If you guard your
precious garden with an electronic mole repeller, this hardware upgrade can increase the life
span of its batteries by a factor of 10!
If you have a garden with a lawn, especially if you live in a rural area, mole repeller: a device that uses (sound) vibrations to prevent or end
you run the risk of being unpleasantly surprised by the presence of these underground activities. It is a spiked tube that is inserted into
moles, or rather by the mole hills they make. The good news is that the ground; in the tip, there is a sound source (usually in the form of
you will most likely have clean, fertile soil in your garden. You will never an electronic DC buzzer) that is meant to chase away moles and other
— or rarely — see the animals themselves, as they usually stay under- vermin like voles and rats.
ground in tunnels that they dig, looking for worms and insects that are
on their menu. The soil that they move during their digging has to go Some manufacturers claim that the pest repellers they make are
somewhere, of course, and they push it upwards and thus form mole producing ultrasonic vibrations. Maybe they do exist, but most devices
hills, the sign that there is a mole in (actually: under) your garden. Not we found – according to their specifications — produce sounds with
many people are happy about this, and numerous methods have been frequencies in the low kilohertz region or even lower, which is way
devised to prevent moles entering a garden or to chase them away below the ultrasonic range. In most cases, the term sonic repeller
once they have settled there. One of the solutions is the so-called (without ultra-) will be more appropriate. The sound is switched on
K1 K5
+6V +6V
D2
D1 R3
Buzzer
10k
LL4148
RED
K2
6 T1 K6
D
IC1
for about half a second, at intervals of some 30 seconds. These pulses 5 8
VCC RESET
1
R1
G
would be so unpleasant for a mole that it would pack up and/or stay
4 7 2
PB2/SCK PB3/AD3 220
ISP 3 6 3
away. There are people who are absolutely convinced of the effec-
PB1/MISO PB4/AD2 S
2 5 4 GF2304
PB0/MOSI GND
tiveness of these devices, others claim they are just a scam and that
1
ATtiny13A
only the manufacturers and sellers benefit from them; we will not
C1 C2 R2
220k
comment on that. K3
100µ 470n
10V
GND
box. In this article, we will only discuss a way to reduce the power
consumption of a battery-powered, sound generating variant. Figure 1: The circuit diagram of the upgrade of the time circuit.
How It Works
This type of repeller contains a timing circuit and some kind of
sounder; the latter will be a piezo buzzer in most cases, but we have
also found devices with vibration motors, like the ones used in cell
phones. In electronics, anyone who says “Timer circuits” immediately
says “555”, perhaps the most famous integrated circuit that recently
celebrated its 50th anniversary. There will be exceptions, but the
designer of the circuit we are discussing here also came across a
mole repellent in which the 555 was used as a bistable multivibra-
tor. Most of the power of the device is consumed when the sound is
being produced, but of course some power is also needed to keep
the 555 running when the buzzer is switched off. Although tweaking
this circuit may save power and thus extends the battery life (e.g.,
by replacing a standard 555 by a CMOS-version or by changing the
values of its external components), the designer chose a different
approach. The complete timer circuit is replaced by a small micro-
controller that stays in sleep mode most of the time; its watchdog
timer wakes it up approximately every half minute and sounds the Figure 2: The PCB layout.
buzzer for one second and then enters sleep mode again. The current
consumption is reduced with nearly a factor of ten: 4 mA with the
original 555 timer circuit versus an average of 430 µA with the micro-
controller, or a battery life of less than 200 days extended to about
1450 days! In practice this will be shorter, due to factors such as three standard 1N4148 diodes in series. A linear voltage regulator
self-discharge of the batteries, but still, this is a great improvement should not be used for this purpose, as it would increase the current
compared to the original current consumption of the mole repeller. consumption of the mole repeller. C1 and C2 are decoupling capac-
itors for the power supply of the microcontroller.
The New Hardware
The schematic diagram of the microcontroller circuit is shown in The buzzer is salvaged from the original hardware and connected to
Figure 1. IC1, an ATtiny13 from Microchip (formerly Atmel), is the heart the K4/K5 (positive) and K6 (negative) pins. Some buzzers are induc-
of the timer circuit. Its internal program memory can be flashed with tive and likely to produce spikes, especially when switching off. Diode
an ISP programming interface connected to K2. Alternatively, this D2 is the flyback-diode that prevents these spikes from harming the
6-pin can be omitted if the microcontroller is programmed before it transistor T1. The choice of this switching transistor is not critical at
is inserted in the socket for IC1. all. With the current through the buzzer being less than 10 mA, also a
standard BC547 can be used if base resistor R1 is changed to 4.7 kΩ
The circuit is powered by the batteries, in this case four D-cells in and R2 to 10 kΩ. Any logic-level NMOS-FET will do too, with R1 replaced
series — i.e., 6 V in total connected to K1 and K3 (the positive and by a jumper wire and R2 omitted.
negative terminals, respectively). With four freshly installed 1.5 V
batteries, with no load or very low load connected, the total voltage There Is Even a PCB Design
will be higher, more like 6.5 V. However, the ATtiny13 has an absolute The schematic was designed in a free version of Target3001!, and the
maximum supply voltage of 5.5 V. D1 is a standard red LED (preferably author even made a small PCB for the microcontroller upgrade (see
not a high-efficiency type) which has a forward voltage of about 1.3 V, Figure 2). The design files are available for download at the Elektor
even at a forward current as low as 1 µA and this effectively lowers Labs page of this project [1]. Considering the large number of different
the supply voltage to a safe value, well below the 5.5 V maximum brands of mole repellers available on the market, it would be a mere
for the microcontroller. Alternatively, D1 can be replaced by two or coincidence if the PCB exactly fits into the model you have like in
RELATED
PRODUCTS
b•
or la Elekt
kt
or
Ele
lab
ORIGIN
AL
Ele
b
or
kt
or
la
la b
• Ele k t
Stick It on an ESP32
The VEML7700 module used for my exper-
iments was bought at Adafruit. A good
platform to use it with is the ESP32-Con-
nected Thermostat [1] (a.k.a. Automator,
see [2]). The module has five pins, but as
it has two power supply options, we only Figure 1: The 5-pin VEML7700 module plugs onto 4-way connector K9. Its VIN pin is not
need four of them. These four pins have connected even though it may look like it.
An Encapsulated Arduino
Sketch
Our driver is a C++ class that must provide
at least a constructor and a function named
update. We need a function setup too so
that we can initialize the Adafruit driver.
The functions setup and update of our
class do what would normally be done in
the functions setup and loop of a typical
Arduino sketch using the Adafruit driver.
Basically, our class encapsulates an Arduino
sketch including global variables and adds
some ESPHome-specific things to it. For
ESPHome we must insert calls to publish_
state for each data stream (ALS, lux & white
light) to the function update. This will make
the data available to the rest of the world. Figure 2: ESPHome installs the Adafruit library automatically.
The call order must be the same as in the
RELATED PRODUCTS
WEB LINKS
[1] Y. Bourdon, “ESP32-Connected Thermostat,” ElektorMag 9-10/2021: www.elektormagazine.com/200497-01
[2] Elektor Automator: www.elektormagazine.com/labs/automator
[3] ESPHome starts here: www.elektormagazine.com/labs/how-to-home-assistant-esphome
[4] C. Valens, “Home Automation Made Easy,” ElektorMag 9-10/2020: www.elektormagazine.com/200019-01
[5] Adafruit VEML7700 library: https://github.com/adafruit/Adafruit_VEML7700
[6] ESPHome on GitHub: https://github.com/esphome
[7] Downloads for this article: www.elektormagazine.com/210190-01
However, there is a considerable gap between a prototyped Little Room for Voice Assistant Newcomers
platform that demonstrates the core concept of an IoT solution With such powerful industry players already established on the
and deploying one for real. The IoT Insights report from Micro- market, there is little room for newcomers, and the technology
soft [2] interviewed more than 3,000 IoT professionals in 2021. curve to develop a competitive VA is significant. Thus, if you
They found that 35% of IoT projects experience failure during the want to leverage voice control for your IoT solution, you have to
trial or proof-of-concept phase, up 5% on their survey from a year play according to the rules set by the big three. An alternative
earlier. Most cited as the reason for failure at this stage is the high approach would be to license a VA. However, some manufactur-
cost of scaling. Other reasons include too many platforms to test, ers questioned reported that licensing conditions were restrict-
too many use cases to prove, and a lack of resources. A separate ing their choices. These ranged from exclusivity or restrictions
study by Cisco [3] reported that only 26% of companies surveyed to stop more than one VA being used concurrently to licensing
thought their IoT initiatives had been successful. Responses to that forced the inclusion of other types of software or applica-
their study showed that, while most IoT projects look good on tions, meaning the VA technology couldn’t be used standalone.
paper, they proved to be more complex than initially thought.
Another big concern is access to data. As a third party relying
Despite such gloomy feedback on IoT overall, there are sectors on a VA, you only have limited access to the data collected.
where IoT is making huge inroads and delivering growing The VA provider has access to the audio recordings and would
revenues. also know how many failed attempts there
have been to issue the commands selected
EU Commission Reviews for your device. However, your team will not
Consumer IoT Sector be provided access to the audio recordings,
EU citizens have welcomed the range of so you’ll more likely have to wait for user
consumer IoT solutions on offer in recent feedback to discover that your choice of
years. So much so, a Smart Home revenue Looking at the available voice commands is suboptimal amongst
report from Statista [4] predicts that related IoT landscape, it is a group more expansive than that used
revenues will double from around €17b in for testing. Additionally, because the VA
2020 to around €38.1b in 2025. Concerned clear that business provider can analyze everything spoken into
that competition in this sector may be being opportunities abound, it, they could conceivably use this data to
stifled, the European Commission under- develop a solution that competes with yours
took an inquiry as part of their digital strat- regardless of whether or leverage user experience provided by your
egy [5]. The report, released in January of you are focused on IoT solution to improve their services.
2022, garnered input from manufacturers
of wearable devices, connected consumer solutions for consumers A further issue arises when the VA provider
devices used in the smart home, and those or industry. also offers advertising services. Theoreti-
providing services over such smart devices. cally, the voice input provided by your users
Additionally, the Commission requested input could help the provider target advertis-
from standard-setting organizations. However, upon reading, ing more accurately to the demographic represented by your
many paragraphs of their analysis are given to the voice assis- customer base.
tants (VA) that form the user interface to many IoT products and
services (Figure 1). Finally, there is the loss of brand recognition and experience.
Your carefully crafted solution is at the whims and mercies of
Having analyzed the landscape of the smart home, the report the VA. Should they choose to make a significant change, such
[6] makes it clear that, in Europe, Google’s Google Assistant, as the voice used, the wake word, or even roll-out functionality
Amazon’s Alexa, and Apple’s Siri are the leading general-pur- changes that result in a drop in users, you’re inevitably going
pose VAs. Other VAs are available, but these tend to be more to suffer the consequences too.
limited in functionality and focus on supporting a single product
or a service provider’s app. According to ZDNet, of the solutions The report also examines many other relevant areas, including
from the big three players, Amazon provides the highest level of application programming interfaces (API), standards, interop-
compatibility, supporting around 7,400 brands [7]. By compar- erability, the imbalance in power between many third-party IoT
ison, Google supports around 1,000, while Apple remains the device developers and the big cloud platform service providers,
most exclusive, supporting about 50. and contract termination clauses.
There are no recommendations in the report. However, the LoRaWAN Under the Magnifying Glass
conclusions state that the report’s content will contribute to LoRa and LoRaWAN have been subject to particular scrutiny by
the Commission’s standardization strategy and feed into the the security and hacking community. Sébastien Dudek of Trend
legislative debate on the Digital Markets Act (DMA). Micro, a company focused on IT security solutions, is one of several
researchers that has written extensively on some of the potential
Security Concerns Worry IoT Implementers issues. In a series of three technical briefs [9][10][11], he outlines
Reviewing the data collected in Microsoft’s IoT Insights report, a range of issues in the implementation and potential attacks.
it is IoT security that is high on the list of worries. This issue These range from denial of service (DoS) (Figure 2) and eaves-
is of particular concern for those planning IoT solutions, with dropping to bit-flipping (Figure 3) and spoofing of acknowledg-
29% indicating that the associated security risks are holding ments (Figure 4). The outcomes of such attacks range from the
them back from using IoT more. The report also explains that inability to communicate with nodes and reducing the battery
around a third of organizations are concerned about the security life to altering application data.
risks of IoT, especially data breaches. To combat this, outsourc-
ing is highlighted as the best way of improving peace of mind. Many of the vulnerabilities highlighted were resolved between
version 1.0.2 and 1.1 of the LoRaWAN standard. However, further
While many engineers know the phrase “obscurity is not challenges arise when operating LoRaWAN nodes with gateways
security,” few are skilled enough in this domain to ensure a using different versions of the specification. In such cases, there is
solution is protected, end-to-end, from attackers. And while a need to make modifications to ensure secured backward compat-
semiconductor suppliers offer a range of single-chip security ibility between end devices and the back-end, as highlighted in
solutions, developers still need to understand how to use them a paper from 2018 by Tahsin C. M. Dönmez [12].
correctly to ensure that they don’t inadvertently introduce new
security weaknesses. Beyond hacking the wireless link, there is also the issue of bad
actors stealing and directly attacking the hardware. Sébas-
Over the past decades, low-power wide-area networks (LPWAN) tien Dudek also examines this aspect of security. In the case of
solutions such as LoRa and Sigfox have established themselves LoRaWAN, many solutions use a microcontroller (MCU) and a
as key wireless IoT technologies supporting long-range commu- Semtech wireless module. As these are connected via SPI, data
nication. Achieving ranges of tens of kilometers, they are an passing between the two can be easily captured and analyzed.
alternative to cellular wireless such as LTE Cat-M1 and NB-IoT
thanks to their superior low-power performance for low data Beyond this, there is also the issue of the security of the MCU
volumes [8]. But how secure are they? itself. One attack method simply extracts the firmware from flash
al. [14], several proof-of-concept attacks on wireless networks in the delivery vans of DPD, that are already frequently underway
addition to LoRaWAN are described. In a technical brief issued by in the target city. These sensors recalibrate themselves against
Deutsch Telekom [15] it was stated that implementing Sigfox and data acquired by the stationary sensors they pass to ensure the
LoRaWAN “without [an SE] can [even make] end-to-end encryp- accuracy required based. All this requires a robust, reliable, and
tion useless.” It explains that, by contrast, NB-IoT benefits from secure LPWAN choice.
long-proven LTE security features, such as authentication and
secure key generation and exchange. However, it also makes clear Talking to co-founder Marc Nodorft, he explains that both Sigfox
that end-to-end encryption is not standard and, if deemed neces- and LoRaWAN were considered during the early development
sary, must be discussed with the network operator. stages. Sigfox offered connectivity infrastructure, simplifying
system deployment, but neither provided the data throughput
Delivering City-Wide IoT Solutions required. LoRaWAN, at the time, wasn’t secure enough out-of-the-
Concerns regarding security in LPWAN networks influenced box and, without infrastructure partners in the cities where the
technology choices made by DEUS POLLUTRACK Smart City technology was to be deployed, it would be necessary to deploy
GmbH i.G. for their IoT platform [16]. Their team has been devel- gateways that connected to the back-end via cellular networks.
oping IoT sensor networks to monitor particulate matter in cities As a result, 4G and, later, 5G cellular were selected, resolving the
for more than a decade. With the technology deployed in more issues of coverage, reliability, and security to the levels required.
than 15 European cities, it enables local leaders of municipalities
to make informed environmental decisions regarding air pollu- Nodorft also tells us that, while there are plenty of cheap electronic
tion. Their patented optical particle counters (OPC) are capable solutions for IoT available, these are not robust enough for
of monitoring down to the ultrafine particle (UFP) classification long-term deployment in the environments where their products
(under 0.1 μm). While larger particulates, such as PM10 are consid- are installed. Hence the choice was made to develop according to
ered dangerous for the lungs, UFPs can enter the bloodstream industrial standards, another consideration for those planning
and pass to other organs through inhaled air. their own IoT products.
DEUS’s sensor technology (Figure 5) uses a combination of Another aspect is the back-end operations, which they have
stationary and mobile sensors, networked to back-end dashboards developed specifically to the needs of their IoT implemen-
that visualize the data collected. Cities such as Marseille and Paris tation (Figure 6). Moving forward, there is a need to support
use 40 stationary sensors complemented by 300 mobile sensors open-source reporting dashboards to allow government bodies
[17]. Mobile sensors are fitted to vehicles of partners, such as using the system and citizens to access the data, which requires
a cloud services provider. And, while there are plenty of choices, relationships if they go it alone. Without a doubt, expertise, either
the provider is considered as important as the technical solution. hired or loaned, is essential to move beyond example applications,
Thus, the search is on for a provider that can provide personal demonstration dashboards, and test IoT services. Finally, it is vital
support and not just an impersonal customer service chatbot. to fix your vision while remaining agile in all areas of implemen-
tation, from technology choices to target market, to fulfill it.
With so much experience in significant IoT deployments and 220053-01
learning much about the technical challenges, I wondered what
other advice Nodorft could offer those seeking to implement IoT
solutions. “We’ve always stayed true to our vision,” he replies, Contributors
“which has often required us to change the approach.” This has Text: Stuart Cording
meant evaluating different technologies, working with different Editors: Jens Nickel, C. J. Abate
partners, and modifying the sales strategy on their road to success. Layout: Harmen Heida
WEB LINKS
[1] Elektor IoT Articles: www.elektormagazine.com/select/internet-of-things-IoT
[2] “IoT Insights, Edition 3,” Microsoft/Hypothesis, October 2021: https://bit.ly/3rxMk3a
[3] “The Journey to IoT Value,” Cisco, May 2017: https://bit.ly/3GzdJWS
[4] Dr. J. Lasquety-Reyes, “Smart Home - revenue forecast in Europe from 2017 to 2025,” Statista, June 2021: https://bit.ly/3LlGiuG
[5] “Sector inquiry into the Consumer Internet of Things,” European Commission, January 2022: https://bit.ly/3Lgw9iE
[6] “Final report - sector inquiry into consumer Internet of Things,” European Commission, January 2022: https://bit.ly/3B2Htu9
[7] “The best voice assistant,” ZDNet, September 2021: https://zd.net/3rxf6Rt
[8] L . Tan, “Comparison of LoRa and NBIoT in Terms of Power Consumption,” KTH Royal Institute of Technology, January 2020:
https://bit.ly/3JafsUb
[9] S
. Dudek, “Low Powered and High Risk: Possible Attacks on LoRaWAN Devices,” Trend Micro, January 2021:
https://bit.ly/3rA02Tg
[10] S. Dudek, “Gauging LoRaWAN Communication Security with LoraPWN,” Trend Micro, February 2021: https://bit.ly/3LhV0T5
[11] S. Dudek, “Protecting LoRaWAN Hardware from Attacks in the Wild,” Trend Micro, March 2021: https://bit.ly/3rxquge
[12] T.C.M. Dönmez, “Security of LoRaWAN v1.1 in Backward Compatibility Scenarios,” Elsevier, 2018: https://bit.ly/3GtzKq0
[13] Microchip Product Page - ATECC608A: https://bit.ly/3B7zIms
[14] F .L. Coman et al., “Security issues in internet of things: Vulnerability analysis of LoRaWAN, sigfox and NB-IoT,” IEEE, June 2019:
https://bit.ly/3uwhUQX
[15] “NB-IoT, LoRaWAN, Sigfox: An up-to-date comparison,” Deutsche Telekom AG, April 2021: https://bit.ly/3uyUydj
[16] DEUS Pollutrack Website: https://bit.ly/3sHL9O5
[17] DEUS Sensor Measurement Network: https://bit.ly/3Gzjbcc
Global IoT Market Share, by Component, 2020 (Source: BCC Publishing, Fortune Business Insights)
200
Preferably Wired
After All
Tips for Developing
a 1 Gbit/s Interface
in an Industrial
Environment
By Dr. Heinz Zenkner (Freelance Industrial wireless sensor networks can to receive the station’s signal. In addition,
Consultant at Würth Elektronik) be established using smart sensors and there is a possibility that the network
meters that use efficient modulation and could be accessed from the outside or that
Wireless networks are coding techniques with good propaga- the wireless signal transmission could be
becoming increasingly tion characteristics and low bandwidths. interfered with.
popular, especially in However, the majority of the use cases
explored are limited to low throughput As a result, wireless data transmission is
industrial applications. applications. For these use cases the actual intrinsically less reliable than transfers
However, there is a strong throughput is often no more than 1 Mbit/s. through a wired network. Thus, particu-
case for robust cabling via larly in industrial settings, there may be
There are no definitive boundaries in instances where a wired Ethernet network
Ethernet in many cases a wireless network. For example, even is the only viable solution.
as the more reliable and minor adjustments to the access point’s
secure option. This article antenna positioning can have a significant Wired Ethernet Network
effect on the signal strength at the other Similar to wireless networks, wired
demonstrates how to stations. The signal is attenuated by walls, networks work by exchanging Ethernet
easily implement a 1 Gbit/s ceilings, and floors, and reflected by metal- frames between endpoints. There are
interface. lic objects. While a station may be able to a few rules to follow when setting up a
receive the signal from an access point, network to avoid problems. The most
the access point in turn may not be able common cause of network problems is
Figure 1: Basic circuit of a Gigabit Ethernet interface. Representation of a transmission channel with a total of four channels.
(Source: Würth Elektronik)
WEB LINKS
[1] Würth Elektronik Application Guide: https://www.we-online.com/applicationguide/en
Bringing Real-Time
Object Detection
to MCUs with Edge Impulse FOMO
FOMO scales down to about 100 kilobytes small objects very effectively (Figure 3). had to deal with when it came to computer
in RAM, making it possible to run object That’s something that MobileNet SSD and vision (Figure 4).
detection in real-time on everything YOLOv5, despite being larger and more
from highly-constrained Arm Cortex-M4 capable models, can’t do very well. To learn more about FOMO and exper-
cores to more powerful ones, like the iment with your own algorithm, visit
Cortex-M7 cores on the Arduino Portenta No More Missing Out edgeimpulse.com/fomo.
H7 (Figure 2), the new Arduino Nicla Vision FOMO is available today, runs on a wide 220207-01
(another dual Arm Cortex-M7/M4 CPU), or variety of computing platforms, and is
even specialized DSPs such as the Himax compatible with Linux systems, Cortex-M
WE-I. microcontrollers, and specialized DSPs. About the Author
Add a camera and Edge Impulse, and you’re Jan Jongboom is an
FOMO can scale from the tiniest micro- all set. embedded engineer
controllers all the way to full gateways or and machine
GPUs. This high degree of flexibility also With FOMO, you can quickly add object learning advocate,
makes FOMO useful when fault detection detection to just about any camera-based always looking for
requires identifying variations that are very, device, and avoid the fear of missing out ways to gather more
very small within an image. that, until now, embedded engineers have intelligence from the real
world. He has shipped devices, worked
In an MCU with strictly limited compute on the latest network tech, simulated
and memory capacity, it’s best to use an microcontrollers and there’s even a
image size of about 96x96 pixels. But with monument in San Francisco with his
a larger microcontroller device, 160x160 name on it. Currently he serves as the
pixels is probably fine. The important cofounder and CTO of Edge Impulse,
thing is that FOMO is fully convolutional, the leading development platform
so it works on any arbitrary input size. If for embedded machine learning with
you need higher granularity, more detail, 80,000+ projects.
or more objects, you can just scale up the
input resolution.
Traveling
HEATER TUBE ANTENNA HELIX ATTENUATOR COLLECTOR
N S
Wave
N S
INPUT OUTPUT
1 2 WINDOW WINDOW
Tubes
TO HEATER TO ELECTRODE TO HELIX TO R-F TO R-F TO COLLECTOR
CATHODE VOLTAGES VOLTAGE INPUT OUTPUT VOLTAGE
VOLTAGE
Peculiar Parts,
the Series
Since the streaming electrons travel much tions, a small group of enthusiasts still like
By Neil Gruending
more slowly than the RF electrons, the RF experimenting with these wonderful little
The world of RF amplifiers signal is fed through a spiral wound wire, amplifiers in amateur microwave transmit-
called the helix. This slows the RF signal ters [3]. Their biggest challenge, however,
is fascinating because of down to match that of the electron stream. is finding the tubes!
the wide range of methods 210418-01
in use. Today, many are As the RF electrons proceed down the helix,
they modulate the velocity of the electrons Questions or Comments?
constructed from solid- in the stream because the in-phase Do you have technical questions or
state components, but there electrons speed up, and the out-of-phase comments about this article? Email Elektor
are still situations where electrons slow down. These modulated at [email protected].
electrons then bunch together, inducing
vacuum tubes are the only an amplified signal back into the helix that
suitable choice. We’ve is then picked off the end of the helix using
looked at klystrons in the a directional coupler.
past, so, this time, let’s look When compared to klystrons [1], travel-
at the traveling-wave tube ing-wave tubes have the advantage of
amplifier, another unsung wider bandwidths. Additionally, they don’t
require resonant components, making
electronic hero. them ideal for lower power microwave
applications like radar or even spacecraft Figure 2: Collins Radio S-Band traveling-wave
and satellites. A great example is the tube amplifier used for communication with
One of the most fascinating things about Collins Radio S-Band amplifier (Figure 2 earth during the Apollo mission.
(Source: Ken Shirriff)
traveling-wave tube amplifiers is how they and Figure 3) used in the Apollo space
work. They feature a heater, cathode, and program [2]. It was a compact, 32-pound,
acceleration electrodes to form an electron 20-W amplifier that transmitted all of the
gun, much like a cathode-ray tube, that voice, data, and television back to NASA’s
beams a stream of electrons to the collec- network of 26-m, earth-based dish anten-
tor (Figure 1). This stream is focused by an nas. By comparison, the ground station
external magnetic field that is usually made used a focused 10,000-W signal to commu-
of permanent magnets. Using velocity nicate back to the craft.
modulation, which mixes the electron Figure 3: Operating at several thousand volts,
stream with the incoming RF electrons, the Even though traveling-wave tubes are the Collins Radio amplifier was a tightly-packed
tube amplifies the applied RF input signal. mostly the domain of commercial applica- tangle of coaxial cables. (Source: Ken Shirriff)
WEB LINKS
[1] N. Gruending, “Klystrons, Weird Component # 12,” Elektor 3/2015: https://bit.ly/2UW4k9G
[2] K. Shirriff, “Inside a 20-Watt Traveling-Wave Tube Amplifier from Apollo,” Ken Shirriff’s Blog, July 2021: https://bit.ly/3ea8lOn
[3] H. Griffiths, “Travelling Wave Tube Amplifiers,” The National Valve Museum, September 1980: https://bit.ly/3wA8aCn
Narrowband
Internet of Things
Standards, Coverage,
Agreements and
Modules
Along with LoRa and Sigfox, mobile communication networks LTE-M is basically a ‘light’ version of LTE (4G) with a bandwidth
are also a good option for the transmission of IoT sensor data. The of 1.4 MHz, while NB-IoT is a dedicated wireless communication
upgrade from EDGE to UMTS made this option even more attrac- standard for the Internet of Things. The key difference is that LTE-M
tive, since using a faster transmission system can in the end be additionally supports voice transmission with VoLTE, while an
better than using a lower-power but slower system. However, the NB-IoT system exclusively transmits data messages.
immense bandwidth and power hunger of 4G/LTE make this rule
of thumb a bit less relevant. The power consumption of the trans- The NB-IoT channels, each with a width of only 180 kHz, use a
mitters is significantly higher, and on top of that the modules are subset of the methods implemented in the full version of LTE.
more expensive. Nevertheless, it can be worthwhile. Uplink uses a simple version of the frequency division multiple
access (FDMA) method, while downlink uses orthogonal FDMA
In the framework of the specification 3GPP Release 13, desig- (OFDMA). The quadrature phase shift keying (QPSK) modulation
nated by LTE as ‘informational’, the GSM Association defines method does not require especially complex hardware in terms
two systems for the Internet of Things. The first is Narrowband of processing power.
Internet of Things (NB-IoT), and the second is LTE-M, also known
as LTE Cat-M1 or eMTC. However, it should be noted that introducing NB-IoT usually incurs
How to Get Started development environment. This means that our offering is currently
After these basic considerations, it’s time to start thinking about exclusively oriented to business customers, for which we create a
how you can integrate NB-IoT into practical systems. Of course, tailored offer in the course of a consultation process.”
development of customer-specific modems is not feasible for most
companies, but in the past we have described the ‘design in’ process When working with ‘ordinary’ 2G/3G/4G systems, one way to get
for wireless modules in detail, for example in Elektor 5-6/2021 [5]. around this is to use a ‘virtual’ mobile communication provider such
as PodGroup. When asked about this, they answered that NB-IoT
If you don’t want to start developing your own board right away, one is currently not really suitable, especially for ‘global’ solutions that
option is to use a ‘turnkey’ evaluation board — although the avail- need to work with a single SIM card.
ability of Qualcomm ICs is proving to be a problem in this regard.
There are two reasons for this. Firstly, that the NB-IoT rollout is
Two possibilities are the NBIOT-BG96-SHIELD from Avnet, still relatively limited. And secondly, that roaming agreements
which integrates a Quectel BG96 module, and the 5G NB IoT between the different network operators have generally not yet
click board from MikroElektronika, which hosts a Cinterion been adapted to the new NB-IoT wireless communication standard.
module. Arduino also offers a small development board in the Liked tax treaties between countries, it takes a long time to achieve
form of the MKR NB 1500. However, both of these boards cost such adaptations. In short: international NB-IoT roaming is still
more than 50 dollars. in its infancy.
In many cases, it is no longer permitted to supply evaluation board Is It Worthwhile?
equipped with SIMs, so a massive rollout of applications based on Searching for a practical module that supports only NB-IoT is
NB-IoT is far from easy. The reason for this is that network opera- certainly a very tricky endeavour. Quectel, for example, offers
tors have not yet packaged the technology for end users. This is two versions even with the smallest series (BC660): one with only
also openly admitted by operators, as illustrated by the following NB-IoT, and the other with both eMTC and NB-IoT. Both wireless
statement from Hutchison: standards are also present in larger families, such as the very
popular BG95 and BG96. Open market prices for these modules
“NB-IoT is a very young and innovative network. As there are hardly can only be found at SOS Electronic: the BC660K-GL costs €7.63 is
any devices available on the market, the target group primarily small quantities, while the version with LTE-M and NB-IoT is not
consists of business customers in the hardware (and software) listed. The price there for the BG96 is €19.
A search for u-blox [6] yields more results. The SARA-N3 family
includes a module exclusively intended for the NB-IoT set of proto-
cols, but the Swiss company does not offer a pure CAT-M device
(see Figure 2).
At Gemalto, whose takeover by Thales has made the website even
more confusing than it used to be, there is a pure CAT-M module in
the form of the EMS31, along with a pure NB-IoT module (ENS22)
with the same form factor. At the Czech distributor Sectron you
can compare prices: the EMS31 costs €14, the ENS22 only €8.
Information on current consumption (in roundabout form) can be
found in the data sheets, which go by the name ‘Hardware Interface
Description’. The highest current consumption of the EMS31 occurs
when operating in Band 4 and is 239 mA with a supply voltage of
3.8 V. For the ENS22, the highest current listed is 404 mA in Band 28,
but it should also be noted that wireless modules often require
Figure 3: A traditional Stierian windmill serving as a scarecrow. (Source:
Martin Geisler, CC BY-SA 4.0 [7]). peak currents like this only for a very short time.
WEB LINKS
[1] LTE-M vs. NB-IoT: What are the Differences?: https://www.sierrawireless.com/iot-blog/lte-m-vs-nb-iot/
[2] Wikipedia entry on narrowband IoT: https://en.wikipedia.org/wiki/Narrowband_IoT
[3] GSMA: Word map of IoT wireless communication standards: https://www.gsma.com/iot/deployment-map/
[4] T-Mobile Narrowband IoT web page: https://t-mo.co/3EC5Jo4
[5] Tom Hanna, “Do Not Fear the Cellular Module!,” Elektor Mag 5-6/2021:
https://www.elektormagazine.com/magazine/elektor-175/59527
[6] u-blox mobile communication modules: https://www.u-blox.com/en/cellular-modules
[7] Klapotetz: https://bit.ly/3nOr0Fb
Advertisement
Dragino LPS8
Indoor Gateway Speedy LoRaWAN Gateway Setup
By Mathias Claußen (Elektor) LoRaWAN is a topic we have featured many The Dragino LPS8
number times in Elektor. It is relatively easy The Dragino LPS8 Indoor Gateway (Figure 1)
We have often described to build a basic LoRaWAN node which has is housed in a plastic enclosure and could
how you can interconnect an associated sensor or actuator module. In easily be mistaken for a Wi-Fi router. The
your own electronics devices this type of setup, a LoRaWAN module (which electronics inside are powered by a small
handles communication to the network) is Atheros (today Qualcomm) AR9331 Wi-Fi
using a LoRaWAN link. If connected to a microcontroller board such as SoC clocked at 400 MHz which is specifi-
you are not within range an STMicroelectronics STM32 or Raspberry cally designed for use in router platforms and
of an existing LoRaWAN Pi Pico [1, 2], and this provides an interface access points. With 64-MB RAM and 16-MB
to the sensor. In order for the data sent to Flash, its processing power is not spectac-
gateway, or if you simply and from the node via LoRa to be transported ular when compared with something like a
want to delve a bit deeper further, a remote station is required. In this Raspberry Pi Zero 2 W, but it is more than
into the topic, you can set case, a LoRaWAN gateway will accept the enough for the functions that the gateway
data over the air via LoRa and forward it to needs to perform. The SoC also supports
up and operate your own an Internet platform like The Things Network Wi-Fi according to 802.11 b/g/n and provides
gateway. We tried this using (TTN). You can use a pre-existing gateway a 10/100 Mbit LAN port. The communica-
the low-cost Dragino LPS8 that’s already been set up in your area (many tion rates available are more than capable of
are run by volunteers), or you can set up your handling the relatively slow data rate used by
Indoor Gateway. own gateway. I have been using a Dragino LoRaWAN. The gateway itself does not have
LPS8 to provide an Indoor Gateway for more to provide a lot of computing power either,
than a year now. as it only takes care of the integrated LoRa
RELATED PRODUCTS
> Dragino LPS8 Indoor LoRaWAN Gateway (868 MHz) (SKU 19094)
www.elektor.com/19094
> Seeed Studio LoRa-E5 STM32WLE5JC Development Kit (SKU 19956)
www.elektor.com/19956
WEB LINKS
[1] M. Claußen, “My First LoRaWAN,” ElektorMag 3-4/2020: http://www.elektormagazine.com/magazine/elektor-141/57159
[2] M. Claußen, “LoRa with the Raspberry Pi Pico,” ElektorMag 7-8/2020:
http://www.elektormagazine.com/magazine/elektor-179/59721
[3] Dragino LPS8 Indoor Gateway Handbook: http://www.dragino.com/downloads/index.php?dir=LoRa_Gateway/LPS8/
[4] Firmware download of Dragino LPS8 Indoor Gateway: https://bit.ly/LPS8-firmware-release
[5] Gateway picture resource: http://www.dragino.com/media/k2/galleries/148/LPS8-10.jpg
[6] Dragino LPS8 Indoor Gateway Manual: https://bit.ly/LPS8-user-manual
[7] The Semtech SX1257 Front-End Data sheet: https://sforce.co/3fZmy1f
[8] The Semtech SX1308 Transceiver Data sheet: https://sforce.co/32zxAqV
Editor’s Note. This article is an excerpt from the 376-page book Explore ATtiny Microcontrollers using C and Assembly Language (W. Smith,
Elektor, 2021) The excerpt was formatted and lightly edited to match Elektor Mag’s editorial standards and page layout. Being an extract from
a larger publication, some terms in this article may refer to discussions elsewhere in the book. The Author and Editor have done their best to
preclude such instances and are happy to help with queries. Contact details are in the Questions or Comments? box.
I/O ports are configured and controlled using a set of four registers Remember that to use this configuration a programmer/debugger,
in the ATtiny13(A) and ATtiny25/45/85. When a pin is configured such as an Atmel-ICE, or AVR Dragon must be used.
as an input pin, a program running on the AVR can read the logic
level on the pin. If a switch is attached to the pin, the logic level
on the pin can be read to see if the switch is open or closed. When
a pin is configured as an output pin, it can be used to switch the
logic level of the pin high (to logic level 1) or low (to logic level 0).
An output pin can be used to drive an LED as was done in the LED
blink project described elsewhere in the book.
Questions or Comments?
Do you have any technical questions or comments related to this
article? Email the author at [email protected] or Elektor at
[email protected].
WEB LINK
[1] Book resources/info page: www.elektor.com/20007
Digital Oscilloscopes:
Powerful and Economical
MSO5000 Series
Digital High-End Oscilloscopes
+4V5
Driving Motors with H-Bridges
Elektor 01-02/2022, P. 6 (210491)
Unfortunately, the H-bridge with relay
diagram in this article (Figure 4) is missing
S1 S2
FWD BWD
a connection between the Motor M- and
the common switched contacts of relays K3
and K4. We have included here a corrected
version of the diagram. Many thanks to
the eagle-eyed readers who spotted this
blooper. D1 K1 D3 D5 K3 D7
Another error crept into the descriptions M1
of Figure 14 and 20. The chip shown is M
actually an L298N device and not an L294N
as suggested in the description. D2 K2 D4 D6 K4 D8
The last two diagrams shown in Figure 23
do not show the correct sequence of field
excitation and rotor orientation. Here is
210491-004
LoRa GPS
Tracker Update
Receive and Show Location
Using a Raspberry Pi
By Hans Schneider (Germany) that the reader is familiar with entering commands using the Raspberry
Pi Terminal app. Next, we need to log into the terminal via SSH, by
The article, “LoRa GPS Tracker,” featured using the following command line: bash <(curl -sL https://raw.
in the 6/2020 edition of Elektor described githubusercontent.com/node-red/linux-installers/master/
how to collect the tracking data from a TTN deb/update-nodejs-and-nodered). You may need to enter sudo
apt install build-essential git so that npm is able to build the
server using Node-RED and then visualize it binary modules that need to be installed. The script takes some time
on a map. In principle, this should work, not to run; you should expect it to take around half an hour to complete.
only with a PC, but also with a Raspberry Pi.
When the Script is finished, the command sudo systemctl enable
Indeed this is possible, but there are one or nodered.service can be input via the Terminal so that Node-RED
two hurdles that need to be overcome. One starts automatically when the Raspberry Pi is powered up or rebooted.
of our readers found a good solution and This command can be disabled by entering sudo systemctl disable
nodered.service.
describes how he ported the Node-RED flow
to the single board computer. The Node-RED server can be started using node-red-start, and
stopped with node-red-stop. To stop and restart the server use
In the article, “LoRa GPS Tracker” (Elektor, Nov/Dec 2020), Mathias node-red-restart. The terminal can be exited after starting Node-RED,
Claussen describes hardware and software that can be used to track and the server will continue to run. When the terminal is restarted, you
moving objects. A compact tracker module sends the data from a can start the output service of the server using node-red-log and see
GPS sensor via LoRa to a gateway, which forwards it to a The Things the output in the terminal. This is useful if you want to check if everything
Network server, where the raw data can be called up manually via the is still working without starting a new instance of the server.
Internet, provided the necessary authorization is granted. Of course, this
is more convenient when it is accessed automatically via a framework Installing the Required Modules in Node-RED
such as Node-RED, which can also control the display on a (world) The modules can be installed in Node-RED by using either the palette
map. The Node-RED-Flow described in the article works very well on manager in the browser window or by using the npm package manager
a PC, but this has one major drawback: an energy-guzzling PC needs from the terminal. My recommendation would be to use npm because
to be powered up for this purpose and we need the Node-RED server in my experience that works more reliably. In this case, however,
running, otherwise we will get no data. Node-RED must be terminated beforehand.
It’s likely that many tech-savvy households will already have at least one If, on the other hand, the Node-RED service runs on the Raspberry
Raspberry Pi on which software such as Pi-Hole [1], Homebridge [2] Pi, you can log into the user interface using a browser on the PC. For
or Flightradar24 [3] is running and continuously waiting to receive and this, you need to enter the address line: http://<IP-address of
send data. Why shouldn’t we entrust another task to this Raspberry Pi? Raspberry Pi>:1880 , which will get you into the Flow-Editor. The
One note of warning: the resources used by Node-RED can sometimes required modules are installed here first; in the Flow-Editor, this is
conflict with a Homebridge installation. With that in mind, the instal- done via the palette manager. The modules you will need are (some
lation procedure is also not entirely without difficulties. of them were already installed when installing Node-RED):
Installing Node-RED on the Raspberry Pi > node-red
First, we need to install Node-RED on the Raspberry Pi. It is assumed > node-red-contrib-worldmap
The Username is the Application ID from the TTN console with @ttn
appended. An access key with at least “Messages Rights” must be RELATED PRODUCTS
generated as the password in the TTN console. The Access Key copied
from the TTN console is then pasted under Password and confirmed by
clicking on Add. Back in the mqtt in element, you can give the element
> Elektor LoRa Node – Partly Assembled Module
(SKU 19175)
a name (e.g. TTN uplink); lastly a click on Done completes the task. www.elektor.com/19175
Figure 6 shows the updated Node-RED flow chart. The CayenneLPP > SeeedStudio RFM95 Ultra-long range LoRa Transceiver
decoder shown in the flow is included for future system expansion. Module (868 MHz) (SKU 18715)
www.elektor.com/18715
210120-01
Reportedly, one of the best features of TINA is that a simulated circuit can easily be
implemented on a PCB with auto-placement and auto-routing capabilities. Users can also
use the Gerber plotting and CNC drilling options of TINA to learn, design, and implement
a prototype of their projects. That’s “awesome,” but before any PCB can come into play, you
have to master elementary circuit simulation. Here’s an up-tempo primer to TINA you
cannot afford to miss and do on your PC.
A sinusoidal oscillator consists of an amplifier and a feedback The total loop phase shift is, therefore, 0° as required for oscillation.
network (Figure 1). The following two conditions must be satis-
fied to have a working oscillator: TINA schematic
Figure 2 shows the circuit diagram. The RC network is connected
> the loop gain (A × B) in Figure 1 must be greater than or equal to the inverting input of the operational amplifier. Assuming the
to unity; resistors and capacitors are the same, the requirement is that the
> the total phase shift around the circuit must be 0 or 360°. voltage gain of the amplifier must be greater than or equal to 29, i.e.:
Rf
Some simulations of operational amplifier-based oscillator circuits Gain
29
are given in this section. R
Rf 1
29 f
R 2 RC
and we choose Rf = 237 kΩ. A type UA741 operational amplifier In this example, the required frequency is 5 kHz. Choosing C =
is used in this project. The TINA circuit is available as a file sim9 3 nF, we can find the required value of R from:
(see article end).
1 1
R
TINA simulation 2 f C 2 5 103 3 109
The steps to run the simulation are:
which gives R = 10.6 kΩ.
> Click T&M -> Oscilloscope and Run. Set the Time/div to 100 u.
> Check the output waveform (Figure 3). The period is 250 µs
which corresponds to 4 kHz. Note the glitch in the output
waveform on the oscilloscope. The oscilloscope can be
synchronized to create a stable picture. To do this, select
Normal under Mode and synchronizing signal under Source. It
may also be needed to set the (Trigger) Level.
To satisfy the gain condition, for a non-inverting amplifier (see 1
f
Figure 4): 2 LCT
TINA simulation
The steps to run the simulation are:
RELATED PRODUCTS
> Click T&M -> Oscilloscope and Run. Set the Time/div to 50u.
> Check the output waveform (Figure 7). The period is 100 µs
(100u) which corresponds to 10 kHz. > Book: D. Ibrahim, Circuit Simulation with TINA Design
Suite & TINACloud (SKU 19977)
www.elektor.com/19977
Where to get it?
The TINA simulation files mentioned in this article are contained > E-Book: D. Ibrahim, Circuit Simulation with TINA Design
in the software bundle released by the author and DesignSoft in Suite & TINACloud (SKU 19978)
support of the book. The software is available for free download- www.elektor.com/19978
ing. Head over to [1], scroll down to the Downloads, and click on
this file name:
Contents_Circuit Simulation with TINA Design Suite & TINACloud.
Save the ZIP archive file locally (2.45 MB)) and then extract it.
Open your version of TINA and load the files sim9, sim10, sim11 as
mentioned in this article. Feel free to modify them for your own
applications.
Limited Time Offer: The TINA book comes with a free, one-year
license of TINA Cloud Basic Edition.
220025-01
Contributors
Text and Graphics: Dogan Ibrahim
Editor: Jan Buiting
Layout: Giel Dols
u b li c a t io n s c ome with
Questions or Comments? Both p r License
Do you have any technical questions or comments related to this
E E o n e -y e a
a FR
article? Email the author at [email protected] or Elektor
I N A C lo u d B a sic Edition
at [email protected].
for T r).
(Limited Offe
WEB LINK
[1] Book resources/info page: www.elektor.com/circuit-simulation-with-tina-design-suite-tinacloud
From Life’s
Experience
Assembly Line Work
By Ilse Joostens (Belgium)
WEB LINKS
[1] “Is cake smashing the dumbest cake trend ever?”, Anges de Sucre/Anges Bakery: https://bit.ly/3nyQeGD
[2] P. S’heeren, “Swiss Pi – A Swiss Army Knife for the Raspberry Pi,” Elektor 09-10/2016:
https://www.elektormagazine.com/magazine/elektor-201609/39796
For many electronics projects, a Windows PC is used to provide control the .NET framework, which was intended for Windows programs and
functions, data logging and other tasks; it will typically be necessary to whose further development ended at version 4.8.
develop a graphical user interface to run under Windows to carry out this
function. Locally executed desktop applications are often the method of Version .NET 5, on the other hand, is the technological successor to
choice here; they give you complete access to the system environment .NET Core. This framework is not limited to Windows, but can also be
and, via the appropriate drivers, also provide links to connected peripherals. used with other operating systems. Microsoft has surprisingly trans-
formed both WinForms and WPF to .NET Core. If you are creating an
Microsoft, as the manufacturer of the Windows operating system, is app for Windows today and opt for WinForms or WPF, then you have
currently undergoing a major technological upheaval. The focus of the choice between the previous .NET framework and .NET Core. It
this activity is on the connectivity and design of user interfaces. The is also possible to migrate existing applications, but, as is so often the
developments are coordinated under the project names WinUI 3 and case with such projects, it is often associated with a number of issues.
Windows App SDK. In this article, we show what this new graphic inter- Other manufacturers of development tools for Windows applications
face is all about and where we can use it. First, we get an overview of have mostly based them on the graphic interface of the operating
the possibilities of programming Windows applications with a graphi- system (GDI) and encapsulated this in their own framework.
cal user interface. The purpose of WinUI 3 will become clear by using
different technologies and application types. Not content with a purely The second category of Windows applications are apps for the Univer-
theoretical review of this relatively new type of Windows application, sal Windows Platform (UWP). These run in an individually isolated area
we will also go ahead and create our first practical application. of the operating system and have only limited system access. Users
install these apps through the store. In practice, however, this type of
The Technology app has not proved to be popular and its uptake is quite low. One of the
Basically, current applications using a graphical user interface for the reasons for this is that system access from these apps is very limited.
Windows operating system can broadly be divided into two types. On The UWP however has the advantage that the graphics framework
the one hand, we have Desktop Applications. These are essentially based WinUI 2 used here is significantly more modern than the technologies
on the use of the Win32 API. There are different approaches, frameworks of WinForms and WPF. An appealing design, new visual components,
and programming languages for their development. The technologies the use of materials and the orientation towards the design language
Windows Forms (WinForms) and Windows Presentation Foundation Fluent Design System are its stand out features. In other words, apps
(WPF) come from Microsoft. WinForms relies on the Windows GDI inter- for the UWP look modern, contemporary and fresh, but their usability
face. WPF is based internally on DirectX and was originally intended as is somewhat limited. To achieve similar effects with the WinForms or
a replacement for WinForms. Both graphics frameworks were based on WPF technologies, we need to do some pull-ups, use extensive third-
party components or “mix” the WinForms/WPF technologies with the > Separation of code and design: The user interface is declaratively
UWP. This approach however quickly leads to a more complex app created in separate files using the XML-based XAML language.
structure and brings with it the typical disadvantages, such as higher > UI control elements: A range of controls are available for design-
susceptibility to errors and poorer maintainability. ing the user interface. These include basic elements such as
buttons and text entry fields, along with more complex and
Software designed for electronic control, development, etc., are advanced elements such as a calendar control element, a
almost without exception classic desktop applications. You can also WebView or an element for displaying personal data, which we
build these using other tools and frameworks. For the program- can use, for example, for user administration. If you would like to
ming language Java there is, for example, the graphics framework explore the range of control elements further go to the Micro-
Swing, which for Windows is based internally on the GDI operat- soft Store and download the WinUI 3 Controls Gallery app from
ing system interface. there. This app gives a preview of the available controls for WinUI
3. Their use (Use Case) and their integration in the source code
The WinUI 3 Graphic Framework (XAML) are demonstrated. Corresponding links to the documen-
With the introduction of the WinUI 3 graphic interface, Microsoft tation can also be found (Figure 1).
would like to enable all applications under Windows to use a modern > Loose coupling through DataBinding: The properties and events
graphic interface. WinUI 3 is the technological successor to WinUI 2 of the control elements are linked to the source code by means
[1]. However, it is available for all types of Windows applications and of data binding. In this way, data is exchanged in both directions
is therefore not limited to use in apps for the UWP. WinUI 3 is part between the program code and the user interface control. Events
of the new Windows App SDK, which is also provided in parallel of the control elements, such as the click on a button, are also
with the introduction of Windows 11. The Windows APP SDK bundles forwarded to the relevant algorithm in the same way.
new features for the development of Windows applications. It is not > Modern Design: The WinUI 3 provides a contemporary feel.
only aimed at Windows 11, but can also be used under the current This includes the use of Microsoft’s design language Fluent
versions of Windows 10. Development of the Windows App SDK is Design System with the Mica material introduced in Windows 11.
still ongoing, but a first version is available that can already be used The Fluent Design System provides the following UI elements:
in newly created applications. conscious use of geometry and colour, overlapping of surfaces,
use of selected materials and the use of specific iconography and
WinUI 3 is technically and conceptually based on WinUI 2. If you have typography for visual design using images, symbols and fonts.
ever developed an app for the UWP, you will quickly get to grips with Motions between UI elements are also supported.
it. It is based on the following principles:
Let’s look at the procedure for developing applications with the WinUI 3.
First, we will need to set up the development environment.
A Demo Application
The best way to become familiar with any new system is to try it out.
Here we will design a simple user interface for our first application (the
source code, for this example, can be found on the web page for the
article [3]). The starting point is the XAML file for the relevant page.
As an experiment we can create a handy calculation tool for use with
the LM317 adjustable linear voltage regulator (Figure 8). The output
voltage of this device is given by the formula Vout = 1.25 (1 + R2/
R1). We can solve this equation for R2 and thus calculate its value to
give the desired output voltage. With the help of this example we can Figure 7: A first desktop application with WinUI 3.
the need for any further configuration, all the elements will be arranged the application is started - without saving — and produce an updated
one above the other with StackPanel. The controls are configured via display. This feature is called Hot Reload and is standard when creat-
the XAML code, with the properties according to Table 1. ing graphical user interfaces.
The associated source code is shown in Listing 1. You can code the What is interesting here is the control binding of the control elements of
surface interactively. Start the application and place the relevant XAML TextBox type with the properties of Text. Here you will find an expres-
file in Visual Studio and the application side by side on the screen sion according to the pattern in the XAML code:
(Figure 9). Changes in the XAML code are immediately adopted when
Text="{x:Bind ViewModel.R1, Mode=TwoWay, UpdateSource two layers. Thanks to the MVVM concept, all layers are decoupled
Trigger=PropertyChanged}" and can be developed and maintained independently of one another.
Information on the MVVM pattern can be found under [4].
This means that the property of Text is bound to the variable R1. This is
defined in the ViewModel page and is based on the MVVM concept. Program Logic
UI events are handled in the View layer and data is managed in the The program logic is implemented using C# (Listing 2). For this
Model layer. The ViewModel represents the connection between the purpose, a program file (ViewModel) is assigned to each window of
WEB LINKS
[1] Information for WinUI 3: https://docs.microsoft.com/en-us/windows/apps/winui/
[2] Visual Studio 2019: https://visualstudio.microsoft.com/
[3] Project page for this article: http://www.elektormagazine.com/210407-01
[4] Information for MVVM pattern: https://en.wikipedia.org/wiki/Model%E2%80%93view%E2%80%93viewmodel
Create GUIs
Part 04
with Python:
World’s worst GUI
Learn good GUI design by doing it all wrong first!
I
Laura Sach t’s time to really go to town with your GUIs and visible and show it if it’s not:
MAKER
Pop-ups
No terrible GUI would be complete without a pop-up
worst4.py window.show(wait=True)
app.display()
worst5.py
> Language: Python 3
def are_you_sure():
if app.yesno("Confirmation", "Are you
sure?"):
app.info("Thanks", "Button
05-worlds-worst-gui.py pressed")
else:
app.error("Ok", "Cancelling")
> Language: Python 3
Add the button to your GUI which calls the function
001. from guizero import App, PushButton
when it is pressed.
002.
003. def are_you_sure():
004. if app.yesno("Confirmation", "Are you sure?"): button = PushButton(app, command=are_you_
005. app.info("Thanks", "Button pressed")
006. else: sure)
007. app.error("Ok", "Cancelling")
008. Your code should now resemble 05-worlds-worst-
009. app = App(title="pointless pop-ups")
010. gui.py. When you run the application and press the
011. button = PushButton(app, command=are_you_sure) button, you will see a pop-up asking to you confirm
012.
with a Yes or No (Figure 4).
013. app.info("Application started", "Well done you started the
014. application") You can find out more about the pop-up boxes in
015. guizero at lawsie.github.io/guizero/alerts.
016. app.display()
How about combining all of these ‘features’ into
one great GUI?
By Dr. Thomas Scherer (Germany) low-power systems which can handle a peak looks very simple, but as ever the devil is
demand in the range of a few watts to a couple in the detail. In the following sections we
What is an off-grid solar of kilowatts. Also, as the levels of feed-in tariffs will therefore take a look at these individual
system? Where are such continue to fall, new and simplified designs components.
for fixed domestic solar installations that store
installations necessary or the generated energy locally in rechargeable Here’s a real-life example: Klaus, a good friend
practical? What are the batteries solely for private use, rather than of mine, decided to install a 12 V system in his
most important design feeding into the public supply grid, begin to shed because of the low prices and manage-
make more sense. These installations typically able size of the components involved. To
considerations? These have a maximum nominal power output of a design the system and specify the compo-
questions and more will be few kWp (‘kilowatts peak’). Let us now look nents there are two questions that first need
answered in this article. at these small-scale systems in more detail. to be answered.
Advertisement
SERVICE.
Optocouplers by Würth Elektronik
With the new optocouplers, Würth Elektronik presents one of the latest additions
Optocouplers by Würth Elektronik to its optoelectronic product portfolio. The innovative design features a coplanar
structure and high-grade silicon for total internal reflection. The coplanar design
ensures the isolation gap stay fixed during the production process and provide
perfect isolation and protection for your application. The total internal reflection
provide stable CTR over the whole temperature range and high CTR even at low
current operation.
Provided in all industry standard packages. Available with all binnings ex stock.
Samples free of charge: www.we-online.com/optocoupler
Advertisement
Advanced ML for
every solution
Try free at edgeimpulse.com
Contributors
Text and figures (unless otherwise stated):
Dr. Thomas Scherer
foldable 120 Wp panel plus a Victron Energy battery, it also avoids a large amount of Editor: Jens Nickel
MPPT charge controller came to a total of bureaucracy: not a negligible consideration! Translation: Mark Owen
just under €500/US$550/£450. The charge (Note that such an arrangement may not be Layout: Harmen Heida
controller has a Bluetooth connection and legal in all countries.)
all parameters and graphs can be monitored
using a smartphone app. In the arrangement in Figure 11 the savings Questions or Comments?
from using the simplified design add Feel free to send technical questions to
The Semi-Off-Grid House up to €1000/US$1150/£850 to €2000/ the Elektor editorial team by e-mail to
In these times of dwindling feed-in tariffs inter- US$2300/£1700. It would take a few years [email protected].
est has grown in a version of the fixed solar to make up for that using a feed-in tariff. The
installation that as far as possible dedicates
all of the generated energy to the demand of
the house. An array of, for example, 10 modern
solar panels will generate some 3.75 kWp; a
suitable MPPT solar charge controller could
then charge a LiFePO4 battery with a capac-
ity of say 6.5 kWh; and then a three-phase RELATED PRODUCTS
inverter could be controlled using a current
monitoring circuit (the three ammeters
towards the bottom right of Figure 11) to > PeakTech 4350 Clamp Meter (SKU 18161)
ensure that under no circumstances is any www.elektor.com/18161
electrical energy driven into the grid. All the
‘current’ is therefore locally used. With electric- > Pokit Meter: Portable Multimeter, Oscilloscope and Logger (SKU 19854)
ity in Europe in 2022 costing around €0.35/ www.elektor.com/19854
US$0.40/£0.30 per kWh this is a very attrac-
tive option: not only does it avoid having a > PeakTech 3445 True RMS Digital Multimeter with Bluetooth (SKU 18774)
complex and also expensive grid-tied inverter www.elektor.com/18774
with integrated charging electronics for the
WEB LINKS
[1] T. Scherer, “Balcony Power Plant,” Elektor Magazine September/October 2021: www.elektormagazine.com/210326-01
[2] T. Scherer, “Solar Power for Mowing Robots,” Elektor Magazine July/August 2021: www.elektormagazine.com/200553-01
[3] Victron Energy, “How to not blow up your alternator when charging lithium,” YouTube: www.youtube.com/watch?v=jgoIocPgOug
The 10-Year
Smartphone
Renew Your Expectations
Maybe you’ve seen the ads online for a new What about your washing machine, your washing machine if it suddenly refused
smartphone that will last you 10 years. wake-up light, or your reflow oven? to spin cycle? I don’t think so. I think my
Maybe you too clicked on one, only to be reflex would be to google the problem to
disappointed that this phone does not Giving you two to four years doesn’t seem see if maybe the internet knows that this
exist ... yet. The “10-year phone” is an so bad for most devices as you will proba- happens all the time and I should just
initiative that has been trying to get your bly want something new in this timeframe unclog the something-nozzle. Maintaining
attention, and the EU’s legislative atten- anyway. Which is a strange notion. Where and repairing it myself. Should that fail, I
tion, by tempting us with a future in which did this drive to continuously upgrade would probably get a repair professional
it becomes the norm for a smartphone to come from and isn’t it time we got ourselves IF the washing machine is not older than
last a decade. In order for this to actually rid of it? In light of our planet drowning 10 years.
work, there would have to be legislation on in our stuff, the resources and suffering
repairability, continued software support involved in making many of our devices Washing machines and smart phones are in
and availability of parts — especially the and our own appreciation of what we have. the same price range. But we don’t expect
battery. Information should be readily How about we adjust our devices and our our phones to last a decade. It’s time that
available on how to repair your phone mental models to last longer? we smarten up.
yourself along with an official repairabil-
ity score [1]. New Reflex The 10-Year Smartphone is an initiative of the
My smartphone is now around five years European Right to Repair campaign, a coali-
Timing old, and I desperately need to have the tion of over 80 organisations from across
Somewhere along the journey of increas- battery replaced. It drops from 42% to Europe, pushing for longer-lasting and more
ingly amazing mobile phones, we appear dead in an instant. I found myself brows- repairable products.
to have accepted that these expensive ing for a new phone until I realised that I 210714-01
lifelines are only going to last two to four am still very happy with my phone beyond
years (in full working order). I guess we the suicidal battery. I am not alone in this WEB LINK
don’t often stop to consider how much new reflex; only 11% of people in the EU
[1] “10 Year Smartphone”:
time we actually expect from our devices. will repair their phone when it fails them.
https://10yearphone.com/
How long should your 4K flat screen last? Would I also immediately browse for a new
puhui T-962
Infrared Reflow Oven
Price: €229.00
Member Price: €206.10
www.elektor.com/20135
Raspberry Pi Zero 2 WH
(with pre-soldered GPIO Header)
Price: €34.95
Special Price: €29.95
www.elektor.com/20157
www.elektor.com/20137 www.elektor.com/20098
www.elektor.com/20130 www.elektor.com/20096
Traditionally, the last page of Elektor The Hexadoku puzzle employs numbers in the hexadecimal range 0
through F. In the diagram composed of 16 × 16 boxes, enter numbers
magazine is reserved for our puzzle with an such that all hexadecimal numbers 0 through F (that’s 0-9 and A-F)
electronics slant: welcome to Hexadoku! occur once only in each row, once in each column and in each of the
Find the solution in the gray boxes, submit it 4×4 boxes (marked by the thicker black lines). A number of clues
are given in the puzzle and these determine the start situation.
to us by email, and you automatically enter
the prize draw for one of five Elektor store Correct entries received enter a prize draw. All you need to do is
vouchers. send us the numbers in the gray boxes.
PRIZE WINNERS
The solution of Hexadoku in edition 02-03/2022 (March & April) is: C73B8.
Solutions submitted to us before April 15th were entered in a prize draw for 5 Elektor Store Vouchers.
The winners are posted at www.elektormagazine.com/hexadoku.
Congratulations everyone!
The competition is not open to employees of Elektor International Media, its subsidiaries, licensees and/or associated publishing houses.
ORDER NOW!
www.elektormagazine.com/win-a-voltera-v-one
PROTEUS
DESIGN SUITE
Design Quality Assurance
Constraint Driven
Design
Flexible and scalable
Zone Inspector
rule system
Full support for design Analyze plane coverage and
rule rooms stitching
Manufacturing Grid view of plane
solder mask rules configurations
Live display of
Edit plane settings and
violation areas
draw order
Dedicated
Reporting
Module
Tables automatically
populate with design
Pre-Production data
Checklist
Compliance status for
diff pairs and length
Set of board tests
matched routes
before Gerber Output
Make custom
Includes placement, reports with data
connectivity and object tables
clearance testing
Generate reports
Completely independant from templates
code for clearance checks
[email protected]
+44 (0)1756 753440