CC 2020 03 Issue 356

You might also like

Download as pdf or txt
Download as pdf or txt
You are on page 1of 84

MEDICAL WEARABLES

MARCH 2020
circuitcellar.com ISSUE 356
CIRCUIT CELLAR | ISSUE 356 | MARCH 2020

Inspiring the Evolution of Embedded Design

ELECTRONICS EVOLVE FOR


MEDICAL WEARABLES

w Datasheet: Industrial Power Supplies w PCB Assembly Services |


Build a Composite Video Text Terminal | LoRa-Based Tracking System |
circuitcellar.com

Periodic Table Project Uses PIC16 | LPWAN Deep Dive w Kilogram Redefined |
USB Attacks with GreatFET Tool | Taking RPLIDAR Out for a Spin (Part 1) |
Dehumidifier Revamped for the IoT Era w The Future of Data in Robotics
FRESH
PERSPECTIVES
At the world’s largest, most
comprehensive event for unmanned
and autonomous systems, you’ll
discover that something extra that
gives you a competitive edge — your
X factor. Only AUVSI XPONENTIAL
2020 offers the opportunity to
hear new ideas, get up close with
groundbreaking innovations and form
partnerships that move your business
— and the industry — forward.

FIND YOUR MOMENTUM. FIND YOUR X FACTOR. Boston Convention and Exhibition Center | Boston
May 4 – 7 | Educational Program
REGISTER NOW | XPONENTIAL.ORG May 5 – 7 | Exhibits
2 CIRCUIT CELLAR • MARCH 2020 #356

Issue 356 March 2020 | ISSN 1528-0608

OUR NETWORK CIRCUIT CELLAR® (ISSN 1528-0608) is published monthly by:

KCK Media Corp.


PO Box 417, Chase City, VA 23924

Periodical rates paid at Chase City, VA, and additional offices.


One-year (12 issues) subscription rate US and possessions
$50, Canada $65, Foreign/ ROW $75. All subscription orders
payable in US funds only via Visa, MasterCard, international
postal money order, or check drawn on US bank.

SUBSCRIPTION MANAGEMENT

Online Account Management: circuitcellar.com/account


Renew | Change Address/E-mail | Check Status

SUPPORTING COMPANIES CUSTOMER SERVICE

E-mail: customerservice@circuitcellar.com
Accutrace, Inc. C3 Phone: 434.533.0246

All Electronics Corp. 77 Mail: Circuit Cellar, PO Box 417, Chase City, VA 23924

AUVSI XPONENTIAL 2020 1 Postmaster: Send address changes to


Circuit Cellar, PO Box 417, Chase City, VA 23924

CCS, Inc. 77 NEW SUBSCRIPTIONS

Earth Computer Technologies, Inc. 15 circuitcellar.com/subscription

EasyOEM 25
ADVERTISING
EzPCB 59 Contact: Hugh Heinsohn

Embedded Tech India Expo 2020 65 Phone: 757-525-3677


Fax: 888-980-1303
Formant 63 E-mail: hheinsohn@circuitcellar.com
Advertising rates and terms available on request.
HuMANDATA, Ltd. 51
NEW PRODUCTS
IAR Systems, Inc. 45 E-mail: editor@circuitcellar.com

Pico Technology 19
HEAD OFFICE
Revenue Control Systems 77 KCK Media Corp.

Technologic Systems, Inc. C4, 77 PO Box 417


Chase City, VA 23924
Phone: 434-533-0246
University of Cincinnati 31

NOT A SUPPORTING COMPANY YET?


COPYRIGHT NOTICE

Contact Hugh Heinsohn Entire contents copyright © 2020 by KCK Media Corp.
All rights reserved. Circuit Cellar is a registered trademark
(hugh@circuitcellar.com, Phone: 757-525-3677, Fax: 888-980-1303) of KCK Media Corp. Reproduction of this publication in
to reserve space in the next issue of Circuit Cellar. whole or in part without written consent from
KCK Media Corp. is prohibited.

THE TEAM
DISCLAIMER
PRESIDENT EDITOR-IN-CHIEF ADVERTISING COORDINATOR
KCK Media Corp. makes no warranties and assumes no
KC Prescott Jeff Child Nathaniel Black responsibility or liability of any kind for errors in these
programs or schematics or for the consequences of any such
CONTROLLER SENIOR ASSOCIATE EDITOR ADVERTISING SALES REP. errors printed in Circuit Cellar®. Furthermore, because of
Chuck Fellows Shannon Becker Hugh Heinsohn possible variation in the quality and condition of materials and
workmanship of reader-assembled projects, KCK Media Corp.
disclaims any responsibility for the safe and proper function
FOUNDER TECHNICAL COPY EDITOR PROJECT EDITORS
of reader-assembled projects based upon or from plans,
Steve Ciarcia Carol Bower Chris Coulston descriptions, or information published in Circuit Cellar®.
Ken Davidson
GR APHICS David Tweed The information provided in Circuit Cellar® by KCK Media
Corp. is for educational purposes. KCK Media Corp. makes
Grace Chen
no claims or warrants that readers have a right to build
Matt Pinkerton things based upon these ideas under patent or other
relevant intellectual property law in their jurisdiction, or
COLUMNISTS that readers have a right to construct or operate any of
Jeff Bachiochi (From the Bench), Bob Japenga (Embedded in Thin Slices), the devices described herein under the relevant patent or
other intellectual property law of the reader’s jurisdiction.
Robert Lacoste (The Darker Side), Brian Millier (Picking Up Mixed Signals), The reader assumes any risk of infringement liability for
George Novacek (The Consummate Engineer), and Colin O’Flynn constructing or operating such devices.

(Embedded Systems Essentials) © KCK Media Corp. 2020 Printed in the United States
circuitcellar.com 3

INPUT
Voltage
Coronavirus Impacting Electronics Industry

B eyond the obvious human tragedy,


including lives lost and communities
disrupted, it’s clear that the coronavirus
outbreak is going to impact several
industries including the electronics industry. The
impact is expected to be much more severe than the
of the crisis. “… the effects of the virus on supply chains,
which have grown notoriously complex, are difficult to
anticipate. A single part of an advanced product like a
smart TV may be made of dozens of smaller components,
with each of these assembled from other pieces.” The
problem is tricky because companies themselves often
SARS outbreak in 2003. As reported in an assessment in do not know the suppliers that are three and four rungs
early February by IHS Markit entitled “Coronavirus Rolls down the chain. Apple, for instance, assembles most
Through Global Economy – Impacts on GDP,” at the of its products in China. The company disclosed much
time of SARS, China was the sixth largest economy, wider volatility in its potential revenues for the current
accounting for only 4.2% of world GDP. China is now quarter in the face of uncertainties around factory
the world’s second largest economy, accounting for production and sales of its products.
16.3% of world GDP. That means that any slowdown As seems to always be the case with the electronics
in the Chinese economy reverberates across the globe. technology industry, while it’s being shaken by world
At the time of writing this, it’s not certain when events, it is simultaneously offering potential solutions
confinement measures will be lifted, and that will to the very same crisis. A piece by Frost & Sullivan’s
telegraph how severe the effect of factories going idle Dilip Sarangan entitled “The Next Generation of IoT—
will affect 2020 GDP. Assuming they’re not lifted until Addressing the Coronavirus and Preventing Future
March, IHS Markit predicts that the resulting economic Outbreaks” outlines his view on how IoT could play a
impact will be concentrated in the first half of 2020, with role in preventing future disease outbreaks, especially
a reduction of global real GDP of 0.8% in Q1 and 0.5% in the context of China.
in Q2. In this scenario, the coronavirus and resulting “The first step in infectious disease control is
measures will reduce global real GDP by 0.4% in 2020, detection,“ says Sarangan, “While a global network of
says IHS. sensors is unlikely to happen in the foreseeable future,
We’re already hearing from some of our friends in China does have the ability to implement such a network
the embedded board industry that some companies in the country. China has a history of implementing
are being more cautious when promising ship dates wide-area IoT solutions (video surveillance) on a scale
because of the potential impact of the coronavirus that has never been seen before. So why not a network
epidemic on product shipments. For products primarily of virus-detection sensors? Couple that with facial
built in China, shipping dates in the Spring timeframe recognition and location, existing surveillance cameras
are now in doubt. to identify, trace, and monitor people that may have
An early February New York Times story “SARS contracted the coronavirus. While this may sound like a
Stung the Global Economy. The Coronavirus Is a Greater police state to many, ultimately, leveraging IoT and AI
Menace,” by Peter S. Goodman, provides an informative may be the most logical way to prevent highly infectious
overview of the many impacts of coronavirus on the diseases from spreading rapidly in a world that is
world economy. One interesting area discussed in getting smaller every day with air travel.”
the article is the symbiotic relationship between the
China and the US technology industries in this day
and age. The American semiconductor industry is
particularly entrenched in China, which is both a major
manufacturing hub and a market for its products.
Intel’s customers in China accounted for about $20
billion in revenue in 2019, or 28% of its total for the
year,” says Goodman. “Qualcomm, the dominant maker
of chips for mobile phones, is even more dependent on
China, drawing 47% of its annual revenue—or nearly
$12 billion—from sales in the country.”
The article also discusses the supply chain impacts

Jeff Child
4 CIRCUIT CELLAR • MARCH 2020 #356

COLUMNS
DATASHEET

42 Industrial Power Supplies


Factory Functionality
By Jeff Child

46 USB Attacks and Embedded System Essentials

More with GreatFET


Facedancer Fun
By Colin O’Flynn

52 Redefining the Kilogram


PG. 46
The Consummate Engineer

From Metal to Math


By George Novacek

54 Dehumidifier Revamped for


Picking Up Mixed Signals

the IoT Era


Wireless Control
By Brian Millier

66 Taking RPLIDAR Out for a Spin


From the Bench
PG. 54
(Part 1) Command Interface
By Jeff Bachiochi

TECH THE FUTURE

79 Distilling Insights from


The Future of Data in Robotics

Tomorrow’s Digital Exhaust


By Jeff Linnell

74 : PRODUCT NEWS
78 : TEST YOUR EQ

@editor_cc
@circuitcellar circuitcellar
PG. 66
circuitcellar.com 5

FEATURES

6 Build a Composite Video


Text Terminal
Using TI’s TM4C MCU
By Stuart Ball

12 LoRa-Based Tracking System


SARNet Aids Search and Rescue
By James Lawton,
Callum Munn-Middleton and Cam Stauffer

PG. 6
20 Periodic
Trainer
Table Desktop

Built Using PIC16 MCU


By Devlin Gualtieri

26 A Deep Dive Into LPWAN


IoT Sensor Connectivity
By Wolfgang Thieme

SPECIAL FEATURE

32 Solutions Evolve for


Medical Wearable Designs
MCUs, Analog ICs and Sensors
PG. 12
By Jeff Child

TECHNOLOGY SPOTLIGHT

38 PCB Assembly Services


Parts, Prototypes, Production
By Jeff Child

PG. 20
6 CIRCUIT CELLAR • MARCH 2020 #356

Build a Composite Video


Text Terminal
Using TI’s TM4C MCU
FEATURES

There are many benefits to integrating


a small display into your embedded
system. In this project article, Stuart
takes a 3.5" LCD video monitor and
builds a circuit that provides a text-
based terminal that can plug into
the display. This basically emulates
an old-style alphanumeric computer
terminal, but using modern low-
power LCD technology.

By
Stuart Ball

I picked up a $15 LCD video monitor from


Amazon. It has two standard, composite
video inputs. The screen is only 3.5", so you
would never use it to replace a 12" or 14"
monitor. It is intended for use as a display for
backup cameras in vehicles.
in the transmitted waveform. The picture on
the screen was painted as a series of lines from
left to right and from top to bottom. There was
no digital communication. It was all done with
voltages and resistor-capacitor timing.
To paint the image on the screen, the waveform
All that said, a display like this has some other has to include:
uses. For example, it could be a status display for
an embedded system. Of course, you could always • A signal to start painting on the picture tube at
carry around a tablet, or even display things on the top left corner of the screen
your phone. But what if you want the display self- • When to start each new line
contained? Or you don’t want to add Wi-Fi to your • The brightness (white level) of each dot on each
design? What if it’s a piece of equipment that line
is located where phones and computers aren’t
allowed? The composite waveform is shown in Figure 1.
I thought it would be interesting to build a Since the video terminal circuit that I built is only
circuit to provide a text-based terminal that can for painting characters—not a television picture—
plug into the display. The effect would be similar all the video information is either white or black.
to the old alphanumeric computer terminals used In contrast, on a television broadcast the video
in the 1970s and 1980s, but with a much smaller, portion would vary between white and black to
lighter, and less power-hungry screen. To make reproduce the grayscale image of the transmitted
this work, I had to generate an output that would picture. The composite waveform, when sent
drive the composite video input of the monitor. over a cable, is normally a 1V P-P (peak-to-peak)
signal. When broadcast over the air, the amplitude
WHAT IS COMPOSITE VIDEO? varies with signal strength. Circuits in a television
The composite video waveform dates back receiver normalize it, so the signal can be used.
to the days of monochrome televisions, when Each line starts with a horizontal sync pulse
they were built with vacuum tubes. Because the that is about 0.1V, with 4.7µs duration. This tells
signal was sent over the air, everything needed to the receiver to restart the scan at the next line.
display a complete picture had to be embedded There is a black region on either side of the
circuitcellar.com 7

horizontal sync pulse to give the circuits in rate to make the characters wide enough to
the receiver time to process the sync input. read, results in a row of typically 70 to 80
These are called “blanking,” and they are characters. Filters in a television to remove
referred to as the “front porch” (the blanking the audio subcarrier mean a television can’t
interval just before the sync) and the “back display that many dots on the screen, but a
porch” (the blanking interval just after the monitor with composite video input can.

FEATURES
sync). Between the back porch of one sync If the first line of the display contains the
pulse and the front porch of the next is the characters ABC, then the first three locations
live scan video information. This is where one in the RAM will contain the ASCII codes for
scan line of the picture is painted. those characters. As the scan moves across
Once the last horizontal line has been the screen, the first scan line will address the
painted, the scanning beam must be top line of character A, then B, then C, and
moved back to the top left corner to start then the rest of the line will be blank. The
the next image. This is done with vertical second scan line will address the second line
synchronization pulses, which are the same of character A, then B, then C, and so on. Each
voltage as the horizontal sync pulses, but have character row is displayed, one scan line at a
a longer time period. Circuits in the television time, all the way to the bottom of the screen.
recognize the difference in the pulse width Later versions of the composite waveform
between horizontal and vertical sync, and inserted information into the vertical blanking
move the scan back to the top left corner. The interval for things like channel information and
vertical sync on an old television took some closed captioning. Although composite video
time to retrace the scanning beam, so three has been superseded by higher resolution
vertical sync pulses were followed by a long VGA, DVI and HDMI in computers, the ability
blanking interval. That gave the circuits time to run a full video signal down a single coaxial
to make the vertical recovery. cable still has advantages in some situations.
The vertical blanking interval is broken up And, now, of course, the television broadcast
or serrated by horizontal sync pulses, so the itself is a digital HDTV transmission.
horizontal synchronization isn’t lost during the
vertical retrace time. The vertical scan rate is EARLY VIDEO TERMINALS
60Hz in the US NTSC system. This is not an The composite video standard defines a
accident. By making the vertical scan rate the standard way of getting a video image to the
same as the 60Hz power frequency, some visible
artifacts resulting from using vacuum tubes,
262 horizontal lines, separated by horizontal sync
unregulated power supplies, tube filaments
operating at 60Hz, etc., can be minimized. The 58 microsecond
vertical sync pulses
horizontal sync rate is 15,750Hz, or a 63.5µs
period. The 60Hz vertical rate combined with a
15,750Hz horizontal line frequency gives 262.5
horizontal scan lines per picture.

TOTAL VIDEO TIMES Horizontal sync


+ blanking
Because the sync, front porch and back 10.9 microseconds White level, 0.8V

porch together need about 11µs, the total live Black level,
0.3V
video time on each scan line is about 52µs. So, Sync level, 4.7 microseconds
the horizontal synchronization process steals 0.1V horizontal
sync pulse
about 20% of the total line time. Similarly, the
Horizontal sync
vertical retrace takes some time, so a portion period 63.5
of the 262 horizontal scan lines are blanked 63.5 microseconds
(15,750 Hz)
and used for vertical retrace.
In displaying text on a monitor using Scanning a character row, line by line
composite video, each character needs
multiple lines on the display. In the 1970s This row of dots is displayed --->
Then this row ---------->
and 1980s, typical characters were either 5×7
or 7×9—that’s 5 dots wide by 7 dots high,
or 7 dots wide by 9 dots high. To display a
complete character, 7 or 9 scan rows would
be needed, with at least one blank row of Here the first row of dots for the second character row is displayed

dots between each character row to separate Horizontal blanking


for each scan
the characters. The monitor would therefore row ends here
display around 20 or 24 character rows.
Similarly, with each character being 5 or 7 FIGURE 1
dots wide, clocking the dots at a reasonable Composite video waveform
8 CIRCUIT CELLAR • MARCH 2020 #356

monitor, but a signal containing intelligible NEW DESIGN


information still has to be generated. Early The new circuit implements similar
video terminals were constructed with TTL functionality using a modern microcontroller
(transistor-transistor logic). The logic had to (MCU). I used a Texas Instruments (TI)
walk through the display memory, retrieving TM4C1233H6PM Arm-based MCU, mainly
stored ASCII characters in sequence. because I had a few on hand. The entire
FEATURES

The output of the display memory would circuit consists of the MCU, an RS232 interface
go to a ROM (read-only memory) that chip, a single-gate, open-collector buffer and
contained the codes for converting the ASCII a voltage regulator. A transistor drives the
from the RAM into dot patterns for each scan video output to the monitor.
line of the character. A shift register produced The TM4C has enough internal memory to
white/black outputs that produced dots on store the video information and to support
the screen. Additional logic was needed to the program. Memory was expensive in the
generate the horizontal and vertical signals days of the original terminals, but there is
when needed, and still more logic was needed plenty of memory to store scan rows instead
to handle incoming serial data, and write it of characters in the TM4C RAM. So, instead of
into memory. The Lear-Siegler ADM-3A was storing ASCII characters that are converted to
one such terminal. You can find a maintenance dots by an external ROM, the TM4C program
manual for it with schematics on the Internet. converts the incoming ASCII codes to dots in
That terminal had over 100 ICs. a lookup table, and stores the dots in the RAM.
Video cards installed in early computers Using internal RAM has an additional
often used video timing ICs, such as advantage—no complicated RAM synchronization
the Motorola 6845. These devices had is needed. Early video cards needed a mechanism
programmable internal counters to address to ensure that the computer microprocessor did
external RAM and to generate the vertical not write new characters into memory during the
and horizontal timing pulses. But they still live scan time. If they did, the display would be
required external RAM, an external character covered with “snow”—white dots that randomly
generator ROM and additional hardware to appear on the screen. If the writing occurs during
put the ASCII characters into the RAM. the live scan time, it interferes with reading the
memory to display the characters. One way this
was fixed is by writing only during the horizontal
1980s Terminal display logic or vertical blanking periods, when the screen is
Sync ⁄ blanked anyway.
Sync ⁄ blanking logic blanking
signals In the TM4C design, this isn’t necessary,
Character load logic because the reading is performed using
Address counters Character RAM Shift
register
the internal DMA controller. DMA access to
Character RAM
Load
the RAM is synchronized with the MCU CPU.
Address Data Address Dots to
Out video
As a result, there is never a problem with
Data
Character mixer interference between the two.
dot-row address Early terminal designs used a shift
Address
To additional register to shift out the dots. The TM4C
logic for writing design uses one of the synchronous serial
new characters
to RAM ports to output the dots. Internal timers
Dot clock
generate the synchronization signals, and
Arm-based terminal design the entire process is driven by the horizontal
sync signal. The TM4C provides a nearly self-
contained video terminal with few external
CPU
parts needed (not counting, of course, the
electronics in the LCD video terminal, itself).
Timer T0 Sync to video mixer
Incoming serial data UART1 Due to the tiny size of the monitor, a DIP
RAM DMA SSI0 Dots to video mixer
switch selects either a 75-character x 20-row
output, or a 35-character × 10-row output.
FIGURE 2 The 75×20 output is for display on larger
Block diagram of a 1980s-vintage terminal design and of the new Arm-based design. terminals. You can use it on the tiny display,
but it’s impractical.
Figure 2 is a block diagram showing how a
ABOUT THE AUTHOR terminal might be implemented in the 1980s,
compared to the new design. The address
Stuart Ball is a registered professional engineer with a BSEE and an MBA. He counters in the old design (top of Figure 2)
has more than 30 years of experience in electronics design. He is currently might be discrete counters or part of a video
a principal engineer at Seagate Technologies. timing chip, but you can see that there is a lot
of logic required either way, to generate the
circuitcellar.com 9

video information. This diagram doesn’t even transmit 7-bit words, since the character
include the logic that gets new characters matrix is 7 dots × 9 dots. The SSI shift
into memory. The lower diagram in Figure 2 register is clocked at 10MHz in 75-character-
is the new approach, where nearly everything per-line mode, and at 5MHz in 35-character-
is contained in the MCU. Although the MCU, per-line mode. This is the dot rate, and allows
itself, is far more complex than the old design, the 52.5µs live scan time to display 525 dots.

FEATURES
it still replaces dozens of ICs with just one. Using a 7×9 character format, that’s 75
characters per line. With a 5MHz clock, it’s
THE CIRCUIT 37 characters per line. I set it to 35 in the
The schematic of the circuit is shown in firmware.
Figure 3 and Figure 4. U1, the TM4C1233H6, U3 buffers the output of PD3 so it can drive
is one of many parts in the TI TM4C family. the output transistor. Serial port 0, on PA0 and
Internal timer T0 generates the 15,750Hz PA1, is used for programming the device. A
horizontal and vertical sync pulses, and the jumper, W1, is grounded to put the TM4C into
output of T0 is fed back to input PB6 as an programming mode. J2 connects an external
interrupt. RS232 converter to connect to the host serial
Synchronous serial interface number 3 is port, as described in my article “Debugging
used to generate video dots and blanking. The Embedded Systems with Minimal Resources”
output of SSI3, on PD3, is pulled to ground, (Circuit Cellar 312, July 2016). Figure 5 is a
because it needs to be at blanking level when schematic of the programming adapter.
not active, and the TM4C normally floats the U5 is a 3.3V to RS232 converter that
output when inactive. SSI3 is configured to connects serial port 1 (UART1), on PB0/PB1, to

/ /( /(

 
# -
  
85 3 + 7 &
   
  7 &
 15 
7 &
  - 
 0&  = -
  7 &
: 
& 1 
9  -
7%>+ ?
= 
?

7> ? .
9  
?
:
?  ' 2
 =
7 ?

   7

9

, , , 

   



 3+*




 


3*

 ; 9




  6< 

 =
3* +3
-  
 +8

+ *
 6*45
+@
 +
%9 *45

%
 9
;3* %
:
%
 :
;3* % 7+-81
/( 9
%
 
A.>@? % * +
 
- A68% % * -
:
A-*+
 
>9

>
*   /(
15; >
 
15> >
- *.   #
15 >
9 = 
15 >
= : 
15 >
 9 
15 >

7B C
(:7B' * 
+ 
(7B -
7B2D)

-9
/( /( /( /( /(

-:
 9 : =

(, (, (, (, *.

FIGURE 3
Schematic, page 1

       !  "#$%&' ( )"*) $
10 CIRCUIT CELLAR • MARCH 2020 #356

the cursor, the blank line under the character


 
where the cursor is located is switched once
), ), per second between white and black.
Although the horizontal characters per line


 = = (

/=
/>
  can be changed simply by changing the dot
),  > > 
), clock and forcing the DMA to send only 262
FEATURES

 ( #
dots (35 characters) per scan line, the vertical
+ - -?0 -4 -


-?0 -4 -
1




(
spacing isn’t so easy. In 35-character-per-
line mode, if the same number of character
+ . .4 - .?0 :
 
.4 - .?0 1 :
)/

/ 30
   rows were used as in the 75-character-per-
 67 row mode, the characters would be vertically
)/ “squashed,” and only the upper half of the
)/ display would be used. So, in 35-character-
per-line mode, each line of dots is sent twice to
)/
.1
)
 
.:
expand the vertical height of each row. The full
( 8
frame is still 262 scan lines, but each character
 (
4-+ 0(
1(2/301  #(
row now takes 20 scan lines instead of 10.
0(
 .
. 

0(
 9  /  Timer T0 is configured as a 16-bit PWM
+50
.

.

generator. The duty cycle is 4.7µs for the
+@A)/ horizontal sync, and 58µs for vertical sync. The
%A)/
B* A):/ interrupt service routine (ISR) has to change
the PWM duty cycle (but not the frequency)
FIGURE 4
to generate the wider vertical sync pulse. The
Schematic, page 2 the host system. UART1 is fixed at 9600 baud value can’t be changed inside the ISR, because
in the firmware, though that can obviously be it will produce a short pulse at the output.
changed. Header J3 is a 10-pin header that Instead, the ISR sets a flag, and the main loop
connects to a D-series connector with a short changes the duty cycle, when the time count
cable. Transistor Q1 mixes the dot and sync is lower than the new duty cycle value. This
signals to produce the composite video output. causes the new duty cycle and pulse width to
To keep the dots crisp, Q1 is biased so that it
'< occur on the next timer period.
never goes fully into saturation or cutoff. The software scrolls the screen when a
%&' ( new character needs; to be inserted and the
SOFTWARE screen is at the end. This is accomplished by
There are some special considerations in moving+*an index
 that indicates where the top
the TM4C firmware to make working video. The row starts. At initialization, location 0 in the
“character generator ROM,” which is actually
  ! "#$%&' () *"+* $
display RAM area is the start of the first line.
an array in flash memory, is configured for When the bottom of the screen is reached,
7x9 dots. But the actual display memory is the screen is scrolled up by making location
sized for 10 dots per character, to make a 750 (the start of the second character row)
blank scan line under each character row for the top of the screen, and the row starting at
vertical separation. This extra scan line isn’t location 0—now the last row on the screen—is
included in the character matrix. It’s just an blanked. The circuit board and the monitor,
extra line that is initialized to all zeros (blank). displaying a few lines of test text, are shown
So, the start of the first character row is at in Figure 6. See the sidebar “ Composite Video
location 0 in the display memory array, and Display Calculations” as a guide if you wish to
the next one is at location 750 (75 characters try out alternate clock frequencies or different
per row × 10 scan lines per character). To blink character generator dimensions.

 

- -
"

 7
67
68

7
! "  
2!
" - -
*- - 8 8 !
2 2 %
%  
.<: .; .
 !  3 ! 
6 .<: .; . "
   
2 2 2; . 2<:  2 3 ./

. 2; . 2<:  2>=/
9: ! ! 
" ! !
6 9: 23 2"
 01   " "
 ./

0 
=#5
FIGURE 5
Programming adapter
circuitcellar.com 11

COLOR
When color television was introduced,
the monochrome video waveform was
modified to accommodate the addition of
color. The waveform had to be compatible
with existing monochrome televisions, so

FEATURES
the changes had to be invisible to existing
monochrome receivers. Color was added
by sending a color sync burst during the
horizontal synchronization back porch, which
synchronized the chrominance phase with
that of the transmitter. The color information
is phase-encoded with a 3.58MHz signal on
the video. Circuits inside the television extract
the 3.58MHz color signal to display the color
information with the luminance (white/gray/
black) information. The video circuit here does
not include color. That would take additional
hardware and a significantly faster processor. FIGURE 6
As currently implemented, the terminal CONCLUSION Photo of prototype circuit board and
is fairly simple. Characters are received via This project started out to re-create the 3.5" LCD monitor
the serial port and written to the display at something resembling the terminals that we
the current cursor position. When the end used on in the 1980s. Unless you are
of the display is reached, the screen scrolls interested in that sort of project, the original
up one line, and new characters are inserted intent for this circuit wouldn’t be of use. But
at the bottom. The addition of direct cursor the simplicity of the circuit provides an easy
addressing would allow the host to send way to build a text-based or even graphics-
characters that tell the terminal to place the based monochrome display that will drive
cursor at a specific line and column position. any monitor with a composite video input. It
Another improvement would be to add provides an inexpensive way to produce a
underline or inverse video for the characters. display for diagnostics, monitoring and
The high bit of the incoming byte can be general visual displays, especially given the
used to indicate when a character is to be low cost of the monitor used for the
displayed in this enhanced mode. The original prototype.
ASCII character set needed only 7 bits, so the
highest bit can be used for special features.
Some word processors of that era used these
features. when available. COMPOSITE VIDEO DISPLAY CALCULATIONS
Although this entire project was based The calculations for the composite video display are given here, should
on displaying ASCII characters, there is no you wish to tinker with alternate clock frequencies or different character
reason you can’t display graphics information generator dimensions:
on the screen. The resolution isn’t very
high, and, as mentioned, adding color would Horizontal blanking plus sync time = 10.9µs
require different hardware. But unlike the
character-based terminals of the 1980s, you Horizontal scan rate = 15,750Hz = 63.5µs period
aren’t locked into displaying characters only.
Since there is no hardware character Live scan time = 63.5µs – 10.9µs = 52.6µs
generator between the RAM and the dot output,
you can display low-resolution graphics just by Dots per line = live scan time × dot clock frequency
filling the memory with the graphics image. In = 52.6µs x 10MHz = 525 for 10MHz, 262 for 5MHz
fact, the first test I did on the system when I
connected it to the LCD was to display a line in Characters per line = dots per line/horiz. dots per char
the middle of every other character position in = 525/7 = 75 for 10MHz, 37 for 5MHz (limited to 35 in FW)
each character row. The result was a display
that had just a series of horizontal dashed lines.
I did this because it was easy to do and didn’t
require any of the character processing routines
For detailed article references and additional resources go to:
to be functional. If you look at the source code,
www.circuitcellar.com/article-materials
you will see that the simple code to do this is
still there, just commented out. The source code
for this project can be downloaded from Circuit RESOURCES
Cellar’s article code and files webpage. Texas Instruments | www.ti.com
12 CIRCUIT CELLAR • MARCH 2020 #356

LoRa-Based Tracking System


SARNet Aids
Search and Rescue
FEATURES

Because every minute counts during


search and rescue operations, technologies
that narrow the search area are always
welcome. Learn how these three Camosun
College students built a LoRa-based
tracking system designed to aid search-
and-rescue teams in locating lost or missing
individuals. Called SARNet, the system can FIGURE 1
narrow down the initial search area and The Bat handheld tracker unit (left), and the
Cricket beacon unit (right)
give technicians a larger searching radius.

By
James Lawton, Callum Munn-Middleton
and Cam Stauffer

G etting lost in the woods while


camping or hiking can be
dangerous, unless you have a
rescue device such as Recco or
Spot. However, the Recco and Spot devices
are expensive and require GPS or specialized
a network of devices similar to the Bat that
are mounted along a trail in a checkpoint
fashion, and give the last known location of
a Cricket. We designed, built and tested the
first two parts of our system, the Bat and the
Cricket (Figure 1). We did not manufacture a
tags. Our SARNet (Search and Rescue Colony setup as part of our project. However,
Network) is a tracking system that will be a Bat module can be easily implemented as a
more affordable, accurate and independent Colony configuration in the future.
of GPS. Implementing LoRa (Long Range)
wireless technology in a new and unique way, LORa
we made a system that can be used to narrow LoRa is short for “Long Range” and is
down a search area for persons requiring an emerging wireless technology that uses
emergency assistance. Once a rescue team extremely low-powered transmitters and
arrives, our system enables a technician to receivers. The radios operate in the Industrial,
reduce the time it takes to find someone who Scientific and Medical frequency bands (ISM).
is lost or in distress. Depending on the country of operation, the
Our project is split into three main parts: assigned frequency is either 430, 433, 868 or
The Cricket, the Bat and the Colony. The Cricket 915MHz [1].
is the active transmitter device that a user LoRa radio uses a Chirp Spread Spectrum
carries while going into the woods or other (CSS) radio modulation technique that is
remote area. The Bat is a handheld tracking similar to FM modulation [2]. LoRa has a
device used to locate a Cricket. The Colony is resilience to noise and low bit error rates,
circuitcellar.com 13

which is critical in today’s world of busy using LoRa communication technology than
airways. Semtech is a large stakeholder in with other methods.
LoRa technology, and it produced the SX1276
radio IC that is integrated into our project. THE CRICKET
Reliability and the ease of implementation The Cricket is a transmitter module that a
with the Internet of Things (IoT) sets LoRa user would purchase or rent before going on a

FEATURES
apart from other radio technologies. LoRa hike or similar outing. We designed the Cricket
setups often involve remote temperature to be as small and light as possible, so the user
monitoring or situations where brief digital can carry it while on the move, without adding
messages are sent. Typically, a LoRa user will much space or weight. Our design closely
connect a device to an IoT service, such as resembles a carabiner in its overall style
The Things Network, to log on and read data and the shape of its enclosure. To be as size-
via the Internet. This setup is called LoRaWAN. and shape-efficient as possible, we carefully
Essentially, a LoRa device can send its data to designed the PCB and all its components to fit
any public LoRa gateway, which then uploads within the shape of the enclosure.
the data to the Internet for viewing. We printed our 3D enclosure with PLA
We decided to experiment with LoRa radio (polylactic acid) filament on a Ultimaker
as the means of communication between our Cura printer. The enclosure is a two-part
devices. After all, using LoRa radio hardware design that snap fits together and has a
and protocol is possible, and is a simple two- removable battery cover. Inside the case is
way link that doesn’t require the Wide Area a custom-printed PCB that is pressure fit in
Network (WAN) aspect of public gateways. to four standoffs, a battery holder for two
That being said, our system implements a AAA batteries and a channel for a whip-style
similar private WAN for the future Colony antenna.
portion of SARNet. We designed our PCB to have a Murata
We ended up using LoRa because it was CMWX1ZZA Type ABZ chip, two LEDs (green
an inexpensive option that allowed us to get a and red), two input buttons, a reset switch,
long-range signal with good penetration, and power switch, programming header and
also because it requires very little power to an RF output port. The LEDs indicate to the
transmit. Also, we chose it for the ability to user if the Cricket is actively transmitting,
sacrifice data rate for added range. Because and double as an indicator for what state the
we send very little data between the Bat and Cricket is in—either Normal, Distress or Alarm
the Cricket, we get a longer maximum distance mode. Refer to Figure 2 for the Cricket's

23)24

#


 (DD(
7 +, 
5 


 +




7
78
79

7
77
7
7
7
7

8
9

)1
7

 5 
6<
6<
6<
6<
6<

6<
0>>?
23?->
?->3> ?
AB>+3=<
AB>+3> ?

/7+,%:
/+,=>
0% ?= 3=<
0 % ?= 3@?5
09% ?= 3=<
0% ?= 3> ?

7
6<

6<
 
6< 0=3+/
9 
6< 08=3+%
 7
/ +03  35+?
 
/ +03 /,: 
 
6< 25@'4 23)24
23)24 7 
23 +0 +?+/'@35+? 9
 
23  0635'

235' 0635' 1
063+-9 3=>

9 8
/ +/5?35-

 7  6< 0635'
0+ =3 >+=
07+ =3 =+>

/ +/5?3?-

///
/7/7/
0+ =3+:
0+ =3<++

8 9 #
063+-9 3=> 6<
  
1 1 )1 063+-9 3=> /<?
  
//
//

+-9 3=>7 6< 8


/8 >

 
063+-9 3=>

063+-9 3=> ) 5'/ 
 
 ,-../0.

7


9
8





7


5 
23)24

23)24 5 
+ + 5 
+,
#  

6 

+  &*
0 C
  57 5
 
FIGURE 2
Cricket schematic, featuring Murata
Type ABZ CMWX1ZZABZ chip

  (;


14 CIRCUIT CELLAR • MARCH 2020 #356

schematic and to Figure 3 for the Cricket PCB. batteries are accessed by removing the rear
We selected a 915MHz, whip-style antenna battery cover (Figure 4).
for its light and flexible characteristics.
To power the Cricket, AAA batteries were CRIKET SOFTWARE
chosen, based on cost, size and capacity. The best way to describe the Cricket’s
With disposable lithium cells, the Cricket functionality is to examine the software
FEATURES

lasts for 16 days in Normal mode, 12 days in that runs on it. We wrote all the Cricket
Distress mode and 4 days in Alarm mode. The programming in the Arduino IDE, using a
LoRa library and board support package that
FIGURE 3
recognizes the Murata chip we used [3].
Cricket PCB, featuring Murata chip,
We programmed three modes of operation:
LEDs and input buttons
Normal, Distress and Alarm. Normal mode
will run by default when the Cricket is
powered on. The device will transmit a check-
in message and blink the green LED every
5 minutes. Distress mode will transmit a
distress message and blink the red LED every
minute. Alarm mode blinks both LEDs three
times for good visibility, and transmits an
alarm message every 10s. Alarm mode is
activated when a Bat is close enough to detect
a Cricket’s chirp. More transmissions help the
Bat narrow in on the Cricket, and having both
LEDs light up indicates to the lost person(s)
that a rescuer with a Bat is nearby, and that
they should make noise or try to alert the
rescuer in some way.
In our application, we didn’t need fast data
rates or high data volume, but we did need long
range. This meant we could change various
settings to sacrifice the data rate and volume to
gain longer range. The LoRa Calculator software
by Semtech was a helpful tool while changing
the LoRa settings. The calculator indicated
that for maximum range, we needed high
spreading factor and low bandwidth [4]. We
set the spreading factor to 12, the bandwidth
to 125kHz and the coding rate to 4. Also, we
set the Murata chips to transmit at the highest
supported power level of 20dBm (100mW).
The actual data we transmit over the LoRa
protocol comprises 5 full bytes in series.
The first byte is an asterisk (*) character,
which serves as a start sequence. The
asterisk prevents the Bat from listening to
LoRa signals that are not transmitted from
SARNet devices. The second and third bytes
are used as a unique ID number to identify
a Cricket device. The fourth and fifth bytes
are used to indicate whether the Cricket is
in Normal, Distress or Alarm mode. LoRa
protocol supports a maximum payload size
of 256 bytes to be transmitted at one time.
Since we are using only 5 bits, we had room
for expansion if a large amount of Cricket IDs
were needed for the system.

FIGURE 4
THE BAT
The back of Cricket, with the battery
The Bat is designed to be taken into the
door open. A power button, reset field once the approximate area of a Cricket
switch and SWD programmer header device has been determined. We liked the idea
are accessible. of a rescue technician using a touchscreen,
circuitcellar.com 15

tablet-style device to close in on a distressed


person. The method of search is not unlike
recreational “fox hunts” by radio amateurs,
in which someone hides a radio transmitting
device and then others attempt to find it in
a hide-and-seek fashion. Special direction-

FEATURES
finding (DF) antennas are implemented to
help the radio amateurs in their search.
Like the radio amateurs, we based our idea
on a direction-finding principle. We combined
an electronic compass module with a scan
of the received Cricket signal amplitude.
With compass and signal-strength data, our
tracking device can plot a signal’s amplitude
and the direction of its location on the screen.
Because the Bat must receive signals
from the Cricket, we tuned the design for
the antenna to 915MHz. An online antenna
calculator tool helped us determine the
antenna’s dimensions [5]. We chose the
moxon-style antenna because of its direction-
finding capability and its wide, cone-like
reception pattern (Figure 5). In our trials, we
tested a front-to-back ratio of about a 10dBm.
Our trial results were useful in our design
FIGURE 5
because the Bat relies on directional-radio 915MHz moxon-style antenna. The coaxial cable is connected to the top copper wire, which is the driven
signal detection. The Bat’s software requires element. Although the antenna appears to be one piece of wire, the bottom portion is the reflector, which is
the user to turn in a circle (360 degrees) while a separate wire. #14 AWG solid core wire is used.
scanning for a Cricket’s signal. The software
indicates the likely direction of the Cricket

Verilog HDL
With the right tools
such as this book,
designing a microprocessor
can be easy.
Okay, maybe not easy, but certainly less
complicated. Monte Dalrymple has taken his
years of experience designing embedded
architecture and microprocessors and compiled
his knowledge into one comprehensive guide to
processor design in the real world.

Monte demonstrates
how Verilog hardware
description language
(HDL) enables you
to depict, simulate,
and synthesize an
electronic design so
you can reduce your
workload and increase
productivity.
www. EarthLCD.com/cc1

cc-webshop.com 949.248.2333

25 Years Embedded Display Experience


16 CIRCUIT CELLAR • MARCH 2020 #356

by displaying the direction that returned the


highest signal amplitude.
The Bat handheld tracking device combines
several assemblies into one. Like the Cricket,
the Bat houses its components in a 3D-printed
case. Our team used Fusion 360 to create all
FEATURES

the enclosure components. The dimensions


were based on the Raspberry Pi foundation
7” touchscreen, while including enough depth
for the rest of the components.
We wanted the Bat enclosure to be
comfortable to hold, so we modelled it to
have ergonomic, controller-like grips. Fitting
all our components inside and keeping our
wiring neat proved to be a challenge. Inside
the case is a Raspberry Pi 3, a Raspberry Pi
foundation touchscreen, a custom Bat PCB,
Arduino Nano, Adafruit LSM303DLHC compass
module and a Ravpower 26,800mA-hour
power bank (Figure 6). The moxon directional
antenna is mounted on the exterior of the
case. After some careful wiring and strategic
component placement, we were able to fit the
Bat together with all the components inside.
We needed the main processing power to
come from Raspberry Pi, so we picked the
FIGURE 6 Raspberry Pi 3 for its lower power consumption
The Bat shown with the screen removed. The back of the screen holds the Raspberry Pi with Bat PCB HAT and cost, compared to the Raspberry Pi 4.
and the Arduino Nano. In the bottom half of the enclosure is the Ravpower bank, power switch and Adafruit The touchscreen was ideal, because it had full
LSM303DLHC compass module.
software driver support in Raspbian, and the
touch functionality works out of the box. Also,
we used the several mounting holes on the
ABOUT THE AUTHORS screen to attach the Raspberry Pi and keep
Cameron Stauffer everything in the case secure.
accumulated various To receive radio signals from the Cricket,
we designed a custom PCB in a HAT (Hardware
employment experience
Attached on Top) form for mounting on the
in the retail, funeral and
Raspberry Pi (Figure 7). With this design,
oil and gas industries,
our Bat circuit board is powered directly by
before choosing to
the Raspberry Pi’s 3.3V and ground pins. The
pursue a diploma in Bat’s PCB has the same Murata chip for radio
Electronics and Computer Team SARNet : James Lawton (left), Cam Stauffer (center), reception as does the Cricket, and a coaxial
Engineering Technology Callum Munn-Middleton (right) cable connects the U.FL connector to the
at Camosun College. His moxon antenna. Figure 8 shows the Bat's PCB
curiosity for physics and schematic.
mathematics, and passion for electronics influenced his decision to return Finally, we power all these devices using
to school after 5 years in the workforce. Cameron plans on completing the a Ravpower 26,800mA-hour power bank. The
Electronics and Computer Engineering Bridge program, and pursuing a power bank is capable of running the Bat
bachelor's degree in engineering at the University of Victoria in Canada. for at least 8 hours. We chose the Ravpower
for its high capacity and ability to deliver up
to 2.4A of continuous current at 5V. The 7"
Callum Munn-Middleton has always had a passion for electronics, which
touchscreen draws up to 500mA, the Arduino
drove him to enroll and now graduate from the Electronics and Computer Nano consumes a miniscule 20mA and the
Engineering Technology program at Camosun College. He plans to do the Pi 3 draws a maximum of about 1,500mA. The
Bridge program at Camosun this year, which will then allow him to continue power bank can be conveniently charged via
his engineering studies at the University of Victoria. a micro USB port, accessed on the side of the
enclosure. Refer to Figure 9 for a functional
James Lawton worked in the electrical trade for 8 years before returning block diagram of the Bat and Cricket.
to school to study electronics. He has graduated from the Electronics and
Computer Engineering Technology program at Camosun, and he plans to
BAT SOFTWARE
We controlled many different components
pursue a career in marine electronics systems.
from the one Raspberry Pi. Because of
circuitcellar.com 17

the variety of hardware, we had multiple


programs made to run the functions for each
of the components. We wrote a program for
receiving packets and RSSI from the Crickets,
calculating a heading for the compass
module, and a main GUI program for the

FEATURES
Bat’s user. We developed the Bat’s Type ABZ
chip software using the Arduino IDE, just like
the Cricket. The chip’s software includes the
board support packages and LoRa libraries we
used for the Cricket, since both devices have
the Murata chip.
The purpose of the Bat chip’s program is
to listen continually for any LoRa messages
transmitted by the Cricket. Once it detects a FIGURE 7
message, the messages are parsed and the Bat PCB with LSM303 compass module. The compass module was originally mounted on this PCB before the
information inside each message is recorded. final design utilizing Arduino.
The messages contain the Cricket ID number
and operating mode, and the received signal
strength indicator (RSSI) value. The ABZ chip level to get an accurate heading. The compass
sends these values to the Raspberry Pi via the heading is then transferred from the Arduino
I 2C bus. If the message received is from the to the Pi over a USB serial connection.
Cricket being tracked, the Bat’s chip will send We programmed our own GUI to clearly
a signal back to the Cricket to trigger it to display all the information collected from the
go into Alarm mode. To orient the Bat’s user Bat PCB and the compass module. The main
toward the source of the Cricket’s signal, we screen has basic instructions on how to use
implemented an Adafruit LSM303 compass the Bat, and navigation buttons to access
module. To interface with the compass, we other screens with different features. Our
use an Arduino Nano connected to it over the GUI program reads files that have continually
I 2C bus. updated compass, Cricket ID and RSSI
An example program written by Adafruit information in them. By reading the data files,
polls the compass module continually, current data are always available for access
retrieving acceleration X Y Z and magnetometer by any of the graphical features of the Bat.
X Y Z values, which gives us a heading from We wrote all the code that runs on the
0 to 360 degrees. Using both accelerometer Raspberry Pi in Python and mostly use
and magnetometer readings means that the tkinter and PyQT modules. We adapted
compass direction is tilt compensated, so and modified a handy graphical compass
the user does not have to hold the Bat unit program from an existing Python widget [6].

34*35

#


 (CC(
 ,- 
7 


 ,




>
)
6







>
)
6

*2


 7 
34*35
:;
:;
:;
:;
:;

:;
1==?
34?.=
?.=4= ?
AB=,4<;
AB=,4= ?

0,-%8
0,-<=
1% ?< 4<;
1 % ?< 4@?7
16% ?< 4<;
1% ?< 4= ?

 #
:;
  
:;
   
:; 1><4,0
6  
:; 1)<4,%
  6 )
& EC 0 ,14  47,?
  > 
7  D  0 ,14 0-8 
 
:; 37@'5 34*35
34*35   7  D 
34 ,1 ,?,0'@47,? 6 < E  
 
34  1:47'
>
347' 1:47' 2
1:4,.6 4<=

6 )
0 ,07?47.

   :; 1:47'
1, <4 =,<
1, <4 <,=

0> ,07?4?.

000
000
1, <4,8
1, <4;,,

) 6
>
1:4,.6 4<= :;
 
# FIGURE 8
2 2 *2 1:4,.6 4<= 0;?
  
Bat schematic diagram. The
00
00

,.6 4<= :; )


0) =

 34*35 
1:4,.6 4<=

1:4,.6 4<= * 7'0 
circuit is similar to that of the
  Cricket, except there are no
 -.//01/
LEDs or switches. There are




6
)
>







     6 )
also lines for an I2C connection
#
with the compass module, as
originally planned.
18 CIRCUIT CELLAR • MARCH 2020 #356

THE COLONY
BAT Bat The Colony aspect of the project was
PCB designed, but not implemented, because
915MHz LoRa 3.3V
CRICKET
TX ⁄ RX
we did not have the time to increase the
AAA cell Cricket 915MHz LoRa
scope of our project. However, the Bat and
Murata
×2 PCB TX ⁄ RX type Cricket working successfully is enough to
FEATURES

+3V +5V +3.3V ABZ demonstrate that a Colony setup is feasible,


Murata Raspberry I2C-1 since a Colony is essentially a set of mounted
type
+5V
Pi 3 Bus Bat-like devices. We developed the Cricket
ABZ I2C-0 USB 5V ⁄ serial data code to be able to communicate with a Colony
Bus
RavPower
+5V Arduino setup if it were implemented. Alternately,
Nano
26800mAh Raspberry Pi we could program the Cricket devices to
USB Foundation 7" 3.3V⁄ I2C communicate with commercial, off-the-shelf
Power touchscreen
Button 1 Red LED bank Adafruit LoRa gateways.
Button 2 Green LED
LSM303DLHC The Colony would be mounted along trails
Compass ⁄ or in parks in a checkpoint configuration. In
Accel a checkpoint configuration, when a Cricket
sends out its chirp, it can be picked up by
FIGURE 9 any section of the Colony, at which time the
Final block diagram for Cricket and Bat Cricket’s location is recorded and saved.
Moving forward, the rescue team will look up
the last known location of the Cricket, based
The compass graphic is updated continually on the last section of the Colony that picked
with heading data received from the Arduino. up the device’s signal. The Colony’s data
We implemented a sweep feature that identify a focused initial search area, to which
live updates and plots the strength of the a rescue team with a Bat can be deployed.
signal received as the user turns slowly in a
360-degree circle. The pointer in the graphic TRIALS
will grow or shrink corresponding to an We conducted several trials to ensure that
increase or decrease in signal strength. The LoRa was a feasible technology to use in our
direction that resulted in the pointer having application. At the start of the project, we
the highest amplitude indicates the general used Heltec LoRa 32 (V1) boards with included
direction toward the source of the Cricket’s monopole antennas, to test maximum signal
signal (Figure 10). ranges. Both the Heltec devices and the
Finally, we do not want the user to have Murata chips we selected use the Semtech
to launch all these complicated programs SX1276 radio ICs. Therefore, we concluded
individually when the Raspberry Pi starts up. the Heltec board would accurately reflect the
To avoid this problem, we took advantage of performance we could expect with the devices
Linux’s bash script functionality, letting us we planned to develop.
have all scripts launch together as soon as the We started our testing at Camosun College,
Raspberry Pi boots up. Because of the bash and found that the units could communicate
script, the Bat is ready for use when the user easily at 250 meters. Building on this success,
turns on the power. we tested again in Mount Doug, a densely
forested park, and found we still had reception
up to 600 meters away with minimal packet
For detailed article references and additional resources go to: loss.
www.circuitcellar.com/article-materials After we had fully developed the Bat and
Cricket, we conducted more testing to observe
References [1] through [6] as marked in the article can be found there. the results of our calibrated hardware. In
a wide-open area with no obstructions, we
RESOURCES successfully detected the Cricket up to 1,800
meters away from the Bat. In a more densely
Adafruit | www.adafruit.com
forested area, we were able to achieve up
Heltec | www.heltec.org to 800 meters detection range. With more
resources and better equipment, we could
Murata | www.murata.com further expand on the performance of our
Raspberry Pi Foundation | www.raspberrypi.org technology.
Our group had to confirm that a person
Ravpower | www.ravpower.com out of sight with a Cricket device could be
located with the Bat. We did this in the most
Semtech | www.semtech.com
reasonable way possible—with a game of
Ultimaker | www.ultimaker.com hide and seek. A group member hid outdoors,
circuitcellar.com 19

with a Cricket device transmitting in distress


mode, and another team member with the Bat
attempted track the person down. Every hide-
and-seek test was successful, and proved that
the Bat can effectively track down Crickets in
a wilderness setting.

FEATURES
CONCLUSION
Our goal was to use LoRa radio technology
in a new and exciting way. The SARNet rescue
system is a departure from the typical IoT
usage for LoRa. We hope using LoRa in this
way will help to pioneer future LoRa-based
professional safety systems. In the end, we
produced a working proof of concept for
SARNet. We successfully use LoRa as a radio
location technology, by combining the power
of Raspberry Pi, Arduino and the Murata chips
on our self-made PCBs. FIGURE 10
The Cricket works as a compact design, Bat handheld GUI. The left area is for selecting functions and settings, the top right is the compass indicator,
and the bottom right gives amplitude and direction of detected Crickets. The length of the red line represents
while retaining long battery life, and the Bat
amplitude.
functions as planned, despite the complexity
and number of components involved. Our
team was surprised that the range exceeded printing. Above all, SARNet showcases much
1.8km in clear conditions, and we are proud of of what we have learned over the past 3 years,
how well the Cricket and Bat devices worked along with our group’s creativity and
together. teamwork skills. We completed all the
Our project is an excellent engineering objectives we set out at the beginning of the
exercise for embedded and GUI programming, term, and collectively agree that our capstone
Linux systems, PCB design, RF design and 3D project was a complete success.

IT’S HERE...
The NEW
PicoScope ®

6000E Series A SMARTER SCOPE


FOR FASTER DEBUG

More Deeper Higher Smarter Better Most


8 analog + 16 digital Up to 4 GS 500 MHz bandwidth in 8/10/12-bit FlexRes® Multi-channel probe 21 serial protocol
channels (MSO) memory an 8-channel PicoScope architecture holder system decoders as standard

Visit www.picotech.com/A488 to discover MORE


20 CIRCUIT CELLAR • MARCH 2020 #356

Periodic Table Desktop Trainer


Built Using PIC16 MCU
FEATURES

The year 2019 marked the 150th anniversary of the periodic


table. As a tribute, Dev built a desktop accessory that helps
students learn the chemical symbols and the order of the
chemical elements in the periodic table. The circuit is based on
a Microchip PIC16 MCU, and it continually runs when powered
by a commonly available 5V charger, or intermittently with a
long-lived battery supply.

By
Devlin Gualtieri

T he United Nations proclaimed 2019


to be the International Year of the
Periodic Table of Chemical Elements
(IYPT2019). In 1869, Russian
chemist, Dmitri Mendeleev (1834-1907), first
organized all the chemical elements known
promethium, polonium, astatine, francium,
actinium, protactinium, neptunium and
plutonium. There are other elements—those
of atomic number 95 and greater—that have
such a short lifetime that they are not found
in nature and are only obtained through
at that time into a table based on atomic synthesis.
weight. In this effort, he built on the earlier Each chemical element is represented by
work of many other chemists, notably Antoine a one- or two-letter symbol in the Periodic
Lavoisier (1743-1794), Humphry Davy (1778- table. When you scan these symbols, most
1829), John Dalton (1766-1844) and Jacob of them make sense, like “O” for oxygen,
Berzelius (1779-1848). The table revealed “Al” for aluminum and “Ne” for neon. Mixed
regularity in the properties of the elements, among these are some “oddball” chemical
so it’s now known as the Periodic Table. elements whose symbols don’t match their
Some of the elements of small atomic English names. That’s because their symbols
number—such as iron, copper and zinc— derive from their names in other languages
have been known since antiquity. Some other (Figure 1).
elements are bound together in minerals, The symbol Na for sodium derives from
and they were only isolated after chemistry the Latin word for salt which is natrium. Latin
was sufficiently developed. The gaseous provides other symbols, such as potassium
elements, invisible as they are, were likewise (K, kalium, from the word for potash), iron
difficult to identify. Other naturally occurring (Fe, ferrum), silver (Ag, argentum), tin (Sn,
elements were first known only after their stannum), antimony (Sb, from the name of its
synthesis in nuclear reactions. These are mineral, stibium), gold (Au, aurum), mercury
(Hg, hydrargyrum, for silver water) and lead
(Pb, plumbum). The symbol for tungsten, W,
11 19 26 47 50 51 74 79 80 82 comes from the German name of its mineral:
Na K Fe Ag Sn Sb W Au Hg Pb wolframite.
Presently, 118 chemical elements are
FIGURE 1 known. The 118th element, oganesson, was
These are the “oddball elements” of the periodic table, at least for English speakers. Their symbols derive first synthesized in 2002 at a nuclear research
from their names in Latin and German. facility near Moscow, and it’s named after
circuitcellar.com 21

Russian nuclear physicist, Yuri Oganessian. FIGURE 2


The Periodic Table Desktop Trainer,
Oganesson is in Group 18 of the periodic
showing the symbol for bismuth, the
table, and it completes the 7th period. A
element with atomic number 83. The
consequence of this is that the next element, push button at the top allows display
119, with the temporary name “ununennium,” of one element at a time, when
Latin for a hundred and nineteen, will be battery powered.

FEATURES
difficult to synthesize. As a consequence, we’ll
have 118 chemical elements for quite a while.

DEVICE OVERVIEW
My desktop circuit (Figure 2) operates in
several modes. It will display the symbols for
all 118 chemical elements, either sequentially
or in random order. In the sequential mode,
it displays the symbols in order of atomic
number, from hydrogen (H) to oganesson
(Og). In the random mode, it first displays CIRCUITRY
the atomic number, and then the symbol. The characters are displayed on two 8×8
This latter mode is useful for learning the LED matrix displays that have a total of 128
association of the atomic number and symbol. LEDs. The LED matrix displays used were
It could also serve as the basis for a periodic Luckylight KWM-R30881CPGB, which are
table memory game. available from a variety of sources. These
The device can be powered from a 5V have the LED cathodes connected to the rows.
charger. The current demand is surprisingly In each display, the LEDs are wired in a
low—10 to 12mA—because the matrix display matrix of eight columns and eight rows, with
LEDs are very efficient. As a consequence, the LED cathodes connected to the row lines.
nearly any 5V charger can be used as a power If you happen to have displays in which the
supply. There’s provision for intermittent anodes are connected to the row lines, you can
operation in either sequential or random use the hardware without change and invert
mode by pushing a button, and this is a useful some values in the microcontroller (MCU)
mode when using battery power. source code. The LEDs are multiplexed for
In my device, I incorporated a battery display by supplying the proper 16 data bits
holder for three AA batteries. These have for each row to the column lines, and cycling
enough voltage to power the PIC and display. through the rows. Since there are 16 columns
Since alkaline AA batteries have a capacity and 8 rows, we need 24 I/O pins to drive the
of about 2,000mA-hours, this means that display. Additionally, we need two data lines
theoretically, the battery supply should as an interface for an I 2C serial EEPROM that
operate the device continually for 200 hours, contains the character set (that I’ll described
or about 100,000 push-button cycles. shortly) and a mode switch.
I used a 40-pin MCU, the Microchip

$
  $
1
!
  ./ # %
;  )0
#,+ %
3 
  
1)
./ . .
 1
211 6 73. &:3:  
 ;
39>? 3--2 &3:!

39>? 3--2 -2 3: 1) 1)
./ 1   
39>? 3--2 -23:1 . -
!  
39>?! 3- -2 & 3: > -
! !
3-184, -23: +7 -
 1 1
39>? 3- -21 -23: +- .++

1) 39>? 3=3-2 ,283:
;   11 !
39>?1 3=>3-2! + 3 97?
 ; 
39>? 3=+-2 + !3! 97?
  
9+74,2 + 3 97? 
1  
9+749 8 + 131 97?!
  ! 
97?; 389+9 3<3 97?1
 !  
 97?1 389+, 8<3! 97?!
97?
 
3  +93
1 
97? FIGURE 3
   
97?
 ;
3 +4 +,31
 
97? Microcontroller circuitry for the
97? 3 +  + 3 97?
97?
 
3 +  + 3
 
97? Periodic Table Desktop Trainer. To
.++ .++ enable a low current sleep mode for
  ,!'-
battery longevity, the serial EEPROM is
powered by one of the PIC I/O pins.
The current drain in sleep mode is just
200nA.
22 CIRCUIT CELLAR • MARCH 2020 #356

Technology PIC16F877A [1], to accommodateexternal 4.7kΩ resistor and 22pF capacitor.


This gives a clock frequency of about 4MHz,
all this I/O. The PIC also has pins available for
in-circuit serial programming, which madewhich is the upper limit for the internal
oscillator. The actual operating frequency can
for easier development. The circuitry around
the PIC MCU is shown in Figure 3, and thebe checked at pin 14, which outputs a signal
at one-quarter the clock frequency. The 100Ω
connections for the LED matrix displays are
FEATURES

given in Figure 4. current-limiting resistors at the pins that drive


the LED columns provide a bright display, and
Since precision timekeeping isn’t required,
the actual brightness is set by a pulse-width
the clock for the PIC is provided by its internal
modulation (PWM) in the source code.
RC oscillator, with the frequency set by an
The character set is contained in a Microchip
24C256 serial EEPROM, whose data are accessed
using I2C SDA and SCL signal lines. The required
1/0

1/

1/

1/!

1/

1/

1/ 

1/0

1/

1/

1/!

1/

1/

1/ 
1/

1/
storage for the character set is slightly less
than 2KB. The 256KB capacity of this EEPROM
 )  !   !  )  !   !
/  ) !  0 /     )  ! is certainly overkill in this application, but it’s
hard to source less dense serial EEPROMs. Since
1/ 
23/ 
we want to minimize battery drain in the MCU’s
sleep mode, this serial EEPROM is powered by
23/ )
1/0 )
one of the PIC I/O pins. The pull-up resistors
1/ 0
23/ 0
for the mode pins are powered by the same
I/O pin.
1/ 
23/) 
There are quite a few connections from the
PIC pins to the LED matrix displays, and many
23/
1/  
of the signal line conductors need to cross
1/ 
23/!  each other. Figure 5 shows the component
side view of the main circuit board. While
1/ 
23/ 
this is easily done in a multi-layer PCB, I use
boards with a single copper plane that I etch
23/0
1/)
for my own circuits. To simplify construction,
   
I mounted the LED matrix displays on a
daughter board that plugs into the MCU
FIGURE 4 board. The daughter board still requires a
Connections for the LED matrix displays. The displays used are Luckylight KWM-R30881CPGB, which are
few jumper wires to route the display signals.
available from a variety of sources. Other LED matrix displays can be used, but the pin-outs may differ from
Figure 6 shows the front and bottom views
those shown here. These displays have the LED cathodes connected to the row lines.
of the final assembly, showing the daughter
board placement before insertion into the
plastic case.
The Periodic Table Trainer operates in
several modes that are selected by the logic
 (.
signals present on the connections to PIC pin-
37 (RB4) and pin-38 (RB5). These are set at
&'() -
a logical “1” by the two 100kΩ resistors, and
they are set ,+
to a logical “0” by connection
to ground by switches. When B4 is at zero,
the device operates in a single-shot mode, in
  !" #$%&'()* +#,+% which one element is shown after each reset.
When B4 is a one, the device continually
shows elements. If B5 is at zero, a random
element is displayed each time, and when B5
is a one, the elements are displayed in the
order of their atomic number. In that case,
the displayed element is stored in the PIC
non-volatile memory so that the order is
preserved between button presses in single-
shot mode.

CHARACTER SET
I originally wanted to use 16-segment
FIGURE 5
alphanumeric displays, but these weren’t
Component-side view of the main circuit board for the Periodic Table Trainer. The header for in-circuit serial
programming is at the top left with the mode connections nearby. Also seen are the three, eight-position
available in the desired large size. The 8×8 LED
single inline sockets that connect to the daughter board that hosts the LED matrix displays. matrix displays were a good second choice.
circuitcellar.com 23

The next problem was that I needed


character set data for the chemical element
symbols and the atomic numbers from
1-118. I designed my own, based on a 5×7
character set, but I included some aesthetic
enhancements. One was to have the five

FEATURES
lowercase “dangler” characters—g, j, p, q
and y—drop below the baseline of the leading
uppercase characters. While no chemical
elements have symbols that require either
uppercase or lowercase j or q, I included
these for completeness.
The symbols for the chemical elements are
one or two characters, and these are easily
displayed on two, side-by-side 8×8 matrix
displays. However, the atomic numbers can
be as large as 118. While you might initially
think that we need three matrix displays
to accommodate the atomic numbers, the
leftmost digit is the slender character one.
I was therefore able to squeeze all the
necessary numbers into two matrix displays
in my character set. The row data are stored
as sequential bytes in the serial EEPROM.
Figure 7 shows how.

EEPROM PROGRAMMING
Integrated circuit (IC) technology has
advanced considerably since the late 1970s,
when I built my first home computers. At
that time, erasable read-only memory chips
had just a few kilobytes of data space,
and they were erased only by exposure to
intense ultraviolet light. The IC packages had
windows that allowed the ultraviolet light to
penetrate the silicon chips and erase them by
FIGURE 6
recombining the electrons and holes in the
Front (above) and bottom (below) views of the final assembly, showing the daughter board placement before
memory capacitors (Figure 8). Today, read-
insertion into the plastic case. A few of the jumper wires on the daughter board that translate the interface
only memory chips have memory space that pins to the proper matrix display pins can be seen. Some of these jumpers are hidden beneath the displays.
is orders of magnitude greater, they’re erased The symbol for silver, Ag, is shown on the top-view photo. The bottom-view photo shows how the daughter
by a quantum tunneling effect and they’re board plugs into the microcontroller board, and how the LED matrix displays plug into the daughter board.
called “electrically erasable programmable Single-row inline sockets are used for the connections.
read-only memories” (EEPROM).
Several years ago, the 24C08 was a
popular EEPROM for MCU circuits because
it was serially alterable by an I 2C interface.
This device contained 8KB of memory, which
was usually sufficient for most applications.
Today, this device has been superseded by the
24C256, a plug-compatible device with 256KB
of memory. Not surprisingly, the 24C256
chips are available at a lower price than that
of the 24C08, so I could hardly complain when
I used this chip to store my 2KB character set.
The character set initially needs to be
loaded into the serial EEPROM. There are
many choices for purchase of a device
programmer, but, if you just need to program
a device for the Periodic Table Trainer, that’s
an unnecessary expense. One of my many FIGURE 7
Raspberry Pi computer boards solved that Character set coding to hexadecimal numbers in the serial EEPROM. The character set is a modified 5x7
problem, because these boards have an character set in which the lower-case “dangler” characters rise from the lowest row.
24 CIRCUIT CELLAR • MARCH 2020 #356

integrated I 2C interface. The circuit shown


in Figure 9 allows connection of the serial
EEPROM to the Raspberry Pi I/O header. It’s
so simple that I built mine using point-to-
point wiring on a prototyping circuit board,
but I’ve included a circuit board layout in the
FEATURES

online repository.
The I 2C is not activated by default on the
Raspberry Pi, but it’s a simple procedure
to do that using the raspi-config program
in the Raspbian operating system. Run the
configuration program by typing the following
in a command line:

sudo raspi-config

Then, at Interfacing Options, enable I 2C,


FIGURE 8
select <Finish> and then reboot. After reboot,
Evolution of read-only memory. The earlier packages had a window that allowed memory erasure by an
you can verify that the I 2C system is active by
ultraviolet light. Left to right, two examples of 2k×8 parallel interface chips from 1979 and the 256k×8 I2C
this command:
serial EEPROM used in the circuit.

ls /dev/*i2c*
FIGURE 9
Using a Raspberry Pi to program an
The Raspberry Pi will respond by indicating
EEPROM memory chip. Fortunately,
the 24CX chips will operate from a 3.3V (    that the user I 2C system, i2c-1, is active.
supply, so we can steal voltage from
the Raspberry Pi I/O header pins. The 4  5
/dev/i2c-1
Raspberry Pi has I2C interface pins
67 

that make programming possible by One command-line utility you should


- 
software (see main text). 
1
2
0
0
 install for debugging is i2c-tools. This is
installed with the following command:

+3 0
 ,
+0 1++

,- ,
,) ,)
sudo apt-get install -y i2c-tools

In particular, i2c-tools will probe the


entire I 2C address space to report what
devices are connected. When the serial
EEPROM is connected, you will see the display
ABOUT THE AUTHOR
shown in Figure 10, which indicates that
Dev Gualtieri received his Ph.D. in Solid State Science there is a device at hex address 0x50, after
and Technology from Syracuse University in 1974. entering the following command:
He had a 30-year career in research and technology
at a major aerospace company, and is now retired. i2cdetect -y 1
Dr. Gualtieri writes a science and technology blog at
www.tikalon.com/blog/blog.php. He is the author of The 0x50 address is a consequence of the
three science fiction novels, and books about science upper 4 bits of this EEPROM being logically set
and math. See www.tikalonpress.com for details. at 0101 inside the integrated circuit. When
combined
    with the three lower address bits set
'/
at a logical “0” by grounding the address pins,
For detailed article references and additional resources go to:
%
we get an &'
address (
of 0101000, which .
is 0x50.
Although the user I 2C interface of the
www.circuitcellar.com/article-materials +* 
Raspberry Pi is accessible from several
References [1] through [3] as marked in the article can be found there.
available programming languages, I’ve found
       !  "#$% &' () *"+* $that the easiest of these is Python. However,
some things are more easily done using one
RESOURCES of my favorite languages, PHP, so I’ve written
Luckylight | www.luckylight.cn a program in PHP that writes the character
set data into a text file, which is read by a
ME Labs | www.melabs.com
Python program that programs the serial
Microchip Technology | www.microchip.com EEPROM through the I 2C interface. Source
code for these programs is included on Circuit
Raspberry Pi Foundation | www.raspberrypi.org Cellar’s article code & files webpage, and the
circuitcellar.com 25

text file of the character set is included so


that it isn’t necessary to run the PHP program 0 1 2 3 4 5 6 7 8 9 a b c d e f
if the character set is unmodified. From the 00 : – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
same directory that includes the file named 10 : – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
elements_hexfile.txt, run the following to
20 : – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
program the serial EEPROM:
30 : – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –

FEATURES
python i2c_programmer.py 40 : – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
50 : 50 – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
60 : – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – – –
CIRCUIT VARIANTS
As with all my PIC projects, I wrote the 70 : – – – – – – – – – – – – – – – –
firmware using the PICBasic Professional
compiler from ME Labs [2]. Because I use FIGURE 10
Linux exclusively, I run an older version of this When the serial EEPROM is connected, you will see this display, which indicates that there is a device at hex
compiler and its associated programmer on a address 0x50, after entering the command: i2cdetect -y 1

very old Windows operating system installed


as a virtual machine. The folder on Circuit
Cellar’s article code and files webpage for this component that might be hard to source in
article include a compiled hex file, to program the future, so I didn’t use these in my design.
a PIC without needing a compiler. It would If you are able to buy these, you can still use
be easy enough to rewrite the source code in the character set in the serial EEPROM, and
C so other compilers can be used, including there would be a considerable simplification
the free MPLAB C compiler [3] from Microchip of the circuit. A smaller PIC can be used, since
Technology, manufacturer of the PIC MCUs. much of the complexity is off-loaded to these
At the time of writing this article, it’s I 2C display subsystems, and I’m sure that
possible to buy 8×8 LED matrix display Arduino fans would have no trouble building
subsystems with an I 2C bus interface. I avoid and programming a device using these
publishing circuits that utilize a particular displays.

www.easyOEM.com
email: sales@easyoem.com
Toll-free: +1(866)66-EZOEM

One-stop Electronics Manufacturing Service


-PCB Fabrication
-BOM Kitting
-Assembly New Product 50% OFF!
(for first order up to $1,000)

-Testing
We do much more...
-Design Checking -PCB Coating -MCU/CPLD/FLASH/EEPROM Programming
-Wiring Harness Assembly -Injection molding
-Printing -Labeling -Packaging -Certification
-Stocking -Distribution -Shipping -Customs Declaration
“Just focus on your design. We do the rest for you!”
26 CIRCUIT CELLAR • MARCH 2020 #356

A Deep Dive Into LPWAN


IoT Sensor Connectivity
FEATURES

There are several technology options for connecting


widely distributed IoT sensors. But system developers
face challenges with the range and power of many of
today’s wireless networking options. In this article,
BehrTech’s Wolfgang Thieme does a deep dive on Low
Power Wide Area Networks (LPWAN), explaining how
the technology solves many of those design dilemmas.

By Wolfgang Thieme,
Chief Product Officer, BehrTech

A s the global IoT connections


exponentially grow to 22 billion
in 2025 (IoT Analytics), Low
Power Wide Area Networks
(LPWAN) [1] are expected to be a prominent
facilitator. The central value of IoT is the
LPWANs are unique in that they overcome
these pitfalls to deliver an efficient, affordable
and easy-to-deploy solution for massive-
scale IoT networks. They are ideal for low-
bandwidth applications with small payloads,
such as environmental monitoring, asset
unprecedented visibility into physical assets, and facility management, worker safety and
processes and people to enable informed smart metering.
decision making. Often times, this visibility
comes from granular, battery-powered IoT KEY QUALITIES OF LPWAN
sensors distributed over large, structurally LPWANs employ a star topology in which
dense campuses like factories, mine sites, oil a base station collects data from numerous
fields or commercial buildings. remote, distributed end nodes. With the
Legacy wireless technologies can’t keep up exception of cellular LPWAN (such as NB-
with the range, power and cost requirements IoT), the connection between end nodes and
in smart sensor networks. Traditional the base station is non-TCP/IP to avoid hefty
cellular connectivity (for example 3G, LTE…) packet headers (Figure 1). After receiving
and wireless local area networks (such as and demodulating messages, the base station
Wi-Fi) are too expensive and power hungry then relays them to the backend server
for transmitting small amounts of data from through a standard TCP/IP backhaul link
a large number of sensor devices. Other (for example Ethernet, cellular…). For public
solutions such as Bluetooth, Zigbee, Z-Wave LPWAN services, data must be routed through
have highly constrained physical range. And the network operators’ server before reaching
even though many of them employ a mesh the end user’s applications, while in privately
topology to extend their coverage, the multi- managed LPWANs, data can be directly
hop relaying nature is power-consuming transferred to the user’s preferred backend
while entailing complex network planning for complete data privacy and control.
and management. As such, mesh networks The appeal of LPWANs exist within their
are suitable for medium-range applications two signature features that used to come
at best. as a trade-off in traditional technologies:
circuitcellar.com 27

FIGURE 1
LPWAN architecture

FEATURES
long range and low power consumption downlink message.
(Figure 2). While Wi-Fi and Bluetooth can only Second, though not all, many LPWAN
communicate over tens or a hundred meters technologies employ a lightweight
at best, LPWANs are able to transmit signals asynchronous protocol at the Medium Access
up to 15km in rural areas and up to 5km in Control layer to minimize data overhead.
urban, structurally dense areas. This wireless Pure ALOHA—a very simple random-access
family also provides deep penetration protocol—is a common choice. In pure ALOHA,
capability to connect devices at hard-to-reach a node accesses the channel and transmits
indoor and underground locations. On top of a message whenever data is available.
that, it comes with a simple, small-footprint There is no time-slotted coordination or
transceiver designed to minimize cost and carrier sensing, and even acknowledgment
power consumption on the end node side. of received messages is often bypassed to
The idea is to leave all the heavy-lifting to the further reduce the power footprint.
base station and keep the data frame as short Finally, the one-hop star topology
as possible. introduces great power benefits. While
Long Range: Range is often measured certain mesh solutions (for example, Zigbee
in terms of receiver sensitivity—the lowest or WirelessHART) have been previously
signal power for a message to be detected implemented for battery-operated, industrial
and demodulated. In LPWANs, receiver sensor networks, they consume more
sensitivity can reach -130dBm, as compared power than an LPWAN solution by orders of
to a moderate -70dBm sensitivity in Bluetooth. magnitude. This is because, in a multi-hop
This high receiver sensitivity is typically mesh topology, a device must spend extra
achieved by reducing the signal bandwidth energy on listening for and relaying messages
and thus experienced noise levels (such as from other devices. On the other hand, a star
(Ultra-)Narrow Band) or adding processing network allows devices to “turn off” and stay
gain (like Spread Spectrum)—both come at most of the time in sleep mode (Figure 3).
the cost of lower data rates. All that said, power efficiency can drastically
Besides these special modulation vary among LPWAN technologies. This is
techniques, the use of sub-GHz frequency
bands in most LPWAN solutions, instead of the
popular 2.4GHz band, further improves range
and penetration capability. As the wavelength
is inversely proportional to free space path
loss, the long radio waves in sub-GHz systems
can travel over kilometers in open areas.
Compared to 2.4GHz signals, they can also
better penetrate through walls, trees and
other structures along the propagation path,
while bending farther around solid obstacles.
Low Power: LPWAN systems adopt multiple
approaches to optimize power efficiency,
securing many years of battery life on end
nodes. First, outside the transmission time,
the transceivers are put into deep “sleep”
mode whereby very minimal power is
consumed. In bi-directional communications,
a listening schedule is defined so that the
device is “awake” only at predefined times or FIGURE 2
shortly after an uplink is sent to receive the Wireless IoT landscape
28 CIRCUIT CELLAR • MARCH 2020 #356

As mentioned earlier, the lightweight


asynchronous protocol at the MAC layer is
widely used in LPWAN for its power advantage.
Nevertheless, when multiple radio systems co-
exist and share the same spectrum resource,
uncoordinated transmissions in asynchronous
FEATURES

networks significantly increase the risks of


packet collisions and data loss.
Mitigation mechanisms like Listen-before-
Talk, handshaking and acknowledgment
to ensure QoS inevitably come with heavy
overheads or frequent signaling, which means
more power consumption. As wireless IoT
deployments and radio traffic exponentially
FIGURE 3
Mesh vs Star topology
grow, warranting network reliability and
scalability while optimizing battery life will
be a major undertaking in many LPWAN
because transmission time or on-air radio technologies.
time of each message is very different across Standardization is another important
systems, and transmission is technically the consideration, given its critical role in enabling
most energy-consuming activity. Short on-air a robust and vibrant IoT ecosystem. A
time means that the transceiver can turn off standardized technology provides a rigorous
faster to further reduce power consumption. and transparent technical framework to fuel
both vertical and horizontal interoperability. So
CURRENT LPWAN LANDSCAPE far, there have been only two camps of LPWAN
The LPWAN landscape can be confusing technologies that succeeded in standardization
at first sight, given the plethora of available efforts and are endorsed by formal standard
solutions on the market. Nevertheless, if we organizations. One is cellular LPWAN that
take a look at the underlying technology, implements 3GPP standards, and the other is
LPWAN solutions can be broadly grouped the Telegram Splitting [2] technology based
into four major types: cellular LPWAN, Ultra- on the newly released ETSI standard on Low
Narrowband (UNB), Spread Spectrum and Throughput Networks—TS 103 357. A link [3] to
Telegram Splitting. Among these four, cellular this specification is available on Circuit Cellar’s
LPWAN is the only category that operates in article materials webpage.
the licensed spectrum, while the latter three Some industrial alliances have also been
mostly leverage the license-free Industrial, established around certain proprietary
Scientific and Medical (ISM) frequency bands. LPWAN technologies to promote standard
While introducing low cost and quick development. However, these efforts do not
deployment benefits, the use of the license- ratify the viability of the technology and
free spectrum raises considerable Quality- might not cover the whole network stack.
of-Service (QoS) and scalability challenges. It’s common that only the MAC layer is
In most solutions, there exists a persistent made open, while the physical layer remains
trade-off between QoS and power efficiency. entirely proprietary, like in the case of
the LoRa Alliance. Having part of technical
specifications publicly available on a royalty-
ABOUT THE AUTHOR basis doesn’t necessarily make the technology
a truly open standard. Also, these industrial
Wo l f g a n g T h i e m e i s t h e C h i e f P ro d u c t activities do not incorporate a stringent
Officer at BehrTech, an enabler of next- technology evaluation and quality testing
gen wireless connectivity for Industrial IoT. process, as in an SDOs’ (standards developing
He has more than 12 years of experience organization's) formal procedure.
in academic research and development;
successfully innovating and implementing new FOUR MAJOR LPWAN GROUPS
technologies with commercial partners and After a quick glimpse into the existing
managing development and product teams. LPWAN landscape, we’ll now dive into each
He worked for over 10 years at Fraunhofer type of LPWAN technologies and review their
Institute for Integrated Circuits where he led major technical features (Figure 4).
the advancement of early stage technology
development and technology transfer processes 1. Cellular LPWAN (Licensed Spectrum):
with a specific focus on integrated circuits, Internet of Things (IoT) and LTE-M and NB-IoT are the two major
communication and sensor technologies. variants of cellular LPWAN. Both employ a
narrowband approach, wherein the received
circuitcellar.com 29

signal bandwidth and data rates are reduced


to improve range and building penetration
ability. Compared to LTE, their transmission
power and technical design complexity are
also drastically reduced to achieve low-cost,
low-power qualities. NB-IoT, however, uses

FEATURES
a much smaller system bandwidth (200kHz)
than LTE-M (1.4MHz) and is thus a better choice
for underground and indoor applications.
Thanks to their operations in the licensed
spectrum, cellular LPWAN solutions introduce
great Quality-of-Service advantages.
That’s because there is no co-channel
interference from external systems. They
additionally employ time and frequency
synchronization alongside handshaking for
very high transmission reliability and network
scalability. That being said, these mechanisms
come at the cost of power efficiency due
to the required data overhead [4]. Besides
FIGURE 4
consuming extra energy, handshaking makes
LPWAN technologies positioning
the battery life of a node unpredictable,
since it’s difficult to decide how many times
the process needs to be repeated for each Telensa are representatives of UNB-based
transmission. LPWAN technologies.
Compared to the unlicensed counterparts, UNB signals, however, introduce very low
cellular LPWAN provides relatively higher peak data rates which translate into long on-air
data rates (greater than 1Mb/s for LTE-M and radio time. For example, systems like Sigfox
250Kb/s for NB-IoT), which further increases feature a 100Hz signal bandwidth and a data
power budget requirements. Available as rate of 100bps (EU mode), which means a
managed connectivity services from telecom 12 byte transmission could last for as long as
providers, their coverage at remote locations 2 seconds. This presents several challenges.
might not be guaranteed, and network First, long on-air time inevitably comes with
longevity is at stake due to the unforeseeable more power usage as the transceiver needs to
technology sunsetting. If your IoT end nodes be active for a longer period of time. Second,
are mobile, NB-IoT won’t be in your best under EU duty cycle regulations (1%) imposed
interest as it’s mostly designed for stationary by ETSI, a device operating in the 868MHz
devices. band can “speak” for only 36 seconds per
Given their pros and cons, cellular LPWAN hour. As such, the longer each transmission
options are best suited for higher data rate IoT takes place, the fewer total messages are
use cases and in smart city scenarios where allowed to be sent. In the US, FCC regulations
telecom infrastructure is mature. On the other limit the frequency occupation time of each
hand, they aren’t optimal for applications message to 0.4 seconds, requiring a different
where ultra-low power is at a high priority. network design with a higher data rate and
The same goes for industrial deployments shorter overall network range.
which often take place at remote locations Another issue with long on-air time is
and require the supported communications impaired Quality-of-Service (Figure 5).
network to sustain over several decades. Coupled with asynchronous communications,
longer time in the air interface exposes a
2. Ultra-Narrowband – UNB (License-free message to a higher chance of data collision,
Spectrum): To minimize the subjected noise especially in a crowded license-free spectrum
level and optimize receiver sensitivity, Ultra-
Narrowband solutions contract the signal
bandwidth to as small as 100Hz. Besides
extensive range and excellent penetration,
UNB approach allows for high spectral
efficiency as each signal occupies very minimal
channel bandwidth. High spectral efficiency
means that more messages can fit into an
assigned frequency band without overlapping
with each other, thereby improving overall FIGURE 5
system capacity and scalability. Sigfox and Long on-air time makes UNB signals highly susceptible to interference
30 CIRCUIT CELLAR • MARCH 2020 #356

changes frequency, resulting in a frequency


ramp that occupies a much wider channel
bandwidth. More bandwidth use essentially
comes with a higher experienced noise level.
As such, processing gain is added to improve
the signal-to-noise ratio (SNR) and overall
FEATURES

system range. Spreading Factors (SF) signify


the level of processing gain with higher SF
FIGURE 6 enabling longer range at a lower data rate.
Short on-air time of sub-packets in Telegram Splitting minimizes packet collision and data loss.
Compared to UNB signals, Spread
Spectrum signals are more robust against
with heavy radio traffic from multiple co- interception and eavesdropping attempts.
existing systems. Certain solutions apply Chirp Spread Spectrum (CSS) implemented in
redundancy in which the same data is sent LoRa technology is a representative variant of
several times in an attempt to improve message this modulation scheme. A recent study shows
reception. However, this measure proves to be that CSS systems can effectively support
counter-productive, as it increases total on-air mobile nodes at a speed of up to 40km/h [6].
time and energy usage per unique payload, On the other hand, the major limitation of
while further limiting effective data amounts Spread Spectrum solutions is their inefficient
that can be sent per hour. use of the spectrum resource, since more
Another drawback of UNB networks is bandwidth is required to transmit only a small
its sensitivity to multipath fading caused data amount. This induces bad co-existing
by Doppler effects in mobile end devices or behavior and serious scalability problems.
those situated close to fast-moving objects In the limited sub-GHz radio spectrum,
(near a highway, for instance) [5]. To avoid high wideband data traffic combined with
packet errors due to Doppler shifts, UNB uncoordinated transmissions in pure ALOHA
nodes should be stationary or moving only at can cause message overlays and eventually
minimal speeds. packet errors. This challenge further
intensifies in long-range applications using a
3. Spread Spectrum (License-free Spectrum): high spreading factor, due to the low data rate
As a common LPWAN modulation technique, and thus, longer on air-time of messages [7].
Spread Spectrum overcomes the very slow data The uses of different spreading factor
rate and Doppler fading issues experienced by and bandwidth combinations (such as
UNB solutions to a certain extent. In Spread orthogonality) and a higher number of base
Spectrum, a narrowband signal continuously stations are common approaches to partly
remedy this issue. However, tuning each base
station to different frequency entails complex
network management and requires radio
system expertise.

4. Telegram Splitting (License-free):


Telegram Splitting is the latest and so far, the
only standardized LPWAN technology in the
licensed-free spectrum. Introducing a new
radio transmission approach for UNB signals,
the technology aims to surpass the trade-off
between Quality-of-Service and power efficiency
commonly faced in previous LPWAN solutions.
MYTHINGS by BehrTech is the only solution
that implements Telegram Splitting and fully
FIGURE 7
complies with the ETSI TS 103 357 standard.
LPWAN technologies comparison in different network criteria Telegram Splitting systems feature a data
rate of 512bit/s. At the physical layer, the
technology divides a UNB telegram into multiple
For detailed article references and additional resources go to: equal-sized sub-packets, each of which is
www.circuitcellar.com/article-materials randomly sent at a different time and carrier
frequency. As each sub-packet has a much
smaller size than the original telegram, its on-
References [1] through [8] as marked in the article can be found there.
air time is drastically reduced to only 16ms.
The accumulated on-air time of a 10-byte as
RESOURCES an example is only 390ms. Short on-air time
Behr Technologies | www.behrtech.com combined with the virtually random distribution
circuitcellar.com 31

of sub-packets over time and frequency additionally diminish Doppler fading effects.
significantly mitigate their risk of being hit by And, even if some sub-packets suffer from
interferers (Figure 6). On top of that, even if deep fades, FEC ensures that message
up to 50% of sub-packets are affected, Forward detection and retrieval is minimally affected.
Error Correction ensures that the full message With this, Telegram Splitting systems can
can be retrieved at the base station. connect end nodes moving at up 120km/h

FEATURES
As such, although asynchronous [2]—a feature not available in previous LPWAN
communication is used for ultra-low power technologies. Figure 7 quickly recaps how the
benefits, Telegram Splitting delivers very high four major LPWAN technology types compare
interference immunity and system capacity. in different network criteria.
Specifically, a single base station is able to
handle more than one million messages a day CONCLUSION
as specified in the ETSI TS 103 357 standard Providing a unique combination of long-
[3]. Also, in an Industrial IoT-equivalent range, low-power and low-cost advantages,
scenario, Telegram Splitting has been proved LPWANs are poised to become the backbone
to drastically outperform Chirp Spread of battery-operated IoT sensor networks
Spectrum in LoRa in terms of message across verticals. Nevertheless, not all LPWAN
deliverability and network reliability [8]. technologies are created equal, and there
In addition to Quality-of-Service, the exists a persistent trade-off between Quality-
characteristics of Telegram Splitting, at the of-Service and battery life among most
same time, offer great power benefits. After solutions. At the same time, the lack of
the transmission of each sub-packet, there standardization and limited mobility support
is a significantly longer transmission-free are other challenges not to be overlooked.
period in which the node goes into “sleep Recognized for its versatile technical design,
mode”. Short on-air time and longer off- Telegram Splitting represents a new LPWAN
air time minimize power consumption while generation to surpass these limitations and
giving the battery time to recover, which in provide a robust, scalable and power-efficient
turn significantly extends battery life. architecture for massive-scale IoT
Short time in the air interface of sub- deployments in the industrial and commercial
packets combined with coherent demodulation marketplaces.

LOOKING TO

ADVANCE
YOUR
CAREER?
Be a part of one of the
top Electrical Engineering
programs in country
and experience the
Bearcat Promise!

l(_t
University of
CINCINNATI I ONLINE ucengineer.o nline
32 CIRCUIT CELLAR • MARCH 2020 #356

Solutions Evolve for


Medical Wearable Designs

MCUs, Analog ICs


and Sensors
SPECIAL FEATURE

By Jeff Child,
Editor-in-Chief

With extreme low-power and wireless connectivity as leading design needs,


mobile and wearable medical devices continue to evolve. Solutions for designers
have taken shape in the form of microcontrollers, analog ICs and sensors.

T he mobile and wearable segments


rank among today’s most dynamic
areas of medical electronics
design. Such devices put extreme
demands on the embedded electronics
that make them work—and power is front
monitoring could only be achieved with
bulky and mechanical cuff-based medical
devices. Design engineers can develop blood-
pressure trending solutions with Maxim's
MAXREFDES220# reference design.
Comprised of a complete integrated
and center among those demands. Devices optical sensor module, an MCU sensor hub
spanning across fitness and medical markets and a sensing algorithm, the MAXREFDES220#
all need highly-integrated processing and optical blood-pressure trending solution can
advanced power management technologies to be embedded into smartphones or wearables
perform as expected. (Figure 1). It enables users to place their
To keep pace with those demands, makers finger on a device for 30-45 seconds while
of microcontrollers (MCUs), analog ICs and resting to measure blood pressure anywhere
sensors have rolled out a new crop of solutions and anytime. The reference design includes
over the past 12 months, each designed for the MAX30101 or MAX30102 high-sensitivity
the needs of mobile and wearable medical optical sensor, as well as the MAX32664D
systems. sensor hub IC with built-in algorithms.
The MAX30101 (using three LEDs) and
BLOOD-PRESSURE MONITORING MAX30102 (using two LEDs) pulse-oximeter
Exemplifying these trends, in November and heart-rate optical sensor modules
Maxim Integrated introduced a solid-state combine photodetectors, LEDs and analog
blood-pressure monitoring solution to front-end (AFE) electronics with an integrated
more conveniently track this critical health cover glass. This integrated optical design
indicator. Until now, accurate blood-pressure and lenses-on-top approach enables optimal
circuitcellar.com 33

signal-to-noise ratio (SNR) for a small, lower


cost and power-efficient module. It comes in
a tiny 5.6mm × 3.3mm 14-pin optical package
with an I 2C interface to the sensor hub IC.
The MAX32664D sensor hub IC includes
firmware, which controls the sensor and
executes the algorithms that measure cuffless
blood pressure, heart rate and blood-oxygen
levels. Its ultra-small size (1.6mm × 1.6mm)
can easily fit into small devices to seamlessly
and effortlessly connect to a device’s host
microcontroller.
The MAXREFDES220# provides industry-

SPECIAL FEATURE
best accuracy that meets Class-II regulatory
limits. For example, under resting-only
measurement conditions, the solution
provides the following accuracies: Systolic
Error: Mean = 1.7mmHg, Std Dev = 7.4mmHg;
FIGURE 1
Diastolic Error: Mean = 0.1mmHg, Std Dev = Including a complete integrated optical sensor module, an MCU sensor hub and a sensing algorithm, the
7.6mmHg. For reference, Class-II regulatory MAXREFDES220# optical blood-pressure trending solution can be embedded into smartphones or wearables.
limits are |Mean Error| ≤ 5mmHg, and Std Dev
≤ 8mmHg. This solution requires calibration
every four weeks to maintain the above According to the company, The STHV64SW
accuracies. This is based on independent has already been designed into innovative
testing and a limited number of subjects at high-tech equipment such as ultrasonic flaw
resting condition. detectors for industrial non-destructive
testing (NDT), as well as into affordable
SWITCH IC FOR ULTRASOUNDS and portable handheld medical echography
Ultrasound systems require high levels of devices that are raising standards of pre-
resolution and high-integration to facilitated natal care available to remote and rural
portable design requirements. Meeting communities.
these needs, in October, STMicroelectronics The highly integrated 64-channel analog-
(ST) released the STHV64SW, a 64-channel switch IC comes in a small FCBGA (flip chip
high-voltage analog-switch IC offering high ball grid array) package as does the recently
integration for advanced ultrasound systems,
probes and other applications.
The IC comprises a shift register for
logic control signals, self-biased high-
voltage MOSFET gate drivers and N-channel
MOSFET switches capable of providing up
to ±3A peak output current (Figure 2). The
switches respond quickly, with 1.5µs turn-on
time, and low quiescent current saves power
when turned off. Low on-resistance with low
distortion and crosstalk ensure high signal
integrity. Thermal shutdown and under-
voltage lockout (UVLO) are built-in to ensure
safe operation.
ST says it created this advanced device
leveraging proprietary BCD6s-SOI (silicon
on insulator) and BCD8s SOI process
technologies to combine precise analog
circuitry (Bipolar), low-voltage CMOS logic,
and robust DMOS power stages on the same FIGURE 2
chip. The STHV64SW can operate with various The STHV64SW, a 64-channel high-voltage analog-switch IC, comprises a shift register for logic control
combinations of high-voltage supplies up to signals, self-biased high-voltage MOSFET gate drivers and N-channel MOSFET switches capable of providing
-100V/+100V, 0V/200V, or -200V/0V. up to ±3A peak output current.
34 CIRCUIT CELLAR • MARCH 2020 #365

other wearable applications, says Maxim. It


is optimized for in-ear applications with its
small package size and best-in-class SNR—
3dB improvement with a band limiting signal
for PPG (photoplethysmography) use cases
compared to closest competitor, according
to the company. This enables development
of devices that cover a wider range of use
cases. MAXM86161 delivers approximately
35% lower power to extend battery life of
wearables. In addition, an integrated analog
front-end (AFE) eliminates the additional AFE
typically needed to procure a separate chip
SPECIAL FEATURE

and connect to the optical module.

CLINICAL GRADE MEASUREMENT


The MAX30208 digital temperature
FIGURE 3
The MAX30208 is a clinical-grade digital temperature sensor that enables new wearable health and fitness sensor delivers clinical-grade temperature
use cases at half the power. And the MAXM86161 is an in-ear heart-rate monitor that boasts best-in-class measurement accuracy (±0.1°C) with fast
SNR at lowest power and 40% less space. response time to changes in temperature.
It also meets the power and size demands
of small, battery-powered applications such
as smartwatches and medical patches. It
announced companion 16-pulser STHV1600 simplifies the design of battery-powered,
IC, enabling system manufacturers to increase temperature-sensing wearable healthcare
channel density for superior ultrasound image applications. Easier to use than competitive
resolution, using minimal board space. The offerings, it measures temperature at the top
STHV64SW is packaged as a BGA-196 device. of the device and does not suffer from thermal
self-heating like competitive solutions.
HEALTHCARE SENSORS MAX30208 is compatible with up to four I 2C
Last summer, Maxim rolled out a pair addresses to enable multiple sensors on the
of sensors aimed specifically at medical same IC bus. The MAX30208 can be attached
wearables. The MAX30208 is a clinical-grade to either a PCB or a flex printed circuit (FPC).
digital temperature sensor that enables MAX30208 delivers ±0.1°C accuracy in
new wearable health and fitness use cases the range of 30°C to 50°C and eliminates
at half the power. And the MAXM86161 is thermal self-heating, a factor that affects
an in-ear heart-rate monitor provides best- measurement accuracy in competitive
in-class SNR at lowest power and 40% devices. MAXM86161 cancels ambient light
less space for continuous heart-rate and for greater accuracy and provides highest
SpO2 measurements, according to Maxim SNR (Nyquist SNR is 89 dB; 100 dB SNR with
(Figure 3). averaging). In addition, Maxim provides
To provide value, wearable health and algorithms for motion compensation to
fitness monitors require greater accuracy increase measurement accuracy.
in measuring human biometrics such as To extend battery life of wearables, the
body temperature and heart rate, but device MAXM86161 consumes approximately 35%
designers have been limited by sensor lower power versus the closest competitor,
accuracy for small, battery-powered, body- with less than 10μA operating power and
worn devices. Maxim’s two new continuous- 1.6μA in shutdown mode. Compared to the
monitoring body sensors provide higher closest competitive solution, the MAX30208
degrees of accuracy in measuring vital signs consumes only half the power (67μA operating
such as temperature, heart rate and blood- current during active conversion vs. 135 μA)
oxygen saturation (SpO2). under a representative use case. MAXM86161
The MAXM86161 in-ear heart-rate is available in an OLGA package (2.9mm ×
monitor and pulse oximeter is the market’s 4.3mm × 1.4mm), which is 40% smaller
smallest fully integrated solution that than the closest competitor. MAXM86161
delivers highly accurate heart-rate and includes three LEDs—red and infrared for
SpO2 measurements from hearables and SpO2 measurement and green for heart rate.
circuitcellar.com 35

MAX30208 is available in a 10-pin thin LGA


package (2mm × 2mm × 0.75mm).

DUAL-FUNCTION SENSORS
High integration is an ongoing theme
for mobile and wearable medical system
designs. Part of the game is getting multiple
functions on one chip. Along such lines,
Infineon Technologies offers its XENSIV TM
DPS368, a miniaturized digital barometric
pressure sensor that is capable of measuring
both pressure and temperature (Figure 4). It
offers an ultra-high precision of ±2 meters

SPECIAL FEATURE
and a low current consumption for precise
measurement of altitude, air flow and body FIGURE 4
The XENSIV TM DPS368 is a miniaturized digital barometric pressure sensor that is capable of measuring
movements. This makes the DPS368 ideal
both pressure and temperature. It offers an ultra-high precision of ±2 m and a low current consumption for
for mobile applications and wearable devices precise measurement of altitude, air flow and body movements.
offering, for example, activity tracking and
navigation. Additionally, the sensor can be
used in home appliances for airflow control,
in drones for flight stability and in medical
devices such as smart inhalers.
Due to its robust package, it can withstand
operation 50 meters under water for one hour
(IPx8) and protects the sensing cells against
dust and humidity. As a result, the board
handling in an assembly line is also facilitated.
The 8-pin LGA package with its small dimensions
of 2.0mm x 2.5mm x 1.1mm saves up to 80%
space compared to other waterproof sensors,
says Infineon.
The pressure sensor element is based on
a capacitive sensing principle that guarantees
high precision even during temperature
changes. The internal signal processor
converts the output from the pressure and
temperature sensor elements to 24-bit
results. Calibration coefficients stored in the
sensor are used in the application to convert
the measurement results to high accuracy
pressure and temperature values. DPS368
provides quick feedback due to a measurement
rate of up to 200Hz and fast read-out speed.
The integrated FIFO memory can save up to
32 measurement results, allowing for power-
savings on system level.
The XENSIV DPS368 sensor features an
average low power consumption of 1.7μA for
pressure measurements at 1Hz sampling rate.
In standby mode, this is reduced to 0.5μA.
The sensor operates at pressure ranges
from 300 to 1200hPa (hectopascals) and
temperature ranges from -40°C to +85°C with
a temperature accuracy of ±0.5°C. Sensor FIGURE 5
measurements and calibration coefficients The QN9090 and QN9030 devices are powered by an Arm Cortex-M4 running at 48MHz and include up
are available through the serial I²C or SPI to 640KB onboard flash and 152KB SRAM. The QN Series devices target diverse IoT applications such as
interface. personal healthcare devices, sports and fitness trackers and connected appliances.
36 CIRCUIT CELLAR • MARCH 2020 #365

time-to-market for developers creating


products with rich features for diverse IoT
applications such as personal healthcare
devices, sports and fitness trackers and
connected appliances.
As NXP’s BLE (Bluetooth Low Energy) SoC
with NFC integrated on chip, the QN9090T
and QN9030T variants support out-of-band
wireless communications to enable numerous
use cases. By tapping an IoT device based on
the QN9090T to a smartphone, tablet or other
NFC reader device, a BLE connection can
be quickly established, greatly simplifying
SPECIAL FEATURE

the pairing process. The built-in NFC NTAG


eliminates the need for the tag to be powered
and creates additional opportunities for
diagnostics or device commissioning in
stages of the device life cycle.
FIGURE 6
The devices are well suited to wearable
The RX23W is a 32-bit MCU featuring Bluetooth 5.0 for IoT endpoint devices such as home appliances and Bluetooth, battery-operated applications,
healthcare equipment. It combines Bluetooth 5.0 Low Energy (BLE) with Renesas’ Trusted Secure IP. thanks to their 4.3mA Rx current and 7.3mA
Tx current at +0dBm. The SoC has a 48MHz
Arm Cortext-M4 core, 640KB of embedded
flash and 152KB of SRAM. The embedded
NFC NTAG reduces system board footprint
BLE SOC WITH NFC and cost of manufacturing with digital and
Low-power SoCs with wireless connectivity analog integration. The devices’ rich set of
have become a key ingredient in many new MCU capabilities includes various low power
wearable medical device designs. In January, modes, digital MIC interface with wake up on
NXP Semiconductors fed such demands by audio event and Quad SPI NOR flash memory
announcing the availability of its QN9090 controller for high-density data or code
and QN9030 Bluetooth 5 SoC with hardware storage.
compatible options for 802.15.4, Multiprotocol The 2.4GHz BLE 5.0 transceiver supports
RF and optional NFC technology. 2Mbps and up to 8 concurrent Bluetooth
The QN9090 and QN9030 devices are connections with antenna diversity
powered by an Arm Cortex-M4 running support. Integrated power amplifiers with
at 48MHz and include up to 640KB exceptionally high transmit power (up to
onboard flash and 152KB SRAM, providing +11dBm) to make long-distance transmission
storage space and flexibility for complex possible. A wide temperature range if -40°C
applications and safe over-the-air (OTA) to +125°C makes the devices applicable in
updates (Figure 5). The QN Series various environments.
devices help accelerate development and
MCU EMBEDDED SECURITY
Embedded security is a critical feature
for many healthcare wearable devices. The
For detailed article references and additional resources go to: more such functionality can be integrated
www.circuitcellar.com/article-materials on the device’s MCU the better. Along such
lines, Renesas Electronics has introduced the
RESOURCES RX23W, a 32-bit MCU featuring Bluetooth
Infineon Technologies | www.infineon.com 5.0 for IoT endpoint devices such as home
Maxim Integrated | www.maximintegrated.com appliances and healthcare equipment
(Figure 6).
NXP Semiconductors | www.nxp.com
By combining BLE  5.0 with Renesas’
ON Semiconductor | www.onsemi.com Trusted Secure IP on its popular high-
Renesas Electronics | www.renesas.com performance RX MCU family, Renesas offers
embedded system designers an optimized
STMicroelectronics | www.st.com
single-chip solution for system control and
circuitcellar.com 37

FIGURE 7
wireless communication, while also providing The RSL10 is a family of tiny
a more secure way to answer the Bluetooth Bluetooth 5 certified radio SoCs in a
security risks such as eavesdropping, ready-to-use 6mm x 8mm x 1.46mm
tampering and viruses. System-in-Package (SiP) module.
RSL10 devices can be easily designed
The RX23W is based on Renesas’ RXv2
into any “connected” application
core, which provides high computational including sports/fitness or healthcare
performance with improved FPU and DSP wearables, smart locks and appliances.
functions and operates at a maximum clock
frequency of 54MHz. The RX23W provides
full BLE support including long-range and
mesh networking functions and achieves
the industry’s lowest level reception mode
peak power consumption at 3.0mA, says

SPECIAL FEATURE
Renesas.
Furthermore, it integrates a rich set of
peripheral functions that are indispensable
for IoT equipment, including security, touch
key, USB, and CAN functions. These functions TINY BLUETOOTH RADIO
allow the RX23W to implement both system For wearable healthcare devices that need
control and Bluetooth wireless functions to partition the Bluetooth radio separately,
for IoT endpoint equipment such as home ON Semiconductor offers its RSL10 family of
appliances, health care equipment, and Bluetooth 5 certified radio SoCs with a ready-
sports and fitness equipment on a single to-use 6mm × 8mm × 1.46 mm System-in-
chip. In addition, the RX23W’s Bluetooth Package (SiP) module. Supporting BLE wireless
mesh functions make it optimal for industrial profiles, RSL10 devices can be easily designed
IoT equipment collecting sensor data within into any “connected” application including
a factory or a building. sports/fitness or healthcare wearables, smart
The RX23W supports long distance locks and appliances (Figure 7).
communication (long range: 400m), 2Mbps The RSL10 SIP features a built-in antenna,
data throughput, and Bluetooth mesh RSL10 radio, and all required passive
networking, supporting the full functionality components in one complete, miniature
of BLE 5.0 Low Energy. Furthermore, the solution. Certified with the Bluetooth
RX23W achieves a 3.0mA reception mode Special Interest Group (SIG), the RSL10 SIP
peak current—the industry’s lowest level, significantly reduces time-to-market and
according to Renesas—and a reception development costs by removing the need for
sensitivity level of -105dBm at 125Kbps. any additional RF design considerations.
In addition to a Bluetooth 5.0 basic With the 2Mbps speeds possible with
protocol stack package, Renesas provides Bluetooth 5 alongside low power consumption,
API functions that conform to all standard the RSL10 family provides advanced wireless
profiles, including a Health Thermometer functionality without compromising battery
Profile (HTP), an Environment Sensing application life. RSL10 consumes just 62.5nW
Profile (ESP), and an Automation I/O profile while in Deep Sleep mode, and 7mW peak
(AIOP). These allow users to start prototype receive power. RSL10’s energy efficiency was
development and evaluation quickly and can validated in 2018 by the EEMBC’s ULPMark
speed up the user’s development process. where it became the first device in the
The RX23W integrates Renesas’ Trusted benchmark’s history to break 1,000 ULP
Secure IP (TSIP) as part of its built-in Marks and produced Core Profile scores more
hardware security engine. The TSIP driver than twice as high as the previous industry
uses strong encryption key management leader. The RSL10 SIP is offered in a 51-pin
with hardware accelerators to securely boot 6mm ×8mm ×1.46mm package.
customers’ IoT devices and protect them from Mobile and wearable medical device
security threats. Cryptographic Algorithm designers are hungry for highly integrated,
Validation Program (CVAP) certification is low-power, wirelessly connected solutions to
expected. The RX23W is available now in meet their high demands. Makers of MCUs,
both 7mm × 7mm 56-pin QFN and 5.5mm × analog ICs and sensors will continue to
5.5mm 85-pin BGA packages with 512KB of address those demands with new innovative
on-chip flash memory. products.
38 CIRCUIT CELLAR • MARCH 2020 #356

PCB Assembly Services


Parts, Prototypes, Production
By Jeff Child,
Editor-in-Chief
TECH SPOTLIGHT

Example from EzPCB of a complex PCB assembly job involving multiples types and sizes of components

The assembly phase is a critical step in the production of a board-level product. Fortunately,
there’s a rich set of companies offer all types of PCB assembly services—ranging from
quick turnaround prototypes to large volume runs. This roundup summarizes the PCB
assembly service capabilities available today and whose providing them.

ADVANCED ASSEMBLY BETA LAYOUT


www.aapcb.com uk.beta-layout.com
Location: Aurora, CO Location: Shannon, Ireland

Advanced Assembly launched in 2004 with a Beta Layout’s PCB-POOL operation is Europe’s
new way to assemble just a few boards in 3 days largest manufacturer of PCB prototypes, with
or less: Quick turn PCB assembly. The company over 36,000 customers worldwide. You can
has assembled over 40,000 unique designs in calculate the prices instantly online using the
the last decade for some of the largest and PCB-POOL’s Online price calculation. PCBs using
most innovative tech companies in the world, special technologies and materials can also
including many Fortune 500 organizations. be sourced directly from the company, from
Services Summary: Quick turn PCB prototype to series production quantities.
assembly, DFA verification, first article service, Services Summary: Prototype PCBs or
turnkey assembly, PCB fabrication: smallest small series PCBs in 1-6 working days; Laser-
0.25" × 0.25", largest 20" × 24" cut SMD-Stencils in 1-3 working days; Fully
populated SMD and THT prototype boards
PCB Assembly Services: SMT and thru- in 2 working days; Support for PCBs with
hole; Press fits; Parts in any format; ISO embedded UHF RFID modules
9001:2015; Passives down to 01005; BGAs and PCB Assembly Services: Can perform
VFBGA; Box build; Leadless chip carriers / CSP; assembly on PCB prototypes and “small
Double-sided SMT assembly; Fine pitch to 08 series” (up to 50 pieces) with SMT and THT
Mils, BGA repair and reball; Part removal and components starting with just one component
replacement; RoHS and leaded; Flying probe, and from one piece. SMT and THT from size
3D BGA X-ray and functional testing 0402 SOIC, PLCC, TSOP, QFP, BGA Diverse SM-
exotic and SM - connectors.
circuitcellar.com 39

EASYOEM Design consultation, optimization, DFM, to


www.easyoem.com final flex design; Supply chain management
Location: Beijing, China for components and materials; Prototypes
through production; Low mix-high volume
EasyOEM is a one-stop electronics and high mix-low volume program support;
manufacturing service that offers total Assembly services; Testing Services.
solutions for electronics manufacturing tasks. PCB Assembly Services: FCT Shenzhen
Services Summary: PCB manufacturing, is FCT’s main hub for coordinating all of our
PCB assembly, BOM kitting, testing, Design China based operations including: support in
checking, PCB coating, MCU/CPLD/FLASH/ DFM, production scheduling for prototypes
EEPROM programming, wiring harness and production of bare flex, support in
assembly, injection molding, printing, sourcing and receiving of components for
labeling, packaging, certification, stocking, sub-assembly, assembly services, testing,
distribution, shipping, customs declaration packaging and shipping.
PCB Assembly Services: Supervises entire
manufacturing process from engineering IMAGINEERING
files to final products. BOM kitting, including www.pcbnet.com
sourcing various materials / components. Location: Elk Grove Village, IL

TECH SPOTLIGHT
EasyOEM manufacturing tasks and dispatch
then to various factories. Those tasks include Imagineering acts as a reliable source for
PCB soldering, wire harness assembling, high quality and on time PCBs. Its quick turn
mechanical assembling, chip programming prototypes not just intended for testing and
and more. verification of designs. Every one of its boards
meet IPC-A-600 F (Class2) standard, be it
prototype or production. Specializes in quick
EZPCB turn prototypes and rapid turn production.
www.ezpcb.com Services Summary: PCB capabilities
Location: Shenzhen, China include: 22-layer fabrication, hole sizes down
to 8 mil plated and 5 mil laser drilled, 3 mil
EzPCB is an online provider of PCB line width and spacing, 6 oz. copper and a
manufacturing and PCB assembly products maximum PCB thickness up to .300". Supports
and services. EzPCB has supplied high quality Multi-Layer, Rigid and Flex PCBs.
PCBs—and related products and services— PCB Assembly Services: Same day and
for over 2,000 customers from more than 40 24-hr turnaround; Prototype to production
countries. Its customers include amateurs, volumes; SMT; Flip chip; Thru hole; Flex
small businesses, universities and many circuit assembly; Cable assemblies; PB-free
world-class companies and organizations assembly; Wire harness assembly; AOI –
including Jet Propulsion Laboratory, Micron, Automated Optical Inspection; BGA X-Ray
Siemens, STMicroelectronics and Rohm. Inspection; Functionality testing
Services Summary: PCB manufacturing,
PCB assembly, cabling, enclosures, keypads,
stencils and components, one-stop turnkey
services and design consultation
PCB Assembly Services: For prototype
assembly, the lead time is about 2 weeks for
PCB+ order component+ assembly. For mass
production assembly, the lead time is about
3-4 weeks for all process.

FCT
www.flexiblecircuit.com
Location: Minneapolis, MN

Flexible Circuit Technologies (FCT) has


an internationally recognized flex circuit
Application Engineering and Design Team
offering over 250 years of combined industry
expertise.
Services Summary: Supports multiple
types of flexible PCBs; value added assembly, Imagineering says that is aerospace-quality PCB assembly is only possible with industry-leading equipment
Testing Services to complete box builds; in its facilities, like this Mydata MY200 Series pick-and-place machine.
40 CIRCUIT CELLAR • MARCH 2020 #356

OURPCB Package (POP), Rigid PCBs, Flex PCBs; Flexible volume


www.ourpcb.com alternatives: prototypes, low volume, high volume; Parts
Location: Shijiazhuang Hebei, China sourcing; Comprehensive Quality Assurance including
visual inspection to AOI and X-ray inspection
OurPCB is a multi-national PCB manufacturing and PCB
assembly company that provides global service and support while
using its own Chinese manufacturing capabilities. Company has PCB UNLIMITED
provided professional PCB production and assembly services for www.pcbunlimited.com
more than 2,500 customers around the globe. Location: Tualatin, OR
Services Summary: Assembly capabilities include BGA, LGA,
QFN, QFP, DIP and SIP. The smallest SMT footprint it can mount is In 2003, PCB Unlimited’s sister company Stencils
0201. Factory can also provide programming and wiring as well as Unlimited pioneered the internet SMT stencil quote and
injecting and conformal coating services. order process. In 2008, PCB Unlimited took it one step
PCB Assembly Services: ISO 9001:2015 certified; RoHS & further by providing a one-stop-shop where engineers
lead-free assembly; Consigned components or turnkey; Single can quote and order online US and offshore PCB services
or double-sided mixed technology PCB assembly; All kinds of IC and everything else they need for their PCB projects.
package BGAs, CGAs, QFNs, DFNs, CSPs; AOI inspection, X-Ray Services Summary: US PCB fabrication including
inspection Rigid, Flex and Rigid-Flex PCBs; Offshore PCB
TECH SPOTLIGHT

Fabrication; US Quick-Turn Prototype PCB Assembly


and Low Volume Production followed by our offshore
PCBCART operation to service your high-volume production needs
www.pcbcart.com PCB Assembly Services: Specializes in building
Location: Hangzhou, China short-run, one-off and prototype PCB assembly,
with rapid turn times and instant online quoting and
PCBCart is a professional PCB production service provider with ordering. Supports SMT, Through Hole and Mixed
more than 10 years of experience in the electronics manufacturing Assembly; Passive Down to 01005 Sizes; Packaging
industry. It has manufactured printed circuit boards for more support: BGA, uBGA, QFN, QFP, PLCC 6, PoP; Small Chip
than 10,000 companies and over 80 countries around the world. Packages (Pitch of 0.2mm)
Fast, affordable prototype assembly they take your unique PCB
designs, prepare them for the assembly process and perform
comprehensive testing to ensure they meet your precise PCBWAY
performance requirements. Can provide a complete turnkey PCB www.pcbway.com
prototype assembly featuring a one-stop shop approach. Location: Shenzhen, China
Services Summary: Development, manufacturing, assembly
and testing of custom PBCs; Rapid PCB prototyping; Circuit boards PCBWay is a China Shenzhen-based PCB manufacturer
manufacturing: PCB assembly; Components sourcing services and PCB assembler. Its online pricing software gets
PCB Assembly Services: Turnkey and consigned PCBA you an instant your PCB Assembly service. PCBWay
services; Supports SMT, THT, Mixed Assembly, Package on has accumulated lots of reliable and competitive parts
suppliers in the world to ensure the quality and cost
of parts sourcing. All jobs can be done under one roof,
either SMT, thru-hole or Hybrid
Services Summary: Quick turn PCB prototyping,
PCB Assembly and low-volume production. Small volume
quick turn PCBs, custom spec quick turn PCBs, full spec
PCBs, highly specialized precision PCBs and largescale
production PCBs.
PCB Assembly Services: PCBA services also specialize
in prototyping and small-volume production. PCBA
capabilities: SMT Assembly, BGA Assembly, Through-
Hole Assembly, Mixed Assembly, Rigid Flex PCB Assembly
Services. Compliant with a wide range of standards
including IPC 610 Class 2 and Class 3.

SAN FRANCISCO CIRCUITS


www.sfcircuits.com
Location: San Mateo, CA

SMT assembly requires screen printing frames and frames (framed and unframed stencils)
Specializes in the complex, advanced technology of
which present excellent stability over time and high wear resistance. Shown here is an PCB fabrication and assembly, producing high quality
example from PCBWay of a stencil PCB, ready to be used during the assembly phase with multi-layered PCBs from elaborate layouts. Expertise in
surface mount devices (SMDs). circuit boards is not limited to PCB manufacturing, but
circuitcellar.com 41

extends to PCB layout & PCB assembly. SIERRA CIRCUITS


Services Summary: PCB fabrication, PBC assembly www.protoexpress.com
and PCB layout services. Supports Mil-SPEC PCBs, Flex Location: Sunnyvale, CA
PCBs, Metal Core PCBs and many others.
PCB Assembly Services: Quick-turn prototype Sierra Circuits is an ISO 9001:2015, ISO 13485:2016 and
assembly; Turn-key assembly; Partial turn-key MIL-spec MIL-PRF-55110 certified, Silicon Valley-based, high-
assembly; Consignment assembly; RoHS compliant lead- technology PCB manufacturer and assembler. It specializes in quick
free assembly; Non-RoHS assembly; Conformal coating; turn PCBs and medium production. By owning its manufacturing
Packaging support: BGA, Micro BGA, uBGA, QFN, QFP, and assembly facilities, the company controls every aspect of the
PoP; Flip Chip and more; X-Ray testing, AOI testing, ICT production schedule and quality.
testing and more Services Summary: Micro/fine line PCBs, PCB assembly,
flexible PCBs, lead-free PCBs, high-reliability PCBs, no-touch PCBs,
burn-in PCBs, R&D PCBs, MIL-spec PCBs, PCB design
SCREAMING CIRCUITS PCB Assembly Services: NPI; SMT single & double-sided;
www.screamingcircuits.com Plated through-hole: Selective soldering; Mixed technologies: SMT,
Location: Canby, OR through-hole, electro-mechanical assembly; Packaging support:
BGA, Micro BGA, QFN, CSP and any leadless devices up to 0.35mm
Unlike old-fashioned manufacturing models that pitch assembly

TECH SPOTLIGHT
focused on mass volumes and cost-control through
rigidity, Screaming Circuits specializes in fast and flexible
prototype and short-run assemblies. It offers short-run SLINGSHOT ASSEMBLY
production for higher volumes without forecasts, NRE www.slingshotassembly.com
charges or volume commitments. If you need to go a step Location: Denver, CO
further with scheduled production, its parent company
Milwaukee Electronics provides a full range of electronics SlingShot Assembly’s state-of- the-art production facility
manufacturing services, from original design to volume handles prototype and low-volume production orders. From
production and life-cycle management. a single board and up, they use the latest software, processes
Services Summary: PCB fabrication, PCB assembly, and equipment to produce high-quality assemblies fast and at a
parts sourcing, layout engineering, prototype to volume reasonable price. Customers use the company’s assembly services
production transitioning for early prototype runs when they need high-quality assemblies
PCB Assembly Services: Turn times as short as 24 completed in a matter of a few days. Typically, the quantities for
hours; 1 to 5,000 units; Class II Inspection standard early prototypes range from a single board to about 50. Once
and Class III Inspection available; Lead-free RoHS initial testing of early prototypes is completed, many customers
Certification and ITAR compliance screen available; Lead move to late-stage prototyping or pre-production assemblies.
Free (RoHS) options; Supports 2-Sided SMT; SMT sizes: Services Summary: Specialist in PCB assembly
0201 or larger; Fine pitch: 16 mil (.4 mm) or greater; BGA PCB Assembly Services: Quick turn PCB assembly, standard
pitch: 16mil (0.4mm) or greater; BGA Ball count: Up to assembly turn time: 2 – 3 days (turn times as fast as 24 hours
1932Call for larger parts available), prototype and low-volume production (single orders
welcome, 100% turn-key components, turn-key board fabrication
encouraged, test, conformal coating, limited box build services,
SEEED STUDIO web-based BOM sourcing and more.
www.seeedstudio.com
Location: Shenzhen, China
WELLPCB
Seeed is a hardware innovation platform tailored www.wellpcb.com
for makers to help grow inspirations into differentiating Location: Australia
products, by providing accessible technologies WellPCB, registered in Australia, is a daughter company of
with quality and delivery guaranteed. Seeed Fusion Uniwell Circuits. It’s focused on PCB fabrication and PCB assembly
Service offers one-stop prototyping services for PCB turnkey services and is capable of delivering over 10,000 varieties
manufacturing, PCB assembly and other electronic and monthly. WellPCB can produce quick turns to meet 24-hour
mechanical customized services such as CNC Milling, 3D delivery for double-sided PCBs, 48-hour for 4 to 8-layer and 120-
printing and PCB layout services. hour for 10-layer or higher PCBs.
Services Summary: Seeed Studio offers four kinds of Services Summary: PCB fabrication, PCB assembly turnkey
Fusion electronic service which includes Prototype PCBs, services
PCB assembly, stencil, 3D printing, PCB layout. PCB Assembly Services: SMT, thru-hole assembly, SMT/Thru-
PCB Assembly Services: Quick-turn PCBA service: hole mixed, single or double sided placement; consigned
get the entire PCBA produced in 20 working days from components or partially components procurement; BGA and Micro
order confirmation to dispatch, including sourcing of parts. BGA installation and rework with 100% x-ray inspection,
Prototype, small or large batch: Seeed can cater for as little automated optical inspection, aqueous cleaning and PCB testing
as a single piece 1 to 8000 pieces. Assembly types: SMT services; Capability to handle virtually any device including all
assembly, BGA assembly, through-hole assembly, mixed types of BGAs, CGAs, QFNs, DFNs, CSPs and Sons.
assembly, kit assembly
42 CIRCUIT CELLAR • MARCH 2020 #356

Datasheet:
Industrial Power Supplies
Factory Functionality
DATASHEET

FIGURE 1
By Jeff Child, Power supplies require special cooling and high levels of ruggedness in order
to operate in industrial system environments.
Editor-in-Chief

Over the past couple years, there’s been an increasing trend toward new power
supply products that have some sort of application or industry focus. That means
supplies that include special performance specs or tailored packaging intended
for a specific application area such as industrial control and factory automation.

O ften the unsung heroes of any


embedded system design,
power supplies are critical
enablers for meeting today’s
needs. As embedded systems pack ever
more intelligence into smaller spaces, power
An example of special power supply
features for industrial systems is XP Power’s
CMP250 series of high peak-power AC-DC
power supply units. The supplies provide
a highly flexible combination of electrical
and thermal characteristics. These power
has direct implications on the size, cooling supplies deliver up to 500W of peak power
and mobility of any system. To keep pace, for up to 60 seconds, as well as providing
power supply vendors continue to roll out up to 250W of continuous convection-cooled
more efficient products, new partitioning power. This flexibility makes the series well
strategies and more compact solutions. In suited for motor applications and other
tandem to those trends, there’s a growing electromechanical loads without the need
demand to reduce size, weight and power of for fan cooling, removing unwanted audible
system electronics. Driving those demands is noise, across a range of applications.
a desire to fit more functionality in the same TDK’s TPS4000-24 is industrial power
space or into a smaller footprint. supply is likewise well suited for use in many
If you look at the power supply products industrial settings. Its high voltage, three-
released over the last 12 months, there’s phase input avoids the requirement for costly
been a definite uptick in new products that step-down transformers and assists phase
have some sort of application or industry load current balancing. Meanwhile, the
focus. While this hasn’t diminished the role PQU650 series from Murata boast cooling
of general-purpose power supplies, the trend options suited to factory automation
has been toward supplies that include either applications, with forced air- and convection-
certifications, special performance specs or cooled ambient ratings. No system fans are
tailored packaging intended for a specific required up to 450W up to 50°C temperatures,
application area such as industrial control and only 300 LFM forced air-cooling is needed
and factory automation (Figure 1). for 650W at 50°C.
circuitcellar.com 43

DATASHEET
5W AC-DC Converter Boasts AC-DC Supplies Meet 650W AC-DC Supplies Offer
Wide Input Voltage Range Green Power Demands Cooling Options

Aimtec’s AMEL5-277NZ is an CUI’s VOF open frame AC-DC power The PQU650 series from Murata are
encapsulated 5W AC-DC converter that supply series delivers higher efficiency open-frame, 650 W-rated AC-DC power
has been designed to offer greater and improved no-load performance to supplies. Murata says the PQU650
economies of scale due to greater meet the growing demand for green series offers the highest power-density
production automation, leading to power technology. Featuring industry product on the market, with forced air-
improved reliability and performance. standard footprints, the VOF’s efficient and convection-cooled ambient ratings.
Offering a wide industrial input voltage design, compact size and high reliability The power supplies offer a multitude
range of 85-305VAC and an output make these power supplies well suited of standard features including wide
voltage range from 3.3-24V, this series for a range of consumer, industrial and output voltage adjustment range,
offers a temperature range of -40°C to ITE applications. auxiliary power rails and a high
+70°C. transient capability.
• 6W to 550W
• Universal Input: 85-305VAC/ • Industry standard footprints • Input voltage range of 90-264 VAC
100-430VDC • Efficiency up to 94% • Efficiency up to 95%
• Operating temperature range: • ITE safety certifications • No system fan requirements up to
-40°C to +70°C • Power densities up to 30 W/in. 3 450W up to 50°C
• High isolation voltage: 4,000VAC • Low no-load power consumption • 300 LFM forced air-cooling for 650W
• Regulated output; Low ripple and • Operating temperatures, from at 50°C
noise: 100mVp-p, max. -40°C to 70°C • Certified to EN 60960 and IEC 60601
• Output short circuit, over-current, • Isolation of 4,000 VA 3rd Edition medical standards
over-voltage protection • Safety approval to UL/cUL/IEC/
• Input voltage: 85-305VAC CUI EN 62368-1 (60950-1), TUV IEC/EN
• Output voltage: 3.3V, 5V, 9V, 12V, www.cui.com 60335-1 & CE Marking
15V, 24V
Murata Power Solutions
Aimtec www.murata-ps.com
www.aimtec.com

DATASHEET URLS:
Aimtec www.aimtec.com/site/Aimtec/files/Datasheet/HighResolution/amel5-277nz.pdf
CUI www.cui.com/open-frame-ac-dc-power-supplies
Murata Power Solutions www.murata-ps.com/datasheet?/data/acdcsupplies/pqu650.pdf
44 CIRCUIT CELLAR • MARCH 2020 #356

Industrial Power Supplies

High Isolation AC-DC Modules 4,080W Supply Operates from 3 Phase 5kW AC-DC Supply is
DATASHEET

for Industrial Automation Delta and Wye Inputs Software Configurable

The RAC04-K/277 series from The TDK-Lambda brand TPS4000-24 XP Power’s CMP250 is a series of
RECOM delivers 4W of continuous power supply extends the TDK’s existing high peak-power AC-DC power supply
output power (6W peak) in harsh 3000W rated TPS series. Delivering up units developed to support a wide
industrial and household environments. to 4080W output power (24V at 170A) range of healthcare, industrial and
These modules deliver full load output in a 2U high package, the TPS series IT applications. With a highly flexible
power from -40°C to 75°C across the operates from a wide range Delta or combination of electrical and thermal
entire input range of 80VAC to 305VAC Wye 350-528VAC 3-phase phase input. characteristics, these power supplies
and are certified for operation with This industrial power supply is well deliver up to 500W of peak power for
power derating up to 90°C air ambient. suited for use in many applications up to 60 seconds, as well as providing
They have international safety and EMC including test and measurement up to 250W of continuous convection-
certifications for industrial, domestic, equipment, semiconductor fabrication, cooled power.
ITE and household applications additive manufacturing, printers,
lasers and RF power amplifiers. The • 250W convection-cooled rating
• 80-305VAC input voltage range high voltage, three-phase input avoids • 500W peak power
• 150% peak power capability the requirement for costly step-down • IT and medical safety (BF) approvals
• Wide temperature range: transformers and assists phase load • U Channel 4"×7.5" package
-40°C to +90°C current balancing. • 80-300VAC input voltage
• No load power consumption • 5V/1.5A Standby and 12 V/0.6A
<150mW • 400/440/480VAC (nominal) 3-phase auxiliary
• Household and ITE certified Delta or Wye • AC OK signal, inhibit
• 4kVAC insulation • Voltage and current programming • Current share
• Operating altitude up to 5,000 • -40°C (start up) to +70°C operation
meters • PMBus communication XP Power
• 92% typical efficiency www.xppower.com
RECOM • Built in ORing FETs and Active I
www.recom-power.com share for parallel operation

TDK-Lambda Americas
www.us.tdk-lambda.com

DATASHEET URLS:
RECOM www.recom-power.com/pdf/Powerline_AC-DC/RAC04-K_277.pdf
TDK-Lambda www.us.tdk-lambda.com/ftp/Specs/tps4000.pdf
XP Power www.xppower.com/product/CMP250-Series
M a k e y o u r c o d e e v e n f a s t e r, s m a l l e r, a n d s m a r t e r
w h i l e e n s u r i n g ro b u s t n e s s a n d h i g h q u a l i t y.

for RISC-V

Are you ready


for the next
level?
A s t h e o n l y c o m m e r c i a l t o o l s v e n d o r, I A R S y s t e m s i s a b l e t o p r o v i d e
stable and future-proof technology as well as global technical support.
We a re s p e c i a l i st s o n e m b e d d e d d e v e l o p m e n t a n d h e l p c u s t o m e rs w h e n
t h e y n e e d i t t h e m o s t , e n a b l i n g t h e m t o m a ke t h e p ro d u c t s o f t o d a y a n d
t h e i n n o v a t i o n s o f t o m o r row.

We t a ke R I S C - V t o t h e n ex t leve l .

Sign up now for your free evaluation license!

www.iar.com
46 CIRCUIT CELLAR • MARCH 2020 #356

Embedded System Essentials

USB Attacks and More with


GreatFET
Facedancer Fun

By
FIGURE 1
Colin O’Flynn Photo of the GreatFET One main board
COLUMNS

A new open-source hardware tool has been released, called the


GreatFET. It can be used for a variety of purposes, including
performing all sorts of low-level work on the USB protocol. Beyond
just raw USB, it also works as an interface for SPI, UART, I2C and
other protocols. In this article, Colin discusses how you can get
started using the tool.

I/O Header Pins

Cortex
M0
Cortex
M4
T his month I’m looking at a new(ish) open-source
tool useful for embedded security research. This
particular tool is called GreatFET One, and is made
by Great Scott Gadgets. The main board is shown
in Figure 1. You might be more familiar with this company—or
its founder Michael Ossman—because it produces the popular
HackRF Software Defined Radio (SDR).
GreatFET is an extension of a tool started by Travis
USB1 USB 264 KB USB USB0 Goodspeed, called the GoodFET. The original tool was an open-
SRAM source JTAG programmer for Texas Instruments (TI) MSP430
microcontrollers (MCUs). Later iterations become something
LPC4330 called Facedancer, which is used for working with USB devices.
Facedancer enabled interesting research into what happens if
a USB device misbehaves. For example, what if the USB drive
plugged into a public photo printing kiosk could exploit flaws
SPI Flash
2 MB
in the USB stack of that kiosk to take control of it?
GreatFET extends the hardware that made Facedancer
possible by having a platform that provides two USB ports
that can serve as host or device and then lots of I/O. The
general architecture of the platform is shown in Figure 2. For
FIGURE 2
The base GreatFET board has a simple architecture that allows access to many features
a general-purpose “hacking tool” you might notice there is no
of the NXP LPC4330 MCU. specific connectors in this platform such as an IR interface,
circuitcellar.com 47

a CAN interface or a SPI flash connector. The


idea of GreatFET is that “neighbors” can be self.ep_to_host = USBEndpoint(
added on top, giving this tool an ability to 3, # endpoint number
interface with almost anything out there. USBEndpoint.direction_in,
But just telling you the tool can do
USBEndpoint.transfer_type_bulk,
“anything” sounds more like a bullet-point on
USBEndpoint.sync_type_none,
a marketing slide than useful content. So, I’m
going to walk you through a few examples of USBEndpoint.usage_type_data,
specific interesting work you could accomplish 64, # max packet size
with this tool, and what to look forward to in 0, # polling interval
later firmware and software releases None # handler function
The first examples I’ll discuss are actually )
part of the Facedancer project. Facedancer
refers to the project on GitHub [1] that uses dclass = USBMassStorageClass()
the GreatFET as a backend. Much of the USB
functionality actually applies across multiple USBInterface.__init__(
devices (not just the GreatFET), but the
self,
GreatFET is one of the easier options to get if
0, # interface number
you want Facedancer functionality. Although
you can build your own GreatFET One from 0, # alternate setting
scratch—being fully open-source hardware)— dclass, # interface class: Mass Storage
it’s also available in stock worldwide if you 6, # subclass: SCSI transparent
are lazy (like me) and don’t want to build your 0x50, # protocol: bulk-only (BBB)
own. 0, # string index
verbose,

COLUMNS
USB DEVICE EMULATOR [ self.ep_from_host, self.ep_to_host ],
The GreatFET can serve as a USB emulator. descriptors
If you’ve done USB development you know )
that getting a simple USB device up—such as
a serial port, USB mass storage or similar—
often requires diving into the specific USB stack LISTING 1
on the MCU you are using. With Facedancer, All the USB configuration is done via Python, giving total flexibility into even the endpoint configuration, for
example.
this is all done through Python instead. You
can easily change the functionality of the USB
device you are emulating using just simple
high-level Python changes. Check USB
An example of a snippet of the Drive Image
mass storage configuration is shown in
Listing 1. You’ll notice things like the size of
USB endpoints and what happens on reads
or writes is all configured over Python.
Having such a flexible USB device has many
uses. You’ll find it useful for embedded No
Abort Validation OK?
research (what if we request too much
data?) Meanwhile, as a developer, you’ll
find it useful for validating whether you’ve
properly handled invalid conditions. Yes
You can also use the USB emulator to
serve as a “magic device type” to give new
functionality to old equipment. For example, Copy Image to
some test equipment added USB support for FLASH
saving data files to USB drives. The first problem
is sometimes old devices only work with smaller
drives, which can be hard to find now. Luckily
you can emulate those old drives with GreatFET
and not worry about such problems. The second
Boot New Image
issue is you might want to be logging that
data onto a network instead, and maybe the
device has no network interface. With GreatFET
you can now emulate a mass storage device, FIGURE 3
while, in reality, the data is getting saved to a A device receiving a new firmware file by a USB flash drive can be attacked. This is done by emulating the
network-accessible location. flash drive to swap the firmware file to a malicious version after the original version passes validation checks.
48 CIRCUIT CELLAR • MARCH 2020 #356

USB emulation can serve all kinds of other


useful tasks too. You can emulate a USB
keyboard to send boot sequence commands
to a headless computer, or emulate a USB
mouse to prevent a device from going to
sleep.
Just telling you how you can use USB
emulation to keep your old test equipment
working wouldn’t fit the scope of this article.
Don’t worry, there is lots of security-focused
uses as well. A great overview of them was
given in a presentation by Dominic Spill &
Kate Temkin called “Opening Black Box
Systems with GreatFET + Facedancer” [2].
One cool example from this is a device that
did a firmware update over USB. The logic
for the host device (the target of the attack)
is shown in Figure 3. You can see the logic
reads the file, validates a signature and then
if the signature passes, flashes that firmware
FIGURE 4
USB Wallet attached to the GreatFET One, where the GreatFET One is working as a USB host.
into the device. But in the process, it re-reads
the firmware from the USB drive!
Because we’re emulating the USB drive,
it’s trivial for us to swap out the legitimate
firmware for something nefarious. Now
COLUMNS

from facedancer import FacedancerUSBHostApp

# Enumerate and configure the attached device.


u = FacedancerUSBHostApp(verbose=3)
u.initialize_device(assign_address=1, apply_configuration=1)

# At this point, we can perform whatever communications we need to to use the target device.
# Usually, this is accomplsihed using the send_on_endpoint and read_from_endpoint functions
# for non-control requests, and the control_request_in and control_request out functions
# for control requests.

# Print the device state.


print(“Device initialized: “)
print(“\tDevice is: {}”.format(“Connected” if u.device_is_connected() else “Disconnected”))
print(“\tDevice speed: {}”.format(u.current_device_speed(as_string=True)))

# Print information about the attached device...


print(“Attached device: {}”.format(u.get_device_descriptor()))

# .. and its configuration.


configuration = u.get_configuration_descriptor()
print(“Using first configuration: {}”.format(configuration))

for interface in configuration.interfaces:


print(“\t - {}”.format(interface))

for endpoint in interface.endpoints:


print(“\t\t - {}”.format(endpoint))

LISTING 2
A simple example of configuring GreatFET as a USB host device using the Facedancer project
circuitcellar.com 49

the device thinks the firmware will be OK, USB device connected to a target computer
and flashes it onto the system. If no more and as a USB host stack driving a target
verification is done on boot, the device will device.
boot the incorrect firmware. Because the GreatFET is a complete USB
stack, you can do more than just modify
USB INTERPOSER AND HOST specific packets in-flight. You can interject
Another unique feature of GreatFET is its completely new requests to either the device
ability to serve as a USB interposer. Remember or host, or block certain requests. When
PhyWhisperer-USB that I described in my evaluating security tokens, this can be useful
column in Circuit Cellar 352 (November 2019) since you can modify requests in-flight, or
that could sniff USB traffic? Rather than just even forward requests from one device to
doing that, you can use GreatFET as both a another device.

Using GreatDancer Host backend.


Device initialized:
Device is: Connected
Device speed: Full speed

Attached device: <USBDevice object; vid=0x1209, pid=0x53c0>


Using first configuration: <USBConfiguration index=1 num_interfaces=1 attributes=0x80 max_power=100mA>
- <USBInterface number=0 alternate=0 class=class 255 subclass=0 protocol=0 string_index=0 endpoints=[1, 1]>
- <USBEndpoint number=1 direction=IN transfer_type=3 sync_type=0 usage_type=0 max_packet_size=64 interval=1ms>

COLUMNS
- <USBEndpoint number=1 direction=OUT transfer_type=3 sync_type=0 usage_type=0 max_packet_size=64 interval=1ms>

LISTING 3
The output of running Listing 2 with a Trezor USB wallet attached in bootloader mode is shown here.
50 CIRCUIT CELLAR • MARCH 2020 #356

In the previous example of attacking the


$ gf shell firmware from Figure 3, the interposer mode
In [1]: gf.spi.transmit([0x9F, 0xFF, 0xFF, 0xFF]) would let us confirm that the USB firmware is
read twice in a row. We could then potentially
LISTING 4 even interject our own malicious firmware for
A few lines of Python are sufficient to read the device ID of an attached SPI flash memory. the second read.
Of course, we can also use the GreatFET
USB host to send specific commands to the
target device. This requires a micro USB
OTG cable adapter to change the micro USB
connector on the GreatFET into the more
common “Female A” connector. With that,
you can plug any standard USB device into
the GreatFET. In Figure 4, I’m working on the
Trezor Wallet that I featured in my column in
Circuit Cellar 346 (May 2019). I’m using it as a
basic sanity check for the built-in host script
shown running in Listing 2, which prints
the expected VID/PID pair and additional
information. The output of this script is given
in Listing 3. Using the GreatFET is a perfect
way to trigger the type of fault injection
attacks I talked about in my May 2019 column,
because it provides you total control of what
is sent to the device.
COLUMNS

CLASSES AND VERBS


If you check out the GreatFET
documentation, you’ll find out it has the idea
of classes and verbs. Different functionality is
encapsulated in a class, and within the class it
has various capabilities (verbs). The previous
examples would fall into a few different USB
classes such as greatdancer or usbhost.
Sometimes those classes are easier to use
with some higher-level support, such as the
Facedancer control logic I used, but many of
the classes can be easily used directly.
There is a lot you can do here from
working with a SPI flash device (spi_
flash), toggling some GPIO pins (gpio),
working as a quick logic analyzer (logic_
analyzer) and talking to some peripheral
devices (spi and i2c). There’s a lot of other
features like working as a serial UART cable,
analog measurements and programming
MSP430 MCUs with JTAG, for example. Again,
the entire project is fully open source, so it
FIGURE 5
Attaching to a SPI flash chip on-board an IoT device
can be extended to support new devices and
protocols relatively easily.
A simple example of talking to an SPI
peripheral is shown in Listing 4. In this
example, I’m using the greatfet shell
command to give me an interactive Python
console, and reading the ID of an attached
Additional materials from the author are available at:
SPI flash by sending the 0x9F command,
www.circuitcellar.com/article-materials
using the hardware setup shown in Figure 5.
RESOURCES Note here I’m connected to an in-circuit SPI
Great Scott Gadgets | www.greatscottgadgets.com flash device, which requires me to hold the
NXP Semiconductors | www.nxp.com MCU on the target board in reset. Otherwise
Texas Instruments | www.ti.com the MCU on the target board might also try
to exercise some of the I/O lines!
circuitcellar.com 51

FPGA Boards from JAPAN


SAVING COST=TIME with readily available FPGA boards
One trick up the GreatFET sleeve is provided by the
LPC4330 parallel data capture feature. This feature allows Basic and simple features, single power supply operation
NXP Semiconductors’ LPC4330 MCU to capture parallel data Free download technical documents before purchasing

L ACM-031
INTEMAX
on a bus interface and write it directly into internal memory—
and thus download over USB as well. This feature is used to
provide a simple logic analyzer that can run alongside other
commands. 10 U169 FPGA board
This means that, with a single GreatFET device, I could
sniff the SPI traffic on a logic analyzer along with performing 5V I/O support
the actual SPI data transactions. This requires wiring the
SPI data lines to the SGPIOn pins, which I can then use the
logic_analyzer backend to record data with.
The parallel data capture feature allows a lot of interesting
future use cases. For example, an extremely low-cost USB
sniffer is possible since you could actually record low/full-speed
USB 2.0 traffic! This would be similar to the architecture of
the PhyWhisperer-USB I presented in November 2019, except
without the FPGA—which is the most expensive component.
Kate Temkin already has a beta of a neighbor (add-on board)
called Rhododendron that provides this feature to GreatFET.
Keep an eye out for its full release.

FIRST HOUSE ON THE BLOCK


GreatFET is still a relatively new project, so you might find SIZE : 3.386" x 2.126" (86 x 54 mm)
many features aren’t yet well documented. You’ll also notice
ACM-031 is an FPGA board with

COLUMNS
there are many planned neighbors (add-on boards), with only
a few in active release currently. Keep an eye out for the Intel high-performance FPGA MAX 10.
rest of 2020 as this project continues to evolve. But if the It's compact and very simple.
examples I’ve talked about in this article sound interesting,
5V single power supply operation.
I suggest trying to dive into it now and see how you can use

INX XCM-026
XILSpartan-7
GreatFET. The hardware itself has been finalized for some
time, so being the first house on the block might just mean
waiting for updated firmware and documentation to perform
the task you need—or even adding the feature yourself. And FGGA484 FPGA board
as new neighbors move in, you’ll just continue to get more
functionality! 5V I/O support
While I don’t discuss a lot of generic tools in this column,
GreatFET has some unique features. It even allows you to
more directly explore USB commands. This type of tool is
useful for both development and usage of USB stacks (both
host and device side), along with security testing of your
USB products. You can also see the link back to a few of my
previous articles, and how the GreatFET functionality would
have simplified the projects I presented.
Hopefully you found some of these examples useful, and it
gave you some ideas for what you might be able to do with
this new open-source tool. Happy hacking!

ABOUT THE AUTHOR SIZE : 3.386" x 2.126" (86 x 54 mm)


Colin O’Flynn (colin@oflynn.
com) has been building and XCM-026 is an FPGA board with
breaking electronic devices Xilinx high-performance FPGA Spartan-7.
for many years. He is an It's compact and very simple.
assistant professor at Dalhousie 5V single power supply operation.
University, and also CTO of
NewAE Technology both based in See all our products, A/D D/A conversion board,
Halifax, NS, Canada. Some of his boards with USB chip from FTDI and accessories at :
work is posted on his website at
www.colinoflynn.com. www2.hdl.co.jp/CC20C
52 CIRCUIT CELLAR • MARCH 2020 #356

The Consummate Engineer

Redefining the Kilogram


From Metal to Math
It may surprise you to learn that
within the past couple years it was
discovered that the kilogram isn’t
quite what it used to be. When the
International Bureau of Weights and
Measures in Paris measured the
reference unit for the kilogram, they
discovered it lost approximately 50
millionths of a gram. In this article,
George discusses the background of
this story, and reports on efforts last
year by scientific teams—in more
than a dozen countries—to redefine
COLUMNS

the kilogram.

By
George Novacek

FIGURE 1
Kibble Scale by Jennifer Lauren Lee, for the U.S. National Institute of Standards and Technology (NIST).

T he International System of Units (SI) also known


as the metric system relies on precise definitions
of several physical measurements, such as
the mass. I have addressed some aspects and
the relationship of mass and weight in detail in my article
Measuring Acceleration in Circuit Cellar 332, March 2018).
used in nano or astronomical measurements. Consequently,
the International Committee for Weights and Measures came
to the conclusion that the kilogram—just as well as all the
other International System Units—should be defined on
immutable natural constants rather than a physical object—a
chunk of Platinum in our case.
As the reference, the International Prototype of the But here came a challenge. The mass, one kilogram in
Kilogram, IPK, also known as “le Grand K,” was created in our case, can be defied in nature by Planck’s constant (h),
1889 from a block of Platinum and since then has been kept which is a proportional value describing the ratio between
in Paris under three glass bell jars [2]. Exact replicas have the energy in one quantum of electromagnetic radiation—in
been constructed and located around the world to be used in other words, a photon—and the frequency of its associated
defining mass of everything. Including countries, such as the electromagnetic wave. However, for the Planck’s constant “h”
United States, where an imperial and customary systems of to be useful for the definition of the mass of one kilogram, the
units are in commercial use. International Committee for Weights and Measures stipulated
In 2018—at the International Bureau of Weights and that three separate test measurements of the mass must be
Measures in Paris—when le Grand K was checked by the performed and the results agree within an infinitesimal level
alpha metrologists and the results compared with the of uncertainty. That was a very tall order.
measurements of some of its sister replicas it was, to great
surprise, discovered that it lost approximately 50 millionths KIBBLE BALANCE
of a gram. In fact, all the replicas drifted, microscopically, in A British inventor named Bryan Kibble proposed a design
one direction or another. known today as the Kibble balance—also known as the Kibble
This may not be a big deal in commercial use, but such Scale or Watt balance (Figure 1). However, the principle is not
discrepancies add up quickly to unacceptable errors when new. As early as the 1920s, scientists measured mass (weight)
circuitcellar.com 53

using the so-called ampere balance—the


precursor of the Kibble balance. The principle This is a news item posted on Laboratory News on May 20, 2019:
of the operation lies in suspending the mass
to be measured in a magnetic field created Science Says Goodbye to the Original Kilogram
by an electric coil. Knowing the voltage As of World Metrology Day [today] (Monday, May 20), redefined standards
across the coil and the precisely measured of the International System of Measurement (SI) means a kilogram is now
current, the mass became proportional to expressed in terms of fundamental constants that can be observed in the
the power consumed by coil in Watts. For natural world, rather than a physical object.
the better accuracy required, power would The changes, voted on by global representatives last November (2018),
be integrated over some time, making the will ensure the kilogram remains stable and will enable more accurate mass
mass proportional to the consumed energy. measurements in the future.
As a result, the determined mass could be Dr Ian Robinson at the National Physical Laboratory, said: “There will be
expressed in purely electrical terms—that no change to the mass scale currently used in trade and industry, but by
is, by purely mathematically determined SI using a universal constant of nature to ensure the long term stability of the
units. kilogram, we are both reunifying the SI and setting the stage for robust,
While the theory is enticing, the scale’s reliable science that could pave the way for new ideas and inventions.”
accuracy depends on its ability to define the The definition of kilogram will now be based on the Planck constant,
Planck’s constant with sufficient precision. a constant observed in the natural world that is inherently stable. It uses
That drove the decision to define the constant the Kibble Balance, a physical instrument that measures mass using
in terms of power multiplied by time. electromagnetic and quantum techniques.
Nevertheless, until recently, the best results Since 1889, the kilogram has been defined by the International Prototype
provided the uncertainty of about 70 parts of the Kilogram (IPK), a metal block made of an alloy of 90% platinum and
per billion (ppb). This was not acceptable to 10% iridium, contained within glass bells in a vault in Saint-Cloud, France.
the International Committee for Weights and Different countries have used their own prototype kilograms that were
Measures as accurate enough, so the search calibrated back to the IPK, to ensure mass measurements were consistent

COLUMNS
continued. around the world.
Scientific teams in more than a dozen However, the IPK can gain mass over time due to adsorption of
countries set off to refine the measurement atmospheric contamination onto its surface. Changes in the IPK’s mass over
results. Among them, proudly, a small team of time can be deduced by comparing it to official copies, but this process is
Canadian scientists at the National Research rarely undertaken and does not have the accuracy of the new standard.
Council (NRC) in Ottawa. With the constant Dr Richard Brown, Head of Metrology at the National Physical Laboratory,
improvement of the Kibble scale hardware as said: “The revised SI future proofs our measurement system so that we are
well as factoring in error causing influences, ready for all future technological and scientific advances such as 5G networks,
such as the fluctuating gravitational pull quantum technologies and other innovations that we are yet to imagine.”
caused by the motion of the moon, the As well as the kilogram, the Ampere will now be defined using the
presence of a few molecules of water on the elementary charge (e), a fixed value; the Kelvin will be defined using the
surface as well as some minor earthquake Boltzmann constant (kB); while the mole will be based on the Avogadro
tremors on the other side of the world, the constant (NA).
NRC team succeeded in bringing the mass
precision down to nine parts per billion.
In cooperation with the U.S. National ABOUT THE AUTHOR
Institute of Standards and the German
National Metrology Institute, the International George Novacek was a retired president
Committee for Weights and Measures voted o f a n a e ro s p a c e c o m p a ny. H e w a s a
to accept the new definition of the kilogram professional engineer with degrees in
with the official adoption scheduled for May Automation and Cybernetics. George’s
20, 2019. So, what does it mean for regular dissertation project was a design of a
folks like you and I? The good news is that the portable ECG (electrocardiograph) with
new standard is expected to last us for a long wireless interface. George contributed
time. But, more than that, those of us articles to Circuit Cellar since 1999, penning
watching our weight can sleep better knowing more than 120 articles over the years.
that as of May 20, 2019 we’ll weigh a little bit George passed away in January 2019, but
less. Infinitesimally less, to be correct, but we’ve been grateful to be able to share with
every little bit counts. you several articles he left with us to be
Editor’s Note: This article was written published, including this final piece.
by George before he passed away, over a year
ago. As a wrap-up to this story we’ve included
a sidebar with a news item “Science Says For detailed article references and additional resources go to:
Goodbye to the Original Kilogram,” posted www.circuitcellar.com/article-materials
on Laboratory News on May 20, 2019. A link
to the original story is available on Circuit References [1] through [4] as marked in the article can be
Cellar’s article materials webpage [4]. found there.
54 CIRCUIT CELLAR • MARCH 2020 #356

Picking Up Mixed Signals

Dehumidifier
Revamped for
the IoT Era
Wireless Control

When his dehumidifier stopped


working, Brian decided to take a
crack at repairing it. In this article,
he explains how dehumidifiers
function, and shares his journey as he
replaces the old control system with
a modern electronic controller. The
COLUMNS

new controller enables several IoT-era


features like Web-based control via
smartphone, efficiency monitoring FIGURE 1A
The side of the dehumidifier, showing the evaporator and
and time-of-day scheduling. condenser coils

By
Brian Millier

I ’ve been using a dehumidifier in the


finished basement of my home for more
than 25 years. Modern units are probably
more efficient than this old one, though
I haven’t investigated this. However, some
friends owning modern units have mentioned
throw out a refrigerator—or anything else
using a CFC refrigerant. You must pay an
HVAC repairman to have the Freon removed
before it will be accepted for curb-side waste
pickup. In this case, even if the Freon had
already leaked out, I would still need to pay
that their units died after only a few years. an HVAC repairman to put a sticker on the
The modern units have an electronic control unit, stating it had been drained of any CFCs.
PCB, and the average consumer is hard- One more reason to try to repair it.
pressed to get these units serviced. After removing the covers and examining
My dehumidifier stopped working late last the unit while it was running, I determined
summer. Given its age, I initially just rolled it that the evaporator coil was cooling down and
into a storage closet and let it “rest in peace.” frosting up properly. So, the Freon refrigerant
Later, when I had some spare time, I took a had not leaked out, after all. However, the
closer look at it to see what had gone wrong. compressor should have stopped running
Even after it had stopped dehumidifying, I after a good layer of frost had formed on
could hear the compressor start up when I the evaporator coil, to allow the frost to melt
plugged it in, and the fan was still working. and flow into the holding tank, and allow
I have some refrigeration repair the condenser coil to cool down. This wasn’t
experience from early in my career, and the happening—the compressor was running
above symptoms often mean that the CFC continuously, and the unit wasn’t working
refrigerant (Freon 12) has leaked out. This properly this way.
generally involves an expensive repair. Also, What component had failed will be
in our Canadian province, you can’t simply revealed later in this article. I’ll explain how
circuitcellar.com 55

a dehumidifier works. Then I’ll describe how FIGURE 1B


The compressor and circulation fan.
I replaced the old control system with a
My new controller is in the foreground.
modern electronic controller.
The new controller has several features that
weren’t present in the original dehumidifier.
Indeed, even modern units don’t have most of
these features:

1) A time-of-day scheduling function


2) An efficiency check to ensure that the
unit isn’t running when humidity and
temperature conditions are such that it is
not efficient
3) A Web-based interface that allows control/
monitor operation from a cell phone or
tablet
4) A “tank-full” alarm that beeps and
generates an email message that is sent
to a phone or computer
5) A humidity display—not just an adjustment
knob coupled to an uncalibrated mechanical
humidistat

I’ll expand upon these features later in


the article, but I’d like to mention here that

COLUMNS
my electricity provider uses time-of-day
metering. I get electricity for half-price all where it will be heated up beyond ambient
night and on weekends. Since a dehumidifier room temperature. This warmer air will then
uses a fair bit of electricity, it’s best to run be exhausted from the dehumidifier cabinet.
the unit only when the electricity is at this low Once back in the room again, this warmer,
rate. Even before I built this new controller, I drier air will mix with room air and pick up
had used an external timer (a DIY unit with some of the water vapor present in the room
an Espressif Systems’ ESP8266) on the unit, air itself. Then it gets pulled back into the
to limit its run time to nights and weekends. inlet port of the dehumidifier, and the cycle
repeats.
REFRIGERATION-MODE This process will continue efficiently for
DEHUMIDIFIERS a while, but not indefinitely. Within a few
First, let’s look at how a dehumidifier minutes, the evaporator coil will frost up,
works. The most common dehumidifiers which is OK. However, as time passes, the
used in homes are based on the refrigeration evaporator coil would ice up completely, at
principle. I also see dehumidifiers based on which time the water-removing capacity
desiccants on Google, but I’ve never run across would diminish greatly. But before this could
any of these, personally. For the refrigeration happen, there is another thing to consider.
dehumidifier, the basic principle is that the The condenser coil is located close to
colder the air is, the less moisture it can hold. the evaporator coil. Since the refrigeration
At the left of Figure 1a is a coiled aluminum process is not 100% efficient, in practice,
evaporator. To the right is a copper condenser the condenser coil will always produce more
coil with many fins—like a car radiator. To the heat than the evaporator coil can remove.
right of that is a motor, which turns a big fan. Therefore, the heat from the condenser
It isn’t visible in Figure 1a, but can be seen coil will eventually work its way over to the
in Figure 1b, along with the compressor that evaporator coil, thus cancelling out any
powers the refrigeration process. cooling effect that it originally had. This will
Room air is drawn into the dehumidifier by happen even though the fan is pulling the
the fan, passing first through the evaporator hot condenser air away from the evaporator
coil, and then through the condenser coil. coil. You would see the effect if you tried to
The evaporator coil gets cooled down to operate a window air conditioner indoors,
around 0°C. Water vapor will condense out without it being mounted in a window—which
of the air when it flows past the evaporator places the condenser coil outside where it can
coil, and will either condense on the coil and dissipate its heat.
drip down into the storage tank below, or it In my old dehumidifier—with its simple
will produce frost. This cooler, drier air will control system—a thermostat is mounted on
now pass through the warm condenser coil, the evaporator coil. After the unit has been
56 CIRCUIT CELLAR • MARCH 2020 #356

FIGURE 2
Screen capture of the controller’s
webpage. The time-slot matrix is in
the center, and the other parameters
are displayed below and above it.
COLUMNS

running for a while, the evaporator coil gets involved a lot of programming. In contrast,
cold enough to trip the thermostat off. Any I had already written a Web-based control/
frost present on the coil melts and drips into monitoring program for my home’s air
the storage tank. In the time it takes for the exchanger (Heat Recovery Ventilator) that ran
evaporator coil to warm up enough for the on Espressif Systems’ ESP32 microcontroller
thermostat to close again, the condenser (MCU). This program was written and
coil will cool back down to around ambient programmed into the MCU using the Arduino
temperature. When the thermostat closes IDE. Being Web-based, it didn’t require a
again, the cycle will repeat. custom app on the iPhone/iPad, just a Web
It turned out that the thermostat in my old browser. Both projects called for a Web-based
dehumidifier was stuck in the closed position. interface that displayed 24-hour time slots
Therefore, the compressor ran indefinitely, configured by the user, along with several
but the dehumidification process stopped other similar control parameters. Figure 2
working after the first 5 minutes or so. is a screen capture of the unit’s Web page,
While I likely could have found a replacement showing the time-slot matrix in the middle.
thermostat, I decided to design an electronic The hardware requirements for this
controller that would not only control the project were such that the less-expensive
compressor/fan, but also implement the ESP8266 would work just as well as an ESP32.
added features mentioned in the first section Adapting my ESP32-based air exchanger
of this article. This was an attractive option control program to this project wasn’t overly
for me, as I have done several IoT projects difficult. Programming for either Espressif
lately, and this seemed a good fit for IoT. device is very similar, though you must
include different libraries in some cases.
THE CONTROL ELECTRONICS The sensors that I needed for the project
I wanted the dehumidifier to be controlled are itemized as follow:
wirelessly, and I figured that the control
program, itself, wouldn’t be too involved. 1) Humidity sensor. I am using a Silicon Labs
I considered using Bluetooth LE, but the Si7021 humidity/temperature sensor. It’s
control app for my phone or iPad would have inexpensive, uses the I2C interface, and
there is an Arduino library for it.
2) Evaporator temperature sensor. This is
what replaces the mechanical thermostat
ABOUT THE AUTHOR found in the original dehumidifier. I chose
Brian Millier runs Computer Interface Consultants. He was an instrumentation a simple 10kΩ thermistor, which can be
engineer in the Department of Chemistry at Dalhousie University measured using the single ADC input on
(Halifax, NS, Canada) for 29 years. the ESP8266. You can see it attached to
the evaporator in Figure 1a.
circuitcellar.com 57

3) “Tank-full” sensor. This condition in the fan shut off when the tank is full—even if the
dehumidifier was handled by a float ESP8266 happened to get “hung.”
coupled to a SPDT microswitch. I stuck The N.C. contacts of the switch contacts are
with this design and monitored the switch monitored by ESP8266’s GPIO12, allowing the
state with a GPIO pin on the ESP8266. processor to know when the tank is full (when
GPIO12 is LOW). It responds to this condition
For control, I used the following: by removing drive to the two relays—double
redundancy, since it’s also handled by the
1) To switch the compressor on/off I used float switch, itself, as mentioned earlier. It
a small but high-current capacity TE also sends out a packet to the IFTTT website,
Connectivity (P&B) RZF1-1A4-L005 relay. which responds to that packet by sending me
This is rated for 16A continuous duty. an email message stating that the tank is full.
2) I chose an Omron G5SB-1A4 relay for the More on this later.
fan. In the original design, the compressor When the tank is full, the program sits in
and fan were connected in parallel and a loop that produces a beep from the piezo
turned on/off simultaneously, but I every few seconds. The program no longer
did things differently here for reasons responds to incoming Wi-Fi messages trying
discussed later. to access its built-in Web server, since I
assume that either the beeping or the email
For the “tank-full” alarm condition, I message is enough to get me to go down to
added a few features. First, I added a piezo the basement to empty the tank and cycle the
buzzer, which beeps on/off every few seconds dehumidifier power off/on to restore normal
when the tank is full. The tank float switch is operation.
“activated” when the tank is not full—that is, I made the piezo alarm loud enough to be
when the float is hanging in mid-air. Therefore, noticed only in the basement or on the first

COLUMNS
the N.O. contacts of the SPDT float switch are floor of the house, but not from the bedroom
used to provide a ground return for the two on the second floor. Because the dehumidifier
2N3904 transistors (T1 and T2), which power is programmed to run at night and all-day
the fan and compressor relays, respectively. on weekends, the chances were high that
This ensures that both the compressor and the alarm would start beeping sometime at

8 9)
,-
./ ,D&
6* -D &1  2
0    G(9J@9+-+

,





 8

4AB
8?B
5

7?B
5B
<5

7
<5
4

).

&D: 2
)6

 
<5 <5 ,D+D5
  5,
6= 4@.7
 +


4 4A 4
, -
   8 4
8 8  
' ' > 
   . 1
). > ,
, - ,
)6 >, 
./ 
)-

 +  7=:
<5 > *5
  
4 8? . 8 )
   
495 7? 8)7
,'- 7%)G(
./ 012 A
34
8
 *)+ 7%
C 
8
'3
,- C ,  
576**#@ %
HI
8, 6 =1 <)@D.,
:

.5  

 ,-30 , 8-
*  7
7 1  5,
3 '3 ,-  .6
)  
5,

:

4 4
% 8 1 
6 8+ 
0D6 ,- 5,
1. 06:D 
A  ,- 7 
8 6*
4. 4 1.
3 E@8F%D.,D6
,-
'4
4.
5* 7

FIGURE 3
Schematic of the controller. The ESP8266 MCU on the Huzzah module does all the control/monitoring/Wi-Fi functions.
    &;

 %&  :
58 CIRCUIT CELLAR • MARCH 2020 #356

night, when we didn’t want to be awakened. I than a bare ESP8266 module, but it contains a
check my emails first thing in the morning, so 3.3V LDO regulator, two switches to put it into
I know if the tank is full as soon as I get up. programming mode and a few other necessary
Given the Web-based user interface, I “glue” components. More importantly, it uses
could have gotten away without any display a 0.1” pin footprint, allowing me to mount it
on the dehumidifier, itself. However, things easily on a Vector board, rather than designing
don’t always work as expected. The possibility a custom PCB.
exists that the ESP8266 might not connect Unlike the Adafruit ESP32 modules
successfully to my Wi-Fi router, or it might that I have also used, the ESP8266 Huzzah
not be able to resolve the address of the NTP doesn’t contain a USB-Serial bridge chip
server that I use to set the system’s Real-time (for programming/debugging purposes).
Clock. Possibly, the ESP8266 won’t receive Therefore, you must use a USB-Serial cable,
the time packet returned by the NTP server. such as the FTDI Serial TTL-232 USB cable
Maybe the humidity sensor isn’t responding (also sold by Adafruit) for programming/
to I 2C commands. debugging.
If any of these error conditions occur, they Figure 4 is a photo of the finished control
are displayed on a 4-digit LED display that I board. I chose a Hi-Link 5V 600 mA power
have included in the design. Other than the module, due to its small size and low price.
possible error indication, the display normally It is a switching power supply, so I added a
shows the relative humidity in the room. 2,200µF reservoir capacitor to keep the 5V
The LED display is sold by Adafruit, and it’s from dropping too much when the compressor
interfaced to the MCU via the I 2C bus (as is starts up. The 5V powers the relays and piezo
the Si7021 humidity/temperature sensor). buzzer directly. The ESP8266 Huzzah module
The ESP8266 doesn’t contain many GPIO is powered by 5V via its V+ pin. It contains its
pins, so it’s important to use I 2C peripherals own 3.3V regulator, which powers the ESP8266
COLUMNS

whenever possible. chip, itself. The LDO regulator can handle


about 250mA of external load. I power both
MODULAR SOLUTION I 2C peripherals: the Si7021 and LED display
The components mention so far, together from the Huzzah’s 3V pin (actually 3.3V). I
with other required circuitry, are shown in intentionally program the LED display at a
Figure 3. The ESP8266 device that I used is low-intensity setting (still perfectly readable),
contained on an Adafruit Huzzah ESP8266 to keep the current draw low enough for the
breakout module. It’s a bit more expensive Huzzah’s regulator to handle easily.
I recall that my dehumidifier once had a
sticker on the tank with a graph showing the
temperature/humidity range under which
the unit would work efficiently. However, that
peeled off years ago. That graph was just a
guideline. For it to be useful, you had to know
the humidity somehow and turn the unit on/off
manually.
After doing some research, I found some
data on the Internet on extraction rate
vs. temperature/humidity for a modern,
14 liter/ day dehumidifier. I’ve plotted
these data in Figure 5. While one could set
any arbitrary lower threshold for liter/day
efficiency, I decided that 5 liter per day—out
of a unit rated for 14 liter/day—would be the
lowest reasonable value. From the graph, you
can see that at 10˚C, the humidity would need
to be greater than 80% for the unit to run
efficiently. At 20°C, this drops to about 38%.
In my basement, it never exceeds 25°C, so I
don’t consider this situation.
In the ESP8266 program, whenever
the time-of-day time slot indicates that
half-price electricity is available, and the
humidity is above the user-entered setpoint,
the unit will run—but only if room conditions
FIGURE 4
Close-up of the controller. The Huzzah ESP8266 module is mounted in a socket. The black item to the right is
are in a range where the graph indicates that
the AM2320 Humidity/temperature sensor. running it is worthwhile.
circuitcellar.com 59

ESP8266 FIRMWARE Adafruit_Si7021. This class library handles


To be honest, programming the Web- the reading of the humidity/temperature
based control software for my earlier Heat data from the Si7021 sensor.
Exchanger controller project was a lot of work. WiFiServer. This class handles the
I started out designing that controller around controller’s Web-server tasks.
an Arduino Uno (Atmel (Microchip) Mega328- WiFiClient. Same as above.
based) and a Wi-Fi shield. Before I got the WiFiClientSecure. This is a secure Wi-Fi
whole Web-server stack running, I ran out
of SRAM memory space in the Mega328, and
had to start over with an Arduino Mega2560 Dehumidifier extraction rate vs. Room temperature
board. Later, I replaced that design with one 16
based on an Espressif ESP32. Having this Web- 14
server firmware already written, it meant less RH 80%
of a programming effort was needed to get 12
this project operational. 10
In order to run, the Si7021 humidity/ Extraction-
Liters ⁄ Day 8 RH 40%
temperature sensor needs Adafruit libraries
to be included in the program. A link to this 6
procedure is provided on Circuit Cellar’s
article materials webpage. 4
Here’s an overview of how the program 2
works. First, there are several classes that
must be instantiated: 0
0 5 10 15 20 25 30 35
Temperature °C
WiFiUDP. This class handles the UDP

COLUMNS
messaging to/from the NTP server. FIGURE 5
Adafruit_7segment. This class library This graph shows the extraction rate of a 14 liter/day dehumidifier at 40% and 80% humidity. The dotted red
handles the 4-character I2C LED display. line is a 5 liter/day lower threshold of efficiency that I chose to use in the controller algorithm.
60 CIRCUIT CELLAR • MARCH 2020 #356

client needed to interact with the IFTTT repeatedly until the unit is powered down.
cloud server. The loop() function contains the following
basic functions:
Next, the setup() routine runs. The
LED display is initialized and tested using an 1) Checks the water-level switch for a “tank-
“8888” display for a few seconds. All the GPIO full” condition. If full, sounds the beeper
lines are configured, and then the EEPROM and sends an IFTTT message saying that
subsystem is initialized. Connection is then the tank is full. More on IFTTT later.
made with the Wi-Fi access point. The Wi-Fi 2) Once per minute, executes the
SSID and passphrase must be defined in lines ControlLoop() function, which I’ll
48,49 of the code. Next, I start up the ESP8266 describe in more detail later.
mDNS server, which allows me to access 3) Prints out all relevant parameters/conditions
the controller from my iPad using the URL via the serial port, for debug purposes.
“esp8266.local.” Without this, I would have to 4) Checks the Wi-Fi connection, and if it has
know the actual IP address of the controller. been disrupted, shuts off the compressor/
I can set up my Wi-Fi router to assign a fixed fan and tries to re-establish it.
IP number to any device that uses DHCP, but 5) Once per hour, checks the time-slot array
it’s easier all around to just use the mDNS and determines whether the unit should
service and access the controller by name. be active or not for the next hour. Every
You don’t have to use the name “esp8266. hour, runs the DetermineEfficiency()
local.” You can assign a different name on line routine to monitor the temperature and
53 of the program. Note that the “.local” part humidity, and decides whether conditions
is not used here—it’s implied. are such that the unit can operate
Next, we must contact an NTP server efficiently (Figure 5).
(Network Time Protocol) to initialize the 6) Once per day, at 1400 hours, re-connects
COLUMNS

Real-time Clock (RTC). I’ve been stung in the to the NTP server and re-synchronizes the
past by designating the fixed IP number of a ESP8266’s RTC.
common NTP server in my program. Oddly, 7) Checks for incoming messages from a Web
the IP numbers of these large NTP servers client (initiated by the user accessing the
seem to change frequently. In this program, ESP8266.local URL in a Web-browser). If
I designate the NTP server as “time.nist.gov” found, serves up the webpage shown in
on Line 58, and use this function to get its Figure 2 (filled in with current parameters).
current IP number: Then checks for the presence of parameters
that the user may have entered into the
WiFi.hostByName(timeServer, three windows or five buttons on the page,
timeServerIP); and sets the appropriate SRAM variables.
8) Toggles a panel LED on and off- to act as a
“heartbeat” indicating that the software is
The last things done in the setup() running properly.
routine are to start up the Web server, and
access the EEPROM to load in the user-set THE CONTROL LOOP
humidity setpoint. This routine takes the humidity/
After setup, the program enters the temperature sensor readings and decides
loop() structure, where it iterates whether to activate the compressor and
fan. The humidity reading is compared to
the humidity setpoint, and if the humidity is
For detailed article references and additional resources go to: above setpoint, it activates the compressor.
www.circuitcellar.com/article-materials However, this only happens if the current
time falls into a time slot that is user-
programmed as being an active one. In my
RESOURCES case, electricity is half-price between 11 PM
Adafruit | www.adafruit.com
and 7 AM every day, so those eight time slots
are set to “active.” Alternately, if it is during
Espressif Systems | www.espressif.com the weekend (also half-price) the unit is active
FTDI | www.ftdichip.com 24 hours a day, for both days. Overriding the
above decision process, if the temperature
Hi-Link | www.hlktech.net
and humidity fall outside the efficient range
Microchip Technology | www.microchip.com (from Figure 5), the unit will not run.
For test purposes more than anything
Omron Electronic Components | www.components.omron.com
else, I include an OVERRIDE button on the
Silicon Labs | www.silabs.com webpage. This allows me to set the unit’s
TE Connectivity | www.te.com “active” status to the true state, regardless of
circuitcellar.com 61

the time of day or day of the week. I set this of 4 minutes before re-start, which is quite
override interval as 5 hours, but this can be conservative. This 4-minute interval also
changed in line 45 of the program. applies when the controller is first powered
There is one important consideration that up, even though the compressor was not likely
complicates the operation of the control-loop running in this case. However, this particular
routine. The refrigeration function of the timeout exists in case the user turns the unit
dehumidifier is performed by a compressor, off and back on quickly. It would also protect
evaporator coil, compressor coil and a the compressor in the event of a short power
pressure-reducing device. The pressure- interruption.
reducing device is merely a capillary tube. As mentioned earlier, I don’t switch the
The compressor takes the incoming Freon compressor and fan simultaneously, for a
gas, pressurizes it and pumps it through couple of reasons. First, I was a bit concerned
the condenser coil. The gas condenses in the that the starting current of the compressor
condenser coil. At the end of the condenser might be more than the P&B relay could
coil is the capillary tube, which takes the handle. I measured the compressor run
liquid Freon at high pressure, and reduces this current to be 7A, and I know from experience
pressure. This pressure reduction causes the that compressors like this draw about 4
liquid Freon to evaporate in the evaporator times this current for a fraction of a second,
coil, thereby cooling the evaporator coil. The while starting. The P&B relay can handle 16A
gas exiting from the evaporator coil returns continuously, but the datasheet didn’t actually
to the inlet port of the compressor. specify its rated surge current. Since I didn’t
want to push the compressor relay too hard, I
SIDE EFFECT decided to switch the fan separately. It draws
A side effect of this process occurs when an amp or so.
the compressor is switched off. For several Second, I believe that switching the fan

COLUMNS
minutes, the high pressure developed by and compressor separately allowed me to
the compressor will remain in the condenser improve efficiency. I didn’t see any reason for
coil, until it can slowly bleed off through the fan to be running for the first minute after
the capillary tube. The compressors used the compressor started, since it would take at
in refrigerators, A/Cs and dehumidifiers least this much time for the evaporator coil
are not designed to start up with this high to cool down. Similarly, after the compressor
“head pressure.” They will just stall out if shuts off, the coils remain cool for a few
you try to re-start them soon after they are minutes, so I leave the fan running for a
shut off. This stall condition will result in the few extra minutes. I can’t prove this is more
compressor drawing 4 to 10 times its normal efficient, but the compressor relay rating
run current. If this were allowed to persist, issue mentioned earlier enough reason to
either a circuit-breaker would trip in your implement this split-switching arrangement.
electrical entrance panel, or the compressor The error codes displayed on the LED
windings themselves would fail if it occurred display are as follows:
too frequently.
For domestic appliances, a small, Err1. Can’t find Wi-Fi access point.
cylindrical device is mounted on the side of the Err2. Can’t set up mDNS service.
compressor, next to the power inlet terminals. Err3. Can’t find NTP URL via DNS server.
These protection devices (called Klixons) Err4. Haven’t gotten time packet back from
interrupt the power to the compressor when NTP server.
either an over-current condition persists for Err5. Can’t find Si7021 Sensor after second
more than a fraction of a second—the normal I 2C scan.
motor start time—or the compressor case
itself over-heats. They are simple devices
containing a small bimetallic strip/heater, IFTTT (IF THIS, THEN THAT)
which opens a switch contact when the This project uses the IFTTT cloud server to
bimetallic strip deforms due to heat—from send an email message when the water tank is
either over-current or a hot compressor case. full. The ESP8266 is already connected to the
Even though the compressor is protected by Wi-Fi access point, and it sends out a TCP/IP
a Klixon, we want to avoid a situation where packet to a specific URL. This URL is assigned
this protection is needed, since we don’t uniquely when the user registers with IFTTT.
want high stall current flowing through the The IFTTT cloud server will respond to this
compressor relay contacts. “trigger” by:
The controller software must therefore
keep track of the time when the compressor 1) Sending a TCP/IP packet back to the
is turned off, and must wait awhile to let the Huzzah Wi-Fi module, to acknowledge
gas pressure bleed off. I chose an off time receipt of the original packet sent out
62 CIRCUIT CELLAR • MARCH 2020 #356

by the ESP8266 Huzzah module. This is profiting from all the information that its
useful during the debugging phase of the users are freely providing it, doesn’t concern
program development. me. For this project, the small amount of
2) Sending an email message indicating that “non-interesting” data that they’d get from
the dehumidifier tank is full. my dehumidifier is of no interest to me, apart
from appreciating that I am getting a very
Let’s look more closely into the IFTTT useful service for free.
cloud service available on the Internet. It’s To use IFTTT, you must visit the ifttt.
a free service, which is nice. Its primary use, com website and register. Registration is
from looking over the available applets, is to simple. You can register using your Google
allow people to associate the occurrence of or Facebook account ID. I have a Google
some Internet-based event (the “trigger”) account, so I used that. The IFTTT registration
with the generation of one or more Internet- procedure has security features to ensure
based actions (“services”). The combination that random people can’t set up IFTTT apps
of a trigger and one or more services is called in your name—assuming they knew your
an “applet.” You can either write your own Google credentials. During registration, they
applet, or merely use one of hundreds of will send you an email message which you
applets that others have written and posted must respond to properly, to verify that you
on the IFTTT website. are actually the person that is attempting to
When you visit the IFTTT website it’s set up the account. Like most websites these
immediately obvious that most of the applets days, the IFTTT website uses cookies, so when
are centered around social media such as you visit the website later, it will recognize
Facebook, Instagram and Twitter. Social you and you’ll be automatically logged in.
media are very popular these days, and the
IFTTT cloud service is also very popular. SET-UP PROCEDURE
COLUMNS

The fact IFTTT is centered on social media I am going to briefly cover the procedure
activities is why it can be a free service: the needed to set up your IFTTT applet for this
users are not really the customers, they are project. However, I did not “invent this
the product. In other words, IFTTT can make wheel” myself. I found an online tutorial that
money selling the “big data” generated by explained how to use IFTTT in detail. A link
all the social media events that are captured to the tutorial is available on Circuit Cellar’s
when they are used in the many IFTTT article materials webpage. This tutorial
applets. describes how to send SMS messages, but
I don’t use any social media sites, so sending an email is similar. I had used this
whether the big social media companies are feature about 6 months earlier in a Wi-Fi
water-leak detector, and my IFTTT applet for
that project was still working. In fact, it saved
me a bundle of money when it alerted me to
a small leak that had developed in a pipe in
my basement.
Once registered with IFTTT, search for
the email applet. You will have to enter your
email address. Here again, there is security
to ensure that some rogue individual doesn’t
write an applet that floods you with email
messages. After you enter your email address,
IFTTT will send you an email message with an
ID number that you must re-enter into the
webpage that you have just used to register
your email account.
After you have set up the action that you
want performed, you must then set up the
“trigger” that initiates it. To do this, you use
the “Webhooks” applet, so search for that.
Then press the Connect button and you will
see a screen like the one shown in Figure 6.
Notice the long URL that is displayed. (I have
hidden the last few digits of the personal ID
part at the end of this URL.) It is a template
FIGURE 6 of your personal URL at IFTTT that must
This shows a sample of the IFTTT Webhooks settings. The long alphanumeric ID string (partially redacted be accessed by the ESP8266. Note that in
because it’s my ID) must be placed in the controller firmware, as detailed in the article. my program, the first section of the URL
circuitcellar.com 63

(https://maker.ifttt.com ) is assigned to FIGURE 7


the const char* host, which is used by the
New Applet (a) To define the “trigger” for your
sclie nt.co n n e ct(h ost,httpsPor t) IFTTT applet, you press the blue
“+” icon shown here. This isn’t
routine (Line 784). The rest of the line from /

if + this then that


immediately obvious to the first-
use/ onwards must be customized for your
time user. (b) To define the “action”
applet, as described later. or service for your IFTTT applet, you
Also, note that if you hit the “Edit press the blue “+” icon.
Connection” button, it will generate a new a) Want to build your own service? Build on the platform

URL. If you have already embedded the


existing one in your program code, don’t hit

then + that
this button! It will generate a new URL, and
you can’t revert to the old one! if
You have now created a custom “service”
applet and a custom “trigger” applet. You b)

must link or “sync” the trigger and services


together in your own custom applet. To do
this, navigate to My Applets -> New Applet. the email icon, and fill out the “message box”
You will see a screen as shown in Figure 7a. as you would like the email message to read,
Here it is a bit confusing. To choose the trigger then click “Create Action.”
event, click on the blue “+” icon, search for At this point, you are basically finished
the Webhooks applet and choose “receive setting up the IFTTT service. You will see a
a web request.” You then must name this block describing your applet. Make sure that
trigger with an event name—something that you have toggled the applet ON.
is meaningful to you (and will be used later). The only thing remaining is to determine
Next, you must add the service that you the format of the message that the ESP8266

COLUMNS
want to have performed. You will see the must send to your personal IFTTT URL (as
screen shown in Figure 7b, and this time click mentioned earlier). When you are on the
on the blue “+” icon next to “that”. Search for Webhooks page, you will see a button marked
64 CIRCUIT CELLAR • MARCH 2020 #356

“Documentation.” When you click on it, you routine, at the end of the setup() function,
will see the format of the message that the it should send IFTTT the proper packet at the
ESP8266 must send. In the URL, where the custom URL, and you should receive an email
{event} appears, replace this with the event message shortly thereafter. You can also test
name that you chose earlier—when you were just the IFTTT applet alone by selecting your
configuring the Webhooks applet. You can test applet from “My Applets” and clicking the
the triggering of your applet at this point by “Check now” button.
clicking on “Test it,” after you have done the
{event} replacement. CONCLUSIONS
That line of code that you have just seen/ Where I’m located on the East coast of
edited must be inserted into the ESP8266 Canada, I don’t need to run a dehumidifier
program code for the project. If you look at until mid-summer through fall, when the hot,
the “sendITFFFmessage() routine in my humid outdoor air gets into the cool basement.
program , you will find the line: At that time, I’ll likely get mildew or mold
developing if I don’t lower the humidity.
String url = “/trigger/humidifier It was early summer when I developed the
tank full/with/key/ project and wrote this article. Even though
That’s followed by the long personal ID this dehumidifier is more than 25 years old,
string described earlier. You will have to fill in the compressor and associated refrigeration
the rest of the URL as I described above in the components—called the “sealed system” in
Document section of the Webhooks service. the trade—are still in good working condition,
When the ESP8266 program code has been so I hope that I will get many more years of
customized with your own URL, if you were to service out of it.
perform a call to the “sendIFTTTmessage() Figure 8 shows the unit with my new
controller tacked onto the front panel. While
COLUMNS

it’s not pretty, I wanted the controller on the


outside, so that its temperature/humidity
sensors would get a better sense of the
ambient air. The red LED on the right is the
“heartbeat” LED, which flashes every second,
as long as the program is executing properly.
When I started using the unit in mid-
summer, I ran into an issue with the humidity
sensing. The humidity value that was displayed
when the unit was first powered up correlated
well with two other humidity sensors in my
house. However, after the fan had been running
for 15 minutes or so, the humidity reading
would drop by about 20%. This made it useless
as a setpoint control sensor.
At first, I blamed it on the low-cost AM2320
sensor that I had originally mounted. However,
replacing that with a better Si7021 sensor
didn’t improve matters. It seems that the
strong airflow from the fan disrupts the
sensor’s ability to read properly. I am not
sure how commercial dehumidifiers handle
this issue. Possibly they just add 20% to the
readings, and control the compressor based
upon that. I decided to add 6’ of cable to the
Si7021 sensor, and placed it at that distance
from the unit. That cured the reading
discrepancy. I suspect that the AM2320
sensor would have worked fine under those
circumstances as well.

FIGURE 8
The unit with the finished controller mounted on the front panel. The red LED to the right is the “heartbeat”
LED, described in the main article text.
———————————————
RESCHEDULED 7-9 July 2020
66 CIRCUIT CELLAR • MARCH 2020 #356

From the Bench

Taking RPLIDAR Out for a Spin


(Part 1) Command Interface

RPLIDAR-A1 is 360-degree laser range scanner that uses a laser triangulation


ranging principle to calculate distance. In this article, Jeff examines this device
and its development package. He steps you through his project using RPLIDAR,
detailing his creation of a simple command interface for the device.
By

I
Jeff Bachiochi
’ve discussed LIDAR in the past, most limited—it will power up without a separate
recently in Circuit Cellar 300 (July 2015) supply. Start-up current is around 600mA, but
COLUMNS

and Circuit Cellar 301 (August 2015). If it scans at around 400mA, so most powered
you were with me back then, the $100 USB ports can handle it. Physically, the unit is
LIDAR-Lite from PulsedLight (now Garmin) about the size of your fist.
used time-of-flight to calculate distance from
a reflected laser beam. This was a single SAFETY AND SCOPE
collimated point system that could be aimed The RPLIDAR A1 system use a low-power
using servos. Today I want to discuss the (less than 5mW) modulated-pulse infrared
RPLIDAR-A1 from Slamtec, which has been laser as its light source. The laser’s short
taking the market by storm thanks to its $100 emission time frame assures Class I laser
price tag. This is a 360-degree laser range safety standards, making it safe for both
scanner that uses a laser triangulation ranging humans and pets. Although you won’t need to
principle to calculate distance. Its spinning wear special glasses to use it, you should treat
head allows it to make distance calculations it as you would any potentially dangerous
for all angles in a complete 2D plane. piece of equipment.
The RPLIDAR-A1’s development package Figure 1 gives you a good look at how this
contains the laser head, a TTL-to-USB dongle laser system is set up. Note that the motor
and connecting cables. You can plug it into your is driving the laser head with a drive belt—
PC and—as long as your USB port isn’t current similar to many old turntables or disk drives.

FIGURE 1
The RPLIDAR measures the angle
of reflection of a pulsed laser beam.
Computations of distance are made
based on the angle measured at the
receiver [1].
circuitcellar.com 67

RPLIDAR emits a modulated infrared laser the need for any brushes.
signal, which is then reflected by the object to After I gained some confidence in the
be detected. The returning signal is sampled communications, I started by running the
by a Vision Acquisition System (VSC). The serial terminal application RealTerm on my
VSC comprises an embedded DSP to process PC to invoke some of the API commands. I
the sample data and output distance and decided to talk TTL directly to my Arduino
angle values. The ranging scanner system is Mega, and set aside the dongle. The RPLIDAR
mounted on a spinning rotor with a built-in uses 115200 baud, 8N1 serial protocol, so it
angular encoding system. was easy to set up “Serial1” on the Mega for
Multiple distance scans are performed this purpose. This still leaves “Serial” console
during each rotation. The motor defaults for programming and debugging. Let’s look at
to 5.5rps, but can operate from 1-10rps.
Scans begin when requested with a single
point sample based on angle of return,
processing and communications timing. A new
sample begins only after the previous one is
completed (or times out) up to a maximum
of approximately 8,000Hz. It has accuracies
of less than 1% of the distance and greater
than 1 degree of angle. RPLIDAR-A1 (Rev5) can
measure distances up to 12m (40') and down
to 150mm (6").

COMMUNICATIONS
I mentioned earlier that the development

COLUMNS
kit included a TTL-to-USB dongle. I’ll want
to communicate via TTL, so I won’t be using
that. The designers used a 7-pin Molex
connector (#0022035075) for the TTL output
of the interface board. This is a 2.54mm (0.1")
pitch Mini-SPOX system. The interface board
just translates the separate electronics and
FIGURE 2
motor connectors into a single connector. If
I removed the cover of the spinning turret so you could see the physical parts reflected in Figure 1. The DC
you want to connect directly to those, you’ll
motor drives the turret via a rubber (O-ring) belt. There are separate connectors from the motor and the
need to use a Molex (#538-53048-0450) & turret that are combined on the interface PCB.
(#538- 53048-0310), which is a 1.25mm
(0.05") pitch PicoBlade system.
You can use the included dongle if you
wish to connect with your PC and talk to it—
using the API via a Windows application—or
simply a serial terminal program. The software
development kit that comes with it has a few
examples that will give you a head start on
using RPLIDAR, but I’m not going to use those.
I will use the API document “Interface Protocol
and Application Notes” for this discussion.
Note that in Figure 2 the protective
cap was removed from the rotating turret.
You can see the laser on the right, receiver
on the top center and the vertical circuit
board that does all of the control and
computations. The turret spins via the
belted DC motor on the left. Getting power
and communication to and from a spinning
turret is an engineering feat. You can see
evidence of the two coils that wirelessly
pass power from the stationary base to the
rotating turret in Figure 3. With the turret
circuit board removed, note the SMT (surface FIGURE 3
mount technology) devices in the center of When the Laser PCB is removed from the turret, you can see that power is transferred wirelessly, using
the hollow shaft. Communications are sent a coil on the base and a coil on the turret. A hollow shaft allows communication via a suspected infrared
via LED transmitter/receiver pair, eliminating transmitter/receiver pair.
68 CIRCUIT CELLAR • MARCH 2020 #356

TABLE 1
Requests take the form of a packet of
Start Flag Command Value Payload Size Payload Data Checksum
data. 1 byte (0xA5) 1 byte 1 byte 0-255 bytes 1 byte

TABLE 2
Responses have their own packet
Start Flag1 Start Flag2 Data Response Length Send Mode Data Type
format. 1 byte (0xA5) 1 byte (0x5A) 30 bits 2 bits 1 byte

the API offered by RPLIDAR. 01 or 1. According to the datasheet, presently


Requests take the form of a packet of data, there are only two possible Send Modes, 0 and
as shown in Table 1. The simplest is a 2-byte 1, where 0=a single packet, and 1=multiple
packet, which contains the Start byte (used packets. In this case, the response will not
in all request packets) and a Command value. stop at this response packet.
Without a payload count and payload data, The last byte is a Data Type and can be
the checksum is not required. Let’s look at a used to identify the format you will be looking
simple command like STOP. To send a STOP for in the next packet (remember 1=multiple
packet, just send the 2 bytes 0xA5 and 0x25. packets). We know that, in this case, the
If not already idle, the laser diode and the following packet will have 5 bytes. While every
measurement system will be disabled, and command uses the response packet format,
the idle state will be entered. additional packets will have a unique format
There is no response by the RPLIDAR to this (DataType) used only for this command. For
request, so it doesn’t give us any feedback. So, the SCAN command, a data packet will be sent
let’s look at the RESET command. While this after every completed scan. This will continue
command also states that it has no response, until it receives a STOP command. The format
it actually does. It’s a sign-on power-up for this packet is shown in Table 3.
COLUMNS

message (which was acknowledged by a The quality byte is a combination of the


communication with Slamtec). This command MS 6-bit value, based on the strength of
is the 2-byte sequence 0xA5 and 0x40. When the reflected sample and the lower 2 bits,
sent, RPLIDAR will respond with some ASCII which indicate if the sample is the first after
text similar to this: the 0-degree rotor position. A binary value
of “01” indicates this is the start of a new
RP LIDAR System. rotation, and “10” identifies all other samples.
The angle is bits 15:1 value, with bit 0 always
Firmware Ver 1.27 - rc8, HW Ver 5 set to “1.” The angle value is a fixed-point
combination of bits 15:8 (integer) and bits 7:1
Model: 18 (fraction) in degrees (0-359.x). The distance is
a 16-bit fixed-point combination of bits 15:2
This readable text is not the norm and (integer) and bits 1:0 (fraction) in millimeters.
does not follow the response format of any Note that a distance of “0” indicates an
of the commands that support a response. invalid measurement—probably less than the
Responses have their own packet format of minimum distance of around 150mm.
data, shown in Table 2. I’ll be tossing out any fractional values
reported and dealing with the just integers. It can
THE SCAN COMMAND be noted that samples are not taken at exactly
I found the 4-byte Data Response Length the same position on each rotation. Presently,
and Send Mode really confusing. Let’s take a there is no command to take a sample at some
look at the SCAN command to dissect this. The arbitrary angle. The system merely continues
complete response packet is as follows: 0xA5, to sample and report its present position and
0x5A, 0x05, 0x00, 0x00, 0x40, 0x81. The distance calculated. A STOP command is the
4-byte Data Response Length and Send Mode only way to halt SCAN activity.
for this command is 0x05, 0x00, 0x00, 0x40. All packets are sent at 115200 baud
First the 4-byte value is sent little-endian. without any communication handshaking.
That means the value is actually 0x40000005 This means your system must be fast enough
or in binary 01000000 00000000 00000000 to accept all the data being sent, or there will
00000101. The Data Response Length is be a loss of sync. There seems to be no way to
the last 30 bits of this—000000 00000000 resync the data, since scan data has no sync
0000000 00000101—or just 101 = 5. The most byte, as with a request and response packet.
significant (MS) 2 bits of the 32-bit value is
API COMMANDS
Table 4 is a complete list of the functions
TABLE 3 Quality Angle Distance
Data packet format for the SCAN
available. You’ll mainly be interested in the
command
1 byte 2 bytes 2 bytes first three commands. The last four commands
circuitcellar.com 69

Request Name Value Payload Response Mode RPLIDAR Operation


STOP 0x25 N/A No response Exit the current state and enter the idle state
RESET 0x40 N/A No response Reset (reboot) the RPLIDAR core
SCAN 0x20 N/A Multiple response Enter the scanning state
EXPRESS_SCAN 0x82 YES Multiple response Enter the scanning state and working at the highest speed
Enter the scanning state and force data output without
FORCE_SCAN 0x21 N/A Multiple response
checking rotation speed
GET_INFO 0x50 N/A Single response Send out the device info (for example, serial number)
GET_HEALTH 0x52 N/A Single response Send out the device health info
GET_SAMPLERATE 0x59 N/A Single response Send out single sampling time
GET_LIDAR_CONF 0x84 YES Single response Get LIDAR configuration

TABLE 4
Each of these commands uses the same request and response formats. The format for the data packet that follows the response (if any) will be specific to each command.

will give you some feedback on the operation FIGURE 4


of the system. The express scan is a way to The interconnections from the 7-pin
send data more quickly by compressing it and RPLIDAR connector can be separated
back into their individual controls,
communicating using larger chunks. Each of
motor and serial. I’m using Serial1
these commands uses the same request and
on the Arduino Mega, so the console
response formats. The format for the data

COLUMNS
port serial can still be used. The motor
packet that follows the response (if any) will control comes from a digital I/O pin
be specific to each command. (3), which can turn ON/OFF the motor.
An Arduino library for the RPLIDAR [2]
contains several example programs, and I will
not be using that here. Instead, I want the
communication to be more visible to you, so
that you can customize it to your individual
requirements. The 7-wire connection to my
Arduino Mega is shown in Figure 4. It is a
straightforward 5V TTL interface with Serial1 of
the Mega. The motor control line is connected
to a digital pin to turn the motor ON or OFF.
My primary interest is to give the user a
way of exploring all the API commands. This
is accomplished via a serial terminal program
connected to the Arduino via the standard
USB Serial port. The first order of business
was to decide on using a two-letter command
format. It’s always a good idea to give the user
help on what commands are supported. This
is done through a menu that will be displayed RP Lidar 2-Letter Menu
by sending a “?.” Most commands begin with SCan
INfo
the first two letters of the command, but due
DAta
to limitations of using only two letters, the Clear Path
menu shows all the commands, and capitalizes Object Path
those used for the command. Sub Menu
The SCAN command is therefore displayed 2-Letter plus ‘=’ and a value
as “SCan” meaning for a user to type in “S” and Angle Left of center=? (0-180), presently aaa
“C” followed by a <CR> (carriage return). I’ll use Angle Right of center=? (0-180), presently aaa
that convention from here forward in the article Distance miN (mm)=? (100-150), presently ddddd
when I mention commands. The last command Distance maX (m)=? (0-15), presently dddddd
in Table 4 is “GET_LIDAR_CONF” and it has ? this menu
configuration values that can be requested. One
is the maximum distance of the scanning mode. LISTING 1
The menu item displayed for that command is Because the menu is displayed as a list, I wanted to give priority to those commands that are more useful
“maX Distance” which indicates the two-letter by splitting this into a main menu and a sub menu.
command is “XD.” Should a command require The main menu is shown here, with the sub menu shown in Listing 2.
70 CIRCUIT CELLAR • MARCH 2020 #356

a value, its menu item is displayed with an being restricted in any way. I’ll be using this
appended “=?” which suggests the command function for both the console (Serial) and
format will be two letters followed by the equal the RPLIDAR (Serial1). Note that an UNO
sign, a decimal value and <CR>. could be used, but since communication with
the RPLIDAR is the highest priority, it should
SERIAL EVENT be connected to Serial and a software serial
A special function, SerialEvent can routine could be implemented for console I/O.
be used with receiving serial data. It is Initial testing was accomplished by hand
not actually an interrupt, but will be called assembling the API-required data packet
once every time through the loop function, for each of the API’s commands I sent using
so it is dependent on the loop timing not Real Term. Constructing a more friendly
user interface seemed appropriate, because
I wanted to off load as much of the work as
RP Lidar 2-Letter Sub Menu possible. Because the menu is displayed as a
REset list, I wanted to give priority to those commands
STop that are more useful by splitting this into a main
HEalth menu (Listing 1) and a sub menu (Listing 2).
Sample Rate You’ll notice that most of the informational
Mode Count commands are on the sub menu, which is
maX Distance
available with the “SM” command. Meanwhile,
Answer Type
Time per Sample commands that may be used frequently are
Mode Typical on the main menu and are available with the
Mode Name “?” command. You also may have noticed
2-Letter plus ‘=’ and a value some other commands that don’t seem to be
ID=? (0-2), presently # part of the RPLIDAR’s API. We’ll get to them
COLUMNS

RPm=? (0-255 later. But first let’s see what happens when a
? main menu command is entered.
User input commands are expected to end
LISTING 2 with a <CR>, so serialEvent() gathers
Sub menu of commands user input into the userInput[] array. The
first character is saved as userCommand
and the second character is saved as
void loop()
{ userSubCommand. These variables are
if(userCommand) initially set to “0” so the main loop() has
{ nothing to do unless a command has been
switch (userCommand) received, which alters those variables. Should
{ a third character in the userInput[] array
... be the equal character “=”, an integer value
case ‘S’: is expected before the <CR>. I wanted a way
switch (userSubCommand) to set some parameters, even though the
{ RPLIDAR APIs don’t require data input (for
case ‘C’: // SCan
the most part). Anyway, this integer value is
rplidarScan();
flushCommand(); saved as the commandValue.
break; So, let us assume the “SC” command was
... entered, therefore userCommand = S and
default: userSubCommand = C. In the main loop(),
flushCommand(); there are only two things to do—execute some
break; code when the userCommand <> 0 (user has
} input a command), and responseCommand
… <> 0 (RPLIDAR has responded to a request).
default: We have not yet discussed gathering
flushCommand();
RPLIDAR’s responses via serial1Event(),
break;
} so let’s continue with the SC command.
} Using the Arduino’s switch/case
if(responseCommand) function, we can zero in on the SC command
{ (Listing 3). Here switch is based on
userCommand, and so execution will look for
} the case “S.” Execution branches to the code at
} case S and this has a secondary switch/case
function based on the userSubCommand.
LISTING 3 Again, execution branches to the code at
Code for the “SCan” command case C. We now execute any code for the
circuitcellar.com 71

scan command requested by the user. incorrectly, because there is no indication that
The rplidarScan() routine will begin a this has happened. This means that you must
scan. This action can only be interrupted by a be absolutely sure to handle everything that
STop command as it continuously repeats its is sent. Using an Arduino has its limitations.
scan routine. The scan routine sends out laser Once started, I want to be sure I spend all my
pulses and looks for a return of the reflected time handling this function, so as not to cause
pulses up to its maximum flight time. If the any delay in this process. The rplidarScan()
pulses are returned, then a distance is calculated function has two components: start the scan
and the present rotation angle and distance are and turn on the motor.
sent out as a 5-byte packet. This repeats ad
nauseam and is the subject of a gotcha. Serial1.write(0xA5);
There is no flow control and the 5-byte Serial1.write(0x20);
packet has no absolute unique byte that can digitalWrite(RPLIDAR_MOTOR, true);
be used to sync the data. That means that
if you can’t take the data as fast as they The userCommand is then set to ‘0’ using
are sent, you will lose data and become un- the flushCommand() routine. And we can
synced. You might continue to interpret data begin to look for an RPLIDAR response.

void serialEvent1()
{
while (Serial1.available())
{
switch (mode)
{

COLUMNS
case 3
while(Serial1.available() > 4)
{
Serial1.readBytes(responseDescriptor, 5);
quality = responseDescriptor[0];
if (quality & 1)
{
scanCount++;
}
angle = ((responseDescriptor[2] * 256) +
responseDescriptor[1]) / 128;
if (angle < 0)
{
angle = angle + 512;
}
distance[angle] = ((responseDescriptor[4] * 256) +
responseDescriptor[3]) >> 2;
}
if (scanCount > 2)
{
newData = true;
rplidarStop();
dataCount = 0;
for(int c=0; c<360; c++)
{
if(distance[c]>0)dataCount++;
}
Serial.println(“Data Count = “ + String(dataCount));
mode = 0;
}
break;

default:
Serial.println(“Unknown Mode:0x” +String(mode,HEX));
mode = 0;
responseCommand = 0x00;
break;
}
}
} LISTING 4
Code for the serial1Event() function
72 CIRCUIT CELLAR • MARCH 2020 #356

responseCommand = the first byte, which will be 0x71, 0x72,


SERIAL1 EVENT 0x74, 0x75, 0x7C or 0x7F. Set the mode=0. And we’re done here.
Enter the serial1Event() function (Listing 4). Once we Otherwise, we can use the first byte to determine what should
have received any characters from the Serial1 port (RPLIDAR), be done next. Because these responses all have additional packets
we want to stay in this routine until we have completed the that are custom to the request, I assign each a unique mode# and
task. The switch/case function is used here based on the handle those packets in separate routines. Each of these collect
switch variable mode. As we begin the mode=0, we look additional packet data and assign a unique responseCommand
for start byte 1 (0xA5). Receiving this byte sets the mode=1. value, before setting the mode=0 and exiting.
While mode=1, we look for start byte 2 (0x5A). Receiving this All this is pretty ordinary, ending up with the
byte sets the mode=2. This is where things begin to get tricky. responseDescriptor[] array holding RPLIDAR’s data packet
When in mode=2 we are expecting an additional 5 bytes. info, each with a unique responseCommand value used back
If the last byte = 0x20, we have a response from the special in loop(), except for responseCommand=5. This is the SCan
request 0x84, GET_LIDAR_CONF, which will have one of six command’s response. It has been reassigned a mode=3.
responses. We need to read an additional packet to determine Since RPLIDAR will be sending 5 bytes for every scan, I wait
the specifics for this request. From that packet, we can set for the buffer to have more than 4 bytes before the next 5 bytes

[plotData]
‘radius=200 pixels
‘zoom=1 maxdistance=12000
‘1 pixel=12000/200=60
print #main.graphicbox, “cls” ‘ clear the plot area
print #main.graphicbox, “color red” ‘ change the pen color
print #main.graphicbox, “goto 10 10” ‘ goto x,y coordinate
print #main.graphicbox, “down” ‘ drop pen to draw
COLUMNS

print #main.graphicbox, “\150mm” ‘ print text


print #main.graphicbox, “up” ‘ lift pen to not draw
print #main.graphicbox, “home” ‘ move to center of graphic area
print #main.graphicbox, “down”
print #main.graphicbox, “circle “;(150*zoom)/60’ plot a circle with a radius of (150*zoom)/60
print #main.graphicbox, “up”
print #main.graphicbox, “color green”
print #main.graphicbox, “goto 370 10”
print #main.graphicbox, “down”
print #main.graphicbox, “\1m”
print #main.graphicbox, “up”
print #main.graphicbox, “home”
print #main.graphicbox, “down”
print #main.graphicbox, “circle “;(1000*zoom)/60
print #main.graphicbox, “up”
print #main.graphicbox, “color blue”
print #main.graphicbox, “goto 170 10”
print #main.graphicbox, “down”
print #main.graphicbox, “\zoom=”;zoom
print #main.graphicbox, “up”
print #main.graphicbox, “home”
print #main.graphicbox, “color black”
print #main.graphicbox, “down”
print #main.graphicbox, “circle “;(70*zoom)/60
print #main.graphicbox, “up”
for a=0 to 359 ‘ do this 360times, once for each distance
print #main.graphicbox, “turn 1” ‘ rotate direction of travel CW 1 degree
print #main.graphicbox, “go “;(distance(a)*zoom)/60
print #main.graphicbox, “down”
print #main.graphicbox, “circlefilled 1”’ plot a filled circle with a radius of 1 (small dot)
print #main.graphicbox, “up”
print #main.graphicbox, “turn 180”
print #main.graphicbox, “go “;(distance(a)*zoom)/60
print #main.graphicbox, “turn 180”
next a
return

LISTING 5
Because I wanted to see the points plotted, I wrote a simple program in Liberty Basic to do this on my PC.
circuitcellar.com 73

are read into the responseDescriptor[]


array. The first byte holds the quality value
and the start bit (bit0). If bit0=1, scanCount
is incremented. Remember, this bit indicates
ABOUT THE AUTHOR
the first scan completed after the rotation has Jeff Bachiochi (pronounced BAH-key-AH-key)
reached 0 degrees. I use this to keep track of has been writing for Circuit Cellar since 1988.
complete rotations. I want to stop the scan His background includes product design and
when I have fulfilled my requested number of manufacturing. You can reach him at:
complete rotations. This is presently set to 1.
jeff.bachiochi@imaginethatnow.com or at:
The second and third bytes contain the angle
in degrees and fraction (which I throw away). www.imaginethatnow.com.
The angle is used to index into the distance[]
array. Each entry in this array will hold the
latest distance from bytes four and five. Once
scanCount=2, I end the scan by sending the make this simple to execute, with minimum
STop command. Distances reported as “0” are math required. In fact, the only math is for
illegal. These couldn’t be calculated, because the zoom function I added to allow you to plot
they were either less than the minimum from 12m down to 1m, full scale (Listing 5).
distance (less than 150mm) or further than the If you think like a XY plotter, you can see
maximum distance (greater than 12m). I do how these commands are used to rotate the
a quick check to determine how many entries direction of travel, move out some distance,
in the distance[] array have legal entries, plot a mark and then move back. This is done
and this is saved in the variable dataCount. once for each of the 360 array entries. The
The mode is set to 0, and no response code is TUrn command internally calculates the X
necessary, except the array is flagged using and Y steps necessary to move in a vectored

COLUMNS
newData = true, and we’re done here. direction, so no math is required!

LET’S SEE WHAT WE GOT WHY AN INTERMEDIATE


Ordinarily, I wouldn’t want to get all the INTERFACE?
data back, unless I were trying to do some Certainly, I could have coded my Liberty
mapping. The DAta command will dump 360 Basic application to request data using just
degrees of data, saved in the distance[] the API commands directly interfacing with
array. This command can be used to verify RPLIDAR. Although the API commands may be
that the data returned from RPLIDAR are simple, you would need to interpret the 5 bytes
correct (or at least look good). You may have of data being returned for every scan point.
noticed that I am not doing anything with While you are doing this and storing the data,
the quality value. You might want to use this you need to keep track of where you are, and
value for qualifying each computation. For STop the scan when you have sufficient data.
example, only accept the angle and distance It’s not really a big deal at this point, but I
if it has a quality value greater than some believe the best way to interface with this is
predetermined value. For this version, I’ll be to be totally insulated from the data collection
taking all angles and distances. process. This allows a user to retrieve only
What’s dumped is the list of distances pertinent information, and is absolutely critical
computed for angles 0-359. The table is for equipment with limited processing power.
initialized to all “0“s, so any angle that wasn’t Next month, we’ll look at the plot made
measured will be “0.“ You can choose to view using the Liberty Basic application, and
these as a minimum distance, a maximum determine exactly what data we need. We want
distance, or no plot point. I wanted to see to be sure that any processor interfacing with
these points plotted, so I wrote a simple this project doesn’t get bogged down with an
program in Liberty Basic to do this on my PC. abundance of data. As always, it seems there’s
This program is only about 150 lines of code. too much to do and too little time.
The application consists of a graphic window
centered on the screen.
A pop-up box asks which comm port Additional materials from the author are available at:
the Arduino/RPLIDAR is connected to. Next, www.circuitcellar.com/article-materials
it sends out a SCan command and a DAta References [1] through [2] as marked in the article can be found there.
command, which returns a 360-item list of
distances. Once the list is received, the plot
routine displays the data as plotted points, as RESOURCES
seen from the RPLIDAR. This request and plot
Molex | www.molex.com
action continue repeatedly. Liberty Basic has
some easy-to-use plotting commands that Slamtec | www.slamtec.com
74 CIRCUIT CELLAR • MARCH 2020 #356

PRODUCT NEWS

Jacinto 7 Processors Serve ADAS and Auto Gateway Needs


Texas Instruments (TI) has introduced the new Jacinto 7 processor platform. Built on the foundation of TI’s decades
of automotive systems and functional safety expertise, the new Jacinto processor platform brings enhanced deep learning
capabilities and advanced networking to solve design challenges in advanced driver assistance systems (ADAS) and automotive
gateway applications.
The first two automotive devices in the platform, TDA4VM processors for ADAS and DRA829V processors for gateway
systems, include specialized on-chip accelerators to segment
and expedite data-intensive tasks, like computer vision and
deep learning. TDA4VM and DRA829V processors incorporate a
functional safety microcontroller, making it possible for original
equipment manufacturers (OEMs) and Tier-1 suppliers to support
both ASIL-D safety-critical tasks and convenience features with
one chip.
Developers can get started immediately with Jacinto 7
processors development kits, and buy the new TDA4VMXEVM and
DRA829VXEVM evaluation modules on TI.com for US$1,900 each.
Preproduction TDA4VM and DRA8329V processors are available
now, only from TI, at US$97 in 1,000-unit quantities. Volume
production is expected to be available in the second half of 2020.

Texas Instruments | www.ti.com

30W DC-DC Power Module Targets High-Voltage Applications


XP Power has announced a 30W DC-DC power module that can generate up to 6kVDC from a single 24VDC input. The HRL30
series provides an accurate high voltage output for a wide variety of applications, including scientific and semiconductor uses,
says the company. With 22 voltage models in the series, a wide range of fully controllable outputs from 0-200VDC to 0-6kVDC are
available in both positive and negative polarities. The wide input
PRODUCT NEWS

range of 22 to 30V allows the module to be powered by the 24V


rail commonly available in industrial equipment, while an inbuilt
precision +5VDC reference provides a stable supply to control the
high voltage output. Excellent line/load regulation (0.01%) and
low ripple/noise (<0.05%) ensure a stable output voltage.
Modules in the HRL30 series operate across the temperature
range -40°C to +70°C. The baseplate cooled package, along with
unique design and manufacturing techniques and a typical 85%
efficiency ensure superior thermal performance in even the most
demanding applications, says XP Power.

XP Power | www.xppower.com

Carrier Boards and Mini-PCs Boost the Jetsons


Diamond Systems announced a Stevie carrier board for cores and 2x Nvidia Deep Learning Accelerator (DLA) engines.
Nvidia’s high-end Jetson AGX Xavier module. In the Stevie There’s also a 7-way VLIW vision chip, as well as 16GB 256-bit
announcement, Diamond also LPDDR4 RAM and 32GB eMMC 5.1.
promoted some other Jetson carriers Unlike the slightly smaller, more
and embedded systems, some of rugged, and more expandable Elton
which appear to be relatively new. All carrier for the Xavier Stevie has a
the products ship with Linux BSPs. variety of real-world ports for easier
The Stevie board measures connectivity. Coastline ports include
105mm × 92mm, just slightly larger an HDMI port, 2x Gigabit Ethernet,
than the 100mm × 87mm Jetson AGX and 2x USB 3.1 ports. The block
Xavier module. Nvidia’s top-of-the- diagram suggests there’s a second
line Xavier has greater than 10x the HDMI port, which might be an input
energy efficiency and more than 20x interface.
the performance of the Jetson TX2. It
features 8x ARMv8.2 cores and a 512- Diamond Systems
core Nvidia Volta GPU with 64 tensor www.diamondsystems.com
circuitcellar.com 75

PRODUCT NEWS

STM32 SoC Speeds LoRa IoT Smart


Device Designs
STMicroelectronics has released what it claims is the first
LoRa system-on-chip (SoC) for connecting smart devices to
the IoT using long-distance wireless connections. The SoC
combines the ultra-low-power STM32 MCU design with a LoRa-
compliant radio in one single-die and easy-to-use device.
With multiple ST patents pending, namely for radio Power
Management Architecture, the STM32WLE5 will ensure unique
performance. ST’s LoRaWAN software for wireless network
communications has passed all regional certifications for use Users also benefit from the built-in cyber-security features
worldwide. of STM32L4 MCUs, including hardware public key accelerator
STM32WLE5 is available in a 5mm x 5mm UFBGA73 (PKA), True Random Number Generator (TRNG), sector
package. It is fully integrated into the market-proven STM32 protection against read/write operation (PCROP), and support
ecosystem, including STM32Cube software support, as well for state-of-the-art cryptographic algorithms including RSA.
as a LoRaWAN stack certified for all regions and available in
source-code format. STMicroelectronics | www.st.com

PMIC Simplifies Car Camera Power Supply Designs


Renesas Electronics has announced the ISL78083, a highly integrated power management IC (PMIC) that simplifies power
supply design for use in multiple HD camera modules, reducing development cycles, bill of materials (BOM) cost and supply
chain risks. The automotive camera PMIC accepts direct-from-battery (36-42V) or power-over-coax (15-18V) supply sources
and supports output currents up to 750mA per output. This power level offers ample headroom for existing image sensors
up to 7-megapixel and future sensors with even higher
resolution.
The feature-rich 4-channel ISL78083 automotive
camera PMIC includes a primary high-voltage synchronous

PRODUCT NEWS
buck regulator, two secondary low-voltage synchronous
buck regulators, and a low-dropout (LDO) voltage regulator.
With integrated feedback and integrated compensation, all
that is left to complete the high efficiency power supply is
the output inductor and capacitors.
Mass production quantities of the ISL78083 automotive
camera PMIC are available now in a 4mm × 4mm, 24-lead
SCQFN wettable flank package.

Renesas Electronics | www.renesas.com

Mini-PCIe IoT Radio Targets Industrial Applications


Gateworks has released the second generation of the GW16122 IoT Radio for
rugged and industrial applications. This next generation card features greatly
improved output power through a 20dBm power amplifier, more storage space
and a simplified design, says Gateworks. Software from Texas Instruments (TI)
includes a TI 802.15.4 Stack, 6LoWPAN, Wi-SUN and KNX RF support. The GW16122
additionally features a 2.4GHz RF output for Bluetooth 5 LE, Thread and Zigbee. This
Mini-PCIe radio card provides low-power and long-range radio communications.
Second Generation GW16122 Mini-PCIe IoT Radio Features: Updated TI CC1352P
Dual-Band Wireless Radio Transmitter/Receiver; Sub-1 GHz Radio (868MHz EU,
915MHz US); Improved +20dBm output power using high-power amplifier for
longer distances; Increased flash storage from 128KB to 352KB; Increased SRAM
from 20KB to 80KB; Simplified design with removal of large TI Tiva MCU.
In contrast to many other IoT technologies such as SigFox and Lora, this
technology requires no monthly fees or consortium memberships, says
Gateworks. All the software is Open Source and the entire network is completely
private with zero dependency on the coverage of third-party networks.

Gateworks | www.gateworks.com
76 CIRCUIT CELLAR • MARCH 2020 #356

PRODUCT NEWS

PMIC Shrinks and Simplifies Automotive Display Designs


Maxim Integrated Products has announced the MAX16923 4-output display power IC with watchdog timer. By replacing four
or five discrete ICs with a single power management solution, the MAX16923 significantly shrinks solution size and makes it
easier for automotive designers to increase the number of displays from two to five per vehicle or even more.
The MAX16923 offers high integration
with four power rails, featuring both a high-
voltage and low-voltage buck converter, a
high-voltage and low-voltage low-dropout
(LDO) regulator, electromagnetic interference
(EMI) mitigation and a watchdog timer in a
single IC. Its high level of integration can
reduce an automotive power solution from
four or five ICs down to one chip, without
making the temperature rise significantly.
The MAX16923 is available at Maxim’s
website. Pricing available upon request. The
MAX16923EVKIT# evaluation kit is available
for $50.

Maxim Integrated
www.maximintegrated.com

DC-DC Converters Target Energy System Applications


MINMAX Technology has announced its new MIE10-HI offering 9-18, 18-36 or 36-75VDC input ranges with single
PRODUCT NEWS

series of 10W DC-DC converters with ultra-high isolation output models ranging 3.3-24VDC and dual output models
power solutions. The MIE10-HI Series consists of 24 models ±12V, ±15V delivering 10W of output power.
Further features include I/O Isolation of 5000VAC, high
average efficiency up to 88%, operating ambient temperature
range of -40°C to +90°C, no minimum load requirement,
built-in EMC filter for EMI emission EN55032 Class A without
additional components required, and under-voltage/overload/
voltage/short-circuit protection. All models have been qualified
per the CB scheme with safety approvals to UL/cUL/IEC/EN
62368-1 standards.

MINMAX Technology | www.minmax.com.tw

GaN Desktop AC-DC Power Supplies Deliver 200W


CUI has announced the addition of two GaN desktop AC-DC European Union’s (EU) CoC Tier 2 directive for universal input
power supply series to its SDI product family. The SDI200G-U voltage ranges; with up to a 250% increase in power density,
and SDI200G-UD offer 200W of continuous power from a no-load power consumption as low as 210mW and universal
compact desktop package. These AC-DC supplies have been input voltage ranges of 90 to 264VAC.
designed for a wide range of portable industrial and consumer The SDI200G-U series offers a three prong (C14) inlet, while
products, where efficient power is the SDI200G-UD features a two prong
needed in a lighter, smaller adapter (C8) inlet. Measuring 5.91" × 2.13"
package. × 1.3" (150mm × 54mm × 33mm.),
The SDI200G-U and SDI200G- the compact new models are 32%
UD comply with UL/EN/IEC 62368- smaller than the non GaN models.
1 and 60950-1 requirements. The The SDI200G-U and SDI200G-UD are
adapters also meet the current available immediately with prices
average efficiency and no-load starting at $188.50 per unit at 5
power specifications mandated by pieces through distribution.
the US Department of Energy (DoE)
under the Level VI standard and the CUI | www.cui.com
circuitcellar.com 77

IDEA BOX
The Directory of
PRODUCTS & SERVICES
AD FORMAT:
Advertisers must furnish digital files that meet our specifications (circuitcellar.com/mediakit).

All text and other elements MUST fit within a 2" x 3" format.
E-mail adcopy@circuitcellar.com with your file.

For current rates, deadlines, and more information contact


Hugh Heinsohn at 757-525-3677 or Hugh@circuitcellar.com.

Revenue Control Experience the POWER of a PIC® MCU in your USB port!

Systems PnP
- Pick & Place Machines starting @ $6,250
- Direct U.S. Sales, Support, Training,
Parts, Accessories, Warranty Capabilities and Features
- PCB Fabrication Equipment • Pushbutton,Two LEDs &
I/O Cable

- Makerspace Specials • Text I/O from PIC®MCU to


PC Screen

- Reflow Ovens
• Quick Way to Log/Graph
Analog Data

757-258-0910
• Easy Graphing of PIC® MCU Data

www.ccsinfo.com/CC320

RCSPnP.com
sales@ccsinfo.com – 262-522-6500 x 35

THIRD PARTY

PIC® MCU is a registered trademark of Microchip Technology Inc.

Single Board Computer


Surplus & New Parts & Supplies
Since 1967
LEDS . CONNECTORS . RELAYS
SOLENOIDS . FANS . ENCLOSURES
MOTORS . WHEELS . MAGNETS
T
TES
VER
SER

PC BOARDS . POWER SUPPLIES


SWITCHES . LIGHTS . BATTERIES
and many more items... TS-7250-V2
1GHz ARM Computer with
Customizable FPGA-Driven
PC/104 Connector
We have what you need for your next project. and Several Interfaces
at Industrial Temp
Discount Prices
Fast Shipping www.embeddedARM.com
78 CIRCUIT CELLAR • MARCH 2020 #356

TEST YOUR EQ Contributed by David Tweed

Problem 1— The venerable 555 timer IC, Problem 2— In addition to its basic
originally developed by Hans R. Camenzind timing functions (monostable and astable
at Signetics (now part of NXP), despite multivibrators), the 555 can be used to
being quite old (1971—almost 50 years!), create:
is still widely used. Let’s see how well you
understand it. Start by describing the • Set-reset flip-flop
internal functional blocks. • Schmitt trigger

Problem 3— Where do the constants 0.693 Problem 4— What are the characteristics of
and 1.1 come from in the timing equations the 555 reset input?
for the multivibrators?

Circuit Cellar
2019 Archive
TESTS YOUR EQ

cc-webshop.com
Order yours today
circuitcellar.com 79

The Future of Data in Robotics

Distilling Insights from


Tomorrow’s Digital Exhaust

T he robotics industry is
at a turning point. We’re
leaving the industry’s
open, exploratory infancy,
and entering the more rigid realm of
maturity. During this period, we will
SENSORS, SENSORS,
SENSORS
When we talk about robots occupying
novel spaces, it’s important that we
understand “how” they’ve made this
shift. The short answer is: by ingesting,
see some hard lines start to form— processing and transmitting lots of
exploration will yield to well-worn paths, complicated data. The transformative
and experimentation will take a back nature of modern robotics data isn’t
seat to best practices. And while there merely a question of total data volume.
will always be space for innovation, this Nor is it simply the rate at which data
Jeff Linnell,
landscape will be the terrain on which must be ingested and processed. It is CEO, Formant
our industry’s titans take root. also a matter of the types and variety of
As someone on the “front lines” of data a single machine must work with in
this industry, I can feel this sea change order to reliably perform its role.
coming. And the companies poised to To help illustrate this idea, let’s
“come out on top” after this seismic look at a real-world use-case. Amazon
shift aren’t the types of companies most (among others) has recently started
imagine. In the near future, the titans of using robots in their distribution centers
robotics will be those who deal in data, to perform “pick & pack” labor. These
not devices. robots are given product codes and
Until recently, robots were largely tasked with locating items, retrieving
confined to the safe, predictable confines them and delivering them to packaging
of the factory floor—bolted down to fixed station.
positions along assembly lines. However,
for today’s generation of robotics, one
of its most recognizable characteristics
is mobility. In addition to its literal

TECH THE FUTURE


interpretation, “mobility” also speaks to
robots moving into entirely new sectors of
our economy. Increasingly sophisticated
technologies are enabling robots to
perform increasingly complex tasks,
in increasingly complex environments.
And, as a result, managing these robots
is growing increasingly complicated.
Meanwhile, as they begin to work
with and around humans, the need
to monitor, analyze and observe their
actions grows. Whereas metrics like
up-time and down-time were once
substantial parts of monitoring robots,
today’s applications demand much more.
Today, we must monitor processes, not
variables. And as applications grow even FIGURE 1
more sophisticated and diverse, the need Imagine data streaming out of smartphones like exhaust. The average robot (right) transmits 10 times as
for (and the complexity of) observability much data as a smartphone (left). Left alone, that digital exhaust is simply lost—left to vanish into thin air.
skyrockets. When collected, processed and stored effectively, it becomes insight.
80 CIRCUIT CELLAR • MARCH 2020 #356

The true value of Google’s analytics operations


doesn’t lie in the data itself. It lies in its processing.
It resides in their efforts towards “organizing”
that data and making it “accessible” and “useful”
to its customers.

DATA, DETAIL, VALUE


The next time you’re on a bus or a train,
take a moment to look around you. Take into
consideration that nearly 96% of the people
around you have cellphones in their pockets (or
in their hands), and about 79% of those phones
are smartphones. If you happen to be in New York
and riding on a busy metro line, that’s roughly 50
smartphones in just your train car alone—all of
them churning through untold amounts of data.
Now, try to visualize all that data streaming
out of those phones like exhaust. The sheer
volume would choke the car with an impenetrable
fog of zeros and ones. Now, consider the fact that
the average robot transmits 10 times as much
In order to perform even such a small number of discrete tasks, a data as a smartphone (Figure 1). There’s more of
robot must be equipped with a litany of sensors, and be able to rapidly it, more metrics are involved, more complex data
process countless data types. In this case, we can assume that the robot types are used (for example, streaming video) and
will require a variety of motion sensors—such as an accelerometer the robot operates continuously.
and odometer—plus various geometric sensors to determine physical If each smartphone is a single tailpipe, then,
orientation. each robot is like a billowing smokestack. Left alone,
Already, we’ve identified over 4 sensors. And yet they address only that digital exhaust is simply lost—left to vanish into
a single aspect of the robot’s functionality—movement. It isn’t at all the ether. But, if we’ve learned anything from recent
uncommon for robots to employ twice as many sensor types, monitoring history, it’s that such “exhaust” should not be left on
variables such as temperature, location, video monitoring and 3D data— the table. And despite being practically ubiquitous,
for example lidar and depth cameras. this exhaust has the potential to be more precious
than gold. Like crude oil or iron ore, digital exhaust
GOOGLE AND DATA is a raw material. When collected, processed, and
When we look at the history of digital data, there is one organization stored effectively, it becomes something else
whose import is so massive that its shadow often blots out every other entirely. It becomes insight.
actor in the field—namely, Google. In 1998, Google was born as a small- Although Google is a useful analogue for our
scale search engine company. However, it wasn’t long before it became discussion, robotics needn’t reinvent itself as an
the most popular search engine in the world. 21 years later, Google retains advertising mechanism. The insights gained from
its position as the #1 search engine in the world. But that status is no robotic data could be used to answer countless
longer its greatest claim to fame. Today, Google is also the world’s most questions; including everything from customer
powerful advertising company. Currently, advertisements account for attitudes to optimal speed in low pressure
roughly 90% of Google’s total annual revenue, which amounts to roughly environments.
one third of the world’s digital ad revenue. In the future, robotics will play a role in
TECH THE FUTURE

The nature of Google’s transformational ascent is better left for another virtually every industry imaginable. For each of
time. However, the question of how Google managed to achieve such market those industries, there is an immeasurable
supremacy has never been much of a secret. In fact, Google indirectly amount of value to gain from the distillation of
identifies it in its public mission statement: “Google’s mission is to organize insight from digital exhaust. And as the role of
the world’s information and make it universally accessible and useful.” robotics matures, both the stakes and the
While the “universally accessible” clause is debatable, the mission challenges are bound to rise. The time to start
statement is remarkably direct. It can also be used to cast light on tackling this problem is already upon us. Any
robotics’ current data problem. First, one must ask:” Why would a search company considering employing robotics in their
engine startup remake itself into an advertising megalith?” Well, in their operations should already have a plan in place
efforts to “organize information and make it accessible and useful,” they regarding how best to make use of their robotic
realized something extremely important: information has the potential to data. Because, those who don’t will invariably be
be priceless. The operative word there, however, is “potential.” left behind.

For detailed article references and additional resources


go to: www.circuitcellar.com/article-materials Formant CEO Jeff Linnell brings an unorthodox approach to robotics. Part
Cinematographer, part Creative Director and part self-taught Engineer,
Jeff is a serial robotics entrepreneur and a thought leader.
RESOURCES
Formant | www.formant.io
A R I FF
NO T S

F O R
A R E D
CL E O M S
CU S T
N
R A
F

TA I W
OM

Technology:
Technology: Materials:
Materials:
UpUptoto
5050 Layers
Layers Fr4
Fr4
Any
Any Layer
Layer HDI
HDI MetalCore
Metal Core
Sequential
Sequential Lamination
Lamination Isola
Isola
Blind
Blind / Buried
/ Buried Vias
Vias Rogers
Rogers
Laser
Laser Drilling
Drilling // Routing
Routing Polyimide- -Flex
Polyimide Flex
Heavy
Heavy Copper
Copper Magtron
Magtron

www.PCB4u.comsales@PCB4u.com
www.PCB4u.com sales@PCB4u.com
FROM THE OUTBACK
TO OUTER SPACE

Extreme Remote Deployed Assets.


Technologic Systems computers are engineered
to be deployed to some of the most
remote places on, and off, the Earth.
The TS-7800-V2 was designed to provide extreme
performance for applications demanding high
reliability, fast startup, and connectivity
at low cost and low power.
Packed with interfaces such as USB 3.0, SATA
Gigabit Ethernet, CAN, and RS-232, RS-485,
and TTL UART Serial Ports plus a full compliment
of digital and analog I/O. With so many features
integrated into one computer, you will
accomplish more while reducing
your payload weight.

TS-7800-V2 Where does your project need to go?


Single Board Computer with Starting at
Marvell Armada 385
Dual Core 1.3 GHz ARM CPU
$229
Qty 100

You might also like