Elektor 536 2025
Elektor 536 2025
95
*
1
*
IN
CE 196
Including
RISC-V:
16 Bonus Pages
by eeNews
Europe!
Future
16 Boards &
MCUs You
FOCUS ON
Should Know
Embedded & AI
AI Prevents An FPGA-Based i n g D i g i t al
x
Damage Audio Player with Mi
Au
Equalizer a n A rd u i n o M io
d
Predictive with
KR
Maintenance Vi d o r 4 0 0 0
in Practice
Jens Nickel
Volume 51, No. 536 International Editor-in-Chief, Elektor Magazine
March & April 2025
ISSN 1757-0875
For all your questions Since then, I’ve had the opportunity to learn more firsthand: I met an expert at a symposium
service@elektor.com who is himself part of a standardization committee, and I also spoke with Calista Redmond, at
that time CEO of the RISC-V Foundation, at a trade fair. Today, RISC-V has become an everyday
Become a Member
tool for all of us in development. That’s precisely why we decided to make the open-source
www.elektormagazine.com/membership
ISA our cover story (written by Elektor engineers Saad Imtiaz and Jean-François Simon). As a
hands-on magazine, we wanted to show that there are now high-quality boards available for
Advertising & Sponsoring
Büsra Kas
every need and performance class, which can be used for developing IoT, audio/video, AI, and
Tel. +49 (0)241 95509178 many other projects (page 6).
busra.kas@elektor.com
www.elektormagazine.com/advertising Personally, I’m not particularly fascinated by the high-end boards costing several hundred
euros, but rather by the other end of the spectrum. RISC-V makes it possible to use a microcon-
Copyright Notice troller for just 10 cents in your own projects. Here’s a small preview of the next issue: Frequent
© Elektor International Media b.v. 2025 contributor Tam Hanna will bring such a controller to life in a hands-on article and test how
well it works with the associated IDE.
The circuits described in this magazine are
for domestic and educational use only. All
Our colleagues from news platform eeNews Europe also regularly report on RISC-V. In this issue,
drawings, photographs, printed circuit board
layouts, programmed integrated circuits,
you’ll find about 16 extra pages from their news portal, including articles created exclusively
digital data carriers, and article texts published for us. On page 120, for example, we cover a RISC-V processor that can handle GPU, CPU, and
in our books and magazines (other than even FPGA functions within a single architecture.
third-party advertisements) are copyright
Elektor International Media b.v. and may not What else is in this Embedded and AI issue? As an audio enthusiast, I highly recommend
be reproduced or transmitted in any form our FPGA-based audio mixer (page 14). It’s amazing what can be achieved in terms of quality
or by any means, including photocopying, and features with an Arduino MKR board for well under €100. You should also check out the
scanning and recording, in whole or in part tool we introduce on page 50, which provides developers with valuable insights into what’s
without prior written permission from the
happening inside their microcontrollers during program execution. Both articles impressively
Publisher. Such written permission must also
demonstrate how far you can go with hobby projects.
be obtained before any part of this publication
is stored in a retrieval system of any nature.
Patent protection may exist in respect of
Get involved in development!
circuits, devices, components etc. described
in this magazine. The Publisher does not
accept responsibility for failing to identify such
patent(s) or other protection. The Publisher
disclaims any responsibility for the safe and
proper function of reader-assembled projects
based upon or from schematics, descriptions
or information published in or in relation with
Submit to Elektor! Elektor Labs
Elektor magazine. Your electronics expertise is welcome! Ideas & Projects
Want to submit an article proposal, an The Elektor Labs platform is open to
Print electronics tutorial on video, or an idea everyone. Post electronics ideas and
Senefelder Misset, Mercuriusstraat 35, for a book? Check out Elektor’s Author’s projects, discuss technical challenges and
7006 RK Doetinchem, The Netherlands Guide and Submissions page: collaborate with others.
PEFC/30-31-151 www.pefc.org
Sylvia Sopamena, Patrick Wielders | Publisher: Erik Jansen | Technical Questions: editor@elektor.com
Regulars Projects
3 Colophon 14 An FPGA-Based Audio Player with Equalizer (1)
Mixing Digital Audio with an Arduino MKR Vidor 4000
92 From Life’s Experience
Choice Overload 20 Laser Head for Pico-Based Sand Clock
Drawing with Light
94 Starting Out in Electronics…
…Continues Filtering and Controls Tone 24 A Multi-Sensor Environmental Monitoring System for Plants
Wireless Measurement of Water Supply and Lighting
108 2025: An AI Odyssey
Conditions
The Rise of Foundation Models and
Their Role in Democratizing AI 34 Maixduino AI-Powered Automatic Doorman
Face Detection with a Camera
117 Err-lectronics
Corrections, Updates, and Readers’ Letters 56 USB 2.0 Isolator
Electrically Isolated Connections for USB Devices
74 ECG Graph Monitoring
20
Predictive Maintenance in Practice
82 The Battle for AI at the Edge
124 Dual-Core Programming with a Raspberry Pi Pico Laser Head for
Venture into the World of Parallel Programming Pico-Based
Sand Clock
Drawing with Light
72 Color TV: A Wonder of Its Time Elektor Magazine’s May & June 2025 edition will be published
Creating a New World around May 14, 2025.
87 HaLow Hits Record 16 km Wi-Fi Distance at 900 MHz Arrival of printed copies for Elektor Gold members is subject to transport.
www.elektormagazine.com/
Embedded & AI embedded-ai
RV32IMAC
AMOSWAP.W 32 bits
RV32A C.FLD C.OR
Atomic Instruction ISA Extension C.LWSP C.XOR
MULHSU 32 bits
RV32M C.SW C.SLLI
Integer Multiplication and Division ISA Extension C.FSW C.SRLI
WEB LINKS
[1] Stuart Cording, “What Is RISC-V?,” elektormagazine.com, April 2021: https://elektormagazine.com/articles/what-is-risc-v
[2] Mathias Claussen, “BL808 and Cohorts: A Look at New RISC-V MCUs,” elektormagazine.com, June 2023:
https://elektormagazine.com/articles/bl808-and-cohorts-new-riscv-mcus
[3] RISC-V Instruction Set, RISC-V ISA pages, GitHub: https://msyksphinz-self.github.io/riscv-isadoc
[4] RISC-V on Wikipedia: https://en.wikipedia.org/wiki/RISC-V
[5] Arm vs. Qualcomm Dispute, Capacity Media: https://capacitymedia.com/article/arm-pulls-qualcomms-architecture-licence
[6] Warren Gay, RISC-V Assembly Language Programming (Elektor 2022):
https://elektormagazine.com/articles/why-risc-v-assembly-language
[7] Embedded Development with RISC-V [French]: https://riscv-mcu.defert.com
[8] High-performance RISC-V Datacenter Processor from SiFive:
https://sifive.com/press/sifive-announces-high-performance-risc-v-datacenter-processor-for-ai-workloads
[9] LLM Optimization and Deployment on SiFive RISC-V: https://sifive.com/blog/llm-optimization-and-deployment-on-sifive-intellig
[10] Ventana Micro Systems: https://ventanamicro.com
[11] 1,000 Cores on a Chip, VLSIFacts: https://tinyurl.com/et-soc-1-chip
HiFive1 Rev B
The HiFive1 Rev!B is an entry-level board designed for IoT and edge computing,
powered by the FE310-G002 processor, which includes a 32-bit RV32IMAC core.
Costing around $65, its 16!KB!L1 instruction cache, 16!KB data SRAM, and support
for flexible clock generation make it efficient for lightweight applications. With a USB
debugger upgraded to SEGGER J-Link-OB and compatibility with SiFive Freedom
Studio, developers benefit from seamless drag-and-drop flash programming and
robust debugging tools. This board is ideal for prototyping IoT devices, developing
low-power applications, and exploring the fundamentals of RISC-V development.
https://sifive.com/boards/hifive1-rev-b
VisionFive 2 SBC
The VisionFive 2 is the world’s first high-performance RISC-V SBC with an integrated
GPU, powered by the StarFive JH7110 SoC. With a quad-core CPU running up to 1.5!GHz
and support for up to 8!GB LPDDR4 memory, it excels in multimedia processing and
dual-display output via HDMI and MIPI DSI interfaces. Features such as three USB
3.0 ports, Gigabit Ethernet with PoE, and GPIO headers make it a strong contender
for IoT, lightweight servers, and edge computing. Its robust multimedia capabilities,
including 4K video decoding and encoding, make it ideal for developers exploring
high-performance RISC-V applications in cost-effective projects, which is currently
sold on Amazon’s website for $99.
https://starfivetech.com/en/site/boards
Milk-V Megrez
The Milk-V Megrez is a Mini-ITX RISC-V device powered by the Eswin EIC7700X SoC,
featuring a quad-core SiFive!P550 CPU at 1.8!GHz. Its built-in GPU supports advanced
graphics standards such as OpenGL ES 3.2 and Vulkan 1.2, while the 19.95 TOPS NPU
enables local AI processing for applications in machine learning and robotics. With
support for up to 32!GB LPDDR5 memory, multiple storage options, including SATA
SSDs and eMMC, and a range of connectivity options like HDMI, USB 3.0 and dual
Gigabit Ethernet, this board is ideal for AI development, high-performance computing,
and multimedia tasks. Its compatibility with Linux and versatile hardware interfaces
make it a significant step forward in RISC-V desktop computing. You can grab this
powerful board for $200.
https://milkv.io/megrez
Milk-V Mars
The Milk-V Mars is a compact and high-performance RISC-V SBC powered by the
StarFive JH7110 SoC, featuring a quad-core CPU clocked up to 1.5!GHz. It supports
up to 8!GB of LPDDR4 memory, an eMMC slot, and SPI flash for bootloader storage,
making it highly adaptable for development tasks. With three USB!3.0 ports, one USB!2.0
port, and an HDMI!2.0 output supporting 4K resolution, it is well-suited for multime-
dia projects, lightweight servers, and general-purpose Linux development. Additional
features such as a 40-pin GPIO, PoE-enabled Ethernet, and MIPI interfaces for cameras
further enhance its versatility, enabling use in IoT, edge computing, and embedded
systems. At around $70 for the 8!GB variant, it’s a steal for the performance it delivers.
https://milkv.io/mars
Banana Pi BPI-F3
The Banana!Pi BPI-F3 is an industrial-grade RISC-V development board powered by
the SpaceMiT K1 8-core RISC-V processor, which integrates 2.0 TOPS of AI comput-
ing power. It offers flexible configurations with 2/4/8/16!GB DDR and up to 128!GB
eMMC storage. With dual Gigabit Ethernet ports, four USB 3.0 ports, PCIe for M.2
expansion, and support for HDMI and dual MIPI-CSI cameras, this board excels in
advanced prototyping, industrial applications, and AI-driven tasks. Its compatibility
with Linux distributions and diverse hardware interfaces makes it ideal for high-per-
formance computing and robust development environments. Available at $70, it strikes
a perfect balance between cost and capability.
https://banana-pi.org/en/banana-pi-sbcs/175.html
BeagleV Ahead
The BeagleV Ahead is an open-source RISC-V SBC powered by the T-Head TH1520
SoC, featuring a 2!GHz quad-core XuanTie C910 processor with advanced GPU and
NPU capabilities. Its compatibility with BeagleBone Black cape headers allows for
hardware expansion, making it suitable for robotics, AI, and multimedia applications.
With support for Linux and open-source frameworks, it is designed to enable develop-
ers to explore the potential of RISC-V architecture in complex AI and machine learning
projects. For only $150, this SBC punches well above its weight.
https://beagleboard.org/boards/beaglev-ahead
WCH CH32V307V-EVT-R1
The WCH CH32V307 on the CH32V307V-EVT-R1 board is a feature-rich RISC-V
microcontroller designed for interconnected applications. It runs at up to 144!MHz,
with a single-precision FPU and hardware stack area for improved performance. The
controller includes 64-KB SRAM, 256-KB Flash, and a wide range of peripherals, such
as eight UART ports, USB 2.0 HS, Ethernet with built-in PHY, and multiple timers. Its
GPIOs can be mapped to external interrupts, and it supports ADC, DAC, SPI, and I2C
interfaces, making it versatile for industrial automation, real-time data processing, and
communication-centric tasks. Its efficient low-power modes and robust connectivity
make it a solid choice for advanced embedded systems. You can find the dev board
at different suppliers (including the Elektor Store) for around €20.
https://github.com/openwch/ch32v307
Raspberry Pi Pico 2
Raspberry Pi surprised everyone by adding two Hazard3 RISC-V cores to the recent
RP2350 powering the Raspberry!Pi Pico!2! It offers 520!KB of SRAM, 4!MB of flash
storage, 26 multi-purpose GPIO pins, including 4 that can be used for ADC, and a
comprehensive set of peripherals including two UART interfaces for serial communi-
cation, two SPI plus two I2C controllers and 24!PWM channels. Additionally, the board
includes 12!PIO (programmable I/O) state machines and a USB!1.1 controller with PHY
supporting both host and device modes. Priced at only $5, the Pico!2 is perfect for
learning and experimenting with RISC-V.
https://raspberrypi.com/products/raspberry-pi-pico-2
An FPGA-Based
Audio Player
with Equalizer (1)
Mixing Digital Audio with an Arduino MKR Vidor 4000
WEB LINKS
[1] The Arduino MKR Vidor 4000: https://docs.arduino.cc/hardware/mkr-vidor-4000/
[2] ESP32 Package for the Arduino IDE: https://docs.espressif.com/projects/arduino-esp32/en/latest/installing.html
[3] Quartus Prime Lite from Intel: https://www.intel.com/quartus
[4] An Arduino library that uploads your custom FPGA bitstream: https://github.com/HerrNamenlos123/JTAG_Interface
[5] Software for Arduino Vidor boards: https://github.com/wd5gnr/VidorFPGA/tree/master/C
[6] Application Note from NTI Audio: https://www.nti-audio.com/Portals/0/data/en/NTi-Audio-AppNote-AES3-AES-EBU.pdf
[7] Simple AES3 or SP/DIF receiver on OpenCores: https://opencores.org/projects/aes3rx
[8] Author’s GitHub repository: https://www.github.com/xn--nding-jua
b•
or la Elekt
kt
Ele
or
lab
ORIGIN
AL
Ele k
ab
rl rl
to
• Ele k to
ab
By Clemens Valens (Elektor)
In January 2017, Elektor published the Sand Clock, a novel clock that
wrote the time in a sand bed [1]. It was based on an Arduino UNO. A
year later, a modification was published [2] that replaced the sand bed
by a sheet of glow-in-the-dark film and the pen by an ultraviolet laser.
The laser clock was more discreet than the Sand Clock, as it didn’t need
to shake the sand bed every time to clear it before writing the new time.
!
A second update [3] added a stand to allow the laser clock to be placed
vertically on a horizontal surface instead of hanging it on a wall. A PIR
sensor was added too, so the clock could be made to write the time
only if there was someone around to see it.
!
A few years later, the Sand Clock with the PIR sensor option was Figure 1: The new laser head mount has a ring rather than a grip to hold the
redesigned to use the Raspberry Pi Pico instead of the Arduino UNO. laser.
suitable level. The laser, on the other hand, needs a 5!V supply, and so V_USB
! D2...D4 = S2J-E3
Note that the new laser head is compatible with the original Arduino-
DC1
C1
based Sand Clock from 2017. It requires a similar modification for the
laser’s power supply as described above. Refer to [2] and [3] for the VIBRATION
100n
! R11
330
Software Update
100k
The software of the Raspberry!Pi Pico-Based Sand Clock has been
updated to drive the laser instead of the vibration motors. The main
240647-001
changes are the dimensions of the new pantograph arms that differ
slightly from the Sand Clock and, of course, the On/Off control of the
laser that replaces the vibration motor control. Figure 4: The red line shows the electrical modification of the main board.
!
While we were working on the new software, it was thought interesting
to add a vector-drawing option to the clock. The functions required to
draw lines, arcs, and circles were already available in the clock’s software,
and the observant user might have noticed the comments describing
serial commands for them in the source code. Therefore, we added
the possibility to receive a drawing script and execute it. Instead of just
writing the time, the clock can now also be used to create ephemeral
works of art (Figure 6).
!
Furthermore, as the Raspberry Pi Pico has plenty of program memory,
scripts can also be placed in memory. This allows you to create anima-
tions, turning the clock in a fun decorative object for, e.g., Christmas
or other special events. Making a script is a bit laborious, though, as
it requires you to convert a drawing into line and arc segments with
millimeter coordinates. However, a PCB design program like KiCad or a
mechanical 2D-design program capable of drawing in millimeters can Figure 5: The electrical modification in practice.
help you here. We’ve left the implementation of a g-code interpreter as
used by CNC machines as an exercise to the reader. !
! The following commands can be used:
Drawing Commands !
The commands available for drawing are simple text-based commands f: Script start, not required when a script is stored in internal memory.
that can be sent over a serial link. Make sure that the serial port speed @: End of script, not required when a script is stored in internal memory.
of your terminal program is set to 115,200!baud (with eight databits, no !
parity, one stopbit, i.e., 115200n81). Also, serial commands must be termi- pld: Laser head down.
nated with both CR (carriage return) and LF (line feed). In Tera Term this plu: Laser head up.
is configured in Setup! Terminal! New-Line! Transmit: CR+LF. To le: Laser enable (on).
send a script file using Tera Term, use the File! Send File command. ld: Laser disable (off).
WEB LINKS
[1] Ilse Joostens & Peter S’heeren, “Sand Clock - A Real Eye-Catcher,” Elektor 1-2/2017:
https://elektormagazine.com/magazine/elektor-201701/40130
[2] Ilse Joostens & Peter S’heeren, “Laser Time Writer - Writing with light,” Elektor 1-2/2018:
https://elektormagazine.com/magazine/elektor-201801/41254
[3] Ilse Joostens & Peter S’heeren, “Laser Time Writer - Revisited!,” Elektor 7-8/2018:
https://elektormagazine.com/magazine/elektor-201807/41746
[4] Downloads for this article: https://elektormagazine.com/labs/laser-head-for-raspberry-pi-pico-based-sand-clock
Explore the cutting edge of artificial intelligence and edge comput- The STM32N6570-DK Dev Kit
ing by participating in the STM32!Edge AI!Contest, powered by The first high-performance STM32 MCU with AI acceleration is
STMicroelectronics. This is your chance to bring your most innova- your ultimate tool for advanced prototyping and development.
tive Edge!AI ideas to life using the STM32N6570-DK Discovery Kit. With the STM32N6570-DK Discovery Kit, you can bring your AI
Whether you’re an experienced developer or a passionate maker, this vision projects to life with unparalleled ease and efficiency. Whether
competition is your platform to demonstrate your expertise, creativity, you’re developing next-gen applications or exploring innovative
and problem-solving skills. prototypes, this kit has everything you need to succeed. Elevate
! your AI projects today!
Timeline
> Deadline for Project Ideas:!30!April 2025 Key Features
> Deadline for Final Project Submissions:!1!September 2025 • STM32N657!microcontroller — with Neural-ART accelerator and
> Nominees Revealed: 30!September 2025 4.2 MB SRAM
> Grand Winner Announcement: November!2025 — Stay Tuned! • STLINK-V3 debugger — Effortless debugging and programming
! • STMod+!& Arduino UNO connectors — Expand with unmatched
Prizes flexibility
> 1st!Prize: €2,500 • MIPI connector — High-speed camera interface for seamless
> 2nd!Prize: €1,500 AI vision
> 3rd!Prize: €1,000 • 2!USB ports!— Lightning-fast data transfer
! • 1 Gbit Ethernet — Reliable, high-speed networking
Visit www.elektormagazine.com/stm32ai for details and to submit a • 32 MB Hexadeca-SPI PSRAM — Power your most complex tasks
project. With €5,000 in cash prizes up for grabs, the judges are looking • Audio Jack and Codec— Built-in audio for versatile applications
for Edge AI-driven projects that inspire and innovate. Your journey to • MicroSD Card Slot — Simplify storage expansion
cutting-edge innovation starts now! • 5″ capacitive multi-touch display
250006-01 • 2 User LEDs!and 3 Buttons
• ST AI Camera Module included
• Fan-Out Board with mikroBUS socket and Grove connectors
included
!
Find out more
https://st.com/en/evaluation-tools/stm32n6570-dk.html
A Multi-Sensor
Environmental
Monitoring
System
for Plants
Wireless Measurement of
Water Supply and Light Conditions
Source: Adobe Stock
By Alain Romaszewski (France) My goal was to create a multi-sensor environmental monitoring system
for plants and greenhouses, using a wireless development board from
This project was designed to care STMicroelectronics and various sensors to measure soil moisture,
for indoor plants or a greenhouse temperature, humidity, air quality, and light conditions. It wirelessly
transmits data via the Zigbee protocol, with the ability to remotely
during times when you may be control irrigation and lighting, and stores the collected data in an
away, while also storing data to SQL database. Automation is managed through Node-RED, allowing
analyze and optimize watering real-time adjustments and remote monitoring through a web interface.
!
cycles. It uses the An overview of the project is shown in Figure 1. The STM32WB5MM-DK
STM32WB5MM-DK board with development board is coupled to a custom-made extension shield, all
multiple sensors and Zigbee integrated in a 3D-printed case. This main module integrates several
internal sensors to measure environmental conditions. External sensors
communication, alongside are used to monitor soil moisture and soil temperature for three differ-
software like Node-RED and ent plants. For water supply management, the board controls the
Zigbee2MQTT for automation irrigation pumps for the three plants and checks that enough water
is left in the reservoir using the sensor. When it comes to lighting,
and remote control. The project the system measures luminosity and controls the lighting based on
was entered in the ST Wireless these readings.
Innovation competition organized !
The data gathered by these various sensors are transmitted as attri-
by Elektor and ST — and won the butes over the Zigbee protocol. (See more details in the text frame
second prize. More about Zigbee.) A USB dongle is used as a wireless interface
and the ZigBee2MQTT application, installed on a Windows!11 machine,
creates a Zigbee Coordinator, which additionally bridges between
ZigBee events and a remote MQTT server. Each attribute defined in the
measurement system updates on the MQTT server, and any changes
made on the server can be sent back to the measurement system.
!
Internet
RF USB dongle
STM32WB5MM-DK + Sensors
Water Tank
Figure 1: General architecture of the project. Figure 3: The STM32WB55MM-DK development board.
Since the data is accessible via the MQTT server, I chose to use water each plant individually from a shared reservoir. A three-part
Node-RED to subscribe to the server and track events, enabling enclosure, designed for easy mounting of the PCB and the additional
automation. In my case, Node-RED is running on a Virtual Private daughterboards (see below) while allowing button access, was 3D
Server (VPS) hosted by OVH and running Debian. The Dashboard printed with ASA material.
feature of Node-RED provides a user interface accessible through a !
web browser from all over the world. Furthermore, all data is stored in Sensors
an SQL database for further analysis. The system can be seen being For each plant, a soil moisture sensor is used. Like all the sensors in this
used in Figure 2. project, these are easy to find at various places on the internet. They
! are capacitive, with two electrodes forming a capacitor. A 1-MHz signal
Main Board is applied to the electrodes. The capacitance between the electrodes
The STM32WB5MM-DK board (Figure 3) is built around the changes with the soil’s moisture content, which changes the frequency.
STM32WB5MMG microcontroller from STMicroelectronics, which That frequency change is finally converted into an output voltage.
includes a Cortex M4 core and a Cortex M0+ communication copro- To protect the electronic components of the sensor, I 3D-printed an
cessor. To operate, the coprocessor needs to be flashed with the appro- enclosure in ASA material and filled it with two-part resin. The result
priate firmware based on the selected protocol and settings. The board is shown in Figure 4.
provides 1!MB of flash memory and 256!KB of RAM. !
! An ADS1115 (16-bit, four-channel analog-to-digital converter) from TI
I use the integrated temperature sensor on the board. This board connected via the I2C1 bus is used to measure the voltage from the
has two I2C interfaces named I2C1 and I2C3; the temperature sensor soil moisture sensors. I found this converter and sensor arrangement
connects to the latter. Measurements are displayed on the onboard to be fairly robust against interference caused by noise and long wire
LCD screen, and navigation through the various display screens is lengths. The soil moisture sensors have been modified to operate on
controlled via two buttons. Other I/Os (including the I2C1 bus and six
other GPIOs) available through the Arduino-compatible set of headers
are used for managing pump and light controls, water level readings,
and interfacing with the soil temperature sensors.
!
The board is powered through USB; I also installed a battery backup
to supply three low-power water pumps (operating at 3!V), used to Figure 4: Soil moisture sensor.
Programming
Figure 5: Custom PCBs to connect sensors. Firmware (version 1.18 in this case) from the manufacturer must be
downloaded into the memory area reserved for the M0+ radio proces-
sor. There are several firmware options for BLE, Thread, Zigbee, and
3.3!V by removing the voltage regulator and are connected to three BLE-Zigbee combinations, which are selected based on the specific
inputs of the ADS1115 analog-to-digital converter. One input of the use case. These firmware versions (the current version is 1.20) can
converter is used to measure the battery voltage, which is divided by be found online [1].
two to respect the ADS1115’s maximum input voltage. !
! The programming for this project was carried out using the C language
To monitor soil temperature, three DS18B20 sensors from Analog and the STM32CubeIDE 1.14 environment. The project is based on an
Devices are used, each housed in a stainless steel tube. These sensors example from the STM32WB library [2]. The example program can be
operate over a shared 1-wire bus. Other environmental measurements, found online [3]. The system uses a pseudo-preemptive multitask-
such as temperature, humidity, and pressure, are provided by a BME280 ing model specific to STMicroelectronics and includes
sensor from Bosch, while CO2 , total volatile organic compounds advanced functions for processor communication.
(TVOC) and indoor air quality (IAQ) levels are measured using an However, the provided example does not utilize a
ENS160 sensor from ScioSense. An AHT25 sensor (Aosong) is also known real-time operating system (RTOS).
used for temperature and humidity compensation. Finally, luminosity !
is measured by a VEML7700 lux meter from Vishay. All these sensors
operate on the I2C1 bus. The water level in the tank is monitored using
a capacitive sensor mounted at the low level of the tank.
!
External Interfaces
An Arduino-compatible interface card was developed to simplify sensor
connectivity. This card includes a switching power supply module to
power the sensors and recharge the battery, which provides additional
power for the pumps. It also houses the ADS1115 converter on a PCB
module. Additionally, a custom interface card was made to control the
pumps. This PCB has several N-channel power MOSFETs connected
to the microcontroller’s ports. The interface boards are shown on
Figure 5; see the connected sensors in Figure 6. Another external
module, equipped with a solid-state relay in a custom 3D-printed
enclosure, is used to control a 230!V!/ 200!W light source. Figure 6: Connected sensors.
!
Configuration of cluster
and fix atrtributes default
values
Zigbee
Stack
started ? yes
Button 1 Erase NVM memory
pressed
no
Read each Sensor and write
Attributes
Already yes Start Commissioning to
commissionned coordinator
?
no
Zigbee no
Stack
started ? Load NVM memory Wait for coordinator
yes
yes
Button2 Next screen
pressed ?
In this case, for physical measurements, a client-server architecture running time pump. If this attribute is non-zero, the pump starts
is used, where the client is the PC while the server is the STM32WB- and the value is decremented until it reaches zero, at which point
5MM-DK. The Zigbee coordinator/client is responsible for regularly the pump stops. Each pump is controlled by a separate I/O pin, and
querying the server’s attributes in order to retrieve and store the infor- the ON/OFF status of each pump is reflected in the state pump
mation. To perform actions, the coordinator can modify the values of attribute. Lighting control is similarly managed through the light
the attributes on the endpoint, the latter upon receipt will execute state attribute.
the requested tasks, indicating its status by modifying the attributes. !
! A flowchart of the program is shown in Figure 7, with the automation
To help with this, STMicroelectronics provides a pre-compiled library thread detailed in Figure 8. The function for reading sensor data and
for cluster management. A Zigbee cluster is a group of related attri- transmitting it to the cluster attributes is too lengthy to show in full,
butes and commands within a Zigbee device that defines a specific but key portions are displayed in Listing 1.
functionality, such as temperature measurement or lighting control, !
standardized across Zigbee devices for interoperability. I chose to Zigbee Processing
use a standard temperature measurement cluster. The application The Zigbee stack is initialized in the file Application/User/STM32_
was configured on Zigbee channel!15, with a single server endpoint. WPAN/App/app_zigbee.c, with the the functions APP_ZIGBEE_Init,
A basic cluster is automatically added by the stack. Proprietary attri- APP_ZIGBEE_StackLayersInit, APP_ZIGBEE_ConfigEndpoints, as
butes are then added to this standardized cluster. well as some other functions managing commissioning and persistence
! with non-volatile memory (NVM).
All sensors are queried cyclically, and the results are stored in the !
respective cluster attributes. By default, this occurs every 20!s, though Network formation is carried out by the APP_ZIGBEE_NwkForm function.
the time interval can be modified through the measuring time loop A standardized temperature measurement cluster was created, and
cluster attribute. additional attributes necessary for the project were added. This
! was done in the modules app_cluster.c and app_cluster.h, with the
Automation of the pumps is handled by setting a pump activation AddProjectCluster(void) function, which adds a cluster to the
time, specified in milliseconds, via the corresponding Zigbee attribute application. The implementation of this function is shown in Listing 2.
!
Current light
yes
Light state attribute value state different
Start or Stop light of attribute
value ?
yes yes
Pump Value Pump State Pump State Started
Different of Started ? Start Pump
yes
End
if (status != ZCL_STATUS_SUCCESS) {
APP_DBG("Error Writing Att. temperature in cluster %d", status);
}
APP_DBG("T:%.1f C", temp);
// Read temperature, pressure and ambient humidity with BME280
read_bme280();
if (dev.Error != 0) {
APP_DBG("Error reading BME280: %d", dev.Error);
}
vuint16t = (uint16_t)(dev.pressure * 10);
status = ZbZclAttrIntegerWrite(zigbee_app_info.clusters[IDCLUSTER_CARD],
ATTENVPRESS, (uint16_t)vuint16t);
if (status != ZCL_STATUS_SUCCESS) {
APP_DBG("Error Writing Att. Pressure in Cluster");
}
vint16t = (int16_t)(dev.temperature * 100);
if (status != ZCL_STATUS_SUCCESS) {
APP_DBG("Error Writing Att. temperature in Cluster");
}
vuint16t = (uint16_t)(dev.humidity * 100);
status = ZbZclAttrIntegerWrite(zigbee_app_info.clusters[IDCLUSTER_CARD],
ATTENVHUM, (uint16_t)vuint16t);
if (status != ZCL_STATUS_SUCCESS) {
APP_DBG("Error Writing Humidity in Cluster");
}
APP_DBG("Temp: %.2f - Hum: %.2f - Press: %.2f", dev.temperature, dev.humidity, dev.pressure);
return;
}
{
"write":
{
"cluster": "msTemperatureMeasurement", "options": {},
"payload": {
"PlantWaterAlimentation1": 1000
}
}
}
{
"read":{
"attributes" :[
"Luminosity",
"WhiteLuminosity",
"PlantTemperature1",
"PlantSoilMoisture1",
"PlantMACDS1",
"PlantWaterAlimentation1",
"PlantWaterAlimentationState1"
],
"cluster":"msTemperatureMeasurement", "options":{}
}
}
WEB LINKS
[1] Firmware Downloads: https://tinyurl.com/mw8xw3d4
[2] The STM32WB library: https://github.com/STMicroelectronics/STM32CubeWB
[3] Basic examples: https://tinyurl.com/yeypkdh3
[4] Zigbee2MQTT package and instructions: https://tinyurl.com/3uam3d83
[5] This project on GitHub (Online Resources): https://tinyurl.com/5yhmajkv
[6] DesignSpark Mechanical: https://www.rs-online.com/designspark/mechanical-software
[7] Prusa Slicer: https://www.prusa3d.com/en/page/prusaslicer_424/
[8] EasyEDA: https://easyeda.com/
Join the
Elektor C mmunity
The Elektor web archive from 1974! Take out a Ge mOb eLD
m rship
8x Elektor Magazine (print)
8x Elektor Magazine (digital) membership!
10% discount in our web shop and
exclusive offers
Access to more than 5,000 Gerber files
www.elektormagazine.com/member
Maixduino AI-Powered
Automatic Doorman
Face Detection with a Camera
sensors to open them, even if they have other remains fully closed. Once the first gate firing the GPIOs. More GPIOs can be deployed
no intention of entering or exiting. In noisy opens and the person enters the chamber, the if needed, depending on the gate mechanism.
environments such as these, it can cause the gate fully closes, isolating the chamber from The gate opening can be customized to field
engineers inside to be constantly disturbed both sides, and only then does the second requirements.
by the outside noise, triggered by the doors gate open. This is usually done by sequentially
opening unnecessarily as the turbine floor’s
loud noise pours in.
A Smarter Solution
The proximity sensor’s function is the root of
this unwanted issue because these IR sensors
have very limited functional capabilities. We
have therefore replaced the traditional IR
proximity sensors with AI-powered facial
detection hardware and proximity calcula-
tion capabilities to ensure the doors only open
when a human approaches.
Gate-Opening Mechanism
When the conditions are met, two GPIO-pow-
ered relays trigger the gate opening mecha- Figure!2: Flowchart of the logic behind the project.
nisms. Typically, when one gate opens, the
The camera’s focal length is instrumental for Once the distance is within 250 cm, the GPIO
determining the relationship between the fires, and the gate opens or closes.
distance of the face and the size of the facial
box in the image. The change in size follows a Hardware +5V
linear relationship within the focal range, but The chip that sits as the heart of the Maixduino
beyond this range, the relationship becomes board, a Kendryte K210, is a highly integrated
nonlinear, requiring a more complex calcula- system-on-chip (SoC) designed for AI and Door
tion to maintain accuracy. IoT applications, incorporating machine vision 5V
This was done to enhance the AI-pow- and reliability. The K210 is designed for rapid
ered door system’s accuracy and efficiency. deployment, enabling “zero threshold” AI +5V
The linear model provides fast and reliable development for fast integration into products.
detection for close-range proximity, making
the door responsive when someone is A key component is the Knowledge Process- Door
nearby. The quadratic model ensures more ing Unit (KPU), a general-purpose neural 5V
accurate distance calculations at longer network processor. The KPU supports convo-
GPIO13
ranges, accounting for perspective distor- lution, batch normalization, activation, and
1k
tion as a person approaches from further pooling layers, making it capable of real-time
away. This combination optimizes perfor- object and facial detection. BC547
230050-013
mance across varying distances, preventing
premature triggers and enhancing overall user We are using MicroPython as the program-
experience. ming language to develop the code, with Figure!4: Connections for triggering the gate.
The MaixPy FaceDetect classifier is avail- > In kflash_gui, select the facedetect.kfpkg Set Auto-Play on Boot:
able in a *.kfpkg file, where * represents file and press Download to install the > To make the program auto-run every
the model name. These models are highly AI model onto the device. You can also time the MaixPy device is powered on,
efficient and fast-acting YOLO (You Only Look modify the flash-list.json file to change go to Tools in the MaixPy IDE and select
Once) Version 2 classifiers. Each scene is the registered model number (0x300000). Transfer File to Board. This will copy the
processed through the model, and the output Python script to the device as boot.py,
is checked against its defined classifiers. Upload a Project with MaixPy IDE: ensuring it automatically starts on boot.
YOLO v2’s speed allows it to quickly identify > Next, download and install the MaixPy > Alternatively, you can copy the Python file
a human face on the screen and draw a box IDE from here [4]. For a complete guide to the root directory of an SD card and
around it. The classifier model used here is to MaixPy IDE, visit the MaixPy wiki [5]. rename it boot.py. Inserting the card into
facedetect.kfpkg. > Open MaixPy IDE and connect your the MaixPy will make it auto-play as well.
MaixPy device by pressing the chain
Aside from simpler face detection, it is also symbol at the bottom left of the screen. Results
possible to use the MaixPy facial recogni- > Load the Python program (e.g., AI-powered face detection is nothing new
tion classifier, but it should be noted that doorman_mod3.py as shown in Figure 6) today. It can easily be accomplished using
this program currently only supports facial by selecting File and opening it in the IDE a powerful computer and camera. However,
recognition for a maximum of 10 faces. A more window. implementing this on a standalone, low-pow-
powerful development board would be needed > To run the program, press the play button ered (5 V) MaixPy microcontroller demon-
to run a more robust facial recognition model. at the bottom left. strates that AI can make life easier, not just
on powerful computers but also at the micro- been incorporated into the latest software
controller level. The cost-effective Maixduino version which can be downloaded from [8].
Related Product
offers several advantages, including having After making this improvement, it operated
a small yet fast TFT screen, the ability to run flawlessly the entire time I was there. > Sipeed Maixduino Kit for
small AI projects and Micropython codes, and 230050-01 RISC-V AI + IoT
it also offers the sipeed.com repository support. www.elektor.com/18972
WEB LINKS
[1] MaixPy FaceDetect classifier download: https://dl.sipeed.com/MAIX/MaixPy/model
[2] kflash_gui: https://github.com/sipeed/kflash_gui
[3] MaixPy MicroPython firmware: https://github.com/sipeed/MaixPy/releases
[4] MaixPy IDE: https://dl.sipeed.com/MAIX/MaixPy/ide
[5] MaixPy IDE wiki: https://wiki.sipeed.com/soft/maixpy/en/get_started/env_maixpyide.html
[6] Video demonstration for a range of 1.5 meters: https://youtu.be/-2GsDlSfZVo
[7] Video demonstration for a range of 2.5 meters: https://youtu.be/2NoueDvC3KM
[8] Software download: https://www.elektormagazine.com/230050-01
Our solutions:
Design-In Support:
support@fortec-power.de
+49 61 58 82 85-0
www.fortec-power.de
FEATURE
Embedded
Electronics
2024
AI Is Set to Redefine the Industry
By Jean-Pierre Joosting (eeNews Europe)
Source: Alif Semiconductor
There were many trends in embedded To address power consumption in edge devices, chip developers
electronics in 2024 ranging from AI at and manufacturers have designed microcontrollers and SoCs with
built-in machine-learning capabilities to enhance performance
the edge, on-chip machine learning, the and efficiency using dedicated low-power neural processing units
use of Generative AI for programming, (NPUs) that can execute machine learning algorithms natively.
collaborative robotics, wearable electronics, Another technology that has come to the commercial market is
event-based neuromorphic computing for very low-power and
the automotive transition to software- wake-up applications.
defined vehicles (SDVs), rising interest in IoT
cybersecurity, and multi-protocol wireless An emerging leader in microcontrollers with integrated NPUs,
Alif Semiconductor [1] has pioneered a different architecture with
devices to mention a few. Some of these key its Ensemble Arm-based microcontroller family (Figure 1), which
trends are highlighted below. can scale from a single core to a new class of multicore devices.
The Ensemble can combine up to two Cortex-M55 cores, up to
two Cortex-A32 cores capable of running high-level operating
systems, and up to two Ethos-U55 microNPUs for AI and machine
On-Chip Artificial Intelligence learning acceleration. These power-efficient microcontrollers can
AI is the major trend in technology at the moment but for many handle heavy AI and ML workloads for battery-operated IoT devices
things embedded, power consumption is a key issue. As a result, up to 250+ GOPs. By optimizing the microcontroller architecture
GPUs are typically integrated into CPUs, microcontrollers, and to tightly integrate the processing cores, low-power NPUs, and
SoCs that are aimed at applications that can support high power on-chip memory, the microcontroller family delivers at least two
requirements. However, for many embedded applications, a GPU orders of magnitude higher edge AI performance than traditional
consumes too much power and is often overkill. microcontrollers with the lowest power consumption levels possi-
ble for vision, voice, and vibration analysis.
A major trend that has come to the fore is the need for AI at the
edge. Here power consumption is critical as these devices typically At electronica 2024, Alif Semiconductor also showed its latest
operate on small batteries or implement energy harvesting technol- Balletto B1 Bluetooth microcontroller family along with a corre-
ogy. Often, these applications also rely on smaller AI models that sponding development kit. The Balleto B1 integrates a 160 MHz
are more tailored to specific requirements. Arm Cortex-M55 CPU core with Helium vector processing exten-
A deep-tech Canadian startup, Blumind [3] has developed a Programming and Generative AI
disruptive all-analog neural signal processor technology — A fast-growing technology, Generative AI has found use in
Blumind AMPL. This AI compute fabric is ideal for micropower generating code, debugging, and rapid prototyping in embed-
AI applications and delivers deterministic and precise inferenc- ded electronics. For example, developers can use ChatGPT and
ing performance at up to ×1,000 lower power than legacy digital GitHub Copilot [5] to provide instant code suggestions as well
approaches. AMPL claims to be the first all-analog AI on advanced as help in debugging and optimization to resolve errors quickly.
standard CMOS architected to fundamentally mitigate process, Generative AI has also become a useful tool in rapid prototyp-
voltage, temperature and drift variations. Applications include ing as it can quickly generate bits of code to test functionality or
always-on keyword detection, image classification, and always-on explore different configurations.
visual image wake to enable rapid identification for access control.
While generative AI tools like ChatGPT and GitHub Copilot offer
Another startup, Mythic [4] has pioneered analog compute-in-mem- increased efficiency and faster prototyping, they also present
ory that is purpose-built for AI inference. This analog computing challenges regarding code accuracy, confidentiality, and intel-
lectual property. When using Generative AI, human oversight is
important to ensure code meets its functional and performance
metrics, as well as compiler and hardware requirements. Confi-
dentiality and adherence to IP laws also need to be considered.
In 2025 and beyond expect to see more tools addressing the use of
Generative AI to automate coding and programming.
Highlighting its success, the Zephyr Project added several members The CRA sets a minimum level of cybersecurity for all connected
in 2024, including CARIAD [10], Ac6[11], Alif Semiconductor, products available within the EU market. It aims to ensure that
Arm [12], Honda [13], Inovex [14], MicroEJ [15], Qt Group [16], there is an adequate level of cybersecurity in hardware and software
and STMicroelectronics [17]. According to the Zephyr Project, products with a digital component as well as timely lifetime security
Nordic Semiconductor [18], Intel [19], and NXP [20] contributed updates, whether they are embedded systems or standalone
the most to the ecosystem in 2024. software. It came into force on the 10th December 2024, starting a
36-month implementation period to full compliance.
Several technical milestones were achieved in 2024, including over
100,000 commits and added support for 150 new boards (bring- This means that organizations need to design hardware and
ing the total to over 750), including development platforms such software for security to minimize vulnerabilities from the start
as Raspberry Pi Pico 2 [21] and the WCH CH32V003EVT [22] — a and provide timely risk assessments and updates. In addition, clear
board powered by a 10 cent RISC-V MCU. information on security updates and known vulnerabilities must
be provided to users throughout the product’s lifetime. Expect
Going forward, Zephyr is expected to keep gaining traction in organizations to use automation and risk management to meet
embedded systems, IoT, and safety-critical domains as more devel- compliance from 2025 onwards. On the 11th of September 2026,
opers look to use open-source to cut costs, benefit from increased reporting obligations for manufacturers are expected to become
security, portability, wide support, and flexibility as well as to future- applicable.
proof development.
Humanoid robots have caught the attention of the world with the Future vehicles using AI, for example, will be customized to the
Tesla Optimus humanoid slated for 2026. However, mass market driver’s needs, boost the effectiveness of driver aids, and enable
adoption of humanoid robots remains a difficult challenge. predictive maintenance to address problems before they occur.
In the smart home, expect software and AI to dominate, enabling
Founded in 2019, German startup NEURA Robotics [25] has become interoperability (hardware-agnostic) and LLMs to provide natural
a global leader in cognitive and humanoid robotics, creating robots language interaction for the whole home. In industry, machine
designed to work seamlessly with humans in industries such as learning, digital twins, robotics, and AI will continue to automate
manufacturing, logistics, and healthcare (Figure 2). Using unique everything from setup to operation of smart factories. Predictive
sensor technology and AI integration, NEURA Robotics has devel- maintenance will also play a large role in cutting costs. However,
oped the first cognitive cobot on the market and is now leading a lot of these applications will require low-power AI chips.
the way in the development of market-ready humanoid robots. 250072-01
Charge-Based
In-Memory Compute
at EnCharge AI
Naveen Verma, CEO of EnCharge AI
By Nick Flaherty (eeNews Europe) is rather than using the current through a semicon-
ductor device we are using charge,” he said.
Naveen Verma, CEO of EnCharge AI, talks
to eeNews Europe about the company’s analog “We don’t use semiconductor devices, we use capac-
itors formed from the metal wires, they only depend
in-memory compute technology for edge AI. on the geometry and that’s something we can control
very well.”
US startup EnCharge AI [1][2] is reaching the next “This solves the analog accuracy and scalability
stage of its development of in-memory compute problems from the geometry control as we scale to
(IMC) for low-power AI. The company has raised $45 m more advanced nodes so the energy efficiency and
for its capacitor-based analog in-memory comput- density improve. The precision of patterning the wires
ing technology and is actively raising funds for the does scale, and what geometry you need is an inter-
commercialisation of AI chips for laptops. esting question. What we need is more of an order of
magnitude less (than approaches), and that allows
“There has been a lot of interest in analog computing you to use the upper metal layers.”
as it can be orders of magnitude energy efficient but
it is sensitive to noise so the big problem that we have EnCharge AI has built a macroblock that does the multi-
solved is managing analog IMC in a very robust and ply-accumulate (MAC) functions very efficiently for AI,
scalable way,” said Naveen Verma, CEO of EnCharge AI using SRAM to provide the addressability for the capac-
and professor of electrical and computer engineering itors in the metal layers that can store the weights for
at Princeton University since 2009. the frameworks. This approach has been demonstrated
in chips ranging from 130 nm in 2017 to 16 nm in 2021.
“AI is moving out of the data centre to scale up, moving
into laptops and desktops, edge servers. These are Building a Chip Is Not Enough
often battery-powered or space-constrained, and that’s “The trick is to re-architect the chip to get the advan-
where we have found a lot of traction.” tages,” he said. “The fundamental technology was a
breakthrough in 2017 and the next five years was to
“My research group at Princeton has been looking build an architecture around it with a software stack
at this for many years, with all sorts of optical and and a compiler to map applications to it.”
electrical computing. The big fundamental difference
“Because the fundamental capacitor technology does
not require any additional technology, that allows us
to be in the most advanced nodes and that gives us
$exibility to build programmability into this with all
the AI models.”
“Then the problem is to map the software to this archi- of parameters. This uses well-established principles
tecture to use the units efficiently. This gives high of memory virtualisation.
levels of density and power efficiency. Now you can
very $exibly choose the parallelism of the AI graph.” “Virtualised memory takes a capacity-limited
L1 memory and couples that with the L2 cache all the
“So we had the full stack in a baseline from where we way out to DRAM and we have used the same princi-
understood the architecture, the compiler structure, ples to IMC, orchestrating the way memory moves
we spun that out in 2022 for customers that needed across the system so that we can scalably execute
the higher efficiency and performance.” models with billions of parameters,” he said.
“What we found was the first couple of models broke “What you have to have is some IMC hardware and
everything as there were small features in the first work out how it works with the L2 and L3 and off-chip
couple of AI workloads that were missing. Working memory for the right amount of data reuse so that the
with customers, we identified the features for the data movement doesn’t become the limiting factor. That
next spin of the hardware and the software. That’s drives the architectural design, and our systems are
the journey that we were on,” he said. optimised for multiple multi-billion parameter models.”
“We have been working with partners to prove out While the latest laptop devices such as Meteor Lake
the workloads that need to run. The systems need use chiplets, this is not a focus for the in-memory
to be optimised from top to bottom. We are building compute architecture, says Verma.
the chips and the software for a couple of reasons.
Really getting the full performance advantage requires “Chiplets are a very interesting technology but there
a top-to-bottom optimisation and being able to control are constraints, whether using UCIe as an interface or
that allows us to get the most out of the technology.” not. I do see opportunities around chiplets.”
240728-01
The initial form factor for this is simple discrete boards
on PCIe cards, and he sees M.2 as well aligned for Editor’s Note: Nick Flaherty first reported on this in
laptops. The existing technology can provide perfor- eeNews Europe, a publication in the Elektor network.
mance of over 150 8-bit TOPS/W, but the chip under www.eenewseurope.com/en/domain/eenews-embedded/
development for 2025 has an efficiency of 375 TOPS/W
and can also handle AI frameworks with billions of
parameters.
WEB LINKS
[1] EnCharge AI: https://www.enchargeai.com
[2] R. Pell, “In-memory computing startup launches to enable edge AI at scale,” eeNews, 2022:
https://www.eenewseurope.com/en/in-memory-computing-startup-launches-to-enable-edge-ai-at-scale/
Sagence AI has emerged from stealth to unveil a groundbreaking advanced analog in-
memory compute architecture that directly addresses the untenable power/performance/
price and environmental sustainability conundrum facing AI inferencing.
Based on industry-first architectural innova- price, and 20 times smaller rack space. Using “A fundamental advancement in AI inference
tions using analog technology, Sagence AI [1] a modular chiplet architecture for maximum hardware is vital to the future of AI. Use of
makes possible multiple orders of magnitude integration, the technology enables a highly large language models (LLMs) and Genera-
improvement in energy efficiency and cost efficient inference machine that scales from tive AI drives demand for rapid and massive
reductions for AI inferencing, while sustaining data center generative AI to edge computer change at the nucleus of computing, requir-
performance equivalent to high performance vision applications across multiple indus- ing an unprecedented combination of highest
GPU/CPU based systems. tries. The technology balances high perfor- performance at lowest power and economics
mance and low power at an affordable cost that match costs to the value created,” said
Compared to the leading volume GPU — addressing the growing ROI problem for Vishal Sarin, CEO & Founder, Sagence AI.
processing the Llama2-70B large language generative AI applications at scale, as AI “The legacy computing devices today that
model with performance normalized to computing in the data center shifts from are capable of extreme high-performance AI
666 k tokens/s, Sagence technology performs training models to the deployment of models inferencing cost too much to be economically
with 10 times lower power, 20 times lower to inference tasks. viable and consume too much energy to be
WEB LINK
[1] Sagence AI: https://sagence-ai.com
The Elektor
Mini-Wheelie
A Self-Balancing Robot Kit
By The Elektor Team
WEB LINK
[1] This project on Elektor Labs: https://elektormagazine.com/labs/self-balancing-robot-with-maker-fabs
MCU,
I See You
MCUViewer Open-Source Multiplatform Debugging Tool
directly, providing a way to adjust program flow and trigger specific Currently, ST-Link and J-Link probes are supported and they can
actions during development or testing. work in different modes: ST-Link probes support only normal mode
which samples variables’ values one by one, whereas J-Link can work
In addition, MCUViewer offers basic statistical analysis of the in both normal and HSS (High-Speed Sampling) mode in which it’s
gathered signals and enables exporting the data to CSV format for capable of sampling at rates of tens of kilohertz. Depending on the
further analysis. Variable Viewer is especially useful for visualizing debugging scenario, you can easily switch between the two modes.
many signals at once; for example when tuning a PID controller
you could display all three P, I and D components together with After picking the debug probe we can set up the tracked variables
the setpoint and output value. and create some plots. The main rule is that all tracked variables
have to be global; they have to persist throughout the program
However, Variable Viewer is not sufficient in all cases — especially lifetime in order to have a constant address and be detected by the
for very high-frequency signals such as inductor current responses. parser. At the moment all basic types up to 32-bits are supported.
Depending on the number of logged variables and the type of probe
used, Variable Viewer can reach up to a few tens of kilohertz. While After the import, plots can be added by selecting their type, then
this frequency may be adequate in many situations, there are times drag and drop the variables onto the canvas. Clicking the large
when it falls short. button in the top left window’s corner will start the acquisition.
When stopped, the user can zoom in on particular parts of the
To address this, the Trace Viewer module was developed. Unlike collected data and analyze it. Additional tools are cursors which
Variable Viewer, which samples memory, Trace Viewer processes can be used to quickly measure time difference and check signal
SWO trace data from the embedded firmware. Variables are written values, and simple statistics windows that measure and display
to the ITM peripheral with hardware-generated timestamp packets, some basic properties of the signal.
ensuring synchronization with code execution. Thanks to the
optimized SWO protocol, Trace Viewer can achieve sub-micro- For example, Variable Viewer can be used with a cascaded PID
second timestamp resolutions, making it suitable for high-fre- of a servo drive. In Figure 2, I have created two plots, one for
quency signal analysis, and much more. the outer position control loop and the inner one for the veloc-
ity control loop.
How To Use Variable Viewer
Initially designed as the core feature of MCUViewer, Variable At first glance, it seems the step response of the position controller
Viewer collects the values of variables using a selected debug probe. looks good — a nice critically damped response. However, when
The SWO pin can be used to track the execution times of multiple float a = sin(10.0f * i);
functions and the real-time values of several variables. However, //some high speed signal to trace
if these monitoring operations produce more data than the SWO ITM->PORT[0].u32 = *(uint32_t*)&a;
pin can handle, then the Trace Viewer module can debug the probe // type-pun to desired size
// sizeof(float) = sizeof(uint32_t) gives a lot of additional info about the system as CPU-intensive
tasks can be easily spotted and fixed if needed.
Basically, we need to type-pun the value to a suitable type, and
select the proper type in MCUViewer plot settings. First, set the plot Results and Future Improvements
domain to analog, and then select the type from the drop-down list. MCUViewer has evolved into a robust, open-source solution
designed to make embedded systems debugging more efficient
In Figure 4, a response of an inductor current for a given voltage and accessible. Total downloads over all released versions have
command is plotted. reached over 2500, and it now offers features that cater to a variety
of sensor- and actuator-related applications, such as debugging
When registered, we can use cursors to measure the time constant power electronics, robotics and embedded control systems in
and estimate the inductance. Registering analog signals can be general. My hope is that MCUViewer can empower developers
very useful in the power electronics field, where controllers usually across a range of fields, providing a reliable and adaptable tool for
operate at tens of kilohertz, which makes them more challenging solving their most pressing challenges.
to analyze and debug.
MCUViewer is under constant development. I am currently working
Interrupt Profiling Example on some new features that will make the debugging process even
The last demonstration example uses Trace Viewer to analyze the better. One of the most important of these is plot groups, which
execution order and priorities of interrupts. By placing markers will allow users to switch quickly between plot collections.
on the interrupt enter and exit we can easily visualize the relative
interrupt timings as well as execution times and preemption Other important features to come are:
events.
> XY plot
Figure 5 shows a TIM7 interrupt with the highest priority, TIM17 > fixed point interpretation of variables
with medium priority, and TIM6 with lowest priority. The preemp- > the ability to read arbitrary memory addresses
tion can be easily spotted in places where the frequency of TIM6 > the ability to perform basic preprocessing on collected
and TIM17 is affected by TIM7 interrupt execution. This use case variables
Questions or Comments?
Do you have questions or comments about this article? Email
the author at piwasilewski@interia.pl or contact Elektor at
editor@elektor.com.
3. Troubleshooting:
> Try the example/MCUViewer_test CubeIDE project with the
corresponding MCUViewer_test.cfg project file. Remember
to build the project and update the ELF file path in
Options → Acquisition settings.
Figure 2: Block diagram of the ISOUSB211 isolator IC. IC2 in the center separates the left side, where
the host or PC is connected, from the right
side, where the peripheral is connected. Inter-
these sobering first attempts. And hooray: It The board offers a wide range of settings and nally, the integrated circuit has not only 3.3 V
works with all the devices I was able to try has a fairly sophisticated power supply. The TI regulators on both sides that supply the logic,
out. In addition to the USB connection, it has website [1] provides a data sheet and techni- but also integrated 1.8 V regulators to supply
a DC/DC converter with electrical isolation cal specifications. Figure 2 shows the block other logic parts. However, since the use of
on board, which generates the 5 V sometimes diagram of the ISOUSB211. the integrated 1.8 V regulators significantly
required for the device side from the 5 V on the heats up IC2, the use of external 1.8 V regula-
input side. If the power provided is insufficient The Circuit tors (IC1 and IC3) is recommended instead. In
or the switching converter causes interference, After the first encouraging tests with the addition, a 5 V regulator is provided around
an external supply can also be used. ISOUSB211, I decided to design my own circuit IC4 on the right, which can also be used to
LT1117CST1.8 LT1117CST1.8
IC1 IC3
C1 C2 C4 C5 C6 C7 C8 C9 C10 C12 C13 C11 C15 C16 D1
22µ 100n 100n 2µ2 2µ2 100n 100n 100n 100n 2µ2 2µ2 100n 100n 22µ
SK56
16V 16V 16V 16V 16V 16V
OUT
IN
10k
10k
10k
10k
10k
5 24
VCC1 VCC2
1 6 23 1
VBUS 1 JP6 V2OK V1OK 1 JP7 VBUS
2 7 22 2
J1 D– UD– DD– D– J2
3 8 21 3
USB D+ UD+ DD+ D+ USB
4 9 20 4
GND 2 EQ10 EQ20 2 GND
10 19
EQ11 EQ21
C3 11 18 C14
V1P8V1_2 V1P8V2_1
12 17
GND1_2 GND2_1
100n 13 16 100n
CDPENZ1 CDPENZ2
R5 R6 R7 14 15 R9 R10 R8
NC_1 NC_2
10k
10k
10k
10k
10k
10k
IN OUT
LM317MABT
D2
JP2, JP3, JP4: Connectors for Current measurement in VBUS line
IC4
JP6, JP7: Connectors for High Speed Probe R16
SK56
261Ω
X2
C17 C18 C20 2
1
R17 R18
22µ 100n C19 22µ
16V 16V
820Ω
39k
22µ
16V
Figure 3: The circuit of the DIY USB 2.0 isolator. OUT 240616-003
Capacitors:
C1, C16, C17, C19, C20 = 22 %F / 16 V,
electrolytic, tantalum, SMC-B
C2…C4, C7…C11, C14, C15, C18 = 100 nF,
X7R, SMD 0603
C5, C6, C12, C13 = 2.2 %F / 16 V, X7R,
SMD 0805
Semiconductors:
D1, D2 = SK56, Schottky diode, DO214AA
IC1, IC3 = LT1117CST-1.8, SOT223
IC2 = ISOUSB211DPR, DP0028A
Figure 4: The PCB layout for the circuit. IC4 = LM317MABT, TO220
Miscellaneous:
supply the circuit from an external DC power for signals, which of course depend on the JP2…JP4 = 3-pin header, 1/10″ pitch
supply with 8…15 V. IC4 is powerful enough to specific PCB layout and can be quite relevant JP6, JP7 = 2-pin header, 1/10″ pitch
supply USB 2.0 devices connected to J2 with at the data rates occurring with USB 2.0. Since X2 = 2-pin screw terminal, 5 mm pitch,
up to 400 mA. the EQXX pins can process three levels (high, AK300/2,
open, and low), 32 = 9 different compensa- J1 = USB socket for PCB mounting, type B
There are six resistors on each side (R2… tions can be set per side. The details are J2 = USB socket for PCB mounting, type A
R7 and R8…R13) that can optionally be used described in the data sheet [3]. In general, Enclosure Hammond 1593NTBU
to configure certain functions. The levels the circuit works well with open inputs, which Circuit board 240616-01
at the inputs EQ10, EQ11, and CDPENZ1 as is why I did not fit R3, R4, R6, and R7, nor
well as EQ20, EQ21, and CDPENZ2 deter- R8, R10, R12, and R13. The CDP function is * see text
mine the configuration of an equalizer (the EQ not needed for the purposes described here,
pins) and the use as a charging port (CDP = so it can be disabled by fitting R2 and R11.
Charging Downstream Port, active low). The All settings are queried each time the IC is
equalizer is a switchable compensation of the switched on and stored internally until the
electrical properties of the conductor tracks next time it is switched off. Measurement Options
Since I was interested in the currents flowing
in the circuit, especially when something was
not working properly, I added 0.1-Ω resistors
R1, R14, and R15. The voltage drop can be
conveniently measured at JP2, JP3, and JP4.
Miscellaneous
Figure 5 shows the assembled board in the
plastic casing for which it was designed. My
homemade USB isolator works well, and I am
Figure 5: The custom-made, assembled circuit board in its housing. satisfied. Barely had the board been installed
WEB LINKS
[1] ISOUSB211DPEVM evaluation board: https://www.ti.com/tool/ISOUSB211DPEVM
[2] Elektor web page for this article: https://www.elektormagazine.com/240616-01
[3] ISOUSB211 data sheet from TI: https://www.ti.com/lit/ds/symlink/isousb211.pdf
Intervention
Before Damage
Predictive Maintenance in Practice
By Tam Hanna (Hungary) The term “anomaly detection” is based on a highly important theory:
The AI learning process shown in the middle of the figure usually
One of the most valuable applications of has no direct knowledge of what is going on inside the machine.
AI is certainly predictive maintenance Instead, the system examines measurement data from various
sensors and compares it with training data in order to detect devia-
– the forward-looking servicing of tions and report them.
machines. The neural analysis of data
streams, usually from multiple sensors, Controller Zoo
The MCX family, which was introduced at the beginning of 2024,
makes it possible to detect critical is NXP’s path to the future. Figure 2 shows the options that devel-
system states at an early stage and to opers will be faced with in this now very extensive microcontrol-
intervene before any damage actually ler portfolio. The MCX N series, designed primarily for the needs
of AI applications, is presented as shown in Figure 3. It should
occurs. In this article, we will provide be noted here that the smallest variant, 2X, does not come with
not only background information a Neural Processing Unit (NPU) — this is only available from the
but also a practical application of the MCX 5X upwards.
method. We will use an inexpensive For the sake of convenience, we will use the high-end version
development board and example MCX N9X in the following steps (see box Start with Large
software from NXP, as well as an Controller Types). The controller is available at a relatively low
price in the form of the FRDM-MCXN947 evaluation board (see
acceleration sensor, to detect anomalies also the Related Products box).
in the operation of a fan.
Start with Large Controller Types The following practical example requires an accelerometer (in
Particularly for small series, the price differences between addition to an NXP-specific TFT display for showing the calculated
the various memory configurations are marginal. The author results). This sensor is connected to the fan we want to monitor, in
therefore likes to start with the largest possible variant of a way that couples as much vibration as possible. The accelerom-
a chip in his consulting business — if the system works, eter and evaluation board are connected via I2C, while the display
you can scale down later. However, it should be noted that is connected to the designated port.
a small reserve of resources can be helpful — you never
know what additional functions the customer might want Software Setup
in the field. Similar to the compulsory registration for Cube introduced by
STMicroelectronics some time ago, NXP also only allows people
with an NXP account to download the documentation and
A USB-C cable is required to communicate with the computer. In toolchain. The download process (probably inspired by Android) is
addition, of course, various (sensor) hardware is needed to enable also interesting: The SDK and the integrated development environ-
the ingestion of the required information as shown in Figure 1. ment have to be obtained in two separate transactions.
Figure 4: The board assistant asks you to select the appropriate evaluation kit.
In the next step, the .zip file is dragged and dropped into this In the case of anomaly detection, NXP provides an example project
window. You can safely ignore the warning message displayed by on GitHub at [2] that we will use in the following steps. Note that
the IDE. A few seconds later, the new toolchain is ready for action the IDE allows direct rehydration of source code from GitHub
as part of the MCUXpresso IDE. — it is not necessary to use the command line client to load the
project skeleton into the workstation file system in the first step.
Examining the (Complex) Example Code Specifically, the function Import from Application Code Hub is avail-
Samsung’s now defunct Bada operating system was popular with able for this purpose, which is hidden in the Quickstart panel shown
developers in part because it put handheld software developers in in Figure 7.
the role of “plumbers” to a certain extent. Developing an applica-
tion for this operating system generally involves connecting the The search string on-device training fan anomaly on mcxn947 then
various building blocks provided by Samsung. In the opinion of the leads to the display of a tab with the desired example, which you
author, this development method, which at the time was revolu- click on with the left mouse button in the next step. MCUXpresso
tionary and ingenious, is also recommended when working with responds by displaying a rotating progress bar, which you have to
artificial intelligence systems. confirm after a while.
Since most AI tasks are structured according to one of just a The appearance of a tab with the content shown in Figure 8, which
relatively small number of schemes, developers should start by appears on the right of the screen, then allows you to click on the
looking for an example that can be run, and then adapt this to the GitHub link symbol. In the next step, a Next option appears in the
needs of the given task. Eclipse IDE.
The reward for your efforts is the display of a more or less standard A queue will then work in the background, which — fed by the
GitHub deployment assistant. In tests by the author, it was possible sensor task and harvested by the algorithm task — ensures the
to simply accept all the settings as proposed — due to the limited transfer of the incoming information from the accelerometer.
speed of GitHub, a little waiting time is sometimes required. If
an error message appears as shown in Figure 9, you can update Brief Analysis of the Sensor Task
the SDK. NXP supports two different sensor types here. In addition to the
FXLS8974 from NXP itself, the MPU6050 from TDK InvenSense,
After successfully completing the loading process, we can start which is well known for its low-cost availability on AliExpress and
analyzing the code. The “entry point” of the example, which is other sites, is also on the support list. In the sensor task, however,
based on FreeRTOS and LVGL, can be found in the file source/main.c, this selection does not have a significant effect. There is a kind of
where the creation of the sensor and algorithm tasks is of partic- hardware abstraction layer that performs the following breakdown
ular importance: of the incoming accelerometer data and provides it for harvesting
via a uniform interface:
int main(void) {
. . . int IMU_ReadSensorData(int16_t *pBuf,
if (xTaskCreate(app_sensor_task, "SENS", 4096, uint16_t fifo_cnt, uint16_t readSize)
NULL, configMAX_PRIORITIES-1, NULL) != pdPASS) { {
PRINTF("Failed to create sensor task.\r\n"); if (sensor_id == IMU_6050)
while (1) {} return MPU_ReadSensorData(pBuf, fifo_cnt, readSize);
} else if (sensor_id == IMU_FXLS8974)
if (xTaskCreate(app_algo_task, "ALGO", 0x1000, return IMU_FXLS8974_ReadSensorData(pBuf,
NULL, configMAX_PRIORITIES-1, NULL) != pdPASS) { fifo_cnt, readSize);
PRINTF("Failed to create sensor task.\r\n"); else return 0;
while (1) {} }
}
The architecture of this example is interesting in that the raw data
supplied by the accelerometer never actually reaches the ML model.
Instead, the ML model is only presented with a frequency spectrum
that the example code obtains by applying an FFT process to the
raw data supplied by the accelerometer.
The purpose of “windowing” the FFT raw data is to reduce the effects
of inaccuracies occurring in the edge areas due to the limited length rmsAry[j] += ftmp * ftmp;
of the data array [6]. It is also interesting to note that the FFT data }
is windowed by a float field, which the NXP example code creates arm_sqrt_f32(rmsAry[j] / APP_FFT_LEN, rmsAry + j);
according to the following scheme: arm_rfft_q15(&s, fft_buffer, g_app.rfftOutBuf[j]);
The “meat” of the sensor data processing is then found in an endless Next, we will turn to the actual application evaluation logic. Pleas-
loop. For reasons of space, I will just show the innermost working ingly, it begins with the realization of a state machine:
part here. What is important here is the call of the method arm_
rfft_q15, which is responsible for the actual application of the typedef enum {
transformation to the sensor data. kAppPredicting,
// in main screen, predicting data
for (int i=0; i < APP_FFT_LEN; i++) { kAppWaitForCollect,
g_app.rfftInBuf[j][i] -= g_app.dcEMAs[j]; // in train screen, wait for "Start" button
fft_buffer[i] = g_app.rfftInBuf[j][i] * kAppCollecting,
hanning_ary[i]; // in train screen, collecting data
ftmp = (float)(g_app.rfftInBuf[j][i]) / g_rmsDiv; kAppWaitForReturn,
}AppState_e;
__WEAK void* ad_train(float features[][APP_FEATURE_DIM], The next task of the prediction code is to call the actual predict
int featureCnt,float gamma, float nu) { method, which — as discussed above — returns a result from the
return svm_train_mode(features, featureCnt,gamma, nu); model.
}
volatile float g_modelRetPlaceHolder; Practical experience shows that the bulk of the intelligence in such
__WEAK float ad_predict(void* pvModel, AI tasks lies in the weighting of the results – here, in addition to a
float feature[APP_FEATURE_DIM]) { multiplication, we also note an inclusion of the sign. In any case,
return svm_model_pre(pvModel, feature); the reward for our efforts is that the variable g_app.health now
} shows the current state of health of the system to be maintained.
The SVM task starts by harvesting the most recent accelerome- ret = ad_predict(g_app.pADModel, feature);
ter value, which is written to a FreeRTOS queue by the previously float retSign = -1.0f;
discussed task. From now on, the content of the feature variable if(ret > 0){
is a representation of the most recent sensor values in both the retSign = 1.0f;
training and prediction cases. ret *= 25;
} else {
void app_algo_task(void* parameters){ ret *= 1;
. . . }
float feature[APP_FEATURE_DIM]; g_app.health = (g_app.health + ret + 0.5 * retSign);
. . .
for (;;) { Practical experience in design shows that a plausibility check or
xQueueReceive(g_app.qh_NewSample, value restriction of the results returned by an AI model always
feature, portMAX_DELAY); makes sense. This applies in particular if the values — as is the case
g_app.isNewFeature = 1; here in the variable g_app.health — are integrated or accumu-
lated over the program runtime.
In the next step, we can turn to the training logic. The first task is
to collect the incoming sensor samples — a buffer is filled via the if (g_app.health > APP_HEALTH_ABS_MAX)
g_app.featureNdx variable: g_app.health = APP_HEALTH_ABS_MAX;
if (g_app.health < -APP_HEALTH_ABS_MAX)
memcpy(g_features + g_app.featureNdx, g_app.health = -APP_HEALTH_ABS_MAX;
feature, APP_FEATURE_SIZE);
g_app.featureNdx++; The next step of the program then implements a hysteresis. This
ensures that the model does not oscillate in borderline cases:
When the buffer reaches the limit stored in APP_FEATURE_CNT, the if (g_app.fanState == kFanOn) {
actual training takes place. if (g_app.health < APP_ABNORMAL_LEVEL - APP_SWITCH_BAND)
g_app.fanState = kFanErr;
if (g_app.featureNdx == APP_FEATURE_CNT) { } else if (g_app.fanState == kFanErr) {
int32_t pre_svs_cnt = 0; if (g_app.health > APP_ABNORMAL_LEVEL + APP_SWITCH_BAND)
if(g_app.inc_train){ g_app.fanState = kFanOn;
The rest of the code is then just responsible for switching the various
LEDs on and off to make the ML model’s results visible to the user: About the Author
Engineer Tam Hanna has been working with electronics, comput-
if(fanState == kFanErr){ ers, and software for more than 20 years; he is a freelance devel-
LED_OFF(GREEN); oper, book author and journalist (www.instagram.com/tam.hanna).
LED_ON(RED); In his free time, Tam is involved in 3D printing and selling cigars,
LED_GREEN_OFF(); among other things.
LED_RED_ON();
}else{
LED_OFF(RED); Questions or Comments?
LED_ON(GREEN); Do you have questions or comments about this article? Email
LED_RED_OFF(); the author at tamhan@tamoggemon.com, or contact Elektor at
LED_GREEN_ON(); editor@elektor.com.
}
Perspective
The experiments shown here have demonstrated that the reali-
Related Product
zation of predictive maintenance is nowhere near as complicated
as the AI development community, which is always eyeing “other > Get Started with the NXP FRDM-MCXN947
people’s money”, likes to present it. Development Board (Bundle)
www.elektor.com/20990
In particular, anyone who invests a little time in the background
of SVM and Co. can quickly develop quite powerful systems. The
author hopes that the experiments carried out here will provide
a first incentive for readers to delve deeper into this fascinating
area of software technology.
Translated by Jörg Starkmuth — 240452-01
WEB LINKS
[1] SDK downloader for MCUXpresso IDE: https://mcuxpresso.nxp.com/en
[2] Example project for anomaly detection (GitHub):
https://github.com/nxp-appcodehub/dm-on-device-training-fan-anomaly-on-mcxn947
[3] Tam Hanna, “FFT with a Maixduino,” ElektorMag 3-4/2023: https://www.elektormagazine.com/magazine/elektor-292/61493
[4] CMSIS DSP library, Documentation: https://arm-software.github.io/CMSIS_5/DSP/html/structarm__rfft__instance__q15.html
[5] CMSIS DSP library (GitHub): https://github.com/ARM-software/CMSIS-DSP
[6] Introduction to the windowing of FFT raw data (Application Note LDS Dactron): https://tinyurl.com/FFT-Windows
[7] Support Vector Machine (Wikipedia): https://en.wikipedia.org/wiki/Support_vector_machine
[8] LIBSVM — A Library for Support Vector Machines: https://www.csie.ntu.edu.tw/~cjlin/libsvm/
[9] NXP MCX portfolio: https://tinyurl.com/NXP-MCX-MCUS
[10] AI accelerators in the NXP MCX portfolio: https://www.nxp.com/docs/en/fact-sheet/MCXNFS.pdf
SPoE - Electromagnetic
Compatibility
Single-Pair with Power-Over-Ethernet Through the Eyes of EMC
Figure 5: Comparison of the radiated interference emission of the SPoE reference design The interference spectrum of the reference design
when using shielded SPE cable or unshielded twisted pair cable. in Figure 5 is at least 9 dB below the limit value for
both cable types used, and the results are comparable.
Figure 6: Measurement setup for testing the radio interference voltage on the PSE.
A CDN T2 is used to test the SPoE interface with an
unshielded twisted-pair cable; when measuring
the interference on the shielded SPoE interface, the
emission is tested using a self-built CDN for shielded
SPE cables. The interference on the shielded Ether-
net cable is measured using a CDN for shielded
Cat5e cables. Network replicas and CDNs must always
be terminated with 50 Ω in the test setup (either by
the test receiver or by means of a 50 Ω resistor).
WEB LINKS
[1] Heinz Zenkner, “Design of a Single Pair Ethernet System with Power over Data Lines (SPoE),” Reference Design from Würth
Elektronik RD041: https://www.we-online.com/RD041
[2] Adrian Stirn, “Gigabit Ethernet interface from an EMC perspective,” Application Note from Würth Elektronik ANP116:
https://www.we-online.com/ANP116
[3] Adrian Stirn, “Gigabit PoE Interface from an EMC perspective,” Application Note from Würth Elektronik ANP122:
https://www.we-online.com/ANP122
[4] Adrian Stirn, “The SPoE Interface from an EMC Perspective,” Application Note from Würth Elektronik ANP141:
https://www.we-online.com/ANP141
Color TV
A Wonder
WEB LINK
[1] New Tech Tuesdays (Mouser Electronics), “A New Era of Movie-Watching,” January 2024:
https://resources.mouser.com/new-tech-tuesdays/new-era-movie-watching
ECG
Source: AI-generated by the author
Graph Monitoring
An Implementation with Hexabitz Modules
and an STM32CubeMonitor
These experiments help us to refine the ECG monitoring system and block; a programming and data transmission block; and a monitor-
demonstrate its potential for real-world applications. ing block.
! !
What Is an ECG? The signal acquisition and processing block, shown on the right,
An ECG is a paper chart or a digital recording of the electrical signals is responsible for acquiring the bio-potential signals from the body
in the heart. These signals — whose typical waveform is shown in and made by two main components, the Single-Lead, EXG Monitor
Figure 1 — can be analyzed by studying their components, repre- (H2BR0x) and the Sensor cable with electrode pads (3!Leads).
senting the cardiac electrical activity. To know more about this, you !
might take a look at [1]. The Hexabitz Single-Lead, EXG Monitor Module (H2BR0) is a one-of-
! a-kind module that can record publication-grade biopotential signals
The Project from your body be it from the heart (ECG), brain (EEG), eyes (EOG), and
Figure!2 illustrates the functional diagram of this design, that could be muscles (EMG). The two sides of this compact, yet powerful module
divided into three main logic blocks: a signal acquisition and processing are shown in Figure 3, whilst two YouTube introductory videos about
Figure 2: Functional
diagram of the design.
Figure 8: Configuration of the Acq IN node. Figure 9: Settings for the Acq OUT node.
Figure 10: Configuration of the Clear Button node. Figure 11: The chart configuration window.
To simulate the remote access on our dashboard, we can use the link
http://localhost:1880/. The dashboard can be controlled using any
browser, as shown in Figure 14.
Figure 12: Configuration settings for the Variables node. !
Hardware Setup
Figure 15 shows the wiring of the buzzer, that must be connected to
which will be plotted on a line chart as curves. Figure 12 details the P5 and GND pads. You can also solder it directly onto an Hexabitz
configuration settings for the Variables node, which holds the neces- Proto module.
sary variables for collecting and displaying ECG data. It ensures the !
correct variables are tracked and updated. You also need to connect the ST-Link (H40Rx Module) to the EXG
! module using SWD (Serial Wire Debugger), and supply the module with
In Figure 13, the settings of the Processing node are shown. We a 3.3!VDC source. The analog EXG module outputs can be checked
selected the filtered sensor readings without performing any additional with any oscilloscope.
processing, as the filtering is done within the sensor module itself. !
! Testing the System
To modify your layout, you need to click on the Dashboard menu, on The live testing of this system obviously implies the proper place-
the top-right side, select the layout and edit the layout; in theme, you ment of the electrodes on di"erent body parts. Figure 16 shows three
can change the background color, the buttons color, etc. di"erent options for the placement of LA, RA and LL electrodes: on
!
Figure 17: The RA electrode in place, with a “live” signal acquisition visible in Figure 18: Final phases of dashboard testing. The involved hardware is
the background. shown on the right.
Related Product
Questions or Comments?
Do you have technical questions or comments about his article? > M. Pakdel, Advanced Programming with STM32
Microcontrollers (Elektor, 2020)
You may contact the author at aulajazmati7@hotmail.com or the
www.elektor.com/19520
editorial team of Elektor at editor@elektor.com.
WEB LINKS
[1] Wiki page for Electrocardiography: https://en.wikipedia.org/wiki/Electrocardiography
[2] EXG Monitor Module YT introductory video - Part 1: https://tinyurl.com/yc9hmmpf
[3] EXG Monitor Module YT introductory video - Part 2: https://tinyurl.com/48dx894h
[4] Hexabitz Single-Lead, EXG Monitor Module webpage: https://tinyurl.com/5b6a97dz
[5] BCRobotics sensor cable: https://tinyurl.com/tukpw7vb
[6] Hexabitz Single-Lead, EXG Monitor Module Firmware: https://tinyurl.com/4s9vdj7n
[7] Code for this project (GitHub): https://tinyurl.com/y6sumenz
[8] STM32CubeIDE download: https://www.st.com/en/development-tools/stm32cubeide.html
[9] How-To write code with STM32CubeIDE: https://tinyurl.com/2vujcv29
[10] How-To control ports independently: https://tinyurl.com/rftuharu
[11] Build GUI using STM32CubeMonitor: https://tinyurl.com/2zcfhy5p
[12] J. Holzhauer, “ECG simulator,” Elektor 5/2000: https://tinyurl.com/4zaudfsd
With MyWE, you have all processes in view 24/7. Quickly and easily access all
relevant data, make inquiries, and place orders. Thanks to the clear design and
your customizable dashboard, you can reach your goal with just a few clicks.
YOUR The shipment tracking for all common carriers shows you when your deliveries
will arrive. This way, you and your colleagues are always up to date.
www.we-online.com/mywe
CONNECTION Highlights
• Shipment tracking for all couriers
• Overview of all inquiries, offers, and orders
TO US: MYWE • Live stock information
• Detailed information on products
© eiSos
The Battle
for AI at the Edge
By Stuart Cording (Germany)
can be built that recognizes the six peaks (P,
The news around AI mainly reports on the achievements of Q, R, S, T, and U), ECG anomalies, and deliv-
tools like ChatGPT and Midjourney — powerful, cloud-based ers the results typically required by a physi-
cian (Figure 1). This will range from heart
tools. But there are plenty of other non-cloud applications rate and regularity of the beat to deviation
where even a little intelligence can make a big difference. in the cardiac axis and other anomalies [2]
(Table 1).
Embedded systems have traditionally relied and then apply an ECG algorithm that is Such an AI model is also easier to modify
on procedural programming to solve their robust enough to respond to a wide range of when changes are made to the analog front
tasks, especially those constructed for differing and distorted pulse shapes, signal end, different use cases are needed, or newly
battery operation and using microcon- transitions, and amplitudes. discovered ECG signal classifications arise
trollers clocked at tens of megahertz and through research. And the demand on a
with limited memory. This restricts these On the software side, ECG samples are microcontroller is not exceptionally high,
devices to tasks that can be implemented collected, and then an algorithm is coded meaning a decent 32-bit device running at
by a series of decisions supported by an using procedural programming decisions. tens of MHz with a few hundred KB of flash
algorithm such as a fast-Fourier trans- These choose different detection algorithm and tens of KB SRAM can be used instead of
form or PID control loop. But many tasks options and approaches depending on the relying on cloud-based AI resources.
are simply a pattern-matching activity. And distortions detected. This can lead to a long
this is something that AI is really good at. list of di%cult-to-manage options. Research Into Tiny Machine
Learning
Applying AI to Everyday Medical The alternative approach is to use AI. As a result, plenty of research is going
Diagnostics Because AI algorithms are good at pattern on into AI at the tiny, non-cloud end of
Take, for example, an electrocardiogram matching, real ECG samples can be provided the user spectrum. The primary goals of
(ECG). Used to monitor the activity of the as training data. From this point, a model such research are to support privacy by
heart, these time-varying signals have an
amplitude of around 10 µV to 5 mV and
contain frequencies of around 0.05 to
35 Hz [1]. Such tiny signals are the first
R-R Interval
challenge. The next is that the electrodes
aren’t permanently fixed in place like a R R
sensor of an industrial system delivering
well-defined signals. They are temporarily
attached to the human body; even when a
T T
health professional performs this, there is P P
wide signal variation and noise. Further- U U
more, humans move continuously, which
causes deviations in the shape of signals.
Q S Q S
The typical approach to this signal detec-
tion challenge is to build a high-quality Figure 1: The key features of an electrocardiogram are labeled from P to U. The R-R Interval is the heart
analog front end, perform digital filtering, rate and normally lies between 0.6 and 1.2 seconds.
and “Is this road accessible?” (Figure 5). VLM is executed on an NVIDIA Jetson powerful Arduino, you’ll be eager to get
A baseline AI for this task requires over TX2 with its 256 Pascal GPUs, dual-core started. But clearly, the path from one to
81 MB of memory for the model and deliv- 64-bit Denver 2 cores, and quad-core the other requires a heap of skills, from
ers an accuracy of 81%. Their tiny version of Arm Cortex-A57, energy consumption was programming to data analysis.
this model for a microcontroller fits in just 5.6 J with an inference latency of 213 ms.
339 kB of memory, with a loss in accuracy The GAP8 achieved a latency of 56 ms while To make things easier, work is being under-
of just 1.5%. requiring just 200 mJ. taken on Automated Machine Learning, or
AutoML [9]. This provides processes and
This particular VLM leverages the capability Such developments open up a wealth of methods that make machine learning
of the GAP8 processor utilizing the cache opportunities in processing and power-con- more accessible to non-experts, improves
memory for double-buffering, DRAM strained systems like MCUs. algorithm e%ciency, and supports research-
attached via a DMA (direct memory access), ers. The reach of activities is enormous and
and the PULP-NN multicore comput- Improving Getting Started has led to tools like Auto-PyTorch that
ing neural network software library [8]. Now that you know that a billion-parameter optimize AI network architectures and
And the results are impressive. When the AI model can be squished into a reasonably training hyperparameters.
the market with more flash and RAM, and Processing Unit (NPU), which is available in
potentially interfaces for external memory the Alif Semiconductor Ensemble E5 [12]
that provide the space for applications and E7 [13] families alongside Cortex-M55
Related Product
where integrating internal memory is no and Cortex-M32 processors (Figure 6).
longer business viable. > D. Situnayake and J. Plunket,
Of course, as always, engineers will AI at the Edge (O’Reilly)
Heterogeneous multicore processing, which ultimately decide which architectures and www.elektor.com/20465
uses several cores of different architectures, approaches are preferred. Referring back
will also be more common. Both Arm and to Alessandro Grande from Edge Impulse:
RISC-V are the key technology providers “Ultimately, the optimal choice between
here. However, there is growing interest in a dedicated accelerator, a basic core, or a
AI accelerators, processors with an archi- hybrid solution will depend on the specific
tecture well suited to the convolution and needs of each application, balancing perfor-
matrix calculations used by AI algorithms. mance, power e%ciency, and cost consid-
Arm already offers its Ethos-U55 [11] Neural erations.”
240687-01
WEB LINKS
[1] Xie L, Li Z, Zhou Y, He Y, Zhu J., “Computational Diagnostic Techniques for Electrocardiogram Signal Analysis,” National Library of
Medicine, Nov 2020: https://pmc.ncbi.nlm.nih.gov/articles/PMC7664289/
[2] Dr M. Jackson, “How to Read an ECG,” Geeky Medics, Nov 2024: https://geekymedics.com/how-to-read-an-ecg/
[3] R. Groh, N. Goes, A. M. Kist, “SpokeN-100,” Presentation: https://cms.tinyml.org/wp-content/uploads/summit2024/Rene-Groh.pdf
[4] R. Groh, N. Goes, A. M. Kist, “SpokeN-100,” Zenodo, March 2024: https://zenodo.org/records/10810044
[5] R. Groh, A. M. Kist, “End-to-end evolutionary neural architecture search for microcontroller units,” tinyML:
https://tinyurl.com/EvoNAS-algorithm
[6] Edge Impulse, “Label image data using GPT-4o”: https://tinyurl.com/label-image-data-gpt-4o
[7] Arduino Nicla Vision: https://store.arduino.cc/products/nicla-vision
[8] PULP-NN library [GitHub]: https://github.com/pulp-platform/pulp-nn
[9] AutoML: https://www.automl.org/automl/
[10] Microchip, “MPLAB Machine Learning Development Suite”: https://tinyurl.com/MPLAB-Microchip
[11] Ethos-U55: https://developer.arm.com/Processors/Ethos-U55
[12] Ensemble E5 Series from Alif Semiconductor: https://alifsemi.com/ensemble-e5-series/
[13] Ensemble E7 Series from Alif Semiconductor: https://alifsemi.com/ensemble-e7-series/
Morse Micro has achieved a record 16-km distance for a Wi-Fi HaLow link at 900 MHz.
The tests of Wi-Fi HaLow at the rural Joshua Tree National Park in the In theory, Morse expected a link at a sensitivity of -95 dBm, which
US covered 16 km [1], up from the 3 km shown in January in an urban provides a throughput of 4.5 Mbit/s or a UDP MAC throughput of
environment. HaLow is a variant of the Wi-Fi standard designed for 4 Mbit/s. The tests at the Joshua Tree National Park achieved a stable
lower data rates and frequencies for the Internet of Things and the connection of 2 Mbit/s UDP throughput at 15.9 km.
Morse tests achieved a data rate of 2 Mbit/s. 240734-01
The tests used an evaluation kit as an access point (AP) at the edge Editor’s Note: Nick Flaherty Joosting first reported on this in eeNews
of a quiet rural valley. The off-the-shelf MM6108-EKH01 evaluation kit Europe, a publication in the Elektor network.
is based around a Raspberry Pi 4 with the Morse MM6108-MF08651 www.eenewseurope.com/en/domain/eenews-embedded/
Wi-Fi HaLow reference module.
The evaluation kit outputs 21 dBm (125 mW) through a standard 1 dBi
low-gain dipole antenna, resulting in a total radiated power of 22 dBm
without tweaking the 802.11ah parameters to increase the range or
using high-gain directional antennas.
The Morse Micro [2] chips adhere to the 802.11ah standard, which
specifies a slot time of 52 µs. Morse Micro’s implementation allows
for a maximum time of flight of 53 µs to allow for slight variations
between devices. This results in a theoretical maximum range of 15.9 km
(approximately 10 miles).
WEB LINKS
[1] Wi-Fi HaLow delivers throughput at 16 km range: https://youtu.be/fBMgZah2Z7g
[2] Morse Micro: https://morsemicro.com
family of chips for embedded designs. “We are riding both horses at the moment as the primary goal is
The ICENI microcontroller chips are a device maker as the biggest challenge is being able to buy the
based on the RISC-V RV32E architecture technology for automotive, smart energy, and telecoms. We have
a design that is qualified for extended temperature operation and
and use the Microsoft CHERIoT-Ibex we have partners looking at after-market telematics applications.
processor core. The chips are built Moving to autonomous vehicles [1] means more communications
by GlobalFoundries and are aimed at and that increases the attack surfaces,” he said.
a wide variety of applications, from Over 70% of modern software vulnerabilities are based on these
simple microcontrollers to advanced memory safety software issues, creating the explosion of cyber-se-
microprocessor applications, with curity attacks taking advantage of memory misconfiguration and
software-reuse issues to rapidly escalate attacks and are endemic
availability in 2025. in modern code bases globally.
This supports existing code with a compilation without rewriting making its way into production silicon. This is one of the main
the C code, and has an overhead of 1 to 3%, says David Chisnall, reasons why Microsoft developed and open-sourced the CHERIoT
co-founder of SCI Semiconductor and Director of Systems Ibex core,” said David Weston, VP of Enterprise and OS Security
Architecture. at Microsoft.
“Everything on the market is embarrassing,” said Chisnall at the SCI has also launched an Early Access Program, which will enable
High Integrity Systems Conference yesterday. “You are trying to selected customers and partners early access to silicon devices,
replace appliances that people expect to last ten years but compa- alongside advanced development systems. These systems use
nies think three years is long-term support and they are building the lowRISC FPGA Sonata platform [3] enabled by the UKRI Digital
these in an incredibly cost-sensitive environment so the hardware Security by Design programme.
is not able to support the features that we rely on for security. So
we looked at designing the hardware and software stack from the Selected partners can start development immediately on the EAC
ground up with all the things we have learned since the 1960s.” program with rapid portability to silicon devices in 2025, accel-
erating to transition to next-generation Memory Safe systems.
“We have a production quality core, and an open source core is
great with an FGPA dev system but if you actually want to deploy SCI Semiconductors has also signed a strategic distribution deal
this in production you just want to buy a chip and that’s what we with EPS Global, which also handles IC Programming and Embed-
are doing at SCI Semiconductor,” he added. ded Security for automotive Tier One suppliers and contract
manufacturers.
“The ICENI family marks the start of a new epoch of secured devices,
secured applications, and secured society,” said Povey. “The modern “SCI’s value proposition is compelling, and they’re ahead of the
cyber-security industry is focused on treating the technological market in terms of delivery,” said Colin Lynch, CEO at EPS Global.
symptoms of poor hardware and software architecture, with CHERI “They are providing key security chips that meet customers’ needs
and the new ICENI device family, we can now finally start to treat the for secure-by-design solutions. The key markets are infrastructure,
disease, enabling rapid code reuse without importing vulnerabili- defense, automotive, and aerospace. EPS Global can add significant
ties, accelerating development and reducing update requirements.” value in this space through our customer engagement, distribution
expertise, and secure provisioning capabilities.”
The ICENI family of devices uses the open-source CHERIoT
Platform [2] originally developed by Microsoft Research and now SCI Semiconductors is a founder member of the CHERI Alliance,
maintained as a cross-vendor open-source project, with Microsoft and was formed to lead the commercialisation of CHERI technolo-
and SCI Semiconductor as co-owners of the repository, along with gies, which took on the SDK developed by Codasip in Germany for
contributions from Google and rapidly evolving host of ecosys- CHERI RISC-V cores for SoCs and automotive designs.
tem partners including open source hardware developer lowRISC. 240727-01
WEB LINKS
[1] N. Flaherty, “£2.2m for CHERI automotive, embedded security projects,” eeNews, 2023:
https://www.eenewseurope.com/en/2-2m-for-cheri-automotive-embedded-security-projects/
[2] CHERIoT Platform: https://cheriot.org
[3] N. Flaherty, “CHERI moves into RISC-V, x86 for embedded,” eeNews, 2024:
https://www.eenewseurope.com/en/cheri-moves-into-risc-v-x86-for-embedded/
A fully integrated PCB (printed circuit board) antenna Built-in near-field communication (NFC) interface
design with no external antennas improves reliability provides local configuration and testing. This is
and eliminates a weak point of other gateway designs especially helpful in areas where there is no commu-
and there is a single rigid-%ex PCB for maximum nication infrastructure that may prevent or impede
durability: The advanced rigid-%ex PCB design elimi- installation or maintenance communication between
nates any internal connectors and cables, further a gateway and the Silvanet Cloud Platform. Techni-
improving reliability and longevity of the devices in cians can access the gateway configuration and testing
challenging environmental conditions. controls at the gateway site with an NFC-enabled
device such as a smartphone, with no need to scan
“At Dryad Networks, our mission is to protect QR codes during installation and maintenance.
the world’s forests by developing innovative and 240729-01
scalable solutions for wildfire detection and forest
management. Our third-generation Silvanet border Editor’s Note: Nick Flaherty first reported on this in
and mesh gateways represent a significant leap eeNews Europe, a publication in the Elektor network.
forward in achieving this goal, offering unmatched www.eenewseurope.com/en/domain/eenews-embedded/
WEB LINKS
[1] Dryad Networks: https://dryad.net
[2] “Satellite connection for solar-powered forest wildfire sensor network,” eeNews June 2024:
https://eenewseurope.com/en/satellite-connection-for-solar-powered-forest-wildfire-sensor-network
From Life’s
Experience
Figure 1: Plenty… (Source: Adobe Stock / nonnie192).
salt. Trivial as it gets, I almost dare not to these endless choices. We’d love to try
mention the number of different types of everything, but we can’t, and out of helpless-
butter and margarine (Figure 1). Even ness and the flood of information we have to
worse with all the apps that every supermar- wade through, we don’t really know what to
ket offers these days, discounts and other choose anymore. The result is an unfulfilled
promotions, some time pressure, and you’ll feeling, the gnawing subcutaneous fear of
feel like your brain is about to burst out of having overlooked something important,
your head while shopping. FOMO, an acronym for Fear of Missing Out. Source: Adobe Stock / Avi.
WEB LINKS
[1] insideBE: Choice Overload – How Having Too Many Options Can Shut Down Your Brain:
https://insidebe.com/articles/choice-overload/
[2] Wikipedia: The Very Hungry Caterpillar: https://en.wikipedia.org/wiki/The_Very_Hungry_Caterpillar
[3] Choosing MOSFETs / So Many Options! – Circuit Tips and Tricks (YouTube): https://youtu.be/f9Mgcf6EcTg
[4] PSSI2021SAY Constant current source in SOT353 package: https://www.nexperia.com/product/PSSI2021SAY
Starting Out in
Electronics…
…Continues Filtering and Controls Tone
In the final column you can read the value of R2 that you have to
select when R3 has a value of 10 kΩ.
A high-pass filter looks exactly the same — except all the resistors
and capacitors have swapped places (Figure 2). Figure 3 shows
the characteristics of the four filter types mentioned in the table.
Figure 4 shows the same characteristics, but here we have made Figure 3: Frequency characteristics.
the different gains equal by using a voltage divider at the input.
Band-Pass Filters
Band-pass filters are generally made by connecting a high-pass
filter and a low-pass filter (with the appropriate transition frequen-
cies) in series. With these it is perfectly okay to combine filters that
have different orders or are not of the same type.
Tone Control
We usually speak of a tone control when there are no more than four
controls (and therefore filters) available; with five or more filters
we speak of an equalizer. However, the basic operating principle is
the same for both. We make a distinction between nonparametric,
semi-parametric and parametric filters. Figure 5: Ringing of a 3-dB Chebychev filter.
We will leave it here for the time being. In the next installment, we
will continue with this tone control.
Translated by Arthur de Beun — 240711-01
> With nonparametric filters only the gain can be adjusted Questions or Comments?
(where an attenuation is the same as a gain of less than one). If you have any technical questions regarding this article, contact
Nonparametric filters are found in “simple” tone controls and the Elektor editorial team at editor@elektor.com.
in graphic equalizers.
> With semi-parametric filters, the gain as well as the cross-
over frequency can be adjusted. Mixing panels in the medium
price range typically have two parametric intermediate filters
Related Product
combined with nonparametric high and low tone filters.
> With parametric filters, besides the gain and cross-over > B. Kainka, Basic Electronics for Beginners (Elektor, 2020)
frequency, the filter quality (Q-factor) is also adjustable. This Book: www.elektor.com/19212
latter parameter determines whether the filter operates over a Ebook: www.elektor.com/19213
narrow or a wide frequency band.
Quasi-Analog
Clockwork
A Remake of an Elektor Classic or la
b • Elek
kt t
or
Ele
lab
T E S T-
By Ton Giesberts (Elektor)
Ele
la b
or
k
Original Project by P. Hogenkamp or
t
la b
• E l e kt
WEB LINKS
[1] P. Hogenkamp, “Quasi-analogue clockwork,” Elektor 1/1995:
https://www.elektormagazine.com/magazine/elektor-199501/33259
[2] Elektor Store webpage for the clock:
https://www.elektor.com/products/elektor-quasi-analog-clockwork-kit
[3] Elektor Labs page for this project:
https://www.elektormagazine.com/labs/quasi-analog-clockwork-an-elektor-classic-a-remake
[4] Quasi-Analog Clockwork construction manual: https://tinyurl.com/34nuvjtb
or
Ele
lab
ORIGINAL
Ele
b
or
kt
or
la
la b
• Ele k t
A Modular Approach to
Sensor
Testing
The ESP32-S3-Based
Sensor Evaluation Board Figure 1: The Sensor
Evaluation Board in its
assembled state.
K10
0 0 +5V 1
R7 R8 R11 R6 GND
0 0 2
B1 A12 VCC
GND GND D2 3
ADC2_2
10k
10k
10k
10k
D3 B140HW-7 4
K11 1 IC2 8 ADC2_1
ADDR VDD
B4 A9 1N5819HW-7-F +5V +3V3 2 4 IO
VBUS VBUS TLV75733PDBVR ALERT RDY AIN0
B5 A8 9 5 +3V3
CC2 SBU1 SDA AIN1
B6 A7 1 5 10 6
DP2 DN1 IN OUT SCL AIN2 K9
B7 A6 R4 3 7 1
DN2 DP1 R1 IC3 GND AIN3 GND
B8 A5 3 4 AD51515IDGS 2
SBU2 CC1 100k EN NC VCC
1k
B9 A4 +3V3 3
VBUS VBUS C2 C10 GND C6 ADC2_3
4
2 LED3 ADC2_4
R10 USB C R9
22µ 1µ 22µ 1 IC1 8 IO
B12 A1 10V 10V ADDR VDD
4k7
4k7
GND GND 2 4
ALERT RDY AIN0
0 0
9 5 +3V3 +5V
0 0 SDA AIN1
10 6 J2
SCL AIN2
3 7 1
GND AIN3
2
AD51515IDGS
J1 3
EN 1 2 4
UART_P 3 4 D0 5
+3V3 UART_N 5 6 6
+3V3 7
PROG 8
C1
9
R2 10
100n
1 40 11
10k
GND GND
2 39 12
3V3 IO2
3 38 13
EN IO2
SW1 4 37 14
C3 C4 IO4 TXD0
5 36 15
IO5 RXD0
6 35 16
EN
100n 100n IO6 MOD1 IO42
7 34 17
IO7 ESP32-S3-WROOM-1 IO41
8 33 18
IO15 IO40
9 32 19
IO16 IO39
10 31 20
IO17 IO38
11 30 21
IO18 IO37
12 29 22
IO8 IO36
13 28 23
IO19 IO35
14 27
IO10
IO12
IO13
IO14
24
IO11
IO46
IO21
IO47
IO48
IO20 IO0
IO9
27
100n
BOOT 28
D1 6 5 4 3 1
29
30
R3
MOSI
MISO
LED1
+3V3
SDA
SCK
CS4
CS3
CS2
CS1
SCL
SMF05C.TCT 2 1k
R5
LED2
1k
+3V3
K5 K6 K7 K8
1 1 1 1
GND +3V3 GND +3V3 GND +3V3 GND +3V3
2 2 2 2
VCC VCC VCC VCC
3 3 3 3
SDA SDA SDA SDA
4 4 4 4
SCL SCL SCL SCL
Qwiic IO IO IO 240472-001
Capacitors
C1 = 100 nF, 50V
C2, C6 = 22 µF
C3, C4, C7 = 0.1 µF
C5, C8, C9, C10 = 0.01 µF
Semiconductors
D1 = SMF05C.TCT
D2 = 1N5819HW-7-F
D3 = B140HW-7
IC1, IC2 = ADS1015IDGS
IC3 = Regulator TLV75733PDBVR
LED1 = NCD0805A0 (Amber)
LED2 = NCD0805G1 (Green)
LED3 = NCD0805R1 (Red)
MOD1 = ESP32-S3-WROOM-1
Others
SW1, SW2 = Button SKRKAEE020
J1 = 2×3 Pin, 2.54 mm Vertical Header
J2 = 2×15 Pin, 2.54 mm Vertical Header Figure 3: PCB layout, highlighting the reference numbers for connectors
and component placement.
K1, K2, K3, K4 = 408-52020-000-11 (ept Card Edge Connectors)
K5 = Qwiic Connector
K6, K7, K8, K9, K10 = Grove Connectors
K11 = USB-C GSB1C41110SSHR One I2C interface of the ESP32 (GPIO8 = SDA) and GPIO9 = SCL) is
routed to the edge card receptables K1 to K4 and additionally to three
Grove connectors K6 to K8 and one Qwiic connector K5. Similarly, the
SPI communication interface is allocated as follows: SDI on GPIO11, SCK
antenna front end designed along with other core components to use on GPIO12, and SDO on GPIO13. These lines are also connected to the
with the MCU, which further decreases the number of components to edge card receptables; together with four CS (Chip Select) lines. This
make your prototype work. You can address to Figure 3 which shows enables simultaneous use of SPI sensors across the edge card connec-
the PCB layout of the board. tors without conflicts, enabling greater flexibility in sensor testing setups.
The board includes two ADS1015 ADCs (IC1 and IC2) to address As said, the four edge card connectors (K1...K4) enable straightforward
the limitations of the ESP32-S3’s internal ADCs. Both of them have sensor swapping without any rewiring. These connectors are EC.8 edge
four analog inputs (channels). The analog inputs of the first ADC are card SMT connectors from ept [3], which are indeed quite robust for
connected to 2.54-mm pitch header pins and the analog inputs of the this application; they support up to 28-Gbps data transmission and
second ADC to two Grove connectors (two channels each, together a current capacity of 3.2 A (specs well above what is required here).
with VCC and GND). The ADS1015 provides reliable 12-bit resolution However, their main advantage lies in their ease of use, allowing for
[1], which is adequate for most sensor tasks while remaining cost-ef- seamless, frequent sensor module changes in a testing environment.
fective. Although a higher-resolution ADC like the ADS1115 [2] was Compared to traditional pin headers, these edge connectors make it
considered, the ADS1015’s balance of performance (3300 Samples/s significantly easier to streamline testing setups, with a claimed 500
vs. 860 Samples/s) aligned better with the board’s purpose. However, insertion cycles that should hold up well over time.
one can use ADS1115 instead of the ADS1015 on the same PCB as
both of these ICs share the same pinouts and footprint. As you can Connector J1 is dedicated to programming the ESP32-S3 via UART,
see, the ADDR pin of one ADC is connected to GND, the other one providing a straightforward interface for uploading firmware and making
to VCC — which gives these chips different I2C addresses (more on initial configurations. However, one can also flash firmware via the USB
this can be found in the datasheet [1]). Type C Connection (K11) as well. J2, on the other hand, is a 2.54-mm
header that grants access to the remaining GPIO pins of the ESP32-S3
For status indication, the board features two LEDs (LED1 and LED2) and the first ADC (IC1). This additional access is valuable for connect-
connected to GPIO14 and GPIO21 of the ESP32-S3. These LEDs can be ing external modules or custom peripherals directly to the ESP32-S3,
configured for any application, such as displaying power status, commu- allowing flexibility for expanding the board’s functionality as needed
nication activity, or custom debugging signals during sensor testing. during development and testing.
R1 R2
6 8
J1
10k
10k
VIO VDD
1 2 2
CSB
3 4 SDA 3
SDI IC1 handling, and more. For the BME280, I relied on the Adafruit_BME280_
5 4 BME280
Library [7], which is well-known for its simplicity and ease of use.
6 SCL
SCK
7 8 5
SDO
9 10
JP1 GND GND
11 12
1 7 When designing the edge card modules, I selected the 02x10 Connector
13 14
15 16
ADD SEL
odd/even symbol in the schematic and used the Samtec_HSEC8:Sam-
17 18 tec_HSEC8-110-X-X-DV-BL_2x10_P0.8mm_Edge footprint from KiCAD’s
default library for the PCB layout. For the edge card connectors on
19 20
For testing these sensors, I utilized libraries that simplified the integra-
tion process. For the ICM42688, the ICM42688 library by finani was
used [6], which proved to be user-friendly and included examples Figure 6: Size comparison of the Edge Card modules with a 1 Euro coin for
covering various functionalities such as I2C and SPI modes, interrupt scale.
C1 C2 R1 R2 JP3 C3
10k
10k
8
J1
VDD I2C Mode
5 1 1 2
VDDIO AP_SDO/AD0
14 3 4 SDA JP2 JP1
AP_SDA/SDIO/SDI
2 13 5 6 SCL
RESV1 AP_SCL/SCLK
3 12 7 8
RESV2 IC1 AP_CS ADDR SEL
7 CS 9 10
RESV3 ICM-42688-P COMM SEL
11 4 INT1 11 12
RESV5 INT1/INT
10 9 13 14 SPI_MOSI
RESV4 INT2/FSYNC/CLKIN
15 16 SPI_SCK
GND
17 18 SPI_MISO
6
Figure 5: Schematic
CLK/INT2 19 20
240472-004
diagram of ICM42688
Edge Card module.
Testing and ADC Limitations of ESP32 Another improvement would be relocating the bottom ADC (IC2) slightly
During testing, I evaluated both of the onboard ADS1015 ADCs. Unfor- further from the power section of the board. While the noise difference
tunately, only a single ADS1015 IC was available with me at the time, observed during testing was very minimal, optimizing its placement
so I tested it in both locations separately. Despite this limitation, both could further enhance signal integrity. At the time of designing, I specu-
configurations performed identically under normal conditions. However, lated this might have a very minor impact, and testing confirmed that
the ADC at IC1 showed slightly better noise performance. This is likely even small adjustments in layout can make a measurable difference.
due to its position, being closer to its header pins and further from the
board’s power section. That said, this noise difference is negligible for Additionally, I would explore incorporating a multiplexer for the Chip
practical purposes. Select (CS) lines on the edge card connectors. This would allow
dynamic assignment of CS pins, making the design more scalable
When comparing these external ADCs to the ESP32-S3’s built-in ADC, and reducing the reliance on predefined GPIOs for each edge card.
the improvement is stark. The ADS1015 offers far better accuracy and It would streamline the integration of multiple edge cards and enable
significantly reduced noise, even with the ESP32-S3 clocked at 20 MHz. more flexibility in future designs.
The difference in performance is almost incomparable — truly a “day and
night” contrast — making these external ADCs a worthwhile addition. Lastly, I’d consider adding an onboard OLED display for real-time
feedback during testing. Features like displaying the sensor status or
Beyond the ADC testing, this board’s modular design truly shone ADC readings directly on the board could enhance its usability and
when swapping and testing the edge card sensor modules. While I speed up debugging.
currently have only two modules — the BME280 and ICM42688 — the
flexibility, they provide has inspired me to expand the collection. As Overall, this project has been a valuable experiment in modular design
shown in Figure 7, the compact size of the board, measuring just and has proven its utility during sensor testing. While there’s always
64.7 × 66.6 mm, is another advantage. It’s smaller than the mouse room for improvement, this version serves its purpose well and provides
Figure 8: A size comparison of the Sensor Evaluation Board next to a Figure 9: Side-angle view showing the tight spacing of the edge card
keyboard and mouse, demonstrating its desk-friendly dimensions. connectors, highlighting potential for future improvements.
Related Product
Visit our IoT & Sensors page
for articles, projects, news, and > Dogan Ibrahim, The Complete ESP32 Projects Guide,
videos. Elektor 2019
www.elektormagazine.com/ www.elektor.com/18860
iot-sensors
WEB LINKS
[1] ADS1015 (12 bit, 3.3 kSamples/s, 4 channels), TI Datasheet: https://www.ti.com/product/ADS1015
[2] ADS1115 (16 bit, 860 Samples/s, 4 channels), TI Datasheet: https://www.ti.com/product/ADS1115
[3] EC.8 straight, ept connectors Product page: https://www.ept-connectors.com/index.php?EC8-SMT-HighSpeed-Direct-Connector
[4] BME280, Bosch Sensortec Product page:
https://www.bosch-sensortec.com/products/environmental-sensors/humidity-sensors-bme280/
[5] ICM-42688-P High-Precision 6-Axis IMU, TDK Product page:
https://invensense.tdk.com/products/motion-tracking/6-axis/icm-42688-p/
[6] ICM42688 Sensor Libaray (GitHub): https://github.com/finani/ICM42688
[7] Adafruit BME280 Library (GitHub): https://github.com/adafruit/Adafruit_BME280_Library
[8] Setting up Library Loader for use with KiCad: https://www.samacsys.com/kicad/
www.elektormagazine.com/community
2025: An AI Odyssey
The Rise of Foundation Models and
Their Role in Democratizing AI
Foundation models are everywhere. (Source: @Tada Images/@Koshiro K/@Robert — Adobe Stock)
WEB LINKS
[1] Forbes India — “Top 10 Companies in the World by Market Cap in 2025”: https://tinyurl.com/forbesmc
[2] GPT Wikipedia entry: https://en.wikipedia.org/wiki/GPT
[3] BERT (language model) — Wikipedia: https://en.wikipedia.org/wiki/BERT_(language_model)
[4] Stability AI: https://stability.ai
[5] “Attention Is All You Need,” arXiv Cornell University: https://arxiv.org/abs/1706.03762
[6] “What Is a Transformer Model?” — NVIDIA blog: https://blogs.nvidia.com/blog/what-is-a-transformer-model
[7] OpenAI Developer Platform — Getting Started documentation: https://platform.openai.com/docs/overview
[8] Amazon SageMaker — build, train, and deploy ML models: https://aws.amazon.com/sagemaker
[9] Hugging Face: https://huggingface.co
[10] Llama: https://llama.com
[11] EleutherAI — empowering open-source artificial intelligence research: https://eleuther.ai
www.elektor.com/21051 www.elektor.com/21061
Price: €89.95
Price: €139.95 Member Price: €80.96
www.elektor.com/21080 www.elektor.com/21026
Raspberry Pi
Standalone MIDI
Synthesizer (1)
Preparing a Platform for Some Edge AI Experiments
fluidsynth -a alsa -g 1 -o synth.polyphony=64 /usr/share/ Time to run the fluidsynth command again with bated breath and…
sounds/sf2/FluidR3_GM.sf2 Nope. noteon works, but still nothing when I play the keyboard. OK,
! I have to verify that MIDI data is, in fact, coming in to the system.
In my case, FluidSynth complained about failing to “set thread to Let’s use the aseqdump tool. We’ll first confirm that it recognizes the
high priority” (Figure!6). It tries to do this to minimize latency and known ports:
improve real-time audio performance. This is merely a warning, but !
FluidSynth is indeed now running in “interactive mode,” so there’s aseqdump -l
nothing to worry about. The “high priority” preference may be an issue !
on older Raspberry!Pis, but given that I’m running on a Raspberry Pi!5, Yes indeed, it confirms that the keyboard is at 24:0. Now let’s monitor
I discerned no noticeable lag. In fact, I was presently surprised at how any data that comes from the keyboard as we play a few notes:
responsive the whole system was. So, I moved on to the next step. !
! aseqdump -p 24:0
At that point, I was supposed to be able to play the keyboard and !
hear audio. Deafening silence. I tried telling FluidSynth to play a note You can see the output in Figure!7. Well, the notes are coming in. (Side
manually. As mentioned, if it’s already running in interactive mode, you challenge: The first person to email me with the name of the tune gets
just tell it what to do by typing a command. For example: a €20 Elektor Store voucher!)
! !
noteon 0 60 100 Eventually, I got suspicious of FluidSynth — I found it showing up on
! port 128:0 before I even started it (even immediately after a reboot).
This tells it to play the Middle C note (60) at a velocity of 100 on That’s fine, but what if I did explicitly start it from the terminal?
channel!0. But still, no audio. Sigh. To test this, I started FluidSynth as normal, then opened a separate,
! new terminal window and ran aconnect -l again. Well, what do
After a bit of troubleshooting, it turned out that the Raspberry Pi’s audio
was being channelled to one of its two HDMI outputs — of course not
the one I was using. Loath to do more software configuration, I just
did a clean shutdown:
!
sudo shutdown
!
Then I plugged the HDMI cable into the other Micro!HDMI output, and
powered back up again. After starting FluidSynth again, the noteon
command yielded the expected result and made a sound.
!
However, still no sound when playing the keyboard. Ah yes, there
is another step: We need to route the keyboard’s port (as listed in
aconnect -l) with FluidSynth’s port. From Figure!5, we saw that
our keyboard was client 24, port 0. We just need to connect that (in
software) to FluidSynth’s port. And now that FluidSynth is installed,
running the aconnect -l command tells us that FluidSynth is client
128, port 0. Let’s connect them:
! Figure 7: aseqdump -l tells you exactly what tra!ic is coming in via the
aconnect 24:0 128:0 MIDI port.
!
you know, there was a new instance of FluidSynth operating on port Questions or Comments?
129:0 (see Figure 8). So, in the new window, I told aconnect to route We’d love to hear about how you are using AI and how it has affected
to 129:0 instead of 128:0. you over the past two years. If you have questions or comments,
! email me at brian.williams@elektor.com.!You can also catch me on
aconnect 24:0 129:0 Elektor Engineering Insights each month on YouTube, and you can
! find me @briantw on X.
I tickled a few keys, and was immediately greeted by the glorious
sounds of FluidSynth’s default piano. Finally! I’m not sure what I could
have done wrong to get FluidSynth showing up on two different ports
simultaneously — I never added any startup configuration or scripts
to the Raspberry!Pi earlier.
! About the Author
To restore default behavior, where I could use ports 24:0 and 128:0, I just Brian Tristam Williams has been fascinated with computers and
killed all instances of FluidSynth from the new terminal window with electronics since he got his first “microcomputer” at age 10. His
! journey with Elektor Magazine began when he bought his first issue
killall fluidsynth at 16, and since then, he’s been following the world of electronics and
! computers, constantly exploring and learning. He started working
and watched the process die in the original window. Then I ran at Elektor in 2010, and nowadays, he’s keen on keeping up with the
aconnect 24:0 128:0, started FluidSynth again in the original window newest trends in tech, particularly focusing on AI and single-board
( just up-arrow followed by Enter, of course), and now it’s working as computers such as Raspberry Pi.
expected. Wow, it “just works.”
!
Getting Ready for More
Now that we have our gadgets talking and making sounds, we have
the potential to write our own scripts to take output from the keyboard Related Products
and turn it into sound using available tools. But, can we take it to the
edge, i.e., doing some AI processing on our local hardware? I don’t > Pimoroni Piano HAT for Raspberry Pi
www.elektor.com/20552
know how much brain power it really takes a computer to fiddle with
a few plaintext MIDI messages containing a little bit of information. > Raspberry Pi 5 Ultimate Starter Kit (4 GB)
Stay tuned! www.elektor.com/20720
240714-01
WEB LINKS
[1] What Is MIDI?: https://instructables.com/What-is-MIDI
[2] PC speaker: https://en.wikipedia.org/wiki/PC_speaker
[3] Media Vision Pro AudioSpectrum: https://en.wikipedia.org/wiki/Media_Vision_Pro_AudioSpectrum
[4] Demonstration of MidiSoft on Reddit: https://tinyurl.com/redditmidisoft
[5] M-Audio: Keystation 88 MK3: https://tinyurl.com/keystation88
[6] FluidSynth project wiki: https://github.com/FluidSynth/fluidsynth/wiki
Err-lectronics
Corrections, Updates, and Readers’ Letters
Compiled by Jean-François Simon (Elektor)
680n
With this arrangement, there is no way to ensure that the
current is perfectly equal in each of the four MOSFETs. If
Mains
you want to recreate the setup, you can use four identi-
B1
come from the same batch and have similar proper- 47µ
ties), or you can match them by checking that they let
through similar drain-source currents for a fixed gate
voltage. This can be done using two regulated power
250015-006
There are always several ways of solving a given problem indeed! For capacitor C1, you’re right, an X2 would probably be
safer. For points 2 and 3, I can’t comment. The author of the circuit told us that, in his case, the circuit had been working
without a problem for many years, so it seems that for him the open-circuit voltage of the current transformer was not
a problem in relation to the maximum emitter-base voltage of Q1. For your last point, it seems to me that the maximum
current in capacitor C2 is in any case limited by the impedance of C1 (of the order of 21!kΩ at 50!Hz) to a value of around
15!mA, which seems reasonable to me.
Thank you for your comments. The device has been working for over 10!years without any problems. The toroid does
not produce any harmful voltages / currents and no additional protective component is needed for the transistor. For C1
I have indicated the working voltage and the choice of an X2 is agreeable. As Jean-François points out, the current this
capacitor lets through is very small, compatible with the characteristics of the limiting Zener.
SW1 S1
L L
R1
Current Sensor
C1
Mains OUT
1M
150n
400V
N N
Bipolar 16A
D3 D1
4x 1N4007
D6 C3 D1
D4 D2
D5 47µ
C2 Blue Red
16V
R2 Q1
22µ
4V7 35V
82Ω
240039-006 BC547
250015-01
“What Ubitium brings will provide a real architecture. “We envision a future where every device
breakthrough to develop and launch any operates autonomously, making intelligent
new product with embedded electronics. a complete portfolio of chips that vary in decisions in real-time and transforming the
Their approach will reduce the cost as well array size but share the same microarchi- way we interact with technology,” added
as the complexity, allowing a much faster tecture and software stack — enabling Hyun Shin Cho.
time-to-market. What previously required solutions from small embedded devices to 240731-01
multiple teams to collaborate on hardware high-performance computing systems. This
and software design now becomes purely super-scalable approach allows customers Editor’s Note: Jean-Pierre Joosting first
a software project,” said Rudi Severijns, to scale their applications without chang- reported on this in eeNews Europe, a publi-
Investment Director at KBC Focus Fund. ing their development process, while the cation in the Elektor network.
workload-agnostic design ensures the www.eenewseurope.com/en/domain/
Looking ahead, Ubitium plans to develop processor can adapt to handle any comput- eenews-embedded/
WEB LINKS
[1] Ubitium: https://ubitium.com
[2] Runa Capital: https://runacap.com
[3] Inflection: https://inflection.xyz
[4] KBC Focus Fund: https://www.kbcsecurities.com/en/investment-services/kbc-focus-fund.html
VOX-POWER.COM
Unique Power Solutions.
CEO Interview:
Ventiva’s Thin
and Cool Tech
Carl Schlachte, chairman, president and CEO of Ventiva. (Source: Ventiva)
After over a decade of development, thermal power, up from 25 W in earlier designs, and fits into the
miniature, silent cooling technology was space previously occupied by the fan so that the motherboard design
does not need to be changed. The control architecture also mimics
reducing the thickness of laptop designs, a fan so that the software doesn’t need to change.
shown at the CES 2025 show in Las Vegas.
“A lot of engineering went into making this easy to integrate, and
that is hard,” said Schlachte. “This is the benefit of having been
around for a decade. We go out, test things in the market, and go
Carl Schlachte, chairman, president, and CEO of the developer, back and re-engineer it. We initially went after spaces that couldn’t
Ventiva, is a veteran of the semiconductor industry, having worked be used in the laptop, such as the space around the hinge. Because
at Motorola and ARM before taking over as CEO of the UK proces- of how it is built we can turn a corner, and we are not taking any
sor design company ARC. Back in 2011, he bought into a small US more space.”
firm developing an innovative cooling technology.
“We spent a lot of time with designers to understand that to get
Now in 2025, Ventiva [1] is showing a proof of concept for its ion great performance you have to rearchitect the design. We were
cooling technology, replacing the fans in a laptop to show how the using an existing Lunar Lake motherboard but they were invest-
thickness of the design could be reduced by several millimetres ing in future products for the proof of concept and learning about
with the potential to be used in other consumer designs. the modeling and the air$ow.”
“Between Dell, Intel, and Ventiva, we had 30 engineers working “The strategic vision I have is that in the next five to seven years,
for over a year. This was a serious engineering effort. What was fans will be gone. If you go out to buy a laptop then, everyone will
fascinating was that a community formed between the engineers,” have the same reaction to fans that they had to hard drives that
he tells eeNews Europe. “This is the thinnest laptop they have ever moved to solid state drives.”
built, 2 mm thinner.”
“That’s what we are doing right now. We are taking out the exist-
The technology of the 3-mm-high ICE9 blower is only one element. ing blowers and putting our blowers in the exact same spot. That’s
The technology for manufacturing and integration into designs not the best way to get the best performance out of the system. We
has been as challenging. The latest version can address 40 W of take the exact same 4-pin connector and the system thinks it is
The company has its own factory in Malaysia, and it is getting ready
to ramp production by the end of the year, along with second sourc-
ing deals. The system that will ship to the laptop makers includes
the heat pipe and the fins ready to replace the fan. A proof-of-concept thin laptop developed by Dell and Intel using the
Ventiva ICE9 cooling system. (Source: Ventiva)
“Every piece of the manufacturing $ow has been known for 40 years,
the novelty went into the development of the software, the control
of the power supply and the architecture of the blower to maximise a random lovely accident that occurred at a time we had all the
the air$ow,” he said. tools to tackle it,” he said.
“I am the only connection back to 2011, the product is different, The company also targets the $1000+ market as that has the margin
but the basic physics of the idea is the thing that has remained the and demand for thinner designs, as well as AI. He points to data
same. My partner and I bought it, and scaled it back to bare metal, that says 94% of the volume of these laptops is between 15 W and
negotiated partnerships that helped pay for things.” 40 W, hence the 40 W proof-of-concept design shown at CES.
“Even 18 months ago, we hit a product problem and I thought we “Laptop PCs are just the start. We have a counterintuitive view
were dead. So, going from that to the Intel keynote, with Dell people of the world — we don’t see a play for us in the gaming laptop or
at our booth, is fantastic. We have relationships with all the top PC data center. Instead, there are more compelling applications on
makers, but Dell is the furthest along. In six to eight months, we’ll the small side — in a handset, ultrathin tablets, at a certain level
have more news to share,” he said. there is nothing else that will move air at this size. Giving a handset
maker an extra 5 W of cooling is unheard of, especially if you add in
“We’ve spent the bulk of our time working with really smart laptop wireless charging and the more performance requirements of AI.”
engineers, and our credibility will start to show up in the way these 250043-01
products are developed.”
AI has been a boon for the company, as the higher energy consump-
tion of AI in both the CPU and any accelerators has highlighted Editor's Note
the need for more thermal management. Nick Flaherty first reported on this in eeNews Europe,
a publication in the Elektor network.
“The general figure of merit for large language models (LLMs) we www.eenewseurope.com
use is an extra 10 W in heat load, so what has happened is that their
problems have got worse overnight as everyone wants an AI PC that
people want to talk to, and fans are loud. To get a blower quieter, WEB LINK
you have to make it bigger and run it slower. For us, our technol- [1] Ventiva: https://ventiva.com
ogy is quiet no matter what. That converged on our technology,
Dual-Core Programming
with a Raspberry Pi Pico
Venture Into the World of Parallel Programming
The Raspberry Pi Pico is powered by the Synchronization and the Volatile Attribute
RP2040 processor, equipped with two When programming software to run on multi-core CPUs, it’s often
necessary for threads to synchronize their activity. In the simplest
CPU cores. This characteristic makes case, Core 0 can activate Core 1. This can be achieved easily using
it an ideal platform for delving into a trigger variable:
the realm of “Parallel Programming.”
volatile int trigger ;
Through the utilization of tangible
real-world examples in digital signal void core1do(){
void core0do(){
The examples showcased here employ various parallelization int cnt=0 ;
techniques. The acceleration of a program through the use of while(1){
multiple cores is referred to as “Speedup” (abbreviated as S). With trigger=cnt++ ;
two cores, the maximum theoretical speedup is S = 2. The speedup sleep_ms(1000) ;
score achieved by each example application will be provided in }
the following discussion. }
To test the FIFO’s performance, we can implement a simple “server” The timing measurement results in a value of approximately 56 ns
on Core 1: per loop iteration. If we let the server run the loop for N = 10 itera-
tions, we have a computation time of about 560 ns and a commu-
void core1do(){ nication time of about 620 ns. This results in a communication
int buffer1 ; overhead in excess of 100%. The server, therefore, needs to provide
while(1){ a substantial amount of computing power to prevent commu-
buffer1=multicore_fifo_pop_blocking() ; nication overhead from impacting overall performance. When
multicore_fifo_push_blocking(buffer1+1000) coding for parallel programming environments, it’s advisable not
} to focus on too fine a level of programming granularity. In addition
} to FIFOs, Queues are also provided, offering more flexibility as they
can send arbitrary data structures. Furthermore, the SDK offers
It just waits for a value from the FIFO of Core 0 and sends this value various mechanisms for thread synchronization; it is worthwhile
back to Core 0 increased by 1,000. taking a closer look at the available SDK facilities.
For the calculation, it’s necessary to store the last N input values
xk. This can be most conveniently performed using a ring buffer.
void core1Do(){
while(1){
multicore_fifo_pop_blocking() ;
A routine called skpLoop in this program performs the summa- result=skpLoop(NN/2,NN) ;
tion of k1 to k2: multicore_fifo_push_blocking(456) ;
}
}
void parallelSkp(){
In the non-parallel version, 1 to N are simply summed. In the paral- float sum ;
lel version, summations from 1 to N/2 and N/2 to N are performed multicore_fifo_push_blocking(123) ;
in parallel. sum=skpLoop(0,NN/2) ;
multicore_fifo_pop_blocking() ;
sum=sum+result ;
printf("parallel sum=%10.3f\n",sum) ;
The end result is obtained by adding the two partial results. sleep_us(10) ;
Core 0 and Core 1 simultaneously use the same summation loop }
skpLoop(..,..). Since the loop is used by each core with separate
sets of array elements xk and yk, there is no conflict. The speedup void seriellSkp(){
achieved here is S = 1.8. The programs are shown in Listing 1. float sum ;
sum=skpLoop(0,NN) ;
FIR Filters printf("seriell sum=%10.3f\n",sum) ;
Finite impulse response (FIR) filters are widely used for applica- sleep_us(10) ;
tions in digital signal processing. In an FIR filter of order N, the }
current output value is calculated by summing the last N input
The parallelization can be carried out in principle in the same way The evaluation of a Biquad is dependent on the results of the previ-
as with the scalar product, using loop splitting. You just need to ous stage:
manage the ring buffer and correctly index its contents. The loop
is represented here: out1=biquad1(x) ;
out2=biquad2(out1) ;
float doSumLoop(int k1, int k2, int readPtr){ out3=biquad3(out2) ;
float sum=0 ; out4=biquad4(out3) ;
for( int k=k1 ; k<k2 ; k++){
sum=sum+ak[k]*xBuf[readPtr] This makes it di%cult to parallelize the evaluation of Biquads. There
readPtr-- ; is, however, a pipelining technique that can be applied here. The
if(readPtr<0){ readPtr=N-1 ; } term pipeline originates from the implementation of fast proces-
} sors. The execution of an instruction is divided into Fetch, Decode,
return sum ; and Execute phases, each of these phases is executed in separate
} processing stages in parallel.
The parameter readPtr points to the current start position in the When Instruction Ik is fetched, the previous instruction I(k-1) has
ring buffer xBuf. The parallel FIR calculation can be seen below. already been decoded and the instruction before that I(k-2) is being
The speedup factor achieved here is S = 1.7. executed. This form of parallelization results in a higher throughput
(Figure 5). The execution of a single instruction is not any faster.
float FIRdo(int x){
xBuf[writePtr]=x ; This concept can now be applied to the IIR filter. The correspond-
int readPtr1=writePtr ; ing code is as follows:
writePtr++ ;
if(writePtr>=N){ writePtr=0 ; } inp1=x ;
int readPtr2=readPtr1-N/2 ; inp2=out1 ;
if(readPtr2<0){ readPtr2=readPtr2+N ; } inp3=out2 ;
inp4=out3 ;
Program Development
Troubleshooting parallelized programs is often challenging and
complex. It has proven useful to initially write a version of the
program to run in a more flexible environment, such as the free,
open-source Processing environment (reference version), and
debug it there. During this process, you also generate test data
for parallelization. Once this version of the software has been
debugged it can be ported to the target system to initially use the
same test data there. For troubleshooting, you can then compare
the two versions.
The diagram in Figure 7 shows the data flow where N = 16. There
are log2 N = 4 iterations performed, and each iteration consists of
N/2 butterfly operations. Within an iteration, the butterfly opera-
tions are independent of each other. They can therefore be executed
in parallel, and that’s just what this program does. Half of the butter-
fly operations in one iteration are carried out by Core 0, while the Figure 7: Signal
other half are performed by Core 1. Each core performs N/4 Butter- flow of a 16-point
fly operations per iteration. This gives a speedup factor S of 1.85. FFT.
Now, we can evaluate the two polynomials q(x) and r(x) at the same
time. To find p(x) just multiply q(x) by x3 = x(N+1)/2 and add it to r(x).
Fast calculation of x3 = x(N+1)/2 is really important here. This can About the Author
be done using the exponents 1 , x , x2 , x4 , x8 , x16 successively, and Martin Ossmann began reading Elektor, and tinkering, at the age
multiplying the necessary powers for x(N+1)/2. For example, for x9 of 12. After studying electrical engineering and working for several
calculate x9 = x8 x1. Calculation of the powers can be performed in years as a development engineer, he became a professor in the
log2 N steps. Since log2 N is very small compared to N (at least for Department of Electrical Engineering and Information Technology at
larger values of N), the necessary calculation of the powers is quick FH Aachen. Not only is he an author of many scientific publications,
and does not impact too much on the runtime. but for more than three decades, he has been regularly publishing
novel circuits and software projects in Elektor Mag, showcasing his
The described algorithm was implemented on the Raspberry Pi wealth of technical expertise.
Pico using N = 100. The non-parallelized version takes 133 µs. The
Horner calculation for both polynomial halves running in parallel
each takes 71 µs. The fast polynomial calculation requires about
7 µs. The total runtime of the parallelized algorithm is therefore
Related Products
approximately 78 µs. This makes the parallel algorithm speedup
S = 133 / 78 = 1.7 times faster. It’s evident that the calculation of > Raspberry Pi Pico RP2040
x3 = x(N+1)/2 necessary for the parallelization eats into the achiev- www.elektor.com/19562
able speedup, but the value attained is nevertheless worthwhile.
> D. Ibrahim, Raspberry Pi Pico Essentials (Elektor 2021)
www.elektor.com/19673
Linear Algebra
In addition to parallelizing the dot product, the matrix-vector
product was also parallelized, achieving a speedup S = 1.6. The
solution for a linear equation system was also implemented, result-
ing in a speedup of 1.8. A simple loop-splitting technique was used
for both tasks.
WEB LINKS
[1] M. Ossmann, “Raspberry Pi Pico Makes an MSF-SDR,” Elektor 7-8/2022: http://www.elektormagazine.com/220006-01
[2] Software Download: http://www.elektormagazine.com/230440-01
673-100B-1003XT
340103211B
654-10-504637-008
A17251-09
11350
CB5347-000
RSPST070856