Professional Documents
Culture Documents
Circuit Cellar - March 2023
Circuit Cellar - March 2023
MARCH 2023
c irc u itce lla r.co m ISSUE 392
DESIGN &
PROTOTYPING
I DSPs & DSCs I ANT+ Protocol Light Control via Garmin Navigator |
Lego king Chris Cantrell tells you how to build your own four-wheeled Lego robot,
complete with compass module so it doesn't get lost in the woods. In his article, "The NEW SUBSCRIPTIONS
Compass Bot," he shows code solutions to address the pesky problem of "hard iron" ci rcu i tee Ila r.com/s ubscri pti on
and "soft iron" affecting your compass. His module solution is cheaper than existing
PC GPS modules on the market, and it's a great way to learn how to handle distorted
ADVERTISING
compass readings. Check it out on page 18.
Most commercial smart home systems are cloud-based, and thus have problems Contact: Hugh heinsohn
with privacy, security, and reliability. In search of a home automation solution that Phone: 757-525-367 7
doesn't use the cloud, Dev Gualtieri replaced his X10 home automation system with Fax:BBB-9B0 1303
one that uses a Raspberry Pi Model 3B+ single-board computer (SBC) and Wi-Fi- E-mail: hheinsohn@circuitcellar.com
enabled switches, dimmers, and plugs. Read more in his feature on page 24. Advertising rates and terms available on request
The Cornell Nexus team, based out of Cornell University, are devoted to developing
NEW PRODUCTS
engineering solutions to the problem of microplastics pollution in the environment.
Their current project is an autonomous robot designed to collect microplastics from E- mail: p rod uct-ed itor@ci rc ui tee Ila r.co m
beaches. Angela Loh, co-founder of Cornell Nexus and a recent graduate from Cornell,
provides an overview of the project on page 12. HEAD OFFICE
In his Picking Up Mixed Signals column, Brian Millier covers monitoring the
Entire contents copyright © 2023 by KCK Media Corp.
power consumption of Internet-of-Things (loT) boards. Battery-powered loT boards All rights reserved. Circuit Cellar is a registered tradem ark
consume power over a wide dynamic range. Brian uses a Teensy 4.1 MCU, high-side of KCK Media Corp. Reproduction of this publication in
whole or in part w ithout w ritte n consent from
current monitors, and analog-to-digital converters (ADCs) to measure the currents KCK Media Corp, is prohibited.
these devices consume and the power they draw. Check it out on page 42.
Jeff Bachiochi writes about Bluetooth beacons in his column From the Bench. He
DISCLAIMER
shows how to use the advertisement ability of Bluetooth Low Energy—in this case via
the ESP32—to determine location, using identity and signal strength as clues. It's a KCK Media Corp, makes no warranties and assumes no
fun and interesting project. Read more on page 52. responsibility or liability of any kind for errors in these
programs or schematics or for the consequences of any such
This month's Tech the Future covers key questions to ask supply chain partners in errors printed in Circuit Cellar®. Furthermore, because of
the face of continuing supply chain disruptions. The right strategies can help mitigate possible variation in the quality and condition of materials and
supply chain woes. And check out Datasheet for workmanship of reader-assembled projects. KCK Media Corp,
disclaims any responsibility for the safe a nd proper function
a round-up of recent digital signal processors of reader-assembled projects based upon or from plans,
(DSPs) and digital signal controllers (DSCs). descriptions, or information published in Circuit Cellar®.
Wherever this issue may find you, I hope
The information provided in Circuit Cellar® by KCK Media
some of these pieces give you new insight and Corp, is for educational purposes. KCK Media Corp, makes
inspiration in your own work. So please read on, no claims or warrants that readers have a right to build
things based upon these ideas under patent or other
and enjoy.
relevant intellectual property law in their jurisdiction, or
that reads rs have a right to construct o r ope rate any of
the devices described herein under the relevant patent or
other intellectual property law of the reader's jurisdiction.
The reader assumes any risk of infringement liability for
constructing or operating such devices.
O U R NETW ORK
I f h
I
LOUDSPEAKER
IN D U B lV Y
VOICE.1COIL
12 Autonom ous Beach Cleaning Robot
A High-Level Overview
L I SOURCEBOOK By Angela Loh
Avnet 51
Sm art Home W ithout the Cloud
CCS, Inc. 61 Ultim ate Control Using Raspberry Pi
Digi ConnectCore 62 By Dev Gualtieri
COLUMNISTS
Jeff Bachiochi (From the Bench)
Stuart Ball (Start to Finish)
Joseph Corleto (The Magic Smoke Factory)
Bob Japenga (Embedded in Thin Slices)
58 : Product News 62 : TEST YOUR EQ
Brian Millier (Picking Up Mixed Signals) @editor_cc
Colin O'Flynn (Embedded Systems Essentials) @circuitcellar circuitcellar circuitcellar
4 CIRCUIT CELLAR • MARCH 2023 #392
S
E
R
U
T
A
E
F
n my last article ("Sports Wearable Uses called "Controls Device Profile." I thought that
ANT+ Protocol," Circuit Cellar #377, this solution could be useful for those who are
December, 2021) [1], I promised myself entering the world of MCU development for the
to continue my journey in developing first time, since this profile has documentation,
ANT+ devices—perhaps integrating them with but it isn't present in the SDKs. Having no
commercial sports products. The inspiration reference code could discourage a newbie from
for this article was born from a bike training having to "reinvent the wheel." So, I thought
session. Like many others, I use a Garmin about modifying my latest firmware as needed.
device to record my rides. As a cyclist, I love I hope I have simplified the logical flow behind
just riding, and the fewer buttons I have to the development of any other profile.
press and menus to explore, the better. You have to consider the bike light as just
Many bicycle computers, navigators, and an application example. It allows you to easily
smart watches integrate control functions of experiment and test the firmware directly
external devices, such as action cameras, mp3 with everyday devices. There are already
players, or several kinds of sensors. Thus, I sim ilar ANT+ devices on the market, including
decided to make an ANT+ networked bike light. ACE lights and Garmin's Varia (a radar tail
You'd be able to activate this light directly light that warns of vehicles approaching from
from a Garmin Navigator, such as a GPSMAP the rear). My solution is cheaper and limited,
64st, by taking advantage of the integrated but has the advantage that you can build
features for the Garmin VIRB action camera. it entirely by yourself, experimenting with
Thus, you wouldn't need to stop your workout alternative customizations and solutions.
to activate the rear light, when it's time to be I also designed a light box model, using
seen rather than to see. It would be useful for SketchUp software, that you can make with a
the cyclist to have control of the rear light from 3D printer. Hopefully this will be of us in other
a convenient remote device, such as a watch scenarios the readers comes up with.
or bike computer placed on the handlebar. I The initial prototype for my project consists
reused the microcontroller (MCU) from my last of a video-controlled device that could be used
project, the nRF52832 system-on-a-chip (SoC) both through the integrated functions of a GPS
from Nordic Semiconductors, Inc. navigator (Garmin GPSMAP 64st) and a remote
The goal of this month's project is to use control for selfies (Garmin VIRB Action CAM
again the profile-oriented development system Remote Control). Then I added a command
made available by Dynastream Inc. I would interpreter, which uses the same command
like to distribute a sample code of the so- identification codes as those transmitted by
circuitcellar.com
commercial devices, to turn the light on and off. type as standard (not extended), the device
You can use the same system to control other type as controlled device 16 (0x10), the
devices, such as a relay or an inductive load. device number as video-controlled device
Reading the documentation, I realized that (0x207), and the channel period as 4Hz so the
the ANT+ protocol is well suited for sending messages have a rate of four per second.
control information between devices. The Remember that to obtain the ANT+ network
Controls Device Profile defines data formats for key for your personal devices, you need to
a large variety of remotely controllable devices— become an "ANT+ Adopter" and agree to the
from the most generic (Keypad Control) to the terms of use. Devices use the network key to
most specialized (Audio Control). The profile identify and access the ANT+ network; the radio
even provides a multi-use case implementation. module will not hear transmissions occurring
You can combine different use cases such that on other networks. In the source code this field
a remote control is able to control multiple is all zeros, so everyone can use their own key.
types of controllable devices, and a controllable If you are only experimenting with ANT+, you
device may support multiple-use cases, can use the public network key, too.
broadcasting information as needed. Using You can find all the details of these
this kind of implementation, you can develop configuration parameters in the ANT+
a multipurpose device capable of associating, protocol documentation made available on
in seconds, with different types of commercial the ANT+ website [2]. For details on the use
outdoor devices. case development, I suggest you read the
I wanted to share this small project— ANT+ Controls Device Profile [3].
from its firmware, an ANT+ Controls Device The CtrlANT+ acts as a controller, and
Profile based on the Nordic Semiconductor each controller in an ANT+ network has an
S212 SoftDevice, to its realization in a small ANT channel ID, as well as a value comprised
circuit with an nRF52832 core, complete with of the device number, device type, and
a 3D-printed plastic case. So, hopefully having transmission type. This identifier is critical
sparked your curiosity, let's start with an during the pairing process, when the remote
analysis of the Video Control use case. Consider searches for the controller to determine the
it a sort of least common denominator of all the specific channel ID. After devices are paired,
other use cases. It's the simplest to understand, the remote device control can begin.
but it also offers all the logical structures you To develop a profile correctly, you need
need to create more complex systems. to understand the sequence of messages
that controller and remote exchange during
EVERYTHING IS UNDER CONTROL execution. In my case, the controlled device
The ANT+ Controls Device Profile supports broadcasts Data Page 7, which contains its
multiple use cases—Audio, Video, Generic, and status and expects to receive a user-requested
Keypad. In this project, I implemented the Video video command through Data Page 16, sent
Control use case, because the navigator I use from the remote control using an acknowledged
frequently (GPSMAP 64st) has a special remote message. You can see a summary of the
control function for controlling a Garmin VIRB message sequence in Figure 1.
Action CAM. The device acts as a video recording
device, while the navigator serves as a remote PRIMARY CONTROLS PROFILE
control. By default, the ANT+ video device will DATA PAGES
broadcast its video status. The remote control Let's analyze the two fundamental data
will send a video command to change the pages of this profile, 7 and 16, in detail.
device status ("Stop/Start Recording," "Take a
Photo"). The "CtrlANT+," as I call the device I
developed in this project, will interpret the Start
Recording and Take a Photo commands as "light
on," and Stop Recording as "light off." Remote
commands will be sent sequentially, and are
independent. Each command has a special
sequential progressive number, which allows
any retransmissions of the same command to
be recognized.
Each ANT+ Device Profile contains the
network rules relevant to a specific use case.
For a video-controlled device we set the
channel type to 16 (0x10 master channel),
the network key to the obtained sequence
number to "ANT+ Adopter," the RF channel Figure 1
frequency to 57 (2,457MHz), the transmission Video Control Use Case
6 CIRCUIT CELLAR • MARCH 2023 #392
Data Page 7 is a required page, and it is the way, because we are controlling a bike light
prim ary data page sent from a video device. instead of an action CAM. Time Progressed is
It has six param eters, form atted as shown in the current progression in seconds from the
Table 1. m om ent the light is turned on. This allows the
The fields used in this project are: Time cyclist to know th a t the rear light is actually
S
Progressed, Capabilities, and Status. We on and fo r how long. Capabilities has the
E have interpreted th e ir meaning in a different value 1, so we use the commands reserved
R
U fo r devices supporting video recording. Status
T
A
E is the most im p o rta n t field. It indicates the
F Length
current state of the device: 3 = light is off, and
Data Page Number Data Page Number = 0x07 [7] 7 = light is on. This field can take on several
Bit[7] 0=Muted other values, but fo r my project, these two
l= N o t Muted states are more than enough.
Volume 1 byte To make the firm w are more understandable,
Bit[6:0] 0-100= Volume percentage %
I f unused set to OxFF I have only implemented the Minimum Data
Page Requirements: Data Page 7 and Data
The tim e remaining th a t is available Page 16, along with Data Page 80 and 81. The
Time Remaining for record ing/playi ng 2 bytes latter two are Background Pages, containing
I f unused set to OxFFFF the m anufacturer's identification and product
Current number of seconds into information.
Time Progressed playback/recording 2 bytes The controlled device will transm it Data Page
I f unused set to OxFFFF 7 at a 4Hz message rate—four times per second.
The remote device uses an acknowledged
B it[2:7] Reserved Set to 0
message to send the Data Page 16. So, the
B it[l] 0=Does not support Video Playback application can determine if the data page was
Capabilities l= S upports Video Playback 1 byte successfully received or if it needs to be resent.
Bit[O] 0=Does not support Video Recorder The application will determine if the data page
l= S upports Video Recorder needs to be resent. This page has seven fields
0= The Video Device is off formatted (Table 2).
For this project, the most im p o rta n t fields
3= The Video Device is stopped
Status 1 byte are Serial Number, Sequence, and Command
7= The Video Device is recording
Number. The Serial Number contains the
■■■
identification number of the remote control.
Table 1
The controlled device chooses to ignore or act
Data Page 7 parameters and their formats. on the command request. Typically, it discards
commands from the remote control w ith a
different identification number. The Sequence
is a number th a t is incremented w ith each new
command. The field rolls over when it reaches
the value 256 (OxFF). It is possible th a t the
remote control resends a command if there
is a transm ission e rro r or if the controlled
device fails to receive the ACK. In this way,
our bike light can differentiate between a new
command and a repeated command, and it
discards repeated commands.
The Command Number determines the
command sent. There are several types of
commands. The firs t 20 are well known and
are not customizable, but the next 107 can
be used as needed. In this project I use three
main commands: R e co rd (id = 19), Take
p h o to (id = 21), and S to p (id = 3). The firs t
tw o can be used interchangeably to turn on the
light, whereas the second is used to turn it off.
During development, you have to ensure
th a t in the num eric field, the m ost significant
b it is set to 1, because you are controlling
a video device. Since we sim ulate a video
device, 128 m ust be added, due to the value 1
assigned to b it 7. So, the commands received
Table 2
Data Page 16 fields and their formats.
from the CtrlANT+ w ill be L ig h t ON = 19 +
circuitcellar.com
C IO
VTJD 15n H
BT1
B attery 3 V lO jiH
VDD
37M Hr
Cl
VD D
lO ttl
C8
lOOn iuOt)
X2
Antenna
3 2 76tJkH Sft
r>rc: i VDD
PO 0 0 XC2
PO.O1 XC1
PO.O2 o rc 3
32
P 0 .0 3 DFC2
Ul 31
PO.O4
nR F52832 30
AMT
8
P 0 .0 6 POJ24
28
PO 07 P 0 23
I ■■
P O O ft POJ?2
11
PO 0 9 S W D IO
12
PO.1O S W D Q .K
Di
VDD
PI
D2 VDD
VTJD ■ > <3
QI B C 547 3
4
R2
D3
10
D4
Figure 2
The CtrlANT+ schematic
CIRCUIT CELLAR • MARCH 2023 #392
THE FIRMWARE
The firm ware development is based on
SDK version 16 for the nRF52 SoC family and
the S212 SoftDevice, both provided by Nordic
Semiconductor. The S212 SoftDevice contains
a highly flexible ANT+ protocol stack that
supports all the features needed to build a
communication network for ANT+ compliant
devices.
I'll now describe the data structure of the
Controls Device Profile, so you can compare it
with the Environment Profile presented in my last
Figure 5 article (Circuit Cellar #377, December, 2021) [1].
The assembled prototype board top (left) and bottom (right).
Three key points of the firmware are: 1) the
logical structure of Data Page 16, which contains
Additional materials from the author are available at: the identification code of the command to be
www.circuitcellar.com/article-materials executed (light on/off); 2) the decoding function
that extracts the command ID from the ANT+
References [1] to [3] as marked in the article can be found there.
message payload; and 3) the events handler
RESOURCES that executes a specific procedure, depending
Garmin | www.garmin.com on the command ID received.
To avoid compilation errors, allow me
Nordic Semiconductor | www.nordicsemi.com to briefly introduce the Network Key and
Sketchup | www.sketchup.com the integration of SoftDevice S212. After
circuitcellar.com
SoftDevice download and before compiling the elapsed in the recording mode (Light ON).
firm ware code, you have to copy the headers The same broadcast transmission frequency
file (/components/softdevice/s212/headers) to is used (4Hz)—an increase of 1 second every
your SDK Install Folder, and uncomment the four events. Therefore, a counter called "tot"
ant_license_key in the file nrf_sdm.h. When is incremented at each event. As soon as
you get your network key or the public one, it reaches the value 4, the m _ a n t _ c t r l.
you have to insert it into the defines of the file p a g e _ 7 .tim e _ p r o g variable is updated.
ant_key_manager_config.h. These values are Finally, GPIO line P0.17 goes to a high logic
fundamental, and will be used during channel level to polarize the transistor base and turn on
and profile initialization. the light for 250ms. Then it goes to a low logic
This profile, like the Environment Profile, level for another 250ms. And again, it turns the
isn't included in the nRF52 SDK. I started with light on for 250ms and off for another 250ms.
the profile presented in the previous article, In this way, the light flashes with a frequency
adding support for the data page requests equal to half the broadcast frequency (4/2 =
that might be sent from the remote control to 2MHz), or two times per second.
the CtrlANT+, and then handled how it should The instructions relating to Stop determine
respond to these requests. the light switching off. The function updates
As I discussed in the section, the main data the main Data Page 7 status, bringing it to
pages are Data Page 7 and Data Page 16. Each the value 3 (Stop: the video device is stopped;
page is always implemented in the same way, the light is OFF). The status change also
by defining a data structure containing the determines the position update of the central
page values and the initialization constants button on the GPS handheld interface. In
for the default values, and two functions—one Recording, it moves upwards, and in Stop, it
for encoding, and one for decoding. Listin g 1
is a summary of the main instructions used
typedef s t r u c t !
for Data Page 16 development. u in t l6 _ t s e ria lN R ; //REMOTE CONTROL SERIAL NUMBER
The initial struct follows the fields sequence u in t8 _ t sequence; //COMMAND SEQUENCE NUMBER
in Table 2. In the decoding function, the u in t8 _ t r e s l; //RESERVED
pointer to the data buffer and the pointer to u in t8 _ t res2; //RESERVED
the data page are passed as input parameters. u in t8 _ t v o l_ in c ; / / INCREASE/DECREASE VOLUME IN %
This function extracts the payload data of the u in t8 _ t command; //COMMAND ID
ANT+ message received. In Listin g 1 you can } a n t_ c trl_ p a g e !6 _ d a ta _ t;
see the instructions of the decoding function.
# define DEFAULT_ANT_CTRL_PAGE16()
First, the payload is transferred to the data
(a n t_ c trl_ p a g e l6 _ d a ta _ t)
page logical structure (ant_ctrl_page_data_
layout), so all fields are valued and formatted .s e r ia lN R = 65535,
correctly (INSTRUCTION 1). Then the numeric .sequence = 0,
ID of the received command is extracted . r e s l = 255,
by accessing the field referenced from the . res2 = 255,
p_incoming_data pointer (INSTRUCTION 2). .v o l_ in c = 255,
Finally, the data page field referenced by .command = 0
the p_page_data pointer is updated with the
received command ID (INSTRUCTION 3).
void an t_ ctrl_ page_ 1 6 _ en co de(u in t8 _ t ★ p _ p a g e _ b u ffe r, ant_
Listin g 2 contains the events handler
c trl_ p a g e l6 _ d a ta _ t const * p_page_data);
instructions. It updates the status of the
void an t_ ctrl_ page_ 1 6 _ deco de(u in t8 _ t const * p _ p a g e _ b u ffe r,
broadcasted Data Page 7, and executes the a n t_ ctrl_ p a g e !6 _ d a ta _ t * p_page_data);
instructions for switching the light on and off.
The events handler consists of two nested void an t_ ctrl_ page_ 1 6 _ deco de(u in t8 _ t const * p _ p a g e _ b u ffe r,
switch statements. The first establishes the a n t_ ctrl_ p a g e !6 _ d a ta _ t * p_page_data)
data page to be updated, and the second
discriminates the command received from a n t_ c trl_ p a g e l6 _ d a ta _ la y o u t_ t const * p_incoming_data =
the remote control. Let's focus our attention ( a n t_ c trl_ p a g e l6 _ d a ta _ la y o u t_ t * )p _ p a g e _ b u ffe r; //INSTRUCTION
1
on the latter.
The two command IDs related to
u in t8 _ t comando = ( u in t 8 _ t ) ( p_incoming_data->command);
"Recording" and "Take a Photo" allow you to
/ / e x t r a c t in g command from remote c o n tro l //INSTRUCTION 2
turn on the light in two alternate ways provided
by the GPS graphical interface. The instructions p_page_data->command = comando; //INSTRUCTION 3
executed are the same. The status of the main
Data Page 7 is updated, bringing it to the value
7 (Recording: the video device is recording;
the light is ON). The Time Progressed field is
Listing 1
updated; it indicates the number of seconds Main Data Page 16 structure and decoding
CIRCUIT CELLAR • MARCH 2023 #392
Figure 6
CtrlANT+ and GPSMAP 64st screens
Take Photo
for pairing and turning the LEDs on
I Mirimj KiMtiy - I irjhl Of I ligh t ON 1 Light ON 2
and off
The most critical conversations take place here. From concept to realization.
Th rou g h d iscu ssio n s on the latest breakthroughs in im plem en tation to an
exploration o f innovation. A cro ss policy, privacy and data m anagem ent,
safety and security, and em erging tech n o lo g ies. Beyond 5G to edge
com pu tin g. Your path to our shared a u to n o m o u s future starts at
X P O N E N T IA L . T h e w orld's o n ly uncrew ed system s event unites th e entire
industry — from end users to regulators — to build co n cre te plans o f action
XPONENTIAL
through transparent collaboration.
MAY8-11,2023 I EDUCATION
MAY9-11,2023 I EXHIBITS
DENVER
Plan your way forward. REGISTER NOW. xponential.org
12 CIRCUIT CELLAR • MARCH 2023 #392
FIGURE 1
By CAD model of the robot (3' x 3 1)
Angela Loh
Currently, 51 trillion microplastics litter our bodies of water and can be found in our food and
drinking water. They're a hazard to our health and ecosystem, but at less than 5mm in size,
they're difficult to spot. The Cornell Nexus robot is intended to address the microplastics
problem on beaches by autonomously collecting and disposing of these plastics.
he Cornell Nexus team aim s to plastic bucket at the back of the robot to store
clean up m icroplastics from beach the collected trash. Figure 1 is a CAD model
shores to the depths of the ocean. of the robot's basic architecture.
Nexus' current project is focused The base station serves as both the
on building an autonomous robot that will charging dock for the robot and the place
traverse beaches and filter out m icroplastics for the robot to em pty its collected plastics
from beach shores. There are two main entities (Figure 2). It contains solar panels, a wind
to the project: the robot and its base station. turbine, a charge controller, a battery
The robot's main m ission is to traverse the pack, and charging tabs. While the robot
beach and clean up the m icroplastics from the is traversing the beach and filtering out
beach, and it contains a drivetrain, a filtration m icroplastics from the sand, it makes its way
system, an electronics box, a battery, and a back to the base station under two cases.
First, the robot will check the am ount of
charge its battery pack has to guarantee the
robot will be able to return to its base station
from its current location. The further the
robot is from the base station, the higher this
charge threshold will be. Second, the robot
will check if its bucket is full using four sets of
break-beam transm itter and receiver sensors
placed around the top of the bucket. When
the m ajority of these break-beam sensors
detect an object, the bucket is full. If either
the bucket is full or the robot needs charging,
the robot will return to its base station.
As I w rite this, our team is alm ost finished
assem bling the robot. In the project's next
FIGURE 2
CAD Model of the base station's
phase, we will finalize the base station
preliminary design assem bly and robustly test the robot.
circuitcellar.com
FIGURE 4
The GUI is updated with data
transmitted via our radio
transceivers.
14 CIRCUIT CELLAR • MARCH 2023 #392
POWER ARCHITECTURE
Figure 8 is a power architecture diagram
for our base station and robot. For the base
station, our system uses 100W solar panels
and a wind turbine to generate power. The
captured solar and wind energy is stored
in the base station battery pack, which
discharges to the robot's battery pack when
the robot docks at the base station. We chose
solar panels since they are a popular method
of generating electricity, but we included the
wind turbines to take advantage of the windy
beach environment and add more power
generation sources to our system.
Our team is currently working on how to
keep the base station's and robot's charging
tabs protected from the surrounding saline
environment, as salt can erode the metal
tabs and result in less efficient charging.
When the tabs are aligned, a charge regulator
FIGURE 8
ensures that the robot draws the appropriate Base station and robot power architecture diagram
16 CIRCUIT CELLAR • MARCH 2023 #392
m is s io n < p y We call this softw are layout our "M issio n "
architecture.
The M ission FSM has different phases that
correspond to the state of the robot (Figure 9).
In order to traverse an area bounded by a
given latitude and longitude, we set up a
S
E grid divided into "nodes," or coordinates.
R
U As the robot visits each o f these nodes, the
T
A
E rem aining nodes to visit are organized into
F
an ordered list of w aypoints. There are
several w ays in w hich the robot can traverse
these w aypoints— fo r exam ple, "law nm ow er,"
"law nm ow er_b," and "sp iral." Or, rather than
traversing such a set path o f nodes, the
robot may also be set to Roomba mode (and,
am ount of current. Our battery pack also eventually, a manual mode). The GUI receives
has a built-in battery m anagem ent system latitude and longitude bounds and creates a
(BMS), w hich ensures that the battery is corresponding plot o f the robot's path it w ill
charged appropriately. Our robot's battery take to filter the beach sand.
pack is 12.8V, lOOA-h, and 1280W-h. We use The setup phase contains all o f the sensor
a buck converter to convert the voltage levels and circu it com ponent checks, w hich include
to those required by the m otor controller, checking that:
Raspberry Pi 4, and pow er monitor. The power
m onitor is used to obtain the battery's charge • the GPS and IMU are on, and that data is
inform ation, so we know how much charge being collected
rem ains in the battery. The battery pack • the radio m odules connected to both the
directly pow ers the robot's m otor controllers, robot R aspberry Pi and GUI com puter can
w hich regulate the voltage that the attached tra n sm it data to each other successfully
m otors receive. The system 's rem aining • and the m otor controllers w ork and can
sensors are pow er by the Pi. com m and the m otors to move properly.
fl m a fo a i H F a o y I
o a r n st e I n
o d G n o
g irc re U
cq
.r n c e b co
R
u t
e u a a m is E u th r h
ict la sy tt
e p th 1 a
r a e e o is
n ri
e ss f w
o p cu
s in
in
h
rt ro st
m m is m n a
o o h
, tr
te
a m o d e a
a u u d d tri
n ct
o
iz n le
ro
d a et , co rk cl
at
r, ti
o d m w e b e
p a n t
co
p i o ,
e lig . o n a
d t t
th t, I
n I LE ro ss
it e G l b m w g
d p O o
o t b t
ri o
co it
n
it t a w y iv
t t
e a r d h e
h to d p d it
h
e e , e
-b
so a yo
t w A a
lu u
e b h c s p o h h e d m
co
im
x a o
ro o h f n e a x
th
o
a
ig
d b o
in o v e o
ti m
p
o
v
r e
p n
g
m
h
s
e o
t
a a
I o
c
m y
w s
,
a
h
a
r
d
rs
t
d
t
h
a
d
e
r
e C
o
m
p
a
n
d
w
o
n
't
h
o
c
m n I d
u
l
W se
d
o
n p
a
a
ll
e
irm
c is ls p o n e e
lo
o p e
n a a th
o lo p
th
e h o e u d i e p ts
b d v a to is
n a s
so
o n
ss
th n to n h ro m e in l s e is e
e r o o g d s s n le o s e , s
ts l t a o u y s f s a a if
lu m
a is w c , e r I n
ch
c c et c : s o m d
to
ro o s u h (m tr
b fe a
rt ti e o
b a n
tr v
p t
o ) th
ci b ro o i
c o o
o n ig e s fo a e a a o ls
b d it a d
d
tr
o
ry e s r c o g tt rro t o o u le s h i c y e
n
n p u sl
t' o c a n n m m e u
re
c le , o a o 'v s
s .l
n s i m y e o a c t, w u m u e e a
o o ife o li
b c t a ri s o I a s
le
p c F m p y u o s g to e tr r v o t y e
th p r r, n
a
o d s o s
to
e s r
ra m ) n r m ci f e r . e o a d
d in e h t e s , k o r h h m t
rf e a c im e p a e y r if m o o
u ro ll
o ll
tr is o ro
a n t.
c s ta h If b co
h p
y y ti m p b s d o c le o y y w m w t, b e o
rm
e , c l o
th
s I ls w o e o o a o e m o
a p n re fo s
e e
ro
a n I a t s d w , r s u . n o n t n re m
n h n te a 's c o is ta
I
ro y o l d d p d
s d d s c o
re
c s w rs b u y s t
c a u s o i m a tf u
in , i r th
b o
o h a e u
e n g — d ro d th o a u t h y
n e fu .
. c g h e n p ir s a a b n is o b n
s j in s o re n ct
e e o u e a o n o il
t s c w u e o t : ss A
m s m s a s s g n t c d th ts $ a h w h ,
t d to
s s h o . 3 a ti in e y b lt
e e t ig . h
su
in ( e m m
in 0 ll r.
I a o o a h
n fu a d n m T s e g R . s d ti' g
b g a c p o s im lo d t n o
ts . ri
v o h f a o s
If a
d
s fa u
d u g
a li T
tu d e
re fe
s
to b p g y t w
trh e u n w c r li o t y d o lo m o g e
t e
n tt
g l h re
s s s k t le i o e iv u s il o o a
o r e e a . le
I ,
ts 's . e s , n u d e r t y k e h st
n s. g I2 io
it r
e C n
fo is c a p t
h I ( G fu i
n a a a ht 'I "y w e B s
ro
h o M Y s c n v h a ilf r"o m a G
b u h o
re e p C tu e c d e e e e
te U
o C n s rt
U R -5 ht e N ll c b p I t P
n e
yo
t y d ig e h a R re
) a 1 re i le a e
"E u o o
r. o w
s l ty S
IL
h a b a s 1 s o c x m s w m t s u
c tr o fo le s
fe
b p " ro c e o T b t D
o o n ly rd
p r o e p r e
t, o d m p p h c a a m
n n r , b a b c n r b m t a e a a I y n
t a to a e o h o o el I S i o io s r s
rt
e N o e
tr h v
th
b e rd r m a a e m n s e e tr
o T e a i c r je ro to n ," d G d e
e s a R s ry
b n c dr te
m s a o s a
to
d
ll
e c R il o t
ry
. o c e . a a m u
h a p m te a F P e
t, . rs
a tr
th rs
r t T
r n a b P s i m I e e " M e n y b l
e
s le ro e ry i p o is m b d a te rc R r o d A H to
th o p : Z b r o e u r h o (a
m m e s
a ol b
je b - e b m n t id e r e b p s I n E
e c y p e d n o d o
ls t a c a e e b
t g r
co
th t o ig y u ts I m ro o o n z w
i
e a th w
ro ry , g l . 't f t j f c
li o R m x u
is
s
rry e o e w te o A C e k y k n O
n e W e w a n n d a c n
is
f I m th e .
ild
b P R e s r P a o n e u r st o t c
ro
B e t
a m i P e . e i t-o e b l a . e w d o b
s 2 w B d ll r c te d e C w m o O
e a P i p - f $ h u z h I n o t m t
k ic 0 s d u 3 o o d n ." o h T
d e 4 h a t
y p o r 8 s
th
d n a e h
-w
e .
s o 0 M w e t e C s n a a h p
o . P s m o m o el o s d s v I
n i . y r o e [2 a d f i e e e "$ ro
a M S je d r ci ]. b c m o s " e 2 s
n C p o u c e e
th
e c p r " d T l 5 e je
th
U ro t l d ro e e to
a fo u T th a c
e a u s c r le g e a o r t
w d in s , p o e e s "c r p M n r c
R c u s a B n
"H
a or s o $ d h w
P e h c + ro
i d
th e m 1 g o fa u e i
s ip t
t l I
e . tr L m e s 3 e m n d th
2 o a p je
o e y p
to f
o d
0 m , t
h d a c t e r a a
tt il
4 li F ll g f t o n [1 ni rs u e a
0 a a , tr k o ts e o e n d s g
ia fo
n
e s t I s e r , r o r r s ]. ")
r
r- r" r
o I o ro c m L a s c 6 I2 g b m tu th "a ro a w b m o ro p M b si n b I th I th p h w a m fr fr m to th e A fr O Y C L G b tw c
f d f o E n o o C r n i u f o a a n o a o o i i
g d o r o i iP u h
ll m e G d l
d d f o re o r e d b d o " b w t s e d e w l
d o o o o e ro o i
p
L u ta T e o , u a T n v o
re tt T t M o k tt 't F tt u d T
re d t m m t th h T a m y u rc o v
tt
E g p o p a O h c e r S n k h
to
s w a t M o h o e e e ot e p
is m e e h s o o e c t h rf o c u e o .
G e f o n - e o re p P d o e h n g n e r o t' r r m ig e
ro c r r e a s e u it c n D
O s L n c n th , u
r'
s e 2 o s s ry
u g
ry
b o id a rs m rs s c i y u a n P h s C T
e d E o n d ro
,I
th c m A w to te P u r- o v d s a
to n . th o y a p , h
s v G e id m fe g e a t M s e e e o c le i p c e g t e w c y . m to r c t
e u c g o e
o n e a e h r U n a c ls b
e t
s o o
ir r h
re
t p r le n a y a If e I o o a e th rg tw m
a e w O p c e a c A d c k w
") v u n e ft rm
a 2 g a lu w e i d r o r n e
rt
n r ts a tu a o R a re
b . e s 1 b c c e d o tc u s y w
s
p u t r w ra r
t o s o o M
d a n a te
d m m b e s to h " m
in o k to l
u k o f h k r
a s o k S fa a n r
l
ta
o d T tw le r w ro a T tt
o e a is d u a o o ri rt e r w s — o n
to a
p to
f
ti
b
re e s p , n c h
rto to o o a e it A s d te h it e v r ll a c fo
k
m c
th
e r G a o s P k e f
o n e lp ll n t
ls rd to it in ld th th
is
rt u e
e r e rs
e
r e h le li
th a . i te g w s a e " o . . th in th a e ro c m m d s e tw i e
r e s
o d t n
h ric o r
o o a th s e p P s n G b rw c y r M ra e s e t c o b f m l o d u a
u s s t e o t in 2 s a P E rm w a M h o th th C s te c c s k m a e o a in o itr re is d I/ -p
n
n s d i W w m w 7 a o a
tu o e w T o id o a h u z n n n . u in o f e S e a it O P
t o s m lo IO c a a rd 1 s u b
re
h e n
la a s v a p e e o t 't d . , ix d i
e b e ro o f o a g h
in y . B rd rn
o
to
M ir e y e d w e n s p r s n
r a n o a
r s
tu
e
it fo
c e
d s a to u t
rie
s o , p
rd
a , c f a r ec s n o r y s h
I e l y d f r o a l f R
e lm b n h s n d l a t e r g i a el c e u h t i o s w c c s t e el o m tI s o P
a o o S u o in G c s If h rd 2 k s p c t ( tc
t is s w a
o a
o a c r $ c b , u 2
th m f a t m t e a
to
C r s o a w y n (t e w u a o re t e F h h b e it f v s u ig b h to io
. 1 p o u
t
in s le ro
m n a o d h
." e to s w o ig e o b d it h rt b e l
d
t h e e c
t h tr 2 z 1 r 0
e s h rt c o g M h t L d y v d w
re
h r
rl
y f s a e c . a m 3 4
e h u a s a
's ig o e e p u M
in
e t a it th w u to h re a e th -i fo b o a f le
t z s 0
e o a a h e n u s k h P h t i t e h t r p rd tw ot a r e n r a m s s n f r e e e g e
u n n h k o it te fi 2 e rm o s i. la v e e o n e c o e ic e o s
le ro d s t o e w c d I2
a c p w s
th n B e u e
b e m e tic
t w s e f
a y
d d
c e k
s w m d
r, re rv h
c t s r o C a lu t e d b i t h H e rm h 1 h e b fo
o c h y . t m
o e p a e o a
b is th le n m G l.
n it u ls n a a o p . ) e e I n e u r
b w
o
o j o
n n s s
tr fr o ra
. s P P in I g h a w b a w o tw le
n t . r t n u u S r b l s d t m re
,
o ot n e . i in p 2 p g th u
tt s r o o d in o
ro
s m m
r-
p a ri h n m o a e u o h o d L
n m I s a 6 e t u h a o o .l h d k . d a B i s th A e n ,
lo
E d
e T a F s s ro a fo a ir
e
tt n i w rs je
d w o e o o
A
rd e e
s m
p ll e a a D
tw
ic (F tw b h y s a rf e g s u in t o T c Hte ls c e e u u w c p m ld d w p a ri p d
ri
v
s i o le a ig s a d s a n
th
h h a th n a it n m e to e o e li r s r e o s o
m g o u c s u m c r . a e rmo e o n
t.
c c n b ju a r of it e s i o d n , e
y u s t S e
ra
p G a m s "A
t e m re
o g n T a o h te o ar. ro to r r u t g s p r
to r g tr
g it re o D . G m o t " a d f .
te
t w n w u h r,
m e r e e s
e tr h o d w o y M o ri in k h re d to d T t
m u e i t i r j w u
b t n a h 2 u A M
ro
e
ro tu o te g ti e S e p n t n r t r f u li o [3 a
-c v s
th
o 1 ip v a . . v fo v
th to fo u IA to s h a th v th th
r fu th
o t rs h e d h d e h e o s k r ] m it e e h fo
e x .) s a ic e s le
I y e r r, e e r
rn
r r r t t ls e e e e e l e , o . in e ry r , e s s e s r t e e . . h ll n r
th to T F a c b t e p t y o t o y s a I o Y C c P r a b b
I
h h If fa o o w o o
a e G n o o e v n y o u r o e n p n ifl
e o o R n e e
t th U d d a y o v t u t t T u r d s u IR m tih b n
o a a
fi e es R e A M o ir I h s r p h r ia T re th C W O o t m m
t E C d
rd u ri o u o to u e e l h th o d U p t t h
o co tu M s m s u n t fa e
fe e n e u h G th h e . e s s
2 a n p
p s p ra e
n n o e d
te
e n v te r d v TI e e .
to tr o m e o fr a d o m c ro " e n t e
te n R T r ,a
o si d n d u n n c V o y p w T o M o ri th
l P r c I
th l p s u d it o e o g e
rm
d v o Y y A e b n
g
e b m is (3 u o l it o 't d n S m u
ri
r itr a e e
is p w o
ro o h e
o B le as
r e e r e C m
ra n s m e in k ra
d d U u M lu
p .6 h t, b m m a d
co a s s v h o r m t" e a e g w y S it o p m I e
le V a e r it h c
at
m rd
. s e [4 a b d a c fr l r ri
v o B o M t' a o s d
p
te m to n v d u e n o . s ia (I e th t it u n s s d m c
a th I to a .] e it d p l e fo P h h e r d a t
h o s h o t a d Y e u i e e . n o
re h
ier p r fo s u
IN
ss
ro a d 6 d u la a
It a r y s e o w s y Y c ri U e b el u w e
m u V s u p s is o R u o e
te
C b ilf c o o o v S c
g ) rg fa m E a o e o u u d e t G rw o 's n e b
o h to le p a d
is u P n a rt
M
rm ir a s d r e B t
d s o e e v — y L c n . c e c a h a ra n te d a
u sc so b s o c . d a d T o in u rd fa a b d c e
e l re d l . rt li u e a in n h b
to
lo n y d a
rd d e d t tt
e
's w e a b ig ri
t v n e e a a it v e b M g n h
r
il n e e te
n is l P a th c o e u d in a e e ry
h R T v
h
ra t-
e , n g t a rr X p y e a d le a ir
e te th P r n i d u e o t ls l ri d p , k ti a c
a rm e C 2 e a y c p s ra ls is e th o ly te d t e e w v r o m c
d o y ir o e r o r ro
o
it
a o y r a
e i w 0 e o s fo n la te w rm g
ro
o o
c h e
s
r n n 4 t f e m h n c b n c th ti y P ti i
Y
th p
e
p a rie 0 C r s in w d th
p ) ra o o e n o u i o e t e a
i
n ls s
tr
o a y ri
a C id h e r e e 's re
t m d g u 'l b n ) s
. R ls o ir e o a d e s a m a e l o . a f s to
s. T to
o o f c l ir ld e s s re
n R t
's y ifl t r x r
h lel
u c r te v in
s a d E e d e e h c s a
e th r b h te u e g y li
k P s c d s e o e is is o m tw
g e o a it in N v te
e o L ri o m e rd n o
t p r P
rm it
P s o e lo C u p e . v m it d a ( t d o
ro m u d y t r p ra s o a e o i P p a to
v o in y ta e m T 'l P O . p y g
s o u
li h c
e b w th a p y c R fr l in u U u
r, re
t u n y f le
to li a
th ll
a o e ti L o s t T p b c h te o n o ro
co rs s o l. o in
d u n v m e T e S et u tl o e u e w th t s
n a h re n n g . r t e
-C
e it y n B r t y n r. w r d n e o s
n n
e d
ct
o to
r
w th P
ri e o
e p w
s o
e w er
n e
d r Sw R
in ws efL gih
fe tic tci t t
m h h M
a , M
e l b o o
u
"D t to t c
u th r o ir
c
P o r u
o it
n
se c
e
t" co l
la
p n r.
lu n c
g e o
s ct m
20 CIRCUIT CELLAR • MARCH 2023 #392
extensive learning guides for all the hardware the hardware on the Maker board. You can
modules they sell. There is a fantastic guide copy and paste the code fragments from this
for the compass module we are using in this demo into your own code.
project [5]. Normally, the Maker Pi's filesystem is
The guide shows you how to download read-only for CircuitPython, but read-write
the various CircuitPython modules for the for your computer. This allows you to update
S
E compass and drop them in the "lib" folder on the code from your computer. But your code
R
U
T the Maker Pi disk. I made it even easier for running on the Maker Pi can't write to the
A
E
F
you: Just download the files for this project filesystem. My "boot.py" contains a script
from their GitHub repository, and drag my to temporarily flip these permissions so
"lib" folder to your Maker Pi [6]. your code can create data files. At power-
Let's test the compass by recording up, CircuitPython runs "boot.py." If you are
compass readings while we spin the robot in holding BP21 down during power-up, the
place slowly for thirty seconds. Copy my "spin, script makes the filesystem writeable by your
py" and "boot.py," from the aforementioned code. Otherwise, the filesystem is writeable
GitHub files, to the root of your Maker Pi. by your computer over USB. Once "boot.py"
Rename "spin.py" to "code.py," which is the finishes, CircuitPython runs your "code.py."
name of the script CircuitPython runs when it Listing 1 has the important parts of "spin,
starts up. Be sure to copy the original "code, py": my code after all the copied and pasted
py" from the Maker Pi to your computer. It initializations. The code starts the motors
contains a demo program that exercises all spinning in opposite directions at half speed.
Then it takes compass readings every tenth
of a second for 30 seconds. Finally, the code
# From “spin.py” (runs on robot)
turns the motors off and writes the readings
to a JSON format text file named "data.json."
pixelsEO] = (80,0,0) # Red LED ... we are recording
Plug the USB cable into the Maker board and
motorl.throttle = 0.5 # Forward half-speed copy this file to your computer.
motor2.throttle = -0.5 # Backward half-speed The last part of Listing 1 is a program you
run on your computer. It loads the "data.json"
data = [] text file and plots the data in an interactive 3D
for _ in range(300): # 30 seconds of data graph. You can drag the mouse around to look
mag_x, mag_y, mag_z = sensor.magnetic # Read the data at the data from different angles. That's the
data.append([mag_x, mag_y, mag_z]) complete program in Listing 1—just 14 lines of
time.sleep(O.l) # Tenth of a second
code. It uses the python package "matplotlib,"
motorl.throttle = None # None to spin freely (no power) which you will need to "pip install" on your
motor2.throttle = None computer using the command in the comment
on the first line. Before reading on, what do
with open(‘data.json’,’w ’) as f: you expect the data to look like?
json.dump(data,f) # Write the data as JSON The compass module reads a magnetic
source (in our case, the north magnetic pole)
pixelsfO] = (0,80,0) # Green LED ... we are done as a point in 3D space, with the sensor at the
origin. The distance from the origin to the
point is the magnitude of the magnetic source
in gauss. If we spin the compass in the air
# From “plot.py” (runs on PC)
around all three axes, we expect the graph
# py -m pip install matplotlib to be a perfect sphere centered on the origin.
import matplotlib.pyplot as pit But our robot only spins on two axes, so our
from load_data import load_data graph should be a circle centered on the
origin. Each point on this graph is the north
x,y,z = load_data(‘data.json’) magnetic pole as it spins around our robot.
Anyway, that's what we want. But what we
fig = plt.fi gure() actually see is the red curve in Figure 3—a
ax = pit.axes(projection^3d’,xlabel=’X’,ylabel=’Y ’,zlabel=’Z’) squished circle (an ellipse) centered well away
from the origin. What's going on here?
ax.scatter3D(0,0,0,c=’blue’,s=100) # The origin
ax.scatter3D(x,y,z,c=’blue’,s=5) # The data
HARD AND SOFT IRON
plt.show() Compass readings are affected by
magnets (obviously). They are also affected
by any nearby iron. Magnetic sources are
LISTING 1
The upper snippet of code spins the robot at half speed, collects 30 seconds of magnetic data, and writes
called "hard iron" while passive iron sources
the samples to a text file on the robot's filesystem. The lower snippet of code reads the data from the are called "soft iron." Each type of iron affects
robot's filesystem and generates an interactive 3D plot on your computer. compass readings in a different way.
circuitcellar.com
Iron sources can be attached to the that red ellipse hovering out in space into the
compass (the robot). The robot's electric black circle centered on the origin.
motors have magnets in them. Other parts A precise correction would involve a lot
like screws, header pins, and standoff posts of math and matrix multiplications. Fierce
often contain ferrous metal. Iron sources can Electronics has a useful introductory guide
also be part of the environment: metal poles, on this subject [8]. Since we must apply
cars, buildings, and even your cell phone. this corrective math every time we read
Hard iron attached to the robot shifts the the compass, we need the process to be as
compass readings away from the origin. That's computationally cheap as possible. I make
why the red curve in Figure 3 is translated away some simplifying assumptions in my code
from (0,0,0). Soft iron attached to the robot that produce fast, if less precise, corrections.
warps the readings into an ellipse. That's why The first assumption I make is that the
the red and blue points in Figure 3 don't form a compass Z value is always 0. At my latitude
circle. I learned a lot about iron and compasses and with my robot's iron signature, the Z
over the course of this project. I've included values stay relatively close to zero degrees. So,
a link to an informative video in the Articles my code completely ignores the Z coordinate,
Materials webpage on Circuit Cellar [7]. reducing the math to two dimensions.
The iron attached to the robot produces The hard iron correction is straightforward.
a constant, fixed effect on the compass The "calibrate.py" script reads a data set from
readings. Your robot will be different from the spinning-robot output and calculates the
mine, and each robot has its own unique iron X and Y offsets to apply to every data point.
signature. In the next section, we will calculate
a set of correction factors for the robot and
apply them to every compass reading.
How precisely does iron in the environment
affect the compass readings? Well, since we
have this cool, spinning-compass robot, let's
do some scientific experiments with it. We'll
use the readings we just took as the baseline
control. Next, let's repeat the spinning/
sampling with a magnet near the robot. Then
let's replace the magnet with a piece of iron
and repeat the sampling. Finally, let's plot all
three data sets on a 3D graph to compare.
The results of this experiment are in
Figure 4. The control data is plotted in black—
the squished circle away from the origin (the
solid black dot). The blue data was produced by
the piece of iron near the robot. I used a one-
foot-long iron tube standing vertically near the FIGURE 3
robot. You can see its heavy distortion along The compass module must be calibrated to correct for magnets and iron fixed to the robot. The calibration
the Z-axis. The red data set was produced by process yields a "hard iron" offset factor that centers the readings around the origin (the blue curve). The
the magnet placed near the robot. For over "soft iron" correction yields a scaling factor that turns the ellipse into a circle (the black curve).
COMPASS CALIBRATION
Environmental iron is problematic; let's
agree to drive our robots in ferrous-free
areas! But we can't get away from the hard
and soft iron attached to our robots. We can
compensate for those effects, however. The
FIGURE 4
goal is to apply corrections to the (x,y,z)
This 3D plot shows how a magnet and a piece of iron skew the magnetic readings as the robot spins in
values every time we read the compass place. The black circle shows the normal readings with no interference. The blue curve shows the effects
module. In Figure 3, we want to transform of an iron bar placed near the robot. The red curve shows the effects of a magnet placed near the robot.
22 CIRCUIT CELLAR • MARCH 2023 #392
The code finds the minimum and maximum The calculated offsets are shown in the lower
value on each axis, subtracts the min from right corner of the figure.
max, and divides that difference by two. This For the soft iron correction, I used
offset value is added to each point to recenter the "scale bias" pseudocode from Mika
the data set on the origin. Tuupola's online article "How to Calibrate a
The red curve in Figure 3 shows the Magnetometer" [9]. This technique uses the
S
E uncorrected data set from my robot. The blue distance values calculated for the hard iron
R
U curve is the data after applying the offsets to correction. We compute an average of the
T
A
E each point and setting all Z coordinates to 0. distances calculated for the X and Y axes
F
and divide each individual distance by that
# From “ d r iv e . p y ” average. The result is a scaling factor along
each axis. We multiply the centered X and Y
d e f g e t_ c u r re n t_ h e a d in g ( ): values by these scaling factors.
# C lo ck w ise : 0=North, 90=east, 180=south, 270=west The black curve in Figure 3 shows the data
mag_x, mag_y, _ = se n so r.m a g n e t!c # Read the sensor after applying these offsets (hard iron) and
mag_x = (mag_x-OFFSET_X) * SCALE_X # Apply the iro n . . . scaling (soft iron). It is not a perfect circle,
mag_y = (mag_y-OFFSET_Y) ★ SCALE_Y # . . . c o r r e c t io n
but it is close enough for my purposes. And
r e t = math. atan2(mag_x, m ag_y)/m ath.pi*180 # Get angle
the offsets and scales are easy to apply to
r e t = 360 - r e t # Reverse so 90=EAST, 270=WEST
r e t = ( ret+FORWARD) % 360 # O ffs e t to forw a rd (180) each compass reading. You can see these
re tu rn r e t corrections in the "get_current_heading"
function in Listing 2. We'll look at that next.
d e f d r iv e _ t o ( h e a d in g , s e c s ) :
FULL = .75 DRIVING WITH THE COMPASS
heading = (heading % 360) # J u s t in case The "drive.py" program contains utility
hunds = secs*10 # 10 tim es a seconds
functions for driving the robot using the
w h ile hunds>0:
compass module. Listing 2 includes only three
cur = g e t_ c u r re n t_ h e a d in g ( ) # C u rre n t heading
d i f f = g e t_ h e a d in g _ d iffe r e n c e ( c u r ,h e a d in g ) important functions. See the complete "drive,
co r = d if f / 1 8 0 * 0.50 # 0:180 becomes 0:50% py" in the GitHub repository for this project [6].
co r = co r * FULL # 0 to 25% re d u c tio n The "get_current_heading" function reads
i f cor>0: # Turn CCW ( r ig h t motor slo w e r) the compass module and returns a heading
m o t o r 2 . t h r o t t le = FULL - a b s (c o r) # Reduced angle from 0 to 360 degrees. The function gets
m o t o r l. t h r o t t l e = FULL # L e ft motor f u l l the raw (x,y) values and applies the offset and
e ls e : # Turn CW ( l e f t motor slo w e r) scale corrections we discussed earlier, followed
m o to r2 . t h r o t t l e = FULL # R ig h t motor f u l l by a little high school trigonometry to get the
m o t o r l. t h r o t t le = FULL - a b s (c o r) # Reduced
angle from the (x,y) coordinates. Finally, the
t im e .s le e p ( O .lO ) # 10 tim es a second
function corrects the heading to the robot's
hunds -= 1
m o t o r l. t h r o t t l e = None idea of forward. Remember, the compass board
m otor2. t h r o t t l e = None is mounted with the negative Y axis pointing
forward, so we must subtract 180 degrees.
d e f d r iv e _ c w _ s q u a r e ( o fs ,le g _ tim e ) : The "drive_to" function in the middle of
tu rn _ to(sp eed= 0 .2 5 ,h eadin g = ofs+ 0 ) Listing 2 drives the robot on a given course
d riv e _ to (h e a d !n g = o fs + 0 , s e c s = le g _ tim e ) heading for the given number of seconds. The
turn _to(speed= 0.2 5,heading= ofs+ 90 )
code adjusts the speed of the motors ten times
d riv e _ to (h e a d !n g = o fs + 9 0 , s e c s = le g _ tim e )
a second to keep the robot on course. With each
tu rn _ to (sp eed= 0 .2 5 ,h ead!n g= ofs+ 1 8 0 )
d riv e _ to (h e a d in g = o fs + 1 8 0 , secs= leg_ tim e) iteration, the code reads the current heading
turn_to(speed= 0.25,head!ng= ofs+ 270) and compares it to the requested heading. One
d riv e _ to (h e a d in g = o fs + 2 7 0 , secs= leg_ tim e) motor always runs at top speed (75% here). The
other motor runs at a reduced speed based on
the heading difference. The larger the difference,
LISTING 2
the greater the speed reduction and the sharper
The "get_current_heading" function reads the compass module, applies the calibration parameters,
and returns a compass heading angle. The "drive_to" function drives the robot along a given compass
the turn toward the desired heading.
heading. The "drive_cw_square" function drives the robot around the floor in a large square. The "drive_cw_square" function at the
bottom of Listing 2 drives the robot clockwise
in a square. At the start of each leg, the code
Additional materials from the author are available at:
turns the robot to face the correct heading.
www.circuitcellar.com/article-materials
Each leg is perpendicular to the last. Then
Reference [1] as marked in the article can be found there. the code calls the above "drive_to" function to
drive the robot forward along the current leg
RESOURCES of the square. After all four legs are complete,
Cytron | www.cytron.io the robot should be back where it started.
HiLetgo | www.hiletgo.com But, with a leg time of three seconds, my
Raspberry Pi | www.raspberrypi.com robot usually ended up within a couple of feet
circuitcellar.com 23
from where it started. So, I experimented a lot of improvement. Maybe I'll change it to a
with the robot at different speeds and on PID control algorithm.
different surfaces. I discovered a few things. The Maker Pi board has six more Grove
The motors are imperfect. At slow speeds, connectors for other sensors and hardware.
my robot drifts to the right, but at higher I could add an I 2 C OLED display to show the
speeds, it drifts to the left. Wheel encoders current heading while the robot moves. Or F
E
would help here by measuring the exact speed maybe I'll add a line-follower array from A
T
U
each wheel is turning, and I did find a pair of Seeed Studios. Of course, I'm only using half R
E
encoders that work with this robot chassis [10]. of the sensor I have; the compass module S
The motors also stall at slow speeds. On my also has an accelerometer that I need to
robot, a motor set below about 25% doesn't experiment with.
move at all. The actual stall point depends on This compass project might seem old-
the batteries' charge and the weight of the school in our modern age of GPS. Adafruit
robot. does make an I2 C GPS module I might
The driving surface makes a huge experiment with, but the cost of the tiny
difference in robot performance. The wheels module is more than my entire robot. And
on the robot slip and slide on my hardwood never underestimate the power of a simple,
floors at home. The robot works much better inexpensive compass. Knowing a general
on the carpet at my work office— but at the direction and being able to travel in a straight
office, there are metal support poles holding line might just be enough to get your robot
up the roof. Once, my robot drove too close to out of the woods.
one and veered off course. That's the soft iron
effect I discussed earlier.
ABOUT THE AUTHOR
FUTURE FUN Chris Cantrell is an engineer for Vertiv. He also teaches for Professional and
This little robot chassis has so much Continuing Studies at the University of Alabama in Huntsville. When he isn't
potential, but I've barely scratched the surface. working, you'll find him soldering on some fun loT project or digging around
Next up, I want to add a set of wheel encoders. in the ROMs of an old arcade game. Chris has written multiple articles for
That will help my code track a straight line. Of Circuit Cellar over the years. You can email him at tophercantrell@gmail.com.
course, my "drive_to_heading" function needs
By
Dev Gualtieri
was an early adopter of X10 home event table was a DOS application, and I still
automation. I bought my first X10 needed to keep a DOS computer for my home
devices at Radio Shack in the early 1980s. automation updates.
X10 was able to send commands to light In 2010, I designed and built my own
switches and other devices by transmitting X10 controller using a PIC microcontroller. I
data encoded as short 120kHz voltage signals detailed this in a two-part article in Circuit
on the AC power line synchronized with the Cellar—"Build an X10 Controller (Part 1):
zero-crossings of the AC voltage. Initially, Circuit Design" in Circuit Cellar issue #240,
there was no X10 automation. There was just July 2010, and "Build an X10 Controller (Part
a companion control box that injected the 2): The Controller Program and Utility" in
proper data signals into the power lines when Circuit Cellar issue #241, August 2010. In
buttons were pressed. the past few years, some of my X10 switches
I was doing embedded systems work in the have failed, usually a consequence of aging
same period, so I had the tools to roll my own electrolytic capacitors. Replacement X10
controller. An embedded system at that time devices are hard to find, and they're usually
involved a Z80 microprocessor with its multitude quite expensive. It was finally time for a
of peripheral chips, a few kilobytes of static RAM, technology upgrade.
an ultraviolet erasable programmable read-only
memory chip (EPROM) burned with an assembly HOME AUTOMATION ON THE CLOUD
language program, and a NiCad battery backup. There is now a plethora of sm art home
I needed to design and build my own 120kHz devices from which to choose, including
power line transmitter to mimic the X10 signals. some that respond to voice commands on
Fortunately, some hobby magazines published companion devices. Nearly all of these are
information about the X10 signal specifications, cloud-based; that is, an internet connection
and I was able to build a reliable X10 controller is required for initial configuration and
using 1980's technology. subsequent operation. Such cloud-based
Eventually, an X10 controller became systems have a significant privacy problem,
available for true automation. This was the since they send data about your lifestyle to
CP290, which came with RS-232 connectivity the cloud providers hosting these services.
to a host computer that allowed one to upload There's also a security problem in connecting
a schedule of timed events. I purchased a your sm art home devices to the Internet.
CP290 and retired my Z80 controller. After Quite a few articles have been written about
a time, another problem emerged when I hacking Internet-of-Things (loT) devices
migrated from Windows computers to Linux. to gain access to home networks and their
The host software to update the CP290 connected computers.
circuitcellar.com
I m anually installed the R aspberry Pi OS A nice Apache2 Default Page should appear.
(64-bit), w ith desktop, onto a 16GB class To then check w hether your PHP installation
10 (high-speed) m icroSDHC card [2]. This is operational, create the follow ing sh o rt PHP
operating system is com patible w ith the script named info.php in the /var/w w w /htm l
Model 3B+ and the newer boards, including folder: < ?php p h p in fo O ; ?>.
the Model 4, the Model 400 w ith its integrated When you direct your web brow ser to
S
E com pact keyboard, and the Zero 2 W. One http://127.0.0.1/info.php, you'll get a very
R
U of the first things I do w ith any of my Linux long and very com plete sum m ary o f the PHP
T
A
E system s is to use w hatever package m anager installation. The python-kasa Python libra ry
F
is available to dow nload the Synaptic package is easily installed fo r the Pi user by opening
manager, w hich is my preferred package a term inal and issuing the com m and p ip
manager. Python is already installed, but you in s t a ll p y th o n -k a s a .
need to install the Apache2 w eb server and This allows execution of the many Kasa
PHP. I found that when I installed PHP using comm ands. You can get a sum m ary of the
Synaptic, Apache2, the Apache PHP Module, com m ands by executing Kasa --help in a
and the com m and line version o f PHP w ere term inal. This brings us to the im portant topic
autom atically installed. Alternatively, these of file perm issions in Linux. Usually, when you
can be installed from the com m and line using can't execute a program or w rite to a file, it's
the follow ing comm ands: because you aren't perm itted to do this as the
Pi user. However, there is an adm inistrative
sudo a p t-g e t u p d a te user named root who can do nearly anything
su d o a p t-g e t in s t a ll apache2 he or she wants, including changing file
sudo a p t-g e t i n s t a l l 1ibapache2-m od- php perm issions for others. For the sm art home
su d o a p t-g e t in s t a ll p h p 5 - c li applications that I've written, python-kasa
needs to accessed by the root user, also. This
There are m any online tutorials on how to is most easily done by opening a term inal as
accom plish such installs from the com m and root and repeating the install, as follows:
line. The Raspberry Pi OS installation also
includes Geany, a nice program editor that su d o -i
I used in my so ftw are developm ent. You < prom pt fo r your pi user p a s s w o rd >
can verify that the Apache2 web server p ip in s t a ll p y th o n -k a s a
is operational by typing its local address
(always 127.0.0.1) into the location box as You can then test your Kasa install as
http://127.0.0.1 on the Raspberry Pi Chrom ium root by executing Kasa — help before quitting
web browser. the term inal. At that point, all the required
system so ftw are has been dow nloaded, and
we can proceed to the sm art home devices
Turn Off Wi Fi and applications.
v* SmartPi fi t
DEVICE INITIALIZATION
Things are easier if you install your Kasa
switches and dim m ers one at a time. Be careful
FIGURE 3 here— switch off the circuit breaker to remove
Here is the Raspberry Pi Wi-Fi menu, power from the switch box, and follow the
showing the wireless networks that
wiring instructions included with each device.
are accessible after the installation of sc 7
For extra safety, I have a non-contact voltage
a Kasa device. The current connection
sesefcaSfo.-- ft t probe that verifies that there is no power to the
is to the Wi-Fi access point named
SmartPi. Connection would be set for ft 1 switch box before the removal of the old switch
the Kasa device for initialization. The and installation of the Kasa switch or dimmer.
TP LINK Smart Switch 0A9A t
SSIDs of the other networks, most of Of course, the Kasa plugs are much easier to
which are my neighbors' networks, ft ; w ork with, since no wiring access is needed.
are obscured here for privacy. The Kasa discover command is designed to
locate Kasa devices on your network. However, at
this point, the command won't find any devices
ABOUT THE AUTHOR
for the simple reason that the device doesn't
Dev Gualtieri received his Ph.D. in Solid State Science and Technology from know your Wi-Fi SSID (name) and password,
Syracuse University in 1974. He had a thirty-year career in research and and it can't join the network. The Raspberry
technology at a major aerospace company and is now retired. Dr. Gualtieri Pi, however, can join the Kasa device's network
writes a science and technology blog at http://www.tikalon.com/blog/blog.php. for initialization. When you examine the Wi-Fi
He is the author of three science fiction novels, and books about science and networks available to the Raspberry Pi, as in
mathematics. See http://www.tikalonpress.com for details. Figure 3, you'll see your Kasa device is listed
as an unsecured network. The menu shows
circuitcellar.com 27
that the Raspberry Pi is connected to my Wi-Fi the On and Off buttons appear for all devices,
access point named SmartPi. the percentage buttons—which represent the
To configure the Kasa device, connect to percentage of brightness— only appear when the
its netw ork and execute the Kasa discover device is a dimmer. You don't need to create such an
com m and. You will see ju st one device w ith elaborate image for your sm art home system. The
the IP address 192.168.0.1. You can then scan sm art home web page will work with any image, F
E
for the W i-Fi netw orks that are visible to the such as a simple rectangle with the names of your A
T
U
device w ith the com m and kasa --h o st devices. I used the Linux Inkscape application to R
E
1 9 2 .1 6 8 .0 .1 W i- F i scan. create my graphic. S
As a result, you'll find your W i-Fi access This manual control application, smarthome,
point and its m ethod o f secure access (usually php, appears at the IP address of the Raspberry Pi.
keytype 3). Use the com m and k a s a --h o st In my case, it's 192.168.1.184. It's addressed on my
1 9 2 .1 6 8 .0 .1 W i- F i jo in --p a ssw o rd computing devices as:
‘ p a ssw o rd ’ --k e y ty p e 3 ‘ S m a r t P i’
to instruct the Kasa device to join the access http://192.168.1.184/smarthome/smarthome.php
point netw ork, substituting your SSID for
the Sm artPi SSID of my access point and since it's placed in the /var/www/htm l/smarthom e
your passw ord for the passw ord portion. directory of the Raspberry Pi. It comm unicates with
Then, sw itch the Raspberry Pi back to your the Kasa devices via the shell_exec() command in
access point netw ork, and once again execute PHP, which calls the Kasa application with appropriate
Kasa discover. You'll find your Kasa device
there along w ith its IP address; fo r exam ple
Alias Type IP address X Y
192.168.1.xxx. At that point, you can set the
device alias, in this case "porch," w ith the "n o n e
com m and k a s a --h o st 1 9 2 .1 6 8 .1 .x x x kitchen dim m er 192.168.1.204 325 150
a lia s ‘ p o r c h ’ . Subsequent execution o f
yard dim m er 192.168.1.191 425 75
Kasa discover w ill show that the device now
has its alias. lamp_post switch 192.168.1.196 400 400
command line arguments and gathers whatever lights and appliances. Another web browser
output information it generates. application, entry.php, lets you create a list of
While PHP code is quite readable and looks daily On, Off, and Dim events. This file allows
a lot like the C language, those not familiar with up to forty possible events, but I use less
server-side coding will find some parts of the than twenty in my home. So, there's plenty
S
smarthome.php code to be mysterious. The of room for expansion. As you can see in the
E manual application has been tested with both browser screenshot in Figure 5, the devices
R
U Firefox and Chromium on my Linux desktop appear in sorted order, and there are drop
T
A
E
F computers, Chromium on a Samsung tablet, down lists to select the Kasa device, the time
and the Silk browser on an Amazon Fire HD. by hour, minute, and AM/PM, the event type,
and whether the listed time is fixed or tracks
TIMED EVENTS the sunrise or sunset. The times are in five
The manual control application is minute increments to limit the number of
occasionally useful, but the heart of the items in the drop-down lists.
smart home system is the timed control of At my latitude, evening twilight lasts
about half an hour after sunset, and morning
twilight begins about half an hour before
Smart sunrise. The times for sunrise and sunset are
Home Events updated daily. In this way, entries such as
Interface "sunset+15" will be the appropriate time for
any day of the year.
S u n r ise = 0 7 :1 5 AM S u n s e t = 0 6 :1 0 PM Firefox is my browser of choice, but I
discovered that it has a long-standing problem
Save in updating the standard HTML list boxes after
a page refresh. A possible reason why this
garage 1 0 . 30 , PM, On a c tu a l_ tim e , bug has never been fixed is that almost every
garage 12. 30, AM, Off a c tu a l_ tim e . website now uses custom list boxes created
6 1 30 , su n se t+ 2 0 using CSS, and these work fine in Firefox.
k itc h e n PM, On
However, the standard HTML list boxes are
k itc h e n 1 2 , 30 , AM, Off a c tu a l_ tim e , far easier to program, so I use the Chromium
la m p _ p o s t 6 . 25 , PM, On su n se t+ 1 5 web browser for editing the events. Clicking
the Save button writes the edited events to a
la m p _ p o s t 3 . 00. AM, Off a c tu a l_ tim e .
CSV file named events.csv.
la w n _ d is p la y . 6 . 1 5 , PM, On su n se t+ 5 Here's where file permissions become
1 a w n _ d is p la y . 1 1 , 00 , PM, Off J a c tu a l_ tim e . important. During my program development,
there was never any problem reading the
1 iv in g _ r o o m . 7 , 00 , PM. N one a c tu a l_ tim e . events.csv file. However, the data entry page
porch 6 , 3 0 , PM, On su n se t+ 2 0 wouldn't write to the events.csv file after
porch 1 1 , 30 , PM. Off a c tu a l_ tim e » clicking the Save button until I assigned
it to the www-data group with read/write
X m a s _ lig h t s , 6 , 1 5 , PM. N one su n se t+ 5 privileges. This was accomplished through
X m a s _ lig h ts . 1 1 , b o , PM. N one a c tu a l_ tim e . the following commands:
yard 6 , 20 * PM. On su n se t+ 1 0
sudo - i
yard ^5 v 5 0 , AM. Off s u n r is e -3 0 . (pi user password requested)
—n o n e 12 , 0 0 , PM. N one a c tu a l_ tim e . cd /var/www/html/smart home
~none 12 , 0 0 - PM, N one a c tu a l_ tim e , chgrp www-data events.csv
chmod 666 events.csv
-*none . 1 2 7 0 0 , PM. N one a c tu a l_ tim e ,
■ .. '“T A 'T I * « ■ 1 I
The trailing ampersand is important. Otherwise, cron will cause the system to hang during boot.
NETWORK INTERFACE
As written earlier, to access the Raspberry Pi web server, you need its IP address. You can find this by executing 1f conf 1g
from the command line on the Raspberry Pi, or by using the nmap command on another Linux machine on your home network.
These will output something like the following, from which I found the 192.168.1.184 IP address of my Raspberry Pi. Nmap also
shows all the Kasa devices on your home network, as the example illustrates.
You can set a static IP address for your Raspberry Pi if you want, but that takes some effort. However, I've found that the
assigned IP address of my Raspberry Pi doesn't change, which is likely a consequence of the device being on all the time, and
the router giving its connections a long lease life.
You can access the Raspberry Pi using the secure shell (SSH) from a terminal. For my system with my IP address, this is
accomplished with the command ssh -X -1 pi 192.168.1.184. Once you've connected with the Raspberry Pi, you can open
a graphical instance of the file manager by typing pcmanfm. I've always found that graphical interfaces make life a lot easier.
You can also copy programs to and from the Raspberry Pi using the secure copy protocol (SCP), which is only possible if
you've enabled SSH on your Raspberry Pi. On my system, I use the following commands, for which you should substitute your
own Raspberry Pi IP address in place of mine, and your own Pi username for p ijjse r:
In my time using my smart home system, I experienced one small problem. After a power interruption, one of my eight Kasa
devices disappeared from the network. Problems like this are corrected by a physical restart of the switch or dimmer device
through the use of a small button on these devices (Figure 6). There's also a button to perform a factory reset. A Kasa plug can
be restarted by unplugging it from its wall outlet and then replacing it. Plugs also have a button that allows a factory reset.
CIRCUIT CELLAR • MARCH 2023 #392
echo h r e f = \ ” h t t p s : / / c i r c u i t c e l 1a r.
com \” >C1 r c u i t Cel 1a r </ a >” ;
embeddedworldaoas
Exhibition&Conference
... it's a smarter world
Get your
free ticket now!
embedded-world.de/gutschein
Use the voucher code GG4ew23
Medienpartner
G (P b N
ra C e e
b B st e
d
a ) a
d p t
o
cu e p
p si ro m
, g a a
p n ch ke
u a ?
t n a
y d W p
o p e
u ro
r ro ll, to
f
e to yo ty
e ty u p
t p 'v e
m l b n o e b a c S e o t R a o a a L W u i e ,
w a a
n e f n a
cu
ll o p a f h o n f t it
.
co p n b
u b re w g n l e m a m V
I I a g u
tih , a p e
ri
o le A n
ri
y
rl l u a cl A A co
tt
e
o a k
I' ro in
g h co R a o s n a s e s ER n h t
sc p ve ca
v e o si , g n o n g e E d a m
ri
n a il p o p e f ti re tci
o S q m el e
ss
i n e
lo e u f a in a e a n to p u a g
y.
a yo o so WW r ve ti'
s
g t o b g ri
n t s ri e n o ss r ca
u t m e
w sc ra u g
ll ,"s p ta n d M yl l t e
IR R a to b
o t r o n i s n o p o ro g st
ni o o d e
in p p d
ltii
y u t r p f lk . — le o a a e ca EA
co
e
h k e g o . t im o a r to g f d g d n b n o m th n
i n a je s o m a A a i w
rc o e u u e WP n e
m e
l r- a t
a
th e u ty b n l
w o a h . ! e
d ni s n a ct I je
n p o d a n — ct
A
ca te ry m a
se
e t co a g e u y s ,r n n
ri
n ti ,ll a
R IS a ri w
g if n n m tsc s t w s a a a d o p y A g
fl g e b o p d a
ca
a — p to s m n ro lo h h
a n d y u r ce
n ll n t h ti th
h PD
b sl o p a d d h
ro a h b t
h e o fr w e o t a E n t lie
o
o f m
ma y to t
re
g t e o to t o e e d n o a v A g p
u e h p f b ld g m s d yt e a
t e ir a a ty o so e e lo se
yt s in u p D w la
y ig t p r u rs m n p e sn a
co
b in n
g e d r , . d e tt t o m t
h o f g
sa . a ce d
a a s e ce e .
sta e h th w
ft
e e a
io
, i . y .
in
in ci ci n m s a T m d s? r e e r s t sit u d
rc n y a h a ir t e s b .
L P yo
h
o ti S
si
a ht le th ti re n in n e "L u rl se p a d p u so O n ri u
m e , e m g y a p in a ca w M ye ty le t m n 'r
p
st
b o g
ro a t g u N ce
e
co m e ali r th p a n
so m m a a a i p a to e G
te
lit a e re o n p
rs
n n o su t d n
u m m id in b ti re ra w a ll
o , o n p im th
o
d i p
d e l n h ci h
sie
w re r
a e e
e d e l st
t g o o to ttli
th ig t th w m :
ci t
t o h t p u th ic
l a o n e h e e o is D
s. e
l e
f e o a e s e ry h e n f s d e r ll e f e I
rc su
a u re
rk ti
a w m w w u b p w a a E ( i
n a e a m t
h e n i in a a A A b o
o i i p lo e o ft p O d b x o e t ro
sa
n g o f
u re th o g u p e o G o p
ss ve
o co le cc
d e a t
fe
kr , m d b r - A u u lo u st S n u s o h
w til
y o ld ro ch E s lg t re b o d a rp n m w s. rd e
th co
a e a ot — E e t
re
d ht e o d p
e ol n n sa t th
a ), a h st yo ry p , a a it
so
d d fi
n
rd a yt e m e th t in u . r ra
b n n h
d fi re el e -h ke p p I g e e h g w o ti u d
a rs d h
ric
e R p a a n d n im p
- t a
ss ly fi o o ro ca ri
a cu
p t s,
y e u g e
a ce le o w m x n s o e ziz m n
ro
n ti
m h ve tu
s d u zlz
e I
rr
e
yo th
t d
ct
t n a to
d e
sp
n t a a im a d n
ss u e o b h g .t
-C e ll a o e t m s n a t st t ib to e rk ty
h b t o d o st te
O a v'e a g ro th e p
ls e a E te ili n o m n e
ikL e
e u (F it w t
h la re
m
st ld rt st
a
ch e
ti
n e s
e o e m
ck q yl w e
ti co sw
a a u w ri g
to str ig .
f
ir s u p th te s m e b a T F
u T e E in ir ir a G it e r o
ke re la n co h IG
s- n i r h - o e e u h o a ef e
f e e ni w dl e d t y n u a te w st m N U
u o t e , f si a f d to is
: t b a t R
e sa ra
r m w x in p e u t ts
ill o e in E
fl 1 re n p p et E h th th fo th i
le a ) s e G a ni fo e e e l e le It t?i ro re b a C
d r n th is e th
m u g o t n e t a d to re u co e
e
ly u d
ke
h
ct o a rn e W o p rci
a w lt
i n e a F ri g
ri
p e ty t r
zz m ic ir l
e
s. o n , s, a a b i c yr t.r a h e p h w e n
ll- u g fi
n p u ll, e e c o
n B d l e c t c d c E e l B b t n . a o ci in f
o d W
h srt
ig u n o u e ro st
— e n u p a p p r
d b e
h t, g m e rs je n D g
ss t ti al s. s W a a
sn v ir
n p w o m i s a it e
te a o se a p le ct tu ig in n ce R w h n b if sk a W
ft ft t u le a , h ri i e . irf o e a t a n
fi
e b
rs e e o g t irf o n e e ta e st t it ili n l ra
, r n f e e e f d I n s l r ,
re o st h 'ts is ty d g t, e p
a a o w st m p ch p b p si m p sk w T p w ht re a h t
h si o o ci g O o t D w w fi cl su a in a (F ca p d g a th d b ao fo w w a cr b h h t
n s n a a o ro ri e ro g i e a h u o a n o e d u n l
o G g i h a u re t n i b ro ra re n a e re nr r o n e a e
d to s e n g n g s e n su d t n e t rc ra
e n m b e g w a d t sk a d ro
u d a
iln lf
co rt re d a a S o t a h
rf
e
lils rp rk d g u ry -E cr it S p n je r a u le je . e t m n "W
m g ta e u p te n o l t m d o lt o it E e a ti e m f r , e .t t n d d y g ld ti
v
k, fr- re
ro ig p d d . , ty ct ra in a co so sp n re , m a l ll w sy ct in te e ct r e e F b ch
o . ir u
so
e h ie
u p i
so ct a R p is h ly ra o w
se
w n ld e e w E a m rr
t h a I st e o o nn p I e m u d
su
u a n o p io n ti
m e a re p o n e n
co
a n h ig it te
p n i s a a co o e
tti
e
rn 2 n b th e d r a su e o m lt
n
ti n g n h n d ci ig su
v g
th b o al so u e d p n - a h h o k n r n o d o a d r 't ro
a w v n i
g
te ti rc h e m e e o e a a f ri p i t a m t -w e t o
). a to d cii
a to lw a h e , tr
r- c t is p a u t s o r ce ld ld ct n e u
ln st
a ch th
y
in
b
su
n n H m t ke si
m n g r a a a g
— b ra th r cc ti a w e d kc in e in g th n e liy ta n m e g o d y
rd
h p o o e ty a a yll rh
n n
a a G e ict o e d th g te te o b g e
r-
c d o d re d y
tl s o e t n b p r t p y p g st e d
e n a ce b ro e iu a
th w f e
rl
e d ke id o r d e
rk
e h w r
s,
l e le w e s !" e a
si ch
oll se r s b te ss o u n m t
ro irc a st g m
la e g e a
ru so e n o ch
e a m d m th a mo t
ily d st a
w d b p o d ss i a n t u n o
it
h ra ss
m si rio re d rs kse th a
re g m
ze r' u rt a v b p
tw s. u co o o
e a a , b d w n cu
f a g n ra tc e
th ys s fa n s e b a m y e ss
o e rt " se yo m n ti
e r er a e l rd o h t e d t t ti
o n b o n , st
p
iz p h a p e o e w e c in r, e ro h Y d u y
co
d
sl
i
rs c
d sc rd to . n a
it h th h u a e e h e n e o f a
ilu re
a g it ts y b m w e n su ,
h lig n o s th , n re e n o re l o d co d
re
f
th lb n a s' co e je p e m a c
e e h t w A (P e n re e si fa a f rf d m
rm a y
ch in ft o re ila s o b n b tsa th ,s so sa co
p n o
n m e
la sl e u C a m o n ir
e a in rd d li
rca p a a b o o g s w b a fo f o lle le tcs ro
e
ro e d lle
g
t- y B a l n th d p
ct
, u n ft th b
re a o p y o ic , w a a o h n ch
d sh n fe ld y.
e j
ct
e ro
a b le o (d ll to ) d e o sie e d n p
to u e in e o p u o e n u re e
th h
le t n t a e ct , w e g ir ll e d j p d ct
i
n o u a m a
te re , r e g re a
ra s a
ct
a e t n a e t — . c r o e te trs io w d . o ct e o e i
e ict a trc t o s a 1 t d e in o r a d n b g d n r, e n o o r n a
yo g f-l p n b it w e
rl "T
a w a o
e d r o n n ss
9 h e d
si
g e a d e l a rd in n rn t
s—
m u a st y n o i h E
sa
h fu ct
o e d n
ca n i 't th ti
o e 9 e si th cr n e a l b
(F
p y . g a a
sa
p g fo jo n , e o st ile re th a lt O ss a n ss
r -b
rs
p t g e n m 0 g e o in ch
o ig o le n
ts in p if y h r g d d ri in a o a w ve G d e .r o
a ic h e T n r'
s
rg
a w a n u w b T d rc o g ro o ilc g b si w p o d u a w b s
t'
e m p T u f
tu b ve e b s, h f t p w e e h o a f n t
h a t
h t
h r g l
u p f b t e f y
ry -E r h g m
to le co tm
n o ly it a sts h ro p r rd o d
u re e n e f n fo to a e u e n h e d o w E e g d b
re
re vo f sh ir
d u a is a s r y la e h t r e e te e t d n a a o d
th
a
ill
e , a o . a IC o
d , s) lo a ul b
se lt lk w ro s d l t 3 t d y e yt d l s d l 's
ck
e so
in n I d t
le se t, s d
e — re g th
e o lf , e sy e b o o g p p w S , a m b b sic rd ld ci h g a b r n
la
o
rf e o
ti e c E . o fo to th fo st ). u m u ir r e a e b y ta o o s ch ri
b a s e r a g o t c a t p w w
ve
o y t a t-r p f rm a tse r o a ve th yl n o , n w . a y b a r p a
sa th in a o o lu o i
su
mr th m n P m o a ss. yt t ft b T ss
r ig b e p je
co
S tt o e b rd
m a ri cu ve
e re d ti s u re
lo u a o C ru th n a p m th e l h e h le m h e a te n i o e u le rd a n rm o e n it e e
rd b e o
p t, ch
s t e f B e n ch e d t A e it . e n e e s a t s w ct n d d re
, r r - s n t n d e re g s ir a e r , s e , n a ld s,
O F a o a p w p d a a w P
G IG n f n re fa co
e a
th
n n
si
m C
-E U d f d la q e b u y is d d B
E R u ce u re ri ld rf y.a
w E o a d e ca b
re m so -p ila
b
ir 3 n lly
w . co m o a o la r In o
e e b e Y
st
e t a d ld a
d u e o t n d e r
liz
e e ce in r
p itl k u h fi re d e r n th d
ro tl ilt e d d n
ri
n m o e s
e p o ju e fo ly g
to
a r lu n r st th zia a va in
yt p
ro s st x t sp a a t a ch t w
p p t o u ni a i g t io n i io a a
e o n e d n n k
er ty la se ry re th n e s e sy
p t n yo a o e w th s
a
ci
e e t o u la P f y e o st
r o f r C d a o f in f e
te s. u h ivt B co s r m
d
yo
t a d e e u lik P th a
tI u a e ly a ve ld
th e a C e
to w w
vi
n si n a . u B s ict
d a fe g g d lo d t T e
a s o w n sm p th h
to
p a
u , se m tci
e e m a n
y. a ld th a n e h a
ro
d d
m e e yo ll d n O re d v
r el u ht G
te u a
a e co co t.
e su d n
st
a
g ce ct
m co ti N
-E lt
ct
n
ic iv ro
u t.s o o
to E a io ce
d
a e n p u w s o ss n s a
l ci o ld t u
rt
o f e —
ti a n e
If to f a m p ca rd
m b fi e th ro ll iz
o le n ve yo
b e u th b cki m e
e x s ts n u e y s e o ly - e d
, f
B F
r
e
IG
a U
d R
b E
o
a 2
rd
ni
g
it
.
c
rci
u
it
c
e
ll
a
r.
c
o
m
3
E RUT AEF HCET 3
CIRCUIT CELLAR • MARCH 2023 #392
the PCB design and prototyping market. Like customer service. They were among the first
Adafruit, they provide a full line of prototyping PCB fab houses to embrace instant online
products and services, but they also include quoting and e-commerce manufacturing. They
prototype development, PCB design support, focus on making the PCB fabrication process
fabrication, custom plastics, and metal as easy and customer-friendly as possible.
enclosures in their line (Figure 5). SlingShot Assembly: Another cute name,
All of Vero's products are manufactured Colorado-based SlingShot Assembly also
in their Southampton facilities and are provides fast turnaround on prototypes.
supported by their worldwide distribution They quote full, top-quality PCB assemblies
partners. Vero offers the ability to modify or as low as $500. Their motto is "We Do The
customize their standard products, reducing Impossible... EVERYDAY," and they emphasize
the costs of procurement for the end user, and value while still meeting the short turnaround
lowering the overall costs by being a one-stop times that developers require. Like Screaming
shop. Vero serves a diverse customer base, Circuits, they have a full online quote and
but I would say they're more focused on the order process. You upload your design, get
commercial market than on the hobbyist. an instant quote, and then place an order
Their mission is to assist customers in with just a few mouse clicks. For ease and
bringing their products to market in a timely convenience, they can't be beat. T
E
C
and cost-effective manner. RayMing Technology: For more mature H
designs where the need is small-run F
E
DESIGN/FAB HOUSES manufacturing in the hundreds to low thousands A
T
U
For those that prefer to outsource their of pieces, there are many fab houses with excess R
E
fabrication, many short-run manufacturing capacity that can do the job. RayMing, a global
firm s can provide these services. A casual company based in Shenzhen, China, provides
search for PCB fabrication will turn up this type of contract manufacturing (CM). It can
hundreds of candidates, so choosing a be the next step in scaling your prototype into
firm can be daunting. As with any service full production. Turnaround times are longer and
provider, reliability, convenience, cost, speed, include international shipping. But during the
and other factors come into play. These are 14-year period in which I ran my own company,
specific criteria, and therefore difficult to contract manufacturers like RayMing were
generalize in an article of this nature. So, the how we brought all of our products to market.
firm s mentioned here are by no means an Sure, there were risks in sending our designs
exhaustive list. overseas, not least of which is piracy. But the
Millennium Circuits Limited: Founded in low cost, reasonable minimum run quantities,
2005, Millennium Circuits Limited (MCL) started and short supply chain made this type of
out supplying bare PCBs [6]. Over the last 15 fab attractive to a small company in a niche
years, they've expanded their capabilities market. This option is a little outside of the
to include everything from quick-turn
prototypes to scheduled runs of production
quantity products. They can produce boards
in various form factors, including rigid, flex,
rigid-flex, aluminum, ceramic, heavy copper,
RF/microwave, HDI, and more. They are ISO
9001 certified, with the controls and processes
necessary to ensure the consistent quality
that every customer should expect from their
PCB partner.
MCL serves all sizes of companies and
industries, including automotive, consumer
electronics, marine, industrial, test and
measurement, LED, medical and more.
They provide rapid quote responses, flexible
lead times, technical support, cutting-edge
technology, superior price-to-value ratio, and a
variety of PCB solutions through a single source.
Screaming Circuits: I don't know about
you, but I just like their name. Screaming
Circuits is a division of Milwaukee Electronics
[7]. They were founded in 2003 to provide
personalized PCB assembly and fast, flexible,
on-demand prototypes. They specialize in FIGURE 6
accuracy, fast turnaround, and top-notch Voltera V-One
CIRCUIT CELLAR • MARCH 2023 #392
pure PCB prototyping arena, but many CMs Headquartered in Hangzhou, China, with
will support your prototype with short runs, offices in France, the U.K., Hong Kong, and
simplifying the eventual production ramp-up. Shenzhen, PCBWay specializes in high-quality,
PCBWay: Last, but certainly not least, we on-time delivery of your project prototype
have PCBWay. This CM has been in business in any volume. In addition to standard PCB
for more than a decade and has a worldwide prototyping, they offer CNC machining, flexible
presence. They pride themselves on fulfilling PC substrates, assembly services, and a host
your prototype needs as a one-stop shop. of other specialty fabrications, with an optional
24-hour turnaround on your prototype.
BOT-BOT-BOT
Now we come to the fun part. Buckle
up OG-EEs, because the game is changing.
Perhaps I am late to the party, but the most
interesting thing I found while doing research
for this article was PCB fabrication bots. In
the same vein as the now commonplace use
of 3D printers for mechanical part fabrication,
these bots will print your PCB for you. This
information was astounding to little old me.
Let's now go into some detail on this brave
new PCB prototyping world.
Voltera V-One: The first bot I found was
the Voltera V-One (Figure 6). This compact
device takes up just a few square feet of
bench space, but it packs a lot of punch.
According to the manufacturer, there is a
bit of a learning curve, and you may have to
make a few practice boards to get the hang of
it. But once you do, it's easy to use.
The V-One uses high-performance
conductive ink to print your PCB traces on
almost any type of substrate, with your
standard Gerber file as input. The V-One also
dispenses tin-bismuth-silver or tin-lead solder
paste at pad sites. And it supports multi-jig
drilling with snap-in tools and reflow soldering.
All in all, it's wicked cool tech.
The manufacturer claims that the inks are
sim ilar in conductive performance to copper,
and are suitable for digital, radiofrequency,
FIGURE 7 and low-power circuits. A $100 ink cartridge
DragonFly IV will print many PCBs, depending of course on
the size and complexity of the circuits you're
building. A single ink cartridge equates to
Additional materials from the author are available at:
100m of conductive trace at 8mil (0.2mm)
www.circuitcellar.com/article-materials width, or 200cm 2 of solid pour. Each ink
Reference [1] thru [10] as marked in the article can be found there. cartridge has an official shelf life of six months
and should be stored in the refrigerator when
Resources not used.
Adafruit | www.adafruit.com The V-One provides a precision dispensing
BotFactory | www.botfactory.co system for fine fluid control that deposits ink
and solder paste with a 0.65mm pin-to-pin
Millenium Circuits Limited | www.mclpcb.com pitch. It can dispense solder paste on pads as
Nano Dimension | www.nano-di.com small as 0402 and ICs that have a 0.5mm pin-
to-pin pitch. One solder paste cartridge will
RayMing Technology | www.raypcb.com
cover up to 11,000 0603 solder pads and has an
Screaming Circuits | www.screamingcircuits.com official shelf life of eight months. It should also
SlingShot Assembly | www.slingshotassembly.com
be stored in the refrigerator when not used.
The unit has interchangeable drill heads
Vero Technologies Ltd | www.verotl.com for vias and through holes, and it maintains
Voltera | www.voltera.io a 3mm runout even at high speeds. All the
circuitcellar.com 37
different size drill bits, rivets, and other to make PCBs in minutes. The unit takes
accessories you need to get started are your hands out of the equation by precisely
included with the printer, and more are sold depositing solder paste on every pad, and
at the store on their website [10]. part pick and place is done with computer
There are many more details about vision-guided vacuum heads. Solder reflow is
soldering, reflow, and substrates given on performed automatically and under precise
Voltera's website. The cost of the system itself heat control. Priced in the $15,000 range, the
is in the $5,000-$7,000 range, comparable to a SV2 provides both low-volume manufacturing
mid-grade 3D printer, and affordable for even and rapid iterative prototyping capability.
a small, home-based business. Voltera says
users can make a simple single-layer board CONCLUSION
in under an hour: five minutes to print, thirty Whew! That was a lot of information. But,
minutes to bake (the ink needs to be dried), as the Romans used to say, you can't make an
and depending on how fast you place your omelet without breaking some Gauls, or
components (they must be placed by hand), something like that. And speaking of omelets,
about 10-15 minutes to dispense solder paste don't you have a prototype you were going to
and reflow. whip up? Come on OG! Spring is in the air! The
Nano Dimension DragonFly IV: The Nano snow is thawing, and the armies of feature
Dimension Dragonfly IV provides a higher— hunting sales teams are at the barbican gates.
ahem—dimension of production (Figure 7). I don't know about you, but I'm going to head
The Dragonfly is a multi-material, multi-layer to my lab and get cracking! I can't wait to see
3D printer that generates entire circuits in what comes out.
one step—including substrates, conductive
traces, and passive components. It can build FIGURE 8
complex and sophisticated custom designs SV2
with extreme precision, allowing makers a
sky-is-the-lim it freedom in their designs. This
technology is a step beyond.
The Dragonfly can produce electronic
designs in 3D space and can fabricate
active components using their Additively
Manufactured Electronics (AME) techniques.
The Dragonfly can produce RF Devices directly
from their design software, fully simulated
and then rendered. Their radiofrequency
(RF) devices have been tested in space and
5G wireless applications. AME technology
and Dimension fabrication allow developers
to take their electronics to new levels of
performance, fit, and function.
BotFactory: The Long Island, New York
based BotFactory has a full lineup of midsize
robotic PCB fabrication engines. Their first
offering, sadly now obsolete, was the Squink,
suited for the small-to-hobbyist market. ABOUT THE AUTHOR
Their new product line, SV2 Starter through
Michael Lynes is an entrepreneur who has founded
SV2 Professional, provides higher throughput
several startu p ventures. He was aw arded a BSEE
and precision, but lacks some of the quirky
degree in Electrical Engineering from Stevens Institute
charms of the earlier product.
of Technology and currently works as an embedded
The SV2 Starter can produce two-layer
boards with 8mil (0.2 mm) traces and 16mil softw are engineer. When not occupied w ith arcane
(0.4 mm) spacing, ideal for SOIC-type chips. engineering projects, he spends his time playing with his
The unit has PCB fabrication and pick-and- three grandchildren, baking bread, working on ancient
place capability, allowing you to produce fully cars, backyard birdwatching, and taking am ateur photographs. He's also a
functional boards for low-rate manufacturing prolific author with over thirty works in print. His latest series is the Cozy Crystal
as well as prototyping. The unit automatically Mysteries. Book one, Moonstones and Murder, is already in print, and book
lays out traces and paste, picks the parts, places two is on its way. His latest works include several collections of ghost stories,
them, and performs solder reflow, all in one full short works of general fiction, a collection called Angel Stories, and another
run. PCBs, depending on complexity, can be collection called November Tales, inspired by the fiction of Ray Bradbury. He
fabricated in hours rather than days or weeks. currently lives with his wife Margaret in the beautiful, secluded hills of Sussex
The SV2 employs both low-resistivity County, New Jersey. You can contact him via email at mikelynes@gmail.com.
conductive inks and dielectric insulating inks
38 CIRCUIT CELLAR • MARCH 2023 #392
Datasheet:
DSPs & DSCs
High Performance Chips for
Digital Signal Processing and Control
T
E
E
H
S
A
T
A
D
Editor-in-Chief
Digital signal processors (DSPs) and digital signal controllers (DSCs) are
designed for time-critical execution of complex algorithms. These chips
are crucial to many high-end, high-performance applications today.
t's hard to believe now, but the first ability to handle tasks in a prescribed am ount of
dedicated digital signal processor (DSP), tim e— no exceptions, no delays. Indeed, DSPs are
Texas Instrum ents' TMS5100, was first used meant for applications that require the processing
in its fam ous Speak & Spell product, released of complex algorithm s in a tim e-critical fashion.
on the m arket in 1978. Of course, the im portance The waters are only further muddied by digital
of this chip was not overlooked at the tim e— it signal controllers (DSCs), which, as their name
was also the first to use linear predictive coding suggests, are hybrids of DSPs and MCUs. These
to perform speech synthesis. But today, DSPs devices incorporate common DSC features—such
are integral to a m ultitude of high-end, high- as barrel shifters, large accumulators, and single
perform ance industrial applications. Some well- cycle multiply-accumulate (MAC) units—with the fast
known exam ples are radar, oil and gas seismology, interrupt responses and control-oriented peripherals
MRI machines, ultrasound, satellites, and m issile typical of MCUs. Not everyone uses the DSC
guidance. It's incredible to think of the humble nomenclature, but a couple of DSC products have
origins of this broad fam ily of devices. been included in this month's gallery for your review.
Rounding up a list of new DSP devices can The DSP and DSC m arket has long been
be a tricky business, as the same device which dominated by a handful of key players. Atypical of
m ight be called a DSP by some vendors could our Datasheet column, Analog Devices, NXP
be called a m icrocontroller (MCU) by others. For Sem iconductors, and Texas Instrum ents have two
our purposes, a defining characteristic of DSPs is products each this month to reflect their
"determ inistic" execution of tasks, which is their significance in this field.
circuitcellar.com 39
(SIMD) DSPs featuring Analog Devices' family, these processors features Analog's supporting up to four mics, multiple high
Super Harvard Architecture. They're Super Harvard Architecture, large SRAM, speed interfaces and GPIOs in two package
based on the SHARC+ dual-core and the multiple internal buses, and innovative options (eWLB and QFN). It combines two
Arm Cortex-A5 core, and they're suited DAIs. Tensilica-based, audio-centric DSP cores—
for automative, professional audio, and one for high-power computer and machine
industrial applications requiring high • Powerful DMA system learning (ML), and the other for low-power
floating-point performance. • On-chip m em ory protection always-on processor of sensor inputs. Both
• Integrated safety features also work as general-purpose controllers
• 1 GHz (max) Core clock frequency • 17mm x 17mm, 400-ball CSP_BGA using the Tensilica-based instruction set.
• 640KB on-chip Level 1 (LI) SRAM (0.8mm pitch), RoHS com pliant
memory (with parity) increases low • 120-lead LQFP_EP (0.4mm pitch), • Multi-core: DeltaMax optim ized for
latency performance RoHS com pliant compute, HemiDelta optim ized for
• 32-bit, 40-bit & 64-bit floating point • Low system power across low power
support; 32-bit fixed point autom otive tem perature range • Up to 4x PDM Digital Microphones,
• Byte, short-word, word, long-word • Large on-chip Level 2 (L2) SRAM 1 stero input, 4x mono inputs, and
addressed with ECC protection, up to 8Mb 1 stereo output, supporting clock
• 1 GHz Arm Cortex-A5 (with Neon/FPU) • One Level 3 (L3) interface optim ized rates up to 6.144 MHz
• 32kB/32kB LI Instr./Data Cache for low system power, • Up to 3x PS/TDM ports supporting
• 256kB L2 Cache providing 16-bit interface to DDR3/ 8 channels each of 32-bit audio data
• 2048 KB on-chip Level 2 (L2) SRAM with DDR3L SDRAM devices using a 24.576MHz input clock
ECC protection • Control Interfaces: SPI, I 2 C, UART,
• Level 3 (L3) interface optimized for low Analog Devices available GPIOs
system power, providing 16-bit interface www.analog.com • 1.44MB RAM (1MB available to user)
to DDR3 (supporting 1.35V capable • 175MHz clock
DDR3L devices)
• 17mm x 17mm (0.8mm pitch) 400-ball Knowles
FCBGA www.knowles.com
Analog Devices
www.analog.com
DATASHEET URLS:
Datasheet:
A Multi-Tasking Dual Core Chip General Usage DSC Family with A Chip for High-End Industrial
MCU Functionality Solutions
The dsPIC33CH128MP508 Dual Core
T
E DSC from Microchip Technology is geared NXP Semiconductor's MC56F80xxx Also from NXP is the MSC8256, built
E
H toward system developers designing DSC family are general usage digital around six StarCore DSP SC3850 core
S
A high-end embedded control applications. signal controllers based on the 32-bit subsystems operating at up to 1 GHz/8000
T
A
D It has two dsPIC DSC cores—a main core 56800EF core. On a single chip, each MMACS per core and up to 48000 MMACS
for user interface, system monitoring device combines the processing power of per device. This multicore processor's
and communications functions, and a a DSP and the functionality of an MCU, ready for advanced processing
secondary that can execute dedicated, with a flexible set of peripherals to support requirements and high-performance,
time-critical control code while the main many target applications, including high-end industrial applications such as
core's busy. The dsPIC33CH can facilitate industrial control, motor control, home medical imaging, aerospace, defense,
independent code development for each appliances, general-purpose inverters, and advanced test and measurement
core. This family of chips is ideal for smart sensors including fire and markets. The MSC8256 will help
high-performance digital power, motor security systems, medical monitoring equipment manufacturers create end
control, advanced sensing and control, applications, and more. products and services that integrate
and general-purpose high-end embedded more functionality in a smaller hardware
applications requiring sophisticated • DSC based on 32-bit 56800EF core footprint.
algorithms. • On-chip memory: Up to 64KB flash
memory, 8KB data/program RAM • Six StarCore DSP SC3850 core
• 3V to 3.6V, -40°C to +150°C • Two high-speed, 12-bit ADCs with subsystems each with: SC3850 DSP
• Core: Dual Core dsPIC33CH DSCs dynamic x l, x2, core at up to 1GHz; 512KB unified L2
• Main Core 90MHz and Secondary Core and x4 programmable amplifier cache/M2 memory; 32KB I-cache,
100 MHz Operation • One high-resolution eFlexPWM 32KB D-cache; Fully programmable
• Independent Peripherals for Main Core module with up to 12 1056KB M3 shared memory (SRAM)
and Secondary Core PWM outputs, including up to 8 • Two DDR 2/3 64-bit SDRAM
• Fast 6-Cycle Divide channels with 312ps interfaces at up to 800MHz data rate
• Code Efficient (C and Assembly) resolution NanoEdge placement • High-speed interconnects:
Architecture • Communication interfaces include: Dual 4 x /lx Serial RapidlO at
• 40-Bit Wide Accumulators Up to two high-speed queued SCI 1.25/2.5/3.125 Gbaud; PCI Express
• Single-Cycle (MAC/MPY) with Dual Data (QSCI) modules with LIN remote 4x/lx; Two SGMII
Fetch functionality; One LPI2C module • Dual RISC QUICC Engine supporting
• Single-Cycle, Mixed-Sign MUL Plus (supports Full PMBus) RGMII gigabit Ethernet ports and
Hardware Divide Serial peripheral interface (SPI)
• 32-Bit Multiply Support NXP Semiconductors
www.nxp.com NXP Semiconductors
Microchip Technology www.nxp.com
www.microchip.com
DATASHEET URLS:
edge A l applications for sm arter automative co-processor, hybrid radio interfaces; full duplex, stereo, acoustic
homes, cities and factories—all and amplifier applications. It's 367-ball, echo cancellation (AEC); reference
with a single-chip. This processor 15mm x 15mm, and 0.65mm ball pitch audio via I2 S with automatic bulk delay
includes a multicore Arm Cortex-A72 with Via Channel Array (VCA) tech. TI insertion; point noise suppression via
microprocessor unit (MPU), and provides development tools such as C interference canceller; switchable
offloads computationally intense tasks compilers and a debugging interface. stationary noise suppressor; a
such as deep learning inference, This family of processors meets the programmable automatic gain control
imaging, vision, video, and graphics AECqlOO standard, and features a (AGC); and independent audio paths for
processing to specialized hardware simplified power supply rail mapping communications and automatic speech
accelerators and programmable cores. that enables affordable PMIC solutions. recognition (ASR).
This processor is ideal for industrial
applications such as robotics, machine • Up to 2 C66x floating-point VLIW DSP • USB HID and Endpoint 0 control
vision, and radar. • Up to 512kB of on-chip L3 RAM interfaces
• Level 3 (L3) and Level 4 (L4) • Flexible Peripheral Interfaces
• 2 Arm Cortex-A72 interconnects • Programmable digital general-
• MCU Island of 2 Arm Cortex-R5F • Memory Interface (EMIF) module purpose inputs and outputs
(lockstep opt), SoC main of 4 Arm • Dual Arm Cortex-M4 (IPU) • I 2 C interface for system control and
Cortex-R5F (lockstep opt) • Vision accelerationPac local peripheral control
• 64-bit CPU • Display subsystem • I 2 S remote interface input & output
• 1 3D graphics acceleration • On-chip temperature sensor that is of audio data
• 2 DPI, 1 DSI, 1 EDP capable of generating temperature • SPI controller interface for control
• 1 Deep Learning accelerator, 1 alerts and interrogation of a local SPI
Depth and Motion accelerator, 1 remote devices.
Video Encode/Decode accelerator, 1 Texas Instruments
Vision processing accelerator www.ti.com XMOS
www.xmos.ai
Texas Instruments
www.ti.com
DATASHEET URLS:
Texas In s tru m e n ts TDA4VM: w w w .ti.c o m /lit/d s /s y m lin k /td a 4 v m .p d f? ts= 1 6 7 5 3 3 1 0 4 1 1 7 4 & re fjjrl= h ttp s% 2 5 3 A % 2 5 2 F % 2 5 2 F w w w .ti.co m % 2 5 2 F p ro d u ct% 2 5 2 F T D A 4 V M
Texas In s tru m e n ts DRA78x: w w w .ti.c o m /lit/d s /s y m lin k /d ra 7 8 5 .p d f? ts= 1 6 7 5 2 7 1 5 2 1 1 6 5& re f_u rl= h ttps% 2 5 3 A % 25 2 F % 2 5 2 F w w w .g o o g le .co m % 2 5 2F
By
Brian Millier
S
This article covers measuring the currents consumed by these devices, and
N
M
U
calculating the power they draw over a period of time.
L
O
C
f you are designing boards for Internet-of-
When you are trying to determine the
I
Things (loT) applications, in many cases overall energy usage of an loT project, it's
they will be battery operated. Sometimes helpful if you can determine the energy used
this means very small batteries have to for three general modes of operation:
be used. If the board is expected to run for
long intervals without changing batteries, • Normal MCU operating current (drawn
it may have to spend most of its time in a while executing code)
"sleep mode," and limit the number of times • Operating current during RF transmission
it transmits a signal with sensor data or and reception intervals
otherwise indicate its status. • Sleep or deep-sleep power consumption,
For such battery-operated boards, the depending upon what mode can be used
ideal choice for a microcontroller (MCU) is one
that has the following characteristics: RF transmission and reception consume
the most power. How much higher this is than
• A low operating current normal MCU operating depends largely on
• The ability to enter a "deep-sleep" mode, whether a low-power Bluetooth protocol or
where the current consumption drops standard Wi-Fi is used. Also, an MCU that is
down to the microamp range designed for extremely low power consumption
• Flexibility in how the MCU can be brought and is coupled with a separate RF module (Wi-
out of deep-sleep mode—for example, Fi/Bluetooth) may end up being more power
with an internal timer or GPIO pin-change efficient.
• Bluetooth Low-Energy (BLE) communication, Sleep modes always draw a tiny fraction
if practical for the application (much lower in of normal MCU operating current. However,
power than Wi-Fi) sleep mode may be in effect 99.9% of the
time in some applications, so even its tiny
Although an MCU that fulfills all the above power consumption may dominate the total
categories is ideal, in many cases we often energy consumption over the long term.
pick an MCU such as the Espressif ESP32, Coming up with a good estimate of long
because it's readily available and inexpensive, term energy consumption for an loT board
and has a lot of existing code and libraries running a specific application is difficult.
supporting it. In general, it conforms to most The peak current drawn will occur during
of the above considerations, but it is definitely RF transmission/reception. It's difficult to
not "best-in-class" when it comes to low determine this power, since it is so dependent
power consumption. on the RF protocol used, and just how quickly
circuitcellar.com 43
and the power supply's negative terminal. than during RF transmission, but in most
In this illustration, I assume that the power cases, will be much steadier.
supply is the USB port of a PC. This is a valid Digital Multimeter: The two sleep
assumption because, during the firmware modes require a much different measuring
development process, you typically connect technique. Deep-sleep current is often in the
your MCU board to a PC to be able to do Serial low microamp range, or even lower for some
debugging/flash programming using the PC's specialty MCUs that are meant to run long
USB port and the USB-Serial bridge device periods on a small battery, and generally use
present on the MCU development board. the BLE RF protocol. However, since the MCU
Since the current drawn by the MCU board may be in the deep-sleep mode for 90-99%
during RF transmission is likely to be fairly of the time, its overall power consumption is
high, the required shunt resistor can be just as important as the peak current drawn
made quite small. A value in the range of 0.1- during RF transmission/reception intervals.
0.5Q will provide a voltage waveform in the Since the current is in the microamp
millivolt range for the MCU current draws of range and relatively steady, it might be
50-500mA that are commonly seen during Wi directly measured using a good-quality
Fi transmission; normally, Bluetooth is much digital multimeter on its DC current range.
less. This is easily handled by an oscilloscope. Alternatively, you can insert a higher value
Note that since both the 'scope and the PC shunt resistor and use the multimeter's DC
are ground-referenced, you cannot connect millivolt range. Figure 3 is an example. One
the 'scope probe's GND lead to the ground complication that arises, however, is that
terminal on the MCU board. Doing so will the MCU board generally executes code that
short-out the shunt resistor, and no current requires RF communication, and that can
signal will be observed. Instead, you must happen just after the MCU is reset. It's only
S leave the GND lead disconnected, or connect later on that the MCU is placed in a deep
N
M it to the USB port side of the shunt resistor. sleep mode for some long sleep interval. If
U
L If you are also using the 'scope to measure you insert a digital meter in the DC current
O
C any small analog voltages on the MCU board, mode in series with either of the MCU board's
during development, these readings will power lines, one of two things will happen.
incorporate an offset due to the presence of First, if you set the meter for a sensitive
the shunt resistor. This offset will vary, and current scale that accurately monitors sleep
may be significant, depending on how much currents in the microamp range, the voltage
supply current the MCU board is drawing at drop across the meter (burden voltage) will be
the time. Although the oscilloscope will allow so great that it's likely the MCU will not even
you to measure the peak current easily, it boot up in its standard (non-sleep) mode. This
would be a lot of work to calculate the average is obviously not useful.
current over the transmission period, due to Second, most digital meters have DC
the complexity of the current envelope. current ranges in both the low-milliamp
The second scenario, normal MCU range, and a separate range that goes up to
operating current, can also be monitored around 10A. On this range, you must connect
quite well using an oscilloscope connected as one of the probe leads to a dedicated "10A"
shown in Figure 2. The current will be lower socket on the meter. This range uses a small
internal shunt resistor, and a dedicated 10A
fuse (which, incidentally, is quite expensive).
You will need to use this range if you want the
MCU board to boot up properly, and definitely
if you expect to do any RF communication,
since that will require hundreds of milliamps
in most cases. However, this 10A range will
not measure currents in the low microamp
range that you can expect during deep sleep.
So, you can see that the extremely wide
range of current consumption—between
the peaks of RF communication and the
low current draw during deep-sleep—make
current monitoring more complicated. This is
not unexpected; there is a dynamic range of
about 104 to 105 , depending on the MCU board
and the sleep mode that you can use.
FIGURE 3
No common digital meter or oscilloscope
The MCU's much lower "sleep-mode" current can be measured using a digital multimeter and a
will accurately measure over this wide a
higher-value shunt resistor than would be used in in Figure 2. Alternately, the multimeter's DC
current range could be used on its lowest milliamp range.
range without changing scales and/or using
circuitcellar.com 45
a separate set of probe terminals (that is, the a differential voltage measurement across the
10A meter configuration mentioned above). shunt, when it was referenced to either GND
Since the current is changing dynamically and or the Vc c used by the target MCU board. Also,
rapidly, this is not a viable option. the shunt voltage levels were too low to be
Over and above the limitations mentioned, measured by any ADC that did not also include
neither the 'scope nor the digital meter has a a programmable gain amplifier (PGA). Finding
way of integrating the current readings over an ADC with a built-in PGA was no problem,
a long period of time, so you can calculate the but getting it to work when the shunt resistor
energy consumption of the MCU board over a was at either GND or Vc c was a problem.
specific period. This is needed to determine The solution was to use a device called a
the expected life of the battery that is "high-side current monitor." This device uses
powering the board. a low-value shunt resistor to monitor the
current, but then translates this current value
POWER MONITOR DESIGN into one of two forms:
In the previous section, I described ways
of measuring the current consumption of • A proportional current to GND, which,
MCUs used in loT projects (or any project, for when combined with a resistor, provides
that matter). Neither of the two instruments— a voltage in the millivolt-to-volt range.
oscilloscope or digital multimeter—would This is referenced to GND, and is easy to
work over the full range of current from measure with any standard ADC.
deep-sleep to full-power RF transmission • A digital signal (I2 C), which can be read by
intervals. Likewise, they would not allow for an MCU, thus completely eliminating the
the integration of current over time, which need for a separate ADC.
would be needed to determine how long the
C
supply battery would last. I've used both types of high-side current O
L
In each of the methods previously monitors in past projects. The latter type would U
M
described, a shunt resistor was placed in seem to be the simpler approach. However, N
S
series with one or the other of the power recall that for this project, I wanted to be able
supply connections. Placing a shunt resistor to measure the higher operating currents drawn
in series with the GND line allows a ground- by the MCU board during RF transmissions.
referenced 'scope to make the measurement, These high-current spikes can be very short
but it also results in the MCU board's GND in duration. High-side current monitor devices
terminal being offset from the mains ground. that provide an I2 C digital readout (TI's INA219,
This is assuming that the MCU board is being for example), are not nearly fast enough to
powered via the USB port on a PC. This monitor these current spikes. Therefore, I
may not be the case when the MCU board decided to use the type of device that translates
is performing its intended function, though the current value into a proportional current
it will likely be true during the development to GND. Such devices are made by several
process, for debugging and programming. manufacturers. Some examples are Analog
Placing the shunt resistor in series with Devices AD8217 High-Resolution Zero-Drift
the Vc c connection works great when using Current Shunt Monitor, Texas Instruments
a digital meter, since it's a non-grounded INA138 Variable Gain Current Sense Amplifier,
instrument. Also, it has no trouble measuring and Diodes Incorporated ZXCT1009 High-Side
the tiny voltage drop across the shunt Current Monitor.
resistor, even though the shunt resistor has I chose the ZXCT1009 because I had used
a common-mode voltage on it of 3.3-5V, with it before (when they were Zetex parts). It is a
respect to the GND terminal.
I wanted to use one or more analog-to-
digital converters (ADCs) to measure the small
voltage drop across the shunt resistor, which,
knowing the resistance of the shunt, could then
be used to derive the current consumption. The
ADC(s) would have to be read by an MCU, which
would need to be operated from either a 3.3V
or 5V power supply. I was hoping to use just
one power supply to handle both this project's
power monitoring circuit and the target MCU FIGURE 4
board, for which I was trying to measure the This is the basic configuration of
the ZXCT1009 high-side current
current consumption.
monitoring device. It provides a
Given the above design criteria, I found
GND-referenced voltage output that
that the commonly-available ADCs that I was is linearly proportional to the high-
accustomed to using weren't able to perform side current flowing through RSENSE .
CIRCUIT CELLAR • MARCH 2023 #392
three-term inal device in an SOT23 package. It operates over a w ide range, using only one ZXCT1009 current m onitor and
the 2.5-20V range, so it is w ell-suited to this application. Not a single ADC. If R SENSE w ere chosen to be sm all enough to
that it m atters much in this project, but it draw s only 4pA of drop only a few tenths of a volt during peak RF transm ission
current. I'll cover this in m ore detail later. currents, the Vo u t would be so low during deep-sleep that it
Because o f a com plication encountered (also described a would be difficu lt to measure.
little later), I included tw o such devices in this project— one I solved the problem by using tw o ZXCT1009 current
to m easure the low deep-sleep currents, and the other to m onitors, w ith both circu its placed in parallel and connected
m onitor both the higher currents norm ally draw n by the MCU between the target MCU board's Vc c line and the pow er
board, and the really high current spikes that occur during RF supply's positive term inal. Please refer to Figure 5, the
transm ission intervals. project's schem atic, for details.
Figure 4 is the typical setup for the ZXCT1009 current The power supply in this project provides either 5.0V or an
monitor. The designer has the choice of values for both RSENSE adjustable voltage in the 2.5-4V range, which is selected by S2.
and Ro U T . Obviously, it's best to choose as low a value as This voltage comes in via JI, and the positive line is connected to
possible for R SENSE , because we can't afford to lose too much R l, the Rsense f° r the ZXCT1009, which is labeled U2. This particular
voltage between the power supply and the MCU board if we current monitor has RSENSE = 100Q and is meant to measure a full-
expect the MCU board to boot up and w ork properly. scale current of 2.0mA (that is, sleep currents only).
The ZXCT1009's transfer function is linear, and it's lo u t is The incom ing positive pow er supply line is also connected
1.0mA when the voltage drop across RS E N S E 's 100mV. So, for to U4, an STMPS2151 high-side pow er switch. When this
example, with RSENSE = IQ and R0 U T = IkQ, a current flow of electronic switch is activated, it connects the positive power
100mA would result in a voltage across RoUT of 1.0V. It should be supply line to the RS ense associated with the second ZXCT1009
noted that the ZXCT1009 draws a quiescent current of 4pA from (U3). For this current monitor, RSENSE has a low value of 0.5Q.
the power supply, which passes through Rq UT , so this quiescent At the m axim um design current of 500mA, a voltage drop of
current must be factored in when doing the current calculations. only 250mV will occur across this Rs ens e- This drop is not great
The com plication that I ran into arose from the w ide enough to have any m aterial effect on the proper operation of
dynam ic range of the current consum ption between deep the target MCU board, even when it is draw ing peak currents
sleep and RF transm ission intervals. Deep-sleep current draw during RF transm ission intervals. Although RS ense is such a
could easily be in the m icroam p range, w hereas the m axim um low value, the full-scale (500mA) current range, handled by
current draw during RF transm ission could approach 500mA. this current monitor, results in a voltage at R5 of 1.175V. This
It would be difficu lt to m easure curren ts accurately over such voltage level is readily m easured by an ADC.
USB Cable to PC R9 5k
(optional) wa TEENSY 4 1
RIO
VCC OK/OT I 5V
5k
14 AQHX3/SPDtl OUT DP
lt> AURX3/SPDIF IK VUSH
SDA
AD DR la A4/SDA0 D*
Al I? I
Alb 2(1 Afi/T X 5/L R C IK 1 O RXUCSUCRX2
21 A77RX5JBCLK1 f X l/f/IS O V C I X?
22 A8KJTX!
10
23 A9/GRX1/MCLK1 1 RX7JOUT1A
Start/Stop U2 e -i x z ;ik i
LT 75 A ll/R Xfi/SD A ?
ZXCT1009FTA 26 A12/WOSI1 78 RX7
38 A14/CSM. I
38 A 1 5 /C S O U 1A 34 RX8
1000 a s n x fi
41 A1//WISO1
■ j
U4 3(1 CRX3 10 CS/NQSR
CM 31C 1X3 11 M O Sl/CTXl
I/) High-side Current Monitor 3 1 RCLK2 12-M SO/M QSl
i 8
GKD our 4 HCLK2 13 SCK/LED
IK 2 OUT 3
b
IK OUT 2 VHAf 3 7 O U I IB
EK PROGRAM 9 O U T IC
High-side Current Monitor R- LU
6 OUT ID
2O UT2
ZXCT1009FTA High-side Switch LED 33 n/CI K?
-----------------------U3 LU
1
o 3 LU
ID Q.
S2 ।
? *
ro
I*L To Pcwer Suppy Vadj 5V
with PCF8574 I2C Backpack
FIGURE 5
Schematic diagram of the current monitoring unit, less the power supply
circuitcellar.com
When U4 is activated, both ZXCT1009 current drawn by the target MCU board during
current m onitors are connected in parallel. RF tran sm ission s (Wi-Fi and Bluetooth), I
So, you would be correct in noticing that the wanted to be able to m easure the current
current m easured by U3—the high current about every Ips. O bserving the current
m onitor— will be som ewhat lower than the true w aveform s on my 100MHz digital 'scope, I
value. This happens because a bit of current never found the current pulses to be quite this
is also passing through the RSENSE of the other sh o rt in duration during RF transm issions.
current m onitor (U2). However, since R l is 200 The ZXCT1009 current monitor, itself, has a
tim es greater than R2, the error will be only bandw idth o f 300kHz, so it w ill broaden or
0.5%, which could be corrected for in software. integrate any pulses sh o rter than Ips; but as
The only com plicating fa cto r in this long as the ADCs w ere reading the current
arrangem ent has to do w ith activating the using a Ip s sam ple rate, the overall current
STMPS2151 pow er switch. As m entioned, the consum ption over tim e w ould be captured.
low -current m onitor (U2) has an RSENSE of MCU with Internal ADC for High-Current
100Q. W henever the target MCU board exits Range: When deciding w hat MCU to use for
sleep m ode and gets re-booted, it's current this project, I chose the Teensy 4.1 MCU. It
draw is great enough to develop such a high w as well suited for my purposes fo r several
voltage drop across R SENSE that the MCU would reasons:
never boot up.
The ADC that I use for the low -current • It contains tw o 16-bit ADCs that are
range is a sigm a-delta ADS1115 16-bit ADC. capable o f a sam ple rate of 1 m egasam ple
It is not especially fast (speed is not needed per second. (Only one of its ADCs is used
fo r sleep current m easurem ents), but by the here.)
tim e the MCU reads it and notices that the • It contains 1MB of SRAM, w hich allow s me
current is much too high for the low -current to store plenty of current readings.
range, there is already too much voltage drop • Its 600MHz processor is fast enough to
to allow the MCU to boot-up properly. collect the ADC data directly, using in-line
To eliminate this issue, I placed DI, a code, w ithou t resorting to using DMA or
Schottky diode across the RS ense associated other methods.
with the low range current m onitor U2. Once • It contains a built-in m icroSD card socket,
the voltage across R l exceeds about 0.25V, DI w hich allow s the data to be stored and
conducts, thereby limiting the voltage drop in then easily tran sferred to a PC for analysis.
the circuit to 0.25V. Thus, the target MCU boots • I'm quite fa m ilia r w ith the Teensy family,
up okay, and U2 will report a current that is and it can be program m ed in the Arduino
saturated at its full-scale value of about 2.0mA. IDE— m eaning that lots o f libraries are
The p ro g ra m ru n n in g on the Teensy available.
4.1 w ill notice th is o ver-ran g e co n d itio n ,
a ctiv a te the STM PS2151 h ig h -sid e pow er For the fast, high-current range monitor, I
sw itch (U4), and re -d ire c t the c u rre n t use the Teensy's ADC #1. W hile it's rated as a
th ro u g h the h ig h -c u rre n t m o n ito r (U3). 16-bit ADC, in reality it doesn't really provide
At c u rre n ts less than the 500 m A design 16-bit accuracy and resolution. I use it in the
m axim um fo r th is p roject, the vo ltag e drop 12-bit mode, w hich is faster and provides
a cro ss R2 w ill be less than the th re sh o ld enough resolution fo r this use case. The
vo ltag e o f the S ch o ttky diode, so the d io de Teensy ADC has a full-scale voltage o f 3.3V,
w ill not a d v e rse ly a ffe c t the a ccu ra cy o f the w hich is equal to Vc c . The ADC is fed directly
h ig h -c u rre n t m o n ito r circu it. by R5 (connected to U3), a 4700 resistor. At
One disadvantage to the inclusion o f DI, 500m A, the voltage to the ADC is 1.175V, or
the Schottky diode, is that it makes a nice about 30% of the ADC's range.
feature of the pow er sw itch unusable. The The voltage developed across R3 is
STMPS2151 has several protection elem ents, proportional to the current on the high-
including therm al, over-current (>500mA) current range. Along w ith being fed to
and sh ort-circu it protection. In this project, the Teensy 4.1's ADC, it's also fed to a BNC
the pow er supply is only 5.0V, and any current connector. This allow s the target MCU board's
beyond 500m A gets shunted through DI. So, in current to be observed on a 'scope— for high-
this case, none o f the STMPS2151's protection
circu its will be effective. Still, it's nice to know
that they exist, for future projects.
ABOUT THE AUTHOR
CHOICE OF ADCs Brian Millier runs Com puter Interface Consultants. He was an
The m easurem ent criteria that I chose instrumentation engineer in the Department of Chemistry at Dalhousie
fo r the project basically ruled out the use of University (Halifax, NS, Canada) for 30 years.
ju st one ADC. To m easure the sh o rt spikes of
48 CIRCUIT CELLAR • MARCH 2023 #392
current target board consumption, where a North America. I don't know how this works,
'scope reading would be most useful. but such breakout modules are currently
External ADC for Low-Current Range: For available, in unit quantities, for less than it
the low-current monitor, I wanted to be able would cost me to buy just the ADS115 chip,
to measure currents in the sub-microamp alone. Figure 6 is the ADS1115 module I used
range (deep-sleep currents). By definition, for this project.
an MCU's sleep mode means that it's doing In this project, I take the output of the
nothing, so the sleep current is basically static. low-current range ZXCT1009 and filter it
To measure this, a much slower, but high- somewhat with resistors R7,R8 and C2.1 then
resolution ADC is needed. One reason that high measure it differentially using analog inputs
resolution is needed is that the ZXCT1009 draws AO and A l.
approximately 4pA of quiescent current (when Besides measuring the low current range,
no current is being drawn by the target board). the ADS1115 also measures the power supply
This varies according to the voltage applied to voltage feeding the target MCU board. This
its current sense terminals, temperature, and is done using its A2 input and a 2:1 divider
device-to-device variations. network made up of R4 and R6. The divider
In this project, a calibration procedure drops the 5V maximum power supply voltage
is performed at start-up. It measures down to 2.5V maximum, which is within the
this quiescent current, and stores that 4.096V full-scale range of the ADCs A2 input
result—which is subtracted from current (using a PGA Gain of 1).
measurements later on. By using a 16-bit The ADS1115 is capable of up to 860
ADC, the quiescent current reads out as an samples per second, which is how it is
ADC count value around 40 counts. Therefore, configured in the Adafruit library. However,
it is possible to accurately measure the target I only trigger a reading every 100ms, and I
S MCU board's current consumption down to save those 10 readings/second to SRAM.
N
M the sub-microamp level. Note that in Figure 5 1 used R9, R10 as pull-
U
L For this ADC, I chose the Analog Devices up resistors for the I 2 C bus lines. ADS1115
O
C ADS1115, a 16-bit ADC with an internal breakout modules generally contain I2 C pull-
reference, a PGA, and a four-channel input ups, but I add my own just in case the module
multiplexer. It can do both single-ended does not include them.
and differential measurements on various For interest's sake, I recently came across
combinations of its four channels. In both a 24-bit ADC device—the NAU7802 made by
the single-ended and differential modes, it Nuvoton. Aside from its 24-bit specification,
is capable of accurate measurements down it also contained a PGA and a programmable
around the GND potential, which is important reference supply. However, what drew me to it
here because the ZXCT1009's output is was the fact that it comes in a DIP16 package
ground-referenced. that's easy for me to handle, was in stock, and
This device comes in a 3.0 x 3.0 VSSOP was inexpensive. I had used it in an earlier
package (or smaller X2QFN). I cannot mount project that measured an RTD sensor in a bridge
or handle such a package, so I'm lucky that configuration. But in this project, I discovered
breakout modules are available for these that while it has a differential input, it cannot
devices. I initially discovered breakout boards accurately measure small voltages that are
for these ADCs at Adafruit. Adafruit is great close to GND potential. To be fair, this chip is
when it comes to providing driver libraries for designed to handle bridge-configured sensors
their breakout modules. To be fair however, such as strain gauges, so this limitation is not a
these boards are currently also available deal breaker when used as recommended.
from many other sources—even some in
POWER SUPPLY
The power supply for the current project
is quite basic (Figure 7). Rather than taking
the easy way out and using a wall adapter, I
built a small, internal power supply. I used a
Recom RAC05E-05SKT power supply module.
It is roughly 1" in all dimensions, and provides
a stable 5V at 1A. The voltage is fed to:
Figure 8 is the power supply board, This is a schematic diagram of the unit's power supply. It provides power for the current monitoring
circuitry, and an adjustable power supply for the target MCU board that is being monitored.
measurement board, and the user interface
components. The finished unit in an enclosure
is shown in Figure 9.
FIGURE 8
These are the two boards making
up the project, along with the LCD,
switches, and other components of
the user interface.
50 CIRCUIT CELLAR • MARCH 2023 #392
Time (ms) High-current Range (mA) Low-current Range (mA) separate segm ent o f SRAM. At this slow rate,
there is enough m em ory in this segm ent to
collect data for m ore than 200,000 seconds,
but in practice, I lim it this to 4,000 seconds.
If a collection runs long enough to
TABLE 1
overflow the m em ory arrays for either the
This is the format of the data that display. Each of these high-current range low- or high-current ranges, I term inate the
is stored on the SD card as file readings is processed as follows: collection and do the calculations for that
"CurrentMonitor.txt". elapsed tim e period. The sam e thing occurs
• Each reading is com pared to previous when the user sw itches the Start/Stop sw itch
m axim um values, and the overall to the Stop position.
m axim um value is stored and displayed at At the end of the collection, the LCD
the end of the collection. displays three things: the maximum current
• Every reading is accum ulated and used to measured by the high-current monitor; the
derive the energy consum ption over the integrated current (over run time) of the high-
collection period in m illiam p-seconds. current m onitor (in milliamp-seconds); and
• Every 1ms, the average current over that the integrated current (over time) of the low-
tim e interval is stored in the Teensy's current m onitor (in microampere-seconds). I
SRAM. Due to m em ory constraints, the also display the elapsed tim e from Start to Stop.
m axim um duration o f the high-current To analyze the current versus tim e profile,
readings is 200 seconds (200,000 samples). I m ounted a m icroSD card in the Teensy's
socket before pow ering-up the unit. At the
During the portion of the collection tim e end of data collection, all the data is stored to
that the current consum ption is < 2mA, the this card using the filenam e "CurrentM onitor.
S low -current range circu itry is employed. txt." W henever a new collection is made,
N
M Currents in this range are generally MCU sleep any existing CurrentM onitor.text file is
U
L current, and as such, are quite stable. So, I overw ritten. The form at of the data in this file
O
C take only 10 readings per second, and save is in Table 1.
each of these in the Teensy's SRAM. These When a zero appears in either the high- or
low -current range readings are stored in a low -range colum n, it m eans that the alternate
range w as active at that p a rticu la r tim e. Note
that on the m icroSD card file, all accum ulated
current readings are expressed in m illiam ps,
regardless of w hich range is active.
SOFTWARE
The Teensy firm w are w as w ritten using
the A rduino IDE (Version 1.8.19) and the
Teensyduino add-in (version 1.57). Both w ere
the latest versions at the tim e of this w riting.
I use the A rduino "LiquidCrystal_PCF8574"
lib ra ry to run the LCD screen, and A d afru it's
"Adafruit_ADS1015" library handles both the
ADS1015 and ADS1115 ADCs.
I discovered a bug in the Adafruit_ADS1015
library. When you call readADC_
the
D iffe r e n t ia l_ O _ l( ) function, it sets the
FIGURE 9 sample rate for the ADC to 860 samples per second
This is the finished unit. Because the SD card socket is part of the Teensy 4.1 module (inside the
(the highest rate). However, it uses a delay routine
case), I used an SD card extender cable/socket assembly to expose the socket outside the cabinet.
to wait out the interval between when the ADC is
triggered and when the conversion is complete.
The delay variable m _ c o n v e rs io n D e la y is
Additional materials from the author are available at:
not initialized in this routine, and if you have
www.circuitcellar.com/article-materials
previously used the re a d A D C _ S in g le E n d e d ()
function (which I do when reading the power
RESOURCES
supply voltage), the delay time will be set to
Analog Devices | www.analog.com
180ms. This is much too long a delay period for
Diodes Incorporated | www.diodes.com
an 860 samples per second conversion rate, so
Espressif | www.espressif.com I had to add the following line to the Adafruit_
PJRC | www.pjrc.com ADS1015.cpp file at line #223:
R.ECOM Power | www.recom-power.com
STMicroelectronics | www.st.com m _ c o n v e r s io n D e la y = 5;
circuitcellar.
Note that this 5ms delay is still too long for CONCLUSION
an 860 sam ples per second conversion rate. I w as a lre a d y fa m ilia r w ith both the
However, I am only taking 10 readings per D iodes In co rp o ra te d ZXCT1009 h ig h -sid e
second, and this delay w orks fine at that rate. c u rre n t m o n ito r and the S T M ic ro e le c tro n ic s
All newer versions of Teensyduino contain STM PS2151 h ig h -sid e sw itch w hen I
the SD.h file, which is associated with the d esig n ed the project. However, I in itia lly
newest SDFat library. This updated SD card a tte m p te d to use the Nuvoton NAU7802
library will handle the newer HC SD cards, and ADC fo r the lo w -c u rre n t range, in p a rt fo r
allows the use of filenam es longer than the old its DIP16 packag e and 2 4 -b it re so lu tio n . As
DOS 8.3 filename format. m en tio n ed earlier, its in a b ility to m easu re
I've mentioned earlier that the Teensy 4.1 d iffe re n tia l v o lta g e s near GND to o k me a
contains 1MB of SRAM. This m em ory is broken w h ile to fig u re out, so I had to redesig n
into two blocks: a high-speed 512KB block that using the A d a fru it ADS1115 ADC m odule.
is directly connected to the ARM MCU; and a T h is is one o f the re a so n s I seldom design
som ewhat slower 512KB block that is tailored to a p ro je ct using a PCB rig h t fro m the sta rt.
DMA operations, though it is still accessible by T h e re are alw a ys th in g s I fail to a n ticip a te ,
the ARM MCU. in advan ce o f actu a l testin g.
Because of this memory fragmentation, I had This project does a decent job m onitoring
to place the high-current range memory array in both deep-sleep and operating currents fo r
one block, and the low-current range in the other. the com m on loT boards w hich I design and
The high-current readings are stored at a rate of build. Ironically, ju st a fte r w ritin g this article,
1,000/s, whereas the low-current readings are I w as asked to review the Joulescope JS220
stored at only 10/s. Due to the allocation of other Precision DC Analyser by Jetperch. It's a m ore
variables in the high-speed block, there was only sophisticated com m ercial produt and the
room to store 200,000 16-bit ADC values (for the JS220 has a much greater dynam ic current
high-current range). The second block, used for m easurem ent range than my unit. It also
the low-current range, had plenty of room to com es w ith very sophisticated softw are.
spare, since those readings are only collected at Check out my next article for my review of
a 10 samples per second rate. this product.
AV NET
/DELIVERINGWHAT'S NEXT
Launching new technology is more complex than ever. your product to market, Avnet delivers the right mix of
Wherever you are in your journey, we're here to help technology and expertise to help your business succeed.
you navigate today's design and supply chain challenges. We deliver what's next in design, supply chain and logistics
Whether you're just starting on a design or working to get so you can deliver what's next for all of us. avnet.com/dwn
52 CIRCUIT CELLAR • MARCH 2023 #392
By
Jeff Bachioa
S
N
M
U You can use Bluetooth Low Energy's (BLE's) advertisement ability to help
L
O determine where you are in your world. In this article I cover how to do that.
C
hen I hear the word "beacon," I connectionless broadcast. The design assigns
visualize standing at the taffrail different capabilities and responsibilities to
on the afterdeck of a ship, in a different devices, depending on the size of
sea so thick with fog that it looks their available power supply, such that those
as if I am staring at a white wall on all sides. with plenty of power do more of the work than
If you've ever closed your eyes and attempted those devices running on coin-cell batteries.
to cross a crowded room, you know that there The simplest form of Bluetooth Low Energy
is anxiety with each step. Not knowing what's (BLE) performsa connectionless communication
out there or where you are can be debilitating. using a procedure called "advertising."
Lighthouses were established to give ships "Legacy advertising" uses three channels from
a point on which they could depend. When the 2.4GHz radio band—specifically channels
the area is dangerous, multiple beacons 37, 38 and 39. Connectionless communication
of light were often used to triangulate means the devices will not keep an established
position. This type of beacon doesn't present communication channel open, which is usually
much information, though, other than the required for the transmission of large amounts
identifying light pattern that is unique to each of data. Instead, an advertiser will send a
lighthouse. payload with no more than 31 octets (bytes).
For this column, I have a completely You can see that not much information can be
different kind of beacon in mind. Although transferred by this packet. Because packets
it's been in use for years, we don't hear are not acknowledged, if this transmission
much about the Bluetooth beacon these were lost or had errors, no one would know
days. A Bluetooth beacon is a small, battery- (or care).
powered radio transmitter. Smartphones Like Bluetooth Classic, devices take on
can scan and display their transmitted either a client or a server function. Those BLE
signals. As of version 4.0 of the Bluetooth devices that initiate an advertisement are
Core Specification [1], a new alternative considered the server, and anyone listening is
materialized which would take advantage the client. In the simplest form, a BLE beacon
of the already established transport system might have only a transmitter. Therefore,
to provide a brief, low-power, one-to-many, it can only be a server of information. That
circuitcellar.com 53
SIMPLE ADVERTISING
The Bluetooth transmission format is
frequency shift keying (FSK ). This simple
transmission scheme uses dual frequencies to
indicate data, as opposed to amplitude shift
keying (ASK), where the transmission scheme
uses one frequency to indicate data. The FSK
receiver determines the data transition point
by averaging the two frequencies. It can do
this as long as the two frequencies continue to
alternate. When a byte consists of all zeros or
ones, the average is skewed, and the receiver
can lose synchronization and misinterpret
the data. To prevent that, the data packet is
processed with a "whitening algorithm." This
assures that there will not be more than four
repeated bits. This must be decoded by the
receiver, to return the string of data back into
its original content. I invite you to read more f i g ur e 1
on this process [2] if it interests you. create a beacon and use a smartphone app to The standard BLE advertising packet
We'll be using "non-connectable scan for it. consists of a 1-byte Preamble (to
synchronize the receiver), a 4-byte C
advertising (0x2x)," which is indicated via O
Access Address (for an advertiser L
the MSNibble in the PDU type of the header ROOM BEACON U
M
this is 0x8E89BED6), 33 bytes of
(Figure 1). This advertising type announces There are two ways to implement N
S
Data (which include a 1-byte header
that it is neither scannable nor connectable Bluetooth: with a dedicated Bluetooth module, byte and a 1-byte length of the data
(has no additional scan data and can not or a microcontroller that contains a Bluetooth included), plus a 3-byte CRC. [3]
accept a connection). The length value in the peripheral. I've been using an ESP32 for quite
header will indicate the amount of data we a few years, but up until this project I had
are sending in the payload. Our data must not used the integrated Bluetooth function.
contain some identifier as to what is being There are example apps that demonstrate
sent. The format for one piece of data is a using the ESP32 as an iBeacon and Eddystone
minimum of three bytes, where the first byte beacon. The iBeacon was developed about
(length of data) will be at least 0x02 (for two 10 years ago by Apple and is a proprietary,
additional bytes). The second byte (first data closed protocol. AltBeacon, URIBeacon, and
byte) is the attribute type from the Generic Eddystone all are open source, and were
Access Profile (GAP) list. The third byte (or developed a few years later in an attempt to
additional bytes) depends on the GAP. Some compete with and improve on the iBeacon. All
useful attributes are shown in Table 1. use the BLE transmission scheme but have
I want to create a beacon that will send slightly different protocols.
out two pieces of information—a beacon Unless your info falls into one of the
name, and the TX power level with which the assigned attributes of the GAP, you'll find the
beacon is configured. With these, I should be attribute "OxFF, Manufacturer Data" the most
able to identify the beacon, and depending on useful. Note that Apple uses this in the iBeacon
the Received Signal Strength Indicator (RSSI), protocol. Their standard packet contains two
determine how far away I might be from the attributes, as shown in Table 2.
beacon. This isn't an exact science, due to Apple's custom manufacturer data includes
variables such as environment and antenna its manufacturer ID and an additional sub
design, but we can make a good guess. Let's attribute, which contains an ID number (UUID)
TABLE 1
These are a few attribute types you
might find in an advertising packet.
Multiple attributes can be packed
into the data portion of the packet
[4].
54 CIRCUIT CELLAR • MARCH 2023 #392
plus indications of the software's major and The application begins by declaring a
minor revisions and the transm itter's power. few items: first, the BLE libraries used,
For this project, my advertising packet will B LE D evice .h and BLEBeacon.h; then the
consist of three attributes—flags, name, variables, used like an array to define the
and custom manufacturing data (Table 3). advertising data and the length of that data
The flags are an indication of the Bluetooth (Listing 1). Note that this is in the form of
function, Classic or BLE, discoverable or Table 2 and Table 3.
connectable. The name is the actual name In the s e tu p O function, the I/O is
of the beacon (in my case, the room it is initialized so we can blink an LED and read
installed in). My custom manufacturing data an analog input. The analog input is actually
will simply be OxFFFF (testing or unregistered a fraction of the battery voltage provided
manufacturer), and the battery voltage is a by a resistor divider, since the voltage
whole data byte followed by a decimal data will generally be higher than VCC. A BLE
byte. device's environment is initialized with the
Using the Arduino IDE, we can program the function B LED evice: : i n i t ( ). Then the
ESP32 to become a beacon with very little work. s e tB e a c o n O function allows you to set the
As the iBeacon.ino example states (available advertising data.
on www.circuitcellar.com/article-materials) We need to substitute the actual TXPower
there are six steps to the application: create byte and the battery voltage whole and
the BLE server, create some advertising data, decimal bytes with those place keepers
start advertising, wait, stop advertising, and defined earlier in b e a c o n A rra y [].
go to sleep. As always with my projects, I add
many lines of debugging code and use the b e a c o n A rra y [2] = oBeacon.
my Debug variable's bits to enable/disable g e tS ig n a lP o w e r();
S serial output with progress reports and data b e a c o n A rra y [b e a c o n A rra y L e n g th -2 ]
N
M values. These can be dynamically altered via = batV;
U
L user input, but generally are just preset prior b e a c o n A rra y [ b e a c o n A rra y L e n g th -l]
O
C to programming as wanted. = batD;
p A d v e r t ! s in g - > s t a r t ( );
del a y (100);
p A d v e r t!s in g - > s to p ();
e sp _ d e e p _ sle e p (1 0 0 0 0 0 0 L L * GPIO
DEEP_SLEEP_DURATION);
u in t 8 _ t beaco n A rrayLen g th = s iz e o f( b e a c o n A r r a y );
LISTING 1
The data packet payload is defined as an array in the Arduino code. This array has three attribute types: the TX power level, the complete local name, and the manufacturer
specific data (in this case the battery level). Note that each attribute has its own data length.
CIRCUIT CELLAR • MARCH 2023 #392
BLEScanResults foundDevices =
pBLEScan->start(scanTim e, fa ls e );
DISTANCE
Keeping in mind the orientation and
environment caveat, we can calculate
distance from the RSSI. To do this we must
measure the RSSI at lm . I did this and set it
as a constant in the application.
beaconDistanceEil = pow(10,((mydBm -
float(beaconRSSIEi]))/(10.00 * N)));
TESTING
I programmed three ESP32 boards as
beacons, and plugged them into charger
cubes in my kitchen, living room, and dining
room (Figure 3). The last ESP32 board
was programmed to display any received
beacons, along with their converted distance
measurements. Figure 4 shows the HTIT-
WB32 receiving two of the beacons from the
front foyer (between the living room and the
dining room). I seemed to be too far from the
kitchen beacon at this time. I began to pick
up the kitchen beacon as I moved toward the
dining room. Standing in one location, I found
that the distances wander around quite a
bit. Just when a distance seemed to be fairly
accurate, the next reading could be off by 50%.
FIGURE 4
I wasn't going to be able to triangulate with any Obviously, the more code you have, the The portable Bluetooth receiver C
reasonable accuracy. I could, however, easily longer it will take to run. So on the plus side, (Heltec HTIT-WB32) displays received
O
L
tell which room I was in. you can whittle down and strip off unnecessary U
beacon advertisements, along with M
These kinds of beacons are generally used code, or even write in machine language either the RSSI or an estimated N
S
with a phone app that recognizes when you instead of a higher-level language, to make distance. In the foyer I am receiving
are approaching an area. In a museum, your the code more efficient. You may be able to two of the three beacons; the kitchen
app might give you an audio message about optimize the power-up (reset) circuitry for fast beacon seems to be out of range at
the artist. In a grocery store, you might be starts. On the negative side, you can't speed this location.
notified that a particular product is on sale. At up the transmit time. And though you could
a bus stop, the beacon might tell you how long transmit with a lower TX Power, this might
you will be waiting for the next bus. Approach reduce the transmission current by only 20mA.
your front door beacon, and your phone could Unless you want to design from scratch,
instruct the door to unlock, or lock the door you are left with choosing a system that
when you leave. works best for you. And by that, I mean you
I want my robots to be able to recognize will most likely have to trade power for ease
which room they're in, so they can better of development. I have found some pre-built
plot their way around my house. Bluetooth beacons that are very low in power, but the
beacons seem like a pretty simple way of tools necessary for using them are just not
allowing this. While pinpoint accuracy is not the friendliest.
possible, many users pigeonhole the results In many cases, a beacon will be operated
into one of three regions based on the RSSI— in an area without power, so the point is
immediate (less than 0.5m), near (~2m), and moot. Your application will determine the
far (~30m). These descriptions seem to offer lengths you'll need to go to make it all work. I
useful information to an application. hope you'll find a use for this (relatively) low-
power Bluetooth technology. It's easy to get
THE PERFECT BEACON started, and the ESP32 is fun to work with.
When a beacon must be battery-powered, Everything takes time, and there's just too
you'd probably like at least a year of service. little of it.
It's obvious this ESP32 isn't going to fit
the bill. The ESP32 touts lOpA as its deep
sleep current draw, so the few milliamps ABOUT THE AUTHOR
I measured must be coming from other
circuitry on the board. I realize that this Jeff Bachiochi (pronounced BAH-key-AH-key)
particular circuit may not have been designed has been writing for Circuit Cellar since 1988.
for extremely low power, and if you wanted, His background includes product design and
you might redesign it for lower idle currents. manufacturing. You can reach him at:
The idle current is important, but the time the jeff.bachiochi@imaginethatnow.com, or at:
application is running has a bigger affect on
www.imaginethatnow.com.
battery life.
58 CIRCUIT CELLAR • MARCH 2023 #392
Ideal Power launches its firs t power module aimed at expected to be smaller and more
the solid-state circuit breaker (SSCB) m arket. The SymCool efficient than SSCBs using traditional
Power Module is a m ulti-die, Bi-Directional Bi-Polar Junction semiconductor switches while
Transistor (B-TRAN) module rated at 1200V 100A, and operating orders of magnitude faster
featuring double-sided cooling. than conventional electromechanical
The design is meant to meet the low conduction loss breakers."
needs of the SSCB m arket. B-TRAN is a p ro p rie ta ry patented During usage, circuit breakers
semiconductor power switch used in the SymCool Power are constantly conducting electrical current. It's critical to
Module. The new power modules are designed fo r us in parallel keep conduction losses to a m inim um . The SymCool Power
arrangem ents th a t can achieve a w ider range fo r high power Module shows dram atic reductions in conduction losses. This
applications in u tility, industrial, and m ilita ry applications. makes the modules suitable fo r the constant high voltage of
Ideal Power's President and CEO Dan Brdar said, "We a large electrical grid, as it reduces energy waste—crucial to
believe our SymCool Power Module is well-suited for the large, wind and solar distribution grids.
growing circuit breaker market, w ith the market projected to Key features include:
grow at a compound annual growth rate (CAGR) of over 6%
to approximately $26 billion by 2027. With clear advantages • Bi-directionality, which equates to fewer switches. The
over electromechanical, IGBT, and MOSFET-based breakers, we SymCool allows flow in both directions, rather than ju st the
believe B-TRAN enabled SSCBs are ideal fo r a range of utility, uni-directional capabilities of the IGBTs, which are single
m ilitary, and industrial power control applications. Today's sided.
introduction is a tremendous achievement fo r our entire team • Advanced packaging. There is dual-sided cooling and built-
and marks the realization of our vision fo r our bidirectional, in tem perature sensing. This allows heat dissipation from
low-loss power semiconductor architecture. We look forw ard both the top and bottom of the module.
to our firs t commercial sales later in 2023 as we execute our
B-TRAN product roadmap." Aging infrastructure m ust be upgraded. There is thus a
"The introduction of our firs t commercial product marks a need fo r advanced system circu itry in renewable energy, EV
pivotal development for Ideal Power's B-TRAN technology, and technology, m icrogrids, energy storage, u tility transm ission
S we could not be more excited," stated Brdar, "The SymCool and distribution, and railway systems. The SymCool Power
W Power Module was designed specifically to enable SSCBs to Module promises to address this need.
E
N
T deliver very low conduction losses. B-TRAN-enabled SSCBs are Ideal Power Inc. | idealpower.com
C
U
D
O
R
P
Gunnir1 MXM Form-Factor Intel Arc A380 GPU for Desktops
Gunnir launched an MXM fo rm -fa cto r Intel Arc A380 GPU The Intel Arc A380 is a desktop-grade graphics card based
aimed at desktops. Gunnir is the only m anufacturer that on the ACM-G11 GPU w ith eight Xe cores or 1024 stream
exclusively produces Intel-based graphics cards. processors. The 6GB m em ory is connected through a 9 6 -b it
The mobile form factor LM-A380-6G MXM 3.1 Type-A interface. Its eight Xe cores means it's likely faster than the
modules come w ith an excess of VRAM and 6GB of GDDR6 Arc A370, which sported 4GB VRAM and a 6 4 -b it m em ory
memory, designed to suit applications in notebooks, embedded interface.
applications, and desktops in p ro p rie ta ry form factors. In the wide w orld of gaming GPUs, there is little call fo r
MXM modules, as most gaming laptops come w ith soldered-
down GPUs that use VRAM. There are ju s t tw o companies
making p ro p rie ta ry GPU modules, Dell and Alienware, and
ju s t a few models come w ith the modules.
The MXM 3.1 Type-A modules mean there could be a move
to address embedded machines and desktops.
The LM-A380-6G is rated at 75W therm al board power.
This is an overheated unit fo r a m ainstream laptop but is still
suitable fo r embedded applications and some desktops.
The most exciting feature here is its video capabilities.
The modules could find uses in Digital Signage.
The Gunnir Arc A380 6GB MXM 3.1 is available now and
runs $260-$286 w itho u t VAT. The modules are intended fo r
ultra-com pact desktops and embedded applications, which
helps ju s tify the unit's higher cost of a standard desktop Arc
A380.
Gunnir | gunnir.cn
PRODUCT NEWS
P
Three Automated Test Equipment Lines for Semiconductors from Xilinx R
O
D
Xilinx has three automated test equipm ent lines for capability for Image Acquisition. The system also keeps power U
C
T
semiconductors. The three areas th a t Xilinx focuses on for consumption and device cost low. The cost-sensitive nature of N
next-gen SoC testing cover: SoC and storage testers, semi- this application requires special attention to power consumption. E
W
ATE: image acquisition, and semi-ATE: PIN electronics. The Kintex UltraScale has a solid price/perform ance/ S
SoC and Storage Testers: The Versal architecture gives w a tt balance delivering a cost-effective solution fo r high-
system designers perform ance, power-optim ized hard IP, end capabilities that include support fo r such systems as
and fle xib ility th a t are exclusive to Xilinx. DSP engines and 6.3 TeraMACs of DSP compute performance, PCIe Gen 4x8,
A l engines, available in the Versal Premium ACAPs, provide 2.6Gbs DDR4, and 32Gbps transceivers.
unmatched signal processing capacity. These devices feature Semi-ATE: PIN Electronics: For vector generation and
on/off-chip m em ory bandwidth at higher speeds, plus 7.5M analysis, there is a need fo r cost-effective FPGAs to address
system logic cells in the Adaptable Engines th a t play a critical PIN Electronics. This would also include a large number of
role in providing ATE the fle xib ility necessary fo r custom IP, high-perform ance I/Os to connect to a greater number of
m onitoring functionality, and tra ffic generation. ASSPs w ith th e ir parallel interfaces. There is also a need fo r
Additionally, the scalable 112G PAM4 transceivers and sophisticated I/O buffers and more capable clock generation
power-optim ized Hard IP are engineered to enable the most and distribution given the lG b/s+ link speed, fewer reference
popular interface standards, clocks, and unfriendly channel, to
including a variety of perform ance manage skew across m ultiple lanes
options and features. Some of and over PVT.
the likely candidates fo r such The Kintex UltraScale+ FPGAs have
systems measurements are the feature-rich SelectIO transceivers
400G High-Speed Crypto Engines, and are high-performance. The
600G Ethernet MAC, Integrated SlectIO transceivers have signal
PCIe Gen5 Blocks, DDR Memory conditioning capabilities, PLL and
controller, and more. DLL-based clock generation as well
Semi-ATE: Image Acquisition: as distribution resources. These are
Xilinx offers the Kintex UltraScale+ enhanced with skew management
to cover the need for high- capabilities.
performance transceivers and DSP Xilinx | xilinx.com
GigaDevice Launches 1st Gen Wi-Fi MCUs to Enhance Wireless Security in AIoT
GigaDevice launched 1st Gen Wi-Fi Microcontrollers (MCUs) provides up to 180MHz frequency, with as high as 2048KB of
to enhance wireless security in Artificial-Intelligence-of-Things on-chip Flash, 448KB SRAM, and up to 32MB external Flash.
(AIoT). The GD32W515 MCU is the latest member of the Arm The Power supply voltage is 1.6V-3.6V, and the I/Os can take
Cortex-M33 core MCU portfolio. up to 5V.
These new MCUs have a higher baseband and RF The operating temperature is -40°C to +85°C,
performance, and built-in Trustzone architecture for extended complementing an challenging industrial environment design.
reliability in hardware execution environments for secure data The maximum transm it power is 21dBm, and there is a signal
storage. This continues a high standard for the GD32 MCU family receiving sensitivity of -97.6dBm, along with a total link
with solid compatibility between software and hardware. The budget of 118.6dBm. This provides a great deal of frequency
GD32W515 products offer wireless connectivity development and baseband performance.
options for a variety of applications in smart homes. The adjacent channel rejection (ACR) value can run as high
Additionally, the GD32W515 is suited for industrial loT and as 48dB, which effectively prevents strong signal interference
consumer electronics. The company feels that with enhanced while improving the stability of overall signal reception. The
processing capabilities and features that offer rich integration series also supports high transmission rates with an Ip erf
options, designs for those applications can be simplified. throughput of up to 50Mbps. In the laboratory setting that
The GD32W515 continues the GD32 series use of the Arm throughput reached 80Mbps.
Cortex M-33 core, integrated with a 2.4GHz single-stream To further simplify the design and development of products,
IEEE 802.11b/g/n MAC/ the radio frequency (RF) module is on-chip, reducing the Bill-
Baseband/RF radio of-Materials and the need for external components.
frequency module on- The GD32W515 series is backed by an SDK in addition to
chip. The Arm Cortex the hardware drivers, the software protocol stacks and cloud
M-33 core is based on connections, and other functionally dedicated systems related
the latest Arm v8-M to Wi-Fi modules.
ISA, and supports DSP There are a number of development environments and
instruction extension, tools such as Keil MDK, GCC, and IAR EWARM, which are all
as well as a single fully supported. The operating systems cover a wide range
precision floating-point of applications and include FreeRTOS, uCOS, RT-Thread, and
arithmetic unit (FPU). AliOS.
The GD32W515 series GigaDevice Semiconductor | gigadevice.com
The Directory of
Advertisers must furnish digital files that meet our specifications (www.circuitcellar.com/mediakit).
All text and other elements MUST fit within a 2" x 3" format.
E-mail adcopy@circuitcellar.com with your file.
UNLOCK CC 2022
Bundle Contents
extbook
USB Cable
Single-Chip Compiler
Companion Hardware
E3mini Advanced
Accessories Kit
53217-1530 $25
Sensors Explorers Kit
S-205 $69
www.embeddedARM.com
TS-7100
NXP i.MX 6UL 696 MHz ARM CPU w ith FPU
Our smallest single board com puter
measuring only 2.4" by 3.6" by 1.7"
62 CIRCUIT CELLAR • MARCH 2023 #392
Problem 1 — Problem 3 —
Unix 6th edition was an important One thing that made Unix 6th edition
landmark in the development of famous was a "commentary" written
operating systems. Distributed with by a college professor that became
source code, it enabled users and a widely-distributed teaching tool for
students to learn and understand its the operating system. Who wrote it?
operation in great detail. To start with,
what computer was the first to run Problem 4 —
this operating system? One feature that was relatively
unique to Unix was the concept of a
Problem 2 — "pipe." What is a pipe, and why is it
In terms of source code, how big significant?
was the Unix 6th edition kernel? How
much of this was assembly code?
Connect with
Q
E
Confidence
R
U
O Partnering with Digi for your loT
Y
S project can deliver exceptional ROI -
T
S
E from critical insights to cost reductions
T
www.circuitcellar.com/digi
circuitcellar.com 63
Three Questions
to Ask Your Supply
Chain Partner
pPOL” Chip-Embedded
Power Modules
A Simple Solution for High Power Density Applications
Current Output: 3 A, 4 A, 6 A, 12 A
REGISTER FOR
Wide Input Voltage (up to 16 V) A FREE pPOL
EVALUATION
Adjustable Vout ±5m V
BOARD
Output Voltage, ±0.5% Initial accuracy (Up to 5 winners)
www.embeddedARM.com
OUTBACK
R SPACE