0% found this document useful (0 votes)
538 views116 pages

Elektor 07.08 2025

The July & August 2025 edition of Elektor Magazine focuses on IoT and sensor technologies, featuring projects like an OBD2 sensor dashboard that provides real-time vehicle data. The magazine includes articles on various sensor applications, including LiDAR, radar, and solar charge controllers, along with insights from industry events. It also highlights membership benefits and upcoming editions with a mix of DIY projects and electronics tips.

Uploaded by

AlbertARG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
538 views116 pages

Elektor 07.08 2025

The July & August 2025 edition of Elektor Magazine focuses on IoT and sensor technologies, featuring projects like an OBD2 sensor dashboard that provides real-time vehicle data. The magazine includes articles on various sensor applications, including LiDAR, radar, and solar charge controllers, along with insights from industry events. It also highlights membership benefits and upcoming editions with a mix of DIY projects and electronics tips.

Uploaded by

AlbertARG
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 116

£9.95 | €10.95 (DE) | €13.50 (other EU countries) | $12.

95

JULY & AUGUST 2025


538 ELEKTORMAGAZINE.COM
S

*
IN 1
CE 196

OBD2 Sensor
Dashboard
Real Vehicle Data on an Adaptable Display

FOCUS ON

IoT &
Sensors

OBD2 Rev Counter and


Gear Shift Indicator LiDAR and
Save Fuel and Keep Vision Sensors
Emissions to a Minimum For Robotics and More

Solar Charge Controller Contact-Free E-Field Analog Audio Frequency


with MPP Tracking Measurements Assessing Generator
The Circuit in Detail DC Voltages or Static Fields Adjustable-Frequency Sine Wave
Join the
Elektor C mmunity
Take out a G O L D membership

membership!

The Elektor web archive from 1974!


8x Elektor Magazine (print)
8x Elektor Magazine (digital)
10% discount in our web
eb shop and exclusive offers
Access to more than 5,000 Gerber files

Also available The Elektor web archive from 1974!


8x Elektor Magazine (digital)
The Digital G R E E N
membership
10% discount in our web shop and
exclusive offers
membership! Access to more than 5,000 Gerber files

www.elektormagazine.com/member
COLOPHON EDITORIAL

Jens Nickel
Volume 51, No. 538 International Editor-in-Chief, Elektor Magazine
July & August 2025
ISSN 1757-0875

Elektor Magazine is published 8 times a year by


Elektor International Media b.v.
PO Box 11, 6114 ZG Susteren, The Netherlands
Phone: +31 46 4389444
www.elektor.com | www.elektormagazine.com
Sensors and Wrenches
Content Director: C. J. Abate
Editor-in-Chief: Jens Nickel The IoT is everywhere right now — including in our editions. We’ve featured remote control
and remote monitoring projects in past issues, and we have LoRa and 4G projects planned
For all your questions for the Wireless edition in September. So for this issue, we’ve decided to focus a bit more on
[email protected] sensors. It’s an interesting field — not just for someone like me who studied physics.

Become a Member
This year, I visited the Sensor+Test fair in Nuremberg once again, and I was impressed by
www.elektormagazine.com/membership
many new developments, including sound intensity scanning and antenna arrays for tracking
Advertising & Sponsoring thousands of Bluetooth devices (see page 26).
Büsra Kas
Tel. +49 (0)241 95509178 In this edition, my colleague Jean-François Simon takes a closer look at a radar sensor you can
[email protected] use for presence detection and many other applications (page 50). Saad Imtiaz from our lab
www.elektormagazine.com/advertising reports on some of the best LiDAR sensors currently available (page 19). As you’ll see, there are
major differences in both specifications and cost. When I have time, I plan to buy one suitable
Copyright Notice
© Elektor International Media b.v. 2025
for beginners and run my own experiments with it. A kind of 3D map of audio equipment —
combined with sound direction measurements — could make for a fun, visionary project.
The circuits described in this magazine are Who knows? Maybe you’ll read about it in July 2026 (or 2027).
for domestic and educational use only. All
drawings, photographs, printed circuit board Our main cover projects — yes, we have two this time — are aimed at a different kind of
layouts, programmed integrated circuits, enthusiast: one who likes to solder and isn’t afraid to pick up a wrench (pages 6 and 14). For
digital data carriers, and article texts published
people like that, a faint smell of gasoline and a free Saturday are the foundation for happiness.
in our books and magazines (other than
third-party advertisements) are copyright
And I know we have plenty of them among our readers.
Elektor International Media b.v. and may not
be reproduced or transmitted in any form About 15 years ago, our “OBD2 Mini Simulator” was a big hit (https://elektormagazine.com/
or by any means, including photocopying, magazine/elektor-201006/19323). It even generated interest beyond our regular readership
scanning and recording, in whole or in part — if I remember correctly, even some German car websites picked it up.
without prior written permission from the
Publisher. Such written permission must also
I hope our two new OBD projects bring just as much joy to auto enthusiasts. As always, the
be obtained before any part of this publication
is stored in a retrieval system of any nature.
articles don’t just invite you to build them — they’re also an invitation to modify and extend
Patent protection may exist in respect of them to suit your own needs.
circuits, devices, components etc. described
in this magazine. The Publisher does not Whether you’re mapping with LiDAR or decoding engine diagnostic codes, I hope this issue
accept responsibility for failing to identify such gives you plenty to tinker with!
patent(s) or other protection. The Publisher
disclaims any responsibility for the safe and
proper function of reader-assembled projects
based upon or from schematics, descriptions
or information published in or in relation with
Elektor magazine.

Print
Senefelder Misset, Mercuriusstraat 35,
7006 RK Doetinchem, The Netherlands

Distribution
IPS Group, Carl-Zeiss-Straße 5
The Team
53340 Meckenheim, Germany
Phone: +49 2225 88010 International Editor-in-Chief: Jens Nickel | Content Director: C. J. Abate | International Editorial
Staff: Hans Adams, Asma Adhimi, Mahy Arafa, Roberto Armani, Jan Buiting, Rolf Gerstendorf (RG),
Ton Giesberts, Saad Imtiaz, Alina Neacsu, Dr. Thomas Scherer, Jean-Francois Simon, Clemens Valens,
PEFC Certified
Brian Tristam Williams | Regular Contributors: David Ashton, Stuart Cording, Tam Hanna, Ilse Joostens,
This product is from
sustainably managed
forests and controlled
Prof. Dr. Martin Ossmann, Alfred Rosenkränzer | Graphic Design & Prepress: Harmen Heida,
sources
Sylvia Sopamena, Patrick Wielders | Publisher: Erik Jansen | Technical Questions: [email protected]
PEFC/30-31-151 www.pefc.org

July & August 2025 3


THIS EDITION Volume 51, No. 538
July & August 2025

OBD2 Sensor
Dashboard
Old Dials Spark
a Quest for Real Data

6
Regulars Projects
3 Colophon 6 OBD2 Sensor Dashboard
Old Dials Spark a Quest for Real Data
48 Peculiar Parts
Solar Cells 14 OBD2: Rev Counter and Gear Shift Indicator
Retro, But Super Useful
56 From Life’s Experience
Paper Factory 28 Contact-Free E-Field Measurements (1)
A Vibrating Membrane for Assessing DC Voltages or
70 Err-lectronics
Static Electric Fields
Corrections, Updates, and Readers’ Letters
36 Wireless Mailbox Notifier
73 Starting Out in Electronics…
From Optical Sensors to Radar, Exploring a Few Options
…Concludes the Topic of Opamps
42 Elektor Mini-Wheelie
92 2025: An AI Odyssey
A Self-Balancing Robot
Mid-Year Review
82 Solar Charge Controller with MPPT (2)
The Circuit

Features 88 Ultrasonic Obstacle Detector


A Simple Project to Help Those with Impaired Vision

19 LiDAR and Vision Sensors for Robotics 94 Raspberry Pi Standalone MIDI Synthesizer (3)
Making It Smarter and Adding a User Interface
50 Getting Started with a Modern Radar Sensor
Is Your Radar Accurate? 102 Meshtastic: A Demo Project
An Intelligent Mesh of LoRa Radios
66 Exploring Wireless Communication with the BeagleY-AI
110 Analog Audio Frequency Generator
76 A Powerful AI Code Assistant High-Quality Adjustable-Frequency Sine Wave Generator
Speed Up Your Development with Continue and
Visual Studio Code

FOCUS ON

IoT & Sensors


4 July & August 2025 www.elektormagazine.com
A D
V In e
Supply Voltag

Getting Started with


En IIC, SPI
V Iout, ref
V Out, ref

V Bat Serial

a Modern A2
V Out

V In
D

Controller
Data

Radar Sensor
V In
I PV I In A
A1

PV V ISense =

Is Your Radar V PV
I Out x c
Charge
Load_On

Accurate?
Solar Charge En
V In T1
T2

Controller
In
I Out

Gate D1
I Sense
PWM Drive

with MPPT 0V = max


V Out

50 82
+V = min

The Circuit 250109-007

Industry Next Editions


26 Sensor+Test 2025 and PCIM 2025 Elektor Magazine Circuit Special 2025
In the tradition of our Summer Circuits, the next edition will be
58 Cybersecurity
extra thick, filled with dozens of DIY projects, retro circuits, tips
Tough Times for Hackers
and tricks, and much more! Circuit Special 2025 will be published
62 Siglent Presents Next-Gen Multichannel Oscilloscopes around August 13, 2025.
High-Performance Solutions for Modern Power and
Embedded Systems Elektor Magazine September & October 2025
As usual, we’ll have an exciting mix of projects, circuits,
64 Bluetooth 6.0 Brings Enhanced Distance-Ranging
fundamentals, and tips and tricks for electronics engineers and
Applications
makers. Our focus will be on Wireless & Communication.
New Version Offers Improved Device Positioning and
Location Services
> Navigating Wireless Protocols
> Accurate Positioning with Bluetooth
> Satellite Tracking Using LoRa
> Wireless Audio Transmission
> AM Transmitter
> Performance Tests with the RP2350
> Model Car Remote Control with an ESP32
> Raspberry Pi Zero Web Streaming Camera
BONUS CONTENT Elektor Magazine’s September & October 2025 edition will be
Check out the free IoT & Sensors published around September 10, 2025.
bonus edition of Elektor Mag!
Arrival of printed copies for Elektor Gold members is dependent on
> Full-Range Analog Input for the ESP32 shipping times.
> Review: Topdon TC004 Lite Thermal Imaging
Camera
> Secure Firmware for Microcontrollers
> Infographics: IoT and Sensors
OBD2: Add a Rev Counter
and Gear Shift Indicator
www.elektormagazine.com/ to Your Car
iot-sensors Retro, But Super Useful 14
July & August 2025 5
PROJECT

OBD2 Sensor Dashboard


Old Dials Sparked a Quest for Real Data r la
b • Elektor
l

to

ab
Elek
NAL
ORIGI

la b
El

or
kt kt

e
or l
a b • Ele

By Saad Imtiaz (Elektor)


Understanding OBD2
This article details the development of a Since about 2002, all vehicles sold in most markets have been
real-time automotive sensor dashboard equipped with a standardized 16-pin On-Board Diagnostics II (OBD2)
interface. This interface replaces the manufacturer-specific diagnos-
by using an ELM327 OBD2 module and an tic connectors that were common before its introduction. Governed
ESP32-S3 touch display. The dashboard by ISO and SAE standards (such as ISO 9141-2, ISO 14230-4, and
shows essential sensor data — including ISO 15765-4), the OBD2 system allows access to a vehicle’s ECU for
reading diagnostic trouble codes (DTCs), emission system statuses,
coolant temperature, battery voltage, oxygen and live sensor data.
sensor voltage, fuel economy, and engine
load — retrieved directly from the vehicle’s Initially, several communication protocols coexisted — ISO 9141-2
and KWP2000 were used widely in the early years. However, modern
ECU, offering instant, reliable diagnostics, vehicles predominantly use the Controller Area Network (CAN) proto-
and opportunities for future enhancements. col (ISO 15765-4), which is faster and more reliable.

It all began one early morning, sitting in my 2001 Toyota Land Cruiser,
waiting patiently as the engine warmed up. Watching the analog dials
slowly climb, I wondered: Why rely on vague needles for crucial parame-
ters like coolant temperature, battery voltage, or oil pressure (Figure 1)?
Wouldn’t precise numeric values directly from the vehicle’s ECU be far
more insightful? This simple thought sparked the idea of developing a
custom OBD2 dashboard, directly tapping into the vehicle’s real-time
sensor data via an ELM327 module and visualizing it clearly on an
ESP32-S3-based touch display.

In this article, we’ll explore the entire development journey, covering


OBD2 communication, hardware selection, UI design, troubleshooting
challenges, and firmware implementation. The resulting system provides
accurate, real-time data, and serves as a flexible template — easy to
customize and extend by integrating any sensor data supported by Figure 1: Analog dashboard view of the 2001 Land Cruiser, displaying
your vehicle’s Electronic Control Unit (ECU). traditional gauge dials.

6 July & August 2025 www.elektormagazine.com


Beyond real-time values, OBD2 also offers access to fault memory Android application on the smartphone. Despite correct wiring and
and the system’s readiness status. One of its main purposes remains initialization, the module consistently failed to establish communication
emissions control monitoring. If an error affects emissions, the system or retrieve sensor data. Suspecting faulty hardware, multiple ELM327
triggers the Malfunction Indicator Lamp (MIL), alerting the driver via adapters were acquired from different suppliers. After opening and
the instrument cluster. While features like airbag status or braking examining their PCB, it turns out they were identical from the inside,
condition are not within the OBD2 scope, the system ensures the having the same PCB with different plastic enclosures (Figure 3),
exhaust and fuel systems operate within permissible limits. During eliminating module defects as a potential cause.
periodic vehicle inspections, these readiness codes are checked to
confirm a well-functioning emission system. Further investigation led to inspect vehicle’s OBD2 port closely. It was
discovered that the 2001 Land Cruiser lacked CAN High (ISO 15765-4)
Physically, the diagnostic port is typically located under the dashboard, connections and only minimally supported the older K-Line (ISO 9141-2/
often in the driver’s footwell or near the center console. Earlier models ISO 14230-4) protocol — restricted mainly to basic diagnostic trouble
may have hidden it behind covers or panels, but modern cars follow codes (DTCs). Consequently, real-time data access (such as RPM,
the easy accessibility requirement. coolant temperature, and fuel economy) wasn’t available, a common
limitation of early generation OBD2 vehicles.
The ELM327: Bridging the Vehicle ECU and the
Display Undeterred, I continued testing with a newer vehicle — a 2007 Honda
To tap into the OBD2 system,the widely available ELM327 interface was Civic equipped with complete CAN protocol support. On this vehicle,
preferred. The ELM327 acts as a translator between the car’s OBD2 communication via Bluetooth was immediately successful, confirming
system and external devices. It supports multiple protocols including that the issue was protocol-related rather than hardware-specific.
CAN, ISO 9141-2, and KWP2000, automatically detecting the vehicle’s
protocol and establishing communication. Inside, it parses OBD2
requests and responses, presenting them over a UART, Bluetooth,
or USB interface.

In Figure 2, the block diagram of the project is shown. To visualize


data, you can use for example a smartphone. Various smartphone apps
utilize ELM327-based adapters to display vehicle data. However, my
focus was to use an ESP32 and a display, rather than a smartphone.

Initial Testing and Troubleshooting


Initially, the plan was to use a Bluetooth-based ELM327 module to
wirelessly connect the ESP32 with my vehicle’s OBD2 port. The first
testing began with my 2001 Toyota Land Cruiser, where I connected Figure 3: External view of three visually different ELM327 clone modules,
the ELM327 Bluetooth module and attempted to communicate via an which share identical internal circuitry.

Figure 2:
The block diagram.

July & August 2025 7


Figure 4: The JC3248W535 ESP32-S3-based LCD development
Figure 5: Detailed internal view highlighting the identical PCB of
board used for the sensor dashboard.
the common single-board ELM327 clone modules.

However, another challenge emerged: the JC3248W535 ESP32-S3 without exposing UART (Figure 5). To overcome this limitation, the
board [1] I selected only supports Bluetooth Low Energy (BLE), while “Double PCB” variant of the ELM327 was selected [3], comprising
the ELM327 modules rely solely on standard Bluetooth. two stacked boards (Figure 6). Interestingly, at the time of planning
this article, we got another OBD project from one of our authors, and
While, I successfully tested Bluetooth connectivity using a standard it makes use of the same module for a gear-shift indicator system [4].
ESP32 module (which supports traditional Bluetooth). However, at
the end, I ultimately favored the JC3248W535 ESP32-S3 3.5-inch LCD In this module, the lower board contains a PIC microcontroller respon-
Development Board due to its aesthetic appearance, integrated capac- sible for OBD2 communication, while the upper board handles
itive touchscreen with a resolution of 480 × 320 pixels (Figure 4), Bluetooth functionality. Conveniently, these two boards communi-
built-in battery management circuitry, SD card and onboard speaker cate internally via UART, exposing RX, TX, and Ground pads. I soldered
support. The integrated built-in speaker opens possibilities for voice jumper wires directly to these UART pins, attaching a compact 4-pin
warning system reminiscent of aircraft alerts — such as “Fuel Low,” JST 1.25-mm connector at the other end (Figure 7). This connector
or “Engine Fire” and many more (though I sincerely hope no car ever seamlessly interfaces with the UART pins (IO17 for RX, IO18 for TX)
experiences that last one). on the JC3248W535 ESP32S3 development board (Figure 8). The
schematic digram is shown in Figure 9.
This compatibility mismatch prompted a decision to switch from a
Bluetooth wireless approach to a direct, stable UART connection. For secure dashboard mounting, a custom backplate was designed in
This change ensured reliable communication between the ESP32-S3 CAD equipped with a pivotable stand, attaching it with strong double-
and the ELM327 module. For those who prefer a wireless approach, a sided adhesive tape directly onto the vehicle’s dashboard (Figure 10).
suitable alternative smaller display called the “Cheap Yellow Display,” To withstand high cabin temperatures (often exceeding 55°C), PETG
compatible with classic Bluetooth, is available on Elektor’s store site [2]. filament was chosen for 3D printing the stand and backplate, as it offers
better heat resistance (approximately 85°C) compared to standard
Project Hardware Setup PLA, which softens around 55°C. While ABS filament would have been
Following the decision to shift to UART, I needed an ELM327 module even more resistant (up to 110°C), it requires specialized enclosures
variant with easily accessible serial pins. Most cost-effective ELM327 and ventilation systems due to its toxic printing fumes, making PETG
modules integrate Bluetooth and OBD2 processing into a single chip the practical material choice.

Figure 6: The PIC microcontroller-based “Double PCB” ELM327 Figure 7: UART jumper wire connections soldered onto the
module variant, featuring two stacked circuit boards. bluetooth PCB of the PIC-based ELM327 module.

8 July & August 2025 www.elektormagazine.com


Firmware and Communication
The firmware is based on the Arduino framework, leveraging Arduino_
GFX library for graphical rendering and standard Arduino libraries for
serial communication. Communication between the ESP32-S3, ELM327
module, and the vehicle’s ECU follows a structured request-response
pattern. The ESP32-S3 sends specific commands using OBD-II Param-
eter IDs (PIDs) over UART at 38400 baud. The ELM327 interprets
Figure 8: Backside of the JC3248W535 development board,
showing GPIO connections. UART lines connected to GPIO 17 (RX) these commands and queries the ECU, returning responses as ASCII
and GPIO 18 (TX) in the bottom-right corner. strings containing hexadecimal-encoded sensor data. (See the textbox
Understanding the OBD2 Protocol.) The firmware and all the files
related to this project are shared via the GitHub repository [5].

Since the code follows a consistent flow — sending a command,


parsing the received response, applying a specific formula based on the
command, and then displaying the result — it’s unnecessary to include
every repeated instance in the article. Instead, only the key sections
1 of the code are provided to clearly illustrate this core functionality.
9
2
10
Parsing Engine Coolant Temperature (PID: 0105)
3
TXD IO17
The process of retrieving sensor data, such as the engine coolant
11
RXD IO18 temperature, begins with the requestOBDData(); function, which
4
CAN 12
sends a request to the ELM327 module:
ESP32S3
Bus 5 Display
13 requestOBDData(i);
+3V3 VCC
6
14
GND GND // Where obdPIDs[i] is "0105"
7 // for coolant temperature
15
8
16
Internally, this function sends the PID command to the ELM327:

sendOBDCommand("0105");
MOD1 MOD2 // Sending command for coolant temperature
ELM 327 Module JC3248W535
Development Board
250107-013
The vehicle’s ECU responds to the ELM327, which returns a raw
response string via UART, for example 41 05 7B. Here, 41 confirms a
Figure 9: Schematic diagram: connections between the ELM327 module successful response (mode 1), 05 specifies the requested PID (coolant
and the ESP32-S3 development board. temperature), and 7B represents the coolant temperature data.

This raw response is passed to the parseOBDResponse function, start-


ing with cleaning unnecessary characters and spaces:

response = cleanResponse(response);
// Cleans response, returns "41057B"

Now, the cleaned response (41057B) is parsed based on the specific


PID requested (0105). The parsing logic extracts the hexadecimal data:

hexA = response.substring(4, 6);


// Extracts "7B" from response
A = strtol(hexA.c_str(), NULL, 16);
// Converts "7B" from HEX to decimal (123)
value = A - 40;
// Applies formula for coolant
Figure 10: Final OBD2 sensor dashboard mounted securely inside // temperature (123 - 40 = 83 °C)
the vehicle, as seen from outside the windshield.

July & August 2025 9


Figure 11: Initial Figma
concept design used for
visualizing and refining
the sensor dashboard
user interface.

After parsing, the value (83 °C) is available for further use: check-engine warnings, and Battery Voltage to identify potential electri-
cal issues. Additionally, metrics such as Fuel Rate and Fuel Economy
Serial.printf("Coolant Temp: %.2f°C\n", value); encourage efficient driving habits, reminding me to keep my foot lighter
// Outputs: Coolant Temp: 83.00 °C on the gas. Parameters like Intake Manifold Temperature and Pressure,
Mass Airflow, and Engine Load were selected to provide insight into
This value is then displayed on the screen using graphical functions engine efficiency and performance.
defined in the firmware:
A personal favorite addition is the Uptime Timer, essentially a stopwatch
drawCoolantTemp(value); activated upon engine start, initially intended as a warm-up timer but
// Visually displays the coolant humorously useful for highlighting time wasted in traffic.
// temperature (83 °C) on the screen
The following snippet illustrates how an individual sensor card,
This process — sending commands, receiving and cleaning responses, such as Coolant Temperature, is drawn on the TFT display. The
parsing data using PID-specific formulas, and displaying parsed drawCoolantTemp function takes the coolant temperature value and
values — is consistently followed for each parameter requested from clearly presents it within a visually consistent card layout:
the vehicle’s ECU.
void drawCoolantTemp(int coolantTemp) {
User Interface Design int cardWidth = 147;
The parsed sensor values are continuously displayed using the graphical int cardHeight = 63;
capabilities provided by the Arduino_GFX library [8]. Real-time values int x = 17;
update dynamically on the TFT screen, offering the driver immediate int y = 45;
feedback on vehicle conditions, such as instantaneous fuel economy, // Draw card background
battery voltage, and engine parameters. gfx->fillRoundRect(x, y, cardWidth,
cardHeight, ROUND_EDGES, gfx->color565(0, 51, 102));
For the user interface, I took inspiration from various after market racing
dashboards available online, ultimately combining selected elements // Draw icon
into a unique, personalized layout. Initially, Figma Design [9] was used gfx->setFont(&FreeSans9pt7b);
(Figure 11) to precisely define and refine the visual concept before gfx->setTextColor(gfx->color565(0, 128, 255));
moving into actual code implementation. gfx->setCursor(x + 7, y + 18);
gfx->print("Coolant ( C)");
Each sensor reading is presented in a dedicated visual card, enhancing gfx->drawCircle(gfx->getCursorX() - 24,
readability and simplifying potential updates. The parameters chosen gfx->getCursorY() - 8, 2,
for display were guided by practical needs: Coolant Temperature for gfx->color565(0, 128, 255));
quick overheating detection, Oxygen Sensor Voltage due to frequent // Draw degree symbol

10 July & August 2025 www.elektormagazine.com


// Draw value Understanding the OBD2 Protocol
gfx->setCursor(x + 50, y + 55); On-Board Diagnostics II (OBD2) is a standardized vehicle
gfx->setTextColor(RGB565_WHITE); diagnostic system introduced primarily to monitor and
gfx->setFont(&FreeSansBold18pt7b); control vehicle emissions. It provides a structured method for
gfx->print(coolantTemp); accessing sensor data, retrieving diagnostic trouble codes
} (DTCs), and assessing overall engine performance directly
from a vehicle’s Engine Control Unit (ECU).
Sensor values are retrieved and parsed within the parseOBDRespone
function, which ensures only supported, and valid sensor data is Communication with the ECU occurs using standardized
displayed. If a PID response isn’t recognized or supported by the messages known as Parameter IDs (PIDs). Each PID
connected vehicle’s ECU, the associated sensor card isn’t rendered, corresponds to a specific sensor or system status within the
keeping the interface streamlined: vehicle. To request sensor data, the OBD2 standard utilizes
different “modes,” with mode 01 commonly used to retrieve
else if (pid == "0105" && response.length() >= 6) real-time sensor information.
{ //Coolant Temperature
hexA = response.substring(4, 6); A typical PID request and response format is as follows:
A = strtol(hexA.c_str(), NULL, 16);
value = A - 40; > Request (sent to ECU): Consists of the mode (01 for real-time
drawCoolantTemp(value); data) and the PID.
Serial.printf("Coolant Temp: %.2f°C\n", value); Example: 01 05 requests the Engine Coolant Temperature.
}
else { > Response (received from ECU): Comprises three parts—
Serial.println("Unknown Response Format"); confirmation of mode (0x40 + mode), the PID number, and
} the actual sensor data in hexadecimal form.

Although metrics like Transmission Temperature or Oil Pressure would Example: A response of 41 05 7B indicates:
have been beneficial, these are unsupported by my vehicle’s ECU.
However, integrating additional sensors into this project is straight- > 41 (0x40 + 0x01) confirms successful mode 01 response.
forward if supported by one’s vehicle. > 05 confirms the requested PID.
> 7B (hexadecimal) is the raw data value.
The fully realized user interface, actively displaying real-time sensor
data during driving, can be seen in Figure 12. To obtain meaningful information, the raw hexadecimal
response must be converted using a defined formula. For
Engine Coolant Temperature (PID 05), the formula is:

Temperature (°C) = Decimal Value - 40

Thus, for 7B (hexadecimal), the coolant temperature is


calculated as 123 (decimal) - 40 = 83°C.

Commonly used OBD2 PIDs

Formula/
PID Description Units
Conversion
05 Engine Coolant Temp. A - 40 °C
0C Engine RPM ((A × 256) + B) / 4 RPM
0D Vehicle Speed A km/h
11 Throttle Position (A × 100) / 255 %
10 Mass Air Flow (MAF) ((A × 256) + B) ÷ 100 g/s

To find out the PID requests along with their formulas, these
two internet resources were used [6][7].
Figure 12: Close-up view of the finalized user interface for the custom OBD2
sensor dashboard, displaying real-time sensor data.

July & August 2025 11


Future Improvements Questions and Comments?
As with any project, there’s always room for further development If you have questions about this article, feel free to email the
and refinement. This custom dashboard serves as a solid foundation author at [email protected] or the Elektor editorial team
toward building a more sophisticated and customizable sensor inter- at [email protected].
face. Currently, sensor parameters are hardcoded into the firmware,
requiring manual reprogramming with the relevant PID values if users
want to display different sensor data. While straightforward, removing
the unit from the car or bringing a laptop to the vehicle every time can
quickly become tedious.

To overcome this, the plan is to implement a webserver based configu-


ration interface, enabling users to easily select and customize displayed About the Author
sensors directly via smartphone or tablet without physically updating Saad Imtiaz, Senior Engineer at Elektor, is a mechatronics engineer
firmware. Additionally, integrating trip data logging would allow sensor who has extensive experience in embedded systems and product
readings to be stored on an onboard SD card in CSV format, enabling development. His journey has seen him collaborate with a diverse
convenient download via the same web interface. This stored data can array of companies, from innovative startups to established global
later be visualized and analyzed to track vehicle performance, identify enterprises, driving forward-thinking prototyping and development
trends, or troubleshoot issues. projects. With a rich background that includes a stint in the aviation
industry and leadership of a technology startup, Saad brings a
Another exciting planned feature is a voice warning notification system unique blend of technical expertise and entrepreneurial spirit to
inspired by “Bitchin’ Betty,” the iconic fighter jet alert system. Not only his role at Elektor. Here, he contributes to project development in
would this add a unique touch, but it would enhance safety by clearly both software and hardware.
announcing important notifications such as “Engine Overheating” or
“Battery Voltage Low,” reducing the need for constant visual monitoring.

Given that built-in batteries are impractical due to high cabin tempera-
Related Products
tures — particularly risky with LiPo batteries — the plan is to incor-
porate a Real-Time Clock (RTC) module. An RTC ensures accurate > ESP32 Development Board (Cheap Yellow Display)
timekeeping for reliable data logging and timestamping, essential www.elektor.com/20890
especially when combined with the intended GPS integration. This
addition would offer real-time speed data, accurate route tracking, and
> Dogan Ibrahim, Controller Area Network Projects
(E-book, Elektor)
comprehensive insights into driving performance and vehicle health. www.elektor.com/18219

Lastly, there is an aim to include support for wireless firmware updates


(OTA), allowing easy, cable-free software upgrades and significantly
enhancing user convenience and maintainability.
250107-01

WEB LINKS
[1] JC3248W535 ESP32-S3 Based Development Board, AliExpress: https://s.click.aliexpress.com/e/_mM4CGkP
[2] ESP32 Development Board (Cheap Yellow Display): https://www.elektor.com/20890
[3] ELM327 Module, AliExpress: https://s.click.aliexpress.com/e/_mrxPLWP
[4] Florian Schäffer, “OBD2: Retrofitting a Tachometer and Shift Light in your Car,” Elektor 7-8/2025:
https://www.elektormagazine.com/250005-01
[5] OBD2 Dashboard, GitHub: https://github.com/ElektorLabs/obd2-dashboard/
[6] OBD2 PIDs for Programmers, Total Car Diagnostics:
https://www.totalcardiagnostics.com/support/Knowledgebase/Article/View/104/0/obd2-pids-for-programmers-technical
[7] OBD2 PID Interactive Converter Tool, CSS Electronics:
https://www.csselectronics.com/pages/obd2-pid-table-on-board-diagnostics-j1979
[8] Arduino GFX library: https://docs.arduino.cc/libraries/gfx-library-for-arduino/
[9] Figma Design: http://www.figma.com

12 July & August 2025 www.elektormagazine.com


JOIN OUR
COMMUNITY

GET FREE
DOWNLOAD

Subscribe
Sub
ubscrib
ubscr
ubsscr
crib
cribe
ibee tod
to
toda
today
toda
oday
dayy a
day at elektor
elektormagazine.com/ezine-24
elektorm
elek tormag
torm
tor
orm
ormag
mag
agazine
aga
agazine
zine.c
zine
ine..com/
ine
ine.com/
ine.c om/ezine
om/ezine-24
ine-
ine-2
-24
24

July & August 2025 13


PROJECT

OBD2: Add a Rev Counter and


Gear Shift Indicator to Your Car
Retro, but Super Useful

By Florian Schäffer (Germany)


When’s the Right Time to Change Gear?
If your car uses a manual gearbox, you can The best time to change gear can be determined by studying an
save fuel and keep exhaust emissions to a engine’s performance characteristic curves (see Figure 1). These curves
are generally quite similar, irrespective of the various road vehicle engine
minimum if you don’t overrev your engine. manufacturers. The big difference in the characteristics is between
A shift light mounted on the dash can tell engines designed to run on gasoline and those that run on diesel. Even
you exactly when it’s time to upshift. The though engine power is what manufacturers love to highlight in their
literature, the level of torque developed by an engine is a more useful
best part? You can easily add one to almost indicator when it comes to changing gear.
any car via the OBD2 port.
On these curves, you’ll see engine speed (RPM) along the x-axis. For
a gasoline engine, the output power in KW (red line) climbs steadily
Back in the day, a rev counter was often seen as more important than from about 1,500 to 5,000 RPM, while the torque in Nm (blue line) is
the speedometer. If you want to drive more efficiently — or just a bit reasonably flat beyond 1480 RPM. That means for this engine, there is
sportier — keeping an eye on your engine’s RPMs is key for knowing no particular band you can use the gearbox to exploit while accelerating.
when to change gear. Many economy cars don’t come with a tachome-
ter, and that’s where a shift light can really come in handy. It’s basically Diesel engines are a different story. They produce a lot of torque (green
a light that flashes when it’s time to shift up. These gadgets used to be line) at low RPM, which is great for acceleration, but only if you stay
mocked as gimmicks, but they might be making a comeback. Most in a narrow RPM range, in the power band around 1,800 RPM (lilac
modern cars are now so quiet (especially diesels) that it’s hard to tell line). With diesels, you need to shift through the gears more quickly
how hard the engine’s working just by listening. to keep the engine running in that sweet spot.

If your car doesn’t have a rev counter or shift light and you think it The perfect time to shift is when your engine hits the RPM where it
might be useful, you can add it without even popping the hood. All makes peak power without the torque dropping off. For most gasoline
you need is a low-cost OBD2 diagnostic module and some electron- engines, that’s around 4,500 RPM while for diesels, it’s about 1,800 RPM.
ics to display the data. That’s also when the gear shift light comes on, if you have one.

14 July & August 2025 www.elektormagazine.com


You can usually find a chart that graphs these output performance
curves for your own engine. This will allow you to double-check the
recommended shift points.

This all mostly applies when you’re accelerating. Downshifting isn’t so


important. You really only need to use it in two situations:

> Quick acceleration — For overtaking. Downshifting bumps up


your RPM, which might drop torque a bit, but increases power
and gives a speed boost for safer overtaking. You can upshift
again as the car accelerates.
> Slowing down — You can save fuel by not downshifting too soon.
Wait until the engine is almost at idle speed before going to the
next lower gear. That way, your car goes into “fuel cut-off mode,”
where the engine burns no fuel at all. The engine and gearbox
act like a brake, to slow you down. This can feel a little jerky
in gasoline cars because they tend to use flywheels with less
rotational mass than diesel engines, which helps to smooth out
sudden engine speed changes.
Figure 1: Typical gasoline and diesel internal combustion engine
Just one thing to watch when going downhill. You need to be sure performance characteristics (torque in Nm and power in kW against engine
speed in RPM). Blue/Red: torque/power of gasoline engine. Green/Lilac:
the engine braking is strong enough to actually slow the car down. If
torque/power of diesel engine.
the gear selected is too high, gravity can actually overcome engine
braking, and you’ll still pick up speed.
more measurements advanced modern vehicles rely on. You can check
How Can We Access the Data? out engine stats like coolant or oil temperature (which most cars don’t
These days, getting live data from your car such as engine RPM is even show on the dashboard), your actual road speed value and fuel
easier than ever, thanks to the OBD2 port (that’s the little connector consumption data (especially in newer cars). For petrol heads, it’s a
usually found under the dashboard). Through it, you can access RPM treasure trove of information, as long as your car supports the data.
information along with a whole bunch of other engine data.
The good news is that engine RPM information is always available at
The first company to bring an easy-to-use OBD solution to the public the OBD port. If you want to build a custom rev counter or gear shift
was ELM Electronics in Canada. They created a series of chips that light, you’re good to go. The RPM data is made up of two bytes and is
could talk to all the different car communication systems and protocols, available in the form: PID 0CHex as a 16-bit value. These two bytes can
and they made them super simple to use via a serial interface. Their then be plugged into a simple formula to get the actual value of RPM.
most popular chip was the ELM327, which became a sort of standard.
The RPM value is defined to be within the range from 0 to 16,383.75 RPM
ELM, unfortunately, did not enable the copy protection feature of the and is given by:
PIC controller, allowing pirates to simply avoid development costs,
lift the code and pump out their own ultra-cheap OBD reader knock- RPM = Diagnostic value / 65,535 × 16,383.75
offs. These copies, costing as little as €5, flooded the market. Some
versions feature USB, Bluetooth, and Wi-Fi connectivity. The downside? If the first byte, Byte (A), has the value 0CHex, for example, and the second
There’s been no further development, and even bugs identified a long (B) has the value B8Hex , we combine them together to form a 16-bit
time ago in the original hardware and software have ended up in the value 0CB8Hex . Plugging this value into the formula gives an engine
cloned versions. The clones work well enough and have become so speed of 814 RPM. The example code described in the article uses a
popular that ELM Electronics lost their market and sadly had to shut slightly different method to calculate this, but gets to the same result
up shop in 2022. in the end, even though it doesn’t follow the official OBD spec exactly.

Lots of Data A Single Indicator


With an ELM327-based adapter, there are now loads of smartphone Using a smartphone to display engine data while driving isn’t exactly
apps that will let you see what your car is actually doing in real time. ideal — it’s bulky, distracting, and just not very practical. A simpler, more
The exact data you can get depends on your car’s engine and its engine focused display works way better. All you really need is an indicator
control unit (ECU), but there is often a lot more than you’d expect. Origi- light to tell you when to change gear; you can skip the digital RPM
nally, there were around 20 data points called Parameter Identifiers display entirely and just use a single LED light, mounted somewhere
(PIDs), but that number has grown to over 100, reflecting how many on your dashboard.

July & August 2025 15


These clones are available in a variety of colours, such
as transparent blue and some can be three times more
expensive. Under the hood, however, it’s just the same
pirated ELM chip in every module. Don’t pay too much
to attention to marketing hype quoting version numbers
or fancy names, those are mostly invented by sellers to
make their own products sound more attractive. Some
newer versions use external CAN controllers like the
MCP2515 or even chip-on-board technology (COB) [2].
Be cautious: one Wi-Fi module I tested didn’t support
Figure 2: Block diagram of the OBD2 rev counter display with gear change all OBD protocols, even though it claimed to. Avoid modules where the
indicator. The red USB adapter is only required for programming. wireless unit is fully integrated with the ELM chip, you won’t be able
to access the serial pins, which would make it useless for this project.

Figure 2 shows the basic layout of a DIY RPM display with a gear shift The most reliable setup that I found can be built using a model that
light. This project uses a cheap ELM327 clone from China to handle consists of two circuit boards with a clearly separate (usually blue)
communication with your car. The great thing about these modules is Bluetooth module. Look closely at product photos when buying the
that they include not only the ELM chip (which grabs and formats the adapter and use the return option if what arrives doesn’t match. Some
data) but also all the circuitry needed to support various car commu- listings claim the dual-board design is a new innovation, but it isn’t.
nication protocols. To handle the logic and display output, the project Just keep in mind, even this version doesn’t support every protocol. It
uses an Arduino Pro Mini (the 3.3 V version works best with the generic can’t handle J1850 VPW, a rare and outdated standard mostly found
ELM clones). The Arduino reads the RPM data via UART and displays in old GM and Chrysler vehicles.
it on a simple four-digit numeric display. It also controls the shift light
LED according to the engine speed. Lastly, this project intentionally avoids any wireless communication
between the ELM and Arduino for good reason. Wireless connec-
Choosing the Right ELM Clone tions can be flaky in a car environment and introduce unnecessary
First, you’ll need an ELM327 interface. Since the demise of hassle. There’s also a potential security risk: a constantly active wireless
ELM Electronics, theres now not so much guilt in using one of the ELM device could, in theory, be a backdoor into your vehicle’s control
many knockoffs floating around. The easiest route is to buy a cheap network and may be exploited by ne’er-do-wells to unlock your car
prebuilt OBD2 interface and do a little hacking. The ELM chip was or cause other mischief.
originally designed for serial communication with a PC and had an
integrated CAN controller. That’s why all the clones still only support A Look Inside the ELM Clone
serial connections. That’s not really a big deal; there are plenty of Most ELM327 clone housings can be popped open pretty easily. Once
modules that can send serial data over USB, Bluetooth, or Wi-Fi. To inside, you’ll usually see a Bluetooth PCB module soldered in place, it’s
build the display setup, you can just tap into the ELM’s UART pins. USB typically connected at five points. You can desolder it without too much
versions are now rare and usually overpriced, so the simplest solution trouble, but be extra careful with the RxD and TxD pads, since they
is to opt for a Bluetooth OBD2 adapter. These come in small thumb- aren’t connected to pin headers (see the zoomed-in view in Figure 3).
sized housings that can be easily popped open. Remove the Bluetooth
module (which you won’t need for this project) and wire the ELM board To program your Arduino, you’ll need a USB-to-TTL adapter. Just hook
directly to the Arduino’s serial communication pins (see Figure 3). it up as shown in the schematic (Figure 2). In the Arduino IDE, select

Figure 3: The blue PCB with the Bluetooth Module is not needed
and can just be desoldered.

16 July & August 2025 www.elektormagazine.com


What Does the Law Say?
A frequently debated question: Am I allowed to do this, and will it cause problems? The short answer is: yes and no. Some countries are
planning to restrict access to OBD port data to prevent misuse of data by third parties. This is more of a data protection issue. Some legis-
latures do not allow permanent, fixed installations in vehicles, at least not without approved components and a technical inspection. If any
device plugged into the OBD port can be removed with a single action, then its use is acceptable. The rev counter can, of course, just be
unplugged before your vehicle goes in for its next check-up. We do, of course, plug accessories into the car’s electrical system all the time
without giving them a second thought.

The second part of the question is a bit trickier. According to ISO standards, it’s the vehicle manufacturer’s responsibility to ensure that
continuous access to OBD2 does not impair the car’s functionality or drivability in any way.

In the early days of OBD2 port implementation, there were stories of control system crashes, causing the instrument cluster to switch to
disco mode with all displays flashing at random rates. The solution (as ever, where computers are involved) was to remove the diagnostic
device, turn the ignition off, and back on again. Continuous data monitoring via an external reader was problematic.

Stories of more serious malfunctions of the braking system or other horror scenarios, however, are nothing more than urban myths.

the usual settings for a Pro Mini: ATmega328, 3.3 V, and whatever doing this, but it can interfere with your vehicle’s control units, which
programmer you’re using. Make sure the Serial Monitor window is not may stay awake instead of going into sleep mode. Over time, this
open while uploading the code; otherwise, you may run into upload process can result in a drained battery.
errors.
If you want to know how your car responds in this situation, try measur-
This project uses a seven-segment LED display with a TM1637 control- ing the current draw directly at the battery. Use a DC clamp ammeter
ler. The display is available in different colours and works well both with the bonnet, doors, and windows all closed (don’t start the engine
at night and in bright sunlight. If you’d rather not use such a display, or touch the ignition key while testing!). After about two minutes, if
feel free to skip it or swap it for something else and tweak the code the current draw from the battery with the rev counter unit attached
accordingly. is the same as without it, there is nothing to worry about.

For the gear shift light LED indicator, go with something super bright, The best solution is to change the wiring to the OBD connector. Pin 16
such as 10,000 mcd. That’s plenty to catch your eye, even if it’s not provides a continuous 12 V supply. This can be replaced by a cable
mounted directly in your line of sight, just don’t stare straight into it. A carrying a switched supply so that the voltage drops to zero when the
reflective LED mount helps make it even more visible. As for the LED ignition is off. This mod will not affect how the socket is used in normal
series resistor, you’ll need to calculate the right value based on your operation when a garage technician connects diagnostic equipment
LED’s specs. Just make sure the current draw doesn’t go over 40 mA. to the socket, because it can only communicate with the ECU when
the vehicle ignition is on. In some older European VAG (Volkswagen/
Power to the Unit Audi) cars, a “Terminal X” supply is also available in the wiring harness
Powering electronics from a car’s electrical system always comes with and could alternatively be used to provide power to the socket. Termi-
its headaches. While we generally accept that cars run on “12 V,” that’s nal X only supplies 12 V after the engine starts running.
really just a nominal value. In reality, the voltage can go up to 14.4 V
when the engine is idling. During startup, you might even see huge If you prefer to use an extension adapter cable between the OBD socket
voltage spikes (hundreds of volts!) or dips below 5 V. Whilst driving, the and the rev counter unit, it is possible to swap the wire to pin 16 in the
voltage level tends to fluctuate, and has high levels of electrical noise. OBD extension cable with either of the alternative switched supplies
mentioned above. The rev counter unit will then be turned on and off
The designers of cloned ELM devices generally do not pay too much along with the ignition.
attention to mitigating the electrical noise issues. The unit needs to
be cheap, so every possible corner has been cut to save costs. Most The Program Code
of the designs use the AMS1117 type of voltage regulator to bring 12 V You can download the full program for this project from Elektor Labs [3].
down to 3.3 V. That particular regulator isn’t especially robust: it can Using the ELMduino.h library included in your Arduino sketch makes
only handle up to 15 V input and its “1 A” output rating is also more talking to the ELM327 module really simple. You just need a few function
wishful thinking than reality. On top of that, it has zero overvoltage calls, and you’re good to go. The same goes for the TM1637Display.h
protection, so if it fails, your whole circuit might fry from the applica- library used for outputting data to the 7-segment LED display. Both
tion of raw battery voltage. libraries are available via the Arduino IDE’s Library Manager and can
be installed in just a few clicks.
Another issue is that most OBD ports only supply constant power
(always-on 12 V), not switched power (on only when the ignition is on). The source code is well commented, making it easy to follow and
That means the ELM doesn’t actually know when the car turns back understand how everything works. At the start, there is a section for
on. Unless you unplug the unit after use, it will keep trying to initiate a customization. This is where you can set the target RPM for the shift
new diagnostics session over and over. It doesn’t draw much current light to trigger (default: 1850 RPM), and how long the LED should

July & August 2025 17


stay on (suggested value: 3000 ms, or 3 seconds). The RPM data can
technically be polled rapidly (depending on the OBD protocol), but
that would make the display flicker a lot. By default, there’s a 200 ms
delay between updates, which makes the displayed information less
jumpy. You can even choose to display a dot as a thousands separa-
tor if you like.

Further configuration options include ELM communication settings,


display characters, serial port assignments for the ELM, and data lines
connection assignments for the 7-segment display. Figure 4: The original
blue housing of the OBD
reader was discarded and
A timer interrupt (Timer 1) fires every 200 ms to flash the decimal points
replaced with a new OBD
on the display. That way, you can tell at a glance that the system is plug and enclosure [4].
active and attempting to establish an OBD connection. If you enable
debugging in the code, you can use the serial monitor in the IDE to
check for test outputs and current RPM readings.

Once the connection with the ELM is established, the sketch enters Questions or Comments?
a loop that continuously fetches the RPM data. It processes the data If you have any technical questions or comments regarding this
for display formatting, such as adding a separator or rounding the project please contact the author at [email protected] or the
last digit to zero so that the readout is more stable. (An ultra-precise Elektor editorial team ([email protected]).
RPM readout isn’t that useful for our purposes and just makes the
displayed values flicker.)

The most important part of the code checks whether the current RPM
has reached or exceeded the configured threshold. If it has, the gear
shift LED lights up and then turns off after a configurable delay period
elapses. The program locks out any further blinking until the RPM About the Author
drops back below the threshold, so you don’t get constant flashing Florian Schäffer has been working as an author of nonfiction books
while accelerating or cruising in the highest gear. and a freelance editor for over 30 years. His interests include
electronics and programming microcontrollers. Years ago, he got
The sketch also checks for communication errors during OBD polling. stuck into computer-based car diagnostics to fix his own car. Since
If something goes wrong, it attempts a quick reconnect of the ELM327 then, he has been exploring the possibilities of vehicle OBD and
to the OBD so the display keeps working without interruptions. If it even runs his own online shop.
detects a more persistent error (for example, when the car’s ignition is
turned off), it clears the display and waits for a longer interval before
trying again. This keeps the system from needlessly polling the OBD
when the ignition is turned off.
Related Products
Installation in Your Car
Housing all the components and making a neat installation can be a > Seeed Studio OBD-II CAN Bus Development Kit
little tricky. Your best bet is probably to design and 3D print your own www.elektor.com/20236
enclosure or use a commercial OBD plug and enclosure (Figure 4).
In this setup, the original blue ELM case was opened with a Dremel
> FNIRSI DMC-100 True RMS Smart Clamp
Multimeter (600 A)
and replaced with a custom OBD plug that also has a matching www.elektor.com/21114
housing [4].
Edited by Rolf Gerstendorf / Translated by Martin Cooke — 250005-01

WEB LINKS
[1] Saad Imtiaz, “OBD2 Sensor Dashboard,” Elektor 7-8/2025: http://www.elektormagazine.com/250107-01
[2] Chip on board, Wikipedia: https://en.wikipedia.org/wiki/Chip_on_board
[3] Download: https://www.elektormagazine.com/labs/elektor-articles-software-downloads
[4] Modular OBD-2 system: https://www.obd2-shop.eu/index.php/cPath/21_71/language/en

18 July & August 2025 www.elektormagazine.com


BACKGROUND

LiDAR and Vision Sensors

for Robotics
Source: Adobe Stock

By Saad Imtiaz (Elektor) In the rapidly evolving world of robotics, a machine’s ability to
perceive and understand its environment is critical to its success.
As sensing technologies continue to From autonomous vehicles navigating complex terrains to factory
evolve, they are quietly shaping how robots collaborating alongside humans, the fusion of advanced
sensors has enabled remarkable progress. Today, technologies like
robots perceive and interact with LiDAR, depth-sensing cameras, and AI-enabled vision systems are
their environment. This article looks no longer reserved for industrial giants — they are increasingly
into a range of LiDAR sensors, and accessible to engineers, students, and makers alike.

depth cameras that are commonly As part of this growing accessibility, a range of reliable sensors —
found across robotics projects — such as those from YDLIDAR [1], which is available via the Elektor
from research and education to more Store — have made it easier than ever to get started with robot-
ics projects or scale them up with more capable hardware. These
advanced applications. It also touches sensors are widely used in educational platforms and prototypes,
on software ecosystems, typical use offering a solid foundation for mapping, localization/navigation,
cases, and a few higher-end options that and obstacle detection.

hint at what’s possible as these tools This article offers an in-depth exploration of some of the most
become more widely adopted. popular and community-supported sensors available today,
comparing their performance, software ecosystems, and ideal
applications. Whether you’re building a mobile robot, a smart
surveillance system, or an autonomous drone, understanding
these technologies will help you select the right perception tools
to turn your vision into reality.

LiDAR vs. Cameras vs. Radar


Robotics engineers often combine multiple sensor types to cover
LiDAR OBJECT the weaknesses of each. LiDAR, cameras, and radar all sense the
Laser Light emitted pulse environment but in very different ways. Here is a brief conceptual
comparison of how they work and their best-use scenarios:

Reception of the laser pulse LiDAR (Light Detection and Ranging)


Light Detection and Ranging (LiDAR) works by emitting pulses of
Laser pulse travelling at speed of light laser light (usually in the infrared spectrum) and measuring the
time it takes for the reflections to return. This allows it to calcu-
late precise distances and generate detailed 3D point clouds of
the environment (Figure 1). As an active sensor, LiDAR performs
Figure 1: Working principle of LiDAR sensors. equally well in daylight or complete darkness.

July & August 2025 19


In robotics, LiDAR is primarily used for mapping, SLAM (Simulta-
neous Localization and Mapping), and obstacle avoidance with high
geometric precision (Figure 2). Mapping refers to creating a spatial
representation of the environment — essentially a digital map of
walls, objects, and terrain. SLAM goes a step further by allowing
the robot to build this map while simultaneously estimating its
own position within it, which is essential for navigating unknown
or changing environments.

LiDAR is commonly mounted on top of mobile robots or vehicles


to provide a 360° horizontal view (Figure 3), though smaller units
can also be placed at the front or sides for more localized sensing.
While it offers excellent resolution and accuracy, LiDAR can be
affected by fog, rain, and dust, and tends to be more expensive and
power-intensive than cameras. Nonetheless, it remains the sensor
Figure 2: The real-time point cloud of automotive-grade solid-state
of choice for applications requiring detailed spatial awareness, Robosense LiDAR M1. (Source: Robosense)
especially in autonomous navigation.

Camera (Passive Vision) with AI


Cameras passively capture visible (or infrared) light, producing
images. A standard camera on its own gives a 2D projection of
the 3D world — meaning depth information is ambiguous (a
far large object can appear the same size as a near small object).
However, cameras excel at detecting colors, textures, and identify-
ing object classes (with the help of AI algorithms). Modern robot-
ics uses cameras with computer vision or deep learning to detect
and interpret features (e.g., recognizing a human, a stop sign, or a
spilled drink on the floor). Stereo camera setups or depth cameras
(like structured-light or ToF) can infer depth, but with some limita-
tions under certain conditions.

Cameras are cheaper and higher resolution than other sensors,


and can leverage immense research from the computer vision
field. They do require sufficient lighting (or IR illumination for
night use), and their performance can drop in darkness or overly Figure 3: LiDAR sensor mounted on the top of an automobile.
bright, shadowy scenes. (Source: Adobe Stock / Tada Images)

Best-use scenarios for cameras include object recognition, scene


understanding, and when rich visual detail is needed. They are
also used for approximate ranging (via stereo disparity or struc-
ture-from-motion), but generally are less direct and less accurate in
measuring distance than LiDAR or radar. In sum, cameras with AI
are indispensable for any task involving reading signs/text, recog-
nizing specific objects or people, or in cost-sensitive projects (since
cameras are inexpensive and ubiquitous).

Depth Cameras: Bridging Vision and Distance


Depth cameras combine the advantages of traditional imaging
with the ability to perceive three-dimensional space, offering a
middle ground between LiDAR’s precision and standard camera’s
visual richness. They typically use technologies like stereo vision,
structured light, or time-of-flight (ToF) to estimate distances to
objects by analyzing how light patterns or disparities change across
a scene (Figure 4). In ToF systems, the camera emits modulated Figure 4: Intel D435 Depth Camera in Action. (Source: Intel)

20 July & August 2025 www.elektormagazine.com


Technologies and Use Cases

Technology Strengths Limitations Typical Use Cases


Camera High-res imagery, No depth without AI/stereo, Visual tracking, classification,
object recognition lighting-dependent surveillance
LiDAR Precise distance, Expensive, affected by weather/glare SLAM, autonomous driving,
3D mapping, long range high-fidelity environment modeling
Depth Camera Dense 3D data, affordable, Range-limited, sunlight sensitivity Indoor navigation, gesture recognition,
RGB+Depth (structured light) object grasping
Radar All-weather performance, Low spatial resolution, sparse data Collision avoidance, speed tracking,
velocity data backup sensing

infrared light and measures the time it takes for the light to bounce where a camera or LiDAR might struggle. However, it might only
back from surfaces — this delay is used to calculate distance with tell “there’s an object at 150 m ahead in lane” but not detail its
high precision. Structured light, on the other hand, involves project- shape or type. Radars are also usually limited to planar scanning
ing a known infrared pattern — such as a grid or dot matrix — (automotive radars have a narrow vertical field).
onto the environment, and then using the deformation of this
pattern when viewed by the camera to calculate depth. This requires Best use cases for radar are in adverse visibility conditions or as
an integrated IR projector and is typically optimized for indoor a safety overlay for long-range obstacle detection (e.g., drones or
use. Depth cameras produce dense depth maps, enabling robots cars use radar to sense far-away obstacles or approaching objects
to understand not just what objects are, but exactly where they at high speed). In environments with lots of metal or reflections
are relative to the sensor. They are passive or semi-active systems (indoors, machinery), radar readings can be noisy. In short, radar
(depending on whether they project IR patterns) and often work adds robustness in weather and long-range speed sensing, comple-
best in controlled lighting conditions. menting cameras and LiDARs.

Depth cameras are ideal for indoor SLAM, gesture recognition, In practice, sensor fusion is key — many robots use all three:
object manipulation, and 3D scanning, providing a detailed spatial cameras (for understanding what objects are), LiDAR (for where
context at relatively low-cost and high resolution compared to objects are in 3D), and radar (for reliable detection in bad condi-
LiDAR. However, they can struggle outdoors under direct sunlight tions and velocity tracking). Each compensates for the others’
(especially structured-light sensors) or over very long distances, weaknesses.
and depth accuracy typically degrades beyond 5 to 10 m. Best-use
scenarios for depth cameras include building mobile robots for For example, an autonomous car might use a camera plus AI to
indoor navigation, interactive robots that recognize hand gestures, read a street sign, lidar to precisely map its surroundings in 3D,
warehouse automation for object picking, or AR/VR applications and radar to keep tracking a vehicle in heavy rain where the other
needing detailed room-scale mapping. sensors falter. Understanding these trade-offs helps in choosing
the right sensor mix for a given robotic application.
Radar
Radar uses radio waves (often in the microwave band, like 24 GHz or For a summary of how LiDAR, depth cameras, and radar differ in
77 GHz in automotive radar) and measures their reflections. Radar function and use, see the Technologies and Use Cases textbox.
can penetrate fog, rain, and dust far better than optical sensors –
weather has little effect on radar’s longer wavelengths. It’s also
an active sensor (emits its own signals), working in darkness and LiDAR Sensors (and a ToF Camera)
bright light alike. The trade-off is that radar has much lower spatial LiDAR sensors produce 2D or 3D point clouds that are commonly
resolution – it doesn’t create a detailed image, but rather detects used in robotics for SLAM, obstacle avoidance, and spatial naviga-
the position and velocity of objects (often outputting a sparse set tion. Depending on the model, these sensors output data via USB,
of detected targets or a coarse point cloud). UART, CAN, or Ethernet. High-resolution units typically require
processing on a PC or embedded system like an NVIDIA Jetson,
In robotics and vehicles, radar is fantastic for long-range detec- while lighter-weight models are often compatible with Raspberry
tion and speed measurement (Doppler returns give direct relative Pi boards and, in some cases, even microcontrollers — making
velocity of targets). For example, an autonomous car’s radar can them versatile for a range of robotics platforms. Below are some
detect another vehicle at more than 200 m even in heavy rain, LiDAR sensors widely used in such applications:

July & August 2025 21


Ouster Velodyne VLP-16 of 51° × 20° and an accuracy ranging from 2 cm to 2% of the
(Puck Hi-Res) measurement distance, it’s suitable for applications like gesture
A professional-grade 16 to 32 channel recognition and indoor robotics. The device is compatible with
3D LiDAR with a 100 m range and 360° ROS, Linux, Windows, and Mac platforms, facilitating integration
horizontal view, producing up to 600,000 into various systems.
points/s [2]. Its compact, weatherproof
design (IP67) makes it ideal for autono- Source: [2] Livox MID-360
mous vehicles and outdoor robotics. Supported by robust ROS The Livox MID-360 is a hybrid solid-state
drivers — where ROS (Robot Operating System) is a widely used LiDAR sensor offering a 360° horizon-
open-source framework for developing and integrating robot tal field of view [7]. It’s optimized for
software — and Ouster’s SDK, it’s widely used in research and low-speed robotics, providing advanced
industry for high-fidelity SLAM and mapping. 3D perception for navigation and obstacle Source: [7]
avoidance. The sensor is compact and lightweight, making it easy
Slamtec RPLIDAR A1 to install on mobile platforms. It operates effectively in various
A budget-friendly 2D LiDAR offer- lighting conditions and supports integration through the Livox
ing a 12 m range with up to 8,000 SDK and Livox Viewer 2 (a software to view the data).
samples/s [3]. Ideal for indoor robots
and educational SLAM projects, it RoboSense Airy
features USB connectivity, open The RoboSense Airy is a compact hemispher-
SDKs, and strong ROS community Source: [3] ical digital LiDAR featuring a 360° horizon-
support. It’s low cost around $100 and plug-and-play setup make tal and 90° vertical field of view [8]. With
it a go-to for hobbyists and students. 192 beams and a point cloud output of 1.72
million points/s, it delivers high-resolution
YDLIDAR TG30 data for detailed environment mapping. The Source: [8]
This is a compact, 360° 2D LiDAR sensor weighs under 240 g and consumes less than 8 W of power,
sensor based on Time-of-Flight (ToF) making it ideal for mobile robotics applications requiring contin-
technology, capable of measur- uous operation.
ing distances up to 30 m with high
accuracy and stability. It operates at RoboSense E1R
up to 20,000 samples/s with a scan The RoboSense E1R is a solid-state LiDAR
frequency between 5 and 12 Hz, offer- Source: [4] sensor designed for robotic applications
ing angular resolutions as fine as 0.09° at lower speeds. [9]. It offers a 120° horizontal and 90°
With IP65-rated protection, strong resistance to ambient light, vertical field of view, with a detection
and support for ROS and a dedicated SDK, it’s a robust choice for range of up to 75 m. Built on an automo-
indoor navigation, SLAM, and educational robotics. The TG30 tive-grade platform, it has passed over 60 Source: [8]
outputs data via UART and can be easily connected through USB rigorous reliability tests and operates within a temperature range
using the included adapter. It’s available in the Elektor Store along of -40°C to +85°C. The sensor’s robustness makes it suitable for
with order variants from YDLIDAR [4], making it an accessible various environments, including those with high vibration and
and well-supported option for anyone starting or scaling up their shock levels.
robotics projects.
An overview and side-by-side comparison of the LiDAR sensors
Slamtec RPLIDAR S1 discussed can be found in the LiDAR Sensors Comparison
A long-range (up to 40 m) 2D Time-of-Flight LiDAR designed for textbox (see next page).
indoor and outdoor use. It captures over 9,000 points/s and resists
sunlight interference — ideal for large-area SLAM or outdoor Depth Sensing Stereo Vision Cameras
navigation. The S1 is compact, durable, and ROS-supported, offer- There are numerous depth-sensing cameras on the market today,
ing premium performance at a mid-tier price [5]. each leveraging technologies like stereo vision, structured light,
or time-of-flight. Among them, devices like the original Microsoft
VSemi Sentinel — 3D ToF Camera Kinect helped popularize affordable 3D vision in robotics and
The VSemi Sentinel [6] is a compact gaming, paving the way for the more advanced sensors in use today.
Time-of-Flight (ToF) 3D camera designed
for near-range depth sensing. It offers a The five models highlighted here are commonly found in robot-
resolution of 160 × 60 pixels and operates Source: [6] ics projects, research platforms, and commercial systems. They
effectively within a range of 0.1 m to 7.5 m. With a field of view offer strong technical performance and provide reliable digital

22 July & August 2025 www.elektormagazine.com


LiDAR Sensors Comparison Chart

Field of View
Model Type Range (FoV) Points/s Applications Approx. Price
Velodyne VLP-16 3D LiDAR High-fidelity mapping,
Up to 100 m 360° H × 20° V ~600,000 ~$950–$1,500
(Puck Hi-Res) (16 channels) autonomous navigation
Slamtec 2D LiDAR Indoor SLAM, hobby
Up to 12 m 360° Up to 8,000 ~$99
RPLIDAR A1 (Triangulation) robots, education
Slamtec Outdoor SLAM,
2D LiDAR (ToF) Up to 40 m 360° Up to 9,200 ~$649
RPLIDAR S1 autonomous rovers
VSemi Sentinel Gesture tracking, depth
3D ToF Camera 0.1 m – 7.5 m 51° H × 20° V N/A ~$199
(3D ToF Camera) sensing, indoor robots
3D LiDAR Mobile robotics,
Livox MID-360 Up to 40 m 360° H N/A ~$1089
(Solid-State) warehouse navigation
3D LiDAR Dense mapping, SLAM,
RoboSense Airy Up to 30 m 360° H × 90° V 1.72 million ~$1,099
(Digital) drone navigation
3D LiDAR Rugged robotics,
RoboSense E1R Up to 75 m 120° H × 90° V 260,000 ~$999
(Solid-State) outdoor automation
Slamtec 2D LiDAR + Mapping, localization,
Up to 12 m 360° N/A ~$380
Slamkit & C1 SLAM Solution indoor AGV navigation

output over USB or Ethernet, making them easy to integrate. Most and temperature sensors. With support for ROS and SDKs in C++
are compatible with PCs, embedded platforms like the NVIDIA and Python, the ZED 2i is ideal for 3D mapping, autonomous naviga-
Jetson, and in some cases, even Raspberry Pi boards — though tion, and AR/VR applications.
microcontroller support is typically limited due to bandwidth
and processing constraints. Their robust software ecosystems, Orbbec Gemini 335Le
ROS compatibility, and active developer communities make them The Orbbec Gemini 335Le is a
especially well-suited for robotics applications. rugged, industrial-grade stereo
vision depth camera designed for Source: [13]
Intel RealSense D435 robotics in demanding environments [13]. It offers depth sensing
The Intel RealSense D435 is a versatile from 0.25 to 20 m, with optimal accuracy up to 6 m, and deliv-
active stereo depth camera equipped ers both depth and RGB streams at 1280×800 resolution using
with global shutter sensors, making global shutter sensors. With an IP67-rated enclosure, Power over
it suitable for capturing fast-moving Source: [10] Ethernet (PoE), and support for ROS1/ROS2 and NVIDIA Jetson, it’s
objects [10]. It offers a depth range of 0.3 m to 3 m and supports well-suited for mobile robots, automation, and outdoor robotic
resolutions up to 1280×720 at 30 fps. With a wide field of view (85° applications.
× 58°) and compatibility with ROS, it’s ideal for applications like
SLAM, obstacle avoidance, and robotic manipulation. See the Depth Sensing Cameras Comparison Chart textbox
for a technical and practical comparison of the most widely used
Intel RealSense D455 depth cameras in robotics.
Building upon the D435, the D455 extends the depth range up to
6 m and enhances accuracy by increasing the baseline between
the stereo sensors [11]. It maintains the same resolution and frame Why Some Sensors Cost More Than Others
rate capabilities, offering improved performance in outdoor and When browsing sensor options, you’ll notice huge price variations
long-range scenarios. The D455 is well-suited for mobile robotics – e.g., a hobby RGB-D camera might be $200, while a high-end 3D
and applications requiring precise depth perception over extended LiDAR can exceed $10,000+. Several factors drive the cost:
distances.
> Range and Power: Sensors designed to see farther (or in
Stereolabs ZED 2i tougher conditions) need more power and advanced compo-
The Stereolabs ZED 2i is a passive stereo camera that provides nents. A LiDAR that reaches 200 m uses more powerful lasers
high-resolution depth sensing up to 20 m [12]. It features a wide and sensitive detectors (often with cooling and precise timing
field of view (110°) and integrates an IMU, barometer, magnetometer, circuits), increasing cost. For instance, a basic indoor LIDAR

July & August 2025 23


Depth Sensing Cameras Comparsion

Depth Field of View


Model Range (H × V) Resolution Frame Rate Key Features
Intel RealSense D435 0.1–10 m 85° × 58° Up to 1280×720 Up to 90 fps Global shutter, ROS support
Intel RealSense D455 0.4–10 m 87° × 58° Up to 1280×720 Up to 90 fps Extended range, improved accuracy
StereoLabs ZED 2i 0.5–20 m 110° Up to 4416×1242 Up to 100 fps Passive stereo, integrated sensors
Azure Kinect DK 0.25–5.5 m 120° × 120° 1024×1024 (depth) Up to 30 fps ToF sensor, advanced AI capabilities
Orbbec Astra 0.4–8 m 60° × 49.5° 640×480 (depth) 30 fps Structured light, compact design

with 6 m range uses a low-power laser diode, whereas a 200 > Build Quality and Durability: Robotics sensors that are
m automotive LiDAR uses amplified laser pulses and APD meant for heavy use or harsh environments are built to
(avalanche photodiode) receiver arrays – clearly more expen- higher standards (ruggedized enclosures, waterproofing,
sive tech. Similarly, a depth camera like Microsoft’s Azure wide operating temperatures, shock/vibration resistance). For
Kinect (around $400) uses a sophisticated Time-of-Flight example, the Velodyne Puck is rated IP67 (waterproof) with
sensor to reach ~5 m with millimeter accuracy, whereas a $150 an aluminum housing and has undergone extensive testing
structured-light sensor only works to ~0.8 m reliably. — this drives up cost. Cheaper sensors might be just plastic
> Resolution (Channels / Pixels): Higher resolution means housings not meant for rain or long-term use. In industrial or
more sensing elements or more complex optics. In LiDARs, automotive settings, companies are willing to pay more for
the number of laser channels (beams) is a big cost factor — a sensors that reliably last tens of thousands of hours. Addition-
64-beam Velodyne has 64 individual laser diodes and detec- ally, manufacturing tolerances (for optics alignment, etc.)
tors, precision-mounted on a spinning assembly, which costs and calibration of each unit add to cost. High-end devices are
a lot more to manufacture than a single-beam RPLIDAR. Each often individually calibrated and tested.
additional channel also increases the data processing load
(needing beefier onboard processors or FPGAs). For cameras, In summary, you get what you pay for: budget sensors are fantas-
higher megapixel sensors or global shutter sensors cost more tic for hobby projects and early prototyping, but for applications
than low-res or rolling shutter ones. Depth cameras with needing long-range, precision, and reliability, the investment in a
higher resolution depth maps (e.g., 1024 × 1024 ToF arrays) higher-end sensor pays off in data quality. It’s often a balance – many
will be pricier than those with 640 × 480. robotics teams use a mix of high and low-cost sensors to meet their
> Processing and Intelligence: Some sensors bundle signif- needs without breaking the bank. For instance, a research robot
icant onboard processing which adds cost. An AI camera might use a $3000 LiDAR for mapping but a set of $50 sonar or IR
like the Luxonis OAK-D has the Myriad X VPU – essentially sensors as backup collision detectors at close range.
a mini computer – inside it. This adds to the price, but the
benefit is it offloads your main computer and simplifies Industrial-Grade Sensor Vendors to Know
software. High-end lidars often output processed point clouds Finally, it’s worth knowing the key players in the sensor industry,
in real-time, requiring built-in FPGA or ASIC processing. even if their products are beyond the needs of a small project. In
Cheaper sensors might output raw data for the user to process the LiDAR space, companies like Velodyne, Ouster, Hesai, and Livox
(shifting the cost to the user’s computing resources instead). are leading development. Velodyne (a pioneer since the DARPA
The inclusion of IMUs, onboard calibration modules, or Grand Challenge days) offers a range from the compact Puck to
sensor fusion (e.g., cameras with integrated depth processing the Alpha Prime (128 beams, long range). Ouster focuses on afford-
like the ZED) also raises price. able high-resolution digital lidars (with a single chip integrating
> Software Stack and Support: When you pay for a sensor, many lasers). Hesai produces high-performance LiDARs used in
especially industrial-grade ones, part of what you pay for is many self-driving car tests. Livox (affiliated with DJI) takes a novel
the robust software and support behind it. Industrial vendors approach to scanning to reduce cost. These vendors are pushing
(like Basler or Zivid for cameras, Velodyne for LiDAR) provide technology forward.
extensive SDKs, documentation, and customer support. They
ensure drivers are maintained for new OS versions, offer For depth and 3D cameras, industrial machine vision companies
calibration utilities, and have warranties. This “software assur- like Zivid and Basler are notable. Zivid’s cameras (e.g., Zivid Two) are
ance” cost is built into professional products. In contrast, a used in robotics picking systems for their high precision color 3D
$100 sensor from eBay might come with minimal documen- capture (accurate to 0.1 mm, but costing in the tens of thousands).
tation and no support, leaving you to reverse-engineer data or Basler’s blaze camera uses Time-of-Flight to produce metric 3D
rely on the community. data for logistics and factory automation, with the reliability

24 July & August 2025 www.elektormagazine.com


one expects from German engineering. Intel RealSense remains About the Author
widely used in robots and drones, and its open-source SDK lives Saad Imtiaz, Senior Engineer at Elektor, is a mechatronics engineer
on – RealSense exemplified how relatively low-cost depth cameras who has extensive experience in embedded systems and product
could be deployed in robotics at scale. development. His journey has seen him collaborate with a diverse
array of companies, from innovative startups to established global
In the radar domain, if your application needs it, look at compa- enterprises, driving forward-thinking prototyping and development
nies like Texas Instruments (they offer mmWave radar modules projects. With a rich background that includes a stint in the aviation
and chipsets that have been integrated into drones and robots) industry and leadership of a technology startup, Saad brings a
or automotive suppliers like Bosch and Continental that provide unique blend of technical expertise and entrepreneurial spirit to
compact radar sensors (sometimes hackable for robotics use). his role at Elektor. Here, he contributes to project development in
both software and hardware.
In conclusion, the landscape of LiDAR sensors and cameras for
robotics is broad and evolving rapidly. The good news is that there
are options for every budget and requirement – from a student
building a small robot with a $20 Pi Camera, to a researcher assem-
bling a sensor suite rivaling a self-driving car’s. By understanding
Related Products
the strengths of each sensor type and paying attention to specs
like range, resolution, and support, you can mix-and-match the > YDLIDAR X4Pro Lidar
right sensors to give your robot the perception it needs. And as – 360-degree Laser Range Scanner (10 m)
tools like the Tangram Vision LiDAR comparison tool [14], the www.elektor.com/20546
community is actively helping make sense of all these options,
> YDLIDAR TG15 Outdoor Lidar
so you’re never alone in the journey of choosing sensors for your – 360-degree Laser Range Scanner (15 m)
next robotics project. www.elektor.com/19237
250341-01
> YDLIDAR G4 Lidar
– 360-degree Laser Range Scanner (16 m)
www.elektor.com/18934
Questions or Comments?
If you have questions about this article, feel free to email the > YDLIDAR TG30 Lidar
author at [email protected] or the Elektor editorial team – 360-degree Laser Range Scanner (30 m)
at [email protected]. www.elektor.com/20211

WEB LINKS
[1] YDLIDAR: https://www.ydlidar.com/
[2] Velodyne VLP-16, Ouster: https://ouster.com/products/hardware/vlp-16
[3] Slamtec RPLIDAR A1: https://www.slamtec.com/en/lidar/a1
[4] YDLIDAR TG15 Outdoor LiDAR: https://www.elektor.com/products/ydlidar-tg30-lidar-360-degree-laser-range-scanner-30-m
[5] Slamtec RPLIDAR S1, RobotShop: https://eu.robotshop.com/products/rplidar-s1-360-laser-scanner-40-m
[6] Sentinel 3D ToF Camera, VSemi: https://vsemi.io/products/sentinel
[7] Livox MID-360: https://www.livoxtech.com/mid-360
[8] RoboSense Airy: https://www.robosense.ai/en/rslidar/Airy
[9] RoboSense E1R: https://www.robosense.ai/en/rslidar/E1R
[10] Intel RealSense D435: https://www.intelrealsense.com/depth-camera-d435/
[11] Intel RealSense D455: https://www.intelrealsense.com/depth-camera-d455/
[12] StereoLabs ZED 2i: https://www.stereolabs.com/en-pk/store/products/zed-2i
[13] Orbbec Gemini 335Le: https://store.orbbec.com/products/gemini-335le
[14] Depth Sensor Visualizer, Tangram Vision: https://www.tangramvision.com/resources/depth-sensor-visualizer

July & August 2025 25


EVENTS

Sensor+Test and PCIM 2025


From May 6 to 8, 2025, two fairs took place in Nuremberg, Germany: Sensor+Test [1]
and PCIM Europe [2], dealing with power electronics. The PCIM has grown to six
halls, with a lot of well-known companies joining, like ST, Infineon, Microchip,
TI, and many others. This underlines that the market of high-power electronics is
growing, with application fields such as electric vehicles, renewable energy, and
server farms for artificial intelligence. Elektor’s editor-in-chief, Jens Nickel, was on
hand to look for interesting new products. As always, his personal selection is only a
small sampling of all the innovations seen at these trade shows.

Non-Contact Temperature
DC Motor Control Measurements
Motor control was, of course, a key Optris is specialized in industrial IR
topic at the PCIM. Toshiba showed a cameras and IR sensors, covering
nice demo based on the brushed DC applications as surveilling large
motor control chip TB67H453 with power facilities on one end to
current sensing. When slowing down the motor with your hands at the wheel, chip research on a microscopic
the higher current was shown at the LED ring. Current feedback can be used scale on the other end. The
for replacing position switches, cutting down the bill of materials and costs. German company has shown at
For easy evaluation of their motor control the Sensor+Test a lot of products
chips, Toshiba developed together with from their portfolio, for example
MikroElektronika a big set of Click boards. the thermosensor on the left, here
Find more about Toshiba at the PCIM at our measuring the surface temperature
Elektor TV Industry YouTube channel (see of an aluminium cube. A simple
textbox). “coating” — in that case an Edding
https://tinyurl.com/toshiba-motor-driver marker spot — does the trick!
https://optris.com/

PCIM in Video
Engineer and Journalist Stuart Cording
was also going around on the PCIM, as
always with the professional camera man
Michael “Mic” Klausner. Qoitech’s Otii
power analyzer was only one of the excit-
ing products they reported on. Check out
this video and a mashup of other company
video reports at our Elektor TV Industry
YouTube channel:
www.youtube.com/@ElektorIndustry

26 July & August 2025 www.elektormagazine.com


Dual Motor Control
A nice demo of two motors controlled in parallel
was shown at the ST booth at PCIM (ST was also
present at the Sensor+Test). The yellow and blue
plastic objects fit together during fast rotation, if
the motors on each side are precisely controlled.
For this demo working together on a dual
motor controller board: The STSPIN32G4 motor
controller for driving 3-phase brushless motors
and the STDRIVE101 as a triple half-bridge gate
driver, controlling
Ultrasonic together 12 power
Flow Meters MOSFETs.
At the Sensor+Test show, flow meters formed a big www.st.com/
segment, together with pressure and gas detection content/st_com/en/
sensors. Germany-based Allengra specializes in ultrasonic events/pcim-europe.
flow meters, tailor-made or from the shelf. Applications html
range from cooling/heating and consumer products like
coffee machines to fuel consumption measurements in
motor sports. As the velocity of sound in liquids depends
on the temperature, temperature sensors are integrated
to enhance the precision. With the ultrasonic technology,
bubble detection is also possible.
https://allengra.eu/

Weles Acoustics
As I am interested
in audio projects, Tracking Thousands of Devices
“sound maps” High-accuracy tracking with low-
always attract cost devices is a kind of holy grail of
my interest (see many IoT applications, like storage,
my report of traffic, and retail. The German start-
Sensor+Test up company Pelory uses an array of
2024 [3]). This antennas to track Bluetooth chips
system from (which are, for example, anyhow
Weles Acoustics is using a special sound integrated in smartphones) with an
probe to detect the sound pressure and accuracy of some centimeters. One
particle velocity at different positions and in antenna array can track thousands of devices at the same time,
different frequency ranges. The scan must and with more antennas, you can cover big halls and places.
be processed manually; the system detects According to the manufacturer, a German supermarket chain
the position of the probe with two LEDs, in is highly interested, but it could also be interesting for fairs and
order to draw maps of sound intensity. This events. Not only to see where the most successful booths are
is interesting for production machine and located, but also to navigate visitors to the exhibitor of their
automotive development, measurements choice. Especially in Nuremberg with a kind of labyrinthine
of sound protection and many more arrangement of halls, this could be indeed helpful!
applications. www.pelora.io
https://weles-acoustics.com/en/

250359-01

WEB LINKS
[1] Sensor+Test - The Measurement Fair: http://www.sensor-test.de
[2] PCIM Expo: https://pcim.mesago.com/nuernberg/en.html
[3] Jens Nickel, “Sensor+Test 2024 and PCIM 2024,” Elektor 7-8/2024 Bonus Edition: https://www.elektormagazine.com/iot-sensors

July & August 2025 27


PROJECT

Contact-Free
E-Field Measurements (1)

Source: Adobe Stock


A Vibrating Membrane for Assessing DC Voltages or
Static Electric Fields

By Michael Monkenbusch (Germany)


To assess the vibration amplitudes of membranes in this type of
In this article — the first of a series — we contraption, a makeshift laser-interferometer has been set up. This
are exploring the possibility of making enables comparison of the amplitudes with those inferred from the
E-field signal. This will be the subject of the next installment of this
a measuring device for static electrical article.
fields, which thereby could also allow a
completely contactless measurement of Signal
For a simplified consideration on how the measured (current) signal
DC potentials of objects. As sensor for the depends on the electric field, E, or the potential (voltage), U, of a nearby
field, a vibrating membrane is used. In the object, we assume that the membrane oscillates like a stiff plate with
second installment, the amplitude of the a uniform amplitude, a, and a frequency, ν. For that, we may discuss
two scenarios:
membrane’s vibration will be assessed,
with the help of a laser-based makeshift Adjacent (parallel) plate at potential U
vibrometer. Here we assume a parallel plate with distance d between plate and
our sensor membrane with an area A. Together they form a capaci-
tor C with a capacitance value of:
To minimize required mechanical work, a vibrating membrane (alumi-
num foil, or Al foil) was chosen as the sensor element. The vibration
is generated by a miniature loudspeaker (sound transducer), which
is coupled by a resonating air column to the membrane. The latter This capacitor then holds a charge Q:
ensures sufficient distance between transducer electric fields and the
sensitive membrane.
The membrane vibration causes periodic changes of the plate
In practice, the column is realized by a cardboard or plastic tube of distance d and thereby periodic changes in C and corresponding
about 4 cm diameter and 20 to 30 cm length. The sensor membrane changes δQ in the stored charge Q. These changes imply a current:
being a piece of Al-foil glued across one opening; the miniature
loudspeaker attached to the other end of the tube. This results in a
resonance at a frequency between 400 to 1000 Hz, which is employed
during the measurement. Therefore, with a plate vibration expressed by:

The membrane is connected to ground via a 100 kΩ to 1 MΩ resistor R,


thus a vibration in the presence of an electrical field induces a (small)
current, which is measured by taking R as a shunt (i.e., the voltage we have
across R is measured). This yields a signal that is proportional to the
electrical field at the Al-membrane.

28 July & August 2025 www.elektormagazine.com


i.e., > Isolate any electrical signals emerging from the vibration drive
from the sensitive membrane.
> Deal with amplitude relations (changes) and phase shifts
between the drive and the membrane signal.
> Suppress the influence of external field noise, in particular
environmental 50 Hz electrical grid “fog”.

The presented design addresses these by:

which means that the current signal I(t) is a sine (cos) of frequency ν > Establishing coupling between drive actuator and sensitive
with an amplitude proportional to potential (difference) U and inversely membrane over 10 to 30 cm distance by a resonant air column.
proportional to the square of the distance d. The sensitivity depends The best (resonant) frequency is determined at start by a scan
on the product of the (effective) membrane area A, the vibration (Arduino program).
frequency ν and the (yet unknown) vibration amplitude a. > Using a two-channel phase synchronized detection employing
two 90° phase-shifted reference signals. From the two detector
Electrical field voltages, the amplitude and the phase angle of the membrane
An alternate view of the situation may start with a given electrical field current can be computed (Arduino program). The phase yields
at the surface of the membrane (e.g., resulting from some charged the sign of the applied field.
object in the vicinity). If the membrane moves a distance δx along the > To extract the sign (positive and negative polarity are associated
electrical field lines, its potential (voltage) should change by δU = E δx. with a 180° phase difference) and magnitude of the voltage of the
The voltage change in the capacitor C, however, is compensated by object under test in a calibration sequence, we observe the signal
a current flow in the shunt resistor R to ground. Again, the associated change upon charging the membrane with a known potential. This
charge is δQ = C δU = C E δx and since δx = a sin(2πν) leading to decouples the determination of the test object voltage from exact
a current: knowledge of the membrane distance and stray capacitance.
> Besides the phase sensitive detection using a frequency that is
different from multiples of 50 Hz, the diagram contains a 50 Hz
notch T-filter.
This may be compared to the previous result if we observe that
E = -U/d and C = ε A/d. Circuit Diagram
The circuit diagram of the electric field sensor is shown in Figure 1.
Note, however, that C is the “mutual” capacitance between membrane Here, its function is explained. From left to right, the functional blocks
and charged object plus free space; any extra capacitance added by include:
connecting cables and other circuit components has little or no influ-
ence on the signal, as long a Ctotal R ≪ 1/ν. > A coupling and protection network, including the shunt resistor
R1|R22 or R22 alone.
In the real world > A first amplification ×22 stage (U1) of the shunt resistor voltage.
For the present realization the membrane displacement is not that of a > A 50-Hz blocking T-filter network (R6, R7, R8, C3, C4, C5).
rigid vibration plate but rather that of a membrane with fixed boundary, > A second amplification ×22 stage (U2).
such that the displacement must be averaged over the area, yielding > Two synchronous switching stages (unity amplification ±1) with
an average that has a value of about 10% of the maximum central 90° phase difference (U3, U4 with Q1, Q2).
displacement amplitude. > Averaging RC combinations (R17, C6 and R18, C7) connected to
buffer amplifiers (U7A,B).
The amplitude (and the phase) of the displacement is frequency-de- > A four-channel (2 differences) 16 bit ADC-shield (based on
pendent, and for closer plate distances d depends on this distance ADS1115 by Texas Instruments) that reads the outputs of the
(as well as the exact resonance frequency). buffer amplifiers and communicates these via I2C to the Ardui-
no-programmed ATmega386 microcontroller.
The presented construction incorporates measures and strategies to > A chain of two D-flip-flops U5A, U5B that receive a frequency
cope with these difficulties to enable also quantitative results. Later, signal from the microcontroller (GPIO4) that is generated via the
the inferred membrane amplitudes were compared to results from a tone-command.
laser interferometer setup. > XOR logic and buffers (U8A, U8B) that create symmetric
90° shifted reference switching signal for the synchronous detec-
Challenges tor’s outputs U8A (Gf) and U8B (G1).
While the basic measuring task is clear and consists of simply deter- > Filtered and current limited (C1, R25) transistor switched
mining the amplitude of the induced current I(t), the practical reali- frequency output (at ¼ of the tone frequency) to drive a miniature
zation poses a number of challenges: loudspeaker (8 to 80 Ω) that is resonance coupled to the sensor

July & August 2025 29


V+ V+

TLE2426xLP

V+
U10 Q3
20 7 21
R23
AVCC VCC AREF Frequency
COM 1 47k
RES Up
R29
SW2 23 14
C0 B0 BC547 R25

10k
24 15 V–
C1 U9 B1

470Ω
V– SW3A
V– 25 16
Reset C2 B2
Trigger out
U8C 26 17 Down
8 C3 B3
10 27 18 J5
9 =1 C4 B4 V– C1
28 19
C5 B5
V–
U8D U5 = 74HCT74 ATmega328p 1 2µ
12 2 13 Trigger out
11 U7 = TL272 D0 D7 /S R24 V–
13 =1 U8 = 4070 3
D1 D6
12 2
D Q
5
470Ω J4
4 11 U5A
D2 D5 V–
V– 5 6 3 6
D3 D4 CLK /Q
/R 10
GND X1 X2 GND
4 /S
8 9 10 22 12 9
Y1 D Q
LCD1
U5B
16 x 2
11 8
V– CLK /Q
C12 16MHz C13 /R
GND

SDA
SCL
+5V

13
1 2 3 4 22p 22p

V–
V– V+
V–

V+
G1
V+
OPA2182
R10 3
1
100k R17
5 3 V+
R9 U3 100k
2 1 14 8 14
100k U7A
4 2 U5 U7 U8
Q1 R31 7 4 7
U8A R11
1 R12

10k
3 100k C6 8
2 =1 100k
VDD
J113
1µ 4 2
V– AIN0 ALERT RDY V–
5 10
AIN1 SCL
V+ 6 U6 9
AIN2 SDA
G2 7 1
AIN3 ADDR
OPA2182 ADS1115IDGS R30 R28 R27
R14 GND
1 3
10k

10k

10k

100k R18 3
5 5
R15 U4 100k
2 7
100k U7B
4 6
Q2 V–
U8B R16
5 R13
4 100k C7
6 =1 100k
J113

V–
V–

V+ V+

OPA2182
OPA2182 1 3
Membrane C8 Monitor out
R21 3
1 5
J1 4k7 R7 R8 C9 R4 U2 J3
5 2
R19 2n2 U1 14k4 14k44 47k
2 4
C5 1µ
20M

SW1a 4 D3 D4
R5
R3 440n 1M
V-compensate D2 Yellow Yellow
D1 100k
J2 C3 C4
C2 V–
1N4148 1N4148
1n
R20 R1 R22 R2 220n R6 219n R26
220Ω
100k

7k22
4k7
1M

1M

V–

240279-006

Figure 1: Complete schematics of the E-field circuitry.

30 July & August 2025 www.elektormagazine.com


foil and thus drives its vibration. The sensor foil is connected via
the Membrane BNC connector (J1, bottom-left side of schematics).
> Results in terms of voltages and inferred phase angles are shown
on and I2C coupled 16 × 2 LCD.

The analog ground reference is obtained from the 5 V supply by the


rail splitter U10. As opamps, the zero-drift low-noise types OPAx182
are used throughout.

In Figure 2, a part of the prototype is shown, which includes the frontend


amplifier, the 50-Hz filter stage, the sync detector and the signal ampli-
fication stages. It’s realized on a full-copper boards (an overall shield),
layered with strip solderable PC Boards and opamp breakout boards.

Figure 3 illustrates the whole prototype of this design, including the


ADC module with U6, the amplifier module (U7), the ATmega328P
controller, an Arduino board — used as a plain USB interface, without
the controller — and the LCD module.

Synchronous Detection
To detect the tiny currents from the sensor membrane movements
in the applied static electric field, we need a synchronous detection
scheme that only “tunes in” on signal components that are synchronous
with the driver excitation. Since, however, there is an unknown (and Figure 2: Amplifier frontend and sync-detection.

Figure 3: The complete design, with its main circuitry in the center; it includes: Amplifier (upper left), sync-detection (lower left), ADS1115 ADC, buffer
amplifiers, drive transistor (middle from above), ATmega328 (Arduino), dual flip-flop, XOR-gate(s) (right from above). The Arduino UNO board — with
ATmega chip removed — has been used as a programming interface and disconnected later on.

July & August 2025 31


V (n035) V (n032)+1.2 V (n034)-1.2
2.4V PRE A3
OUT
2.1V D Q
=1
Clk 1.8V IN A1
CLK /Q
A1 1.5V
CLR
PRE
1.2V D Q

0.9V
A2
Clk 0.6V CLK /Q

A2 0.3V CLR

0.0V
-0.3V 240279-010

Out -0.6V
A3 -0.9V Figure 5: Flip-flop pair receiving the “tone” signal as input to A1. With the
-1.2V
0ms 5ms 10ms 15ms 20ms 25ms 30ms 35ms 40ms 45ms 50ms XOR gate A3 two 90 degree phase shifted sync-detector signals (U8A and
U8B outputs) are generated.

Figure 4: Signal sequence: “tone” frequency input (red), with U8A (black)
and U8B (green) outputs showing the sync detection signals. (Q3) drive for the speaker with only C1 to partially smooth the square
signal is foreseen.

starkly frequency dependent) phase-shift between the loudspeaker The JFETs switch the amplifier stages U3 and U4 from +1 to -1 amplifi-
excitation and the membrane vibration, the actual phase must be cation, depending on their gate voltage. Finally, the averaged (via R17/
adjusted or determined during the actual measurement. C6 and R18/C7) voltages U_outG1 and U_outG2 — buffered by U7A and
U7B — are digitized by ADC U6. From the digitized voltage values, the full
This is achieved by starting with an Arduino generated square wave signal amplitude and the phase are computed in the Arduino program.
four times the operation frequency f, which is divided down to 2f and The extracted phase further contains the E-field polarity information.
then further to f by two cascaded flip-flops. The first division ensures
a 2f signal that has a duty cycle of exactly 50%. Combining the 2f and With that, the signals at the outputs of the phase detector are illus-
f square waves (clk-A1 and clk-A2 in Figure 4) using an XOR gate trated in Figure 6. The traces shown are shifted for better visibility. To
(Figure 5) made with A1 and A2 (U5A and U5B in the schematic, respec- suppress the considerable noise in the input signal (CH1 = Monitor
tively) creates a further 1f square wave (out A3) with a 90° phase-shift. out) the averaging function was used for the oscilloscope acquisition,
thereby cleaning the signal in a way similar to that of the sync-de-
Feeding the clk A2 and clk A3 square waves to the gates G1 and G2 of tection stages, to extract “noise-free” DC-voltages representing the
the switching JFETs in the two synchronous detector stages around input vibration signal.
U3 and U4, yields averaged voltages U_outG1 and U_outG2 that are
proportional to the in-phase and the 90° phase-shifted detector signal The outputs of the sync-detector opamps are connected to 1 μF averag-
components. One of the square waves with frequency f (here clk-A2) ing capacitors by 100 kΩ resistors (low-pass filter). To achieve sub-mV
is used to drive the speaker (i.e., the membrane); since the acous- accuracy, the capacitor voltages are buffered by another pair of
tic coupling yields sufficient filtering, only a simplistic one transistor OPAx182 opamps, used as voltage followers.

Figure 6:
Phase detector outputs
CH2 and CH3 obtained
by multiplication of the
yellow CH1 signal, CH4
shows the reference
frequency. The
oscilloscope’s traces
are obtained using
averaging. The curves
are vertically shifted, for
a better visibility.

32 July & August 2025 www.elektormagazine.com


Figure 7: Display as shown during frequency scan (left) and in “normal” measuring mode (right).

The final averaged voltages relate to the amplitude UR at the shunt Program
resistor via: The microcontroller is programmed using an Arduino environment
and is downloadable at the Elektor Labs page for this project [1].
Upon start or reset, the program starts with a frequency scan (400
to 750 Hz) to find the resonance point of the sensor tube used.
and To do this properly, a constant field must be applied. During that phase,
the display (top of Figure 7) shows the actual frequency together with
signal amplitude and phase.

with α ≃ 400 the amplification factor of the front end and ϕ the phase The switch SW3 (see circuit diagram) allows extending the scanning
angle. (up-ready-down) as long as one of the settings is kept. After the scan,
the resonance frequency will be applied and the present phase deter-
Operation and Measuring Sequence mined and stored. Then the display (Figure 7, bottom) will show the
At start/reset, first a frequency scan is initiated that determines the actual total voltage
resonance frequency. This requires the presence of a (reasonably)
constant applied field to the sensor membrane. As shown below, the
resonance somehow depends on the distance d between membrane
and object. and the phase angle ϕ. The second line shows the voltages after
“rotation” with the determined reference phase. I.e., if the phase has the
Thereby, the best frequency and the phase shift between drive and original value, the first voltage is equal to Ua and the second voltage
signal are determined and stored. The phase knowledge enables the should be close to zero. This enables to check the polarity of the field
determination of the sign of the applied field with respect to the refer- regarding the reference field, as well as potential resonance shifts.
ence at start.
Mechanics
Then measurement can be performed. The results are shown in terms As an easy-to-make makeshift sensor arrangement, a cardboard or
of displayed voltage and phase angle — settling after an averaging plastic (sewer tube) pipe can be used. The main setup is shown in
period of a few seconds. Figure 8. For my experiments I chose lengths between 20 to 30 cm, the
tube thickness was about 40 mm. At one side, a membrane consisting
To interpret the results as potential of the investigated object, a compen- of standard household Al-foil was glued across the opening (no tension
sating (enhancing) voltage can be applied to the membrane — as applied).
we’ll see later on — via a 20-MΩ resistor (still only a negligible signal
bypass!). The ratio of the measured values with and without compen-
sating voltage and the original value multiplied with the compensating
voltage yields an estimate of the object potential.
d
L

C
E

Drive D a E

C
g
Input Ux
2.2nF/
Figure 8: Sketch of the measuring setup. The vibrating membrane is 2KV 20 MW

connected to the input network (2.2 nF, 20 + 10 MΩ) via a 60 cm long Ucompensate
RG174 coax cable. The tube is above some distance from a grounded plane.
10 MW
A plane at elevated voltage Ux is at distance d from the membrane. The
maximum membrane amplitude a is of the order of 1…10 mm.

July & August 2025 33


- Sewerp10 7508 scale 1.00
Sewerpipe 1078V 10mm
sewerpipe 2mm 10mm 15mm - Sewerp10 7509 scale 1.00
Sewerpipe 1078V 10mm
- Sewerp2 7510 scale 1.000
Sewerpipe 2mm 30V
- Sewerp2 7511 scale 1.000
Sewerpipe 2mm 30V
1000 - Sewerp15 7512 scale 1.00
Sewerpipe open 15mm 1078V
- Sewerp15 7513 scale 1.00
Sewerpipe open 15mm 1078V

750

500

mV
250

250 500 750 1000 1250 1500


freq

Figure 10: Resonances of the “sewer pipe“ assembly: the black curve
Figure 9: Setup for some test measurements (distance dependence, offset represents the signal amplitude with the membrane at a distance of 2 mm,
voltage effect). The “sensor” with the vibrating membrane at the “right” end the green one at a distance of 10 mm. The red and blue curves represent
faces the Cu plate, charged at a potential up to 1000 V, connected via a the corresponding phases (1° = 1 mV). Note the artificial back-folding jumps
33 MΩ resistor. The “sensor” sits on a cardboard box to yield some distance when ±180 degrees are reached.
from the grounded steel plate. The Cu plate is isolated by a glass plate from
the steel ground. On the bottom right, the display shows the total average
voltage and the phase angle (1st line); the second line shows the voltages
obtained by “rotating” the sync detector voltages with the calibration 16 mm charged plate distance and 1000 V plate potential. Then the
standard phase angle; thus the first value contains the proper E-field sign
distance was varied and the resulting voltage Ua without and with
and the second value ideally should be zero.
applied (here 285 V) offset voltage Ub were registered.

The results are shown in Figure 11. In Figure 12 the ratio of resulting
At the other end, a miniature loudspeaker (8 to 80 Ω) was attached/glued. voltages without and with compensating offset voltage (applied to the
The Al-foil was connected to the amplifier input by a shielded RG174 cable membrane) are shown. The limiting value for d → 0 allows to infer the
with 40 cm length. A naive estimate of the basic λ/2 resonance of the Ux value of the object under investigation.
tube pipe then would yield 330 m/s/(0.4…0.6 m) = 550…850 Hz. Acous-
tic impedance effects of loudspeaker and membrane and coupling to Thus, the setup may be used to estimate the potential of an electro-
their resonance (may) cause further deviations. statically charged part. I tried a Styrofoam plate charged by rubbing
to some cloth. The ratio of Ua ≃ 200 mV and change by 285 V offset
For flexible experiments and tests, I used a steel ground plate which ∆Ua ≃ 6 mV yields an estimate of 285 V × 200/6 = 9.5 kV. One can
allowed to fix a potential plate (Cu printed circuit board material) as also monitor the slow decay of electrostatic charges. This may be a
well as the tube using a number of assembly brackets and small useful application of the setup to assess ESD risks.
NdB magnets. Figure 9 shows a photo of this assembly. The Ux poten-
tial parts were isolated from the steel by a glass plate. The steel plate Order of Magnitude of Effect and Membrane
was connected to ground. The coupling capacitances CE and Cg Amplitudes
determine the ratio between the displayed output voltage and Ux . With the values: shunt resistor Rs = 1 MΩ, first stage amplifier x420 (6
47.03 mV/701.82 mV = 0.922 damping of the 50 Hz T-filter at the used
Acoustic Resonance frequency of 520 Hz); synchronous detection x 1 and 2/π = 0.6366 we
The microcontroller program searches for the (optimal) resonance obtain a sensitivity such that 1 nA at input yields 0.2465 V at the DC
frequency of the actual setup. The general behavior of the response struc- output of the synchronous detector.
ture of the “tube” sensors (with applied voltage at the adjacent plane)
is displayed in Figure 10. At shorter distances between membrane and The capacitor membrane velocity v = dd/dt (assuming rigid plate
adjacent potential plane (d), the exact position of the main resonance movement) depends on the displacement amplitude a:
depends on this distance. Here it lies between 500 to 600 Hz.
v = 2π f a cos(2πft)
Results
To test the distance (d) dependence of the resulting voltage Ua exper- i.e., the velocity amplitude v0 = 2π f a; with an assumed estimated value
iments were carried out. Here I report the result obtained with the of 5 pF for C, a field E = 30 V/mm and measured U = 0.3 V we would
“sewer pipe sensor.” Initial resonance determination was initiated with get I0 = E C v0 = E C 2π f a ≅ 1 nA yielding a = I0/(E C 2π f) ≅ 2 μm.

34 July & August 2025 www.elektormagazine.com


theory+ bkgr
level

Ua and Ua- Uoffs vs d and phase ratio Ua:Ua- offs slope


sewe100u 10010
sewerpipe 100k 573H
hv
Ucomp
freq
200 3 numor1
fitsewe1 -
sewerpipe 100k 573H
hv
Ucomp
freq
numor1
numor2

150

Ua/mV
Ua/mV

100

50

0 0
0 20 40 60 80 0 20 40 60 80
d/mm d/mm

Figure 11: Measured voltage values as function of distance d at a plate Figure 12: Ratio of the measured Ua values without and with compensating
potential of 1000 V and a detector shunt resistor value of 100 kΩ. The red (externally) applied offset voltage. Ideally — without parasitic capacitive
curve is the value obtained with applied compensation voltage of 285 V. couplings - the value should enable the assessment of the Ux value of the
The change of phase (resonance) with Cu-plate distance is illustrated adjacent plate. The expected ratio would be Ux/Ux-Ucomp, here: 1000 V/
by the blue symbols. The lines are fits with expressions that somewhat (1000 V – 285 V) as indicated by the horizontal line. The influence of
deviate from the theoretical 1/d2 behavior due to influences of the parasitic stray capacitance in a larger distance is clearly visible in deviation of the
capacitance Cg. measured points from this value. Nevertheless, the offset method allows the
approximate assessment of Ux .

Since the real displacement of the membrane is not that of a rigid Questions or Comments?
plate but rather that of a membrane that is fixed at the boundaries, Do you have technical questions or comments about this article?
the effective displacement amounts only to 10 to 15% of the central Please contact the author at [email protected]
amplitude. Thus, we infer a maximum central membrane amplitude or the Elektor editorial team at [email protected].
up to 13 to 20 μm at resonance.

What’s Next
In the next installment of this article, I will describe the interferometric
Related Products
measurement of this amplitude — using a simple makeshift interfero-
metric setup. Stay Tuned! > Douglas Self, Small Signal Audio Design (4th Edition),
240279-01 Focal Press
www.elektor.com/18046

> FNIRSI 1013D 2-ch Tablet Oscilloscope (100 MHz)


www.elektor.com/20644

About the Author


Michael Monkenbusch is a retired physicist who
worked in the fields of neutron scattering, instrumentation, and
soft-matter physics. Reviving an old electronics hobby led to the
project presented here.

WEB LINK
[1] Elektor Labs page for this project: https://tinyurl.com/2t4wmw3w

July & August 2025 35


PROJECT

b•
or la Elekt
kt

Ele

or
lab
ORIGIN
AL

Ele

b
kt
or

la
or

Wireless
la b
• Ele k t

Mailbox Notifier
From Optical Sensors to Radar, Exploring a Few Options

By Jean-François Simon (Elektor) Of course, this problem can easily be solved by purchas-
ing a ready-made system. Many options are available,
Are you eagerly waiting for a letter or a small from mechanical solutions to electronic ones. However,
parcel? Let’s see what sensors and RF modules building it yourself is an excellent opportunity to explore
different types of sensors and wireless systems while
we can use to build a simple mailbox notifier, enjoying the satisfaction of creating something unique!
and why infrared worked best in the end.
Design Objectives
The most obvious design goal for the project is of course
that it should be compatible with the particular type of
Unnecessary trips to check an empty mailbox can be mailbox I have, which is shown in Figure 1. The system
frustrating, especially in bad weather or for people in rural must operate entirely wirelessly, both for power and
areas where the mailbox might be far from the house. This communication, for ease of installation. Additionally, it
is particularly true for individuals with mobility challenges. should require minimal modification to the mailbox itself.
Additionally, in areas where mail theft is a concern, a Those modifications will have to be discreet, as I don’t
notifier can enhance security by alerting the user as soon want the letter carrier to be confronted with an eccentric
as the mail arrives, reducing the risk of tampering. device which could worry them or give them the impres-
sion of being spied on.

Simplicity is another key objective; I will be favoring


pre-existing modules for sensors and communication.
Moreover, the system must have sufficient range to trans-
mit information reliably over approximately 20 meters,
traversing multiple concrete walls to reach the indoor
receiver, as well as a battery life of at least six months.
Lastly, in the absence of an existing home automation
system, the notifier must function as a standalone solution
without reliance on servers or internet connectivity.

A Look At Several Types of Sensors


Since there’s really no such thing as a dedicated mail
sensor, we have to capture its arrival in a roundabout
way. Sensing movement is a relevant approach. Magnetic

sensors containing reed switches, like those used in alarm
Figure 1: A typical systems for doors and windows, are simple, cheap and
French mailbox. consume minimal power (the sensor itself doesn’t use

36 July & August 2025 www.elektormagazine.com


any power, only the microcontroller monitoring it does).
However, if your mailbox has both a door and a flap for
smaller items, two sensors would be needed, as well as
their two corresponding magnets, which slightly compli-
cates wiring and mechanical modifications to attach the
magnets and sensors.

Weight sensors at the bottom of the mailbox could work,


but they’re a bit on the complex side to implement.
Assuming the mailbox itself can’t be moved, it would
be needed to install a double floor at its bottom, with a
load cell under it. A kitchen scale could be adapted for 
this, but there are probably simpler options. Light sensors
are promising, as they can sense changes in illumination on Time-of-Flight (ToF) measurements. Depending on Figure 2:
when the mailbox is opened. However, they may be hard the model, these sensors can measure distances from PIR motion detector.
to calibrate so that they work in any ambient light, even a few millimeters to several meters. This is of course not
at night. Camera modules have also been used in similar needed for a mailbox, but very impressive nevertheless.
projects. For example, several people have shared online
their implementations using ESP32-CAM modules. To Radar Modules
fully leverage such a camera module, it is ideal to have Radar modules are another fascinating option. These
the ability to view the images remotely, which requires sensors emit extremely high-frequency signals, at 10 GHz
a substantial bandwidth between the transmitter and and above, and analyze the returned signal to determine
receiver. Typically, this is achieved using Wi-Fi, but I’d the position and velocity of objects within their detection
rather not take that route for this project. range. Their primary advantage lies in their immunity
to environmental factors such as temperature, humid-
Passive Infrared (PIR) Sensors ity, light, airflow, dust, etc. which make them relevant in
PIR sensors are widely used in applications such as alarm harsh industrial environments. Low-cost modules like
systems and home automation, making them readily avail- the CDM324 and HB100 [3] are widely available from
able and extremely affordable. A quick search for “PIR Chinese suppliers. There are also more expensive and
Sensor” on platforms like AliExpress reveals an extensive better documented options available at Western distrib-
selection in various shapes and sizes, often at remark- utors, such as the IPM165 from InnoSenT or the A111
ably low prices. They are easily recognizable by their and XM125 [4] from Acconeer. At the other end of the
distinctive plastic Fresnel lens (Figure 2). PIR sensors cost spectrum, a minimalist option is the RCWL-0516 [5],
detect infrared radiation emitted by warm bodies, such as which offers basic motion detection on a very simple PCB.
humans and animals. At first glance, it seems unusual to All these modules are fascinating and would deserve to
use this sensor for detecting a letter or parcel, as these are be studied in detail, but fully leveraging their capabilities
typically at a temperature close to the ambient environ- is beyond the scope of this article. I did a few tests with
ment. Yet, several commercial mailbox notifiers use this the RCWL-0516 but had difficulties in reliably detecting
type of sensor, so they are obviously worth considering. motion inside the mailbox, likely due to signal reflections
I’ll investigate myself later. off the internal walls.

Optical Proximity Sensors RF Systems


Proximity sensors often consist of an infrared emitter and Now that we have an idea of the possible sensors, let’s
receiver housed in the same unit. By emitting pulses of look at the possibilities in terms of wireless transmis-
infrared light and analyzing the reflected signals, they sion. 315 MHz and 433 MHz RF modules are cheap and
can determine if an object has entered their detection commonly available. The simplest and cheapest modules
range. Periodic measurements allow the system to detect use On-Off Keying (OOK) and there is no built-in mecha-
movement by comparing changes in reflected light. For nism to avoid transmission errors, thus it’s required to
instance, the VCNL3040 [1] from Vishay offers a detection take care of it in software, which can be quite a bit of work
range of 0 to 300 mm and is promising for this applica- to get a reliable transmission. More advanced modules
tion. However, it’s housed in a small SMD package, with take care of this for you and can be used as a wireless
eight solder pads constrained in a tiny 4 mm × 2 mm serial port, such as the well-known HC-11 and HC-12 [6]
rectangle, which makes prototyping a challenge. Other modules, or the slightly more expensive E32 modules
optical proximity sensors, such as the VL53L series [2] from Ebyte. However, depending on the chosen sensor,
from STMicroelectronics, use a different technique based a full-blown serial port may not be needed.

July & August 2025 37


Figure 3: The insides of primarily designed to detect humans or animals based
the PR100 sensor. on the temperature difference (and infrared radiation)
between them and the surrounding environment. For

parcels, however, this issue is less critical; the mail carrier
must open the mailbox to deposit them, and this motion
(or the mail carrier) is easily detected by a PIR sensor.
Furthermore, I noticed that several commercial mailbox
notifiers, such as those from the French brand Novlee
and the American brand Ring, also use PIR sensors. This
gave me confidence to test them myself.

A quick search for “Wireless PIR” on platforms like


AliExpress revealed a wide range of options. These fully
integrated modules, typically battery-powered, include a
PIR sensor and an RF transmitter that alerts the receiver
when motion is detected within the sensor’s field of view.

Among the many available modules with different radio


options available — Zigbee, Wi-Fi, 315 MHz, 433 MHz,
868 MHz, and others — I chose the PR100 module by
Staniot (Figure 3). It uses the EV1527 protocol, a widely
adopted standard often found in garage door remotes
and similar devices. The sensor sends EV1527 pulse trains
whenever motion is detected. This choice allows me to
Wi-Fi, while offering higher data throughput which can select from a wide range of compatible receivers, offering
be useful for using together with a camera module, is good range, easy setup, and no need for a Wi-Fi network
power-hungry which makes it tricky for long-term battery or a LoRa gateway. This module is powered by two AAA
use. Bluetooth Low Energy (BLE) is power-efficient but batteries and its quiescent current is below 10 µA, with
limited in range, making it less practical for mailboxes an active current of around 15 mA during detection and
located far from the house. Protocols like Zigbee and transmission. This should result in excellent battery life.
LoRa are good for low-power, long-range communica-
tion. They provide better range at the cost of slower data EV1527?
rates, but could be well-suited for basic “you got mail” There are many devices labeled with “EV1527” or “1527”
notifications. but the documentation leaves much to be desired. In
fact, EV1527 is not really a protocol but rather an IC [8]
Some Decisions made by Silvan Chip, specifically for garage door remote
All this research provided fascinating possibilities. I controls. It has four inputs for up to four buttons, and one
wanted to try everything! Optical time-of-flight sensors, output used to toggle the RF transmitter on and off. The
with their fancy surface-emitting infrared lasers, got me implementation of the RF part, typically at 315 MHz or
curious. I also found radar sensors extremely interest- 433 MHz, is left to the remote manufacturer’s discretion.
ing and found a great video about the CDM324 on The It uses a fixed-code transmission mechanism, where a
Signal Path channel [7]. However, time is running out, 20-bit address and 4-bit data are sent as a serialized
and what was meant to be a “quick and dirty project” pulse train. To use the remote, you first have to make the
shouldn’t turn into a six-month research endeavor. As receiver learn the particular 20-bit address of the trans-
a result, I had to make some practical compromises. mitter. This system was so successful that it was widely
My strategy has been to focus on off-the-shelf devices copied and is now massively used in wireless doorbells,
containing both a sensor and a communication device remote-controlled switches, and many more devices.
in one package. This approach allows for prototyping
with functional, validated blocks already tested by their Receiver
manufacturers, avoiding the need to reinvent the wheel. The choice of a 433-MHz module with a built-in sensor
and transmitter naturally determines the options for the
While researching wireless motion detectors online, I receiver. A quick search for “EV1527 receiver” on popular
found that the vast majority rely on PIR sensors. Initially, electronics marketplaces reveals a wide range of compat-
I had doubts about their ability to detect the motion ible modules. These vary in features such as the number
of a letter sliding into a mailbox, as these sensors are of output channels, relay or MOSFET-based outputs, etc.

38 July & August 2025 www.elektormagazine.com


Since only one output channel is needed, I selected the
QA-R-011 receiver [9] from Qiachip (Figure 4). I bought
it in a pack that also contained a small EV1527-com-
patible remote control in key-ring format, which will be
handy for testing.

This module features an open-drain output driven by an


NTD20N06 MOSFET (20 A max.), which is a bit excessive
for handling logic level signals but otherwise perfectly
functional. I connected a simple LED indicator to the
receiver’s output. The receiver can be configured in
several modes, one of which is “latching”. In this mode, 
the receiver must learn a code to turn on the output, and a
different code to turn it off. The PR100, on the other hand, To maintain good relations with the landlord, I replaced Figure 4: Close-up of the
always sends the same code when motion is detected, the house’s mailbox with another old and rusty unit QA-R-011 receiver.
which will be the “on” code from the receiver’s point of that I had no hesitation modifying. The PR100 module
view. This way, a single movement detection will turn on was disassembled, with its NS312 PIR sensor relocated
the indicator light and keep it on. One of the buttons on inside the mailbox, by soldering it to a piece of perfboard
the key ring remote control can be used to transmit the which is then attached with double sided sticky foam.
“off” code to switch off the indicator light once you’ve The NS312 sensor is then covered with a small Fresnel
picked up your mail, or you may power cycle the receiver dome salvaged from another PIR sensor kit I had in stock.
for the same purpose. The rest of the PR100’s PCB, including its antenna, was
placed in a plastic junction box mounted outside the
Practical Build mailbox (Figure 5).
Some YouTube tutorials suggest that installing a module
like the PR100 inside of a mailbox, placing the receiver Sensor Placement
in the house, and connecting it to a light is all it takes. It quickly became apparent that the PR100 frequently
This approach can work – but only if your mailbox is triggered false positives, lighting the LED even when
made of wood or plastic, at least on one side. For a fully no mail was delivered. Indeed, placing the sensor at
metal mailbox, however, the signal is almost completely the back of the mailbox worked well for detecting mail
blocked by the sheet metal, preventing it from reaching but also picked up pedestrians on the street through
the receiver indoors. the mailbox opening. The same issue occurred when
the sensor was mounted on upper internal side of the
To address this, I needed to place the PIR sensor inside mailbox. To diagnose the issues and help me find the
the mailbox while positioning the radio transmitter best position for the sensor, I switched the receiver mode
outside. This required drilling a few holes in the mailbox. from latching to momentary action, so each detection

Figure 5: The PCB of


the PR100 has to be
mounted outside the
box to allow signal
transmission.

July & August 2025 39


Figure 6: EV1527 receiver
and pulse counter
connected together.

 Figure 7: The best position for the sensor, at least for me.

by the PR100 produced a pulse output from the receiver. is present. 2: Both a letter and a package (or possibly
These pulses can then be counted by an Arduino or any junk mail). 3 or more: The sensor likely detected external
other similar device. movements near the mailbox! To reset the counter every
day, its power supply (an old phone charger) is plugged
Staying true to the “less is more” philosophy, I utilized a in a timer socket.
module I already had in stock, which you can easily find
on eBay or AliExpress. It’s a small red PCB equipped with Ultimately, the best position for the PIR sensor was
a 5-digit, 7-segment display and a Microchip PIC16F628A on the inner side of the front door, pointing toward
microcontroller, typically sold as a “Frequency Counter - the back of the mailbox (Figure 7). This configuration
Crystal Tester.” Heinz Winter, from the YouTube channel reliably detected envelopes slid through the slot without
TheHWcave, has made several excellent videos [10] about opening the door and had no trouble detecting motion
modifying this module, including a mode for counting when the door was opened to deposit a package, all
single pulses, even down to DC. You can find the expla- without detecting nearby pedestrians. Initially, I wanted
nation in the video and the source code on his GitHub to build a better, prettier receiver unit, but the cheap
repository [11]. I simply connected the open-drain output 7-segment LED counter blends right in with my living
of the EV1527 receiver to the counter’s pulse input and room now (Figure 8). In the end, I kept the rusty old
added a pull-up resistor (non-critical value, I used 2.6 kΩ). mailbox. Nothing is more permanent than a temporary
The receiver is just small enough to fit between pins of solution! However, these fancy radar sensors are intrigu-
the 7-segment display and was secured with a dab of ing though, I’ll have to keep experimenting and find a use
hot glue (Figure 6). for them in another project!
240715-01
Every day, the counter reading provides a clear indica-
tion of what happened. 0: No mail. 1: A letter or package

About the Author


Jean-Francois Simon (Engineer, Elektor) has a
longstanding passion for electronics and enjoys topics
as varied as circuit design, test and measurement,
prototyping, playing with SDRs, and more. He likes
to create, modify and improve his tools and other
systems. He has an engineering background and also
enjoys mechanics, machining, and all things technical.
Follow him on X at x.com/JFS_Elektor.

Questions or Comments?
Do you have questions or comments about this article?

Email the author at [email protected],
Figure 8: Yay, something or contact Elektor at [email protected].
has arrived!

40 July & August 2025 www.elektormagazine.com


Related Products
> SparkFun Sensor Kit Visit our IoT & Sens
or
www.elektor.com/19620 for articles, project s page
s, news, and
videos.
> HC-SR501 PIR Motion Sensor Module
www.elektor.com/18420 www.elektormag
azine.com/
iot-sensors

WEB LINKS
[1] VCNL3040 sensor: https://www.vishay.com/docs/84917/vcnl3040.pdf
[2] VL53L sensor series: https://www.st.com/en/imaging-and-photonics-solutions/vl53l0x.html
[3] Stefano Lovati, “The HB100 Doppler Motion Sensor,” Elektor 7-8/2023: https://www.elektormagazine.com/230205-01
[4] XM125 Sensor at Sparkfun: https://www.sparkfun.com/products/24540
[5] Information on the RCWL-0516: https://github.com/jdesbonnet/RCWL-0516
[6] HC-12 RF module datasheet: https://www.elecrow.com/download/HC-12.pdf
[7] Video about the CDM324: https://www.youtube.com/watch?v=5vqSX40seqA
[8] EV1527 datasheet: https://www.sunrom.com/download/EV1527.pdf
[9] QA-R-011 receiver: https://qiachip.com/blogs/usermenu/light-control-module-specification-qa-r-010
[10] Video from TheHWcave about the pulse counter: https://www.youtube.com/watch?v=3imEpm_zztQ
[11] Source code for the counter: https://github.com/TheHWcave/PIC-freq.counter-modification/

FRONT PANELS. ENCLOSURES. MILLED PARTS.


Design it yourself & order directly
Starting
Free design
at
piece
software
For Windows,
Linux and Apple

CNC
ence
Excell

ag .de / en
MORE AT www.schaeffer-

July & August 2025 41


PROJECT

r lab • Elekto
to

k
Ele

r la
b
O R IG IN A L

Ele

la b
kt
or r
la b to
• Ele k

Elektor
Mini-Wheelie
A Self-Balancing Robot

By Clemens Valens (Elektor Labs)


Specifications
ooth
> ESP32-S3 microcontroller with Wi-Fi and Bluet
The Elektor Mini-Wheelie is an > MPU6050 inertial meas urem ent unit (IMU )
experimental self-balancing > Two independently controlled 12 V electric
motors

robot powered by an ESP32-S3 with two hall-effect senso rs


> Ultrasonic transducer HC-SR04 (4-pin)
microcontroller and programmable > 320 × 240 pixels TFT colour display
with Arduino. Designed for hands- > MicroSD card slot
on learning, it features wireless > Battery power monitor
mAh)
> 3S rechargeable Li-Po battery (11.1 V, 2200
connectivity, sensor integration, and > Native USB-C port
advanced motion control, making it a > Serial-to-USB-C converter
great platform for exploring robotics > Arduino-based open-source software
and embedded systems.

The Elektor Mini-Wheelie is an experimental self-balancing robot a virtual gamepad. The Dabble app is free and available for Android
platform designed for autonomous operation. Powered by an ESP32-S3 and Apple smartphones and tablets. Again, detailed instructions can
microcontroller, this robot is fully programmable using the Arduino be found at [1].
environment and open-source libraries. Its built-in wireless capabilities
enable remote control via Wi-Fi, Bluetooth, or ESP-NOW, as well as With the Dabble app, the Mini-Wheelie can move forward or backward,
communication with users or even other robots. An ultrasonic sensor is and it can turn left and right. However, it is important to understand
included for obstacle detection, while its colour display can showcase that this is not as easy as it sounds, and it requires some practice to
expressive faces — or, for the more practically minded, detailed debug make it move the way you want it to move.
messages.
How Does Self-Balancing Work?
The Elektor Mini-Wheelie comes as a kit of parts that you must assem- Basically, a self-balancing robot works like an inverted pendulum
ble yourself. Everything is included, even a screwdriver. After assem- (e.g., a rocket). To remain upright in an unstable equilibrium, it must
bling the robot, it must be programmed. It comes preloaded with a constantly measure its orientation in the vertical plane and correct
simple program that shows if the motors and display are working, but its attitude accordingly. The Mini-Wheelie is simpler than an inverted
that’s all it does. To make the robot balance, it must be programmed pendulum as it can only fall over forward or backward, not sideways.
with the Arduino sketch SBRobotDabble available at [1]. There, you
will also find detailed instructions on how to do this. When nothing is done, the robot will fall over. However, it has two
motorised wheels that allow to adjust the robot’s centre of gravity. If
The SBRobotDabble program needs a smartphone app called Dabble the robot starts tilting forward, it moves the wheels forward to bring
to work. With this app, the robot can be controlled over Bluetooth using its centre of gravity back over the wheels. If the robot tilts backward,

42 July & August 2025 www.elektormagazine.com


About the Software
The Mini-Wheelie is compatible with an open-source
self-balancing robot project that has been online for several
years now and in multiple incarnations. It can be found in
various places, but where exactly it originated is unclear. For
it moves the wheels backward. By continuously making these small this project, we tracked down the original libraries as much
corrections, the robot remains upright. as possible and then adapted them to the Mini-Wheelie
platform where needed. Therefore, it is highly recommended
To detect tilt, the robot is equipped with an Inertial Measurement Unit to use the libraries available from [1] as some have been
(IMU) that includes an accelerometer and a gyroscope. The acceler- modified by us.
ometer measures linear acceleration and helps detect the tilt angle
relative to gravity. The gyroscope measures angular velocity (how We used the Dabble library for remote control over
fast the robot is tilting) and helps detect rapid changes in orientation. Bluetooth, mainly because we had used it before. It works
fine but has one drawback: it is not compatible with the
The IMU on the Mini-Wheelie is an MPU6050 from InvenSense (TDK), a ESP32 Boards Package version 3 or higher. If, for some
popular IMU in the maker community for which extensive open-source reason, you are obliged to use version 3 or higher, go look for
software libraries are available and which is easily found mounted on another Bluetooth control library. Make sure it is non-block-
a small module. The MPU6050 integrates a so-called Digital Motion ing, as otherwise the Mini-Wheelie will not balance properly.
Processor (DMP) that combines the gyro and accelerometer data into Again, see [1] for more details.
easy-to-use precise tilt data. Called sensor fusion, this greatly simpli-
fies the application program as it doesn’t have to fuse the data itself.

The tilt angle is sent to a PID (Proportional Integral Derivative, see In this state, the robot behaves similarly to a satellite in a geostation-
inset) controller algorithm that continuously determines how much the ary orbit — constantly “falling.” However, unlike a satellite that won’t
speed of the wheels must be adjusted for the robot to stay upright by crash into Earth because the orbit is wider than the planet’s diameter,
calculating the difference (the error) between the desired and actual the robot operates on a large flat surface. To prevent tipping over, it
tilt angle. relies on its motorized wheels and a sophisticated control algorithm
to maintain balance while moving. This is a delicate balance. If the
Moving Forward control algorithm can’t keep up, the robot will fall over; if it anticipates
A robot keeping balance and remaining upright is nice, but not very too much, the robot will stop moving or go the other way.
useful nor interesting. Allowing it to move around is what we want,
which implies some way to control it remotely. For this reason, the This is why the Mini-Wheelie is easier to control on a rough surface
Mini-Wheelie comes equipped with wireless capabilities in the shape of than on a smooth surface. A rough surface presents small obstacles
Wi-Fi and Bluetooth. This permits easy communication with a portable that keep the control algorithm active, but on a smooth surface it
device like a smartphone or tablet. An additional ultrasonic sensor can tends to run out of control. It needs noise and disturbances to work
be mounted to help with obstacle detection and navigation. well (Figure 2).

How do you make a self-balancing robot move forward or backward? Turning is like moving forward or backward, but with one wheel spinning
Easy, just manipulate its tilt angle, much like how you control movement faster than the other. This implies introducing an asymmetric tilt offset,
on a hoverboard or a Segway-style vehicle with your body (Figure 1). which doesn’t make things easier. Therefore, the Mini-Wheelie with its
By intentionally introducing an offset in the calculated tilt angle, the default software does not allow turning and moving at the same time.
robot will attempt to correct this imbalance, causing it to move in the However, turning while moving is possible simply by moving first and
direction of the tilt. then turning while it is still in motion.

Figure 1: The robot will move into its tilting direction. Figure 2: The Mini-Wheelie with its big tyres likes rough surfaces.

July & August 2025 43


This is Not a Toy!
The Mini-Wheelie is designed as an educational development platform
intended for learning, experimentation, and robotics development. It is
not classified as a toy for children, and its features, documentation, and
intended audience reflect this purpose. It is aimed at students, educators,
and developers who wish to explore robotics, programming, and hardware
integration in an educational setting.

+3V3
VIN VSYS+
Q7 Q6
CN2 AO4407 AO4407
VSYS+
D S S D R3 R48 R47 R66
R20 R40

10k

10k

10k
NC
C22
100k

0Ω1
Charger in G G
1 8
100n VMOTOR IN+ U11 A1
2 7
IN– INA219 A0
3 6
C28 C6 R22 C62 C63 GND SDA
4 5
VS SCL
1k

4µ7 100n 10µ 100n +3V3


25V 50V R4
CN1 C30 C7
POWER

1k
10µ 100n

Battery in

+3V3

+3V3

C46 C37 C38

R23 R63
LED1 10µ 100n 10µ
1 40
10k

10k

GND GND
2 39 IO1/LCD_RST IO4/SCL
YELLOW 3V3 IO1
3 38 IO2/CMD IO5/SDA
EN IO2
R53 RESET IO4/SCL 4 37 TXD0/IO43 IO18/AIN2
C26 C36 IO4 TXD0
470Ω

IO5/SDA 5 36 RXD0/IO44
IO5 RXD0
IO6/INT 6 35 IO42/SCLK
100n 100n IO6 IO42
IO7/AIN1 7 U6 34 IO41/D0
IO7 IO41
IO15/HNSS0 8 ESP32-S3-WROOM-1 33 IO40/IRQ +3V3
IO15 IO40
IO16/CA1 9 32 IO39/SDA
IO16 IO39
+5V IO17/CA2 10 31 IO38/SCL
USB-NATIVE IO17 IO38
IO18/AIN2 11 30 R75 R18
1 IO18 IO37
GND IO8/ECHO 12 29

10k

10k
2 IO8 IO36 NC
VBUS 13 28
3 IO19 IO35
CC1 5k1 14 27
IO10

IO12
IO13
IO14
IO11
IO46

IO21
IO47
IO48

IO20 IO0
IO9

4
SBU2 R74 R64 IO3 IO45
5
D– 33Ω
15
16
17
18
19
20
21
IO14/HSCLK 22
IO21/LCD_RS 23
24
25
26

6
D+ 33Ω
USB-C 7
IO12/HMISO
IO13/HMOSI

IO45/PWMB
IO46/PWMA

D+ R65 R76 BOOT


IO10/BIN1
IO11/BIN2

IO47/CB2
IO3/TRIG

8
IO9/CB1

IO48/BL

D– C4 C20
10k

9
CC2 5k1
10 10µ 10µ
SBU1 R73
11
VBUS
12
GND Q2 Q5
Shield
+3V3

VBUS S8050 S8050


USB-TTL P6
1 R30 R29 1
GND
5k1

5k1

2 IO12/HMISO 2
VBUS
3 3
CC1 5k1 C42 C15 C41 C44 C45
4 IO48/BL 4
SBU2 R46
5 +3V3 IO15/HNSS0 5
D– 10µ 100n 10µ 100n 10µ
6 IO38/SCL 6
D+
USB-C 7 1 10 IO14/HSCLK 7
D+ UD+ U8 V3 R80
8 2 CH340K 9 TXD0/IO43 IO39/SDA 8
D– UD– RXD 0Ω
9 3 8 RXD0/IO44 IO21/LCD_RS 9
CC2 5k1 GND TXD 0Ω
10 4 7 IO1/LCD_RST 10
SBU1 R72 DTR# VCC R79
11 5 6 IO13/HMOSI 11
VBUS CTS# RTS#
12 IO40/IRQ 12
GND
Shield
C39 C40 LCD

100n 100n

240134-006

Figure 3: Schematic of the main board. The MPU6050 IMU module plugs onto J5.

44 July & August 2025 www.elektormagazine.com


VMOTOR V5D0

C17 C8 C9 C27 C24

10µ 10µ 100n 100n 10µ


VMOTOR

J1
IO45/PWMB 1
VMA+
2
3 6 12 18 D3 D7 D9 D11 GND
3
NC VS VSS NC SA1
IO46/PWMA 8 14 4
ENABLEA ENABLEB SS34 SS34 SS34 SS34 SA2
5
+3V3 3V3
IO7/AIN1 7 4 6
INPUT1 OUT1 VMA–
IO18/AIN2 9
INPUT2 U2 OUT2
5
IO10/BIN1 13 L298P 16
INPUT3 OUT3 J4
IO11/BIN2 15 17 1
INPUT4 OUT4 VMB+
2
GND
2 19 3
SENSEA SENSEB SB1
R6 R2 4
GND GND GND GND D6 D8 D10 D12 SB2
5
0Ω1

0Ω1
1 10 11 20 +3V3 3V3
6
SS34 SS34 SS34 SS34 VMB–

IO16/CA1
IO17/CA2 +3V3
IO9/CB1
Ultrasonic
IO47/CB2 Transducer
J6
4
+3V3
IO3/TRIG 3 C1 C2
TRIG
IO8/ECHO 2
ECHO
1 10µ 100n
+3V3 GND

R33 R71 R31 R32 R67 R70


10k

10k

10k

10k

10k
NC

1
DATA2
2
CS
IO2/CMD 3
DI
4
VDD C25
IO42/SCLK 5
SCLK SD
6 10µ
VSS
IO41/D0 7
DO
8
DATA1
D1 1 3 4 5 6 9
CDN
G1...4
+3V3

IMU (MPU6050)
J5
2 SMF05C
1
2
IO4/SCL 3
IO5/SDA 4 C10 C16
5
6 10µ 100n

7
IO6/INT 8

VSYS+ V5D0 VBUS +5V +3V3


C12

D4 D5
AMS1117/3V3
100n
1
BS L1 SS34 SS34 U4
5 6
IN LX
R1 10µH R26 3 2
U3 D2 C13
100k
10k

SY8201ABC
1
C3 C11 NC 22p C14 C19 C23 C29 C21 C5
4 3
EN FB
GND R28
4µ7 100n 10µ 100n 10µ 100n 10µ 10µ
25V 25V 2 16V
13k7

July & August 2025 45


What is a PID Controller?
A Proportional-Integral-Derivative controller, better known as PID
controller, is a mechanism used to maintain a desired setpoint of a
system by continuously adjusting the output based on three terms:

Note that the Mini-Wheelie software assumes that the upright (vertical) 1. Proportional (P): Responds to the current error, i.e. the difference
position is at 180° (originalSetpoint, line 160). Chances are that this between setpoint and process variable.
is slightly optimistic in reality due to mechanical tolerances. There- 2. Integral (I): Accounts for the accumulation of past errors to elimi-
fore, it is worth experimenting with this value to adapt it to your robot. nate steady-state offset.
3. Derivative (D): Predicts future error based on its rate of change,
Furthermore, there may also be some play in the motor shafts, which improving stability and response speed.
can introduce a slight jolt when the direction of rotation is reversed.
To make this abstract definition a bit more tangible, think of
Also, always bear in mind that humans tend to think they know better controlling the speed of a car. In this scenario the setpoint is the
and are cleverer than the system. Trying to be too clever or interfering desired speed, e.g. 100 km/h, while the process variable is the
too much with control algorithms often leads to sub-optimal results. measured speed as indicated by the speedometer of the car.
Suppose our objective is to keep the speed constant. There are
Features several ways to achieve this:
Besides a powerful IMU, the Mini-Wheelie has a few other features that
can be used to improve balancing and remote control. The complete 1. Adjust the pression of your foot on the accelerator pedal to keep
schematic of the main board is shown in Figure 3. The main board the value shown on the speedometer constant. In this case,
itself is shown in Figure 4. the speed v is directly related to the force F on the accelera-
tor. This is proportional control (P). The car responds quickly,
Hall-Effect Sensors but it is not so easy to maintain a super constant speed:
The two wheels are both equipped with two Hall-effect sensors that
allow detecting the spinning direction and speed of each wheel individ- v = k∙Faccelerator = P
ually. In the software, these inputs are labelled CA1 / CA2, and CB1 /
CB2. The sketch SBRobot_Motor_Compare uses them to calibrate the 2. Measure the distance travelled during a defined period, say
two motors. Refer to this sketch to see how to integrate these sensors five minutes. When the travelled distance per time period is
into your own program. They can provide information about the direc- constant, the average speed per time period is constant too.
tion the robot is moving in and if it is going straight or not. You can Note the word ‘average’. Distance d is the integral (I) of speed:
also use them to control or limit the speed.
d = v∙dt = I
Power Monitor
A power monitor lets you keep an eye on the state of the battery. A 3. To keep the speed of the car constant, it should not accelerate
fully charged battery behaves somewhat differently than a (partly) or decelerate. The acceleration must be zero. So, if you measure
discharged battery. This has an incidence on how efficient the motors the acceleration and try to keep it zero, the speed of the car
respond to changes in their control signals. The self-balancing algorithm will be constant. Acceleration a is the derivative (D) of speed:
and the PID controller can be made more performant by taking the
battery level and current consumption into account. The SBRobot- a = dv/dt = D
Dabble sketch shows how to read the power monitor (compile the
sketch with __VERBOSE__ enabled to activate its output on the serial By combining these three methods, the speed of the car can be
port, see around line 54). controlled very precisely and remain perfectly constant:

PID = kp∙P + ki∙I + kd∙D

Here, PID is the signal that controls the accelerator of the car (e.g.,
the force you apply to the pedal). The hard part is finding the values
of the constants kp, ki and kd. Algorithms exist to do this in a more
or less theoretically-controlled way, but they can also be obtained
by experimenting when the system is non-critical and inexpensive,
like a small self-balancing robot. For the cooling system of a nuclear
power plant, you would probably first try with an algorithm. An
interesting tool to optimize PID parameters in (Arduino) code can
be found in this article [2].

Note that you don’t always need all three values to control a system.
P and PI controllers are common too, PD a bit less. ID controllers,
Figure 4: The ESP32-S3-based main board of the Mini-Wheelie is also an i.e., without P, do exist but are only used in rare cases.
excellent platform for other projects unrelated to robotics.

46 July & August 2025 www.elektormagazine.com


the robot will fall over. This is also true for remote control and SD-card
operations. This is why, in the SBRobotDabble sketch, the Dabble library
was modified to allow calling it repeatedly (Dabble.processInput_
tick) instead of using its blocking default message handler. A good
solution to this issue would be to use a multitasking operating system
where one task handles the self-balancing algorithm, and the other(s)
take care of the display and similar time-consuming tasks (like a
webserver).
Figure 5: The Mini-Wheelie can be equipped
with an ultrasonic transducer for obstacle USB-C
detection.
You probably noticed that the Mini-Wheelie is equipped with two USB-C
ports. The one labelled USB-NATIVE is connected to the ESP32-S3’s
built-in USB controller. This is a so-called “future expansion” and hasn’t
been used yet. For programming the microcontroller and debugging
Obstacle Detection over the serial port, use the port labelled USB-TTL.
To enable obstacle detection, an ultrasonic transducer can be connected
to J6 (Figure 5). This is a common HC-SR04-type transducer used in Experimentation and Learning
numerous projects found online. This sensor is supported by many The Elektor Mini-Wheelie is a hands-on self-balancing robot designed
Arduino libraries. A simple suitable library is e.g. Bifrost library for for experimentation and learning. With features like Hall-effect sensors,
HC-SR04. In the SBRobotDabble sketch, the transducer is connected power monitoring, and ultrasonic obstacle detection, it offers opportu-
to pins ULTRASONIC_TRIG and ULTRASONIC_ECHO. After installing this nities to explore advanced control techniques and sensor integration.
library, using the transducer is as simple as adding: Beyond just balancing, the Mini-Wheelie challenges you to refine its
movement, optimize its PID controller, and experiment with multi-
#include <hcsr04.h> tasking, making it an excellent introduction to embedded systems
HCSR04 hcsr04(ULTRASONIC_TRIG, ULTRASONIC_ECHO, range_ and real-world robotics applications. Enjoy!
min, range_max); 240134-01

Here, range_min and range_max define the detection range in millime-


tres. In the main program, call the function below to obtain a reading: Questions or Comments?
Do you have technical questions or comments about his article?
int distance = hcsr04.distanceInMillimeters(); Email the author at [email protected] or contact Elektor
at [email protected].
Advanced Features
Strictly speaking, the Mini-Wheelie doesn’t need a full-colour graphical
display, but it has one anyway. It can be used to implement a face-like About the Author
interface or so. It can be practical however, for displaying debug infor- Clemens Valens started working for Elektor in 2008, and he has
mation while driving around and trying to improve self-balancing or held various positions since. Currently, he is part of the product
obstacle detection. development team. His main interests in electronics are (digital)
signal processing and its applications in music production and
A microSD card slot is available for logging data and for storing images sound synthesis.
and robot parameters. The SBRobotDabble sketch contains functions
to read JPEG images from the SD card and to display them. Also
functions for writing simple text and floating-point values are included.
Related Product
Multitasking
It is important to keep in mind that sending large amounts of data to the > Elektor Mini-Wheelie Self-Balancing Robot
display slows down the control loop, and even more so if it consists of www.elektor.com/21087
JPEG encoded images. When the control loop is interrupted for too long,

WEB LINKS
[1] This project on Elektor Labs: https://www.elektormagazine.com/labs/self-balancing-robot-with-maker-fabs
[2] Johannes Sturz, “PID Control Tool,” Elektor 5-6/2025: http://www.elektormagazine.com/240274-01

July & August 2025 47


PECULIAR

THE SERIES

Solar Cells
By David Ashton (Australia)

Solar cells have, over time, become an entirely


commonplace component in a myriad of different
Figure 1: The small PV cell that powers the rooftop sensors of
sizes and applications, becoming part of our daily a weather station. (Courtesy of: Bresser GmbH, Germany —
lives. Let’s look at them in a brief overview. bresser.de)

I have always found something magical about the idea of panels, as much as 40 to 50% for more expensive types.
solar cells being able to generate sometimes large quanti- When you consider that solar radiation is up to 1000 W
ties of electricity just using sunlight. For this, they depend per square meter, that’s a lot of power available.
on the photovoltaic effect. This was first noted by Edmond
Becquerel, who, in 1839, demonstrated the production of Solar cells may be monocrystalline or polycrystalline.
an electric current when two plates of gold or platinum Monocrystalline cells are made from a large bar of crystal-
in a solution were unevenly exposed to sunlight. line silicon cut into thin wafers, and are usually black,
whereas polycrystalline cells are made from fragments
In 1884, Charles Frits produced an experimental solar of silicon melted together, and are usually a blue color.
cell using a thin layer of selenium covered with a thin Monocrystalline cells are thought to be better and more
film of gold, but the efficiency was poor. efficient than polycrystalline cells, but the differences
are small and the quality of manufacturing probably has
Modern solar cells are based on semiconductor P-N more effect than the type used.
junctions, much like LEDs. In fact, an LED will generate
a voltage when exposed to light — I just got 1.46 V out Perovskite solar cells are another type of solar cell.
of a clear red LED with a powerful torch next to it. The Perovskites are a class of crystalline materials having
current would be very low, though. The polarity is the the same structure as calcium titanate, but include a host
opposite of what you’d normally use to illuminate an LED. of organic and inorganic compounds. Perovskite solar
cells are cheaper to produce, easier to make flexible,
General Features and exhibit better performance under low light condi-
Solar cells come in a wide variety of sizes, from a thumb- tions such as cloudy days. Some perovskites use lead
nail-sized cell in an ornamental solar garden light, up compounds, which has led to resistance to their use.
to the solar panels on my roof, which generate 440 W They have good efficiency, but some perovskites exhibit
each in full sunlight and are nearly 2 square meters in chemical instability, especially in the presence of moisture.
size. Ever larger wattages are available as the technology This has resulted in relatively limited acceptance, but
gets better, and efficiencies are up to 25% for average research is overcoming these problems.

48 July & August 2025 www.elektormagazine.com


Figure 2: A rooftop
photo-voltaic high-power
installation. (Source:
Wikimedia Commons
— https://commons.
wikimedia.org/wiki/
File:Photovoltaikanlage.
jpg)

Recent Applications
With the advent of very-low-power microcontrollers with About the Author
wireless features, small solar cells are seeing wide use in David Ashton was born in London, grew up in
remote environmental sensors, for example the outdoor Rhodesia (now Zimbabwe), lived and worked in
sensor units for weather stations (Figure 1). Teamed with Zimbabwe, and now lives in Australia. He has
lithium batteries, they can power many remote sensors been interested in electronics since he was “knee-high
for IoT and other applications. Solar garden lights and to a grasshopper.” Rhodesia was not the center of the
ornaments are now ubiquitous, and discarded ones electronics universe, so adapting, substituting, and
are a good source of small solar cells for the inquisitive scrounging components were skills he acquired early
hobbyist. (and still prides himself on). He has run an electronics
lab, but has worked mainly in telecommunications.
Larger solar installations, such as on house roofs or in
solar farms, are helping to speed the demise of fossil-fuel-
based power generation. Australia has one of the highest Questions or Comments?
rates of domestic solar power in the world, and large If you have technical questions or comments about
solar plants are being constructed everywhere. Battery this article, feel free to contact the Elektor editorial
storage to store some of the power and supply it at night team at [email protected].
is advancing rapidly and contributing to the uptake of
solar power. Figure 2 shows a large rooftop solar power
installation.
250146-01

July & August 2025 49


HANDS-ON

Getting Started With a


Modern Radar Sensor
Is an Accurate Measurement on Your Radar?

By Jean-François Simon (Elektor)

Let’s get started with the A121 radar


sensor from Acconeer, a very powerful
but not so easy-to-master sensor.
Besides some background information,
we provide a lot of tips for putting it
to use!

Sensors are fascinating. Some time ago, while I was doing research to
build a mailbox mail indicator [1], I came across an interesting video
by Andreas Spiess [2] that, among other things, mentioned a very
powerful radar sensor, the A121 from the Swedish company Acconeer,
costing about €12. This strongly intrigued me and made me want to
give it a try! The manufacturer’s official development kit, the XE125, is Figure 1: The A121 is tiny, less than 6 mm square. The two 60 GHz
quite expensive (around €120), but fortunately, SparkFun also offers a antennas are visible.
development board based on the same sensor for $50. This is better,
and the price helps support a company that does a great job, with
their modules and documentation, of making electronics accessible to t elapsed between transmission and reception of the reflected signal
engineers of all levels. The fact that SparkFun and Elektor are business gives the measured distance d by the equation d = 1/2 * t * v, where v
partners did not influence my choice, and I am glad to have paid for is the propagation speed of the wave, which depends on the material.
this module with my own money. That said, let’s dive in! The A121 (Figure 1) is a Pulsed Coherent Radar, coherent meaning
that it is able to measure the phase of the received signal for even
Radar 101 more precise measurement.
While the general principle of a radar is to emit a radio signal toward
a target and analyze the reflected signal, there are different types. Hardware Overview
In continuous wave (CW) radar, like the HB100 previously featured The A121 [4] uses the 60 GHz band and offers a lot of features within a
in Elektor [3] or the similar CDM324, a constant frequency signal is very small form factor (5.2 x 5.5 x 0.8 mm). It is fully integrated, with the
transmitted and received simultaneously, allowing measurement of the baseband processor, RF front-end, and antenna in the same package,
target’s velocity through Doppler shift, but not its distance. Frequen- and a digital output via SPI. Internally, the A121 measures time differ-
cy-modulated continuous wave (FMCW) radar improves on this by ences with a resolution on the order of a picosecond, which provides
continuously varying the transmitted signal’s frequency over time. excellent distance resolution, on the order of 0.1 mm (!). The maximum
As the wave takes time to travel to and from the target, at any given range is about 20 m. This is a very complex component; explaining
instant the received signal is a different frequency than the transmit- it in detail would both be very hard, and go far beyond the scope of
ted signal. By measuring the difference between those frequencies, this article, but the manufacturer’s documentation (see [5] and [6]) is
the distance to the object can be computed. very good and abundant.

In contrast, Pulsed Radar transmit short bursts of signal at a single Acconeer suggests applications like distance measurement, proxim-
frequency and listens for echoes between pulses. Measuring the time ity or presence detection, measuring velocity, tracking objects, robot

50 July & August 2025 www.elektormagazine.com


navigation, etc. Thanks to its high resolution in distance mode, the A121
can also monitor vital life signs such as breathing and pulse rate. As the
sensor outputs phase and amplitude of the received signal, it’s possible
(by processing the data on a microcontroller connected to it) to detect
and classify different materials, and recognize basic gestures. As other Figure 3: A PCB by SparkFun provides USB and everything needed.
radar sensors, it’s immune to dust, variations of ambient light, etc.

All this is excellent, but on its own, this component is not very easy to A SparkFun Breakout Board
discover and experiment with, for two reasons: first, this tiny package Integrating a microcontroller into the module was a smart choice. This
is a 50-ball BGA, which is not so easy to solder. Second, using the way, Acconeer can offer downloadable firmware files that are already
advanced features requires a lot of data processing through software, compiled and ready to be flashed onto the STM32L431, making it much
which represents a significant amount of work for anyone just consid- easier to try out the sensor. SparkFun [8] makes things even more
ering trying out the component. To address this, Acconeer has a great convenient, with a PCB that includes the XM125, a CH340C USB-to-
solution. UART converter, a USB-C port, and the necessary voltage regulators,
as can be seen on Figure 3. Two Qwiic connectors allow the module
The XM125 Module to be linked via I2C to other SparkFun boards.
The Acconeer XM125 module [7] (Figure 2) makes it much easier
to explore the product. It is a small rectangular PCB measuring This breakout board is simply intended to make connections easier;
18.6 mm x 15 mm, containing: the A121 sensor, a 24-MHz crystal it does not include an additional microcontroller. SparkFun suggests
required for its operation, a few resistors and capacitors, and finally to use the provided binaries as-is for the STM32L431, and to develop
an STM32L431CBY6 microcontroller from STMicroelectronics. All your own application on an external microcontroller, for example an
components are mounted on the top side, allowing the module to be ESP32 on an extra board, communicating with the XM125 via I2C. For
soldered flat onto a Land Grid Array (LGA) footprint on your proto- more advanced users, or those familiar with STM32 products, it is also
type PCB, using hot air or a soldering iron. Of the 28 pins with a possible to do without an external microcontroller and to fully develop
1.27-mm pitch (more accessible than BGA for us mortals), only a few your project on the provided STM32L431.
are absolutely necessary; it would even be possible to solder wires
directly for prototyping without a PCB. Software
Acconeer offers many options in terms of software. For the XM125,
The module is compact enough to be directly integrated into commer- a Software Development Kit (SDK) is provided [6] and contains
cial products. It may function as a stand-alone unit, allowing customers source code and compiled files, directly transferable to the onboard
to build their applications on top of the Acconeer software. Alternatively, STM32L431, for many example applications (distance measurement,
it can be paired with an external microcontroller, communicating with speed, presence detection, etc.). For those planning to use the A121
the module using a register command protocol via a serial port or I2C. sensor in a fully custom project without the XM125 module, other SDKs
are also available in different variants (Keil, ARM-GCC, IAR, etc.) for
ARM Cortex M7, M4, M33, M0 platforms. A dedicated PDF guide is
available for each case.

Special mention goes to the Exploration Tool published by Acconeer,


this time on GitHub [9]. Fully programmed in Python, it provides a
useful graphical interface on PC (Windows or Linux) to evaluate the
A121, modify its parameters, and stream live measurements to the PC.
Let’s take a closer look.

The Acconeer Exploration Tool


For those who have never installed the Python interpreter on their
PC, now is the time to do so. The Exploration Tool is installed using
the pip package manager. However, some Linux distributions (like
Mint, which I recently tried) strongly advise against using pip on the
system’s Python interpreter, as there’s apparently a risk of messing
with packages used by the system itself. In these cases, it is recom-
mended to run pip inside a virtual environment. It may also be worth
doing the same on Windows to keep control over the packages you
install or uninstall for each project. I used PyCharm, which works well
Figure 2: The XM125 modules makes development easier. on both Windows and Linux.

July & August 2025 51


Figure 4:
Main window of the
Exploration Tool at
startup.

In the terminal (of PyCharm or your system), install the Exploration Tool it is possible to directly download the latest firmware version under the
with the command python -m pip install --upgrade acconeer- Get Latest Binary tab. As of the time of writing, a bug seems to exist:
exptool[app] and, once all packages are installed, launch the GUI the firmware acconeer_xc120_exploration_server_a121-v1_10_0.bin
interface with the command python -m acconeer.exptool.app. downloaded via the Exploration Tool does not work properly. Although
The Exploration Tool also supports the predecessor of the A121, the flashing seems normal, trying to connect to the module afterward
A111. Click the left panel to open the A121 version. The main window results in a connection failure (Figure 6). Among other minor issues,
that opens is shown in Figure 4. the link provided by the Exploration Tool to create a Developer account
returns a 404 error. Use [10] instead.
Firmware Download
Just as each specific situation (distance, speed, presence measure- To work around the firmware bug, select the Browse tab and manually
ment, etc.) has its own optimized firmware available in binary format, select the firmware file from the ZIP you downloaded earlier. Choose
the Exploration Tool also needs a specific firmware, called the Explo- Serial, then the correct serial port (on Windows, you can check the port
ration Server. To start, create an account at [10]. Then download the number in the Device Manager when plugging in the module), then
Exploration Server firmware at [6] and unzip the ZIP file. XM125. Finally, click Flash and follow the on-screen instructions: press
the Boot button, then the Reset button while keeping Boot pressed,
The Exploration Tool contains four distinct sections: Stream, Flash, release Reset, and then release Boot. I recommend not doing this
Resource Calculator (RC), and Help. These are accessible through sequence too quickly; leave at least a third to half a second between
buttons on the left. First, open the Flash page (Figure 5). In principle, each press. Flashing should complete normally.

First Tests
Now, click on the Advanced Settings button (to the left of Connect in
the top bar) and type 115200 in the Baudrate field. Close Advanced
Settings and click Connect. Congratulations, your module is connected!

Figure 5: Preparing to flash firmware. Figure 6: I pulled my hair out over this error for quite a while.

52 July & August 2025 www.elektormagazine.com


You can now try out the functionalities of the Exploration Tool. The Figure 8: A CP2102-based module with the additional RTS and CTS
different functions are listed on the left panel: Sparse IQ, Distance pins (required).
Detector, Presence Detector, Speed Detector, etc. For each application,
three display areas are used (Figure 7): Preset Configurations at the
bottom of the left panel (label 1 in the figure), detailed settings on the even though it has RTS and CTS pins (required by the XM125).
right panel (2), and measurement results in the center (3). Each appli- The CH340C datasheet version 1D is vague about this: “The USB to serial
cation must be started with the Start measurement button. Feel free interface is only compatible with the application layer, not totally”. Later,
to explore the various demo applications. The Sparse IQ page displays the version 3B of the same document [11] says: “For one-directional
the raw data output from the sensor, in the form of the amplitude and 1 Mbps and above, or bi-directional 500 kbps and above, we recom-
phase of the received signals, represented as complex numbers. It may mended to use CH343, and enable automatic hardware flow control.”
be a bit difficult to interpret these values by eye. Although it is listed
first, it is not the most fun. Presence Detector and Touchless Button What a pity! Here, the XM125 and Exploration Tool need Hardware Flow
are easier to understand. Control to optimize data throughput. On the XE125 (official Acconeer
dev kit), a Silicon Labs CP2105 is used instead. Maybe SparkFun will
Make It Faster! release a Revision 2? For now, SparkFun’s Hookup Guide [12] notes:
After a few tests, I realized that the graph display was not very smooth: “Note: The Acconeer Exploration Tool may run slower than expected
data arrives in bursts. While some applications like Touchless Button when using the SparkFun XM125 Pulsed Coherent Radar Sensor.”
work fairly well, there are five-second pauses between data bursts and Acconeer’s Exploration Tool FAQ also confirms this.
refreshing of the curves in Sparse IQ, Presence Detector, and others.
It’s a bit frustrating considering the sensor’s speed and all the effort I didn’t have a CP2105-based module on hand to try; the CP2105
Acconeer put into creating a great software tool. Friend from Adafruit [13] would be ideal but was out of stock when
writing. However, the CP2102 and CP2104 are quite similar and worth
It turns out neither Acconeer nor the sensor is to blame. It’s an unfor- trying. They are used in many products – I had several gadgets on
tunate coincidence that SparkFun hasn’t corrected yet. The CH340C hand using them – but RTS and CTS pins are not always accessible.
from WCH, a very popular USB-to-UART converter used in several Digging through my inventory, I found a USB-serial adapter with a
SparkFun boards, was used here again, which is logical for Spark- CP2102 where the necessary pins are exposed (Figure 8). When buying,
Fun. Unfortunately, it does not fully support Hardware Flow Control, check the available pins carefully in the photos or documentation.

Figure 7: Three main sections in the Exploration Tool.

July & August 2025 53


near the pin or carefully lifting the pin and removing solder. I added a
jumper to make this reversible. Two extra wires (+5 V and GND) were
also routed to the pin header to eliminate the original USB-C cable.

To use the CP210x instead of the CH340, simply change the COM port
number in the Exploration Tool. In my case, the CP2102 worked properly,
Figure 9: Modifying the wiring to support other USB to UART converters. and the graphs now refresh continuously, between 2 and 20 times per
second depending on the application. Much better! Another module
based on the FT232RL by FTDI worked as well, but was slightly slower.
As you’re not supposed to use a different USB to UART converter, there
is no easy access to the primary TX, RX, CTS, and RTS signals; those A Solution Looking for a Problem
are directly routed from the XM125 to the CH340C. The DEBUG_TX The Presence Detector illustrates how the radar’s sensitivity to
and DEBUG_RX pins on the side of the module are connected to the micro-movements gives an advantage over other types of sensors.
second serial port of the XM125, which is used for debugging only. I tried sitting perfectly still a few meters away from the sensor: no
This required some adaptation (Figure 9). matter what, my tiny involuntary movements were detected by the
A121, and the Exploration Tool clearly indicated I was always present,
A small piece of perfboard was added to the sensor’s back side, and which is reassuring in case of an existential crisis. On the other hand,
a pin header was wired to the corresponding pins of the CH340 using the Passive Infrared (PIR) sensor placed at the same distance ignored
thin wire. If you attempt this, pins TX, RX, CTS, and RTS are pins 2, me after a few seconds if I stayed still. More interesting applications
3, 9, and 14 on the CH340C, respectively. You can also solder directly include remote vibration measurement of machines, or non-inva-
onto the XM125 pads on the front side. To disable the CH340C, its sively monitoring people’s breathing. I tried that (see Figure 10), but
VCC pin (pin 16) must be disconnected, either by cutting the trace there seems to be something wrong: During the test, I was calm and

Figure 10: Example of


breathing detection.
However, the breathing
rate value in bpm does
not fit to the curve.

54 July & August 2025 www.elektormagazine.com


breathing much more slowly than what is shown. Moreover, the indica- Questions or Comments?
tion in bpm (breaths per minute) does not match the curve either. I will Do you have questions or comments about this article? Email the
investigate and keep you informed in our Err-lectronics section if I find author at [email protected], or contact Elektor at
the bug. Personally, I haven’t yet found a direct use for the sensor at [email protected].
home, but studying it in detail is still a very satisfactory process. Feel
free to email me your ideas or suggestions!

Going Further
It is recommended to tinker with the various settings of the Explo-
ration Tool for yourself! Also have a look at the Resource Calculator
panel, which provides estimates (not measurements) of the module’s
power consumption based on the settings. Also check out SparkFun’s About the Author
Hookup Guide, which offers an Arduino library [14] that you can use Jean-Francois Simon (Engineer, Elektor) has a longstanding passion
on an external microcontroller of your choice, to help you communi- for electronics and enjoys topics as varied as circuit design, test and
cate with the XM125 in Presence and Distance modes, through I2C. I measurement, prototyping, playing with SDRs, and more. He likes
encourage reading Acconeer’s documentation for a detailed under- to create, modify and improve his tools and other systems. He has
standing, and for the brave, taking a look at the source files. To develop an engineering background and also enjoys mechanics, machin-
your own application, you can also install STM32CubeIDE and build ing, and all things technical. Follow him on X at x.com/JFS_Elektor.
upon the Acconeer SDK with the STM32L431.

Do I recommend the SparkFun XM125 module? Hard to say. On paper,


it’s great to have the same kind of functionality as the official Acconeer
Related Products
kit, at 40% of the price. If you mainly use the XM125 in Presence or
Distance mode and, like SparkFun, mainly use the XM125 through its > YDLIDAR X4Pro Lidar – 360-degree Laser Range Scanner
I2C interface, then the CH340C’s slowness doesn’t really matter. For www.elektor.com/20546
those who want a smoother experience with the Exploration Tool and
save some money, buying the XM125 alone, a separate USB-UART
> Universal Maker Sensor Kit
www.elektor.com/21094
converter, and making a simple adapter PCB would be a better option.
Have fun!
250167-01

WEB LINKS
[1] Jean-Francois Simon, “Wireless Mailbox Notifier,” Elektor 7-8/2025: http://www.elektormagazine.com/240715-01
[2] Andreas Spiess, “Which Radar Sensor Is Best?,” YouTube: https://www.youtube.com/watch?v=s-GzUTyIH9c
[3] Stefano Lovati, “The HB100 Doppler Motion Sensor”, Elektor 7-8/2023 : http://www.elektormagazine.com/230205-01
[4] The A121 Radar Sensor: https://www.acconeer.com/products/
[5] Acconeer Documentation (1/2): https://docs.acconeer.com/en/latest/index.html
[6] Acconeer Documentation (2/2) and SDK: https://developer.acconeer.com/home/a121-docs-software/xm125-xe125/
[7] XM125 Datasheet: https://developer.acconeer.com/download/xm125-datasheet/
[8] SparkFun XM125 Board: https://www.sparkfun.com/products/24540
[9] Acconeer Exploration Tool: https://github.com/acconeer/acconeer-python-exploration
[10] Create Developer Account: https://developer.acconeer.com/register/
[11] CH340C Datasheet, Version 3B: https://tinyurl.com/2a6nawzt
[12] SparkFun XM125 Hookup Guide: https://docs.sparkfun.com/SparkFun_Qwiic_Pulsed_Radar_Sensor_XM125
[13] Adafruit CP2105 Friend: https://www.adafruit.com/product/6065
[14] SparkFun XM125 Arduino Library, GitHub: https://github.com/sparkfun/SparkFun_Qwiic_XM125_Arduino_Library

July & August 2025 55


developer’s zone
Tips & Tricks, Best Practices and
Other Useful Information

Source: Adobe Stock / mimadeo - generated with AI


From Life’s
Experience Pluripotency), organic semiconductors
(the Schön scandal [1]), superconductiv-
ity at room temperature, and Theranos’
blood tests — to public rejection — such
Paper Factory as the protests by Greenpeace and others
against genetically modified “golden rice”
[2], which produces beta-carotene, a precur-
sor to vitamin A, and could save the lives of
By Ilse Joostens (Belgium) more than a million children a year in the
Third World (Figure 1).
You are probably familiar with the saying “don’t
count your chickens before they hatch.” Despite the Quite a few scientific experiments look
promising in the lab or on a small scale
important life lesson behind it, it seems that our more but turn out to be disappointing in the real
commercially minded fellow human beings do not world. For example, bleach works very well
have much affinity with this saying. The same goes for in vitro against most pathogens, but that
does not mean that you can simply treat sick
politicians, of course, but even academic institutions people with an injection of the stuff. Take
and scientists are guilty of this all too often. graphene, discovered in 2004 [3]. On paper,
the possibilities of this material seemed
enormous, and there was much speculation
A few years ago, I came into contact with the Expensive Cells about the most spectacular applications,
founders of a start-up that wanted to market Have you ever noticed that groundbreak-
a revolutionary GPS-tracker to combat ing discoveries and technologies are
bicycle theft. It was a good idea in itself, and announced with clockwork regularity in
not only were the newspapers full of it, but the mainstream media (but also in trade
Flemish television also devoted consider- magazines) and that you usually don’t
able attention to it. However, apart from a hear much more about them afterwards?
clumsily constructed and non-functional It seems as if every time, the solution to
prototype, there was no actual product one of the world’s major problems is a step
available. It will come as no surprise that closer. In electronics, too, new discover-
the story ultimately came to nothing, and ies follow each other in rapid succession.
not only that: a Czech entrepreneur even The reasons why they ultimately come
tried to hijack the idea. So, it’s better to have to nothing are diverse, ranging from
a solid, working product before you start outright fraud — such as cold fusion, STAP Figure 1: Who is afraid of golden rice? (Source:
touting it to the world. cells (Stimulus-Triggered Acquisition of Adobe Stock / Prakakrong — generated with AI)

56 July & August 2025 www.elektormagazine.com


Figure 2: Will the space elevator ever be built? (Source: Adobe Figure 3: Hydrogen from sunlight — it seems too good to be true.
Stock / IbotDesign) (Source: Adobe Stock / NKCoolper — generated with AI)

from replacing silicon in computer proces- in April 2024 was still being talked about Putting the Cart Before the
sors to extremely thin rollable television in superlatives as the company with the Horse
screens and even a real space elevator ambition to become the world’s largest Nowadays, it seems as if people in academia
(Figure 2). Now that the hype has died green battery manufacturer and to build a publish first and think later. The reasons for
down, more realistic commercial applica- dam against Chinese, Korean, and Ameri- publishing as much as possible are diverse,
tions have appeared on the market, includ- can battery dominance. Barely six months such as publication pressure (publish or
ing (bio)sensors and solutions for cooling later, the company’s trajectory resembled perish), employment, attracting students,
chips in smartphones. And how about roads more of an Icarus flight due to produc- subsidies, ego and prestige, creating hype,
covered with solar panels, printed solar tion problems combined with the choice obtaining immigration visas, etc. The list
panels on thin film, tubular solar panels for of “expensive cells” with NMC technology is long, and studies show that a signifi-
flat roofs [4], and solar panels that electro- (nickel-manganese-cobalt), a technology for cant proportion of published papers and
chemically generate hydrogen gas from lithium-ion cells that is considerably more doctoral theses are hardly ever cited or read,
water (Figure 3)? Unfortunately, none of expensive than LFP technology (LiFePO4 let alone applied, making them little more
these ideas came to fruition for technical or lithium iron phosphate). LFP was long than paper factories [9][10].
and/or economic reasons. Currently, Solhyd considered inferior, but China has never-
[5], a spin-off from KU Leuven, is working on theless succeeded in using this technology I am not advocating a Trump-style crack-
solar panels that extract water from the air to produce high-performance and cheaper down on the academic world, and not all
at night and generate hydrogen gas during cells for electric vehicles. research needs to be economically useful,
the day using electrical energy from sunlight but reforms to maintain real, lasting impact
through electrolysis. They have clearly Of course, things could always be worse, do seem sensible to me. No one benefits
learned from the mistakes of their prede- and I’m not going to claim that nuclear from research inflation and the creation of a
cessors, and the technology looks promising, energy is the best alternative to fossil fuels, scientific bubble. Moreover, it does no harm
so let’s keep our fingers crossed that they but closing all nuclear reactors and fully to think critically for oneself and realize that
succeed in commercializing these panels. committing to a hydrogen economy that scientists, researchers, and politicians are,
doesn’t yet exist, as Germany has done, was after all, just ordinary people.
On a larger scale, too, mistakes are a huge mistake in my opinion [7][8]. And Translated by Hans Adams — 250311-01
sometimes made. Take Northvolt [6] in I can see that hydrogen bubble bursting in
Skellefteå, Sweden, for example, which the not too distant future.

WEB LINKS
[1] Wikipedia: Schön scandal: https://en.wikipedia.org/wiki/Sch%C3%B6n_scandal
[2] Wikipedia: Golden rice: https://en.wikipedia.org/wiki/Golden_rice
[3] Mark Peplow, “Coming of age — Twenty years after the ballyhooed discovery of graphene, the atom-thin carbon sheets are
finding their footing,” Science, Oct 2024:
https://www.science.org/content/article/twenty-years-after-its-discovery-graphene-finally-living-hype
[4] Wikipedia: Solyndra: https://en.wikipedia.org/wiki/Solyndra
[5] The Solhyd project — Discover all about hydrogen panels: https://solhyd.eu/en/
[6] Anthony King, “Northvolt bankruptcy dents European battery industry ambitions,” ChemistryWorld, Nov 2024:
https://www.chemistryworld.com/news/northvolt-bankruptcy-dents-european-battery-industry-ambitions/4020603.article
[7] YouTube: Sabine Hossenfelder — Why I’m embarrassed to be German: https://www.youtube.com/watch?v=W1ZZ-Yni8Fg
[8] YouTube: Wise Guys — Deutsche Bahn: https://www.youtube.com/watch?v=wXjhszy2f9w
[9] Wikipedia: Why Most Published Research Findings Are False — John Ioannidis (2005):
https://en.wikipedia.org/wiki/Why_Most_Published_Research_Findings_Are_False
[10] YouTube: Sabine Hossenfelder — I was asked to keep this confidential: https://www.youtube.com/watch?v=shFUDPqVmTg

July & August 2025 57


BACKGROUND

Cybersecurity
Tough Times for Hackers

By Gerhard Stelzer (Würth Elektronik eiSos) The deadline for implementation now runs until August 1, 2025.
After that, no wireless devices may be placed on the EU market
Cybersecurity is shifting into the focus unless they meet the cybersecurity requirements of the RED.
of European regulation. According
EN 18031 Standard Facilitates Implementation
to the EU Radio Equipment Directive, The EN 18031 standard translates the cybersecurity aspects of
by August 2025, products with radio the RED into specific testing procedures and was developed by
technology and internet access the CENELEC standards organization on behalf of the EU. In
October 2024, CENELEC submitted EN 18031 to the European
must protect networks and personal Commission for review. The standard was harmonized in
data as well as prevent fraud. The January 2025, meaning that new products no longer have to be
EN18031 standard is designed to assist certified by an accredited testing service provider (Figure 1). A
self-declaration of conformity is sufficient.
manufacturers in implementation.
Conformity Test, Using a Wi-Fi Module as an
Example
The EU Cyber Resilience Act (CRA) introduces entirely new cyber- The conformity test is illustrated here, taking the example of
security requirements for electronic devices. It was published in Würth Elektronik’s IoT Wi-Fi module Cordelia-I [1]. The Wi-Fi
the Official Journal of the EU in November 2024 and is therefore module is fully compliant with the RED, including the cyberse-
applicable law. However, no standards exist for it yet. A transitional curity extension 2022/30/EU from January 2022. The Cordelia-I
period is therefore expected to apply until December 2027, after module complies with IEEE 802.11 b/g/n, operates in the 2.4 GHz
which new products will have to comply with the CRA. band, and has the following features:

Until then, the Radio Equipment Directive (RED) is intended to > Zero-touch provisioning with QuarkLink [2] (more on this later)
enhance cybersecurity, at least for all wireless devices. To this end, > Secure UART-to-cloud bridge (transparent mode)
the EU amended the RED in 2022, supplementing Article 3(3), to > Small form factor: 19×27.5×4 mm3
define the following three sub-points: > Sleep mode <10 μA
> Intelligent antenna configuration (2-in-1 module)
> 3(3)(d) to ensure network protection > Output power +18 dBm peak (1DSSS)
> 3(3)(e) to safeguard personal data and privacy > Receiver sensitivity: –92 dBm (1 DSSS, 8% PER)
> 3(3)(f) to ensure protection against fraud > Industrial temperature range: -40°C up to +85°C

58 July & August 2025 www.elektormagazine.com Partner Content


According to the RED, cybersecurity for wireless devices such as Design of a Security Concept for an Embedded
radio modules must be ensured in accordance with Article 3(3). Device
For the Cordelia-I radio module, only Article 3(3)(d) — protection When designing a security concept for an embedded device, several
of the network — is relevant, as neither personal data under 3(3)(e) key questions have to be asked and answered: Which asset needs
nor financial data under 3(3)(f) is processed. It follows that Corde- protection? What does the threat look like? Which security objec-
lia-I must be tested in accordance with EN 18031-1:2024. tive do we have? What do we need to achieve it? Figure 2 illustrates
these security requirements for different assets.
The core requirements of EN 18031-1:2024 for a wireless device in
terms of cybersecurity are: The current state of cybersecurity measures in a typical IoT appli-
cation encompasses a range of security elements:
> authentication and authorization
> data protection > A secure “root of trust“ is a unique identity along with a
> software and firmware security cryptographic key associated with it. As the entire security
> network security chain relies on this foundation of trust, it is essential that a
> physical security RoT is unique, unchangeable, and unclonable.
> incident response and management > Secure boot is a security feature that ensures that only
> user awareness and education trusted software is loaded during a device’s boot process. It is
> compliance with regulations and documentation a firmware-based process that verifies the digital signature of
the bootloader and all subsequent operating system compo-
The cybersecurity space is volatile and constantly evolving, for nents before they are loaded into memory. The goal of secure
example, with the CRA coming into effect at the end of 2027. It booting is to prevent the execution of malware and other
is important to conduct a cybersecurity risk analysis at an early malicious software and to compromise the system during the
stage of the design process and to continue this analysis through- boot process.
out the product lifecycle. The implementation of cybersecurity > Firmware over-the-air (FOTA) is a method by which the
involves more than just hardware and software. “Policies” also firmware of an electronic device is updated wirelessly, usually
play an important role — for example, a vulnerability reporting over a secure connection. FOTA updates can be used to fix
system, software updates, ease of installation, maintenance, etc. bugs, add new features, or patch security gaps in the device’s
The goal must be “security by design.” firmware.

Figure 1: Whether a product’s conformity can be assessed in-house depends on the existence of a harmonized standard. Otherwise, certified service
providers (Notified Bodies) come into play. (Source: European Commission — RED Guide [4])

Partner Content July & August 2025 59


Figure 2: Design of a security concept for an embedded device with various assets to be protected. (Source: Würth Elektronik)

> Every interface to the outside world must be considered Secure Cloud Connection
vulnerable and secured accordingly. A range of standard To ensure a secure connection to the cloud, the device and the cloud
protocols can be used for authentication and encryption should perform mutual authentication, followed by exchanging
of communication interfaces. a session key, which is then used to encrypt the communication
> Secure storage areas are isolated execution environ- channel. This is usually done using the TLS protocol.
ments that provide hardware-based security for sensitive
data and code. They are designed to protect against attacks To establish a mutual TLS connection, the following cryptographic
that attempt to access or modify data in memory or steal elements must be present on the device and in the cloud. The assets
cryptographic keys. must also be properly aligned with each other.

These general measures to ensure cybersecurity have been imple- On the device side, these are:
mented in the Cordelia-I Wi-Fi module (Figure 3). The Wi-Fi radio
module includes the following security features: > Device ID: Unique device identity that is unchangeable and
tamper-proof.
> 10-byte non-manipulable unique device ID > Device key: This is a private key that is unique to each device
> Secure boot and must be kept secret.
> Secure storage with an encrypted file system for storing > Device certificate: This certificate contains the public key
certificates and other credentials associated with the device private key.
> Secure firmware over-the-air update > Root CA: This is the root CA (Certificate Authority) of the
> Secure socket — Transport Layer Security protocol TLSv1.2 cloud, which is used to authenticate the cloud endpoint.
> Secure Wi-Fi connection according to WPA3
> Hardware-accelerated crypto engine The process of storing these parameters on the end device is known
as “device provisioning”.

On the cloud side, this entails:

> List of the device IDs: A whitelist of device IDs that are
authorized to establish connections.
> Device certificates: Public keys corresponding to the device
IDs to enable device authentication.

Figure 3: The Cordelia-I Wi-Fi module from Würth Elektronik offers a wide The process of storing these parameters on the cloud endpoint is
range of features to ensure cybersecurity in IoT applications. known as “cloud onboarding.” These cryptographic values must

60 July & August 2025 www.elektormagazine.com Partner Content


be stored securely on both the device and the cloud endpoint.
Disclosure of these values at any stage of the device manufacturing
lifecycle can compromise security. Human interaction with these
cryptographic assets often poses the greatest threat. Therefore, the
steps must be followed to ensure maximum security. About the Author
Gerhard Stelzer studied electrical engineering and informa-
The Cordelia-I module with the QuarkLink platform enables a tion technology at the Technical University of Munich, where he
secure cloud connection through zero-touch device provisioning graduated with a degree in engineering. Afterwards, he worked in
and secure cloud onboarding (Figure 4). In addition, full device the development of high-rate optical communication technology
management — including remote cloud migration — can be carried at Siemens AG. In 1995, he moved into technical journalism at
out throughout the lifecycle of a device [3]. “Elektronik” magazine. Since 2021, he has served as Senior Techni-
250415-01 cal Editor at Würth Elektronik eiSos.

Figure 4: Enrolment to a cloud via zero-touch provisioning is handled by the QuarkLink IoT security platform from Crypto Quantique. Secure data exchange
then takes place directly between the IoT device and the cloud. (Source: Würth Elektronik)

WEB LINKS
[1] Cordelia-I Wi-Fi IoT radio module from Würth Elektronik: https://www.we-online.com/de/components/products/CORDELIA-I
[2] QuarkLink, Crypto Quantique: https://www.cryptoquantique.com/products/quarklink/
[3] Product Guide: Wireless Connectivity & Sensors from Würth Elektronik: https://www.we-online.com/de/components/products/wco
[4] European Commission: Guide to the Radio Equipment Directive 2012/53/EU: https://ec.europa.eu/docsroom/documents/33162

Partner Content July & August 2025 61


FEATURE

Siglent Presents
Next-Gen Multi-Channel
Oscilloscopes
High-Performance Solutions for Modern Power and
Embedded Systems

By Siglent Technologies Germany GmbH

The accelerating transformation across


industries like automotive, renewable
energy, and industrial automation is driven
by the rise of advanced power electronics.
High-efficiency inverters, the switch to
wide-bandgap semiconductors, and tightly
integrated control loops are pushing the
limits of traditional test tools. As systems
become more compact and capable,
engineers must observe and correlate more Figure 1: The SDS5000X HD models offer a large, intuitive touchscreen,
perfect for bench work and interactive debugging.
signals across multiple domains with greater
precision. Legacy oscilloscopes, designed
for simpler tasks, often fall short. Today’s and SDS5000L are designed to meet the evolving demands of
development workflows demand multi- today’s power electronics, embedded systems, and automated
test applications.
channel instruments that offer deep insight,
high signal fidelity, and application-focused Scalable and Flexible Solutions
analysis to meet the growing complexity of The SDS5000X HD models (Figure 1) feature a large, intuitive,
usable touchscreen interface ideal for bench work and interactive
next-generation power and control systems. debugging, while the SDS5000L rack-mount variants (Figure 2) are
optimized for integration into automated test systems, offering full
remote control and space-saving design without a built-in display.
Siglent [1] has introduced the latest addition to its high-performance
12-bit oscilloscope portfolio: the SDS5000X HD and SDS5000L
series. These new oscilloscopes offer up eight channels, a bandwidth
up to 1 GHz, and mark a significant advancement in Siglent’s
multi-channel platform strategy. With high-speed sampling and
deep memory architecture, the instruments are built to deliver
reliable insight into complex signal environments. Combined Figure 2: The SDS5000L rack-mount variants are ideal for automated test
with a comprehensive suite of analysis tools, the SDS5000X HD systems, with full remote control and a space-saving, display-free design.

62 July & August 2025 www.elektormagazine.com Partner Content


Figure 3: The
SDS5000X HD and
SDS5000L series deliver
the performance needed
to tackle demanding
measurement
challenges.

These offerings give engineers the flexibility to choose the right preventing issues such as data transmission errors in communica-
tool for their workflow, whether it’s in a hands-on R&D lab or a tion systems. As circuit complexity grows, so do the challenges of
fully automated validation setup. The goal is to provide powerful, power-up testing. The SDS5000X HD addresses this by capturing
scalable solutions that grow with the complexity of modern test the entire power-up process of all relevant signals in a single acqui-
environments. sition. This significantly reduces measurement time, improving
efficiency, and minimizing errors associated with repeated tests.
Advanced Performance for High Requirements For complex designs featuring up to eight power rails, this one-shot
The SDS5000X HD and SDS5000L series deliver the performance measurement capability is a powerful tool for reliable validation.
needed to tackle demanding measurement challenges (Figure 3).
With sampling rates of up to 5 GSamples/s, engineers can capture Accurate Measurements for SiC and GaN Power
fast signal transitions with high precision. Each channel supports Electronics
up to 500 Megapoints of memory (with all channels active), enabling With the introduction of Siglent’s latest 8-channel oscilloscopes
long-duration acquisitions at high resolution, which is ideal for and the new optically isolated differential probe series ODP6000B,
analyzing protocol sequences. In quarter-channel mode, memory a crucial gap in wide-bandgap (WBG) semiconductor testing
depth extends up to 2.5 Gigapoints per channel, supporting deep is now filled. The SDS5000X HD delivers picosecond-level rise
signal analysis over extended time spans. An effective number of bits time performance, enabling precise capture of the fast-switching
(ENOB) of up to 8.2 at 1 GHz ensures excellent dynamic range and behavior characteristic of silicon carbide (SiC) and gallium nitride
signal accuracy, even at full bandwidth. Combined with an impres- (GaN) devices. It provides detailed analysis of voltage and current
sively low noise floor of just 140 µVrms at 1 GHz, the new models offer transients during switching events, including overshoot, ringing, and
clear, detailed signal visibility, which is crucial for accurate debug- other dynamic effects. These capabilities help engineers optimize
ging in sensitive analog, power, and mixed-signal environments. circuit performance and ensure signal integrity in high-efficiency
power designs. Complementing these capabilities, the ODP6000B
Multi-Channel Application-Focused Analysis probes are available with bandwidths of 500 MHz and 1 GHz and
An 8-channel oscilloscope enables comprehensive three-phase feature an exceptional common-mode rejection ratio (CMRR) of
power analysis by allowing simultaneous connection to all voltage 160 dB at low frequencies, further enhancing the accuracy and
and current signals. This synchronized acquisition ensures accurate, noise immunity essential for advanced WBG device measurements.
real-time measurement of waveforms and key parameters across all
phases. Engineers can directly observe and compare phase relation- Elevating Efficiency, Accuracy, and Reliability
ships to detect imbalances and verify system performance. With With the launch of the SDS5000X HD and SDS5000L series, along
built-in FFT capabilities, the oscilloscope also supports detailed with the optically isolated ODP6000B probes, Siglent delivers a
harmonic analysis of three-phase systems. Optional application powerful and scalable measurement solution tailored to the
software further extends functionality by providing vector diagram demands of modern power electronics and complex embedded
visualization for motor diagnostics, power quality evaluation, ripple systems. The combination of high channel count, excellent signal
measurement, and overall system efficiency analysis. fidelity, deep memory, and versatile analysis capabilities enables
precise insights into demanding applications — from three-phase
Beyond power analysis, modern electronic systems increasingly rely power analysis and power-up sequence testing to high-speed
on multiple integrated chips and modules, whose initialization and characterization of wide-bandgap semiconductors. Whether in
operation must be carefully coordinated to avoid undefined states. the lab or integrated into automated test setups, Siglent provides
Power-up sequence testing verifies that signals from different circuit the tools to elevate efficiency, accuracy, and reliability in develop-
modules follow the correct timing, ensuring system stability and ment workflows.
250428-01

WEB LINK
[1] Siglent Technologies Germany GmbH: https://www.siglenteu.com/

Partner Content July & August 2025 63


BACKGROUND

Source: Adobe Stock / Anna; generated with AI.


Bluetooth 6.0
Brings Enhanced Distance-
Ranging Applications
New Version Offers Improved Device Positioning and Location Services
By Steven Keeping (Mouser Electronics)

New enhancements to the Bluetooth protocol, introduced parameter, which provided a reference
in version 6.0, are expected to spur engineers to develop power level one meter from the transmit-
ting device, to provide a Received Signal
improved device-positioning and location service Strength Indicator (RSSI). Because the
products. The most significant new feature is Bluetooth strength of the RF signal tails off inversely
Channel Sounding, which significantly enhances the proportional to the distance between the
two radio devices, it can be used to provide
precision of all previous Bluetooth distance-measuring a crude estimate of distance. This technique
techniques. is useful for locating objects in reasonable
proximity, but indicating the direction of
one object relative to another is quite a
The Bluetooth Special Interest Group (SIG) ing and location service products: The different matter.
continues to diversify the target applica- Bluetooth SIG forecasts a 22 percent CAGR
tions of the once consumer-focused short- to reach 563 million location services device In 2019, Bluetooth Direction Finding
range wireless technology. Originally shipments by 2028 [2]. [3] (adopted as part of the ratification
designed to wirelessly connect peripher- of Bluetooth v5.1) enhanced Bluetooth
als to host computers, Bluetooth® technol- Initial Support for Bluetooth device positioning and distance ranging.
ogy has become almost ubiquitous as the Distance-Ranging The technique enables applications to
go-to solution for power-frugal and reliable Theoretically, wireless connectivity can be calculate the direction of a received signal
wireless connectivity, with almost univer- used to locate lost objects. Think of those using phase measurements made by the
sal smartphone support for the tech hardly keys hiding in the depths of the sofa. If the Bluetooth Low Energy controller. Two
harmed its adoption either. keys are attached to a wireless tag, your methods were defined, angle of arrival
smartphone can quickly indicate where to (AoA) and angle of departure (AoD).
Bluetooth technology use has expanded start looking. In an industrial environment,
into healthcare, consumer, audio, indus- wireless mesh networks can help workers While Bluetooth Direction Finding works
trial, and numerous other applications. quickly locate goods on warehouse shelves. well, it requires extensive design experience
Despite impressive uptake — Bluetooth SIG But in practice, implementing such appli- to implement. Designs are complex and can
forecasts approximately 5.9 billion annual cations is incredibly tricky. Factors such as be expensive. As a result, the technology
device shipments during 2025 — success in multipath fading and interference from has been limited to high-end applications
some target applications has been under- other nearby 2.4 GHz transceivers spoil such as asset tracking high-value items,
whelming [1]. One area of note is device the signal integrity and undermine location rather than being widely adopted for more
positioning and location services. accuracy. day-to-day applications.

New enhancements to the Bluetooth The Bluetooth SIG has already made several New to Bluetooth 6.0
protocol, introduced in version 6.0, are attempts to add distance ranging and device The recent introduction of Bluetooth 6.0
expected to spur engineers to use the tech positioning support to its RF protocol. First brought several key improvements to the
to develop improved device-position- was an attempt to use the transmit (TX) protocol, including:

64 July & August 2025 www.elektormagazine.com Partner Content


> decision-based advertising filter- an addition to a more advanced product solutions work well, but the vibration
ing, a new functionality that enables a without extra hardware costs and with or sound they emit when activated can
scanning device to use the information minimal software additions. be muted by things like sofa cushions
received from a primary advertising or blankets. Channel Sounding will
channel to determine whether there’s PBR uses the phase shift of a signal sent enable precise proximity alerts over
a reason to look for related packets on by the initiator device and returned by the long distances to overcome the limita-
the secondary channels; reflector device across multiple frequen- tions of sound or vibration alarms.
> monitoring advertisers, which cies. The data-to-distance conversion uses > Appliances: The physical context infor-
allows the Bluetooth Low Energy dedicated algorithms and is performed at mation provided by Channel Sound-
controller to filter duplicate advertis- the application level. The RTT technique is ing will be useful when working with
ing packets as instructed by the host based on the time it takes for radio packets multiple devices and will assist safety
component of an observer device; to travel back and forth between the initi- features that activate control functions
> enhancement to the Isochronous ator and the reflector. RTT acts as a secure only when the user is near the device.
Adaptation Layer (ISOAL), which distance bounding technique to cross-check
enables larger data frames to be trans- PBR, and the algorithms used to calculate Lucrative Returns
mitted using more compact link layer the distance are simpler than those used Bluetooth Low Energy continues to diver-
packets; for PBR. sify into new consumer, healthcare, indus-
> an extended link layer feature set, trial automation, and smart home appli-
increasing the number of link layer For both PBR and RTT, power consumption cations among many others. After a slow
functions about which devices can is generally as low as regular data trans- start, the locationing sector promises
exchange information; and fer over Bluetooth Low Energy. Finally, lucrative returns. The Channel Sounding
> an update to frame spacing, Channel Sounding supports various technology added to Bluetooth 6.0 opens
enabling flexible adjacent connection hardware and software configuration a huge range of possible distance-ranging
spacing used with connection event options for accuracy, latency, security, and and locationing applications, including
packets or connected isochronous power consumption. enhanced asset-tracking devices, smart
stream events. locks, tags, and appliances.
Inspiring New Applications 250416-01
The most significant enhancement to Channel Sounding will make it easier for a
Bluetooth 6.0 is the introduction of new cohort of developers to come up with
Bluetooth Channel Sounding, which signifi- device positioning and distance-ranging About the Author
cantly enhances the precision of all previous applications, including the following possi- Steven Keeping gained a BEng (Hons.)
Bluetooth distance-measuring techniques. ble examples: degree at Brighton University, U.K., before
The updated Bluetooth specification defines working in the electronics divisions of
new features of the radio (PHY), features > Asset tracking: Channel Sounding Eurotherm and BOC for seven years.
of the controller, security measures, and promises to bring greater precision, He then joined Electronic Production
procedures needed to collect raw measure- flexibility, reliability, and convenience magazine and subsequently spent 13
ment data. to distance ranging and locationing years in senior editorial and publishing
without adding significant design roles on electronics manufacturing, test,
New Techniques Simplify complexity and cost. and design titles, including What’s New
Device Positioning > Smart locks: Security will improve in Electronics and Australian Electronics
Channel Sounding brings two simple and because the position of the person Engineering for Trinity Mirror, CMP, and RBI
reliable solutions for distance-ranging wanting to use the lock will be known in the U.K. and Australia. In 2006, Steven
applications: Phase-Based Ranging (PBR) more accurately. Smart locks will also became a freelance journalist specializing
and Round-Trip Timing (RTT). Both are benefit from robust protection against in electronics. He is based in Sydney.
standardized and interoperable and can man-in-the-middle and relay attacks.
be supported by very simple devices or as > Tracking tags: Contemporary tag

WEB LINKS
[1] “2024 Bluetooth® Market Update,” bluetooth.com, 2024: https://www.bluetooth.com/2024-market-update/
[2] “2024 Bluetooth® Market Update: Location Services,” bluetooth.com, 2024:
https://www.bluetooth.com/2024-market-update/#location-services
[3] Steven Keeping, “Bluetooth Heads in New Direction,” Mouser:
https://resources.mouser.com/explore-all/bluetooth-heads-in-new-direction

Partner Content July & August 2025 65


elektor books

Exploring
Wireless
Communication
with BeagleY-AI
By Dogan Ibrahim (United Kingdom)
Editor’s Note. This article is an excerpt from The
In this article, we explore two hands-on projects BeagleY-AI Handbook. It was formatted and lightly
that demonstrate how devices can communicate edited to match ElektorMag’s conventions and page
layout. The author and editor are happy to help with
wirelessly. First, we’ll set up a TCP connection queries. Contact details are in the Questions or
between a BeagleY-AI board and an Android Comments? box.
smartphone to send text messages. Then, we’ll
explore controlling an LED connected to BeagleY- Three major features of BeagleY-AI are its Wi-Fi,
AI from a smartphone using UDP. These projects Bluetooth communication, and AI capabilities.
will give you a practical look at how wireless BeagleY-AI is equipped with a dual-band 2.4 GHz
IEEE802.11ax wireless LAN module and Bluetooth
communication works in everyday tech! Low Energy (BLE) 5.4. These built-in features mean
you won’t need any external network-based hardware
to communicate over the Internet. Network commu-
nication is handled using either UDP or TCP protocols.
In this article, we’ll guide you through two projects
that demonstrate how to use these protocols!

TCP and UDP


TCP is a connection-based protocol that guarantees
the delivery of packets. Packets are assigned sequence
numbers, and the receipt of all packets is acknowl-
edged to ensure they don’t arrive out of order. Due
to this confirmation process, TCP tends to be slower
but is more reliable, ensuring packet delivery. UDP,
in contrast, is not connection-based. It doesn’t use
sequence numbers, so there is no guarantee that
packets will arrive in the correct order or at all.
However, UDP has less overhead compared to TCP,
making it faster.

UDP Communication

Let’s break down the UDP communication process
Figure 1: between the server and client over a Wi-Fi link (this
UDP communication. process is illustrated in Figure 1):

66 July & August 2025 www.elektormagazine.com


Server
1. Create a UDP socket.
2. Bind the socket to the server address.
3. Wait until the datagram packet arrives from the
client.
4. Process the datagram packet.
5. Send a reply to the client, or close the socket.
6. Go back to step 3 (if not closed).

Client
1. Create a UDP socket (and optionally bind).
2. Send a message to the server.

3. Wait until the response from the server is received.
4. Process the reply. Figure 2:
5. Go back to step 2, or close the socket. TCP communication.

TCP Communication
Let’s go over the steps for TCP communication between the Client node. Figure 3 illustrates the project block
the server and client over a Wi-Fi link (this process is diagram, showing how the BeagleY-AI and smartphone
illustrated in Figure 2): communicate over a Wi-Fi router.

Server Listing 1 shows the program (tcpserver.py). At the


1. Create a TCP socket. beginning of the program, a TCP/IP socket is created
2. Bind the socket to the server address. (sock.SOCK_STREAM) and bound to port 1500. The
3. Listen for connections. server then listens for a connection. While the server
4. Accept the connection. can accept connections from multiple clients, it can
5. Wait until the datagram packet arrives from the only communicate with one at a time. Once the client
client. establishes a connection, it is accepted by the server.
6. Process the datagram packet. The server then reads a message from the keyboard
7. Send a reply to the client or close the socket. and sends it to the client over the Wi-Fi link. Addition-
8. Go back to step 3 (if not closed). ally, the setsockopt() statement ensures that the
program can be reused without having to wait for
Client the socket timeout of 30 s.
1. Create a TCP socket.
2. Connect to the server. Testing
3. Send a message to the server. You should stop the firewall on your BeagleY-AI if it is
4. Wait until the response from the server is received. running. Enter the following command to check the
5. Process the reply. status of the firewall:
6. Go back to step 2, or close the socket.
beagle@beagle:~ $ sudo ufw status
Project 1: Sending a Text Message to a
Smartphone Using TCP
This project establishes a TCP/IP-based communica-
tion with an Android smartphone. The program reads
text messages from the keyboard and sends them to
the smartphone. The aim of this project is to show
how TCP/IP communication can be established with
an Android smartphone.

Port numbers range from 0 to 65535. Numbers from 0


to 1023 are reserved and are called well-known ports.
For instance, port 23 is the Telnet port, and port 25 is

the SMTP port. In this section, you will be working with
port number 1500 in your program. BeagleY-AI acts Figure 3: Block diagram
as the Server node, while the smartphone serves as of Project 1.

July & August 2025 67


Listing 1. tcpserver.py.
import socket

sock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)


sock.setsockopt(socket.SOL_SOCKET, socket.SO_REUSEADDR, 1)
sock.bind(("192.168.1.127", 1500))
sock.listen(1)
client, addr = sock.accept() # accept connection
print("Connected to client: ", addr) # connected message

yn = 'y'
while yn == 'y':
msg = input("Enter your message: ") # read a message
 Figure 5: Configuring the TCP Client App on the
msg = msg + "\n" Smartphone.
client.send(msg.encode('utf-8')) # send the message
yn = input("Send more messages?: ")
yn = yn.lower()
> After connecting, you should see a connection
message on your BeagleY-AI screen and also the
print("\nClosing connection to client")
IP address of the remote Android smartphone.
sock.close()
Now, enter a message and press the Enter key.
In this example, the message “HELLO FROM
BEAGLEY-AI” is sent to the client (Figure 6).
Figure 7 shows the message displayed on the
If the firewall is running, you should disable it using smartphone.
the following command:
Project 2: Controlling an LED
beagle@beagle:~ $ sudo ufw disable Connected to BeagleY-AI from a
Smartphone Using UDP
There are many TCP apps available free of charge on In this project, an LED is connected to BeagleY-AI port
the Internet for smartphones. In this project, the TCP pin GPIO21 (pin 40) through a 470-Ω current-limiting
Client app by HARDCODED JOY S.R.L. is used on an resistor. The LED is controlled by sending On and Off
Android smartphone. This app is available free of commands from an Android smartphone. The aim
charge in the Play Store (see Figure 4). of this project is to show how an LED on BeagleY-AI
can be controlled from a smartphone by sending
The program is run as follows: commands using the UDP protocol over a Wi-Fi link.
In this setup, BeagleY-AI acts as the server, while the
> First, run the server program: smartphone serves as the client.

beagle@beagle:~ $ python tcpserver.py

> Next, open the Android app and configure it


as shown in Figure 5 (click the 3-line settings
icon at the top right-hand of the screen), where
192.168.1.127 is the IP address of the BeagleY-AI.
> Click CONNECT in the settings menu to connect
to the BeagleY-AI over TCP/IP.  Figure 6: Enter the message on the keyboard.

Figure 4:
Apps used in the project.  Figure 7: Message displayed on the smartphone.

68 July & August 2025 www.elektormagazine.com


Listing 2. udpled.py.
import socket
import gpiod
from time import sleep

led = gpiod.find_line('GPIO21')
led.request(consumer='beagle', type=gpiod.LINE_REQ_DIR_OUT, default_val=0)
led.set_value(0)
sock = socket.socket(socket.AF_INET, socket.SOCK_DGRAM)
sock.bind(("192.168.1.127", 1500)) # Bind to Zero 2 W IP,port
data = [' '] * 10
while data != b'X':
data, addr = sock.recvfrom(1024)
if data == b'ON': # ON command
led.set_value(1) # LED ON
elif data == b'OFF': # OFF command
led.set_value(0) # LED OFF

sock.close()
sleep(1)


The LED can easily be replaced with a relay, for
example, to control electrical appliances from a Figure 8: UDP app.
smartphone.

Listing 2 (udpled.py) shows the program. A socket


is created, and the server waits to receive commands
from a client to control the LED. If the command is
On, the LED is turned on. If, on the other hand, the
command is Off, the LED is turned off. Command X
terminates the server program. About the Author
Prof Dr Dogan Ibrahim has BSc degree in electronic
The program can be tested using the UDP Sender/ engineering, an MSc degree in automatic control
Receiver app shown in Figure 8. engineering, and a PhD degree in digital signal
processing. Dogan has worked in many industrial
The steps to test the program are as follows: organizations before he returned to academic life.
Prof Ibrahim is the author of over 70 technical books
> Build the circuit on BeagleY-AI with the LED. and published over 200 technical articles on micro-
> Start the server program on BeagleY-AI: controllers, microprocessors, and related fields. He is
a Chartered electrical engineer and a Fellow of the
beagle@beagle:~ $ python udpled.py Institution of the Engineering Technology. He is also
a certified Arduino professional.
> Start and configure the smartphone app.
> Write the command On and press Send on the
smartphone. The LED should turn on. Similarly,
write Off and the LED should turn off. Sending X
should terminate the BeagleY-AI program.
250219-01 Related Products
> Dogan Ibrahim, The BeagleY-AI Handbook
Questions or Comments? (Elektor 2025)
www.elektor.com/21137
Do you have any questions or comments
related to this article? Email the author at > Dogan Ibrahim, The BeagleY-AI Handbook
[email protected] or Elektor at (E-Book, Elektor 2025)
[email protected]. www.elektor.com/21138

July & August 2025 69


UPDATES & MAIL

Err-lectronics
Corrections, Updates, and Readers’ Letters
Compiled by Jean-François Simon (Elektor)

Nortonized Wien Bridge Oscillator Source:


Elektor 5-6/2025, p. 98 (240008) Elettronica In
We have missed a resistor in the schematic shown in
Figure 7. For consistency with Figure 5, please exchange
the capacitors Ca and Cb in Figure 7, and insert a 39-kΩ Simple PV Power Regulator
resistor in parallel with Cb. On both figures, Cb must Elektor 1-2/2024, p. 68 (230586)
be paralleled with a resistor. The corrected schematic In the parts list for this controller (page 72), the values
is shown below. for R19 and R20 are not specified, although there is a
On page 99, the sentence “This setup operates from 15 note “see text.” However, after reading through the text
to 250 kHz, but adjusting IABC requires the amplitude (which is otherwise clearly explained) several times, I
to be in the range of a few tenths of millivolts to avoid cannot find any mention of R19 or R20 anywhere. I hope
distortion.” should be corrected to “This setup operates you can email me the missing values or the relevant
from 15 to 250 kHz, but adjusting IABC requires the ampli- part of the text, as I would very much like to build this
tude to be in the range of a few tens of millivolts to avoid circuit. Thank you in advance.
distortion.”
Gert Slijpen (The Netherlands)

Thank you for your email. We are sorry for this confusion
in the article, which was probably introduced when we
translated the article from Italian. In the Italian article,
it is written: “R19, R20: -” instead of “see text.” From the
photo, I can see that those two resistors were not used.
I would guess that they were from a previous revision
that the author did. The circuit should work fine without
R19 and R20.

Jean-François Simon (Elektor)

_
Ideas or Feedback?
Got a bright idea or valuable feed
back
for Elektor? Reach out to us at
[email protected]. We’re eager to
hear from you!
_

70 July & August 2025 www.elektormagazine.com


The HB100 Doppler Motion Sensor
Elektor 7-8/2023, p. 90 (230205)
This article about using the HB100 Doppler sensor got me
really interested. I bought two HB100 modules and two
amplifiers, and I loaded the software onto an Arduino.
However, the speed readings seem random. Sometimes
it shows speeds over 100 km/h when I just move my
hand in front of the HB100 module. Also, the detection
range is very short (less than 20 cm). I swapped the two
modules and the two amplifiers, and I adjusted the
amplifier potentiometers. Still, the speed readings seem
random. My goal is to build a speed sensor to check the
Triangular Wave Oscillator with Sine speed of cars on my street. I’m not sure this sensor can
Wave Converter measure speeds at a distance of 15 meters. Do you have
Elektor 7-8/2011, p. 58 (110431) any suggestions to get this project working properly?
I found this article quite interesting, but since I’m not
equipped to quickly solder something together, I first Olivier Croiset (France)
looked into it using a simulation program. From the
text, it appears that this circuit has been successfully
used in practice; the use of a differential amplifier for If the speed readings seem random or detection range
sine shaping has also been seen elsewhere. Unfortu- is very low, here are some possible causes and fixes:
nately, the simulation (I’m using LTSpice IV) doesn’t
show any sine-shaped voltage at all. The components > Ensure the HB100 signal is amplified and clean
used are all non-critical at the given frequency range, before feeding it into the Arduino. The HB100’s
and the triangle oscillator behaves according to theory. raw signal is very weak (a few µV) and needs proper
So what am I doing wrong? I’m attaching the LTSpice amplification.
schematic, the corresponding netlist and a screenshot > Try adding a Schmitt trigger (74HC14) to clean up
in PDF. Thank you very much in advance if you find the the signal before feeding it into the Arduino.
time to take a quick look. > The HB100 has a limited range (~10 m max),
but factors like angle and reflectivity affect
Günter Herth (Germany) performance.
> If the object moves laterally with respect to the
source, detection is not ensured. The strongest
Thank you for your email and for the files. An inter- signal is directly in front of the HB100’s antenna.
esting circuit indeed! It seems to me that the value of Ensure the object moves toward or away from the
RP2 should be reduced. With a value around 150 Ω to sensor, not sideways.
160 Ω, the circuit appears to produce a roughly sinusoi- > The HB100 works best with metallic or large
dal output signal. If you wish, you could try several objects. Try using a metal plate or a large solid
values for RP2 using .step, and calculate the THD with object. Detection is weaker for soft materials like
.four. Have fun! fabric.
> If an object moves too slowly, the Doppler shift
Jean-François Simon (Elektor) might be too low to detect.
> The HB100 is sensitive to power fluctuations, and
noise from the Arduino’s 5 V line can degrade
Thank you very much. Your suggested values for RP2 performance. Use only a stable 5 V power source.
indeed result in an approximately sinusoidal signal. I
had also tried changing the resistor value, but only from If the issue persists, check if the HB100 is producing a
1 kΩ to 5 kΩ, and saw no effect. Perhaps it was just an signal using an oscilloscope to verify the HB100’s output.
error in the schematic: 500 Ω would be more realistic If you don’t have an oscilloscope, try an audio ampli-
than 5 kΩ. By the way, LTSpice’s Fourier analysis is not fier and listen for a tone change when a moving object
sufficiently documented and should therefore be inter- is near. Regarding the speed sensor project, I’m afraid
preted with caution. this sensor is not the best choice. As said before, it has
low range detection (less than 10 m). However, there
Günter Herth (Germany) might be a chance to improve its range by modifying
its antenna and checking experimentally how far the
transmitted signal can be received.

Stefano Lovati (Italy, Author of the article)

July & August 2025 71


From Life’s Experience
Elektor 5-6/2025, p. 84 (250136)
Thank you for featuring a solar thermal collector! These This kind of total solar autonomy (heating, hot water, and
days, photovoltaic systems tend to overshadow the existence electricity) is technically achievable. The main barrier has
of thermal solar collectors, even though these became been cost. At the time, such systems were prohibitively
widespread during the first oil crisis. expensive, but photovoltaic prices have since dropped
significantly. We are now waiting for hydrogen systems,
A 1-m² photovoltaic panel in summer yields about 200 W including electrolyzers, fuel cells, and storage tanks, to
of electricity, while a thermal collector of the same area become more affordable. At Onebus, we are not hydrogen
yields about 700 W of heat, and is cheaper. A set of two specialists, but we focus on designing ultra-low-energy
2-m² thermal collectors can cover 50% of a household’s hot homes, which naturally align with such advanced systems,
water needs and pay for itself in five years. Meanwhile, a even if future technical solutions (like hydrogen) are still
photovoltaic installation typically takes between 10 and 14 costly for now.
years to pay off. I wonder why so many people rush toward
the less cost-effective option! Concerning wood, in my view, We are also working on components for autonomous homes,
firewood and pellet-based systems are not truly ecological like converting standard electric water heaters into solar
and are a major source of fine particle pollution. This is ones without drilling or welding, while retaining the full
well-known in scientific circles, but rarely mentioned by electric backup, and adding solar thermal collectors. We
wood vendors. are also developing a hybrid solar/air collector made from
photovoltaic cells that not only produce electricity but also
On the topic of energy self-sufficiency, it’s important to recover the remaining 80% of solar energy as heat. Lastly, we
remain cautious. The field is full of unrealistic promises, are experimenting with building hot water solar collectors
and many people are taken in by them. It’s essential to from off-the-shelf sheet metal, assembled using minimal
request very detailed documentation of projected energy tools, which almost anyone can build themselves.
usage, and ideally have it reviewed by a specialist. That said,
full energy autonomy is indeed possible, not just for tiny Yves Accard (France, Thermal engineer at www.onebus.fr)
homes. The first known example is a fully solar-powered Onebus is a non-profit organization. The advice provided is
and autonomous house built in 1992 by the Fraunhofer Insti- given on a voluntary basis.
tute, Germany’s largest research institute. It used seasonal
hydrogen storage and is still in operation on their campus.
A similar house was built in 2017 by Swedish engineer Olof
Nilsson.

Source: Adobe Stock/Michal

250334-01

72 July & August 2025 www.elektormagazine.com


BASIC COURSE

Starting Out in
Electronics…
…Concludes the Topic on Opamps

By Eric Bogers (Elektor)

Last time, we started tentatively with


the equalizer. We will continue with
that here, and then we will conclude the
topic of opamps for the time being.

LC Filters
LC filter circuits have the great advantage of being able to manage
with a minimal number of semiconductors. This means that noise
and distortion can hardly cause any problems. The few equalizers
that are built with “real” coils are, therefore, arts for audiophiles. Figure 1: Equalizer with LC filters.

However, the required coils are a major issue. Because electro-


magnetic compatibility is a hot topic, fixed coils are available at of the attenuation. The attenuation follows from the ratio of the
relatively low prices, but their self-induction is usually far too low, resistance to the capacitance and self-induction. Here, the resis-
and the ohmic resistance of the winding wire quickly becomes an tance consists of the series connection of the coil’s wire resistance
issue. In many cases, we will, therefore, not be able to avoid winding plus an ohmic resistance. This ohmic resistance is generally used
coils manually — and that is not cheap. Such coils are also sensitive to compensate for the unequal wire resistances of the individual
to magnetic radiation, so the device as a whole must be properly inductances, and typically also to provide a useful attenuation
shielded. In short, the savings on semiconductors do not nearly value.
outweigh the extra costs and effort that coils entail.

In the diagram in Figure 1, we have only drawn two filters, but this
diagram can, in principle, be expanded with any number of filter
sections. Resistors R1 and R2 are usually chosen to have the same
value (for example, 10 kΩ); the value of the (slide) potentiometer
is in the same order of magnitude.
As an example, we will calculate such an equalizer filter (if you like
The following formula can be used to calculate the resonance to calculate and build a complete third-band equalizer, it is best to
frequency: write a suitable computer program).

We assume that it must be a fairly narrowband filter to be able to


affect the frequency characteristic without immediately creating
The filter quality, or Q factor, is defined as the quotient of the inter- a large gap. With a center frequency of 1 kHz, we therefore choose
mediate frequency and bandwidth and is, therefore, the inverse a bandwidth of 200 Hz.

July & August 2025 73


From this data, we calculate the Q factor and the attenuation:

As for the resistance, we select a value of 100 Ω. That may seem


rather high, but, because we want to replace the self-induction
with a gyrator later on (see below), we cannot use very small values.

Now, we calculate the self-induction:

And then the capacity:

Figure 3: Equalizer with gyrators.

By the way, when we search for a suitable fixed self-induction (which


would be 68 mH) in the online catalog of a well-known mail order Then, we can calculate for our 1 kHz filter:
company, we see that availability is not a problem — but with such
a coil, the ohmic resistance is already 780 Ω. The frequency in our
example is only 1 kHz — we don’t even want to think about what
value we would end up with at 20 Hz. In practice, using a gyrator circuit would increase the resistance
to 1 kΩ; the self-induction would then be 0.795 H and the capacity
One other thing: LC equalizers usually have a limit at 40 Hz, and of the oscillating circuit 33 nF. However, this does not change the
there are reasons for that. capacity of the gyrator capacitor.

Gyrator Figure 3 shows what an equalizer with gyrators looks like. Of


Fortunately, self-inductances can also be simulated with a so-called course, this does add another 31 operational amplifiers, but fortu-
gyrator — see Figure 2. nately they add only cost and not noise (for the most part).

In this case, R1 represents the coil’s ohmic resistance (caused by Operational Amplifiers in Practice
capacitive losses — these are negligible in the LF range, so a value Except for SMD components, operational amplifiers are almost
between 100 kΩ and 1 MΩ can be chosen for R1). always assembled in DIL8 or DIL14 packages (Figure 4). DIL stands
for dual inline, which means that there is a row of connection pins
R2 stands for the wiring resistance of the coil: We can use 100 Ω on either side of the package.
for this (you can’t really use a smaller value for the opamp — a
value of 1 kΩ would be even better).

The simulated self-inductance of the gyrator now follows from:

Figure 2: Gyrator. Figure 4: Some operational amplifiers.

74 July & August 2025 www.elektormagazine.com


Figure 6: Decoupling the supply voltage.

the IC’s power connections (Figure 6). If the circuit is to meet the
highest standards, you can use a parallel connection of an electro-
lytic capacitor of approximately 10 µF and a ceramic capacitor of
approximately 1 nF.
Translated by Hans Adams — 250271-01

Figure 5: Pin layout of (most) opamps. Editor’s note: This series of articles, “Starting Out in Electronics,” is
based on the book, Basiskurs Elektronik, by Michael Ebner, which
was published in German and Dutch by Elektor.
Single and dual opamps are enclosed in DIL8 packages, while quad
opamps are enclosed in DIL14 packages. The pinout of these ICs is
almost always as outlined in Figure 5. Questions or Comments?
Do you have technical questions or comments about his article?
With single opamps, pins 1, 5, and 8 are often used for frequency Send an email to Elektor at [email protected].
and offset compensation. More information about this can be found
in the opamps’ datasheets.

Power Supply
In the diagrams that we have shown in the last few installations,
Related Product
we have not included the power supply for the opamps, but that
does not mean that opamps do not require one. > B. Kainka, Basic Electronics for Beginners (Elektor, 2020)
Book: www.elektor.com/19212
To guarantee optimal functioning of the opamp, decoupling capac- Ebook: www.elektor.com/19213
itors of about 10 to 100 nF should be placed as close as possible to

THE COAX FAMILY


HAS EXPANDED
New coaxial products
Coaxial connectors and cable assemblies provide low loss
paths between RF system, subassemblies or components.
The coaxial product range includes frequency supporting
up to 18 GHz and with various design.
www.we-online.com/coax

Highlights
• MIL-STD & IEC interfaces
• Characteristic impedance 50 Ω
• High quality data transmission
©eiSos

• Broad line of product portfolio


with customize capability #COAXFAMILY

July & August 2025 75


PROJECT

Source: Adobe Stock


A Powerful
AI Code Assistant
Speed Up Your Development with Continue and Visual Studio Code

By Koen Vervloesem (Belgium) Fortunately, recent years have seen the advent of smaller LLMs that
you can run on your own hardware, provided it’s powerful enough.
Large language models can accelerate your An NVIDIA GPU with at least 8-GB VRAM is recommended, as these
software development. In this tutorial, we GPUs are particularly suited for running LLMs at accelerated speeds.
In this article, I’ll set up an Ollama [5] server for local LLM operation
use the Continue extension for Visual Studio and show how to install and use the Continue [6] extension in Visual
Code and enjoy the advantages of an AI code Studio Code to instruct the LLM in the background to assist you in
assistant that autocompletes, rewrites, and various coding tasks.

explains code. Running LLMs with Ollama


Ollama is available for Windows, macOS, and Linux. Download the
version for your operating system from the Ollama downloads page
Large language models (LLM) like OpenAI’s ChatGPT [1] are often [7]. Ollama supports NVIDIA and AMD GPUs for accelerated inference.
referred to as “autocomplete on steroids” for a variety of programming For AMD GPUs, it’s recommended to install the latest AMD Radeon
languages, but they offer much more. While these neural networks drivers [8] to have access to all features. Moreover, you need to install
essentially predict and complete the text you type, training them the AMD ROCm [9] software stack to enable GPU programming. For
on extensive data sets of texts and conversations has resulted in NVIDIA GPUs, installing the CUDA drivers [10] is necessary.
unexpected emergent capabilities. You can even run the LLM entirely
on your own hardware, ensuring that you don’t send confidential infor- One of the best LLMs you can run locally for code generation and
mation to the cloud. programming assistance is Mistral AI’s Codestral 22B [11]. It’s trained
on a diverse dataset of 80+ programming languages, including Python,
One remarkable capability is their proficiency in coding tasks. You can Java, C, C++, JavaScript, and Bash. Codestral can complete functions,
instruct an LLM to draft a shell script for a one-off task, refactor existing generate tests, and complete partial code snippets. Download and
code, shed light on a compilation error, or even generate unit tests. run the model with 22 billion parameters using the following ollama
LLMs are especially useful when coding in a programming language command: ollama run codestral.
that you might not be familiar with. Overall, LLMs can speed up your
development, if used correctly. After downloading the 12-GB file, you can start chatting with the model
through ollama’s command-line interface. However, this sizable model
Even before ChatGPT’s public release in November 2022, Microsoft requires a GPU with a minimum of 24-GB VRAM, or multiple GPUs
offered an AI code assistant, GitHub Copilot [2], built on OpenAI’s totaling 24-GB VRAM, for optimal performance and user experience.
large language models. You can use this tool in the company’s free Note that the model is distributed under the Mistral AI Non-Production
code editor Visual Studio Code [3] through the GitHub Copilot exten- License [12], which restricts its use to non-commercial purposes and
sion [4]. However, GitHub Copilot operates as a cloud-based service, research.
requiring continuous communication with Microsoft’s servers. This
can be problematic for developers working on confidential software, If you want to be able to run a coding LLM within 8-GB VRAM,
as code is sent to external servers. DeepSeek AI’s DeepSeek Coder 6.7B [13] is a commendable option.

76 July & August 2025 www.elektormagazine.com


The model is available in various sizes: 1 billion parameters (1B), The extension Continue - Codestral, Claude, and more by the publisher
5.7 billion (5.7B), 6.7B, and 33B, allowing you to choose the size best continue.dev should be the first search result. Click on Install to add
suited to your hardware. Subsequently, DeepSeek Coder V2 [14] was the extension (Figure 2).
released, coming in 16B and 236B sizes. DeepSeek AI’s models permit
commercial use. After installation, the extension opens a tab in Visual Studio Code
with a welcome message and useful instructions for first-time users.
To run the 6.7B DeepSeek Coder model, exit the previous Ollama A new icon also appears in the sidebar to interact with Continue. The
session with /exit and run the following ollama command: ollama welcome message recommends moving this icon to the right, allowing
run deepseek-coder:6.7b-base. After downloading the 3.8-GB file, you to see both Continue and the file explorer simultaneously. Simply
you can ask some code generation or explanation questions to the drag the Continue icon from the left sidebar to the right and release it.
model and compare its speed and utility against Codestral.
Choosing the Models
You can find other code-related LLMs in Ollama’s model library [15] Continue offers a choice of LLMs, both cloud-based and local ones.
(Figure 1). Noteworthy models include Google’s CodeGemma (2B and For complete local operation, Continue recommends three models:
7B), Meta’s Code Llama (7B, 13B, 34B, 70B), and IBM’s Granite Code Meta’s Llama 3.1 [16] 8B for chat, BigCode’s StarCoder 2 [17] 3B for
(3B, 8B, 20B, 34B). Always review the model’s license to understand code completion, and Nomic’s Embed [18] for generating text embed-
its terms of use. dings to be able to query documents. First, download these three
models for Ollama:
In the next part, we’ll install an excellent Visual Studio Code exten-
sion called Continue. You can configure it to use the LLM best suited ollama pull llama3.1:8b
to your needs. The selection of compatible LLMs is vast and includes ollama pull starcoder2:3b
Codestral and DeepSeek. For the purposes of this tutorial, we’ll be ollama pull nomic-embed-text
using models other than the two just mentioned, to give you a broader
overview of the possibilities. Once downloaded, click on the gear icon at the bottom right of Contin-
ue’s side bar. This opens the extension’s configuration file config.json
Installing the Continue Extension in an editor tab. Here you can specify the models, following Continue’s
I assume that you’re already running Visual Studio Code; otherwise, configuration documentation [19]. You’ll find various JSON keys within
download it from its website [3]. Microsoft’s popular code editor is the file. For instance, there’s an empty list of models:
available for Windows, macOS, and Linux. After this, click on the Exten-
sions icon in the side bar (the boxes icon) and search for continue. "models": [],

Figure 1: Find code-related LLMs in Ollama’s model library. Figure 2: Install the Continue extension in Visual Studio Code.

July & August 2025 77


Fitting Models in Your GPU’s VRAM coming from the code completion model (StarCoder 2 if you followed
If you have a GPU with 8-GB VRAM, the suggested models Llama Continue’s recommendation).
3.1 8B and StarCoder 2 3B can’t fit simultaneously in your GPU’s
VRAM. Ollama will unload a model and load the other one every You can also ask questions about code sections. Simply select a block
time you switch from asking questions to completing code, adding of code and press Ctrl+L (Cmd+L on macOS) to add it to Continue’s
extra time between tasks. Using Llama 3.1 8B for both tasks isn’t an sidebar. You can then chat with the default model about this code
option, as the models for code completion are trained with a highly (Llama 3.1 if you followed Continue’s recommendations), for example,
specific prompt format, which allows them to respond to requests asking it to explain the code (Figure 3). You can always ask follow-up
for completing code. Instead, consider replacing StarCoder 2 3B questions and have a conversation with the model.
by DeepSeek Coder 1B (install with ollama pull deepseek-
coder:1.3b-base). Tests on an NVIDIA GeForce RTX 4060 with If you ask the model to rewrite some parts of your code, it replies with
8-GB VRAM showed Ollama could run Llama 3.1 8B and DeepSeek a code block. Hovering with your mouse cursor over the code block
Coder 1B concurrently. reveals icons to copy the code, insert it at the cursor’s position, or
apply the suggested changes to the current file.

You can also let Continue directly edit code within the code editor.
Specify Ollama’s Llama 3.1 model: Select the part of the code you want to modify, press Ctrl+I (Cmd+I on
macOS), and then instruct the model what you want to change. This
"models": [ is useful for refactoring, adopting a new approach, or adapting code
{ to a new API. For each changed block of code, Continue displays a
"title": "Llama 3.1 8B", diff with buttons to accept or reject the changes. You can also press
"provider": "ollama", Ctrl+I again for additional instructions until you’re satisfied with the
"model": "llama3.1:8b" model’s edits.
}
], The assistant can help fix errors, too. Running your code in Visual
Studio Code’s terminal and encountering an error? Pressing Ctrl+-
Alternatively, setting the model as AUTODETECT allows Continue to Shift+R (Cmd+Shift+R on macOS) lets Continue feed the question
query Ollama for all available models, letting you choose the model “I got the following error, can you please help explain how to fix it?”
for chat from a dropdown list. For code completion, specify the model followed by the actual error message from the terminal to the LLM.
as follows: The model then replies with a potential solution. Try its suggestion,
and if it doesn’t work, and you get an error again (the same or another
"tabAutocompleteModel": { one), just press Ctrl+Shift+R again to ask for help.
"title": "StarCoder 2 3B",
"provider": "ollama", Adding Context
"model": "starcoder2:3b" Until now, you’ve been using LLMs on selected parts of your code.
}, However, you can also add context by one of Continue’s built-in context
providers, which allow you to use the LLM more effectively. During
Finally, specify the model for text embeddings: any conversation with the LLM, type @code to reference specific
functions or classes from throughout your project, without having
"embeddingsProvider": { to select them. With @problems you can refer to the problems that
"provider": "ollama", Visual Studio Code shows for your currently opened code file, such
"model": "nomic-embed-text" as syntax errors.
},
Continue also indexes the codebase you’re working on, allowing it to
After this, save your changes. automatically pull in the most relevant context from throughout your
workspace when answering general questions. Just type @codebase
Regarding model selection, depending on your hardware it is possible followed by your question to provide this context. It’s best to start a
that the suggested models Llama 3.1 8B and StarCoder 2 3B can’t fit new session for this, which you can do by clicking on the + icon at
simultaneously. See the text box Fitting models in your GPU’s VRAM the top right of Continue’s sidebar.
for more information on that topic.
When the LLM answers your query with the @codebase context, it
Using Continue shows the context items it uses as “X context items”. If you click on
When you start developing in Visual Studio Code now, Continue it, a list of the precise files and lines unfolds that the LLM is using
operates in the background, enhancing your workflow. For instance, as context for its answer. In its answer, it also refers to the relevant
pressing the tab key while typing a line of code provides a suggestion files. This works well for general questions, like how to add a new

78 July & August 2025 www.elektormagazine.com


Figure 3: You can ask questions about your code in Continue’s sidebar.

configuration option, how to implement a subclass using another this context, this should result in more relevant answers. However, the
subclass as an example, or how to add command-line parameters @open context provider isn’t enabled by default. You need to add the
using Python’s argparse module. You can also use @folder to ask following entry to Continue’s config.json file in the contextProviders
questions about a specific folder within your project, instead of using list:
the entire codebase as context.
{
If you’re developing a more than trivial program, you often have multiple "name": "open",
source files open in Visual Studio Code. You can refer to the contents "params": {}
of all your open files with @open. When asking your question within },

July & August 2025 79


Another useful context provider is @terminal, which references the
contents of Visual Studio Code’s terminal. And with @diff you refer
to all the changes you’ve made in your current Git branch. This way,
you can ask the LLM for a review of your work before committing your
changes to the project’s Git repository.

External Context
Continue can incorporate external sources into LLM context as well.
For instance, referencing a specific GitHub issue within LLM queries
is possible by typing @issue. Enable this context provider with the
following entry in Continue’s configuration file:

{
"name": "issue",
"params": {
"repos": [
{
"owner": "theengs",
"repo": "gateway"
}
],
"githubToken": "github_pat_xxx"
} Figure 4: Create a GitHub personal access token to give Continue access to
}, issues on your GitHub repositories.

Note that you need to explicitly specify the repositories you want Another command is /comment, which prompts the LLM to comment
to be able to refer to. It’s also recommended to include a GitHub the selected code. The /commit command generates a commit
personal access token [21] to avoid being rate-limited. When creating message from the current Git diff with changes in your code, and /
the access token on GitHub’s website, giving just read-only access cmd generates a shell command based on your instructions and pastes
to public repositories is enough (Figure 4). Copy the access token it into Visual Studio Code’s terminal. You only need to review and adapt
immediately and paste it in Continue’s configuration file because it’s the command and then press enter to execute it.
only visible once.
You can also create custom slash commands, using either TypeScript
Another useful context provider is @docs, which is enabled by default. code or LLM prompts. By default, Continue includes one custom
Continue pre-indexes a number of common documentation sites, most command using a prompt:
of them about web development technologies, but also the official
Python documentation and Rust documentation and the C# language "customCommands": [
reference. Just start typing @docs, choose the documentation site {
from the dropdown menu or type the name of the project, and then "name": "test",
after selecting the project ask your question with this documentation "prompt": "{{{ input }}}\n\nWrite a comprehensive
site as context. set of unit tests for the selected code. It should setup,
run tests that check for correctness including important
You can also add any documentation site by selecting Add Docs in edge cases, and teardown. Ensure that the tests are
the dropdown menu that appears after typing @docs. Just enter the complete and sophisticated. Give the tests just as chat
root URL of the documentation site and the name of the project. This output, don’t edit any file.",
is useful to add the documentation of the major libraries you’re using "description": "Write unit tests for highlighted code"
in your project, so the LLM is aware of it when asking questions. }
],
Built-In Commands
Continue also has some handy built-in slash commands [22]. Simply The {{{ input }}} is a placeholder for the selected code. Then
select a block of code, press Ctrl+L to start a session with the LLM, come two newlines (\n), followed by the prompt to the model. You
and enter /edit followed by instructions to edit the code. Continue can customize this to your liking. Then just select your code that you
shows the suggested changes in a side-by-side diff editor to accept want to be tested, press Ctrl+L and type /test. Refine the results
or reject individual changes. through follow-up questions if necessary.

80 July & August 2025 www.elektormagazine.com


Powerful Tools at Your Disposal
Continue allows you to have a code assistant available at all times
without relying on cloud services or needing to pay for API access. In
my experience, having a GPU with 8-GB VRAM is really the minimum
to be able to run some usable LLMs to assist with coding. LLMs are
steadily improving, and even though they make errors, Continue’s
seamless integration with Visual Studio Code makes using LLMs as
code assistants quite user-friendly. There’s no need to switch between
your editor, an LLM chat site, and documentation sites anymore. Exper-
iment to find the most suitable models for your use cases and avail-
able hardware, and you’ll have some powerful tools at your disposal
to speed up your development.
240448-01
Related Products
> Dogan Ibrahim, C Programming on Raspberry Pi
(Elektor, 2021)
Questions or Comments? www.elektor.com/19703
Do you have questions or comments about this article? Email
the author at [email protected], or contact Elektor at > Daniel Situnayake, AI at the Edge (O’Reilly, 2023)
www.elektor.com/20465
[email protected].

WEB LINKS
[1] ChatGPT: https://openai.com/chatgpt/
[2] GitHub Copilot: https://github.com/features/copilot/
[3] Visual Studio Code: https://code.visualstudio.com
[4] GitHub Copilot extension: https://marketplace.visualstudio.com/items?itemName=GitHub.copilot
[5] Ollama: https://ollama.com
[6] Continue: https://www.continue.dev
[7] Ollama downloads: https://ollama.com/download
[8] AMD Radeon drivers: https://www.amd.com/en/support/download/drivers.html
[9] AMD ROCm: https://rocm.docs.amd.com
[10] CUDA drivers: https://developer.nvidia.com/cuda-downloads
[11] Mistral AI’s Codestral 22B: https://mistral.ai/news/codestral/
[12] Mistral AI Non-Production License: https://mistral.ai/news/mistral-ai-non-production-license-mnpl/
[13] DeepSeek AI’s DeepSeek Coder: https://deepseekcoder.github.io
[14] DeepSeek AI’s DeepSeek Coder V2: https://github.com/deepseek-ai/DeepSeek-Coder-V2
[15] Ollama’s model library: https://ollama.com/library
[16] Meta’s Llama 3.1: https://ai.meta.com/blog/meta-llama-3-1/
[17] BigCode’s StarCoder 2: https://github.com/bigcode-project/starcoder2
[18] Nomic’s Embed: https://www.nomic.ai/blog/posts/nomic-embed-text-v1
[19] Continue’s configuration documentation: https://docs.continue.dev/setup/configuration
[20] Continue’s built-in context providers: https://docs.continue.dev/customization/context-providers
[21] GitHub personal access token: https://tinyurl.com/bykfswr9
[22] Slash commands: https://docs.continue.dev/customization/slash-commands

July & August 2025 81


PROJECT

Solar Charge
Controller
with MPPT (2)
The Circuit

By Roland Stiglmayr (Germany) The first part of this article series [1] covered the basics, advantages,
and functionality of an MPP tracker in a solar charge controller and
For the second article in this series, ended with a block diagram showing the design of an MPPT. In part 2,
we convert the block diagram of the the block diagram (Figure 1) is converted into a functioning circuit
(Figure 2). In addition, the functionality of the sub-circuits is explained
MPPT solar charge controller into a in detail.
functioning circuit. As always with
power electronics, the main focus is on The Internal Power Supply
Voltage VPV from the solar panel is fed via fuse F1 to suppressor
the currents within the circuit and their diode D2, which suppresses brief overvoltages. F1 trips in the event
implications for certain components. of very high fault currents caused by inductive coupling, and also
Calculations are required! makes it possible to disconnect the module from the solar panels.

12 bit D/A

V In
Supply Voltage A D HMI
En

V Out, ref V Iout, ref IIC, SPI

V Bat
Serial
A2 D
V Out Data
V In
I PV I In V In Controller

A1
PV A
V PV V ISense =
I Out x c

Charge Load_On

V In
T1 T2
In En

I Out
Gate
PWM
Drive
Load

0V = max
I Sense D1
+V = min
Figure 1: V Out
Reminder: The block
diagram from the first 250109-007

part of the series.

82 July & August 2025 www.elektormagazine.com


components are available in several versions, which differ in terms of
switching frequency and the two operating modes: fixed frequency or

July & August 2025 83


discontinuous (gap) operation. Due to its higher efficiency, the version
C5 100n D40 C8 100n
V_IN V_I 13V D_4V8 A_4V8 A_3V3
1 1
R1 D1 CB SM4004 CB R11
L1 L2 L3 L4
5 6 5 6
100Ω VIN SW VIN SW 1k
47µH R59 R4 47µH R6 33µH 47µH R14 R52
F1
SM4004 IC1 IC2

12k

100k
100k

470k

330k

LMR51606 LMR51606 IC3


XDBVR R3 YDBVR R9 V_ACS
X1 15A 4 3 4 3 R12 R17
D2 EN FB 270k EN FB 220k
10Ω

100k
C1 C33 C2 D8 C4 C6 R34 3
PV+ GND GND R10 LM4041IDBZ C30
1

10k
PV0 100n 100n 47µ
D3 2 2 220k T4 IC6A
8.0SMDJ51A SM40042µ2 2µ2
100n R16 2
100V 100V 63V 100V 100V
47k
R60 R5 LL4148 R53 R2 R7 R8 R13 R15
C3 C7 C9 C10 8 C35 C34
100k

10k
BC847
4k7

47k

47k

18k

82k

22k

IC6

with discontinuous operation is used.


100µ 1n 100µ 1µ 4 1µ 47n
25V 25V
13V A_3V3
IC6 = TLV9002IDR
5
C13 R66 R28 R22 7
IC6B
6
R63
12k

12k

10k

R38

C16

C21
100n ARDUINO_NANO

10Ω

10k
12
16 15


VCC TX VIN
16 17 14 R36
2IN+ R19 R20 A_4V8 RX GND
15 C14 18 13 C20 47n R37 R35
8 2IN- 10k 150k RST RST D_4V8
C1 1µ 19
GND
MOD1 12
5V

4k7

4k7

10k
C31 R21 R58 D5
13 20 11
9 OC 10k D2 A7 10k LL4148
E1 21 10
1n 8 1 D3 A6
3 VOUTA VDD 22 9
IC4 CIN 7 2 R31 D4 RESET A5
D_4V8 R65 GND IC5 /CS 1k 23 8
TL494CDRD16-M 6 3 R32 D5 A4
1k2

14 VOUTB SCK 1k 24 7

12
13
14
15
16
17
18
19
20
11
VREF 5 4 R33 D6 A3
/LDAC SDI 1k 25 6

VOUT
IM1
VDD
VSS

SID

/CS
SA0
SOD

SCLK

/RST
11 C11 D7 A2
C2 4 R25 26 5 C18 47n
D8 A1

rectification, only the external storage choke is required for operation.


Input voltage V_IN is applied to the blocking capacitors of the power

They operate up to a maximum input voltage of 65 V. These LMR51605


converters, IC1 and IC2. Since they also have integrated synchronous
section and is fed via L1 as V_I to the subsequent low-power step-down
DTC

Figure 2: The complete circuit diagram of the MPPT solar charge controller.
MCP4822-E/SN 27 4 C17 47n
10n D9 A0
1k2

10 R26
E2 2 28 3 C15 1µ
1IN- 10k R23 D10 AREF DSP1
1 29 2
1IN+ 10k D11 3V3 DOGS104N-A
30 1 C19 47n
RT GND CT D12 D13
6 7 5 R62

NC/C2

NC/C1
NC/A2

NC/A1
R30 R29 R18 R27 R24 R55
C12 10k
10k

USB
3k9

10k

33k

10k
1k

10
9

2
1
1n
R61
V_BCK 100k
13V V_IN V_ACS V_IBCK R45
1k
R44 R57
C25 C27 C37 C26 V_LOAD

100k
4Ω7 T3 T5
100n 100µ 100µ 1µ
IPP024N08NF25 MVMFWS2D3P04
D 100V 63V 63V
D4 T1
DFLS1100 S D S D
R42
G D7 R49
3Ω3 8
D_4V8 1 16 R40 R50 F2

22k
INA VCCA G G
2 15 C23 IPP024N08NF25 S 1 VCC 470k
L5

10k
INB OUTA IP+@1
3 14 2 7 25A D6
VDD_1 IC10 VSSA 15µH IP+@2 VIOUT
4 13 100n BZV55-C12 R46
GND NC_2 6 5 4
5 12 D IC8 C32 C36 LL4148
X2 R56 R48 X3

GATE

CAT_D
ANO_S

8k2
ENA/DIS NC_1 T2
6 11 3 6

10k
DT VCCB R43 IP–@3 FLTR R51
100n 100n Bat+ Out+

6k8
7 10 G 4
ANB OUTB 3Ω3 IP–@4 1 T6
IC9 Bat0 Out0

6k8
8 9 GND VCAP
VDD_2 VSSB
IPP024N08NF25 S 5 LM74700
R64 R39 R41 R67 R68 R54 3 R47
C22 C24 C28 C29 EN LED1 LED2
MCP51561BADWR2G GND

100k

100k
BC847
22k

10k

10k

2k2

2k2
2
1µ 100n 1µ 270µ
35V red green
250109-022
IC8 = ACS711ELCTR-25AB-T
Technical Specifications
Input voltage 20…60 V
Input current (max.) 15 A
Output voltage 10…29 V
Charging current (max.) 20 A
Since uL only assumes two constant values (V_IN – V_BCK and -V_BCK),
Charging power (max.) 280 W the following applies:
Load current (max.) 25 A ∆iL = 1/L × uL × ∆t; uL = constant
Efficiency (230 W) >96%
When loading the choke, the following results:
Internal power consumption (low power) <8 mA
∆t = 1/f × (V_BCK / V_IN)
uL = V_IN – V_BCK

With V_IN = 55 V, V_BCK = 12 V, f = 250 kHz, L = 4.7 µH, we get:


IC1 generates 13 V from V_I to supply the gate control of the power ∆iL,4.7µH = (1 / 4.7 µH) × (55 V – 12 V) × 0.87 µs = 8.0 A
MOSFETs. IC1 is activated by the microcontroller via diode D3 when
the voltage of the PV panel is high enough to operate the power The ripple current is the root mean square value of ∆iL , approximately
section of the tracker. ∆iL/2 = 4 A. This value is very high, which is why another attempt is
made with 10 µH, resulting in ∆iL,10µH = 3.8 A. As expected, the value
IC2 generates the 5 V supply for the microcontroller and the analog has halved, but is still very high. We can solve this problem!
section. Its input is supplied by V_I via D40 or, if V_I is not available,
via D8 by V_LOAD from the battery. The enable input (EN) is used Assuming the above values, a simulation (Figure 3) is used to deter-
for shutdown in case of undervoltage. It is set to the lowest operating mine the voltage and current curves in the converter and calculate
voltage of 6 V by the voltage divider, R6 and R7. the load on the capacitors.

The output voltage of IC2 is cleaned of high-frequency interference The first curve shows the voltage curves, the second shows the current,
by L4 and is used to supply the analog section. The adjustable preci- I(L5), through storage choke L5 and load current I(Load). The super-
sion voltage source, IC3, generates the reference voltage of 3.3 V. imposed alternating current is the magnetizing current applied to C29.
Op-amp IC6B buffers this voltage and supplies it to the reference The third curve shows the current, I(V_IN), supplied by the solar panel,
voltage input AREF of the Arduino. Op-amp IC6A uses the reference the current flowing through the high-side FET, I(T1_DS), and current
voltage as the supply voltage, V_ACS, for current sensor IC8. To keep I(C27) flowing through one of the two decoupling capacitors, C27||C37.
the power consumption as low as possible, the controller switches off The comparison of the two curves clearly shows how an input current
this voltage via T4 when it is dark. Op-amp IC6, a TLV9002, is charac- of 4 A becomes an output current of 15 A. The fourth curve, which
terized by its high stability in unity gain operation and must not be uses a different time scale, shows the energy dissipated at the equiv-
replaced by an arbitrary type. alent series resistance (ESR) of C27 within the observation period of
7 ms. The power dissipation of the capacitor and the associated ripple
The High-Power Section current can be calculated from the energy.
In the block diagram, the function blocks PWM, Gate Driver, the two
MOSFETs in half-bridge configuration, and the storage choke with the Energy: ∆E = P × ∆t; P = ∆E/ ∆t
output capacitor form the high-power section of the MPP tracker. If Power: P = (E8ms – E1ms) / 7 ms = (64.4 mJ – 63.1 mJ) / 7 ms = 0.19 W
you add the control from A1 and A2, you can see a pure buck converter Current: Ieff = √(P/ESR) = √(0.19 W/17 mΩ) = 3.3 A
with synchronous rectification. Synchronous rectification means that
MOSFET T2 (Figure 2) takes over the role of the usual freewheeling If electrolytic capacitors were subjected to such high currents, they
diode. This is the only way to achieve an efficiency of over 95% at would explode in no time! Only high-quality aluminum polymer capac-
currents of 15 A and higher. To achieve this goal, the MOSFETs must itors can withstand currents of this magnitude.
have a very low RDSON and, to keep switching losses low, the semicon-
ductor capacities must be as small as possible. Only N-channel FETs Current sensor IC8 is connected in series with choke L5. The current
can meet these requirements. is measured by detecting the flux density generated by the current in
the sensor’s internal conductor. An integrated Hall sensor measures
Since the high-side FET requires a gate voltage that is higher than the magnetic field. The advantage of this principle is that there are
V_IN, the bootstrap circuit consisting of C23, D4, and R44 adds 13 V no losses. The sensor type used here is suitable for measuring ±25 A
to V_IN and makes it available to the gate driver. Several aspects with a sensitivity of 55 mV/1 A. Since the sensitivity depends on the
must be considered when dimensioning the storage choke: If a small supply voltage, it is supplied with the reference voltage.
inductance value is selected, the magnetization current increases and,
in turn, the ohmic losses decrease for the same component size. The What is still missing is the control of the MOSFETs by gate driver IC10.
magnetization current represents the ripple current of output capacitor In addition to generating the high gate currents of 7 to 9 A, it separates
C29 and therefore has a major influence on its load. A quick calcula- the different reference potentials of the input and output. For this
tion shows the range of the magnetization current. purpose, it is coupled inductively internally to achieve isolation between
all stages. Furthermore, the gate driver generates the complementary
Choke current in general: iL = 1/L × ∫uL × dt output signals required to control the high-side and low-side FETs.

84 July & August 2025 www.elektormagazine.com


Figure 3: Simulation of the power section in steady state, with a load current of 15 A, L5 = 10 µH, and C27 = 100 µF.

To prevent the dreaded shoot-through, i.e., the simultaneous conduc- to the body diode’s polarity. Otherwise, the load would always be
tion of both FETs, it inserts a dead time when commutating the current connected to the battery via the body diode. As already mentioned
from one FET to the other. The dead time is adjusted with R39. The above, in the dark, the battery supplies the controller via diode D8,
microcontroller can disable the component by applying a low signal which is connected to the load output. If there is no input voltage and
to the ENA/DIS pin. the controller detects that the battery voltage is too low, the load is
disconnected, which leads to a complete shutdown of the system.
The above considerations apply to every step-down-regulator and can
therefore also be used very well for your own developments. The Control Circuit
The most complex part of the solar controller is the power converter’s
Battery and Load Management control circuit. It adjusts the PWM’s pulse width so that the output
To charge the battery, the microcontroller activates MOSFET T3 via current corresponds to a value specified by the controller, and the
IC9, which switches the output of the converter to the battery. It is maximum output voltage cannot exceed the battery’s end-of-charge
essential to disconnect the battery from the converter; otherwise the voltage.
converter will discharge the battery. Due to the polarity of body diode
T3, only an N-channel FET can be used here, but this requires an The setpoints for current and voltage are provided by the 12-bit D/A
increase in its gate voltage. IC9, a component originally designed converter, IC5. It has two outputs, an internal reference voltage of
for reverse polarity protection circuits, performs this task. In addition 2.048 V, and is controlled via an SPI interface.
to increasing the voltage, it monitors T3’s DS voltage and immedi-
ately switches off the FET if the source voltage falls below the drain IC4 contains two control amplifiers and the PWM generator. Figure 4
voltage. This reliably prevents reverse operation, which could cause shows a section of the internal circuit and the associated external
the converter to become a boost converter. circuitry. The outputs of the control amplifiers are connected to two
diodes in such a way that the higher signal always dominates. Since
The microcontroller continuously measures the battery voltage and the PWM generator reduces the pulse width as the voltage increases,
switches the battery to the load output when the voltage is sufficient. the actual values must necessarily act on the non-inverting inputs.
This is ensured by MOSFET T5, which must be a P-channel type due If the current or voltage rises above its setpoint value, the control

July & August 2025 85


R65 R25
VOUTA

R24 R23
1IN+
V_BCK

R28 R26 1 +5V


A_3V3

R66

C2
R27
IC4 = TL494 PWM

E2
OUT
R18
2IN+ R39
V_IBCK

R22 R19 2
A_3.3V

R21
VOUTB

R20
Figure 4: The control 250109-018

circuit with IC4 and


external wiring.

amplifier’s output voltage also increases and, as a result, the pulse for the converter’s output voltage of the converter. The non-inverting
width is reduced. This causes the deviating value to fall back to the input of control amplifier 1 sums part of the converter voltage, V_BCK,
setpoint value. with VOUTA from the D/A converter. The value of the setpoint that
the D/A converter outputs is calculated as follows:
The signal from the current sensor, V_IBCK, which represents the
output current, is present at the non-inverting input of control ampli- V_BCK = IR24 × R24 + V1IN+
fier 2. Without current, the quiescent level of the sensor is half its IR24 = (V1IN+ - VOUTA) / (R25 + R65)
supply voltage, i.e., A_3V3 / 2. V_IBCK is: V_BCK = ((V1IN+ - VOUTA) × R24 / (R25 + R65)) + V1IN+
V_BCK = V1IN+ × (c + 1) – VOUTA × c
V_IBCK = I_BCK × SSense + (A_3V3 / 2); VOUTA = V1IN+ × ((c + 1) / c) – V_BCK / c
where SSense = (55 mV / 1000 mA) = 0.055 mV / 1 mA where c = R24 / (R25 + R65) = 13.75
VOUTA = V1IN+ × 1.07272 – V_BCK × 1 / 13.75
The setpoint of the output current, which is obtained from the refer- V1IN+ = V1IN- = A_3V3 × R27 / (R28 || R68 + R27)
ence voltage A_3V3 and VOUTB using a voltage divider consisting VOUTA = A_3V3 × 0.625 – V_BCK × 1 / 13.75
of R20||R21 and R22, is present at the inverting input. The base point DAC_A = VOUTA × 4096 / 2048 = VOUTA × 2
of the voltage divider is present at the VOUTB output of the D/A
converter, which controls the potential of this point in order to set the V_SetZ = A_3V3 × 0.625 × 1.07272 × 216 = A_3V3 × 43939
output current. The following applies: V_SetG = (1 / 13.75) × 216 = 4766

V_IBCK = ((A_3V3 – VOUTB) × (R21||R20) / (R21||R20 + R22) + Resulting in:


VOUTB DAC_A = (V_SetZ – V_SetG × V_BCK) / 215
where (R21||R20) / (R21||R20 + R22) = k = 0.48387 and
V_IBCK = V2IN- = V2IN+ The derivation of these formulas has been described in such detail
V_IBCK = A_3V3 × k – VOUTB × k + VOUTB = because they will be implemented later in the program code.
A_3V3 × k + VOUTB × (1 – k)
VOUTB = (V_IBCK – A_3V3 × k) / (1 – k) The frequency of the PWM is set with R29 and C12. The emitter follower
VOUTB = I_BCK × SSense / (1 – k) + A_3V3 × ((1/2 – k) / (1 – k)) at the output of the PWM operates on resistor R30.
VOUTB = I_BCK × SSense × 1.9375 + A_3V3 × 0.031252
VOUTB = DAC_B × 2048 mV / 4096 = DAC_B × 1/2 Microcontroller and LC Display
DAC_B = VOUTB × 2 For simplicity’s sake, an Arduino Nano is used. It offers everything needed
in a small footprint: digital I/O ports, a 10-bit ADC with eight analog
Two constants, I_SetG and I_SetZ, are used in the software (they may inputs, SPI and I2C buses, and a USB interface. Above all, however,
need to be adjusted by the user to compensate for measurement errors): its programmability via the bootloader is very efficient. This is used
I_SetZ = A_3V3 × 0.031252 × 216 × 2 = A_3V3 × 4096 intensively during commissioning, as the entire analog section is
I_SetG = SSense × 1.9375 × 216 × 2 = 13967 adjusted via parameters to be set in the program. In normal opera-
tion, the operating data is output serially via the USB interface. The
Resulting in: use of the serial plotter is also planned.
DAC_B = (I_BCK × I_SetG + A_3V3 × I_SetZ) / 216
The ADC benefits greatly from the external reference voltage, AREF.
The inverting input of control amplifier 1 is at a constant voltage of This results in astonishingly good accuracy. Voltage dividers limit the
approximately 2050 mV, which is generated from A_3V3 via the voltage analog signals to the maximum input level of 3.3 V. More on this in
divider consisting of R28, R66, and R27. This voltage is the reference the final part of the article.

86 July & August 2025 www.elektormagazine.com


An LC display is used due to its low power consumption. DSP1 is When installing the tracker, the connection to the load should be
powered from the Nano’s internal 3.3 V voltage and controlled via I2C. equipped with a disconnect device and a fuse rated for the load current.
This precautionary measure serves to reduce the risk of fire in the
Construction event of a short circuit in the load.
This concludes the detailed description of the electronics. While we
at Elektor are preparing the third and final part of the article on the The third and final part of this article series will focus almost exclusively
function and correct configuration of the software, you can order the on the MPPT software in the Arduino Nano, describing its functionality
components and have the circuit board manufactured (if you are in detail. The solar charge controller will then be put into operation —
interested in building your own solar controller). All the necessary this will also require certain parameters to be entered into the software.
documents — parts list and KiCad files — can be found at [4].
The author is aware that the above is “heavy going.” However, since
The construction of the circuit is quite simple due to the generously many sub-areas have been discussed that may also be useful in other
dimensioned circuit board, provided you are familiar with soldering projects (analog data acquisition, chargers, power supplies with digital
SMD components. Hot air works very well, but a soldering iron with setpoint specification, and current and voltage control in power
a fine tip will also do the job. As always, you should start with the electronics), this project is sure to be of interest to many readers.
smallest components, then work your way up, and finally fit the large Edited by Rolf Gerstendorf, translated by Jörg Starkmuth — 250109-B-01
through-hole components.

The storage choke, L5, must be insulated from the vias of the circuit board
using a heat-resistant film or a mica disc. The clips of the fuse holders
must be well tinned before soldering, to prevent cold solder joints.

Although the Arduino can be soldered directly onto the board by stick- About the Author
ing insulating film to its underside, it is better to provide a socket for Roland Stiglmayr studied information technology in the 1970s and
it. Either way, it should not be fitted until commissioning. The display has over 40 years of experience in research and development. His
is also mounted in a socket for better visibility. work has focused on the development of computer mainframes,
fiber optic-based data transmission systems, RRHs for mobile
The MOSFETs, T1, T2, and T3, must be cooled. Either place the module communications, and contactless energy transmission systems.
on a heat sink as shown in the title image and screw the transistors Today, he works as a consultant. He is particularly passionate about
onto this plate in an insulated manner, or mount the insulated MOSFETs sharing his knowledge.
on a heat sink with a thermal resistance of less than 3 K/W. T1 and T2
should not be fitted until commissioning.
Questions or Comments?
In Conclusion Do you have questions or comments about this article?
The solar charge controller is ideal for use with today’s standard solar Email the author at [email protected], or contact Elektor at
panels with 2×72 half cells. Another cost-effective option is to use four [email protected].
small panels with 36 cells each, connecting two in series and then
connecting the two series connections in parallel. This creates an ideal
arrangement in terms of shading [2]. In any case, the specifications
of the tracker must be observed.
Related Products
Due to its robustness and low price, a lead-acid battery [3] is the best > Waveshare Solar Power Management Module
choice for the battery. Lithium batteries can only be operated with an www.elektor.com/20488
additional battery management system that monitors voltage and current
and balances the cell voltage. It should be noted that the charging > Waveshare Solar Power Manager (C)
current should not be limited due to an unfavorable battery selection, as www.elektor.com/20490
otherwise the maximum available power will not be available to the load.

WEB LINKS
[1] Roland Stiglmayr, “Solar Charge Controller with MPPT,” Part 1, Elektor 5-6/2025: https://elektormagazine.com/250109-01
[2] Elektor Special: Solaranlagen und Photovoltaik [German]: https://elektor.de/20597
[3] Walter Ribbert, “Pimp My Car Battery Charger (Part 1),” Elektor Circuit Special 2024: https://elektormagazine.com/240040-01
[4] Download: https://www.elektormagazine.com/labs/solar-charge-controller-with-mpp-tracking

July & August 2025 87


PROJECT

Figure 1: A neat PCB to hold the Arduino Nano.

Ultrasonic
Obstacle Detector
A Simple Project to Help Those
with Impaired Vision

By Pascal Rondane (France)

Read how a simple ultrasonic sensor,


a vibrating motor, and one or two
microcontrollers turned into a practical
upgrade for a walking frame. This
ultrasonic obstacle detection module is
capable of identifying objects up to four
meters away.

This project originated with a request from my uncle, who lived in


a retirement home and experienced significant vision problems. He
used a walking frame, but had difficulty detecting obstacles in his
path, which were a daily challenge. To help him get around as best
as possible, I designed an ultrasonic obstacle detection module. It’s Figure 2: The vibration motor is bolted near the handle. A piece of
capable of identifying objects up to 4 m away, with a detection angle PVC pipe hides the wiring.
of approximately 20°. When an obstacle is detected, a red LED lights
up, and a micro motor activates to generate vibrations on the walker’s
frame, which can be felt by the user as a warning. Schematic
The schematic is shown in Figure 3. A custom PCB was designed to
First Version hold the Arduino Nano and provide connectors to ease the wiring of
To keep the project simple and modular, an Arduino Nano was used the vibration motor and the ultrasonic sensor module. Both the vibration
for this project, as well as a ready-made Grove ultrasonic sensor intensity and detection range are adjustable using two potentiome-
module from Seeed Studio (Figure 1). To generate vibrations is easy: ters RA1 and RA2. A jumper (JP1) allows quick selection of a default
simply attach an off-center mass to the shaft of a small motor. Here, detection distance of one meter and maximum motor power. The PCB
to make the task even easier, I used the Vibration Motor Unit (N20) connects to the micro motor module via a 10-pin connector, which
module from M5Stack [1], which, for just under three euros, provides is wired to a 3.5 mm, panel-mount stereo TRS jack on the enclosure.
a ready-made unit. Besides the motor and eccentric mass, it includes From there to the motor, a standard 3.5 mm stereo cable is used.
a flyback diode, a MOSFET to control the motor from a microcontrol-
ler GPIO pin, all housed in a plastic enclosure that’s easy to mount Power is supplied by a USB cable connected to a 5 V USB power bank.
near the handles of the walking frame using the two mounting holes A 10 Ah battery offers about one week of autonomy, and recharging
(Figure 2). is made convenient using a standard phone charger. A known issue

88 July & August 2025 www.elektormagazine.com


+5V

U2 GY-521
Motor Vibration
1 2
3 4
CD2
5 6

INT
VCC
GND
SCL
SDA
XDA
XCL
AD0
7 8
100n
9 10
U1 ARDUINO_NANO +5V
CN3 CD5
1 30
TX VIN
+5V 2 29
RX GND CD4 100n
3 28
RST RST
R1 4 27
+5V GND 5V 100n
5 26
D2 A7

10k
6 25
CN2 CD3 D3 A6
1 7 24 +5V
BLACK D4 RESET A5
2 8 23
RED D5 A4
3 100n 9 22
WHITE D6 A3
4 10 21 +5V
YELLOW D7 A2
R12 R9 11 20
Ultrasonic Sensor D8 A1
220Ω

220Ω

12 19
D9 A0
13 18
D10 AREF
14 17
Red DL1 Green D11 3V3 RA3
15 16
D12 D13 RA2
RA1
100k
USB 100k
JP3 JP1
100k
C1 C2 C3
+5V
100n 100n 100n

RA1 = Distance
R2
RA2 = PWM
RA3 = See text
R3 R4 R5 R6 R7 R8 R10
1k

150Ω

150Ω

150Ω

150Ω

150Ω

150Ω

100Ω

LED1 +5V

CN1

1
D VCC
T1 2 CD1
D–
3
G D+
4 100n
R11 GND
RFD14N05SM9A
S
100k

USB Mini

230653-011 Figure 3: Schematic of


the Arduino board.

with these USB power banks is their tendency to shut down when
current draw is too low. To prevent this, the circuit uses a MOSFET (T1)
to periodically activate load resistors (R3 to R8) for a few milliseconds,
drawing a short current pulse to keep the power bank awake. LED1
gives a visual indication of these pulses. This approach is inspired
by the “USB Battery Interface” project published in Elektor [2]. The
potentiometer RA3 controls the interval to keep the USB battery from
switching off.

A bi-color LED (DL1) signals system status: green for normal operation,
red when an obstacle is detected. If desired, the LED can be disabled
with the JP3 jumper. On the PCB, I have added a footprint for an 8-pin
GY-521 module, using an MPU6050 accelerometer to be added in the
future to detect motion and automatically wake the system. In the end,
this feature hasn’t been used.

Practical Build
The PCB and the ultrasonic transducer fit in a translucent Hammond
enclosure, which was mounted under the seat of the walker, with the
sensor pointing forward. The control box, battery and cables are secured
under the seat (Figure 4) using zip-ties and small, custom-made sheet Figure 4: Mounting everything under the seat.

July & August 2025 89


Figure 5: The sensor on its pivot.

Figure 6: Secondary board to drive the servo.


metal brackets. Of course, very short screws must be used, so that
they don’t go all the way through the wooden board.
SAMD21 module from Seeed Studio [3] that I had in stock. You can
Arduino Software see the result in Figure 6. Three potentiometers are provided to adjust
The software is quite simple; the detection distance, the vibration minimum angle, maximum angle and sweep rate. This allows a sweep-
intensity of the vibrations (i.e., the motor speed) and the delay period ing scan of up to 180° if needed. The schematic is shown in Figure 7.
used to prevent the USB battery from switching off can be configured.
Depending on the specific battery model you are using, the exact This secondary SAMD21 board is powered by connecting it to the first
timing of these pulses may need to be adjusted. A debug mode is also Arduino board described above, via connector CN1 (which connects
available to display real-time debug information via the serial monitor. to CN2 on the first board). In this way, the two PCBs and the ultra-
sonic sensor are daisy-chained, with the ultrasonic sensor connected
The Ultrasonic.h library needs to be included to enable the use of to CN2 of the SAMD21 module. This way, the wiring is kept simple; the
the Grove ultrasonic sensor: #include "Ultrasonic.h". Several primary Arduino board remains in charge of dealing with the sensor.
constants are then defined to manage the input and output pins, as The servo and sensor are protected by a small 3D-printed enclosure,
well as to set default values for various parameters. In setup(), the for which the 3D model file is available on Elektor Labs [4].
relevant input and output pins are configured, the PWM output as
well as the serial port are initialized. SAMD21 Software
The Arduino environment was also used to program the XIAO module.
In the main loop(), the program continuously measures the distance After including the Servo.h and Arduino.h libraries, the servo is attached
to an obstacle using the ultrasonic sensor with a builtin function to pin 9. The potentiometer inputs are configured, and serial commu-
in the Ultrasonic library (RangeInCentimeters = ultrasonic. nication is started at 9600 baud. In the main loop, the potentiometer
MeasureInCentimeters();) and reads the analog voltages on the values are read and converted into angles (between 0 and 180 degrees)
potentiometer inputs. When an object is detected within the configured and a sweep duration (up to 3000 ms). The servo.write() function
range, a red LED is illuminated and a PWM signal is sent to activate is used; this function takes the desired angle for the servo as an
the vibration motor. Finally, the main loop also keeps the USB power argument. For a smooth movement, I chose to move in 20 ms steps.
bank active by repeatedly switching
the load resistors on for a few milli-
seconds and then off again. +5V

The Project Evolves R2


+5V
Following real-world tests, my uncle CN1
470Ω

1
BLACK
(who was a particularly discern- RA1 = Angle min 2
RED
RA2 = Angle max CD2 LED1 3
ing user) pointed out that the 20° RA3 = Sweep time CD1 C2 WHITE
4
YELLOW
detection angle of the ultrasonic 100n ON 100n 100µ
To Nano Board
sensor was insufficient, especially +3V3 CN4
10V

for detecting obstacles on the sides 1


CN2
BLACK
of the walker. To increase the detec- 2
RED
3
tion range, several approaches
RESET

SWCLK

GND
SWDIO

CD3 WHITE
RA1 4
A0 5V +5V YELLOW
could be used; I chose to mount RA2
A1 GND 100n Ultrasonic Sensor
the ultrasonic sensor on a bracket, RA3
A2 MOD1 3V3 +3V3
10k
and make it pivot using a small RC 10k
A3 Xiao A10 R1
3
CN3
A4 SAMD21 A9 10Ω ORANGE
servo (Figure 5). 10k
A5 A8
2
RED
C6 C1 C3 C4
1
A6 A7 BLACK
GND

CD4 C5
VIN

100n 100n 100n 100n


As I wanted to avoid modifying the 10µ
Servo
100n
existing PCB and Arduino software, 10V

I used this as an opportunity to 230653-008

build a second PCB to control the


servo, this time using a small XIAO Figure 7: Schematic of the additional servo control module.

90 July & August 2025 www.elektormagazine.com


Listing 1: Snippet of the servo control code.
void smoothControl(int angleStart, int angleEnd, int duration)
{
int steps = duration / 20; // Divide duration into 20 ms steps
float increment = (angleEnd - angleStart) / (float)steps;
float angle = angleStart;

// Forward transition
for (int i = 0; i <= steps; i++) {
angle = angleStart + increment * i;
monServo.write(angle);
delay(20); // Wait 20 ms between each step
}

int durationForward = duration; // Use the calculated duration

// Return transition with the same duration


for (int i = steps; i >= 0; i--) {
angle = angleStart + increment * i;
monServo.write(angle);
delay(durationForward / steps); // Use the same duration for the return transition
}
}

Hence, the sweep duration (in milliseconds) is divided by 20 to give About the Author
the number of steps needed. The angle the servo needs to move in Pascal Rondane’s hobby has been electronics since he was a
each step is the total sweep angle angleEnd - angleStart divided teenager, and he has owned every issue of Elektor since the beginning
by the number of steps. A for loop is used to go through all the angles, of the French edition in 1978. He trained as an electronics technician
step by step. Then a similar loop is called, counting in reverse, for a and worked for 20 years in a company that maintained Motorola radio
smooth sweep in the opposite direction, as can be seen in Listing 1. equipment, and repaired electronic boards for IBM France. He then
worked for 22 years in after-sales service and test bench design in a
The sweeping sensor made it easier to detect obstacles on the sides, major French group manufacturing road signs. He’s been retired for
and turned out to be a useful addition. I’d like to think of this article as a a year, which leaves him more time for his favorite hobby, as well as
small tribute to my late uncle, whose request started it all; I’m glad this allowing him to take part in the activities of the Association du Centre
project could help him regain a degree of independence. I hope this Historique de la Diffusion Radiophonique (ACHDR), dedicated to
will inspire you with other ideas to help take care of your loved ones! the safeguarding of the French audiovisual heritage.
Many thanks to Vincent, Bastian, and Cyril for their valuable help.
230653-01

Related Products
Questions or Comments?
Do you have technical questions or comments about this article? > Seeed Studio Grove Ultrasonic Distance Sensor
Feel free to contact the author at [email protected] or Elektor www.elektor.com/20027
at [email protected].
> Ultrasonic Radar Robot Kit
www.elektor.com/20941

WEB LINKS
[1] M5Stack Vibration Motor Unit: https://shop.m5stack.com/products/vibration-motor-unit
[2] Pascal Rondane, “USB Battery Interface,” Elektor Circuit Special 2024: https://www.elektormagazine.com/230652-01
[3] XIAO SAMD21 by Seeed Studio: https://tinyurl.com/yrtxyaza
[4] Downloads: https://www.elektormagazine.com/labs/elektor-articles-software-downloads

July & August 2025 91


AI

Source: Antony Weerut / Adobe Stock


2025: An AI Odyssey
Mid-Year Review

By Brian Tristam Williams (Elektor) Multimodal Integration


The barriers between different types of data
From autonomous AI agents to multimodal systems that and processing have continued to dissolve
seamlessly blend text, image, and code, the first half of 2025 in 2025. AI systems that seamlessly work
across text, images, audio, and video are
has transformed AI from experimental novelty to everyday now standard rather than exceptional.
reality. But as capabilities soar, questions about productivity According to PwC, “multimodal AI is
gains and sustainability persist. What does this mean for revolutionizing product design and R&D
processes” [3] in manufacturing, allow-
makers and electronics enthusiasts? ing engineers to rapidly generate and test
designs that might have been overlooked
through traditional methods.
As we begin the second half of 2025, the first in January, has enabled enterprises such
half has brought remarkable developments as Brazil’s Banco BV to securely connect Microsoft’s expanded Copilot capabilities
in artificial intelligence, solidifying what AI agents across critical systems and data now include Copilot Daily, which provides
many predicted would be a year of transi- sources while maintaining compliance. personalized news and weather updates in
tion from experimentation to widespread Meanwhile, IBM reports that organiza- your preferred voice each morning while
practical implementation. tions are increasingly deploying AI agents respecting privacy and security [4]. This
to handle workflows and routine tasks, integration of AI across modalities and
The pace of innovation has become so rapid though their research indicates that “most everyday activities reflects how AI is becom-
that it’s increasingly difficult to stay current organizations aren’t agent-ready” yet [2]. ing more embedded in our daily routines,
with all the developments, so let’s review both professional and personal.
some AI trends that have emerged so far this This shift toward agentic systems represents
year and how they’re impacting both the a fundamental evolution from last year’s Global AI Competition
technology landscape and our community. focus on content generation to autono- Accelerates
mous reasoning and action. While the The first half of 2025 has seen a dramatic
The Rise of Agentic AI full capabilities promised by vendors narrowing of the performance gap between
Perhaps the most transformative trend of aren’t yet realized, the first half of 2025 American and Chinese AI models. Accord-
2025 has been the rise of agentic AI systems has shown that AI can increasingly work ing to Stanford University’s 2025 AI Index,
that can autonomously perform complex independently on meaningful tasks rather the performance gap between top US and
tasks with minimal human supervision. than merely generating content under Chinese models has shrunk from 9.26%
Google’s Agentspace platform [1], launched direct human guidance. in January 2024 to just 1.70% by February

92 July & August 2025 www.elektormagazine.com


2025 [5]. This trend extends across various there’s not enough electricity (or computa- Questions or Comments?
benchmarks for reasoning, mathematics, tional power) for every company to deploy If you have questions or comments,
and coding capabilities. AI at scale,” PwC notes [5]. This constraint [email protected] is my email
has driven innovations in more efficient address. You can also catch me on Elektor
This accelerating global competition has models and computing approaches. Engineering Insights each month on
been accompanied by increased attention to YouTube, and you can find me @briantw
semiconductor manufacturing and AI chip Interestingly, AI is simultaneously becom- on X.
development. As organizations grapple with ing a key tool for addressing sustainabil-
computational constraints, companies such ity challenges. Microsoft reports that AI
as Nvidia have faced growing competition tools are helping address pressing global
from alternative chip designs optimized for concerns such as climate change [4], while
specific AI workloads. Google’s AI-powered tools are reducing
the time required for complex scientific
The Productivity Reality Check research — decreasing both costs and
Despite the continued hype around AI’s environmental impact. About the Author
potential to revolutionize productivity, Brian Tristam Williams has been fascinated
2025 has brought a more nuanced assess- Coming Up in 2025 with computers and electronics since he
ment of real-world impact. While compa- As we move into the second half of 2025, got his first “microcomputer” at age 10.
nies are implementing AI at scale, very few several developments appear on the His journey with Elektor Magazine began
are “actually measuring productivity gains horizon. The focus on measurement and when he bought his first issue at 16, and
carefully or figuring out what the liberated optimization will likely intensify as organi- since then, he’s been following the world
knowledge workers are doing with their zations push to demonstrate concrete of electronics and computers, constantly
freed-up time,” according to the MIT Sloan returns on their AI investments. Regula- exploring and learning. He started working
Management Review [6]. tory frameworks will continue to evolve, at Elektor in 2010, and nowadays, he’s keen
with significant variations between regions on keeping up with the newest trends in
McKinsey’s research reveals that despite creating both challenges and opportunities tech, particularly focusing on AI and single-
significant investments, nearly half of for global companies. board computers such as Raspberry Pi.
C-suite leaders describe their AI initia-
tives as “still developing or expanding,” For our Elektor community, the democrati-
suggesting the full economic benefits zation of advanced AI capabilities presents
remain unrealized for many organizations. exciting possibilities. The ability to deploy
Related Product
This aligns with what we’ve observed in the sophisticated AI on edge devices, including
electronics and maker communities — AI the latest generation of Raspberry Pi and > D. Situnayake, J. Plunket:
tools are widely available, but integrating specialized AI accelerators, puts powerful AI at the Edge
them effectively into existing workflows tools in the hands of hobbyists and small- (O’Reilly Media, 2023)
www.elektor.com/20465
remains challenging. scale developers that were unimaginable
just a few years ago.
Sustainability and Resource
Constraints What AI developments have caught your
An emerging theme in 2025 has been attention in 2025? How are you incorporat-
the growing recognition of AI’s resource ing these technologies into your projects?
demands and the push for more sustainable Let me know — you can find contact details
practices. “AI requires so much energy that in the Questions or Comments? box!
230181-N-01

WEB LINKS
[1] Google: 2025 and the Next Chapter(s) of AI: https://tinyurl.com/google2025ai
[2] IBM: AI agents in 2025: Expectations vs. reality: https://tinyurl.com/ibmaiagents
[3] PwC: 2025 AI Business Predictions: https://www.pwc.com/us/en/tech-effect/ai-analytics/ai-predictions.html
[4] Microsoft: 6 AI trends you’ll see more of in 2025: https://tinyurl.com/ibm2025ai
[5] IEEE Spectrum: 12 Graphs That Explain the State of AI in 2025: https://spectrum.ieee.org/ai-index-2025
[6] MIT Sloan: Five Trends in AI and Data Science for 2025: https://tinyurl.com/sloan2025ai
[7] McKinsey: Superagency in the workplace: Empowering people to unlock AI’s full potential: https://tinyurl.com/mckinseywpai

July & August 2025 93


PROJECT

Raspberry Pi
Standalone MIDI
Synthesizer (3)
Making It Smarter and Adding a User Interface

By Brian Tristam Williams (Elektor)


Loading Pre-Trained Models
In Parts 1 and 2 of this series [1][2], we Magenta provides several pre-trained models. For our purposes, we’ll
transformed a Raspberry Pi into a standalone use a melody RNN model that can generate continuations of melodies
we play:
MIDI synthesizer and added basic intelligent
enhancements. Now, we’ll take a leap # Create a directory for models
forward by integrating actual AI capabilities mkdir -p ~/magenta_models
cd ~/magenta_models
and a user interface.
# Download a pre-trained melody RNN model
With the hardware for these experiments having been configured and curl -O https://storage.googleapis.com/magentadata/
plugged in, this final installment is quite code intensive. The actual models/melody_rnn/basic_rnn.mag
code will still be available at the GitHub repository for this project [3].
Building the AI MIDI Bridge
Implementing Machine Learning Models for Music Create a new Python script called ai_accompaniment.py (Listing 1)
Google’s Magenta project [4] offers powerful open-source tools for that will listen to your MIDI input, process it through the model, and
music generation using machine learning. In Google’s own words, it is output generated accompaniment.
“an open-source research project exploring the role of machine learn-
ing as a tool in the creative process.” I highly recommend checking This script listens to your MIDI input, collects it into a sequence, and
out their Demos page to get some creative inspiration. after you pause playing, it generates a continuation of your melody. The
AI-generated response is then played through your MIDI output port.
Let’s integrate some of these capabilities into our Raspberry Pi MIDI
system. Creating a Musical Style Transfer System
Let’s create another AI capability: transforming your playing into differ-
Setting Up the Environment ent musical styles using a simpler approach that’s better suited for
First, we need to install the necessary libraries. Open a terminal on the Raspberry Pi’s processing power.
your Raspberry Pi and run:
Create a new file called style_transform.py (Listing 2). This script trans-
sudo apt-get update forms your playing by applying stylistic elements like different scales,
sudo apt-get install -y python3-pip libasound2-dev chord extensions, and swing feels based on the selected musical style.
libjack-jackd2-dev This happens in real-time in the following order:
pip3 install magenta 1. When you play a note on your MIDI keyboard, the script intercepts it.
pip3 install python-rtmidi pip3 install tensorflow==2.4.0 2. It applies style-specific modifications (adjusting velocity, mapping
to the style’s scale, potentially adding chord extensions).
Note that we’re using a specific TensorFlow version that’s compatible 3. It may adjust timing to create a swing feel.
with the Raspberry Pi. 4. It outputs the transformed note to the MIDI output.

94 July & August 2025 www.elektormagazine.com


Listing 1: ai_accompaniment.py
import magenta.music as mm
import tensorflow as tf
import threading
import numpy as np
import time
import rtmidi
from magenta.models.melody_rnn import melody_rnn_sequence_generator
from magenta.music import sequences_lib
from magenta.protobuf import generator_pb2
from magenta.protobuf import music_pb2

# Set up MIDI input and output


midi_in = rtmidi.MidiIn()
midi_out = rtmidi.MidiOut()
in_port = 0
out_port = 1
midi_in.open_port(in_port)
midi_out.open_port(out_port)

# Initialize the model


tf.compat.v1.disable_eager_execution()
bundle = mm.sequence_generator_bundle.read_bundle_file('~/magenta_models/basic_rnn.mag')
generator_map = melody_rnn_sequence_generator.get_generator_map()
melody_rnn = generator_map['basic_rnn'](checkpoint=None, bundle=bundle)
melody_rnn.initialize()

# Buffer to store incoming MIDI notes


note_sequence = music_pb2.NoteSequence()
note_sequence.tempos.add(qpm=120)
current_notes = {}
last_note_time = 0

def generate_response(input_sequence):
# Set generation parameters
generator_options = generator_pb2.GeneratorOptions()
generator_options.args['temperature'].float_value = 1.0 # Higher = more random
generator_options.generate_sections.add(
start_time=0,
end_time=4.0 # Generate 4 seconds of music
)

# Generate the sequence


generated_sequence = melody_rnn.generate(input_sequence, generator_options)

# Convert the generated sequence to MIDI messages and play


for note in generated_sequence.notes:
if note.start_time >= input_sequence.total_time: # Only play the new notes
# Calculate when to play this note
delta_time = note.start_time - input_sequence.total_time
time.sleep(delta_time)

# Send note-on message


midi_out.send_message([0x90, note.pitch, note.velocity])

# Calculate note duration


duration = note.end_time - note.start_time
time.sleep(duration)
continued on next page

July & August 2025 95


# Send note-off message
midi_out.send_message([0x80, note.pitch, 0])

def midi_callback():
global last_note_time
while True:
message = midi_in.get_message()

if message:
midi_msg, delta_time = message

# Process note-on messages


if midi_msg[0] & 0xF0 == 0x90 and midi_msg[2] > 0: # Note on with velocity > 0
note = midi_msg[1]
velocity = midi_msg[2]
current_time = time.time()
last_note_time = current_time

# Add note to sequence


note_sequence.notes.add(
pitch=note,
velocity=velocity,
start_time=current_time - note_sequence.total_time,
end_time=current_time - note_sequence.total_time + 0.5, # Default duration
instrument=0,
program=0
)
current_notes[note] = len(note_sequence.notes) - 1

# Process note-off messages


elif (midi_msg[0] & 0xF0 == 0x80) or (midi_msg[0] & 0xF0 == 0x90 and midi_msg[2] == 0):
note = midi_msg[1]
if note in current_notes:
note_idx = current_notes[note]
note_sequence.notes[note_idx].end_time = time.time() - note_sequence.total_time
del current_notes[note]

# If we’ve collected enough notes and there’s a pause, generate a response


if len(note_sequence.notes) >= 8 and time.time() - last_note_time > 1.0:
# Update the total time of the sequence
note_sequence.total_time = time.time() - note_sequence.total_time

# Generate a response in a separate thread


threading.Thread(target=generate_response, args=(note_sequence,)).start()

# Reset for next input


note_sequence = music_pb2.NoteSequence()
note_sequence.tempos.add(qpm=120)
current_notes = {}

time.sleep(0.001) # Small sleep to prevent CPU hogging

# Start the MIDI callback in a separate thread


midi_thread = threading.Thread(target=midi_callback)
midi_thread.daemon = True
midi_thread.start()
try:
print("AI Accompaniment running. Play your MIDI keyboard to generate responses.")
print("Press Ctrl+C to exit.")
while True:
continued on next page
time.sleep(1)

96 July & August 2025 www.elektormagazine.com


except KeyboardInterrupt:
print("Exiting...")
midi_in.close_port()
midi_out.close_port()

Listing 2: style_transform.py
import rtmidi
import time
import random
import numpy as np

# MIDI setup
midi_in = rtmidi.MidiIn()
midi_out = rtmidi.MidiOut()
midi_in.open_port(0)
midi_out.open_port(1)

# Style definitions
STYLES = {
'jazz': {
'chord_extensions': [9, 11, 13], # 9th, 11th, 13th extensions
'swing_ratio': 0.67, # Swing feel
'velocity_variance': 15, # More dynamic expression
'scale': [0, 2, 3, 5, 7, 9, 10] # Dorian scale (for jazz feel)
},
'classical': {
'chord_extensions': [7], # Simpler harmonies
'swing_ratio': 0.5, # No swing
'velocity_variance': 10, # Moderate dynamics
'scale': [0, 2, 4, 5, 7, 9, 11] # Major scale
},
'electronic': {
'chord_extensions': [4, 7], # Power chords and octaves
'swing_ratio': 0.5, # Straight timing
'velocity_variance': 5, # Less dynamic variance
'scale': [0, 2, 4, 7, 9] # Pentatonic scale
}
}
# Current style
current_style = 'jazz'

# Note tracking
active_notes = {}
note_history = []
last_timestamp = time.time()
beat_interval = 0.5 # 120 BPM (in seconds)
def apply_style_to_note(note, velocity):
"""Apply the current style's characteristics to a MIDI note"""
style = STYLES[current_style]

# Add velocity variance


new_velocity = min(127, max(1, velocity + random.randint(-style['velocity_variance'],
style['velocity_variance'])))

# Map to scale if needed


continued on next page
scale = style['scale']

July & August 2025 97


octave = note // 12
pitch_class = note % 12
closest_scale_pitch = min(scale, key=lambda x: abs(x - pitch_class))
new_note = (octave * 12) + closest_scale_pitch

# Occasionally add a chord extension


if random.random() < 0.3: # 30% chance
extension = random.choice(style['chord_extensions'])
extension_note = new_note + extension
if 0 <= extension_note <= 127:
midi_out.send_message([0x90, extension_note, new_velocity // 2])
active_notes[extension_note] = time.time()

return new_note, new_velocity

def adjust_timing(timestamp):
"""Apply swing feel based on current style"""
style = STYLES[current_style]
global last_timestamp, beat_interval

# Calculate position in beat


beat_position = (timestamp - last_timestamp) % beat_interval
beat_fraction = beat_position / beat_interval

# Apply swing if on off-beat


if 0.25 < beat_fraction < 0.5:
swing_adjustment = beat_interval * (style['swing_ratio'] - 0.5) * 0.5
return timestamp + swing_adjustment

return timestamp

def process_midi():
"""Process incoming MIDI messages and apply style transformations"""
while True:
msg = midi_in.get_message()

if msg:
message, timestamp = msg
command = message[0] & 0xF0

# Note on
if command == 0x90 and message[2] > 0:
note, velocity = message[1], message[2]
styled_note, styled_velocity = apply_style_to_note(note, velocity)
styled_time = adjust_timing(timestamp)

# Small delay to implement swing if needed


time_diff = styled_time - timestamp
if time_diff > 0:
time.sleep(time_diff)

midi_out.send_message([0x90, styled_note, styled_velocity])


active_notes[styled_note] = time.time()
note_history.append(styled_note)

# Keep history manageable


if len(note_history) > 32:
note_history.pop(0)

# Note off
continued on next page

98 July & August 2025 www.elektormagazine.com


elif command == 0x80 or (command == 0x90 and message[2] == 0):
note = message[1]
# Find any transformed version of this note
for active_note in list(active_notes.keys()):
if abs(active_note - note) <= 2: # Allow for slight pitch mapping
midi_out.send_message([0x80, active_note, 0])
if active_note in active_notes:
del active_notes[active_note]

# Other MIDI messages (pass through)


else:
midi_out.send_message(message)

# Release hung notes after 5 seconds


current_time = time.time()
for note in list(active_notes.keys()):
if current_time - active_notes[note] > 5.0:
midi_out.send_message([0x80, note, 0])
del active_notes[note]

time.sleep(0.001)

def cycle_style():
"""Change to the next available style"""
global current_style
styles = list(STYLES.keys())
current_index = styles.index(current_style)
next_index = (current_index + 1) % len(styles)
current_style = styles[next_index]
print(f"Style changed to: ")

# Set up a separate thread for button handling if using the Pirate Audio buttons
try:
import RPi.GPIO as GPIO

# Pirate Audio button pins


BUTTON_A = 5
BUTTON_B = 6
BUTTON_X = 16
BUTTON_Y = 24

GPIO.setmode(GPIO.BCM)
GPIO.setup(BUTTON_A, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_B, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_X, GPIO.IN, pull_up_down=GPIO.PUD_UP)
GPIO.setup(BUTTON_Y, GPIO.IN, pull_up_down=GPIO.PUD_UP)

def button_callback(channel):
if channel == BUTTON_A:
cycle_style()

GPIO.add_event_detect(BUTTON_A, GPIO.FALLING, callback=button_callback, bouncetime=300)

print("GPIO buttons configured. Press Button A to cycle through styles.")


except:
print("GPIO setup failed. Button functionality not available.")
if __name__ == "__main__":
print(f"Style Transformer running. Current style: ")
print("Play your MIDI keyboard to hear the transformation.")
print("Press Ctrl+C to exit.")
continued on next page

July & August 2025 99


try:
process_midi()
except KeyboardInterrupt:
print("Exiting...")
midi_in.close_port()
midi_out.close_port()
try:
GPIO.cleanup()
except:
pass

Creating an Interactive User Interface


Let’s utilize the Pimoroni Pirate Audio’s ST7789 display to show the
current AI mode and provide visual feedback. Of course, any other
display may be utilized with suitable code adjustments, but I happen
to have the Pirate Audio one (Figure 1), for which the midi_display.py
is at [3].
Figure 1: I decided to switch up from the Raspberry Pi Zero 2 W to a beefier
This script creates a user interface on the Pirate Audio display showing Raspberry Pi 5 with 16 GB of RAM.
the current AI mode, MIDI activity, and button functions. The Pirate
Audio board has four buttons (A, B, X, Y) in this implementation:

> Button A: Cycles through modes on the main screen, navigates Using crontab make this script executable and set it to run at startup.
up in menus, increases values when editing settings. Crontab (short for “cron table”) is a time-based job scheduler in Unix-like
> Button B: Opens settings menu on the main screen, navigates operating systems, including the Raspberry Pi’s Linux distribution. It
down in menus, decreases values when editing settings. allows users to schedule commands or scripts to run automatically
> Button X: Save functionality (saves presets), edits selected at specified times or intervals.
settings, confirms selections.
> Button Y: Load functionality (loads presets), navigates back, Use this line to enter crontab:
cancels editing.
chmod +x ~/start_midi_ai.sh crontab -e
Button A cycles through the available modes (FluidSynth, AI Melody,
Jazz Style, Classical, Electronic). The interface shows the current mode And then add this line to the crontab:
and status on the display.
@reboot /home/pi/start_midi_ai.sh &
Combining Everything with an Auto-Start Script
Let’s create a master script that will start our entire MIDI AI system at Finally, exit the nano editor by using Ctrl-X, Y, then Enter.
boot. Create a file called start_midi_ai.sh (Listing 3).

Listing 3: start_midi_ai.sh
#!/bin/bash

# Start FluidSynth as a service


systemctl restart fluidsynth

# Connect MIDI devices after a short delay


sleep 5
aconnect 24:0 128:0 # Adjust these numbers to match your hardware

# Start the display interface


python3 /home/pi/midi_display.py &

# Log startup
echo "MIDI AI System started at $(date)" >> /home/pi/midi_ai.log

100 July & August 2025 www.elektormagazine.com


Performance Optimization for AI Models Final Thoughts
Running machine learning models on the Raspberry Pi can be We’ve now transformed our simple MIDI setup into an AI-powered
resource-intensive. Here are some tips to optimize performance: musical companion. The system can:

1. Use TensorFlow Lite: Instead of the implementation in this project > Respond to our playing with generated melodies
— especially for lower-power devices — we could use TensorFlow > Transform our input into different musical styles
Lite, as it’s designed for edge devices. > Provide visual feedback on the Pirate Audio display
> Start automatically at boot
2. Quantize TensorFlow models: This reduces model size and speeds
up inference. As computing power on edge devices continues to improve, and as
AI models become more efficient, we’ll be able to run increasingly
# Add to your Python setup script sophisticated musical intelligence directly on edge devices such as the
converter = tf.lite.TFLiteConverter. Raspberry Pi. Future enhancements could include full band accompa-
from_saved_model(saved_model_dir) niment (perhaps even on an array of Raspberry Pis!), learning from your
converter.optimizations = [tf.lite.Optimize.DEFAULT] specific playing style, or even voice-controlled music generation.
quantized_tflite_model = converter.convert() 240714-C-01

3. Reduce model complexity: When using Magenta models, opt for


smaller network configurations to decrease computational demands Questions or Comments?
and memory usage, especially on resource-constrained devices If you have questions or comments, email me at
like the Raspberry Pi. For Magenta network configurations, the best [email protected]. You can also catch me on Elektor
concise explainer is probably the Melody RNN model config page Engineering Insights each month on YouTube, and you can find
in the Magenta repo at [5]. me @briantw on X.

4. Offload computation: If we really want to branch out to more


complex tasks, we could consider offloading to a more powerful
computer on our network, but the Raspberry Pi 5 with 16 GB RAM
Related Products
works well enough for me — for now.
> G. Spanner, Machine Learning with Python for PC,
Raspberry Pi, and Maixduino (E-book, Elektor, 2022)
www.elektor.com/20150

> D. Ibrahim, A. Ibrahim, Practical Audio DSP Projects


with the ESP32 (Elektor, 2023)
www.elektor.com/20558

oject
See the pr ere!
in action h

WEB LINKS
[1] Brian Tristam Williams, “Raspberry Pi Standalone MIDI Synthesizer (1),” Elektor 3-4/2025: https://elektormagazine.com/240714-01
[2] Brian Tristam Williams, “Raspberry Pi Standalone MIDI Synthesizer (2),” Elektor 5-6/2025:
https://elektormagazine.com/240714-B-01
[3] GitHub repository for these experiments: https://github.com/briantw/pi-midi
[4] Magenta Project: https://magenta.tensorflow.org/
[5] Magenta’s Melody RNN README.md — GitHub repository: https://tinyurl.com/melodyreadme

July & August 2025 101


PROJECT

Meshtastic:
A Demo Project An Intelligent Mesh of LoRa Radios

By Bera Somnath (India)

Despite their scalability, long range,


low power consumption and security
with data encryption, LoRa modules
were not very suitable for mesh
networking. That was before the arrival
of Meshtastic, an open-source platform
that filled this gap. Meshtastic allows
a very effective mesh network to be
created with LoRa modules, and most Figure 2: The finished prototype of the homemade LoRa board, ready for
importantly, at low cost! firmware flashing.

Ever since Long Range (LoRa) radios hit the market, lots of IoT devices Whilst the ZigBee network is highly scalable, the LoRa network is not
are appearing in the market now and then. Besides LoRa, there is one lagging much behind. Besides, LoRa has a very long range, low-power
more standard which is already occupying the market segment with consumption, highly encrypted and is immune to electromagnetic
various applications, and that is ZigBee. Although ZigBee devices interferences.
are substantially costly, still they are in use due to their exceptionally
easy meshing capability. ZigBee radios can be placed in mesh config- Meshtastic Network
urations, where every ZigBee will be connected as a node with each Meshtastic [1] has brought an open-source software to create a LoRa
other (Figure 1), such that if one or more nodes fail, the network will mesh network. LoRa works great on Line of Sight (LOS). Therefore,
still be available. if one or two nodes can be placed at a strategically high place, then
all nodes will easily talk to each other. There are already many works
available on the Internet. Here, I just tried to create a practical working
network for readers, where sensor data, GPS position and triggering
alarms can be easily worked out.

The Project
To make a workable mesh network for testing, we need to build three or
more LoRa nodes, with an ESP32 board and a LoRa module (Figure 2),
or purchase ready-made ESP32 LoRa boards from the market, for
example the WiFi LoRa 32 [2] from Heltec (Figure 3). Furthermore,
at least one I2C sensor from the following list has to be procured:

> BME280
> BME680
Figure 1: A typical mesh network. (Source: Adobe Stock) > MCP9808

102 July & August 2025 www.elektormagazine.com


Modules Needed
> Heltec WiFi LoRa 32 with I2C OLED & SPI LoRa
(3 sets)
> BME280 (Temperature, Pressure, Humidity) -or-
> MCP9808 (Temperature)
> u-blox NEO-6M or NEO-7M GPS Sensor (1 piece)

Instead of the ready-made Heltec LoRa module, you


can also buy these modules separately:

> ESP32 Dev Module - Google: esp32-38pin-


development-board-wifi-bluetooth-ultra-low-power-
consumption-dual-core
> I2C OLED 0.96 Inch - Google: 0-96-inch-yellow-
yellow-blue-oled-lcd-led-display-module
> SX1278 868 MHz LoRa Radio - Google:
lora-module-rfm95w-868s2r
Figure 3: An “off-the-shelf” Heltec LoRa module.

> INA260 webpage [3]. This tool will only work in Chrome or Edge browsers.
> INA219 However, the command line interface (CLI) method of uploading does
> SHTC3 not have this limitation.
> SHT31
> PMSA0031 The website with the Meshtastic flashing tool described above does
not provide flash facility for Heltec V1 or V2 boards. It starts working
Wiring Diagram with the Heltec V3 board upwards (and for higher level boards like
The wiring needed to link all the modules included in this project is T-Beam, T-Echo, T-Deck, etc.). The flash software firmware-heltec-v1-
shown in Figure 4. To flash an ESP32 board with Meshtastic software 2.2.12.092e6f2.bin available from [4] will flash the Heltec LoRa board,
(see also the textbox Compatible Boards), connect the board to your or the finished prototype of a ESP32 LoRa homemade board shown
computer’s USB port and then go to the Meshtastic online flasher in Figure 2.

ANT1
+3V3 +3V3 +3V3 +9V

15 16 ESP32S HiLetgo WiFi Module


GND
ANT

1 38 HT7333A
3V3 GND VCC
2 37
EN/RST GPIO23 GND
3 36 PWR
GPIO36/SVP GPIO22 SCL
LORA-SX1278 4 35
GPIO39/SVN GPIO1/TX0 SDA
14 Radio Module 5 34
DIO5 GPIO34 GPIO3/RX0 CSB
13 6 33
DIO4 GPIO35 GPIO21 SDO
7 32
REST

SCLK

GPIO32 GND
MOSI
MISO
DIO0

DIO3
DIO2
DIO1
GND

GND
VCC
NSS

8 31 BME280
GPIO33 GPIO19
9 30
12 11 10 9 8 7 6 5 4 3 2 1 GPIO25 GPIO18
10 29
GPIO26 GPIO5
11 28
GPIO27 GPIO17
12 27
GPIO14 GPIO16
13 26
GPIO12 GPIO4
14 25
GND GPIO0
+3V3 15 24 +3V3 +3V3
GPIO13 GPIO2
16 23
GPIO9/SD2 GPIO15
17 22
GPIO10/SD3 GPIO8/SD1
18 21 1 2 3 4
GPIO11/SDCMD GPIO7/SD0
GND
SCL
SDA
GND

VCC
PPS

VCC
EN

RX
TX

19 20
5V GPIO6/SDCLK
PWR PPS
EN IO0
USB

GPS Sensor Module

PPS

230679-018
SSD1306

Figure 4: Schematic: A generic GPS sensor (see text) is added. The PPS (Pulse Per Second) output signal is routed to an LED.

July & August 2025 103


Compatible Boards
The Meshtastic site is evolving continuously. When this
project was developed about two years back, it was only
ESP32 varieties of boards where Meshtastic was working.
Today the flasher [3] knows a variety of boards where
On the first screen (Figure 5a), select the firmware version you want the software can be installed, including boards from RAK
to flash (Heltec V1). Then, on the next screen (Figure 5b), select the Wireless, Seeed, Nordic (nRF52) and Raspberry Pi (Pico).
CP2102 USB to UART bridge — this is the interface hardware that sits The tool has even an auto-detect button to automatically
between the MCU and the computer. Next, follow the instructions discover the board.
that appear on the screen — like the warning about erasing the entire
device, etc. Ensure the Internet connection is stable during this crucial
4 to 5 minutes period. For the original Heltec board (V3 hardware
version), you may need to hold down the boot button for the entire 4 Windows commands:
to 5 minutes of the upload phase.
device-install.bat -f firmware-heltec-v1-2.2.12.092e6f2.
Uploading Software Through the Command Line bin
I’m providing this option as well, since I’ve found that the browser-based // for installing
firmware update doesn’t work reliably. Many times it indicates that it device-update.bat -f firmware-heltec-v1-2.2.12.092e6f2-
has completed the task rapidly, but actually, it did not. It takes about 4 update.bin
to 5 minutes to install/update the firmware. That’s why I have provided // for updating
the firmware and the CLI method in the download [4]. Also note that
the software will probably evolve many times from now on. There-
fore, having a stable copy around may be useful during a later setup. Project Set Up and Testing
To set up and test the project, we need to install the Meshtastic app on
MacOS commands/Linux commands: our Android phone, iPhone or tablet. There are both Android and iOS
versions available in the respective software stores. For three nodes
pip3 install --upgrade esptool to work with, I would request to fix one mobile/tab/Apple computer
// upgrade esptool first for each one node to play with. Following this way, you will actually
esptool.py chip_id avoid many setup jolts, which I learned the hard way. The application
// you will get a long output with chip id and chip is absolutely free, so no problem!
// mac id
cd ~/Downloads/firmware/ First, power on the LoRa node. Next, on your mobile/tablet/Apple/
// firmware-heltec-v1-2.2.12.092e6f2.bin PC, switch on the Bluetooth functionality and pair your device with
./device-install.sh -f firmware-heltec-v1-2.2.12.092e6f2. the LoRa node. The six-digit pairing number will appear on the OLED
bin screen. Once connected, open the Meshtastic app, and you will see
// for installing that the app is connected (look for the check mark at the top right)
./device-update.sh -f firmware-heltec-v1-2.2.12.092e6f2. to the board with the board’s MAC address. You can set a name for
bin the board in the wireless configuration by pressing the three dots on
// for updating the right top of the app.

Figure 5a and 5b: First steps to install the Meshtastic software on each ESP32 board.

104 July & August 2025 www.elektormagazine.com


Figure 6: Homemade Heltec-alike LoRa board fabr is now operational and connected. The other two nodes are still inactive.

Attaching Sensors
Only I2C sensors with the following addresses are allowed: 0x76, 0x77,
0x78, 0x18, 0x40, 0x41, 0x5D, 0x5C, 0x70, 0x44, 0x12, and 0x3C (fixed for
OLED). More sensors will hopefully be added in the future. To enable
detection, navigate to Radio Configuration → Detection Sensor →
Detection Sensor enabled.

You may provide a name for the sensor, such as BME or Temp_Ind. In
the same window, you can also designate a GPIO pin to monitor for
high or low signals. The detection will be monitored periodically every
900 s (default value) for high or low signals. Please note that this GPIO
pin status is entirely independent of the sensor value.

The homemade Heltec-alike node is now up and running (Figure 6). I


named it fabr (short for Fabricated One). The other two devices are not
operational yet. Figure 7 shows a screenshot of the Meshtastic app.

Role Configuration
In Radio Configuration → Device → Role, you can assign the role for
transmitting sensor values: Figure 7:
> SENSOR: Used for devices that gather and send sensor data. Screenshot of the
Optimized for low-power consumption and periodic data trans- Meshtastic app.
mission. These are strategically used for remote sensor data on The LoRa node at the
solar panels or battery power. top is up. The two at the
bottom are not up.
> CLIENT: Used for end-user devices that primarily consume and That’s why question
display data. These devices can also send commands but do not marks are appearing
relay messages within the network. against their names.

July & August 2025 105


To control a node via Wi-Fi, you need to know the IP address of the
node. Follow these steps:

> Go to your Wi-Fi DHCP list.


> Find the IP address and port of the node (the port is usually nil,
Figure 8: LED alarm fires up! On the app display, the sensor values are also the default).
visible. > From the command line of your Meshtastic installation (on PC
or Mac, see below), type the IP you’ve just found and a message
that you want to be broadcasted by your node.
> ROUTER_CLIENT: Acts to relay messages across the network.
Typically configured with higher power settings and kept station- $> meshtastic --host <device-ip> --info
ary to maintain network stability and reach. $> meshtastic --host <device-ip> --sendtext "Your message
> REPEATER: Acts as a signal booster, enhancing the range of here"
the mesh network by boosting the signal. Strategically placed
to cover larger areas or to connect distant nodes that are out of For reversing the configuration, simply reinstall the firmware. Despite
direct communication range. Like routers, they typically do not trying various methods, reinstalling the firmware is the only solution
sleep to ensure consistent signal boosting. that consistently works.

Remote Hardware Store & Forward Configuration


This section allows you to send signals from remote sensors. You must To enable Store & Forward, navigate to Radio Configuration → Module
first define a GPIO pin. However, only digital read and digital write Configuration → Store & Forward. This feature is only available for
functions are enabled here. ESP32. It allows you to store a few records in the event of discon-
nection from a node. However, please note that Meshtastic does not
External Notifications normally recommend using this feature.
To enable external notifications, navigate to Radio Configuration →
External Notification → Enable. You also need to set the output GPIO Serial Terminal
pins that will receive the notifications. You can assign an LED, alarm I absolutely love the serial terminal! If you have sensors that are not I2C
buzzer, or alarm vibrator to three different GPIO pins, along with the type, you can attach them to an Arduino and send the data over the
duration of the alarm. In my fabr unit, I have set the alarm on GPIO16 Serial port into the serial terminal of a Meshtastic node. The data will
to light an LED for 2000 ms. The sensor values will appear on the be read and transmitted over the nodes. Additionally, you can attach
Android/iOS screen and on the OLED screen (Figure 8). a serial monitor on two GPIO pins to monitor the serial data output
directly. I have created an “ESP32 Serial Terminal Viewer,” which you
Adding a New Node can try. You can find it on Elektor Labs [5].
There is no special rule to set up a LoRa node. Just set up the node,
power it on and it will be joined into the network.

GPS Location
If the board has a GPS locator (Figure 9), it will deliver the location
automatically. Otherwise, in case GPS is not fitted, if the Android/
iOS device has location information turned on, it will provide its own
GPS location, which will be visible and used for that node in the app
window. The app has the facility to attach a separate GPS sensor, for
which you must manually set the GPIO pins for TX and RX in Radio
Configuration → Position. After setting the GPS sensor, the location
data (latitude and longitude) will come from the GPS sensor. Currently,
only u-blox and GLONASS sensors are supported. My old V.KEL-GPS
sensor also worked when connected. The PPS (pulse per second) is
connected to an LED, which can be disabled to preserve battery life.

Wi-Fi Network Connection


Navigate to Radio Configuration → Network → Enable WiFi. Enter the
SSID and PSK for your network. Note: By doing this, your node will
be inaccessible via Bluetooth. You will have to access it from now on
through Wi-Fi or via the command line using Meshtastic, as explained Figure 9: The prototype with ESP32, LoRa and OLED screen. GPS module
below (note: this method is not very user-friendly). and BME280 sensor are added.

106 July & August 2025 www.elektormagazine.com


Channel Configuration water tank levels, and operating lifts equipped as LoRa nodes can be
At some point, you may need to separate your network from other overseen from a central monitoring center. Additionally, Meshtastic
networks operating on the same frequency band. Meshtastic networks LoRa networking enables communication with the nodes and can
can be secured by setting a custom channel key, a shared secret utilize MQTT to extend connectivity to other cities.
32-byte key used to encrypt messages. Only devices with the same
channel key can join and communicate within the network. To config- Benefits and Fun
ure this, navigate to Radio Configuration → Channel Configuration; The Meshtastic software demonstrates how a LoRa mesh can deploy
enter your secret key and repeat it for all nodes. Instead of a secret key, LoRa radios to achieve the best networking benefits, such as low power
you can also set a unique channel name to distinguish your network consumption, great range, and security. It’s fun to experiment with the
from others. network. Once the nodes are set up, you can disconnect the Android or
iOS devices, and the nodes will continue to operate automatically.
The secret key should be a 32-byte encoded key. There is a small 230679-01
circular arrow on the right of the Channel Key window. Pressing it
will generate a random 32-byte encrypted channel key. Alternatively,
you can use a small Python script (Channel-key.py) to create your Questions or Comments?
own channel key. Do you have technical questions or comments about this article?
Feel free to contact the author by email at [email protected]
import base64 or the Elektor editorial team at [email protected].
key = "abcdefghijklmnopqrstuvwxyz123456"
encoded_key = base64.b64encode(key.encode()).decode()
print(encoded_key)

Command Line Meshtastic


The app is convenient for many users. But, as I previously said, there
is also a CLI for Meshtastic to work with the hardware. Connect your About the Author
device to the USB port to get started. Somnath Bera, a mechanical engineer from Jalpaiguri Govt. Engg.
College, India, worked for 36.5 years at different capacity at NTPC,
$> pip install --upgrade pip [or pip3] the largest power producer in the country. He has a profound passion
$> pip install meshtastic [or pip3] for electronics, evidenced by his 60+ innovative projects on Elektor
$> meshtastic --version Labs, over 12 of which have been featured in Elektor. His projects
$> meshtastic --help are often focused on problem-solving in areas like waste and natural
$> meshtastic --port /dev/usbserial-xxxx --info resource management. Somnath likes to use innovative approaches
[usbserial-xxx is the port number ] and platforms like Arduino, Raspberry Pi, and ESP32 coupled with
$> meshtastic --setkey abcdefghijklmnopqrstuvwxyz123456 various kinds of sensors and wireless systems to create efficient
[to be encrypted channel key] and cost-effective solutions.
$> meshtastic --setch-name "S_Bera_SecureMesh"
[Set the channel name]

Typical Use
Related Products
In a forest area, a LoRa mesh network can be used to monitor forest
fires, with each node tracking air temperature, wind velocity, and humid- > Claus Kühnel, Develop and Operate Your LoRaWAN IoT
ity in its zone. In an industrial setting, this technology is effective for Nodes (Elektor, 2022)
monitoring fire hazards. In a city, turning all vehicles into LoRa nodes www.elektor.com/20147
allows for monitoring vehicle speed and position. For a township or
> 0.96" OLED Display for Arduino (128x64)
housing complex, V53LOX laser sensors can be employed to monitor www.elektor.com/18004

WEB LINKS
[1] Meshtastic website: https://meshtastic.org/
[2] WiFi LoRa 32(V3), ESP32S3 + SX1262 LoRa Node, Heltec Automation: https://heltec.org/project/wifi-lora-32-v3/
[3] Meshtastic flasher: https://flasher.meshtastic.org
[4] Software download at Elektor Labs: https://tinyurl.com/2psrnvdp
[5] “ESP32 Serial Terminal” at Elektor Labs: https://tinyurl.com/95rak5up

July & August 2025 107


www.elektor.com

Upgraded T-962 v2.0 SEQURE HT140 (2-in-1)


Reflow Soldering Oven SMD Soldering &
(Elektor Version) Desoldering Tweezers
This upgraded version 2.0 (available exclusively The SEQURE HT140 is a highly
from Elektor) contains the following versatile 2-in-1 soldering tool that
improvements: combines the functionality of hot
> Enhanced protective earthing (PE) for furnace tweezers and a soldering iron.
chassis It is specifically engineered for
> Extra thermal insulation precise SMD soldering and
layer around furnace to desoldering tasks.
reduce odors
> Connection to a
computer, allowing
curve editing on a PC

Price: €279.00 Price: €119.95


Special Price: €239.00 Special Price: €99.95

www.elektor.com/20346 www.elektor.com/21167

The Arduino Collection Wireless Power Design


(USB Stick)

Price: €49.95 Price: €39.95


Special Price: €39.95 Member Price: €35.96

www.elektor.com/21181 www.elektor.com/21177

108 July & August 2025 www.elektormagazine.com


Geekworm KVM-A3 Kit for Elecrow All-in-One Starter Kit
Raspberry Pi 4 (+ FREE E-book) for Raspberry Pi Pico 2

Price: €119.95 Price: €49.95


Special Price: €89.95 Member Price: €44.96

www.elektor.com/21139 www.elektor.com/21144

FNIRSI DSO-TC4 (3-in-1) Andonstar AD210


Oscilloscope (10 MHz) + 10.1” Digital Microscope
Transistor Tester +
Signal Generator

Price: €89.95 Price: €179.95


Special Price: €69.95 Special Price: €99.95

www.elektor.com/21146 www.elektor.com/20802

July & August 2025 109


PROJECT

Analog Audio
Frequency Generator
High-Quality Adjustable Frequency Sine Wave Generator

By Alfred Rosenkränzer (Germany)


A State Variable Filter is at the core of this design and consists of analog
Last year, we published a high-quality integrators together with a carefully controlled feedback coupling to
variable-frequency audio notch filter. create a band-pass filter with a very high quality (Q) factor. The level
of performance achieved by this filter would be difficult to attain using
To complete a typical test lab setup alternative, more basic circuit designs. The band-pass filter is made to
for measuring audio equipment oscillate by positive feedback. By combining this with active amplitude
performance, this article introduces control in the feedback loop, we can build a high-quality, low-distor-
tion adjustable audio frequency generator.
a high-performance audio frequency
generator with continuously adjustable The Block Diagram
output frequency control. The key The band-pass filter, shown in the block diagram of the adjustable
audio tone generator (Figure 1), shows that its passband frequency
component in both these designs is can be switched between three ranges using a front-panel mounted
something called a State Variable Filter. switch—just like the notch filter published in Elektor 9-10/2024 [1].

Figure 1: Block diagram


of the audio frequency
generator.

110 July & August 2025 www.elektormagazine.com


Component List
Resistors
Unless otherwise specified: C13, C14 = 2,200 µ / 16 V, Electrolytic 5 mm lead pitch, ø 13 mm,
MELF 0204 or thin film SMD 1206 outline, 1% tolerance C15…C18, C22…C28, C30…C32, C34, C35 = 100 n, X7R, SMD 0603
R1 = 100 Ω C19, C20, C33, C36…C38, C40…C43 = 22 µ / 20 V, Tantalum, SMC B
R2 = 510 Ω C21 = 220 µ / 16 V, Electrolytic 5 mm lead pitch, ø 10,5 mm
R3 = 150 Ω C44 = 3n3, X7R, SMD 0603
R4, R6, R8, R12 = 2k87 C45, C46 = 10 µ / 25 V, SMD 1206
R5 = 200 Ω, multi-turn upright trim pot C47 = 1 µ / 25 V, SMD 1206
R7 = 2k2 C48 = 47 p, SMD 0603
R9 = 0 Ω, SMD 0603 C50 = 10 µ / 25 V, SMD 1206, hand wired*
R10, R21 = not fitted
R11, R22 = 2k2 Semiconductors
R13 = 1k5 B1 = Bridge rectifier, B40C1000, DIL
R14, R64 = 0 Ω D1…D5 = 1N4148, DO214AC
R15 = 4k22 D5…D7 = SK34, DO214AC
R16 = 2k15 D8, D9 = BAV199 oder BAV99, SOT23
R17 = 1 k Linear dual gang pot 4 mm shaft IC1…IC3, IC9 = OPA2210, SOIC8
R18 = 10 k Linear dual gang pot 4 mm shaft IC4 = 7812, TO220
R19, R20, R26, R27, R44, R45 = 4k7, SMD 0603 IC5 = 7912, TO220
R23, R24, R28, R29, R46…R49 = 10 k, SMD 0603 IC6 = 7805, TO220
R25, R53, R56, R60…R62 = 220 Ω IC7, IC8 = TL072, SOIC8
R30, R31 = 1 k, SMD 0603 IC10 = NSL-32SR3*
R32, R33 = 47 Ω, SMD 1206 LED1, LED2 = LED, SMD 0805
R34 = 3k3 Q1…Q5 = 2N3904, SOT23
R35, R36, R40 =8k2, SMD 0603 Q6 = 2N3904, SOT23, hand wired*
R37 = 470 Ω, SMD 0603 VR1 = TL431, TO92
R38 = 100 Ω, SMD 0603
R39 = 100 k, SMD 0603 Miscellaneous
R42 = 100 k, multi-turn upright trim pot F1 = PCB mounted 20 mm fuse holder 250 mA.
R43 = 27 k, SMD 0603 JP1, JP3, JP4, JP7, JP8 = 2 way pin header strip 0.1″ pitch
R50 = 2k2, SMD 0603 JP2, JP5 = 4-way pin header strip. 0.1″ pitch
R51 = 5k1, SMD 0603 JP6 = 3-way pin header strip, 0.1″ pitch
R52 = 10 k, linear potentiometer 4 mm shaft K1, K2, K3, K4 = SMD relay, 5 V, Coto Technology 9802-05-00
R54, R55, R57…R59 = 3k3 TR1 = PCB mounted mains transformer, 2 × 12 V / 3.6 VA, Gerth 387.24.2
R63 = 1k1 X1 = 3-way terminal strip, 5 mm pitch, AK300/3
R65 = 4k7, hand wired* X2 = 2-way terminal strip, 5 mm pitch, AK300/2
X3, X4 = PCB mounted BNC socket, e.g., AMP 227161 BNC
Capacitors 2× 1-pole. 3-position switch
C1, C7 = 39 n, COG, SMD 0805 3× control knobs for 4 mm shaft pots
C2, C8 = 100 n, COG, SMD 1206 PCB
C3, C11 = 1n2, COG, SMD 0603
C4, C12 = 33 n, COG, SMD 0805 * see text
C5, C9 = 680 p, COG, SMD 0603
C6, C10 = 15 n, COG, SMD 0603

Coarse and fine frequency control potentiometers are mounted on implemented using the relay-controlled “Attenuator for Audio Signals”
the front panel. The signal amplitude control consisting of a rectifier, featured in the Elektor Circuit Special 2024 [3] or more simply with
filter, amplifier, reference voltage, control amplifier, and optocoupler a rotary switch. Attenuation step sizes of 6 or 10 dB would be ideal. If
has been borrowed from the “Analog 1 kHz Generator” circuit featured no additional attenuator is used, the corresponding connections are
in Elektor 7-8/2024 [2]. The output stage also comes from that circuit bridged using a 0-Ω resistor (R64).
but has been slightly modified here.
In the first version of the audio generator, I used an OPA1632 differen-
The output level is adjusted via a potentiometer. The three-position tial op-amp to generate differential output signals but it introduced too
selector switch sets the gain to 0, 6, or 12 dB (corresponding to x1, x2, much distortion. By the fifth iteration of the circuit (Version E), it was
and x4). An optional stepped attenuator can be placed between the replaced with a conventional dual op-amp. In theory, you could leave
amplifier’s output and the input to the final output stage. This can be this out entirely, but that would result in a single, unbalanced output.

July & August 2025 111


D8
BAV199

C44 3n3
R47 R49
10k 10k
R39
+12V C45 10µ
100k 2
R46
5 1
R43 10k IC7A
Q5 2 7 3
R38 27k IC8B
1 6
100Ω IC8A
3 R41
D9
2N3904 R44 BAV199 C48 47p

47k
LED + JP4 LSP8 4k7
Opto Control C50
6
Voltage R42
7
100k 10µ IC7B R50
VR1 5
Amplitude R45 Q6 R48 2k2
– TL431 C47

4k7

10k
R37 R40 R51

5k1

470Ω

8k2
C46 10µ
2N3904

–12V

C1 39n +5V +5V 39n C7

C2 100n 100n C8
K1 7 5 3 1 1 3 5 7 K3
9802-05-00

9802-05-00
D1 D3
R65

1N4148 1N4148
4k7

8 6 4 2 2 4 6 8

Q1 R19 R26 Q3
4k7 4k7

R23 R28
2N3904 2N3904
10k

10k

JP2
R31 1
C3 1n2 +5V +5V 1k 2 Range +5V 1n2 C11
R30 3
C4 33n 1k 4 33n C12
K2 7 5 3 1 1 3 5 7 K4
9802-05-00

9802-05-00

D2 D4

1N4148 1N4148

IC10
8 6 4 2 2 4 6 8
NSL-32SR3
C5 680p 680p C9
Q2 R20 R27 Q4
4k7 4k7
C6 15n 15n C10
R24 R29
2N3904 2N3904
10k

10k

R16
2k15
2
R13
1 6
IC2A 1k5 R21
3 7 2
IC2B NB R25
R11 5 R22 1
IC3A 220Ω
3
2k2

2k2

R15
4k22

R10 R9
R18B
Coarse

5k R18A
NB

5k
R14

R17B
Fine
500Ω R17A
500Ω

R5 R7
2k2
JP1 R8
R3 200Ω
2k87
150Ω

R4
2k87 R12
R2 2k87
2
510Ω R6
R Opto IC1A
1 6
2k87
3 7
IC1B
R1 5
100Ω

240463-006

Figure 2: The audio signal generator circuit diagram and some elements of the design are taken from my previous projects.

112 July & August 2025 www.elektormagazine.com


+5V IC6
7805

R33

47Ω
C33 C30 C21
The complete power supply design has also been borrowed from the
R32
22µ 220µ
100n
25V 47Ω previously mentioned notch filter design [1].
X2

D5

+12V B1
TR1
Details
IC4
7812
SK34 F1
Figure 2 shows the circuit diagram for the most recent Version E of
250mA
the design. The State Variable Filter is built around four op-amps: IC1B,
D6
C19 C17 C15 C13
L IC2A, IC2B, and IC3A. Just like the circuit used in the notch filter, the
N

SK34
22µ 100n 100n 2200µ PE frequency range can be switched between three bands using four
16V
X1
relays that control the frequency-determining parallel wired capacitors:
D7
C1||C2, C3||C4 and C5||C6 as well as C7||C8, C9||C10 and C11||C12.
C14
C20 C18 C16
In this design, the achievable frequency range extends from 175 to
22µ 2200µ
SK34 100n 100n
16V 5500 Hz. Two twin-ganged potentiometers mounted on the front panel
allow continuous control of the output signal frequency: R18 for coarse
7912
and R17 for fine adjustments. Feedback control used by the system is
–12V IC5
provided by IC1A, via an optocoupler (the variable resistance element
+12V of the optocoupler IC10 at JP1).

The sine wave output from IC3A drives the active rectifier around IC7,
C22 C24 C26 C28 C31 C34 C36 C38 C40 C42 which is part of the amplitude regulation circuit. Its output signal level
100n 100n 100n 100n 100n 100n 22µ 22µ 22µ 22µ is smoothed by R46 and C47 and fed to the input of IC8B which has a
8 8 8 8 8 8
IC1 IC2 IC3 IC7 IC8 IC9
fixed voltage gain of 2. The core regulation stage, built around IC8A,
4 4 4 4 4 4
compares this rectified and filtered output signal amplitude with the
C23 C25 C27 C29 C32 C35 C37 C39 C41 C43
reference voltage from VR1. The resulting voltage level defines the
100n 100n 100n 100n 100n 100n 22µ 22µ 22µ 22µ
current through the opto coupler’s LED via transistor Q5 which influ-
ences the value of its resistive element to control the gain of IC1 and
–12V
close the feedback loop. This section of the circuit is almost identical
to that used by the 1 kHz audio generator design [2].

3
R61 X3 To expand the amplitude control range, R3 (in parallel with the resistor
1
IC9A
2
220Ω
in optocoupler IC10) has been increased to 150 Ω, and R2 changed
R57 to 510 Ω. Resistor R37 has also been swapped for a 470 Ω to allow
3k3 4
R58 3 for a higher current through the optocoupler LED. Extra components
3k3
R59
2
1
— C50, Q6, and R65 — have been added to increase the smoothing
3k3
JP5 capacitor effect at low frequencies. There wasn’t enough space on
R53
5
6
7
R62 X4 the PCB to accommodate these components, so they were wired
220Ω R64 R56 IC9B 220Ω
IC3B
7
0Ω 220Ω
5 by hand.
6
R52
R55 R60
3k3 220Ω The amplitude of the output signal is continuously adjustable using
10k R63 R54 JP7 JP8 potentiometer R52 and is buffered by IC3B. If needed, a switch at JP6
can be fitted to provide additional amplification by a factor of 2 or 4
1k1

3k3

+12V

R35 (connect JP6 pin 2 to pin 1 for 6 dB or to pin 3 for 12 dB gain). The
3 2 1
JP6 additional gain will however result in increased output signal distor-
8k2

tion. A switchable output attenuator can also be inserted between J7


12dB

6dB

LED1
Gain
(input) and J8 (output). If an external attenuator is used, R64 (a 0-ohm
K6 LED2 resistor) must not be fitted.
LED R36
R34 Front For the differential output stage, I originally intended to use the OPA1632
3K3

8k2

ultra-low distortion differential audio amplifier but its performance in


the prototype was disappointing. In the final design, I opted for the
–12V –12V
OPA2210 dual opamp for IC9A and IC9B to provide the differential
output stage. Pads on the PCB are provided to mount right-angle
BNC connectors (X3 and X4) for the differential output signals. Alter-
native output connectors can be wired to the output signals available
at header strip JP5 if required.

July & August 2025 113


Figure 3: The prototype PCB (version A) fitted into its case. Figure 4: Front panel of the prototype design. The gain switch and stepped
output attenuator are not fitted in this version.

The entire power supply design was taken from the notch filter [1]. Questions or Comments?
Its configuration is completely conventional and doesn’t really need Do you have questions or comments about this article? Email the
any explanation. author at [email protected] or contact the Elektor
editorial team at [email protected].
Figure 3 shows the populated PCB (this is still the first prototype
Version A) installed inside its case. The PCB layout files can be
downloaded in Eagle format from the Elektor Labs website [4]. Figure 4
shows the front panel labeling. The output stage gain switch is missing
from this version. The stepped attenuator option is also not included in
this first prototype. For calibration and setup, refer to the correspond- About the Author
ing section in the 1 kHz generator article [2]. Alfred Rosenkränzer worked for many years as a development
engineer, initially specializing in professional television technology.
Quality Components Are Key Since the late 1990s, he has been designing digital high-speed
The quality of the output signal doesn’t just depend on a well-de- and analogue circuits for IC testing. His special interests are in all
signed circuit — it’s crucial that high quality components are used, things audio.
especially when you are designing high-performance linear or audio
circuits. For this reason, all resistors used in the signal path are Mini
MELF 204 format, as they offer the same high-quality performance as
leaded metal film resistors. Thin-film resistors in the 1206 SMD format Related Products
can also be used. It is important to use COG-type capacitors in this
design. The performance of the entire circuit would be compromised > OWON SDS1102 2-ch Oscilloscope (100 MHz)
www.elektor.com/18782
if a single X7R-type capacitor were substituted for any of the COG
types. The high-performance OPA2210 opamp is used throughout the > Douglas Self, Small Signal Audio Design
circuit for processing audio signals. (4th Edition, Focal Press)
Translated by Martin Cooke — 240463-01 www.elektor.com/18046

WEB LINKS
[1] Alfred Rosenkränzer, “Audio Notch Filter with Adjustable Frequency,” Elektor 9-10/2024:
https://www.elektormagazine.com/magazine/elektor-354/63208
[2] Alfred Rosenkränzer, “Analogue 1 kHz generator,” Elektor 7-8/2024:
https://www.elektormagazine.com/magazine/elektor-346/62910
[3] Alfred Rosenkränzer, “Attenuators for Audio Signals,” Elektor Circuit Special 2024:
https://www.elektormagazine.com/magazine/elektor-350/63040
[4] Analogue Audio Generator, Elektor Labs: https://tinyurl.com/ysns2nut

114 July & August 2025 www.elektormagazine.com


Brand new, high performance,
64-bit application framework
with full support for international
character sets and theming.

PROTEUS 9 ...THE START OF A NEW ERA

Proteus VSM Simulation


• System Scope with live circuit Proteus PCB Design
probing.
• Versioning of managed libraries with
• Live results on graph based
either repository or local folder.
simulations.
• Software wide support for restricting
• Visual Designer for MicroPython.
use to managed libraries.
• IoT Builder for MicroPython.
• Lightning fast, live power plane
regeneration.
• Via Inspector tool for board analysis.

Tel: +44 (0)1756 753440

July & August 2025 115


Design Develop
Discover
mouser.co.uk
12S
654-CL90555DT324

673-100B-1003XT

340103211B
654-10-504637-008

A17251-09

11350

CB5347-000
RSPST070856

Order - with - Confidence

116 July & August 2025 www.elektormagazine.com

You might also like