Professional Documents
Culture Documents
Hitec servos have been delivering the STAR power you demand since 1983.
Whether you require the pint-sized proficiency of a micro, the steadfast performance of a standard
sport, the efficiency of a brushless digital or the IP-67-rating of a waterproof giant, our top-level
engineering, design and technology goes into everything we manufacture. For generations,
Hitec’s talented team of R & D professionals have committed to building the
highest quality of servos on the market, giving you the power to be your best.
Be STAR POWERED with Hitec!
Hitec RCD USA, Inc. | 12760 Danielson Court, Unit E | Poway, CA 92064 | (858) 748-6948 | www.hitecrcd.com |
Go portable with LDG!
IN THE
FIELD! ZERO POWER TUNERS
One of the great things about ham radio is that you can take
your hobby with you wherever you go. You’re not limited to These tuners include a AA battery pack
the shack, but can operate mobile from your car, handheld and are zero power once tuned!
just walking around with an HT, and of course portable in the
¿HOG :KHWKHU SLFQLFNLQJ FDPSLQJ SXWWLQJ SDUNV LVODQGV
lighthouses or mountain peaks on the air, or on Field Day,
you can set up a portable station just about anywhere. And
of course, when things go bad like a hurricane, earthquake
or other natural or manmade disaster you can set up an
emergency station near the action to help coordinate rescue
and relief.
Z-100Plus
Low cost and Portable, the Z-100Plus operates from any 7 to
18 volt DC source. AA batteries will run it for a year of normal
A lot of modern ham equipment is ideal for portable
use. Internal ffrequency
re
req
e uen counter
e cy cou
ounte
nteer sstores
ores tuning
tor
ores u ing parameters
tun param
pa ram
amet ete
e te s for
ers fo
operation. You can get a 100 watt radio that’s about the
fast recall. Handles
andl ess 100
ndles 10 watts
wa
attts SSB
tts SSB or or 30
30 watts
ttts digital.
watt
watt dig
igi
g tal
ta
a l.
size of a hardback book, weighs only a few pounds, and
will run off a battery for hours. The hard part about portable
operation is always the antenna. There are generally two
ways to go: you can put up a temporary wire antenna like
a dipole or long wire, or you can use a portable antenna
OLNHDYHUWLFDORUDKDPVWLFNGLSROH,QDQ\FDVHIRUHI¿FLHQW
operation you’ll need a tuner to match the antenna to your
radio. Z-11ProII
Designed for Battery Operation. Operates from 0.1 to 100
LDG makes several tuners that are ideal for portable ZDWWV 66% RU &: ZDWWV GLJLWDO *UHDW IRU ERWK 453 DQG
operation. They are light weight, compact, and can run on standard 100 watts transceivers. Matches dipoles, verticals,
internal batteries so they require no external power source inverted vees and most coax fed antennas.
at all; they’re literally just plug and play. The Z-100Plus and
Z-11ProII handle up to 125 watts, and the Z-817 up to 20
watts. And, they all include a free internal battery holder.
These tuners use latching relays to hold the tuning settings,
so in standby mode once tuning is complete they use
essentially no power at all. A set of AA batteries will typically
last for months of normal operation.
Z-817
As you plan for the fun and utility of portable operation, 7KHXOWLPDWH453DXWRWXQHU6HDPOHVVLQWHJUDWLRQWRWKH<DHVX
complete your portable kit with an LDG tuner. Visit us on the FT-817 and FT-818 provide one button tuning. 2000 memories
web at www.ldgelectronics.com. covers 160 through 6 meters, 20 watts SSB, 5 watts digital.
06 DEVELOPING
Departments 16 NEW PRODUCTS
PERSPECTIVES 31 BENCH & BUILDER
The Ergonomics 86 NV WEBSTORE
of Learning 96 TECH FORUM
07 READER FEEDBACK 97 AD INDEX
Subscription Information
Page 79 Nuts & Volts — PO Box 15277
North Hollywood, CA 91615-9218
Nuts & Volts (ISSN 1528-9885/CDN Pub Agree #40702530) is published bi-monthly for $26.95 per Call 877-525-2539 or go to www.nutsvolts.com
year by T & L Publications, Inc., 2279 Eagle Glen Parkway, #112-481, Corona, CA 92883. PERIODICALS
POSTAGE PAID AT CORONA, CA AND AT ADDITIONAL MAILING OFFICES. POSTMASTER: Send Subscribe • Gift • Renewal • Change of Info
address changes to Nuts & Volts, P.O. Box 15277, North Hollywood, CA 91615 or Station A, P.O. Box 54,
Windsor ON N9A 6J5; cpcreturns@nutsvolts.com. For more details on subscribing, see our ad on Page 51.
4 January/February 2019
52 More Tricks with Old-School
Digital Clocks
Here are a few of the many possible variations on the
Page 32 general theme of discrete-logic digital clocks. If you have a
few LED displays, counters, drivers, and simple logic, you
can probably build a clock. Consult the datasheets of the
ICs you choose to use, breadboard everything first, and
I
Outside US: (818) 487-4545
f you have parents or grandparents of five or more. It’s the same idea P.O. Box 15277
North Hollywood, CA 91615
with arthritis, then you’re probably behind the large grips on utensils for the
subscribe@nutsvolts.com
familiar with oversized handles on elderly with arthritis. Oversized grips
everything from eating utensils and allow someone with a compromised
FOUNDER
kitchen knives, to door knobs and or underdeveloped fine motor control Jack Lemieux
toothbrushes. If you’re unable to move system to get the work done.
your joints in certain ways without pain Better yet, if I had the ability to PUBLISHER
or with enough strength, then there choose a larger robot arm with larger, Larry Lemieux
are some things you just can’t do with more robust servo motors with larger publisher@nutsvolts.com
conventional tools. hardware, the boy could have probably
At the other end of the age handled a regular size screwdriver. This ASSOCIATE PUBLISHER/
spectrum — below a certain age or is the thrust of my observations. ADVERTISING SALES
maturation level — you can’t expect When you’re teaching someone Robin Lemieux
a child to handle certain tools. I’m to work with tools in constructing or robin@nutsvolts.com
not talking about whether a nine year repairing electronics, consider the
old can handle a circular saw, but a ergonomics of learning the entire EXECUTIVE DIRECTOR/
screwdriver, needle-nose pliers, or system — the tools as well as what those PRODUCTION
a soldering iron. And the issue isn’t tools will be used on. Sean Lemieux
responsibility or safety, but physical I don’t know the relative sean@nutsvolts.com
ability — a reflection of the maturation contribution of nature or nurture, but
of their fine motor skills. my brother and I grew up building EDITOR
Your 14 year old may be model airplanes. By seven or eight, Bryan Bergeron
techedit-nutsvolts@yahoo.com
responsible enough to work with your we were cutting balsa wood freehand
$200 miniature screwdriver set, but with X-acto™ blades. In my case, I’d
CONTRIBUTING EDITORS
may lack the fine motor skills necessary like to think the practice carried over to Ward Silver Kristen McIntyre
to use the screwdrivers without ruining electronics. Lou Frenzel Paul Verhage
the screwdriver tips. That’s a recipe for Even so, maturation is an individual Kathiresan Muthiah Benjamin Robson
frustration, anxiety, loss of confidence, process. Two people may eventually Jon Titus George Steber
and maybe a turnoff to electronics in get to the same level of mastery, but it Dane Weston Theron Wierenga
general. may take one longer and require more Daniel Millisor Dwayne Kincaid
For example, I was helping intense practice than the other. If you Bryant Julstrom David Goodsell
a friend’s teenager repair a set of take the time to match the project, Alex Krylov
servos from a robot arm using a set of tools, and ability of the learner, then
SHOW COORDINATOR
miniature drivers, soldering iron, and the journey can be fun and educational Audrey Lemieux
pliers. The boy simply couldn’t hold regardless of how long it takes.
the miniature screwdrivers between his I’m not advocating you purchase WEBSTORE MARKETING/
thumb and index finger. Instead, he had special “tools for children.” In my COVER GRAPHICS
to grip the screwdrivers with his fist, experience, these tools are simply Brian Kirkpatrick
using all four fingers and thumb. cheap miniature versions of real tools brian@nutsvolts.com
As a result, the screwdrivers often that break and result in injury or at
slipped off the screw heads and into best frustration. If you’re going to give Copyright © 2019
the servo motor. Luckily, the damage a youngster a set of tools, make them by T & L Publications, Inc.
to the wires was only cosmetic. The adult tools. All Rights Reserved
All advertising is subject to publisher’s approval.
screwdriver tips, however, required a You might consider add-ons such We are not responsible for mistakes, misprints, or
touchup with a blade sharpener. as grip extenders, but that’s about it. typographical errors. Nuts & Volts Magazine asumes
no responsibility for the availability or condition of
It wasn’t the boy’s fault, but rather And make sure the task fits their ability advertised items or for the honesty of the advertiser.
my failure to recognize his maturation level. The youngster that’s all thumbs The publisher makes no claims for the legality
level when it came to handling the with a miniature tool set may want that of any item advertised in Nuts & Volts. This is the
sole responsibility of the advertiser. Advertisers
screwdrivers. I should have considered mosquito-sized drone kit. and their agencies agree to indemnify and protect
purchasing barrel extensions: metal Get them the full-sized versions of the publisher from any and all claims, action, or
expense arising from advertising placed in Nuts &
doughnuts that increase the diameter tools and kits. They’ll have more fun and Volts. Please send all editorial correspondence, UPS,
of the screwdriver handle by a factor learn more in the long run. NV overnight mail, and artwork to: 2279 Eagle Glen Pkwy
#112-481, Corona, CA 92883.
6 January/February 2019
READER FEEDBACK
Analyzing Situation
I finally received my copy of the
November/December 2018 Nuts &
Volts, following the interruption of
mail service from a postal strike in
Canada in December. I really enjoyed
Robert Reed’s article on building a
“Basic Audio Distortion Analyzer” on Please continue writing articles Glad to hear the DIY Biotech
page 32. Had I seen it sooner I might on this subject. articles are making a difference! We
well have built this project. G.D. Gopal have several more planned, so stay
Like Mr. Reed, I have worked tuned!
for different companies in the past
who used professional quality audio
ALLELECTRONICS.com
distortion analyzers, such as those
made in the 1970s by Hewlett
Packard. In fact, at one point, I was
responsible for the regular calibration
of half a dozen of them (not sure of Surplus & New Parts & Supplies since 1967
exact model numbers then, but likely
the 331A or similar). Order Online or Toll Free 1-800-826-5432
So, in December 2018, when
I came across one of these vintage 36" MICRO-USB to USB CABLE SPECIAL, 12 VDC 3 AMP
instruments at a reasonable price on VERY SPECIAL PRICE POWER
eBay, I couldn’t help myself. I had Charge and sync cables for SUPPLY
to have it! (See the photo included smart phones, tablets, 6' output cable
here.) cameras and other with 2.1mm coax
Fortunately, all that was needed portable devices. plug, center+. cULus.
to get it up and running was to CAT# CB-427 CAT# PS-1272 50 for $6.45 each
1
$ 50
6
$ 95
10 for $1.25 each
replace two shorted capacitors in the 100 for $1.00 each 100 for $6.00 each
meter circuit and the neon pilot light each each
with an LED. Fond memories indeed.
I was also pleasantly surprised 6 VDC, 25 RPM GEAR MOTOR 0-100V DC VOLTMETERS
New gear head motor Three 0.28" digits on a
when Mr. Reed described his use of prepped with an arm 0.89" x 0.39" display.
the little known “Bubba” oscillator. that rotates an offset axle Three wire operation.
The “Bubba” and other sine wave in a 1" circle. Motor is
3
oscillators are well described in 1.45"D x 3.00"L. No-load specs: 25RPM @ Red digits CAT# PM-126 $ 95
“Design of Op-Amp Sine Wave 6Vdc, 150mA. Prepped w/ wire leads and Blue digits CAT# PM-126B each
Oscillators” by Ron Mancini of Texas drive arm. Includes a custom mounting
Instruments (www.ti.com/sc/docs/ bracket and slotted metal link rod. AGC (3AG) FUSE POST
apps/msp/journal/aug2000/aug_07. CAT# DCM-470 Screw-style cap. Fits standard
pdf).
4
$ 75 10 for $4.25 each
100 for $3.75 each AGC, 3AG 0.25" x 1.25"
1
each
Don Dorward VA3DDN cartridge fuses. $ 50
300 LEDS, RED, GREEN, CAT# FHPM-31 each
DIY Biotech Inspires
First of all, congratulations on YELLOW, BLUE, WHITE 10 for $1.35 each • 100 for $1.15 each
8
$ 00
schools and we are seriously thinking CAT# MB-113
about bringing in a subject on DNA
and Biotechnology. This article will
kit
4
$ 50
each 10 for $4.00 each
definitely be an inspiration for our SPDT ON-ON MINI
teachers. TOGGLE SWITCH 12VDC SPDT 40A
We were seriously considering RATED: 6 amp @ 120 Vac. AUTOMOTIVE RELAY
getting equipment from one Solder lug terminals. Plastic enclosed, 1.1" x 1.2" x
company but found it required a huge 1/4-40 threaded bushing. 0.43" long handle. 1" high. Mounts in standard
CAT# MTS-4 automotive relay socket.
investment. The companies Bergeron
CAT# RLY-351
mentioned are comparatively
reasonable and affordable. 1
$ 25
each
10 for $1.10 each
100 for 95¢ each 10 for $2.25 each 2
$ 55
each
January/February 2019 7
Q&A
■ WITH KRISTEN A. McINTYRE
In this column, Kristen answers questions about all aspects of electronics, including
computer hardware, software, circuits, electronic theory, troubleshooting, and anything
else of interest to the hobbyist. Feel free to participate with your questions, comments, or
suggestions. Send all questions and comments to: Q&A@nutsvolts.com.
that titanium alloy is difficult to
• Girding for Battle • Who Needs Wires? machine because of its hardness.
Titanium easily work-hardens, so
• Battle Language • Adrift in Time you need to make sure you are
making constant progress when
Girding for Battle cutting with a drill, for example.
Q
This requires a hardened drill bit and lots of pressure.
I’m building a combat robot from scratch and If you can afford titanium and know how to machine it,
want to design it as bulletproof as possible. it might be a good choice for your combat robot.
Assuming cost isn’t a consideration, what’s the
best metal for the body: titanium or stainless Battle Language
Q
steel? My understanding is that steel will take more of a
beating, but at a significant weight penalty. I’m thinking After watching the movie, Gamer (where
that a titanium chassis would give me the edge to scoot players control other humans), I realized that
out of the way and avoid direct hits from the opponent. the weak link in my battling robot system is my
Thoughts? reaction time and not the robot hardware or
Doug Richardson software. So, I’m thinking of moving basic reflex moves to
Plano, TX autonomous control by the robot, and that I could override
A
those moves if necessary. What language(s) would you
Titanium is a great metal. I love its strength and use to control the local reflexes? I’m thinking low-level
lightness. The frames of my glasses are made assembler to make things as snappy as possible, but then
of titanium alloy and I often forget that I’m I lose the portability of a language such as C. Should I go
wearing them. high- or low-level control language? Any thoughts on the
First, let’s look at the relative densities of steel and overall design?
titanium. For both metals, the particular alloy will change Lyle Mendez
the density, but this will give us some idea. Plain mild Birmingham, AL
A
steel has a density of about 7.85 g/cm3. Stainless steel is
about the same. That means that every cubic centimeter Autonomous reactions could be a very
of steel weighs 7.85 grams. Titanium, by contrast, is 4.5 g/ interesting approach. Whether you can override
cm3. So, an equivalent amount of titanium would be a little them in real time will be a challenge, but if your
more than half the weight. That’s a good thing for a battle reaction time is fast, it might be possible.
robot, perhaps. It depends on whether being lighter would As for languages for real time control, it somewhat
make it easier to be thrown around. You could also use the depends on the CPU’s speed. Programming in assembly
lighter weight armor to put bigger motors or other gadgets language can be simultaneously fun and painful. I’ve
inside for better performance at the same weight. done a lot of assembly programming, and it’s fun to be
Titanium tensile strength is remarkable when right down on the bare metal, squeezing out each extra
compared to steel. Tensile strength is expressed in a instruction. The problem, however, is that this code is often
complicated set of units (106N•m/kg), but the values can fragile and difficult to understand and maintain.
be compared. The best alloy I could find has a tensile My suggestion — based on a lot of experience in this
strength of 282, while steel is 165. Stainless steel is even area — would be to start writing everything in C and see
worse at around 105. Other strength measures are similar. what is too slow. Maybe it will be fast enough, but your
So, I think that titanium would probably take more of a investment in the C code will pay off. Usually, you’ll find
beating than steel, and certainly more than stainless steel. that only a few functions or inner loops are not performing
Of course, TANSTAAFL applies (There Ain’t No Such well enough to achieve your goals. In that case, you’ll
Thing As A Free Lunch). Titanium is quite expensive. I want to speed those up by optimizing them in assembly
found a 12” x 12” x 0.2” sheet of so-called grade 2 titanium language.
for just under $40. I’m sure a comparable steel plate Since you already have a C rendering of what you
can be found for just a few dollars. The other problem is want to achieve, you can start with what the compiler
8 January/February 2019
QUESTIONS and ANSWERS
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/magazine/issue/2019/01.
Q
call. Keep in mind that the more parameters to the function
there are, the more overhead. Usually, these parameters I built a clock using a DS1302 RTC (Real Time
need to be transferred via the stack or registers. In either Clock) chip with a 32.768 kHz crystal per the
case, they must be marshaled into their appropriate datasheet. The clock loses a few minutes per
locations prior to the function call, and that slows things month. I’m looking for a way to fix this. I’ve
down. seen schematics using capacitors to “trim” the crystal, but
Another approach that should be faster depends on I don’t know how to go about it for this application. The
your compiler. Some compilers — like gcc and llvm — allow circuit is in Figure 1. Any help is most appreciated.
in-line assembly language. This has two advantages. You Keith Ujvary
can avoid that function call I mentioned, and you can Oliver, BC
A
reference variables in your function symbolically. This
latter property makes writing the assembly language much The crystals used in RTC applications have a
easier. very low base frequency of ~32 kHz (actually,
You can also keep the C code right next to assembly, 215). These components are not constructed like
using the preprocessor (#if) to select each implementation. typical crystals; they look more like tuning forks.
That can be useful when checking for correctness. The drift in these crystals is large. The frequency varies with
temperature and changes as they age. This makes it hard to
Who Needs Wires? get them to be perfectly accurate. If the frequency is too
Q
high (i.e., the clock is running fast), a trimmer capacitor of
I’m tired of constantly plugging in my wireless just a few pF can be used to pull the frequency in closer to
Bluetooth earbuds for a nightly charge. Do the desired one.
you know of a retrofit that will allow me to use In your case, though, the frequency is too low, so it
inductive charging, like the system used by the can’t be trimmed. A low oscillation frequency can have
Apple Watch? I wouldn’t mind the extra weight or size, several causes. There’s a great article on this topic from
within reason of course. Maxim Integrated at https://www.maximintegrated.com/
John Piche en/app-notes/index.mvp/id/58. They make the DS1302
Chelsea, VT these days after acquiring Dallas Semiconductor.
A
To summarize the possible causes, there are four listed:
I had to look around for this, but it appears that
the market has solved this problem for you. 1. Overshoot on the control signals stopping the
I think it’s best to use a standardized oscillator periodically.
charging protocol, and QI seems to be the 2. A crystal with a lower load capacitance than the
standard for most devices these days. You didn’t mention device expects.
what kind of charging port your earbuds are currently 3. Stray capacitance around the crystal pins.
using, but let’s assume micro USB. 4. Temperature variations.
A quick search on Amazon showed a device from
YTech that looks like it will do the job nicely. It’s a little big Each one of these four points should be investigated
at 4.2 x 1.9 inches, but it’s better than nothing. As of this carefully. Perhaps you’ll find one of them causing the
writing, it’s available for just under $13. I’m sure there are slowdown.
many other solutions out there if this one doesn’t fit the The datasheet for the DS1302 can be found at https://
bill. Just check around on Amazon or eBay. datasheets.maximintegrated.com/en/ds/DS1302.pdf. NV
January/February 2019 9
THE HAM‘S WIRELESS WORKBENCH ■ BY WARD SILVER N0AX
hwardsil@gmail.com
Rotators
How do you turn that thing?
We’ve had a few columns on antennas and propagation,
and there sure is a lot of variation in the types of
antennas! All the different ways signals propagate require different
antenna directions and types. Hams use dinky finger-sized “rubber
ducks” on handheld radios but also some ridiculously big antennas
it seems. Hams can’t use as much power as some of the other
communication services, so they use antennas to get through by
focusing radiated power.
If the antennas can focus a signal, then they need to Yagis or log-periodics for VHF through microwaves. They
be able to focus it in the desired direction, right? A few aren’t sturdy enough to be used with large HF beams
antennas can do that electrically by controlling the signal’s or microwave dishes. They can’t hold antennas with a
phase or switching antenna elements on and off. Most of significant wind load, meaning a large surface area that
the “pointable” ham antennas, though, need to be pointed generates torque on the mast or tower it’s mounted on.
mechanically and held in place during a contact or to keep There are also small portable rotators that work from 12
a communications link working. The thing that hams use VDC.
to point their antennas — large and small — is called a Medium-duty rotators can handle a single mid-sized
rotator. HF Yagi or log-periodic for 14 to 30 MHz. By “mid-sized,”
There are a wide range of rotators, just like antennas. I mean a Yagi with a few elements on a 12 to 18 foot
You may have used a TV antenna rotator with its “chunk- boom weighing 50 pounds or less. A small VHF/UHF Yagi
chunk-chunk” stepping. At the other end of the scale, can be stacked with the HF beam. This is a very common
whole towers turn! We’ll cover some of the most common configuration: a three-element “tribander” (20, 15, and 10
types and give you an idea of how they work. (If you want meters) with a six-meter and two-meter Yagi above it. A
detailed information, including guidelines and illustrations few sections of Rohn 25 tower or an HDBX self-supporting
for how to work with these unsung heroes of the antenna tower (www.rohnnet.com) make for a sturdy antenna
farm, see the sidebar, “Rotator and Tower Know-How.”) system.
These rotators can also handle a set of several VHF/
Rotator Sizes UHF antennas known as a “stack.” If you want them to
point (and hold) a dish antenna up to a meter or so in
TV antenna rotators are just about the smallest version diameter, check the dish wind load to be sure it won’t
used by hams. They are inexpensive and suitable for small overload the rotator. A dish antenna’s main beam is very
narrow — maybe just a few degrees — so a
Rotor or Rotator? rotator has to be both accurate and stable to hold
the dish in place and on target.
Is it "rotator" or "rotor?" Hams are not very precise with slang and The biggest amateur HF Yagis — including
jargon, so both words are used referring to the same thing: A device that stacks of two or three antennas — require a
aims an antenna in a specific direction. Nevertheless, there is a proper much larger rotator. Instead of a solenoid or disc
usage! A "rotator" is a device that causes something to rotate; in this braking system, some of these rotators use a gear
case, a mast with an antenna attached to it. A "rotor" is a part of a device train or worm drive to provide the braking action.
that rotates such as a motor shaft or armature. Be sure the tower and supporting hardware is
If you want to be correct when referring to the gadget that you use
rated to handle the antenna and mast load.
to aim your antenna, call it a rotator. Thank you, I feel better now!
As the rotators increase in capability, they
10 January/February 2019
PRACTICAL TECHNOLOGY FROM THE HAM WORLD
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/magazine/issue/2019/01.
■ FIGURE 2A. Doug N1LI’s tower has a pair of large single-band Yagis mounted on ring rotators:
one at the very top and one about half-way down the tower. This allows them to be aimed
independently. The top one is aimed to the left and the bottom one to the right. A third two- January/February 2019 11
element Yagi is mounted on a mast turned by a conventional rotator mounted in the tower.
PRACTICAL TECHNOLOGY FROM THE HAM WORLD
There are also rotators that can turn antennas in the brake to impact the sides of the indentations. If your rotator
vertical plane. They are designed for satellite operating doesn’t have a brake delay, practice allowing the antennas
and are called azimuth-elevation or az-el rotators. This to coast to a stop before letting the brake re-engage.
is somewhat complicated mechanically, as you might The largest rotators, including prop-pitch rotators
imagine. Yaesu is the largest commercial vendor of amateur originally used to control the angle of aircraft propeller
az-el rotators, but the SatNOGS group (www.satnogs.com) blades, use the gearing of the motor to hold the mast in
has designed a 3D-printed system for automated telemetry place. Worm gear drives are also designed that don’t allow
reception with lightweight antennas. backward turning under load.
a maximum antenna system size is used as a spec by the Controlling the Rotator
Hy-Gain company. Heavy and bigger antennas are harder
to turn and to hold in place against the wind, requiring Each rotator family has their own custom control
a higher effective moment rating for the rotator. Many units for energizing the rotator and displaying antenna
rotators also specify a maximum vertical load in pounds or position. There are also after-market control units that
kilograms. operate with any of the common rotators. The most
Wwidely used are the Green Heron controllers (www.
Determining Direction greenheronengineering.com) and the EA4TX interfaces
(ea4tx.com). Both can control most available models of
For local point-to-point connections, a topo
map and compass are usually enough to get your
signals “on target.” For long-distance over-the-
horizon contacts, though, you need to know
about azimuthal-equidistant maps. Such a map
(centered on your location) shows the correct
bearing to any point on the globe (Figure 3).
All the great circle paths from your location
are straight lines heading directly to the edge of
the map. This is the path your signal takes, and it
may be in a direction you’re not expecting. For
example, viewed on a Mercator projection map,
the path from St. Louis to, say, Berlin is almost
straight east. However, the path your signal would
take is about 35 degrees east of north!
Most of the analog meter scales for the
popular Ham-IV and Tailtwister rotators are
north-centered with north at the top and south at
either end of the scale. You can also special-order
south-centered scales or print your own using the
free program, MeterBasic (www.tonnesoftware.
com/meter.html).
PicoScope ®
PC Oscilloscopes
©2019 Pico Technology. All rights reserved. Pico Technology, PicoScope and FlexRes are registered trademarks of Pico Technology. Learn more: www.picotech.com
14 January/February 2019
Pico_PSFam_N&V0119.indd 1 12/10/18 1:40 PM
Jrk G2
Motor Controller
with Feedback
Maestro Servo
Controller
Simple Motor
Controller G2
Tic Stepper
Motor Controller
CO N T R O L I N T E R FAC E S
Analog Rotary
USB TTL serial I2C voltage RC encoder Scripting
Jrk G2 Motor Controllers
with Feedback
NEW
■ GADGETS
■ TOOLS
BUILD AN INTERNET
DIGITAL CLOCK By Theron Wierenga and Daniel Millisor
It’s time to build this digital clock that connects via Wi-Fi
to the Internet to not only display the usual time, date,
temperature, and humidity, but to also be able to retrieve
things from the Internet like the weather or weather
forecast, and stock market reports as well.
18 January/February 2019
Introduction software would be needed to run them. These have a nice
set of mounting holes in the corners. It also appeared that
I’ve been building digital clocks for longer than I many of them were built to plug into an Arduino Mega
want to admit. My first one was built with over 20 of the 2650 and my thinking was to use an ESP32.
7400 series ICs and the (then) new seven-segment LED I chose instead to use an Adafruit seven inch
displays from Monsanto. My family was really impressed 800x480 display connected to their RA8875 driver board.
— especially when all those zeros rolled around at the Unfortunately, the Adafruit display doesn’t have any
beginning of each hour. Next came a series made with mounting holes, so it will take some extra effort to mount it
dedicated digital clock ICs that scanned the seven-segment in a box. Basically, you have a piece of glass, so you’ll need
displays. This reduced the IC count considerably and to make a frame of some sort to mount it in.
added switching transistors to handle the current. I knew the RA8875 would run off an Arduino and
More recently, I’ve built digital clocks using the Adafruit’s software packages have always worked for me.
Arduino family of microcontrollers and the highly accurate The RA8875 has an SPI interface and the ESP32 has the
(about one minute per year) real time clock ICs like the SPI interface as well, so what could be easier? Famous last
DS3234 and DS3231. These allow for a calendar as well words! I couldn’t get the RA8875 to work with my ESP32.
as the time, and by adding something like the BME280 I purchased my ESP32 from Amazon — their HiLetgo ESP-
you can easily add temperature, humidity, and barometric WROOM-32 ESP32 development board with 2.4 GHz
pressure to an eight-digit seven-segment display. The dual-mode Wi-Fi.
DS3231 is now available on a nice little breakout board I found this ESP32 easy to use. A good ESP32 Arduino
with built-in battery backup and an easy I2C interface. IDE (integrated development environment) installation
Setting the correct time has always been a bit of guide can be found at https://randomnerdtutorials.
an issue. My early approach was the use of switches. com/installing-the-esp32-board-in-arduino-ide-windows-
My latest versions have added an IR receiver, which instructions and there are others that are easy to find
allows you to change the hours or minutes as needed for with Google. After several posts on the Adafruit forum
Daylight Savings Time. A simple pushbutton “clicker” is asking for help using the RA8875 with an ESP32, Adafruit
used with the IR receiver to change the settings. Loss of responded with the message “we’ve never tried the ESP32
power with the backup battery (or a dead one) still means w/RA8875 — ESP32 also has all sorts of weirdness that
reprogramming and uploading the software to the
microcontroller.
When initially programming the starting time
in the DS3231, once the correct time has been
established in the running DS3231, the program is
run again with the set time function commented out.
The battery will now hold the correct time, even if
power is removed.
The advent of the ESP32 Wi-Fi development
boards allows for a further increase in the
sophistication of a digital clock. It doesn’t take much
imagination to envision a digital clock with a large ■ FIGURE 1.
LCD display to not only show the usual time, date, Block diagram of
temperature, and humidity, but to also be able to the digital clock.
retrieve things from the Internet like the weather or
weather forecast and stock market reports as well.
Why the time? With the time retrieved from
the Internet, your clock will always be accurate to
about the second. In addition, you’ll never need to
reset the clock with Daylight Savings Time changes.
Retrieving the time from the Internet will do that for
you.
My design started with looking into the large
seven inch LCD displays with 800x480 pixels.
Between eBay, Amazon, and other dealers, there
are lots of choices. I liked the price of a number on
eBay coming from China but was unsure of just what
January/February 2019 19
■ FIGURE 2. Schematic
of the prototype.
makes it unstable and hard to use.” After digging into the RA8875 software, I found that
Well, I didn’t find the ESP32 hard to use. In an hour or on initialization of the SPI interface, it begins by reading a
two, I had mine installed on the Arduino IDE, and retrieving register and checking the return value. If that value doesn’t
time and weather information over Wi-Fi. match what an Arduino returns, it simply quits. I did open
an issue with the RA8875 library and hopefully Adafruit
■ FIGURE 3.The complete prototype. will address the problem. I also tested a Teensy 3.1 with
20 January/February 2019
the RA8875 and it worked fine.
So, what to do? My display won’t work with
an ESP32. My answer was to put a slave Arduino
Nano between the ESP32 and the RA8875. A bit
of overkill, and a real hassle to form strings on the
ESP32 and then send them to the Arduino Nano
where it needs to parse them and then send the
required commands to the RA8875, but this method
does work.
Figure 1 is a block diagram of the circuit I built.
The Arduino Nano does most of the work. It drives
the LCD display and reads the DS3231 real time
clock as well as the BME280 for temperature and
humidity.
Construction
I used point-to-point wiring on a 3.75 x 2.25
inch prototype board. It fit everything quite nicely. I
used a four-pin header to connect the small BME280
breakout board via an eight inch jumper. This keeps
■ FIGURE 4. Prototype board with components.
the temperature and humidity sensor away from the
heat generated by the prototype board.
A pair of six-pin headers with jumper cables
connects the prototype board to the RA8875. A
nine volt/one amp wall wart type power supply was
used which connects to the board through a mating
jack. The nine volt power supply is delivering about
200 milliamps to the board.
The usual 7805 five volt regulator supplies five
volts to all five small boards: the Arduino Nano;
ESP32; DS3231; BME280; and the RA8875 with its
LCD display. A small 1 x 1.25 inch heatsink on the
7805 works well. It’s warm to the touch, but not so
hot that you can’t keep your fingers on it (which is
my seat-of-the-pants measurement for judging the
size of a heatsink). The complete schematic is shown
in Figure 2.
Software
The heart of this project is the software, given
that the hardware is mostly a set of breakout boards
that are simply connected together. ■ FIGURE 5. RA8875 board.
There are several specific libraries that will need
to be added into your Arduino libraries folder. Check the acting as the slave; and another for the ESP32 which only
various #include statements to identify these libraries in the is used to connect to the Internet and retrieve the time and
programs provided in the download area for this article. outside weather, then pass it on to the Nano. The BME280
These libraries were found online in various locations and board collects the inside temperature and humidity.
Googling the name will lead you to their sources. The The ESP32 software accesses two servers over the
specific locations can change with time. If you need help Internet: pool.ntp.org (Network Time Protocol) to get
with installing libraries, go to https://www.arduino.cc/en/ the current time; and openweathermap.org to obtain
Guide/Libraries. weather information. (See www.ntppool.org/en for more
Two programs were written: one for the Arduino Nano information.)
January/February 2019 21
second whenever polled. The free openweathermap.
org server can be polled once a second, but be advised
the service only updates the weather information
once in less than two hours. It appears this time varies.
My software polled these two servers once every 10
seconds. This was done for testing, and polling once
every 10 minutes is adequate.
The flowchart of the ESP32 software in Figure 7
outlines the basic operations. The program first connects
to the Internet via Wi-Fi. Your local Wi-Fi SSID name and
password must be inserted into the program, so it will
connect to your specific Wi-Fi. If the Wi-Fi signal is lost
■ FIGURE 6.The LCD output.
for any reason, the program will detect this and then
attempt to reconnect.
Using pool.ntp.org is pretty straightforward. You’ll After connecting to Wi-Fi, the program simply reads
need to sign up for access to the openweathermap.org the time and weather data from the servers and then sends
server. Both of these are free services and both sites supply the information in two separate strings out the Serial2 port
information on how to use their service. to the Arduino Nano. The blue LED on pin 2 of the ESP32
The NTP server will give you the current time to the will light when Wi-Fi is connected and go out if Wi-Fi is lost.
The green LED (mounted separately on the board)
will go on for one second when the Serial2 port
sends its strings. After the green LED is turned off,
the program delays for nine seconds and then loops.
When connecting to the pool.ntp.org server,
your offset in seconds from GMT (Greenwich Mean
Time) is specified along with the Daylight Savings
Time offset in seconds. For the weather, there are
different ways to specify what weather location you
wish the openweathermap.org server to report.
I choose using a zip code and specifying
imperial measurement, which then reports the
temperature in Fahrenheit. You can refer to the
software in the download area for more details.
The ESP32 software has been tested on the
ESP-WROOM-32 development board and the
AZDelivery ESP32 Nodemcu CP2102 module
WLAN Wi-Fi development board — both available
on Amazon. It was also tested on the original ESP32
DevKitC board. Only the HiLetgo board has the blue
LED tied to pin 2.
Figure 8 illustrates the flowchart of the Arduino
Nano software. It not only receives the data strings
■ FIGURE 7. from the ESP32, but it also hosts a DS3231 real time
Flowchart of the clock circuit and a BME280 temperature/humidity/
ESP32 software.
pressure circuit along with the RA8875 board to
drive the LCD.
While the DS3231 circuit keeps the time quite
accurately, it is reset once every 10 seconds to
maintain its accuracy and to automatically adjust
to Daylight Savings Time. How often we reset the
time and update the weather is determined by the
program running on the ESP32.
The Nano resets things whenever it receives
a string from the ESP32. The BME280 operates
22 January/February 2019
Post comments on this article and find any associated files and/or
downloads at www.nutsvolts.com/magazine/issue/2019/01.
Parts List
• Adafruit RA8875 and seven inch 800x480
pixel LCD display
• HiLetgo ESP-WROOM-32 ESP32 ESP-32S
development board ■ FIGURE 8. Flowchart of the
• Arduino Nano Arduino Nano software.
• DS3231 breakout board with battery
• BME280 breakout board
• Header pins
• Header jumpers
• 5.5 x 2.1 mm jack
• Nine volt/one amp wall wart type power
supply
• LM7805 five volt regulator
• Heatsink for LM7805
• Green LED
• 100 ohm resistor
• 3.75 x 2.25 inch prototype board
• Wire, solder, screw, nuts
■ FIGURE 1. Examples of fun messages you can engrave on No.2 pencils and popsicle sticks.
■ FIGURE 2:The complete laser pencil engraver system built on my wife’s old breadboard.
THE FINAL RESULT rest of this article. The only problem right now is that all
the grandkids want their own customized pencils. Not just
An hour later and two clicks of the mouse launched yellow ones, but all kinds of screwy colored pencils. I think
my latest brainstorm. I ordered a 1/2 watt blue engraving I opened Pandora’s box.
laser and two galvanometers from China. (Free shipping! Figure 2 shows the layout of the completed laser
Such a deal!) engraving system with a keyboard to enter the characters.
Figure 1 shows the final result which I’ll describe in the Just for fun, I decided to build the project in breadboard
24 January/February 2019
Several months ago, an idea popped into my head for a
fun project. I wondered if I could burn some characters
into the yellow paint of a No. 2 pencil with one of those
powerful diode lasers available on eBay. Perhaps it could
be my name or my grandkid’s names, or even a happy
birthday message to my lovely wife.
form, instead of
packing it in a
big aluminum
enclosure.
Coincidentally, my
wife had recently
replaced her old
cutting board in
the kitchen with a
new one.
So, I grabbed
the “retired”
one and the
rest is history. A
breadboard on
a breadboard.
(Pretty silly I know,
but I thought it
was clever at the
time.)
Figure 3 is a
more detailed view ■ FIGURE 3:The laser engraver with all its components labeled. Note the exhaust fan on the left.
of the board, with
labels on the major parts. Be sure to check it out, so you’ll desired specs are listed in Downloads 1 as well.
know which components I’ll be referring to. The galvo system came complete with the two
galvanometers, two driver boards, a ±15V power supply,
and all the connecting cables.
THE MAIN COMPONENTS In my opinion, the best way to start this project is to
The two main components are the 1/2 watt blue laser buy the laser and galvos, and fire them up on the bench
and two galvanometers (galvos) that steer the beam, as before doing any permanent mounting.
seen in the close-up shot in Figure 4. Figure 5 graphically For safety, you can substitute a red laser pointer in
illustrates the laser path and Figure 6 shows how a 5x7 place of the more powerful (and not eye-safe) burning laser
character is formed. to test the galvos.
The laser briefly pauses at each dot for about 100 ms Note that all the tapped holes and mounting hardware
and burns a tiny spot. The mirrors then quickly move the of the laser, galvos, and X axis stage are metric. Be sure to
beam to the XY coordinates of the next dot, etc. use the correct metric screws to mount them.
Both the main components were available on eBay
when I wrote this article, so hopefully they’ll still be there
when you read this. HOW I CHECKED OUT THE
The links to them are in the file marked “Downloads LASER
1” with the rest of the article extras. If they aren’t available,
there are numerous other similar units that will work. The The laser finally arrived from China after four weeks.
January/February 2019 25
laser driver board. This would allow you to pulse the
laser on and off. Terminal #1 of the button should be
connected to an external +5V source and terminal
#2 to a 1K resistor to ground. Also hook Terminal #2
to the TTL/PWM wire on the driver board. DO NOT
let the TTL/PWM wire float because the laser may
suddenly turn on. A SPDT button would be suitable
too, with no resistor required.
I used a block of wood at a distance of 8” as
a target. With the button in my hand, I put on the
goggles and pushed it. NOTHING HAPPENED!
What the heck!? On, off, on, off, nothing! What’s
that smell??? Something was definitely burning, but it
wasn’t the wood. I then saw the problem.
I had inadvertently left a small piece of blue
painter’s tape on the front of the laser, which I had
purposely placed there to keep dust off the lens until
I was ready to use it. The tape had a tiny burn spot
right in the center.
Believe it or not, I have built and operated lasers
for over 40 years and thought I knew what I was
doing. After all, it’s not rocket surgery!
Next, I tried some pencils at 8” away, and the
■ FIGURE 4:The 1/2 watt blue laser bounces off the X and Y galvo smoke came forth. A half second burned a nice spot;
steering mirrors and travels six inches to the pencil. two seconds was too much. Success!
The laser had a focusing ring on the front,
so I screwed it in and out until the burnt spot on
the wood was the smallest.
The little focusing ring was hard to grab,
so I added a larger ring that was easier to turn,
as seen in Figure 4. I suggest not using plastic
materials as targets because the smoke may not
be healthy.
HOW TO BE SAFE
WITH LASERS
Notice back in Figures 2 and 3 that the
optical path to the pencil is completely covered,
so there is no chance the beam will “get loose”
and hit someone’s eye.
The laser emits a 1/2 watt of blue light
which will instantly burn a spot on your retina
if you view the direct beam. Reflections from
■ FIGURE 5:You can use a low power red laser pointer to test the galvos shiny surfaces can also be a problem if they are
before mounting them. mirror-like.
I have a pair of goggles that I use, but just
I hooked up +12 volts to the Vcc of the power connector to be safe, I always use a 3x5 card or piece of wood as a
and +5V to the TTL/PWM input of the laser driver board target to indirectly view the beam.
(mounted vertically on the left side of Figure 4) in the One time when I was working on a high-energy
manner described next; +5V = laser on, 0V = off. chemical laser, the beam “got loose” after a mirror
CAUTION: I would suggest connecting an on/off fractured from the intense heat.
button to the TTL/PWM connector wire coming from the The uncontrolled beam almost burned its way through
26 January/February 2019
an exterior wall made of plaster board and corrugated
metal before we hit the red button. Whew!
GALVO CHECKOUT
Figure 5 shows how the galvos are positioned so they
steer the beam in the X and Y axes. The shaft/mirror of
the galvo is designed to rotate mechanically about ±15
degrees, which translates to an optical beam motion of ±30
degrees. A torsion spring inside returns the shaft to center.
There were a gaggle of cables that came with the galvos
but absolutely NO instructions on how to hook them up.
Luckily, the driver board connectors were keyed.
The three-pin signal input connector had a tiny little +
and – marked on the board and the power connector had
±15V. Get out your magnifying glass!
First off, the galvos MUST be powered up to make
the mirrors move to their “center” positions. For initial ■ FIGURE 6:The characters are formed using a 5x7 matrix.
testing, the signal inputs should be shorted or have zero Adding custom characters is a cinch.
volts on them. Refer to Figure 7 for the schematic. The
DACs (digital-to-analog
converters) are not needed ■ FIGURE 7:The schematic includes serial DACs to drive the galvos. An Arduino Mega 2560 is
for these tests. the master controller.
I set up a red laser
pointer so it was 1” from
the lower galvo mirror; a
piece of white cardboard
was 6” away from the
upper galvo mirror. I then
applied a small voltage
(+1.0 VDC) to each of
the galvo inputs and
noted which way the
beam moved. You want
it to go in the +X and +Y
directions.
Simply reverse (rotate)
the three-pin connectors
on the ends of the input
signal cables to reverse the
direction of movement.
In this project, the
serial DACs put out 0 to
+5 volts, so the galvos only
move in one quadrant to
form the letters; to the
right and up.
I measured the motion
of the red laser spot on the
screen and it was about
2° (optical) for a 1.0 volt
input. That equates to only
needing 0.6 volts from the
DACs to write a 0.15” high
January/February 2019 27
drawings of the optical components on the
breadboard because there are just too many ways
to mount them. The only dimensions I suggest you
keep in mind are: 1” between the laser and the
center of the lower galvo mirror; and 6” from the
upper galvo mirror to the pencil.
Try to keep the optical path generally parallel
with the plane of the breadboard by mounting the
components at right angles to each other and their
bases parallel to the breadboard. I chose to put the
laser and mirrors inside an aluminum box for eye
protection/safety reasons.
A piece of thin plastic forms a window to keep
dust off the optics. Any clear plastic will work,
although check that it doesn’t absorb too much
energy and melt.
MOUNTING THE
PENCIL
■ FIGURE 8:The six-sided pencil is held in place on the shelf by a Here’s a place where innovation could be
small piece of double-sided tape. Don’t laugh, it works! applied. The real problem is that most No.2 pencils
have six sides, and when they are in the right
character on a pencil 6” away. Good. rotation for burning, the bottom of the pencil is resting on
BTW, unless you are a servo guru, DO NOT try to a peak, not a flat. I chose the easy way out: double-sided
adjust any of the pots on the galvo driver boards because tape!
you could destabilize the galvo PID loops. Notice that the I made a simple aluminum angle shelf for the pencil
pots are locked with a dab of glue and are only meant to and put a thin strip of double-sided tape on the BACK
be factory adjusted. WALL of the shelf. Refer to Figure 8.
To mount a new pencil, I hold it down against the shelf
while pressing it against the sticky tape in the rear. (Hey, it
DESIGNING THE OPTICAL works!) I can burn at least a couple dozen pencils before
PATH changing the tape.
Of course, there are tons of other ways to mount the
I decided not to present any detailed mechanical pencil, like using a small three-jawed chuck.
My friend, Wayne suggested including an indexed
■ FIGURE 9:The control panel includes four pots to adjust rotation capability, so the pencil could be rotated exactly
the character burn-time, size, spacing, and vertical location.
28 January/February 2019
60 degrees. This way, all six ITEM QTY DESCRIPTION DIGI-KEY (unless noted)
faces could have a different
C1,C3 2 Capacitor, 10 µF, 20V 478-1840
message.
C2,C4 2 Capacitor, 0.1 µF, 50V 478-7340-2-ND
CRITICAL: R2
R13
1
1
Resistor, 1K, 1/4W
Resistor, 2K, 1/4W
1QBK-ND
2KQBK-ND
ALIGNING R1,R3,R5,R7,R20,R21 6 Resistor, 4.7K, 1/4W 4.7KQBK-ND
THE PENCIL R9-R12,R14-R19,R22-R25 14 Resistor, 10K, 1/4W 10KQBK-ND
SHELF R4,R6,R8 3 Resistor, 47K, 1/4W 47KQBK-ND
R26-R29 4 Potentiometer, 10K, 1/8” Shaft 392JB103-ND
This is important! The Q1-Q5 5 Transistor, NPN, 2N3904 2N3904PS
pencil shelf must be absolutely
U1,U2 2 DAC, 10-bit, SPI/VREF, 8-pin DIP MCP4811-E/P
parallel to the movement
of the stage, or the burned KNOB 4 Knob, for 1/8” Shaft 679-3543-ND
characters will “walk off” the MCU1 1 Microcontroller, Arduino Mega 2560 1050-1018-ND
pencil. The way I did this was KB1 1 Keyboard, Mini, PS-2 (see Note below) Amazon Adesso EasyTouch110B
to mount the X axis stage unit
J1 1 Receptacle, PS-2, 6-pin CP-2860-ND
on the breadboard such that
the centerline of the leadscrew J2 1 Receptacle, Power, 3-pin, 115 VAC Jameco 147901
was perfectly parallel with USB CABLE 1 USB Programming Cable, Modified See text and figure
the breadboard base. I then LED1 1 LED, Red 516-1335-ND
clamped a 12” precision ruler
F1 1 Fan, 40x40x20 mm square, 12 VDC Jameco 2233166
to the pencil shelf.
Finally, I carefully adjusted STG1 1 Stage, 4 inch travel, w/Stepper Motor SainSmart 101-80-124
the rotation of the shelf in the BRD4 1 Stepper Motor Driver Board SainSmart 101-60-194
vertical slots of the stage (see PS1 1 Power Supply, 5V@6A, 12V@4A 102-2525-ND
Figure 8 again) until each end LCD1 1 LCD Display, 4x20,Serial In Seetron BPP-420L or 420VY
of the ruler was exactly the
FUSE 1 Fuse, 3/4A, 3AG F2507-ND
same height from the base,
±0.010”. You’re done! FH1 1 Fuse Holder 283-2711-ND
SW1 1 Switch, Toggle, SPST, Power Jameco 76241
OTHER STUFF SW2,SW12,SW13 3 Switch, Micro, Safety and Limit Jameco 188867
SW3-SW8 6 Switch, Mini Button, SPST Jameco 26623
The electronics are pretty
standard; refer back to Figure SW9-SW11 3 Switch, Mini Toggle, SPDT Jameco 2258486
7. SainSmart sells both the X BP1 1 Beeper, 5V Jameco 138713
axis stage and a stepper motor LAS1, BRD3 1 Laser, Blue, 405 nm with Driver Board eBay
driver board to move it. I
GALVO SYS 1 XY Galvo System, includes: eBay
chose a 4” stage because 4” of
characters fit nicely on a pencil. G1,G2 (2) Galvanometer with mirror
Limit switches were added BRD1,BRD2 (2) Driver Board, Galvo
to both ends of the stage PS2 (1) Power Supply, ±15V
because I hate to have it bang
GOGG (1) Goggles, Laser, 405 nm
into the ends and stall.
Initially, after burning BREADBOARD 1 Wooden Breadboard, 22”x15” used My wife’s kitchen
several dozen pencils, I added WINDOW 1 Plastic Sheet, thin, 1” sq Found item
a small fan and ducting to carry PENCIL 100 Pencil, No.2, Yellow or Light Color Staples
away the smoke because it
Note: It appears that some full-size USB keyboards with a USB/PS2 adapter are not compatible. The
always seemed to drift directly mini keyboard from Amazon was $19.50 at the time of publication.
toward me. (Cough.) ■ PARTS LIST.
You could add a piece
of tubing and route it out a window if the smoke really Figure 9 shows that the control panel has four pots in
bothers you or someone else in the area. the lower right which are used to adjust the characteristics
January/February 2019 29
of the characters, like size, spacing, vertical position, and my software is not pretty but it works. I have annotated it
— most importantly — the burn time. Different kinds of in many places and hopefully you can follow the general
pencils require different burn times to get a good image. flow. Refer to “Downloads 3” for a listing of the Operation
Too long a time leaves a black mess. Too short and the Menu on the LCD. The menu starts with:
letters are too light. Be ready to burn up quite a few test
pencils at first. DO KEYBOARD ENTRY:
The Arduino Mega 2560 microcontroller board was 1. NEW MESSAGE
ideal for this application because it had SPI to talk to the 2. REPEAT BURN
DACs, serial for the LCD, a PS2 keyboard header file, and 3. CHARACTER ADJUST
enough interrupts to handle the limit switches and some
button inputs. Arduino Unos never seem to have enough You type in your message; it engraves the pencil; and
pins or interrupts. ends with REMOVE PENCIL.
The Arduino IDE (integrated development Not all the ASCII characters are implemented at
environment) version I used was 1.0.6.1 and it included present, but the usual A-Z, 0-9, and punctuation marks are
a keyboard header file that handled PS2 keyboards. It in the CharacterArray. The lower case letters (a-z) can also
seemed that many full-size USB keyboards — even with be typed in, but that part of the CharacterArray is presently
USB/PS2 adapters — did not work with it. (Yes, I’ve read loaded with the coordinates of the upper case letters.
numerous articles about adapting keyboards but there is Result: The pencil will always get burned with upper case.
only so much time.) If you try to type in a character that is not
After trying a bunch of mini and full size AT, PS2, and implemented, the system will not accept it. See
USB keyboards (plus numerous adapters), I ended up “Downloads 4” for instructions on how to add a custom
with a mini PS2 with its own adapter. It worked fine and is character or fill in the remaining special ASCII characters.
included in the Parts List.
CLOSING COMMENTS
SOFTWARE This has been a fun project for me because of my
Loading, editing, or saving the Arduino sketch for this background in lasers. As you can see, there is ample room
project required a modified USB cable that had no +5 volts for changes and innovations, and many custom characters
going through it. You still need the data, clock, and ground to make.
lines. The problem is that the Arduino Mega is powered by Lasers can be hazardous but please don’t let that
a five volt power supply on the breadboard and a standard dispel you. By the time you burn your first pencil, it’ll just
USB cable would also try to power it with five volts from be another tool. Good luck! I welcome comments and
the host computer. other helpful advice — especially regarding software. NV
This situation causes a conflict which must be
eliminated by snipping the +5V wire in the USB
programming cable. Please see the file “Downloads 2” in Post comments on this article and find any associated
the article downloads for a diagram of how to modify a files and/or downloads at www.nutsvolts.com/magazine/
standard USB cable. issue/2019/01.
For those of you who are just starting with Arduinos,
the ArduinoLaserPencilSketch.ino sketch (file) for this
project (also in the article downloads) should be put into
a newly created folder named ArduinoLaserPencilSketch.
This will enable you to open, edit, and save it back to the
folder.
Later on, you may want to edit the sketch and give it a
new name before saving it. When you select “Save As” and
enter the new name, the Arduino IDE will automatically
create a new folder that has exactly the same name as your
newly-named sketch. The IDE will automatically place the
new sketch inside the new IDE-created folder. Simple!
Bottom line: Every Arduino sketch file (.ino) must be
inside a folder with the same name or the Arduino file
system will give you an error.
As you can see in the ArduinoLaserPencilSketch file,
30 January/February 2019
Bench and Builder
USB Add USB to your next project--
Electronics
www.dlpdesign.com
START CREATING!
www.sdp-si.com 516-328-3300
BUILD A FUN
STYLOPHONE
I decided to make an electronic musical toy as a
Christmas gift for my young son. I browsed the Web
looking for inspiration and found the stylophone: a
miniature analog stylus-operated keyboard that was
invented in 1967 by Brian Jarvis. I based my own design
on this; in fact, I replaced short keys with long ones,
thus creating a kind of writing pad. Indeed, you can
write characters and even words on this pad, and every
character has its own ‘sound portrait.’
The Circuit
The circuit shown in Figure 1 is basically an astable
oscillator built with an IC 555; you can find a description
of how this circuit works if it seems unfamiliar on www. Therefore, if you want to change the frequency, you
electronics-tutorials.com. should change either R or C. When playing a stylophone,
The frequency of the oscillations depends on the you change R2 to change the frequency of the sound. I
values of R1, R2, and C1, and is calculated as: transformed the formula (1) to separate R2:
32 January/February 2019
connect (R2 + R3 +R4), and so on. Thus, the value of R3 is
calculated as:
■ TABLE 1.
C#5/Db5 554.37
D5 587.33
D#5/Eb5 622.25
E5 659.25
F5 698.46
F#5/Gb5 739.99
G5 783.99
G#5/Ab5 830.61
A5 880.00
A#5/Bb5 932.33
B5 987.77
C6 1046.50
■ FIGURE 3. Inside view (B).
A complete table can be found
at http://pages.mtu.edu/~suits/
notefreqs.html.
January/February 2019 33
Parts List
IC1 = NE555
R1 = 10 kΩ
R2 = 1876Ω
R3 = 411Ω
R4 = 438Ω
R5 = 456Ω
R6 = 482Ω
R7 = 520Ω
R8 = 546Ω
R9 = 570Ω
R10 = 626Ω
R11 = 650Ω
R12 = 690Ω
R13 = 730Ω
All resistors have a power rating
of 0.125W.
C1 = 100 nF, ceramic
■ FIGURE 4. Outside view (A). C2 = 10 mF x 10V, electrolytic
LS1 = speaker with impedance
of eight ohms
SW1 = miniature toggle slide
switch
B1 = 4 x 1.5V batteries; type AA
■ FIGURE 6. Keys.
34 January/February 2019
Physical
Arrangement
You can see the inside of the
device in Figures 2 and 3; you’re
free to choose you own way to
position the components in the
box. The outside is shown in
Figures 4 and 5.
Keys
I made the keys from an
aluminium strip from a cross
section sized 7x1 mm. A thin layer
of aluminum oxide that is formed ■ FIGURE 7. Attaching the
on the surface of the keys protects wire to the key.
them from further oxidation but
does not prevent electrical contact
between the keys and the stylus.
A key is shown in Figure 6, whereas Figure 7 explains
how to attach wires to the keys. Figure 8 shows how to
attach the keys to the box. It’s important that the lateral
sides of the keys have no chamfers. Otherwise, the stylus
would not move smoothly on the surface. Attaching aluminum keys on the top surface of the box.
Not to scale
1 — Key.
Stylus 2 — Joint between two keys. A layer of varnish should be put on
the lateral sides of the keys to isolate them electrically.
3 — Layer of glue attaching the keys to the surface.
The stylus shown in Figure 9 is made from a ball point 4 — Top surface of the box.
pen that finished its service. The contact that touches
■ FIGURE 8. Attaching the keys to the box.
the keys is, in fact, a pin of an electrical plug. I soldered
a flexible wire to it, put the pin into the pen, and filled
the space around the pin with a
transparent resin. There is one
specific requirement: The end of
the pin should be half round and
have a smooth surface. This is
■ FIGURE 9. Stylus pen.
necessary to avoid scratching the keys.
Instrument and Tools Post comments on this article and find any associated
You’ll need an ohmmeter if you use trimmers to files and/or downloads at www.nutsvolts.com/magazine/
issue/2019/01.
establish required values of R3, R4, etc.; if you wish to get
exact notes, you could use a camertone (tuning fork) to
tune the device. A soldering iron and wire cutters will be
needed to assemble the circuit; a small hacksaw, a drill,
and a file are used to make the keys. However, your choice
of tools depends mostly on the enclosure that you’ll make
for your device; you could 3D-print it as another option.
BUILD AN RF FREQUENCY
COUNTER
BUFFER FOR HF
Most frequency
counters can
tolerate only low
levels of RF at
their input, but
here’s a way to
safely measure
the frequency
of an RF signal
of up to 200
watts with
your existing
frequency
counter.
36 January/February 2019
■ FIGURE 1. Block
diagram of frequency
counter buffer.
T
his buffer allows you to connect your transceivers. It performs well, is easy to reproduce,
counter to any RF source from 20 mW is low cost, and has a minimal parts count.
to 200 watts, from 200 kHz to 60 MHz. Most amateur HF transceivers are in the 5 to
The circuit has a protection limiter that 200 watt range. This buffer (Figure 2) will allow
keeps the RF signal strength in a safe range for the you to connect your standard desktop frequency
TTL input of the counter, as well as providing gain counter directly to the RF line, even with higher
for weaker signals (Figure 1). signal levels that most frequency counters can
You can think of the buffer as a dam safely handle. For Citizens Band, most transceivers are in
keeping high water out of Frequency Counter- the 4 to 12 watt range and will work fine with the
ville. If the water/signal is too high upstream, buffer.
you can limit how much of it gets through. Or, The low end of the buffer’s power range
if its strength is too low, you can add some. It covers the smallest of transmitters. For instance,
helps with low signals by using the gain of an the FCC (Federal Communications Commission)
inverter and holds back high signals with voltage allows experimenters to transmit up to 100 mW
protection, all on the same printed circuit board in the AM broadcast band, and the new amateur
(PCB). bands at 135 and 472 kHz. The buffer is also an
excellent front-end for an Arduino, PIC, or your
favorite microcontroller for your next HF project.
Purpose
There are many forms of RF buffer circuits
that do some of the same things. This one isn’t How It Works
the fastest, strongest, widest, or prettiest RF buffer The RF input is shown in Figure 3 as
ever made, but it’s right in the sweet spot for HF measured at Test Point 1. It shows a five watt
January/February 2019 37
signal on 14 MHz into a 50 ohm dummy load.
R1 and C1 comprise the sampling section.
R1 samples some of the RF from the signal as
shown in Figure 4. R1 has to dissipate a little of
the power, so at one watt, it’s somewhat bigger
that you may expect. C1 shapes the frequency
response and provides better sensitivity above
20 MHz as shown in Figure 5.
C2 couples the sampling section to the
protection section, and diode D3 provides
protection by limiting negative-going signals
stronger than about -0.5 volts. Diode D2 and D3
provide protection from signals above five volts.
Once the voltage at D2 goes above about five
volts, zener diode D3 will conduct to ground.
These components limit the signal to
■ FIGURE 3. RF input, five watts on 14 MHz.
between 5.0 volts and -0.5 volts as shown in
Figure 6. C3 couples the protected signal to the
input of the inverter chip U1 and Test Point 2;
R2 and R3 bias U1 for the best gain response.
The output of U1 at TP3 is a TTL compatible
signal (Figure 7) ready to go to your frequency
counter. R11 and C22 reduce harmonics to the
timer pin. The total response of the system is
shown in Figure 8.
Ready to Count
We’re done! It’s time to go
hook it up and measure some
frequencies. You’ll need a 5-15 volt
DC power supply and a BNC cable
or adapter for the RF connection.
You can use a BNC Tee
connector to attach to your coax
line, or just clip a wire onto the
post of the RF connector you
■ PARTS LIST
A Fun Club
NAME QTY VALUE VALUE 2 STYLE BRAND MOUSER PART#
Project
If your radio or U1 1 74LVC1G04 SOT-23 TI 595-LVC1G04QDBVRQ1
electronics club has not
done an assembly project in D1,D2 1 BAT46 DO-35 ST Micro 511-BAT46
a while, talk to them about
doing this one. It takes only D3,D4 1 1N4733 Vishay 78-1N4733A
about 15 minutes to assemble
once the iron is hot, and R1 1 47K 1W Yageo 603-FMP100JR-52-47K
another 15 minutes to test
a bunch of them. Have a R2,R3 2 47K .125W Yageo 603-CFR-12JR-5247K
couple of your local Elmers
bring in a frequency counter R4 1 47 .125W Yageo 603-CFR-12JR-52470R
and a signal generator. There
are no adjustments; just plug C1 1 5 pF 500V TDK 810-CC45SL3JD050DYNA
and play!
C2,C3,C4,C6 4 0.01 µF 50V Kemet 80-C316C103M5U
This RF buffer is a handy
tool you’ll remember every C5 1 47 pF 50V Kemet 80-C315C470K5G
time you use a frequency
counter. You can easily make C7 1 100 µF 50V Nichicon 647-UVR1H101MPD
one for every counter you
enlist to measure RF. L1 1 10 µH 2.2A TDK 871-B78108E1103K009
You know you’ll need it
at the most important time L2 1 100 µH 600 mA TDK 871-B78108E1104J009
while testing your six-meter
40 January/February 2019
TS-4900 4GB MLC eMMC flash storage
Computer on Module WiFi and Bluetooth on-board
High speed industry standard
i.MX6 ARM CPU connections
WiFi & Bluetooth
Rugged, Industrial with Fanless
Solo or Quad Core
-40°C to +85°C Range
www.poscope.com 2 GB DDR3 RAM
- USB - PWM
- Ethernet - Encoders
- Web server - LCD
- Modbus - Analog inputs
- CNC (Mach3/4) - Compact PLC
- IO
- up to 256 - up to 32
microsteps microsteps
- 50 V / 6 A - 30 V / 2.5 A
- USB configuration
- Isolated
PoScope Mega1+
PoScope Mega50
-up to 50MS/s
-resolution up to 12bit
-Lowest power consumption
-Smallest and lightest
-7 in 1: Oscilloscope, FFT, X/Y, Recorder,
Logic Analyzer, Protocol decoder, Signal
generator
January/February 2019 41
The Discovery of
Radio Waves
By George R. Steber
When the concept of electromagnetic waves was first
proposed around 1864, it was met with great skepticism.
As a result, the idea languished for a long time. This is
understandable since the foundations of the theory were
complex and the conceptual ideas were at odds with
physical thinking. It took several decades for a handful
of dedicated persons — infatuated with the mysteries of
electricity and magnetism — to finally put the theory on a
solid footing.
In this article, we’ll take a look back at this period that launched the
serious study of radio waves. We’ll examine the contribution of James Clerk
Maxwell, the man most responsible for the concept. Next, we’ll look at the
work of several notable scientists who came after Maxwell, and see how
they confirmed the existence of radio waves.
W
e have a seemingly unlimited examine what we mean when we talk about
electromagnetic spectrum consisting such waves.
of radio waves, microwaves, visible
light, ultraviolet, x-rays, and gamma rays.
How we came to discover and comprehend
these astonishing waves is a captivating
story. In what follows, we’ll look back at the
historical underpinnings of electromagnetic
waves — and we’ll do so without invoking
theoretical derivations. But first, let’s
induction consisting of tiny spinning cells of magnetic flux. capacitors and inductors had determined their values
Each cell is surrounded by small particles of some form that very precisely. Using these numbers, Maxwell was able to
helped carry spin away from one cell to another. calculate the speed of an electromagnetic wave in space.
Although he eventually discarded this concept, he Amazingly, when he compared his value to the existing
found that this picture helped him describe a variety of values of the speed of light, he concluded from their
electromagnetic phenomena. Perhaps, most importantly, closeness that light must be an electromagnetic wave.
it helped lay the basis of a radical new physical concept
known as displacement current.
Displacement current is a difficult concept since it is Maxwell Predicts Electromagnetic
not really a current. Normal conduction current found in
wires consists of moving charges. Displacement current is a
Waves
way of describing how the change in electric fields passing
through a given area give rise to a magnetic field, just as a In 1864 when he was 33, Maxwell presented a paper
conduction current would do. “Dynamical Theory Of The Electromagnetic Field,” where
An ordinary capacitor holds within it one of the most he theorized that an electromagnetic disturbance travels in
striking examples of displacement current. Consider a free space with the velocity of light. He also conjectured
parallel plate capacitor in an electric circuit with empty that light is a transverse electromagnetic wave even though
space between the plates as shown in Figure 4. If the this fact was somewhat hidden in the set of equations he
capacitor is charging, that causes charge buildup on the proposed. Most importantly, he described how electricity
plates and an increasing electric field Ε between the plates. and magnetism are inexorably linked in a moving
This changing electric field causes a changing magnetic electromagnetic wave.
field B which is related to the so-called displacement When Maxwell introduced his theory at a presentation
current ID = IC. No conduction current actually flows to the Royal Society, the audience was mystified. Maxwell
between the plates. had shown a fundamental shift in his approach. Instead
However, Maxwell’s displacement current is more of building imaginary physical models, he tried to discern
fundamental than this example shows. It can arise in any scientific truth from well established mathematical relations
medium including regions where electrons are available or known as the laws of dynamics.
not. And, just like a conduction current, it gives rise to a To the audience, a difficult physical model would be
magnetic field. bad enough, but a theory based on no model at all was
Maxwell’s new concept provided the necessary bridge beyond their comprehension! Their perplexed state is
to link measureable circuit properties such as permittivity understandable since Maxwell’s paper was long, hard to
and permeability of free space. He somehow realized that grasp quickly, and the mathematics was difficult to follow.
these constants can be combined to determine how fast an It described how various variables interacted and how
electromagnetic wave travels in space. they moved in space and time. More confusingly, it used
Maxwell relied on others whose experiments on the concepts of vectors to represent electric and magnetic
field intensities and flux densities. Few people of the time
understood vectors. For newcomers, it was especially
And Magnetism” into the new D and the magnetic field strength H
and more compact form shown — related to Ε and B by constants
here. They have become the that reflect the nature of the
standard that today defines the medium that the fields pass through.
relationship between electricity and The displacement field D was the
magnetism and the wave nature key contribution of Maxwell. The
of electromagnetic radiation. last equation describes how both
Shown here is the differential form changing electric fields and current
of Maxwell’s equations, but other produce magnetic fields.
forms exist such as the integral form. The symbol ∇ is a vector
Here, Ε and B are the electric differential operator, commonly
Figure 6. Around 1884, Oliver and magnetic fields respectively, ρ called Del or nabla that compactly
Heaviside began writing the is the electric charge density, and J expresses the calculus that involves
20 fundamental equations of is the current density. There are two directionality of the three x, y, and z
Maxwell’s “Treatise On Electricity other fields — the displacement field components.
January/February 2019 47
Figure 8. George Francis
Fitzgerald was an Irish professor
of physics at Trinity College in Lodge’s friend George
Dublin, Ireland. He is known for his Francis Fitzgerald (Figure 8),
work in electromagnetic theory a professor of experimental
and for the Lorentz–Fitzgerald philosophy at Trinity College
contraction, which became an in Dublin.
integral part of Einstein’s special It turned out that
theory of relativity. Lodge and Fitzgerald were
captivated by Maxwell’s
equations Heaviside’s equations. work and were trying — with
He said that he believed that mutual support — to carry it
Maxwell — with good reason forward, largely through the
— “would have admitted to the exchange of letters. Fitzgerald
necessity of the changes when was a brilliant theoretician
pointed out to him.” Hence, he felt but a bit lazy when it came to
they should be called Maxwell’s experimental work. However,
equations. he was one of the very few
Refining a mathematical people who read and learned
theory was one thing, but finding the “Treatise” in detail.
experimental evidence to support Lodge, on the other hand,
it was something else. With the was more comfortable using
help of two other Maxwellians and models rather than equations
a little known German researcher, and enjoyed experimental
Heinrich Hertz, the fog began to work. Heaviside’s bond with
lift. them was immediate, and
they began collaborating in the hope of advancing the
understanding of Maxwell’s theory.
Other Maxwellians Arrive On the Lodge and Fitzgerald were particularly interested
Scene in finding experimental evidence to support the idea
that light is an electromagnetic wave. They didn’t have
much success in this endeavor initially. One day, Lodge
Up to 1888, Heaviside was doing the same things: was experimenting with a lightning protection system in
reading journals, writing papers that were seldom read, preparation for a talk to the Society of Arts.
and rarely travelling from his He endeavored to simulate
home. One day, he happened lightning by discharging Leyden
upon a report by Oliver Joseph jars across the wires. Sparks
Lodge (Figure 7), professor of appeared between the ends of
physics at University College the wires. This was expected,
in Liverpool, wherein he was but soon he found that by
mentioned for his work on varying the wire lengths he
Maxwell’s theory. Overjoyed to could make very large sparks
find a kindred spirit, Heaviside or weaker ones. He realized
promptly wrote to Lodge and immediately that he was seeing
found he had another admirer, an electromagnetic wave in
resonance. With enough
Figure 9. Heinrich Hertz was power, he claimed to actually
a brilliant German physicist see the ionized standing wave
and experimentalist who around the wire.
demonstrated that the Lodge planned on
electromagnetic waves reporting his astonishing results
predicted by James Clerk when he returned back from
Maxwell actually exist. In a vacation in the Alps. For
November 1886, Hertz became the trip, he took along some
the first person to transmit and unread journals. While on the
receive controlled radio waves. train leaving from Liverpool, he
48 January/February 2019
Figure 10. Hertz took this photo of his lab.
It shows the coil that he used (left) and the
antenna — a dipole resonator with spark
gap that he used to detect electromagnetic
radiation.
Continued from page 17 capability. It is compatible with iOS, to prevent damage to the instrument
Android, and PCs, and features a low and the device under test (DUT), such
or 3 GHz frequency. In addition to noise floor and high maximum input as overtemperature, overload, and
being able to measure RF signals, it power. short-circuit protection.
is also an RF signal generator and Featuring four channels, the
features a tracking generator and R&S®HMP4040 power supply offers For more information, contact:
independent continuous wave (CW) a maximum voltage of 128V and Rohde & Schwarz
signal generator. maximum current of 40A, up to 10A www.AskAnEngineer.us
The R&S®FPC1500 spectrum output current per channel; 160W of
analyzer includes a one-port vector channel power is available with the REAL TIME STREAMING
network analyzer with Smith chart
display, a signal generator, internal
R&S®HMP4040. This unit offers the
same voltage range on all channels.
FROM DEVICES
voltage standing wave ratio (VSWR)
bridge, independent signal source,
and resolution bandwidth settings
The R&S®HMP4040 comes
standard with a dual USB/LAN
interface and locates all basic
T ektronix, Inc., has announced
the launch of a new Initial State
data streaming and visualization
down to 1 Hz. functions on the front panel to allow service for individuals. The cloud-
The R&S®FPC1500 includes a for direct access. based data service — which includes
10.1 inch Wide XGA (WXGA) display Offering high efficiency and low unlimited data streaming and dynamic
(1366x768 pixel), is Wi-Fi-enabled, residual ripple, the product includes visualizations — is ideal for students,
and includes a remote control a wide variety of protection features individual engineers, technologists,
50 January/February 2019
and electronics hobbyists. dashboards, GPS trackers,
Following a free 14 day manufacturing line data
trial, the service is priced collection, education, and
at $9.99 per month or $99 energy use tracking to name
per year, and is free for a few. Among the platform’s
students. The Initial State more advanced capabilities
data service is well-suited are real time data
for applications that involve transformations that make
real time streaming data it easy to derive meaning
from IoT devices, creating from both historical and real
dashboards to visualize time data without manual
the data, and sending out calculations.
triggers and alerts. It can Real time triggers allow
also be used to capture users to set alarms with
and collaborate on test and SMS and email notifications.
measurement data, with features like installed software. All visualization Using these tools, engineers can build
an interactive multi-row waveform and analysis applications are available hosted data applications using both
viewer accessible through a web through a web browser. historical and incoming real time data.
browser. Initial State uses AWS To improve collaboration, users
Users can share and annotate infrastructure and enterprise-grade can add notes, comments, and
waveforms, providing a better way to best practices for encryption, data, emojis for specified time ranges and
collaborate as compared to sending and access management, and offers then cycle through annotations for
around screen captures. high uptime and full data redundancy. presentations and review.
The cloud-based Initial State The platform incorporates a robust
For more information, contact:
platform provides a highly secure set of tools for a wide range of
centralized repository for time-series applications such as home/office
Tektronix
www.initialstate.com
data and untethers analysis from monitoring, IoT device performance
January/February 2019 51
More Tricks
with
Old-School
Digital Clocks
By Bryant Julstrom
52 January/February 2019
Figure 1. Typical design
of a discrete logic clock.
The Time Base minute to drive the counters that identify the time’s digits.
Crystal frequencies that include larger prime factors
Any crystal frequency can be used in the time base so should be avoided. It’s inconvenient to try to divide by,
long as it can be divided down to provide the frequencies say, 23. Powers of 2 like 4.194304 MHZ are the easiest to
a clock requires. The tools available here include binary divide down. Just use the requisite number of stages in a
ripple counters (sequences of flip-flops) like the CD4020 binary ripple counter.
and CD4060, and decimal and binary counters like the The necessary signals can also be derived from the
CD4510, 74LS90, 74LS161, and many others. 60 Hz line frequency. Assuming a low-voltage transformer
Suppose, for example, that our junk box yields a crystal powers a clock, the transformer’s output is rectified
whose frequency is 3.072 MHz and we desire a 1 Hz separately from the clock’s power supply — but not filtered
signal. The prime factorization of 3,072,000 is 213 x 3 x 53. — and run through a Schmitt trigger; there will be noise on
Rearranging the factors to match various counters, we get the line, and we don’t want extra pulses.
3,072,000 = 211 x 102 x 15. We can generate a 1 Hz signal The trigger can be an inverter in any of several chips,
from the output of an oscillator based on this crystal with, based on a TLC555 or an op-amp, or built from discrete
say, 11 stages of a CD4020 to divide by 211; a CD4518 components. The resulting signal will be divided by 60 to 1
dual BCD up-counter to divide by 10 twice; and a CD4516 Hz and by 60 again to 1/minute.
binary counter with additional logic so that it resets when it An elegant device that divides by 60 is the 74LS57:
reaches a count of 15 rather than 16. an eight-pin DIP integrated circuit that was designed for
These stages can occur in any order, so we can choose use in clocks. (The 74LS56 divides by 50, for clocks in 50
appropriate higher-frequency signals for setting. Dividing Hz systems). Two of these yield a 1/minute signal from
the 1 Hz signal by 60 = 6 x 10 yields one pulse every the line frequency and take up little space on a board. The
January/February 2019 53
Figure 2. A circuit that divides a 60 Hz input down to
1/minute. It divides the input frequency by 15, by 16, and Hz, 4 Hz, 1 Hz, and 1/minute. The first and third counters
then by 15 again. count down from 15; they are reset to ‘1111.’ The middle
counter counts up to 16. In general, external logic
can be used to reset any counter when it reaches a
specified count less than 10 or 16.
Seconds
A useful extension of the design above accepts
an input signal of 1 Hz and displays seconds as well
as minutes and hours. This requires only duplicating
the minutes circuitry to count seconds. In this case,
the colon need not blink, and it might be useful
to be able to set the seconds directly to zero by
resetting the seconds counters. The seconds can be
presented using smaller displays. Figure 3 shows a
CMOS clock with a seconds display.
Technologies
As our discussion suggests, a clock of this
kind may use any of the familiar integrated circuit
Figure 3. A CMOS 12 hour clock with a seconds display. technologies. TTL and its relatives in general require
more current than CMOS, but both work perfectly
74LS57 is, however, very hard to find and so probably not well. If you want to really go back in time, there are RTL
a viable choice. counters that can be used.
Certainly, one can twice divide by 10 and by 6, using,
say, 74LS90s or other BCD counters and two 74LS92s, or
using BCD or binary counters and some additional logic to
Driving Displays
reset two of them when they reach 6 (and 10 if necessary). Directly
Noting that 3600 = 152 x 16, another solution uses two Usually, in circuits like these, each digit (except
binary counters and additional logic to each divide by 15, perhaps the hours 10s) is identified by a counter whose
and a third binary counter to simply divide by 16. BCD output goes to a driver. The driver — for example, a
Figure 2 shows such a circuit using three 74LS193 up/ 74LS47 or CD4511 — has seven outputs that the driver sets
down binary counters with 60 Hz input and outputs of 60 high or low so the seven segments of a display present the
54 January/February 2019
Figure 4. A circuit using a CD40110
counter/driver that counts from 0 through 5
and, upon detecting segment signals unique
to ‘6’, resets to zero.
digit. The CD40110 is a decimal up/
down counter that includes a driver;
its seven outputs drive the segments
of a common-cathode LED display
directly. We can build a clock using
CD40110s, but counts that stop short
of 10 require additional logic that Figure 5. A diagram of the Hewlett-
responds to the segment outputs. Packard 5082-7000 LED display.
For example, the minutes 10s
counter must reset when its count derives from this observation:
reaches 6; a reset signal must Counting downward in positive
respond to segments that appear BCD yields the same sequence of
together in the digit ‘6,’ but not in representations as does counting
any lower-valued digit including ‘0.’ upward in negative BCD.
Similarly, to identify when to roll The appropriate choice here is a
the hours count over from 13 to 1 presettable binary counter that can
(for a 12 hour clock) or from 24 to count down, such as the CD4516
00 (for a 24 hour clock), logic must and the 74LS193. To count up from
respond to inputs to the two hours zero in negative BCD, set such a
digits that uniquely identify 13 or 24, counter to 1111 — the inverted
respectively.
Figure 4 presents a circuit for the minutes 10s digit
using a CD40110. This counter must reset to 0 when its
Introducing the
1(:39-U
count reaches 6. The digit ‘6’ illuminates, among others,
the e, f, and g segments of its display; these are not all on
in any preceding digit. A three-input AND gate identifies
this pattern and raises the reset line to the CD40110; the
0LQL&LUFXLW%RDUG+ROGHU
counter immediately resets to zero. (Alternately, a NOR
gate could detect a unique pattern of low outputs from a
CD40110.)
Switch Debouncing
Clocks of this kind are generally set in one of two
ways. The first sets the minutes and hours individually using
a signal of, say, 4 Hz or so. The second presents the clock’s
counter chain with 60 Hz for fast setting or, again, 4 Hz or
so for slow setting.
In either case, signals from the time base must be
switched. Often, this is done directly with pushbutton
switches. Unfortunately, many such switches bounce on
both make and break, so setting becomes more random
representation of zero — and count down. The outputs of than predictable. Simple debouncers can use flip-flops or
the counter are then directly acceptable to displays like the R/C circuits.
5082-7000. Figure 6 shows inside and outside views of a Switch debouncers can also use the ubiquitous NE555
24 hour clock that uses four of these displays. or one of its relatives. The circuit in Figure 8, for example,
When counters are used in this way, the minutes appears in Timer, Op-Amp & Optoelectronic Circuits &
10s counter, for example, must be reset when its output Projects, by Forrest M. Mims III. The ‘555’s output is high
reaches the inverted representation of 6. The minutes and until the switch is closed, when the output goes low.
hours 1s counters must be reset to 1111 when they reach Should the switch itself bounce on make or break, the
the inverted representation of 10. ‘555’s output still will not.
56 January/February 2019
There are also integrated circuits designed specifically
as switch debouncers. The best known is probably the
MC14490, which contains six independent debouncing
circuits. This IC is eminently simple to use, requiring just
one external capacitor. Connect a switch to an input and
use the corresponding output.
In all these cases, however, signals from the time base
are not directly switched. A debouncing circuit renders
a switch’s output clean, but that output is a high or low
voltage which must then control the disposition of the
signals. The 74LS125 and 74LS126 are described as “quad
buss buffers,” and the CS4066 as a “quad bilateral switch.”
Chips like these can implement switching at the control of
a debouncer’s output.
These ICs all contain four independent SPST switches,
each with a control line. In the 74LS125, for example,
when the control line for a switch is low, its input is
connected to its output. Otherwise, the output is in a high-
impedance state.
Figure 9 shows a circuit in which two debouncers in
an MC14490 and the four sections of a 74LS125 select
one of three signals from the time base — 60 Hz for fast
Figure 8. A switch debouncer using an NE555.
setting; 4 Hz for slow setting; or 1/minute for running — to
be passed to a clock’s chain of counters.
January/February 2019 57
C Preprocessor
Reduces Debug
58
Headaches
January/February 2019
By Jonathan A. Titus
T
he preprocessor “dictionary” lists many program and replace it with 3.14159.”
directives that help with test and debug tasks, Then, in a C statement such as:
among others. As an added benefit, you may
include debug operations in your programs circ = ONE_PI * dia;
and enable or disable them as you choose.
You no longer need to find and remove code added solely the preprocessor makes the replacement and gives the C
as debug or test tools. (For more information about the compiler the statement that follows, although we don’t see
preprocessor directives, see Resources.) it this way in a listing:
I often put several LEDs on unused MCU
(microcontroller) outputs to indicate that code execution circ = 3.1416 * dia;
reached — or didn’t reach — certain instructions. When the
program finally worked properly, I went through the code Here’s a code snippet that shows how to use the
and removed — or commented-out — all the LED control ONE_PI substitution in practice:
instructions. That’s a pain! Plus, it’s easy to forget where I
put all the LED statements or how I used them. #define ONE_PI 3.1416 / Just a text substitution
float circ; / Circle circumference
float dia = 11; / Circle diameter
Define Substitution Statements int main ()
{
circ = ONE_PI * dia;
I’ll start this tutorial with a simple example of how the print(“Circumference = %f \n” circ);
#define directive works: /Print answer
}
#define alpha beta Remember, the directive performs only a text
substitution.
When you include the directive above at the start of a
program, it causes the preprocessor to substitute the text Debug with the Preprocessor
“beta” whenever it finds the text “alpha” in the program.
Only the compiler sees the substitution; we don’t. Although you may put preprocessor directives
Suppose you define the text “ONE_PI” and its anywhere in your code, I recommend you place them
replacement, the text 3.14159 as shown here: at the program’s start, prior to the main.c code. That
approach makes them easy to find and ensures you have
#define ONE_PI 3.1416 / Just pi defined a text substitution before you try to use it in a
program.
This #define directive does not create a constant nor For the examples that follow, I used a Parallax Propeller
does it create a variable and assign it a value. It simply tells QuickStart board and the Parallax SimpleIDE software for
the preprocessor, “Find every instance of ONE_PI in the C programming. On a breadboard, I connected I/O pin
January/February 2019 59
P16 to a red LED. A high(16) command turns the red LED RED_LED_ON high(16) directive. If you do, the compiler
on and a low(16) turns it off. (Instead of controlling an LED displays an error message because it will find the RED_
with an output pin, you could use a pin’s signal to trigger LED_ON statement in your main program and tell you it
a logic analyzer or an oscilloscope.) The next code snippet never got defined!
shows how I used a directive to define RED_LED_ON I often use preprocessor directives to enable and
as high(16). You could use any similar descriptive name; disable LEDs or I/O pins used for tests as my programs
perhaps DBUG_LED_RED. The preprocessor substitutes evolve. Two directives in my software simplify LED control.
high(16) for every RED_LED_ON here: The statements in Example 1 substitute high(16) for
RED_LED_ON later in my program. On the other, the
#include “simpletools.h” /Parallax C libraries
#define RED_LED_ON high(16) /Definition statements in Example 2 substitute “nothing” for RED_LED_
ON, so the LED control statements have no effect.
int main() /Main program If I have six or seven debug LEDs and perhaps a logic
{
print(“Hello!”); /Print statement analyzer, I can control them individually as needed for
RED_LED_ON; /Turn on red debug LED tests.
}
This program compiled without errors, printed “Hello!” Example 1.
on the SimpleIDE terminal, and turned on the red LED.
That test worked, but now I no longer need to turn the LED #define RED_LED_ON high(16) /For debug purposes
//#define RED_LED_ON /use the red LED
on after the print statement. I can “disable” the LED in one
of three ways:
Example 2.
1. Delete the RED_LED_ON; statements in the main
program. If I need to use it again, I might forget I put it //#define RED_LED_ON high(16) /For final code
#define RED_LED_ON /do not use the red LED
here, though; or
2. Comment out the RED_LED_ON; statement in the You can take another approach that lets the
main program. That way, I remember where I controlled preprocessor enable or disable groups of I/O pins.
the LED; or
3. Remove only the high(16) command from the
#define directive to leave #define RED_LED_ON. Use Conditional Debugging
In the third case, the preprocessor replaces the RED_ The preprocessor can handle conditional directives
LED_ON; statement in my C code with “nothing.” The that are similar to the if-else statements in C. For the
compiler will never “see” RED_LED_ON; thus, it compiles following example, I put a yellow and a green LED on my
the code as if RED_LED_ON doesn’t exist. In other words, breadboard at MCU pins P17 and P18, respectively. I then
you can leave RED_LED_ON; statements in your C code; added the following lines for the preprocessor at the start
they simply become inactive. of a program:
If you must go back and debug again, the RED_LED_
ON; statements remain in your program. You can re-enable #define DBUG /Define DBUG.
#ifdef DBUG /Debug is defined,
them when you restore the preprocessor directive to: #define RED_LED_ON high(16) /so allow use
#define YELLOW_LED_ON high(17) /of the LED
#define RED_LED_ON high(16) #define GREEN_LED_ON high(18) /statements.
#endif /End of if section.
That’s the beauty of using the preprocessor directives The first line defines DBUG, which simply tells the
for debugging. You can leave debug operations in a preprocessor that DBUG now exists. There’s nothing
program and “enable” or “disable” them as needed via special about the name DBUG, and you may substitute
simple changes to the preprocessor directives. You no another name if you wish.
longer must hunt through your code and remove all the Next, the #ifdef directive determines whether the
LED control or other debug functions before you release a preprocessor has defined DBUG. In this example, it
final version of your software. has. So, the #ifdef statement evaluates as true, and the
Of course, you could use a search-and-replacement preprocessor executes the indented directives that define
operation to remove all RED_LED_ON statements, but if high(16) as the replacement text for RED_LED_ON,
you must debug or test a program again, you might not high(17) as the replacement text for YELLOW_LED_ON,
remember where you had the LED control instructions and and so on.
what they indicated when you ran the last tests. The following snippet of code shows how you might
Important: DO NOT comment-out the entire #define use the red and green LEDs:
60 January/February 2019
PRINT_TEST; in the program. When you run the program,
RED_LED_ON; /Red LED on when execution gets here it prints the text “Test Data” followed by the value assigned
while (alpha > beta)
{ to variable XYZ (you must define a data type earlier; in this
do this..; case, an integer for XYZ):
do other things..;
beta++; total = weight * units;
} /Calculate total weight
GREEN_LED_ON; /Green LED on at end of while loop XYZ = total;
/assign total value to XYZ
The red LED should turn on just before the MCU’s PRINT_TEST;
/print test statement
processor reaches the while command.
The green LED will turn on to show
completion of the while loop. If the
green LED doesn’t light, we likely have a
problem in the while loop. We could put
a YELLOW_LED_ON statement within the
loop to help us find incorrect instructions
or variables.
After we fix any bugs and the
program behaves properly, how can we
disable all three LED-on statements? We
don’t need them in the final code. Again,
do not comment-out the #define DBUG
directive. As explained earlier, you’ll get
an error message.
Instead, we add directives that take
effect only when we don’t define DBUG,
as shown in the next code snippet. In
this case, I may now safely comment-
out the first directive: //#define DBUG.
Then, with DBUG not defined, the #ifdef
DBUG directive evaluates as false, so the
second set of directives after the #else
take effect.
The directives in bold in the
following code define the LED control Figure 1. This multiline macro flashes an LED 20 times in a C program.
words, but they assign “nothing” to
each. Now, the preprocessor ignores the corresponding You can enable or disable the PRINT_TEST directive as
statements in the C code: needed.
#ifdef DBUG
/define DBUG
/If DEBUG is defined... Write Multiline Macros
#define RED_LED_ON high(16) / continue.
#define YELLOW_LED_ON high(17) Preprocessor macros (several lines of code in a
#define GREEN_LED_ON high(18)
#else /If DBUG is not defined contiguous block) may include complete C functions;
#define RED_LED_ON /substitute “nothing” perhaps to calculate an answer or to control an external
#define YELLOW_LED_ON /for the LED commands device as you test and debug a program. Again, the
#define GREEN_LED_ON
#endif preprocessor replaces the defined text name with the lines
of C code text.
Because the #define operation substitutes one section Why wouldn’t programmers put such tasks in a normal
of text for another prior to compilation of a program, you C function? They might. There’s no reason to create a
may create detailed substitutions such as: macro if library functions will work. Some library functions
— think of printf, for example — consume large quantities of
#define PRINT_TEST print(“Test Data %d \n”, XYZ) memory. You don’t want to include them in an embedded
MCU’s memory just for debugging. Why use printf for
Then, you assign the variable XYZ a value and insert debugging when an MCU includes a basic UART that
January/February 2019 61
might do the job?
Aim for simplicity in your programs and in your test #define MY_TEST \
print(“This is a test! \n”); \
and debug toolbox. Also, you might create macros for print(“Value at this point %d \n”, my_value)\
specific tasks and reuse them in other software or keep /No semicolon!
them proprietary. (Frankly, to minimize errors, we want to
modify our application code as little as possible.) Note there’s no semicolon at the end of the second
It’s easy to create one macro and then have the print statement. When you use the two-line macro
preprocessor insert it — or not — as required. If you disable immediately above in an if statement such as:
the macro, it’s still available if you need it at another time.
As an example of a macro, I created one to flash an my_value = 10; /Value for a test run
if (counter == 0) /if counter equals zero,
LED on a Propeller QuickStart board 20 times (Figure 1). MY_TEST; /print my_value on terminal.
Note the use of a semicolon at the end of the macro name
in the main program, and the lack of a semicolon at the The preprocessor substitutes the macro’s text for MY_
end of the macro itself. TEST; so, the if statement looks like this to the compiler:
To use the LED_FLASH macro, just put the statement
LED_FLASH; on a line in your software. The C language my_value = 10;
if (counter == 0)
statements in the while-loop macro flash the LED at pin print(“This is a test!” \n);
P16 20 times. print(“Value at this point %d \n”, my_value);
The preprocessor replaces LED_FLASH with the C /...here.
code you created. The last brace } in the macro code When counter equals zero, you’ll see only “This is
doesn’t need a semicolon because one exists at the end of a test!” on a terminal. The second print statement never
the LED_FLASH; statement in the main program. executes. Why?
This loop demonstrates how to create a macro, but The semicolon at the end of the first print statement
keep in mind it causes the MCU processor to spend eight terminates the if section of the C code (the semicolon
seconds flashing an LED before it moves on to the next at the end of the second print statement is the same
instruction! Your application might not tolerate such a semicolon that ended the macro name, MY_TEST;).
delay, even when you test it. Take a look at a typical if statement that involves two
CAUTION: When you create a preprocessor C code operations:
macro, you must end each line with a backslash \ followed
immediately by a “newline,” or a “return.” (Press the Enter my_value = 10;
if (counter == 0)
key immediately after you type the backslash.) Do not {
leave whitespace after the backslash! code here..;
The compiler will produce a warning if spaces occur more code here..;
}
between the backslash and a new line. In the Propeller
SimpleIDE, for example, the warning text reads in part: Braces — { and } — enclose a block of code that will
run when counter equals zero. A multiline macro must do
“warning: backslash and newline separated by something similar so all its lines execute properly no matter
space [enabled by default]”
where you have the macro name in a program. Some
Remove any extra spaces and the warning disappears. programmers define multiline macros with a bottom-driven
Use semicolons to end statements in the macro just as you do-while loop such as this:
would in a C program. You may leave spaces between the
semicolon and the backslash, though. #define MY_TEST \
do{\
printf(“This is a test.” \n); \
Construct Macros with Care printf(“Value at this point %d \n”, my_value); \
} while(0)
When you need a multiline macro, you must construct Now, we have the two lines of macro code enclosed
it carefully and consider what happens during the in braces within a do-while loop. Because the second printf
preprocessor’s substitution of the macro text for the macro statement exists within the loop, now you must end it with
name in a C program. a semicolon.
The format might seem complicated at first, but in The while(0) condition lets the macro’s do loop run
practice, you’ll find it easy to implement. Bruce Blinn, only once. When the preprocessor analyzes the statement:
a software developer, explains some of the traps on his
website (see Resources). I’ll briefly describe several. my_value = 10;
if (counter == 0)
The following two-line macro should print a message MY_TEST;
and then an integer value, my_value:
62 January/February 2019
it substitutes the new macro text and yields this Then, MULT(3 + 2, 4 + 2) becomes ((3 + 2) * (4 + 2))
intermediate result, although we don’t see it: and you get the expected answer: 30. Parentheses are your
friends.
my_value = 10;
if (counter == 0)
{
printf(“This is a test.” \n); Get Detailed Debug Data
printf(“Value at this point %d \n”, my_
value);
} The C preprocessor provides predefined macros such
as __FILE__, __LINE__, __DATE__, and __TIME__. Two
underscore characters precede and follow each macro
According to Blinn, the current gcc [gnu compiler name. The FILE and LINE macros come in handy because
collection] version provides another method you can use the former identifies the file in use, and the latter gives you
in place of the do-loop, as shown in the following example. the line number in that file. These two macros provide a
Simply put a parenthesis before the first brace and after helping hand in test and debug steps.
the last. I find this method easy to remember. Test this As an example, the macro that follows displays the
technique with your C compiler: name of the file in use and the line number in the code
where you put this PRINT_OUT macro:
#define MY_TEST \
({ \ #define PRINT_OUT printf(“File: %s at line %d
printf(“This is a test.” \n); \ \n”, __FILE__, __LINE__)
printf(“Value at this point %d \n”, my_value); \
})
Insert the PRINT_OUT; macro in your code and it will
Make Friends with Parentheses give you information such as:
When you use a math operation in a macro, pay File: Blink_Light_1.c at line 36
careful attention to how the preprocessor handles the
expression or you can get odd results. Remember, the Often, you’ll find this type of debug information more
#define directive performs only a text substitution. Here’s a useful than a flashing LED because it identifies a specific
simple math macro that will multiply two values: file and execution at a particular line in a program. NV
#define MULT(x, y) x * y
Post comments on this article and find any associated
files and/or downloads at www.nutsvolts.com/magazine/
What happens when you use the macro this way in a issue/2019/01.
program:
DIY Biotech:
Open Source PCR
Thermocycler
In this DIY Biotech article,
we’ll look at an Open Source
Polymerase Chain Reaction
(PCR) Thermocycler kit. In
addition to learning about
DNA amplification, we’ll
cover thermal sensing,
thermal resistance, the
thermoelectric effect, and PID
controllers.
Photo 1. Completed open source PCR thermocycler.
impossible to fully analyze the DNA without amplifying the denaturing, annealing, and extending sequence is repeated
few strands into several billion strands. dozens of times.
In biotech, this amplification doesn’t rely on tubes or With each iteration, there are twice as many DNA
transistors, but on the polymerase chain reaction (PCR): a strands as before, or 2N strands, where “N” is the number
relatively recent scientific discovery that involves repeated of cycles. For example, after only 12 cycles, there are 212
cycles of heating and cooling for specific periods. or 4,096 strands of DNA. After 20 cycles, there are 220
or 1,048,600 strands, assuming 100% accuracy, which is
THE SCIENCE never actually the case. Even so, we’re talking millions to
billions of copies per PCR run. That’s quite an amplification
Key STEM Concepts factor.
The rate-limiting step is often the hardware used to
• DNA is a double-stranded molecule that contains an rapidly and precisely heat and cool the soup of ingredients.
organism’s unique genetic code. However, even the very simple OpenPCR kit discussed
• In DNA, the nucleotide base Adenine binds with here can run dozens of cycles within a few hours.
Thymine and Cytosine binds with Guanine.
• The PCR is possible because of the heat tolerant Taq THERMOCYCLER DESIGN
polymerase enzyme discovered in E. coli bacteria growing The thermocycle kit reviewed here is fully open source.
in a hot geyser. You can opt to buy the kit from OpenPCR for $499 or
• Thermal cycling — alternative heating and cooling — build it yourself. If you go to the website, you’ll find a
is the basis for PCR. complete bill of materials (BOM) including sources, the
design of the housing panels in SolidWorks 3D, the PCB
PCR and Thermocycling (printed circuit board) in Eagle, as well as the source for the
In addition to thermocycling, the PCR process requires software, including the Arduino Uno software. A copy of
five “wet” components: the BOM is available with this article’s downloads.
An advantage of a truly open source device such
• The most obvious component is the DNA to be as the OpenPCR is that you can selectively upgrade
copied. At least a strand of an organism’s double-stranded components of the kit. For example, I’m considering
Deoxyribonucleic acid (DNA) must be present. substituting aluminum panels for the wooden panels. It
• A soup of the raw materials used to construct DNA would make for a much sturdier device, but at a cost.
— known as DNA nucleotide bases — must be created. Another advantage is increased longevity of the system.
These four bases are (A)denine, (T)hymine, (C)ytosine, and For example, if the Arduino Uno is discontinued and
(G)uanine. In constructing the double helix of DNA, the replaced with a less expensive/higher performance device,
base pairings are A-T and C-G. you have access to the source code to make any necessary
• Primers that bracket the DNA to be copied. These changes.
short pieces of DNA initiate the PCR reaction. The major design elements of the OpenPCR device
• The heat tolerant Taq polymerase builds the are a PID controller, a Peltier thermoelectric effect device,
complementary strings of DNA. thermal sensors, and an overall low thermal resistance
• A chemical buffer that creates the optimum design.
conditions for the Taq polymerase to operate rapidly
and efficiently. The buffer commonly consists of TRIS PID Controller
hydrochloride (HCl), potassium chloride (KCl), and At the heart of the OpenPCR is an Arduino-based
magnesium chloride (MgCl2). Proportional Integral Derivative (PID) controlled ST
THE BUILD
Thanks to a simple design and excellent
build documentation, the kit is suitable for
anyone who can use a screwdriver and hex
wrench. There is no soldering involved. The kit
and the build are modular. As shown in Photo
2, there are six modules including the power
supply. In all, I spent about four hours on the kit.
After reviewing the manual, my first step
was to remove the paper tape from one side
of the laser cut wooden panels (Photo 3).
The cutouts are sharp, well finished, and the
tolerances are tight. Tackling the lid module
next, I laid out the small wooden cutouts,
aluminum plates, and the electronics (Photo 4).
After removing the tape from the small Photo 4. Lid components.
Photo 10. Tube holder/temperature sensor. Photo 12. Peltier/tube holder stack.
68 January/February 2019
Photo 13. Control and display electronics.
www.embeddedARM.com
TS-7180
Single Board Computer
70 January/February 2019
Photo 19. Display from dry run.
K
ey to this project will be taking advantage hacks, hopefully in enough detail to get you started on
of one of those hardware modules (in this another exciting Amigo adventure. I think the finished
case, Bluetooth) designed for the Arduino project is pretty cool, and hope you enjoy it. However,
and other popular microcontrollers. Arduino another goal of this article is to encourage you to launch
projects — especially those built around self- off on your own Arduino-to-Amigo conversion adventure.
contained functional modules — can often be converted If you have a BT module and your controller device
to the Amigo. The Amigo has almost everything you handy, let’s cut right to the chase and establish a Bluetooth
need to leverage these units already baked in: onboard link, then see what we can do with it. (If you don’t have a
switches and LEDs; a breadboard; and a built-in integrated BT module, pick up an HC-05 for your Android or an HM-
development environment (IDE; Color BASIC) with a serial 10 for your iOS device, but beware of cheap clones. You
interface. The main trick for these Arduino project “hacks” may be able to get a clone to work, but it may be at the
with the Amigo is replacing the Arduino sketches with roll- expense of hours of trial and error.)
your-own Color BASIC programs. I tried several combinations of BT modules and apps
In this article, we’ll examine one of these project for this article with both Android and iOS devices, but we
72 January/February 2019
Vintage Computing
As originally discussed back in the December 2015 sample programs. If you already have a Propeller board
issue of Nuts & Volts, the Mentor’s Friend (nicknamed with connectors for a PS/2 keyboard, VGA monitor, and 2
the Amigo) is a direct descendant of the Pocket Mini GB SD card, however, you can “roll your own” Amigo by
Computer (PMC): a project by Jeff Ledger that combined getting the Color BASIC source available with this article’s
the work of several Propeller gurus to offer a series of downloads, updating the I/O pin assignments to match
retro computers running a version of BASIC. When the your hardware, and then loading the compiled Color
PMC was no longer commercially available, Dane Weston BASIC binary to the EEPROM on your board.
developed a simplified replacement in mid-2015 to provide Or, if you are truly ambitious, download the Amigo
a home-built, BASIC-driven mentoring platform for Nuts & schematic (also available with this article’s downloads)
Volts readers. and build out the circuits using your favorite construction
Perhaps the easiest way to build your own Amigo is techniques, then download the Color BASIC source or
from the kit available through the Nuts & Volts webstore binary and Flash it to your EEPROM.
which provides everything you need, including the Regardless of the method you choose, please use the
circuit board, all components (including an EEPROM N&V forums to share your challenges and triumphs, or to
pre-loaded with Color BASIC), and a 2 GB SD card with ask for advice if needed. Good luck!
Cursor X location = BYTE[25853] While there’s no real magic in this snippet, a quick
Cursor Y location = BYTE[25854] review may be in order. Line 28 initializes variable s, which
we’ll use to track the state of button S1 in the Amigo
Let’s use these to add a simple string TX capability Experimenter’s Section. Line 112 compares the “real” state
to our program. Enter the following code, then SAVE it as of S1 against the value of s and jumps to the Send String
EASYBLUE.BAS: routine when they are different (that is, when the button is
first pressed or released).
28 s=0 REM <- State of Switch S1 Line 305 captures the screen memory address of the
… current cursor location, using the Color BASIC “trick” of
112 IF (INA [10]<>s) THEN GOSUB 300 Screen Memory Address = 2931 - 50 * [Screen Column]
January/February 2019 77
Vintage Computing
- [Screen Row], and substituting the Cursor X and Y to avoid any screen wrap issues, and Line 345 returns
locations for Screen Column and Row. Lines 310 and program execution back to the main loop (Figure 7).
315 print the appropriate “Light On” or “Light Off” string, Now when you run EASYBLUE.BAS, you should see
depending on the value of s, and Line 320 captures the the appropriate control strings on both terminals when
ending cursor location. you press or release button S1, and the indicator on your
Lines 325-335 step through a FOR/NEXT loop that Bluetooth Electronics control panel should turn on or off as
sends each character in the printed string down the the button is pressed or released.
serial channel, stopping at the screen location of the last With a little work, you can extend this simple capability
character (n+1). to drive other indicators (like gauges or thermometers),
Line 340 sends a new line to the Amigo screen send text alerts from Color BASIC to your BT controller, or
even parse received control strings
inside Color BASIC. Congratulations
on this addition to your Amigo toolkit!
THE MOST COMPLETE PROGRAMMING TUTORIAL!
• Everything you need to learn to program PIC® micro- That’s a Wrap
controllers is included in this package That completes this brief
• Learn the fundamental concepts of programming, explanation of installing a Bluetooth
including program flow, loops, coding techniques, binary interface on your Amigo. I hope this
project sends you and a young helper
manipulation, device-to-device communication, user
on another technology adventure,
interface design, in-circuit debugging, and more!
and that you’re inspired to see what
• Includes all the necessary the software, compiler, other Arduino projects you can hack
$99.99 trainer board, cable, tutorial with exercises and sample with your Mentor’s Friend. Be well
Academic and bulk pricing available
code! and have fun! NV
Check out our other popular products
for PIC® developers including: Post comments on this article and
PBP3
U2 Programmer find any associated files and/or
PBP3 Compiler downloads at www.nutsvolts.com/
Prototyping Boards magazine/issue/2019/01.
PICBASIC PRO™ Compiler Experimenter Boards
www.melabs.com
Contact us at info@melabs.com
Parallax Board of Education Full Kit BOE Full Kit $98.90 0603ZD98
48W Soldering Station
USB version with Stamp and USB Cable. Parallax 7.5V Power Supply $8.95 Temp. Controlled
$15.25
310oF~840oF
B
asically, to construct a Wi-Fi live webcam, phones. We didn’t need any OS and driver for the camera
we needed a Wi-Fi server interfaced with a because they’re built inside. The only thing we had to
camera. This kind of server is nothing more find was a way to interface it with the ESP8266 Wi-Fi
than a Wi-Fi server built around an ESP8266. webserver. The details of our approach are discussed
Constructing an ESP8266 Wi-Fi server is not below.
difficult. Just like in the NTP clock design,
we also used the Arduino IDE (integrated Interfacing with the
development environment) for compiling the Wi-Fi server
code we wrote and fused it into the ESP8266. ESP8266 Wi-Fi Webserver
Sometimes it can be very difficult to interface First, we converted the Android Wi-Fi camera server
commercially-available USB cameras to ESP8266 by writing a suitable mobile app. To do this, we used the
microcontrollers. For this, we needed a suitable driver for Android Studio tool. We’ll explain this in detail shortly.
the camera and had to write OS for the microcontroller Second, we connected the Wi-Fi camera server (built
to use with the driver. It’s a very cumbersome job for the with the Android phone) to the local Wi-Fi network by
average programmer. using the Android Settings icon and entering the SSID and
To overcome this difficulty, we used a different password of the Wi-Fi modem/router that is connected to
approach and focused on using the camera in Android the Internet. Once the phone is connected to the Wi-Fi
January/February 2019 79
3.3V USB-TO-SERIAL ESP8266 BOARD CP2102 (USB-TO-SERIAL) Building the Wi-Fi
CONVERTER USED IN THE PROTOTYPE
1 TX PIN RX PIN TX PIN
Webserver
The ESP8266 module is gaining popularity in the
2 RX PIN TX PIN RX PIN field of electronics because it’s affordable, reliable,
3 +3.3V PINS (SUPPLY PIN) 3.3V SUPPLY +33V PIN (+5V PIN NOT USED) and readily available. The ESP8266 Wi-Fi module
4 GROUND GROUND GND contains a 32-bit low power CPU, ROM, and RAM.
Table 1. Connection details between the USB-to-serial
The ESP8266 is a complete and self-contained Wi-
converter and ESP8266 board. Fi network solution that can run stand-alone or
connected to a microcontroller. Unfortunately, most
camera server, it’s also connected to the Wi-Fi network. of the documentation is in Chinese and the information
Third, the Wi-Fi webserver built with the ESP8266 is provided in the datasheet is lacking in practical details. To
also connected to the same local Wi-Fi network, using the help fill this gap, an ESP8266 community forum has been
same SSID and password. The method on how to enter the established.
SSID and password to the ESP webserver will be explained
momentarily. Schematic
Since the camera and ESP8266 server are connected
to the local Wi-Fi network, interfacing the camera with the The circuit schematic is shown in Figure 1. We used
ESP8266 is very simple; just feed the displayed camera the ESP826612E module as a stand-alone device. The
URL from the Android phone to the Wi-Fi webserver. The supply voltage for the Wi-Fi module is 3.3 volts. A USB-to-
method for how this is done will also be explained later. serial module (CP2102) is used for connecting the TX and
In this situation, the ES8266 webserver will act in a RX pins to a PC for communications and programming.
dual role. It will be a wireless client to the camera server The CP2102 can work with either 5V or 3.3V. For our
as well as a wireless webserver to the outside world. This purposes, we used the 3.3V option. You can use any 3.3V
design comprises three parts: building the ESP8266 Wi-Fi USB-to-serial converter that you prefer.
webserver; building the mobile app (usually called the The driver software associated with the USB-to-serial
camera server app); and testing and interfacing. converter has to be installed in the PC for communications.
Table 1 shows the connection
details between the converter
and the ESP8266 board.
The ESP826612E
module only has 16 output
pins for use. The reset pin
is connected to the supply
through 10K resistance, and
a pushbutton (S2) is provided
for manual reset.
The programming mode
pin GPIO0 is connected to
the supply voltage via the 10K
resistor, and a pushbutton
(S1) brings the module to the
programming mode.The CH_
PD pin is connected to the
supply via the 10K resistor.
The ESP8266EX also
integrates a general-purpose
10-bit resolution ADC (analog-
to-digital converter). The ADC
Figure 1. The range is from 0V to1.0V. It’s
hardware circuit. typically used to measure the
voltage from the sensor or
battery.
The ADC can’t be used
80 January/February 2019
when the chip is transmitting.
All digital I/O pins are protected from
over-voltage with a snapback circuit connected
between the pad and ground. The snapback
voltage is typically about 6V, and the holding
voltage is 5.8V. This provides protection from
over-voltage and ESD (electrostatic discharge).
The output devices are also protected from
reverse voltage with diodes. The setting pin
GPIO12 is connected to the supply voltage via
the 10K resistor, and a pushbutton (S3) is used
to bring the module to set mode to establish the
SSID, password, and camera URL.
An LED is connected to GPIO pin 4.
Suppliers of Wi-Fi modules follow a different
pattern for output pin arrangements. So, we Figure 2. Our prototype.
used the ESP826612E module and
designed a PCB (printed circuit ESP8266 PUSHBUTTON LCD (2x16 ) CD4094 LM358 OP- LM35
(COMMERCIAL SWITCH SERIAL-TO- AMP
board) to suit our requirements. We BOARD ) PARALLEL
chose this module because more SHIFT
GPIO pins are accessible for users. REGISTER
The circuit is simple; you can easily GPIO 12-----------➔ S3
wire it up and do the design.
GPIO 0------------➔ S1
Due to limited output pins, we
implemented a simple application RESET-------------➔ S2
to measure the room temperature GPIO 5---------------- ----------------------- --------------➔ STR(1)
using an LM35 temperature sensor GPIO 14-------------- ----------------------- --------------➔ SI or DATA (2)
and ON/OFF LED control. Output
pin 2 of the LM35 is connected to GPIO 13-------------- ----------------------- --------------➔ CLK (3)
the ADC pin of the ESP8266 through RS(4)--------➔ Q2(5)
the unity gain amplifier LM358 which R/W(5)------➔ Q3(6)
acts as a buffer. The LM358 is a
EN( 6)-------➔ Q4(7)
calibrated temperature sensor; the
sensitivity is 10 millivolts/10C. D4(11)-------➔ Q8(11)
The circuit board is shown in D5(12)------➔ Q7(12)
Figure 2. The LCD is interfaced using D6( 13)------➔ Q6(13)
the eight-bit shift register CD4094 to
display the IP Address. The LCD is D7(14)------➔ Q(14)
operated in four-bit mode. ADC ------------------ ----------------------- ------------------ ------------➔ OUTPUT1(1)
Table 2 shows the complete INPUT+(3) -➔ VOUT(2)
connection details between Note: Some commercial boards have the reset and GPIO0 pin readily available for use. If
the ESP8266 and the external these pins are not available, just follow Table 2.
components: LCD, CD4094, LM35, Table 2. Connection details between the ESP8266 and external components.
LM358, and pushbutton switches
S1, S2, and S3.
The method to use is:
Software Programming 1. First, download the latest version of the IDE from
We use the Arduino IDE for compiling and loading https://www.arduino.cc/en/Main/Software and install it.
programs. The ESP8266 community has developed a There are versions available for Windows, Linux, and Mac
suitable plug-in for the ESP8266 to use with this IDE. Craig platforms. Follow the directions for the installation process.
Lindley (in his October 2015 article, “Meet the ESP8266”) After the installation is over, launch the Arduino IDE.
explained how to set up the Arduino IDE for compiling and 2. Go to the file and bring up the Preference page.
loading the program for the ESP8266. Enter http://arduino.esp8266.com/stable/package_
January/February 2019 81
FILE NAME ROUTINE PURPOSE
ESP-WIFI-LCD4.ino Const char image[] This is the array containing hex code of the Nuts
& Volts logo. This array was created from a jpeg
using “hexy.exe.” This is free software that can be
downloaded.
void setup() This starts the following routines:
initHardWare()
setupWiFi() and server.begin()
void loop() This handles a request from the client, creating a
webpage using the String function and sending
the webpage to the client.
void setupWiFi() This initalizes the LCD and EEPROM
It also handles various LED, EEPROM, and serial
communication functions.
void initHardWare() This initalizes the serial port and configures the
GPIO4 as output, the GPIO12 as input, and keeps
the GPIO4 pin low.
size_t sendProgmem(WiFiClient client, const char progmem[], This routine sends larger array files to the client.
size_t size)
byte ReadStringUART(char *Dest) This routine reads the character from the serial
terminal.
LCD3Wire.cpp LCD3Wire::LCD3Wire (int _lcd_lines, int _dat_pin, int _str_pin, This routine configures GPIO pins for data,
int _clk_pin) strobe, and clock for the CD4094 shift register.
In our design, data=GPIO14, str=GPIO5, and
clock=GPIO13.
void LCD3Wire::init () This routine configures GPIO pins 13, 15, and
5 as output and sets the LCD for four-bit mode
operation.
VoidLCD3Wire::commandWrite(uint8_t value This routine writes the command value in the
command register.
size_t LCD3Wire::write(uint8_t value) This routine prints the character in the current
cursor position in the LCD display.
void LCD3Wire::writeIn(char msg[]) This routine prints the message in the current
cursor position in the LCD display.
void LCD3Wire::_pushByte(uint8_t value, bool command) This routine first sets the strobe pin low, sends
the first four data bits, and sets Hbyte to zero.
void LCD3Wire::_pushNibble(uint8_t nibble, bool command) This sends four bits of data using the routine
_pushOut(nibble)i.
void LCD3Wire::_pushOut(uint8_t value) This pushes the byte to the shift register and then
on to the LCD.
Table 3. Routines and their purposes.
s4 += “ setInterval(function() {“;
// Do something every 1 seconds
s4 += “ refreshDiv(‘div2’,’Status.cgi’,’/
home’);”;
s4 += “ }, 2000);”;
Final Thoughts
This was a simple and fun project with lots of flexibility.
For example, the camera could be implemented for remote
visual control utilizing buttons on the web page.
For simplicity, we used LEDs for control. You could
also control industrial equipment with heavy-duty switching
contactors using optocouplers in the GPIO pins. We just
used a single camera here, but multiple cameras can be
used on different Android phones by linking them to the
ESP module through software.
January/February 2019 85
Printed Circuit Boards Build
Arduino Graphics Interface
e t h i n g
TEENSY Graphics Interface
Mass Measurement
Som
Today
!
Wide Range Pulse Generator
Numitron Clock
Continuity Tester
Pi Scrolling Display Search www.nutsvolts.com for these terms and read the articles.
Search store.nutsvolts.com to find the boards.
Analog Style LED Clock Some are available as complete kits too!
Surprise Packages
Are Back In Stock! Popular Clock Kits
January/February 2019 87
NEAR SPACE ■ BY L. PAUL VERHAGE
Muons
The discovery of muons initially represented
a problem for subatomic physics. They were
the beginning of a zoo of subatomic particles
Figure 1: A young Victor Hess about to explore the nature of that physicists couldn’t classify in a logical sense.
cosmic rays from a balloon. Image from phys.org. However, over time, they gradually increased their
understanding about subatomic particles and
created today’s hierarchy (of subatomic particles)
Discovering that Cosmic Rays are Truly that helps make sense of these fundamental particles of
Cosmic in Origin nature.
So, what do physicists have to say about muons today?
Physicist Victor Hess (1883-1964) discovered the First, they carry a negative charge just like the electron.
true origin of cosmic rays in 1912. He did this by carrying Second, they have a mass 207 times greater than the
electroscopes in a balloon (that he himself rode) to an electron. Third, muons do not have internal structure, nor
altitude of 17,400 feet. Electroscopes were the tool of do they contain quarks, like the true mesons do.
choice before physicists invented radiation detectors This means muons are fundamental particles in and
like Geiger counters. Hess’ balloon flights showed of themselves just like electrons. In fact, muons decay into
that the amount of radiation increased as the balloon electrons over time. So, muons are most easily understood
climbed higher. This increase meant the radiation was of as heavy electrons.
extraterrestrial origin and not the ground. A muon produces a lightweight electron and two
To ensure this radiation didn’t originate from the neutrinos when it decays. While its very difficult to detect
sun, he performed one balloon flight during a near total neutrinos, the electron is easily detected. We know that
solar eclipse. Again, the amount of radiation increased a muon has a half-life of 2.2 microseconds (2.2 millionths
with altitude, indicating the moon wasn’t blocking a solar of a second), which is a very long time for subatomic
source of radiation. Hess’ work indicated that outer space particles. Since they travel at near the speed of light,
88 January/February 2019
APPROACHING THE FINAL FRONTIER
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/magazine/issue/2019/01.
muons should cover a distance of 1,500 feet from their for muons. Particle detectors like Geiger counters and
point of origin in the 2.2 microseconds before they decay scintillators are not directionally sensitive by themselves.
(this is the average distance they should cover since half-life This means the detection of a subatomic particle says
is a probability of decaying). Particle detectors, however, nothing about its direction of travel, and therefore, its
show something different. source. To get around this lack of information, detectors
Muons are detectable on the ground (at a rate of are stacked one on top of the other and their outputs are
about one muon per square centimeter per minute) and then connected together by a coincidence counter.
even in underground mines. Because of their immense A coincidence counter is often an AND gate. This
speed, time dilation increases the half-lives of muons from means unless both connected detectors register a particle
our perspective. However, from the muon’s perspective, at nearly the same time, the coincidence counter will fail
the contraction of length due to relativity shortens the to register a detection. This makes the particle detectors
distance they must travel to reach earth’s surface. sensitive to only the radiation passing vertically through
So, whether its time dilation from our perspective or both detectors. That allows stacked detectors to distinguish
length contraction from the muon’s perspective, muons between background radiation (that comes from every
survive long enough to be the most numerous high-energy direction) and particles like muons (which arrive from the
charged particles detected at sea level. Since muons only high atmosphere).
interact with matter via the weak force (a subatomic force
weaker than electromagnetism), they can pass through
enough matter to be detected in mines.
Cosmic Watch
Cosmic Watch is a desk-top muon detector developed
Detecting Muons by the Physics department at MIT. It uses scintillator
material and a solid-state photomultiplier to generate
In May last year, I launched a muon detector to an signals each time a muon passes through the detector. Best
altitude of 93,000 feet. That detector was significantly of all, the Cosmic Watch is available for $150. The 1.5”
different from the Geiger counters I traditionally launch. A x 2.5” x 3.0” metal box weighs 6.3 ounces and operates
Geiger counter contains a gas-filled tube (the Geiger-Muller from a battery; in this case, a power pack for running
tube) surrounding a center electrode. The body of this or recharging cell phone batteries. Its compact size and
tube acts as its other electrode. When a particle of ionizing weight make it perfect for launching in a BalloonSat.
radiation passes through the tube, it creates a channel of When I was studying physics at Fresno State,
ionized gas (atoms of the gas have lost an electron) that photomultiplier tubes (PMT) were similar to electron tubes.
permits electrons from one electrode in the tube to travel When a single photon of light (which our eyes are not
to the tube’s other electrode. Electrons traveling between sensitive enough to see) struck the window of a PMT, it
two electrodes constitute a current which can be measured freed an electron due to the photoelectron effect. That
with a microcontroller. single electron was accelerated down a chain of dynodes,
The muon detector works differently. It uses a material
called a scintillator that produces a tiny spark of light (a
photon) when an atom in the scintillator is excited by the
close passage or impact of a subatomic particle. Note that
this impact does not have to result in the ionization or loss
of an electron like it does in a Geiger counter. All that is
necessary is that an electron in an atom of the scintillating
material gets excited to a higher energy level. Then, after
a short period of time, the electron will drop back to its
lower energy state and release a photon (so the scintillator
has converted a subatomic particle into a photon of light).
The photons emitted by a scintillator constitute a dim
signal. So, a photomultiplier is attached to the surface of
the scintillator to convert the photons into an electrical
current that can be measured by a microcontroller.
There’s one more issue to consider when fishing
January/February 2019 89
APPROACHING THE FINAL FRONTIER
or series of electrically charged plates. the SiPM, it creates an electron-hole pair that is accelerated
Each impact between the electron and a dynode by the electric field created by the bias voltage across the
released additional electrons. The effect was that a PMT cell. The accelerating electron-hole pairs ionize additional
created an avalanche of electrons from a single photon. atoms inside the cell to create an avalanche of electron-
As you can imagine, PMTs are somewhat cumbersome hole pairs.
because they are glass vacuum tubes that require high Because of the aluminum case, alpha and beta
voltages. particles find it very difficult to reach the scintillator inside.
One of the things that make this muon detector so This shielding limits the Cosmic Watch to detecting muons
portable is that the Cosmic Watch replaces the old glass and perhaps some stray background gamma rays.
and vacuum PMT with a solid-state version called a silicon The signal created by the SiPM is still too small and
photomultiplier, or SiPM. A SiPM contains many small too short for a microcontroller to detect. Therefore, one
diode-like cells etched into its silicon die and requires op-amp circuit amplifies the signal and a second one
only about 30 volts to operate. Each cell inside the SiPM stretches out the signal. The microcontroller inside the
is biased with a voltage that generates a powerful electric Cosmic Watch muon detector is a 16 MHz Arduino Nano
field within the tiny cell. ATmega328.
When a photon from the scintillator impacts a cell of The coincidence counter function is programmed
90 January/February 2019
into each Cosmic Watch’s Arduino, so they don’t require Results
additional electronics. To use them in coincidence mode, On May 6th last year, I launched my 175th near space
I connect two detectors together with a 1/8” stereo cable flight from Jordan Valley, OR. The flight reached an altitude
and stack one on top of the other. A USB to mini-USB of 93,672 feet and carried cameras (visible and near
cable connects power to the first detector and the second infrared) and radiation sensors (traditional Geiger counter
one gets its power from the stereo cable connecting it to and the Cosmic Watch muon detector). The RM-60
the first. Geiger counter (by Aware Electronics) was connected to
Each detector operates from five volts and 250 mA. a PICAXE-based flight computer. The PICAXE counted the
I use a Royal PowerBurst Turbo battery pack with 11,000 number of pulses (or detections) over 10 second intervals
mAh capacity, which was more than enough for two every 30 seconds and recorded the results in EEPROM
Cosmic Watch muon detectors on a two hour near space memory.
ascent. After recovery of the flight, I downloaded the Geiger
Just before launch, I plug in the battery, press the reset counter data and loaded it into a spreadsheet. I was then
button of one of the detectors, wait two seconds, and then able to create a chart mapping the altitude of the detector
press the reset of the second detector. Data is recorded on and the cosmic ray flux.
the first detector that I reset. The Cosmic Watch recorded each time a detection
occurred. So, the time stamp of each detection
was recorded, rather than the number of
detections over a fixed time interval. Data was
stored on a microSD card inside the primary
detector and copied onto my PC after the flight.
As a result of the way Cosmic Watch records
detections, there was a huge amount of muon
data. The data was loaded into a spreadsheet
where I calculated the muon detection rate by
inversing the time between detections. In other
words, I converted units of ‘seconds’ between
detections to units of ‘per second.’ To smooth
out the data, I averaged 11 neighboring muon
rates and graphed the results. The chart in Figure
4 compares the rate for each radiation detector.
Future Plans
Right now, I have two upgrades that I want
to make to my ability to measure cosmic rays.
The first comes from the fact that my old PC
can’t download data directly from the detectors.
So, I need to open the detectors to remove their
microSD card if I want to look at the muon data.
Rather than opening a detector after each
flight, I recently purchased an extension for the
microSD card slot from AdaFruit. Once plugged
in and the case bolted close, this cable will bring
the SD card slot outside the Cosmic Watch case
to where I can easily access it.
Then, there’s the addition of other radiation
detectors. At last year’s Great Plains Super
Launch in Nampa, ID, Pete Sias introduced
January/February 2019 91
me to the Radiation Watch solid-
state Geiger counter. I still have
a lot to learn about this detector,
but it appears to work a lot like
a traditional Geiger counter by
producing voltage spikes at the
detection of radiation.
I think I’ll combine it with the
Cosmic Watch muon detector
and the RM-60 Geiger counter to
create a single radiation-measuring
BalloonSat. The three detectors will
easily fit inside a zippered soft-
sided lunch bag and operate off
rechargeable batteries. The bag’s
padding will provide insulation for
the cold of near space and shock
protection upon landing.
When done, I could attach
Figure 4: The data seems to indicate that the flux of all particles in a cosmic this lunch box to the rest of the near
ray peak about 10,000 feet higher than it does for the muon flux. This
spacecraft in a moment’s notice and
makes sense because muons are created by cosmic rays entering the
atmosphere. However, I need to repeat this experiment several more times
collect cosmic ray data.
to make sure I get the altitude data correct.) Upwards and Onwards,
Your Near Space Guide NV
92 January/February 2019
■ BY LOU FRENZEL W5LEF OPEN COMMUNICATION
T he whole Internet of Things (IoT) phenomenon has been around for a while now.
You may have already acquired a few IoT devices yourself like an interconnected
thermostat, a video camera for remote viewing, or a voice response device like the
Amazon Echo. Or, perhaps you’ve gone further with things like home controlled lighting
or Internet connected appliances.
But have you tried to create an IoT device on provide some useful knowledge. An example application
your own? If so, you know it is not easy. However, it is a remote video monitor. The video camera sends the
picture to the Internet and the server. You can then
now is easier than ever as many of the manufacturers
connect by Wi-Fi at some remote place with your iPhone
of IoT wireless chips and modules are providing the that lets you see the video in real time.
hardware and software to make an IoT device happen As for applications, they’re all over the place.
with minimum work. An example is Silicon Labs Consumer home uses are a major category with devices
that improve safety, energy savings, and convenience.
Wireless Xpress Bluetooth module that makes short
As mentioned earlier, thermostats, appliances, security
work of a simple IoT application. systems, lighting, and video cams are the most popular.
The artificial intelligence (AI) voice recognition devices
How IoT Works like the Amazon Echo with Alexa, Google Home with
Assistant, and Apple HomePod with Siri have quickly
In case you forgot or just didn’t know, IoT is the idea become popular as they conveniently let you call up music
of monitoring and/or controlling objects or things via the or perform other operations.
Internet or through a dedicated wireless network. Most IoT Another large applications area is industrial. Wireless
applications involve connecting some sensor or actuator monitoring and control in factories is widely implemented
by way of a wireless link to a gateway that connects to an on robots, machine tools, programmable logic controllers
Internet modem. (Refer to Figure 1.) The gateway could be (PLC), and production lines. IoT is heavily adopted in
a Wi-Fi router. process control plants, pipelines, and a wide range of other
At some end point, an applications server collects data industrial applications. Lots of remote sensors are usually
from the sensor and can initiate some action based on that involved.
data. In addition, analysis may be applied to the data to Cities are adopting IoT in controlling street lights,
monitoring parking meters and parking lots,
automatic remote meter reading, and traffic control.
Building automation is a growing category
where IoT systems provide safety and security
as well as comfort. Temperature, humidity, and
lighting are monitored and controlled to provide the
optimum environmental conditions for workers and
energy savings outside of work hours.
Some other applications are medical
monitoring of patients, agriculture monitoring
of crops, wireless links to virtual reality and
Figure 1. A generic arrangement of most IoT applications with augmented reality headsets, automotive uses like
the wireless link to a gateway or router for Internet connection. hands-free Bluetooth cellular calls, and smartwatches.
January/February 2019 93
THE LATEST IN NETWORKING AND WIRELESS TECHNOLOGIES
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/magazine/issue/2019/01.
The Critical Link in an IoT System technology is LoRa. It’s a proprietary technology but has
One of the primary decisions to be made in building proven itself to be reliable. Sigfox is also proprietary and
an IoT application is the wireless technology to be used. even uses its own networks locally to collect and deliver
There are lots of choices as Table 1 shows. data. Z-Wave is another proprietary technology that is
With so many wireless choices, there’s something widely implemented in consumer and home IoT products.
that will fit any application. One popular option is the IEEE An interesting option is one of the two cellular
standard 802.15.4. It uses direct sequence spread spectrum standards: LTE-M and NB-IoT. Both use the existing 4G LTE
(DSSS) in the 2.4 GHz license-free band to achieve a data cellular networks to link to the Internet. They have good
rate of 250 kb/s. It’s the basis for one of the more popular range and data rate capability but do require cell service.
IoT choices: ZigBee. Although not present in the table, the forthcoming 5G
ZigBee is one of the oldest technologies and the cellular technology will also find IoT applications when it
standard provides specific applications software. Thread is becomes available in 2019 and beyond.
another variation with its unique software that facilitates That leaves probably the most popular IoT choice:
applications development. Bluetooth. It’s one of the oldest of the short-range wireless
Wi-Fi is also used, but mainly as a link to a gateway standards that has enjoyed widespread use and continuous
from the Internet connection modem. It’s overkill for development. The latest versions called Bluetooth 5 or
many IoT uses as its high speed capability is not usually Bluetooth Low Energy (BLE) extend its range, making it far
necessary. more useful.
Two newer versions of Wi-Fi are 802.11af and You probably already use Bluetooth in headsets,
802.11ah. The 11af version takes advantage of the unused speakers, or auto hands-free capability. It’s getting major
TV channels in local areas for spectrum. These 6 MHz attention in many IoT applications. The main problem is
bandwidth channels permit slow to medium speed data that Bluetooth is a complex technology and development
rates and their low frequency (470 to 790 MHz) permits of products and software is a major challenge.
long range coverage. The 11ah version called HaLow is
faster and also offers long range coverage in the 2.4 and 5
GHz bands. Neither 11af or 11ah are widely adopted but
Bluetooth Simplified
are available. Several companies are now supplying not only the
Another popular long range (multiple kilometers) Bluetooth ICs but also complete modules including
Table 1. Wireless technology options for IoT.
Power
Technology Frequency Data Rate Range Consumption Features
Requires upper layers for
802.15.4 2.4 GHz 250 kb/s 100 meters Low
networking.
Bluetooth 2.4 GHz 1, 2.1, 3 Mb/s 100 meters Low Low Energy version 5 is popular.
LoRa < 1 GHz <50 kb/s 2-5 km Low Longer ranges.
High speeds. Cellular service
LTE M Cellular bands 1-10 Mb/s Several km Medium
required.
NB-IoT Cellular bands 0.1-1 Mb/s Several km Medium Cellular service required.
Sigfox <1 GHz 100 b/s- Several km Low Proprietary system.
Thread 2.4 GHz 250 kb/s 100 meters Low Uses Dot-Dot software.
Weightless <1 GHz 0.1-24 Mb/s Several km Low Three versions W, P and N.
Wi-Fi (11n/ 11 Mb/s – 1.7
2.4, 5 GHz 100 meters High Used mainly in gateways.
ac) Gb/s
Wi-Fi (11af) <1 GHz 0.1-1 Mb/s Several km Medium Uses TV white spaces.
Called HaLow; not yet
Wi-Fi (11ah) 2.4, 5 GHz 0.3 – 300Mb/s Several km Medium
implemented.
ZigBee 2.4 GHz 250 kb/s 100 meters Low Widely used IoT standard.
Z-Wave 908.42 MHz 40 kb/s 30 meters Low Popular in home applications.
94 January/February 2019
Figure 2. The Bluetooth module and one of the development boards available. The module size is 15 x 12.9 mm.
antennas that are ready to drop into any new product with PC with the microUSB cable supplied. The green LED on
minimal effort. You don’t need to be a wireless engineer. the module PCB (printed circuit board) should light.
That does leave the software for you to deal with, which is 4. Open Simplicity Studio. Click on Xpress
another major challenge. However, the good news is that Configurator in the upper right part of the screen. This will
some companies are addressing that roadblock too. bring up several windows.
An example is Silicon Laboratories, a vendor that 5. In the upper left window, you should see the device
makes Bluetooth chips and modules. They also make Wi-Fi designation displayed: bgx13p22ga. Select it and click
and ZigBee products but their new Bluetooth offering is Enter.
a real jewel. Called the Wireless Xpress, it lets you make a 6. At the bottom of the screen, click on the Connect
Bluetooth-enabled IoT device with minimal effort and NO button.
programming. Here’s my recent experience with it. 7. Now, go to your iPhone and open the BGX app.
First, get yourself one of the Wireless Xpress BGX13P When it opens, do a scan by pressing Scan on the upper
module starter kits. The module and a sample evaluation left of the screen. That should connect the phone to the
board look like what you see in Figure 2. You can get one module.
at most of the major distributors like Digi-Key or Mouser 8. On the iPhone, click on the right arrow (>) to bring
for about $40. The module connects to your PC via a up the black terminal screen. You can now type something
microUSB cable (supplied with the kit). on the phone and press the Send button to pass it to the
This module has three mechanical pushbuttons and computer. It should show up in the terminal screen at the
three LEDs. It’s designed to operate in a stand-alone bottom.
mode, so can operate as a simple terminal emulator. The 9. Now, try typing something into the bottom window
module will probably find its way into a project with a of the screen on the PC and press Enter. Your message
microcontroller. Silicon Labs has several of these (8051 and should show up on your iPhone screen. Violá! Magic
ARM) that are a good fit with the Xpress module. terminal communications.
Here are the steps I followed to set the module up
to function as a terminal exchange between a PC and an Experiment with things like the range between the
Apple iPhone. phone and module. It should be good for 30 feet or so.
Also, don’t forget to look at all the material related to this
1. Go to the Apple app store and download the BGX on the Silicon Labs website.
Commander Mobile App. The icon is a blue gecko and Anyway, Silicon Labs has made it easy to pair
BGX. two Bluetooth devices. The next step is connecting a
2. Download the software called Simplicity Studio microcontroller module from Silicon Labs to the Bluetooth
from the Silicon Labs website. module for application development. However, that’s an
3. Unpack the module board and connect it to your article for another time. NV
January/February 2019 95
TECHFORUM READER - TO - READER
As for multilayer boards, they’re when soldering to an internal power/ common. The plated through holes
exactly what the description is. ground plane or even bad solder often do not reach the surface of
They’re a sandwich of thin boards, joints (the solder doesn’t make the the finished board. You can achieve
each layer typically one millimeter connection on internal layers), which much of the same effect by adding a
thick, with etched circuitry (single- or is why they’re very expensive to daughter board (a shield in Arduino
double-sided) or an un-etched power design and manufacture. terms) to your design.
or ground plane, glued together Ken Simmons Dale Freye
in exact (i.e., 1/10000” or better) Auburn, WA via internet
alignment so all the through holes
will match up when components are #3 Etch or mill your circuit #4 I gave up making boards years
installed. boards with space for larger holes ago. Hazardous chemicals, lots
When completed, these boards where you need them to be plated of fiddly fine work. Double-sided
can be as thick as five millimeters or through. Insert small grommets made boards require precise alignment, and
so, with eight or more layers! Most for that purpose into the holes and multilayer boards are impossible at
multi-layer boards use through hole peen them over. In most cases, this home.
plating — especially on power and will be unnecessary because you can A multilayer board is a board that
ground planes — to ensure positive just solder parts like resistors on both has conductive layers sandwiched
through hole connections (again, sides of the board. inside the board, usually one for
depending on how well each layer is The use of sockets will make power and one for a ground plane —
aligned when the sandwich is made). working with ICs, DIP switches, and for a total of four layers (top, ground,
They’re soldered using wave- resistor arrays much easier. power, and bottom). More layers are
soldering equipment because hand- Multilayer boards are made up also possible, of course.
soldering risks damaging the board of several thin circuit boards glued Jay R Jaeger
via local overheating — especially together. Four to eight layers are Madison
(408)748-9600
ITAR I SO 9001:2008 UL Approved
Bring Your Pi to Work!
Measurement Computing now offers
DAQ HATs for Raspberry Pi®
MCC Raspberry Pi measurement HATs were designed to bring high-quality
measurements to the ubiquitous low-cost computer. MCC DAQ HATs are the
perfect solution for adding professional quality DAQ capabilities to the Pi platform.
Perfect for:
Embedded System Design - Industrial IoT - End-of-Line Test - Remote Monitoring - Edge Computing
1 YEAR
www.mccdaq.com/DAQ-HAT
Contact MCC
1.800.234.4232
©2019 Measurement Computing Corporation, 10 Commerce Way, Nor ton, M A 02766 • info @mccdaq.com