Professional Documents
Culture Documents
• Durable, Robust, Elapor ® Foam Airframe • Fast & Easy Data Extraction
• Onboard Image Preprocessing • Modular Payload System Allows
for Future Sensor Integration
• Up to 60 Minute Flight Times
• Available with Parrot ® Sequoia or
• Up to 675 Acres per Flight (2.73 km2) @ 400’ AGL MAPIR ® Survey3 & Kernel ® Sensors
• SAFE LAUNCH - Propeller Starts Spinning After
Parrot® is a trademark or registered trademark of Parrot SA.
Hand Launch MAPIR® is a brand and dba for Peau Productions, Inc.
FEATURES
• Schematic Capture
• PCB Layout
• Gridless Autorouting
• 3D Visualization
• M-CAD Integration
• SPICE Simulation
• MCU Co-simulation
• Built in IDE
• Visual Programming
July-August 2018
Columns
08 TechKnowledgey 2018 85 Open Communication
Events, Advances, and News The Latest in Networking and
Read about these cool topics: Wireless Technologies
• Say No More Killer Wi-Fi Now Available
• Messin’ with Brain Cells Do you really need even better wireless service, and what
• Low-End 2-in-1 is its future? This article is an update on Wi-Fi, a closer
• A Beast of a Box look at the latest version, a summary of the problems, and
• Adaptive USB a look at what’s in store for you.
• Garmin for Golf
• A Blast of Sound
• Yodel-Ay-Eee-Ooh! Page 85
• Twitter Twaddle
12 Q&A
Reader Questions Answered Here
Topics discussed this time:
• High Voltage, Low Cost
• N, P, or What?
4 July/August 2018
TOC - Jul-Aug 18_TOC NV Mar 15.qxd 6/12/2018 3:50 PM Page 5
Subscription Information
Nuts & Volts — PO Box 15277
06 DEVELOPING
Departments 90 TECH FORUM
North Hollywood, CA 91615-9218
Call 877-525-2539 or go to www.nutsvolts.com
Subscribe • Gift • Renewal • Change of Info
PERSPECTIVES 95 CLASSIFIEDS For more details on subscribing, see our ad on Page 91.
Electronics as a Portal 95 ELECTRO-NET
to Other Hobbies 95 AD INDEX
22
77
NEW PRODUCTS
SHOWCASE
96 NV WEBSTORE
Projects & Features
24 Build a MIDI Lyre 49 VINTAGE COMPUTING:
When you think of MIDI controllers, you
probably think of a keyboard. However, Amigo Color BASIC — The
there are many reasons to have MIDI
controllers in other form factors, not the Missing Manual
least of which is fun! In this article, we will The original documentation for the Amigo
make a MIDI lyre version. retro computer was intended to help
■ By Jim Arlow readers mentor youngsters on computer
programming fundamentals. It also
included an “overview of most Color BASIC
34 Build Your Own Funky commands.” A couple of astute readers
working beyond introductory mentoring
Steampunk Display have asked me about the full command
I use LCD displays in almost every project. set. This article covers those “missing”
However, in this modern age of steampunk, commands, plus a couple of tips and tricks
I stumbled on something much cooler. I that Amigo owners may find helpful.
found these 1” high seven-segment ■ By Dane Weston
electromechanical displays (EMDs) that go
clickity, click. I embarked on an ambitious
project that featured five 1941 vintage 58 A Digital Analog –
rotary phone step-by-step (SXS) switches. I
thought these EMDs would be the perfect Part 5
match to display the dialed digits. So, I This final article in our series will examine
ordered a dozen and the rest is history. those circuits from the “555 Timer IC
■ By David Goodsell Circuits” by Forrest Mims which were not
covered in any of the preceding four
articles. As in the other installments, some
42 Build a USB Cable will use the PIC replacement from the first
part, while others will develop specific
Continuity Test Jig programs using a PIC to emulate a
If you’re like me, you likely have a drawer Page 24 particular implementation of a 555.
or shoebox stuffed with assorted USB ■ By Larry Cicchinelli
cables that are used to either charge or program a USB
device. The problem often is that some cables may only
be useful for charging, and which only have the +Vcc and 66 Get ASCII Data from PS-2
ground wires intact with one or both data wires either
broken or not connected in the first place. Here’s a simple Keyboards
test jig to help you tell what’s what. You can buy inexpensive PS-2 keyboards, but they don't
■ By Don Dorward VA3DDN produce ASCII values many applications need. To further
complicate things, these keyboards have their own code-
transmission protocol. I'll show you how to use a system-
44 Does Inductor Winding Have on-a-chip and a bit of software to convert PS-2 key codes
to corresponding ASCII values.
You Tied Up in Knots? ■ By Jonathan A. Titus
While resistors and capacitors
are easily procured and stocked,
most radio frequency circuits 72 Practical Ideas for Portable
require inductors in a wide range
of very specific values. In most Magnetic
cases, you need to create these
yourself, by winding wire on Loop
ferrite rods or toroids of specific
types and sizes. Is it possible to Antennas
substitute another ferrite piece at With the popularity of
hand and still get the right magnetic loop
inductance value? How can a antennas growing
hobbyist measure inductance these days, I thought
without buying an expensive I’d share how I
instrument? This article describes designed a
the principle behind inductance and presents some tricks convenient setup for
that I’ve used to make my own inductors. myself.
■ By Dev Gualtieri ■ By Jim Ford N6JF
July/August 2018 5
Bergeron - Developing Perspectives - Jul-Aug 18_Dev Perspectives - ReadFeed Feb15.qxd 6/12/2018 4:03 PM Page 6
DEVELOPING
PERSPECTIVES
by
Bryan
Bergeron,
Editor Published Bi-Monthly By
T & L Publications, Inc.
430 Princeland Court
Corona, CA 92879-1300
OFFICE: (951) 371-8497
FAX: (951) 371-3052
WEBSTORE: (800) 783-4624
Electronics as a Portal to www.nutsvolts.com
July/August 2018 7
Eckert - TechKnowledgey - Jul-Aug 18_Eckert - TechKnowledgey - Feb 15.qxd 6/12/2018 4:10 PM Page 8
Messin’ with Brain Cells imaging — showed responses similar to those of a normal
or decades, sci-fi movies and TV shows have portrayed sensory stimulus. The researchers speculated, “the laser
F characters whose brains have been erased or
reprogrammed by evil-doers. This fictitious process is so
holography setup could eventually be miniaturized to fit
in a backpack a person could haul around.” Goody for
common that it doesn’t particularly terrify most of us the FBI (Federal Brain Investigators).
anymore. Maybe it should now, because UC Berkeley So, how long until they are able to work with live
(www.berkeley.edu) neuroscientists are getting closer to human brains? Who knows? Maybe they already can.
making it a reality. Maybe they already have.
Under development is a system that uses holographic Are you absolutely certain you were at the Snake Pit
projection to activate or deactivate brain activity, thereby Bar and Grill last night? ▲
allowing it to “edit the sensations we feel, paste in our
brain pictures that we never saw, cut out unwanted pain,
or insert nonexistent scents into memory.”
Recently, a chunk of mouse brain was treated with a
protein that when hit with a flash of light turns the cell on
and creates a spike of activity. To function properly, the
system needs enough accuracy to “shoot the very
specific sets of neurons you want to activate and do it at
the characteristic scale and the speed at which they
normally work.” Apparently, they have achieved that.
The researchers have already tested the prototype on
mice as they walk on a treadmill, acting on the touch,
vision, and motor areas of the brain. Access to the brains
was enabled through an installed clear window. Brain
activity — as measured in real time with two-photon ■ A sample hologram with 50 randomly distributed
neuron targets.
8 July/August 2018
Eckert - TechKnowledgey - Jul-Aug 18_Eckert - TechKnowledgey - Feb 15.qxd 6/12/2018 4:10 PM Page 9
A Beast of a Box
designed to be the ultimate super-
o, you’ve decided to build your tower case. The dramatic look comes
S own computer using selected off-
the-shelf parts. Maybe you want to
from four smoked tempered glass
panels and brushed aluminum, and
put together the world’s most the triple-chamber, dual-system layout
powerful game computer or allows for installation of both a full E-
something that can be used for ATX and a mini-ITX system.
worldwide weather forecasting. If You can mount eight 120 mm
you’re like most of us, you’ll fans to the front, three 140 mm fans
probably house it in the cheapest in the roof, and two 120/140 fans to
box you can find. However, if you’re the rear, or you can install liquid-
willing to shell out some extra bucks, cooling radiators. Included are a
you can go the other way and put it CORSAIR Commander PRO digital
into something that’s impressive in ■ The Corsair Obsidian 1000D. RGB lighting and fan speed
and of itself. controller and three removable dust filters. The only bad
In that case, take a look at the Corsair Obsidian news is that we’re looking at a list price of $499, and the
1000D. Over two years in development, this box is street price seems to be the same. ▲
Adaptive USB
the Trinity: a 3-in-1 adaptive USB
n all likelihood, your computer Flash drive. It features USB Type-A,
I has a few large Type-A USB
ports, and your tablet and phone
Type-C, and micro-B connectors —
all in a single housing. These are
have micro-B connections. So, three of the most common USB
how can you move files from one formats, so you can use it with a
to the other? Sure, you can go range of devices. In addition, the
scrounging around in that big box Trinity supports OTG (on-the-go)
of tangled-up cables to find one ■ Patriot’s Trinity
for Android devices, which allows
with the right end connectors, but Flash drive. users to access it with any of their
wouldn’t it be easier if you could Android devices without
just use the same Flash drive with both? downloading any external drivers or software. The drives
Well, that’s what the folks at Patriot are available with capacities of 32, 64, and 128 GB,
(www.patriotmemory.com) thought, so they designed priced at (respectively) $27.99, $38.99, and $69.99. ▲
July/August 2018 9
Eckert - TechKnowledgey - Jul-Aug 18_Eckert - TechKnowledgey - Feb 15.qxd 6/12/2018 4:10 PM Page 10
A Blast of Sound
ack in the good ol’ days, an audio mixer was a huge console with many knobs, sliders, meters, and so
B on. It would usually be hooked up to a PA system or 10.5 inch multi-track tape recorder. These days,
however, your desktop computer, tablet, or phone can perform the same and many other functions, so
maybe you can replace the old-style mixing board with something like the Sound Blaster K3+ from
Creative Labs (www.creative.com).
The K3+ is an external sound mixer
module with hardware processing including
nine reverb effects, autotune (in case you’re
a really awful singer), and voice morphing
effects. It has multiple input types, supports
48V phantom-powered condenser mikes,
and offers individual I/O gain control. With
no necessary driver installation, it connects
to PCs and Macs via a simple USB cable
and can also be connected using a four-pole
3.5 mm jack. A built-in processor offers 24-
bit 48 kHz recording and 24-bit 98 kHz
playback.
Also included are six sound effects that
can be triggered at any time, including VIP
entrance, cheers, baby laughter, audience
laughter, gunshots, and crow caws. (No, I
don’t know why.) They are available at
Amazon, Newegg, and Fry’s for $129.99. ▲
10 July/August 2018
Eckert - TechKnowledgey - Jul-Aug 18_Eckert - TechKnowledgey - Feb 15.qxd 6/12/2018 4:10 PM Page 11
Yodel-Ay-Eee-Ooh!
his month’s “How Did I Live Without It?” award goes
T to the Electronic Yodelling Pickle, magnanimously
provided to the world by Archie McPhee (mcphee.com),
which also sells rubber chickens, tinfoil hats for both cats
and humans, and a range of other not-so-serious products.
McPhee also maintains the Rubber Chicken Museum at its
Seattle store.
No doubt you are now thinking, “Wow. I gotta get me
a yodeling pickle.” Luckily, you don’t have to go to Seattle
to pick one up; they’re available from Amazon for a mere
$10.61. Oddly enough, the item shows 638 customer
reviews — 82 percent of which give it five or four stars.
One reviewer said it helped his uncle deal with
Alzheimer’s, and another indicated that it’s good for
calming crying babies.
One reviewer gave it only two stars, noting, “The
Yodelling Pickle in my house appears to be possessed.
Whenever I put it away in the kitchen cupboard, it
mysteriously appears in the top drawer of my wife’s
■ The Yodelling Pickle you’ve always wanted.
bedside table.” ▲
Perhaps even more surprising is that Prof. Zhuang was Foundation to conduct additional studies. Nice work if
recently awarded $392,000 from the National Science you can get it. ▲
July/August 2018 11
n WITH KRISTEN A. McINTYRE
Q&A
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.
Q
: I’m running an experiment for my high school The number of wire turns that are around the surface
science project that requires a 5,000V power through which the magnetic field passes are additive. In
supply. The commercial supplies are crazy other words, the more turns, the more voltage. If we have
expensive. Is there an inexpensive DIY way to a turns ratio of, say, 10 to 1, then the voltage on one turn n
generate a few thousand volts at only a few microamps? on what we often call the primary of a transformer will be
Greta Chivers multiplied by 10 and appear on the secondary. w
Boca Raton, FL Of course, there’s no free lunch, so the current will in
be reduced by a factor of 10 (at least) on the secondary
A
: Before we start on this question, I want to so that energy is conserved. So, Pin >= Pout. Another way to th
mention that 5KV — even at microamps — can think of that is: a
be dangerous. Please be cautious when dealing tr
with high voltage in any form. Keeping the Iin • Vin >= Iout • Vout
current limited to a few microamps is difficult at all points ra
in a circuit like this, so it’s possible to induce a fairly high The voltages that appear on these wire turns are not tu
voltage across your body if you touch the wrong thing. referenced to anything except themselves. This means that o
There are a few different approaches one could take we get to choose the reference by what we connect those th
to such a design, but all the ones that are relatively easy wires to. For this circuit, we’ll choose to reverse the voltage tu
involve an oscillator that is based on positive feedback by connecting one secondary up ‘backwards,’ reversing th
through a transformer. This serves the dual purpose of the voltage.
providing an easy feedback path that is naturally oscillatory, Note also that we can have multiple secondaries. Any w
plus gives us an opportunity to c
get some immediate voltage J1 o
multiplication through the turns 12V TR1 1500 turns e
1 12 J2
D112V
D4
PRI
8
transformers work. One warning, J3 a
SpiceOrder 1
1K
R2
S1
2V
C3
J1 a capacitive voltage multiplier stack.
AC HV 1 A voltage multiplier exploits the AC
D1
D3
SpiceOrder 2
signal to progressively charge capacitors
SpiceOrder 1
SpiceOrder 2
SpiceOrder 1
that are at higher and higher voltages,
SpiceOrder 1
SpiceOrder 2
SpiceOrder 1
SpiceOrder 2
connected in series. The biggest
D2
D4
advantage is that each multiplier stage
C2
C4
J2 J3
only has to withstand voltage at that
AC HV 2 HV+
stage — if operating properly. This means
C5
C7
we can use more ordinary diodes and
capacitors.
See Figure 2 for a double
D5
D7
SpiceOrder 2
SpiceOrder 1
SpiceOrder 2
SpiceOrder 1
multiplier that gives us a factor of 8.
The components all need to be able
SpiceOrder 1
SpiceOrder 2
SpiceOrder 1
SpiceOrder 2
D6
D8
to handle about 1 KV max. It may take
C6
C8
Q
oscillator. Another secondary multiplies the voltage from : I’m confused about when to use N-channel vs.
the collector by roughly a factor of 30; again, using the P-channel MOSFETs for voltage regulation. Is
e turns ratio. That gives us some AC high voltage that’s on one optimized for positive regulation and one
the order of 600V for 12V input. for negative regulation?
This is not the kind of transformer you can just buy. It Terry Warden
will probably have to be hand-wound on a toroidal ferrite Downers Grove, IL
core or circular ferrite ‘pot’ core. I prefer the latter for ease
A
of winding and magnetic field confinement. You’ll need : I think we can clear up your confusion by
enough turns to get some inductance to exploit; the ferrite looking at how we model MOSFETs. It’s similar
mix is important too. Those choices are beyond the scope to what we do to understand regular bipolar
of this particular column, but perhaps we can cover them transistors. We’ll use a simplified model that
another time.
We could simply rectify and filter that
and be done, but we need more voltage. We
could also increase the turns ratio to get more
voltage, but then we might get arcing inside the
transformer without special insulating material.
It’s also going to be hard to find diodes and
capacitors to rectify and filter that voltage.
July/August 2018 13
Gate
+
+
gm•Vgs Vgs
Vgs gm•Vgs
-
-
Gate
n FIGURE 4. N-channel MOSFET simple model. n FIGURE 5. P-channel MOSFET simple model.
doesn’t account for the AC characteristics very well, but is gate voltage controls the current flow, and it is positive
accurate enough to understand the difference between N- relative to the source. The important thing, though, is that
and P-channels. the current can only flow in one direction. If we look at
First, why do we call them N and P channels? If we Figure 5, we see that the current direction and gate voltage
take a look at Figure 3, we can see a rough outline of the is reversed. It flows from source to drain, plus the control
structure of a MOSFET. MOSFET stands for Metal Oxide voltage at the gate is reversed.
Semiconductor Field Effect Transistor, and the key feature So, which one should you use? Use the one that lets
is a gate that is insulated from the “channel” between the the current flow in the direction that is convenient for what
source and drain. you want to do. If it’s voltage regulation, chances are that
The transistor operates based on the electric field an N-channel MOSFET will be best suited to a positive
induced between the gate and the source. This field shifts regulated voltage. That’s because we expect the current to
the balance of charge carriers in that region, reducing flow from the positive to the negative voltages (see Figure
the size of the depletion layer. The depletion layer does 6 for a simplified example). If it’s a negative supply, then
not conduct, so we can change the amount of current that’s all reversed and we expect the currents to flow the
that flows between the drain and source by changing the other way. NV
depletion layer size and replacing it with a charge carrying
layer. J1
The type of material used for the source, drain, and V+
channel defines the type of device. An N-channel uses
IC2A
a material with an excess of negative charge carriers Q1
(electrons) for the source and drain, and forms an 3
N-channel when on. A P-channel uses a material with an 1
2
excess of positive charge carriers (holes) for the source and
drain, and forms a P-channel when on.
This doesn’t explain how they are different in a circuit,
however. I think the easiest way to see it is to look at the
models. Figure 4 is the N-channel model and Figure 5
is the P-channel model. Both are drawn so that positive
Load
R2
Filter Basics
Stop, Block, and Roll(off)
A casual observer might think that wireless systems consist
primarily of filters connected by the occasional bit of circuit!
Block diagrams of transceivers often include as many filters as any
other function. This is true at the system level, just as it is at the
circuit level — and many circuits behave in a filter-like way, whether
intended to be a filter or not! That makes understanding filter basics
important for wireless success.
Filter Specifications
Before using or selecting filters, you’ll
have to know how they are specified.
Beyond just the broad high- or low-
s pass type, you’ll have to be able to give
specific frequencies and specific levels
of attenuation. Each of these parameters
has a name and precise definition. Figure
3 shows a high-pass filter’s magnitude
response. Drawing the gray boxes on a
response graph establishes the filter’s basic
behavior.
• Cutoff Frequency: The
frequency, ƒC, at which the output signal
responses are shown in Figure 2. Filters also have a phase has one-half the power of the input signal. This is useful
response that describes the phase relationship between in specifying where the pass-band ends and where the
the input and output signals. (There is also a time-domain stop-band begins. The cutoff frequency is also referred
response such as you would see on an oscilloscope to as the –3 dB frequency because –3 dB is equivalent
screen.) to a power ratio of one half.
Figures 2A and 2B show the high-pass and low-pass • Bandwidth: If a filter passes or rejects only a range of
responses. Figure 2C is a band-pass response and Figure frequencies acting like both a high-pass and a low-pass
2D is a band-stop or notch response. Each response has a filter, there will be two cutoff frequencies. The higher
pass-band (where signals aren’t attenuated) and a stop-band one is ƒH and the lower is ƒL. In Figure 2C, the two
where signals are rejected. All have many uses in radio, cutoff frequencies are approximately 2 kHz and 4 kHz,
ut mostly in attenuating unwanted signals. We’ll discuss some so that filter has a bandwidth of 4 – 2 = 2 kHz.
of these uses later in the article. • Ripple: This is the variation in attenuation, specified
in dB, of the input signal in the filter’s
pass-band or stop-band. Figure 3 shows
a filter with about 1.5 dB of ripple in the
pass-band. Variation in the stop-band is
also called ripple.
• Rolloff: The slope of the filter’s
response in the transition region between
the pass-band and stop-band. Rolloff
is given in dB/octave (a doubling of
frequency) or dB/decade (ten times
the frequency). If the response changes
rapidly with frequency, that rolloff is
termed steep.
• Insertion Loss (IL): The minimum
attenuation in the filter’s pass-band. A perfect filter bands and the steepness of the rolloff vary quite a bit. (The n
would have no insertion loss at all, but all practical filter’s phase responses are also quite different.) o
filters have some insertion loss. The filter in Figure 3 For example, compare the Chebyshev and Butterworth ro
has an IL of about 1 dB. low-pass filter response curves in Figure 4. Both are a
in
• Stop-band Attenuation and Notch Depth: In the low-pass filters with a cutoff frequency of 1,000 Hz. The
stop-band, a minimum amount of attenuation is curves have very different shapes, though. The Butterworth
required of the filter. If the filter rejects a narrow has a very smooth response with no ripple at all —
range of frequencies with a stop-band in between two Butterworth filters are often referred to as maximally-flat
pass-bands, notch depth is the maximum attenuation for that reason — but the rolloff is smooth and gradual,
between those two pass-bands. Both of these as well. The Chebyshev filter trades a smooth response
parameters are specified in dB. for steeper rolloff by allowing various amounts of ripple.
• Input and Output Impedance: Filters have a The filter response in Figure 4 is known as a “1 dB ripple
characteristic impedance that affects how a signal Chebyshev.”
source or load will perform when connected to the Depending on what you’re using the filter for, ripple
filter. For the filter to have only the desired effect, it’s or gradual rolloff might be okay. The different filter families
impedance should match the impedance of whatever offer choices about how the filter will perform and what
it is connected to: a signal generator, a microphone, effects they have on the signals. For example, hams trying
Attenuation - Is it Positive or
Negative?
If an output signal is smaller than the input signal, the ratio in dB d
will be negative. For example, if the output is five times less powerful
than the input to a filter, that is a power ratio of -7 dB with the minus
b
sign indicating a ratio less than 1. That represents an attenuation or
loss of 7 dB, with no minus sign. a
The rule is that power ratios in dB have a positive or negative n
value, while loss or attenuation are given without the minus sign. o
The -7 dB power ratio is a loss or attenuation of 7 dB. Similarly, if the
output was five times greater than the input, that would be a gain of 7
dB. n FIGURE 4. Filter responses for a Butterworth
and a Chebyshev low-pass filter. Both have
The minus sign isn’t used if the name of the parameter implies the same cutoff frequency of 1,000 Hz but have
whether it is present or not. significant differences in rolloff and ripple in the
passband. (Figure courtesy of the American Radio
Relay League.)
a transmission line, or an amplifier. If the impedances to design an audio filter for receiving the single tones of
don’t match, filter performance may not be as Morse code (CW) find that a lot of ripple means distortion
expected. and smearing of the carefully shaped dits and dahs. At high
speeds, that can make the code “tough copy.” In that case,
Filter Families and Orders it’s worth allowing a more gradual rolloff so you hear some
of the adjacent signals in order for the Morse elements
Looking through websites and books of filter designs, to be reproduced clearly. Each application is a little bit
you’ll notice that along with the type of frequency
response, there are other categories: Butterworth, Brick-wall or Ideal Filters
Chebyshev, Bessel, Elliptical, and more. These are known
as filter families. Many of the families are named for the The filter responses in Figure 2 vary smoothly between
designer who worked out the equations describing them. the pass-band and the stop-band. This is the way a real
(Elliptical filters are so-named because the solutions to filter behaves. Nevertheless, you will encounter references
functions describing them form an ellipse in Cartesian to “ideal” or “brick-wall” filters for which the pass-band
coordinates.) Each set of equations has different solutions and stop-band responses are completely uniform or “flat.”
The transition region for such a filter is a vertical line on the nF
that translate into different component values.
response graph with an infinite rolloff. Needless to say, these app
Each family of filters has a different frequency response filters can’t actually be built, although some sophisticated are
shape. They might all be designed to have the same cutoff digital filters get close. tran
frequency but the amount of ripple in the pass- and stop-
18 July/August 2018
s
Common Filter Applications
Let’s discuss a few applications for filters. Figure 6
is a block diagram showing where these filters are found
in typical ham radio transceivers and accessories. Signal-
processing filters are more and more likely to be performed
by software (DSP), but there are still many analog filter
circuits in radio.
• Audio Filters: Along with the CW band-pass filter
different in what is important. mentioned above, audio filters are also used to get
Once a filter family is selected, the next order of rid of hum (50 or 60 Hz signals caused by magnetic
business is to determine how many “sections” of filtering fields), buzz (caused by 120 Hz rectified AC and
are needed to meet the performance requirement. The ac neutral currents), and high-frequency hiss. FM
number of sections is the filter’s order — the higher the modulators and noise-reduction circuits also use pre-
order, the more filtering is applied to the input signal. emphasis (high-pass) and de-emphasis (low-pass) filters
n
h
,
e
July/August 2018 19
F
Why are Analog Filters Still Necessary?
While you’ll find digital filters taking over more and more filtering chores, analog filters are still the only
practical choice for many roles. Obviously, at high power levels — such as for transmitters and duplexers — low-
loss inductors (L) and capacitors (C) are required. The selection of appropriate components is an art in itself for
these circuits.
Less obviously, analog filters are also required at very low signal levels where a digital circuit may not have
enough resolution in bits to represent the signal, and at very high frequencies where the samples can’t be taken
fast enough. Digital filters also require a fair amount of supporting electronics and might be too expensive.
Analog filters will be with us for quite a while!
lines and antenna systems will explain how these work. you a better understanding of how filters behave and are
• Waveguides: Sections of waveguides with internal specified. It wouldn’t be very nice to leave you hanging
baffles or tuning screws can be very effective filters at without some practice, however. So, in the next column,
microwave frequencies. we’ll experiment with a very capable suite of filter design
• Antennas: Not only can antennas act as frequency- software.
dependent filters with preferred frequencies, but they ELSIE (a play on “LC”) is provided by Tonne Software
can act as spatial filters too! (Jim Tonne W4ENE is a long-time contributor to the ARRL
Handbook and other ham radio endeavors), along with
Designing Filters with ELSIE several filter design utilities.
You’ll find that filters are well within your ability to
In this column, I’ve presented some filter basics to give design and build! NV
July/August 2018 21
PRODUCTS
■ HARDWARE
■ SOFTWARE
■ GADGETS
NEW ■ TOOLS
IoT BUILDER DESIGN LeCroy HVD3000A high voltage even to very high frequencies, greatly
SOFTWARE differential probes, including the 1 kV
HVD310xA, the 2 kV HVD3206A,
improving measurement capability.
The high CMRR combined with low
BUILD IT YOURSELF
By Jim Arlow
BUILD A
MIDI LYRE
When you think of MIDI controllers,
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/magazine/issue/2018/07.
A MIDI controller can control any MIDI instrument by other plucked instrument), it goes something like this:
sending it MIDI messages over a standard transport
protocol. The original MIDI specification calls for a serial 1. Touch string.
protocol at 31250 baud sent through a five-pin DIN 2. Pull string from its equilibrium position.
connector. This is the protocol we will use here because 3. Release string.
it’s supported by the majority of MIDI instruments.
However, it is worth noting that there are other MIDI The release of the string causes it to start vibrating,
transport protocols in use; for example, MIDI over USB, and these vibrations are transmitted to a soundboard fixed
Firewire, and Bluetooth LE. It would be an interesting over a resonant cavity that amplifies the vibrations and
follow-up project to modify the MIDI lyre to support one creates the sound.
or more of these newer transport protocols. If we consider a touch event as a simple pulse (as
A MIDI message is made up of an eight-bit status byte shown in Figure 1), then a keyboard sends a Note On
optionally followed by one or two data bytes. There are a message on the rising edge of the pulse when a key is
large number of MIDI messages, but the only ones that pressed, and a plucked instrument sends a Note On
concern us for the lyre are the MIDI Note On and (for message on the falling edge of the pulse when a string is
completeness) Note Off messages. Note On causes the released. The keyboard also sends a Note Off message
MIDI instrument to play a particular note; Note Off causes when the key is released.
it to turn that note off. Does a plucked instrument ever send a Note Off
message? Not really. For most plucked instruments, the
Table 1 sound usually fades away naturally.
MIDI Message Status Byte Note Byte Velocity Byte Now that we understand a bit about lyres and MIDI,
let’s consider the construction of the instrument itself.
Note On 1001 nnnn 0kkkkkkk 0vvvvvvv
Note Off 1000 nnnn 0kkkkkkk 0vvvvvvv Building the MIDI Lyre
The On and Off messages are shown in Table 1. Each There are two aspects to building the MIDI lyre: the
message begins with a status byte where the most electronics and the touch sensors. We’ll start with the
significant four bits of each message (1001 and 1000, electronics.
respectively, in this case) indicate what the message The electronics are comprised of an Arduino Uno, an
means, and the least significant four bits specify the Adafruit MRP121 capacitive touch sensor breakout board,
channel. There is a total of 16 MIDI channels, and you can a female MIDI socket, a couple of resistors, and a couple
assign a different instrument to each one.
We will be sending on channel 0000, so the MIDI
status byte for Note On will be 10010000 (90
hexadecimal); for Note Off, it will be 10000000 (80
hexadecimal).
The next byte is the Note Byte which is a number
from 0 to 127. MIDI defines 128 possible notes such that
each increment by one represents a semitone increase in
pitch. Middle C is (usually) MIDI number 60 and middle
C# is (usually) MIDI number 61. We say “usually” because
how a particular MIDI instrument is tuned is up to the
instrument manufacturer.
The final byte in the Note On and Note Off messages
is the Velocity Byte, which is a number from 0 (silent) to
127 (maximum volume). The MIDI lyre will always send at
maximum volume (127) because it doesn’t have any touch
capability for volume control.
A MIDI keyboard controller works by sending a Note
On when a key is pressed and sending a Note Off when it
is released. Depending on the voice selected, the note will
stop immediately or decay at some preset rate when the
■ FIGURE 1. A touch shown as a simple pulse.
key is released. That’s fine for a keyboard, but how do we Keyboards send a Note On event on the rising edge
simulate a plucked instrument using MIDI? and a Note Off event on the falling edge. Plucked
If you consider the action of plucking a lyre (or any instruments send a Note On on the falling edge.
July/August 2018 25
Arlow - MIDI Lyre - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:22 PM Page 26
DESCRIPTION QTY
Electronics
1/2 size solderless breadboard 1
Arduino Uno 1
Perspex carrier plate for Uno and breadboard (optional) 1
Adafruit 12-key capacitive touch sensor breakout - MPR121 (PRODUCT ID: 1982) 1
Tactile button (E Switch TL1100F160Q or similar) to fit breadboard 2
(SparkFun tactile button assortment 10302 is perfect)
Tactile button key caps (optional; included in SparkFun tactile button assortment) 2 PARTS
220R resistor
DIN 41524, 5/180º mini-DIN connector, right angle, PCB mounting,
2
1
LIST
(e.g,. CUI, Inc.; SDS-50J or SparkFun PRT-09536)
Dupont jumper wire connected 6 inch (approx) male to male (e.g., SparkFun PRT-12795) 1
Strings
2 mm diameter x 1 m length extruded carbon fiber rod 4
15A 12-way terminal barrier block (with screw fixings to take carbon fiber rod) 8 mm pitch 2
26 July/August 2018
Arlow - MIDI Lyre - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:22 PM Page 27
of tactile switches. The circuit diagram is shown in Figure 2. The whole thing is
assembled on a half size breadboard as shown in the diagram in Figure 3. A
photo of the assembled board is shown in Figure 4.
The first thing to do is to add the headers to the Adafruit MPR121 board.
When you get the board, it comes with two headers that need to be soldered www.poscope.com
in place so that in can be inserted into a breadboard. You can find full details of
how to do this at https://learn.adafruit.com/adafruit-mpr121-12-key-
capacitive-touch-sensor-breakout-tutorial/assembly.
It’s very easy: Insert the long pins of both headers into the breadboard to
- USB #"
- Ethernet - Encoders
- Web server - LCD
- Modbus #"
"
- CNC (Mach3/4) #""
- IO
- up to 256 - up to 32
microsteps microsteps
- 50 V / 6 A - 30 V / 2.5 A
#"! ""
- Isolated
""
""
- up to 50MS/s
- resolution up to 12bit
- Lowest power consumption
#" ""
- 7 in 1: Oscilloscope, FFT, X/Y, Recorder,
"""
" "
" """"
"
July/August 2018 27
Arlow - MIDI Lyre - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:22 PM Page 28
try to get the other ends of the strings into the neck block. If you need to replace a string (highly unlikely), loosen
This is surprisingly difficult and very, very fiddly because all the bolts holding it, slide it out of the top of the neck
the strings are already fixed at one end! block, and slide the new string in. It’s interesting to note
The easy way to string the lyre is as follows: that most string instruments have a preferred — and
sometimes necessary — way of being strung, and the MIDI
1. Loosen all the nuts on the neck terminal block so lyre happens to be no exception.
the holes are completely open. I remember spending an afternoon stringing a lute
2. Slide each string through the block to about its and getting halfway before I realized that I wasn’t going to
halfway point. get any further doing it that way.
3. Offer the end of each string up in turn to the A word of warning: Be careful when you tighten the
bridge terminal block and tighten in place. nuts in the terminal blocks. You need to just catch each
4. Slide the neck terminal block up to the opposite carbon fiber rod so that if you give it a little pull, it won’t
end of the strings and tighten everything. come out. Although carbon fiber rod is immensely strong,
it can be quite friable if crushed.
This is a very quick and easy method because you can Once you have fastened the strings in place, you need
move the strings independently. to mark some of the strings to give you an indication of
C = Cb + Cx
■ FIGURE A. Output on one of the MPR121
The chip measures Cb and establishes the baseline electrodes with no touch.
capacitance which corresponds to no touch. This baseline
changes, so the chip dynamically recalibrates to
compensate for this. When an electrode is touched and
Cx is large enough, the chip registers a touch. When the
capacitance falls to the baseline again, it registers a
release.
It works by sequentially charging each electrode to a
peak voltage, V, by applying a constant current, I, for a
given time, T. It then measures V using a built-in 10-bit
ADC (analog-to-digital converter), then shorts the
electrode to ground ready for the next cycle.
Both I and T can be changed by altering the values of
internal registers, but for this application, the default
values seem to work well. We know that capacitance is
defined as:
C = Q/V
30 July/August 2018
Arlow - MIDI Lyre - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:22 PM Page 31
This is like a “hello world” for the Arduino. scale or even a chromatic scale (after all, there are 12
If Blink runs okay, then you’re in business. If it doesn’t, strings!). The current limitations of the software are that
then there may be something wrong with your setup or there must be zero or more semitones between each
the Uno board. There is plenty of documentation and help string, and each semitone is of equal size according to
available on the website. normal Western tuning, which is 12-tone equal
You can find the software for the MIDI lyre with the temperament (i.e., 12 semitones in an octave where each
article downloads. Grab the file and import it into the web semitone is the same size).
editor using the Import button. From there, you can The software could easily be modified to play in
upload it to the Uno. Once it’s uploaded, connect the lyre different temperaments by sending MIDI pitch bend
to your MIDI instrument. If you touch and release a string, messages with each note. However, this is something for a
it should play something. follow-up project. If you’re interested in non-standard
temperaments, then you should check out Scala at
Warning: If you have your MIDI instrument connected www.huygens-fokker.org/scala.
while you are uploading the software, odd things will
happen! This is because on the Uno the same serial port Operation and Testing of
is used for MIDI and for USB. Therefore, to prevent
spurious MIDI messages, always turn off or disconnect the MIDI Lyre
your MIDI instrument before uploading software! When you power-up the lyre, the Uno’s built-in LED
will flash 25 times. Do not touch the strings during this
If you take a look at the software, you’ll see that there time because the MPR121 is calibrating itself against
are three global variables that you can customize. The first background capacitance (no touch)! If the LED never
variable is tonic. This sets the key in which the lyre is stops flashing, then you have an error communicating with
tuned, according to Table 4. the MPR121, and you should check all your wiring.
Once the LED has stopped flashing, you can connect
Table 4 your MIDI instrument if you have not already done so. If
Tonic 0 1 2 3 4 5 6 7 8 9 10 11 you touch and release a string, the instrument should play
C# D# F# G# A# a note.
Key C D E F G A B Remember that the MIDI lyre does not send Note Off
Db Eb Gb Ab Bb
messages. Therefore, if you select a voice that has infinite
The next variable is octave. As you might expect, this sustain, the note will just continue to play.
sets the octave in which the lyre will play. You can see The lyre only works with voices that die away
how it is manipulated by the Octave Up and Octave naturally, such as piano, guitar, any plucked instrument, or
Down buttons in the corresponding octaveUp( ) and tuned percussion such as tubular bells or gamelan.
octaveDown( ) functions. If you have installed the Octave Up and Octave Down
The default octave is 5, which is a nice treble range, buttons, pressing Octave Up will take the lyre up one
but, for example, you could instead default to a bass octave; pressing Octave Down will take it down one
instrument by setting the octave to 3 or 4. octave.
Finally, we have an integer array called There are two important points to note about this:
majorScaleOfsets[ ]. This controls the pitch of each string Firstly, not all voices work well at every octave; and
relative to the tonic. Each integer in this array is the secondly, changing the octave affects the next note to
number of semitones that a string differs from the tonic. In
the default tuning of the lyre, the tonic is C which is on
string number 4 (remember that the strings are numbered Resources
https://create.arduino.cc
from 0 to 11 to match the MPR121 electrodes). So, we The Arduino Web Editor.
www.midi.org
have: The MIDI Association.
Everything about MIDI. www.huygens-
majorScaleOfsets[ 3 ] = 0 fokker.org/scala
https://learn.adafruit.com/a Scala software for non-
dafruit-mpr121-12-key- standard temperaments.
String 0 is the first string; this is tuned to the G below capacitive-touch-sensor-
the tonic, so majorScaleOfsets[ 0 ] = -5, because G is five breakout-tutorial/assembly https://learn.adafruit.com/a
Details on the Adafruit dafruit-mpr121-12-key-
semitones below C. capacitive-touch-sensor-
MPR121 breakout board.
You should now be able to see that by changing the breakout-
values in majorscaleOffsets[ ], you can completely change https://www.arduino.cc tutorial/downloads
Everything about the Adafruit MPR121
the scale of the MIDI lyre. datasheet.
Arduino.
For example, you might change it to play in a minor
32 July/August 2018
Arlow - MIDI Lyre - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:22 PM Page 33
play, not the one that is currently package it all up in some way so
playing. that it’s easy to transport and play.
Playing the MIDI lyre is done There are any number of ways
with a plucking type of motion that you can do this, and provided you
is a quick touch and release. If you still have access to the strings,
touch a string, it will not sound until buttons, and ports, you can
you release it. Touch sensor package it as you choose.
reliability can depend quite strongly I like to make the instrument
on skin resistance, so if you have look like a lyre. The easiest way to
particularly dry skin, you might find achieve this is to mount the
that your touch is not always instrument on a U-shaped piece of
detected. MDF, Perspex, or ply as shown in
To solve this problem, you may Figure 7. I find 6 mm is a good
need to moisten your fingers thickness for the sheet material
slightly before playing. In fact, it’s because it’s rigid enough without
quite useful to keep a damp sponge being too heavy. My MIDI lyre is
or towel next to you while you play. shown in Figure 7.
You can play single notes or chords I call this a “skeleton lyre”
because the instrument is fully because I keep the electronics
polyphonic. exposed so I can easily experiment
The other way to play the lyre and make changes. For a more
is to strum it by dragging your robust instrument, you can cover
fingers across several strings. The the electronics apart from the
instrument works very well in this buttons and ports.
mode. (In a future article, I’ll The shape I have chosen is
describe a simple modification that ■ FIGURE 8. Plans for the MIDI lyre roughly based on the Saxon lyre
frame that are loosely based on the
turns the MIDI lyre into an Sutton Hoo Saxon version. from the seventh century C.E. that
autoharp for playing strummed was found in a burial site at Sutton
chords.) Hoo, England.
Figure 8 shows the plans for this instrument if you’d
Putting It All Together like to copy it. NV
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.
em Controlled
e
310oF~840oF $15.25
BUILD IT YOURSELF
By David Goodsell
DISPLAY
I use LCD displays in almost every project. They are perfect for displaying data about
voltage, current, time, frequency, wind speed, rainfall, etc. However, in this modern
age of steampunk, I stumbled on something much cooler.
34 July/August 2018
Goodsell - Steampunk-Electromechanical Display - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:42 PM Page 35
Post comments on this article and find any associated files and/or
downloads at www.nutsvolts.com/magazine/issue/2018/07.
July/August 2018 35
Goodsell - Steampunk-Electromechanical Display - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:42 PM Page 36
■ FIGURE 3. The
stack of boards
includes an
ATtiny2313 µC
and four TB6612
dual motor
drivers to decode
and flip segments
A-G.
Breadboard Stage
I like to start with a breadboard before I commit
to a PCB because of several painful experiences in
the past. The breadboard consisted of four TB6612s,
some inverters, and an ATtiny AVR chip to do the
decoding and pulsing. Figure 6 is the schematic of ■ FIGURE 5. I used four of the Adafruit TB6612 motor driver
the final unit, but the breadboard was very similar. boards for a breadboard before committing to a PCB.
Amazingly, it worked the first time. I had not
mis-wired a single segment. However, just as I was a 3K resistor and kept it low, except during the 25 ms
congratulating myself, I said “What’s that smell? pulses. Problem solved. Whew!
Something is burning! (BTW, in my video on YouTube I mentioned applying
The spec sheet for the displays emphasized that the a 250 ms pulse. Not so! 25 ms is the correct duration.)
segments should not be pulsed more frequently than 900
ms because the coils would overheat. I had programmed Counting Dial Pulses
the Tiny to wait the correct interval but as I moved several
wires on the breadboard (without turning off the power?), and SPI
I inadvertently let the TB6612 standby pins float high for a A properly adjusted normally-closed rotary dial
minute or so. Several coils got really hot and almost operates at 10 pulses per second (PPS), 60 ms open, 40
burned out. ms closed. Dialing “O” generates 10 pulses and would
From then on, I pulled the standby line to ground with display a zero. I set up the program to tally the pulses until
July/August 2018 37
Goodsell - Steampunk-Electromechanical Display - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:42 PM Page 38
the dial was done rotating, and after ■ FIGURE 7. I successfully soldered
detecting a “missing pulse” it would the SMD components with a chisel
send the total to the display. It took a tip iron, 0.015” solder, and flux pen.
whole day of hair-pulling to get this
supposedly simple routine to work
correctly. board, and MicroC board. They are
I also wanted the Telephone interconnected via headers, with a
System Processor (Arduino Mega little air space between them for
2560) to be able to talk to each cooling. I used ExpressPCB because
display via an SPI link (Data & Clk). their boards have been very accurate
The Mega would serially transmit in the past and cost-effective for small
eight bits over the daisy-chained lines jobs. The layout software was free and
to all nine displays. The high nib easy to use. The file for the boards is
would be the address (0 to 15) and with the article downloads.
the low nib would be the character to Regarding the layout, I was
display (0 to 9 and six special pleasantly surprised that the four
characters). driver chips would fit on one board.
Actually, it was super easy The chips have a ton of pins, but with
because both the Mega and Tiny had a two-sided board you can do
ready-to-use SPI routines. Although, I wonders. The design also required
had to slow down the Mega SPI seven inverters but the normal
transfer rate quite a bit to get reliable 74XX04 only had six.
data from the Mega port to the EMD So, I added a simple transistor
Tinys because the pulses had to go through buffers, high inverter on the breadboard. Just by luck I stumbled on to
speed opto-isolators, and 40” of twisted pair cable to get the perfect chip to replace the transistor in the final
to the farthest EMD. The received signal was a mess at the design. It was a 74HCT1G04, which had five pins and
higher rates and required a scope to track down a contained a single 74XX inverter. Six + one = seven. How
readable waveform. nifty! I happily added it to the back of the driver board
and ordered the first set of three PCBs.
PCB Design Two days later they arrived. SEMI-DISASTER! The new
single-inverter chip was left-right reversed on the board! I
I settled on three stacked PCBs: a coil board, driver had forgotten to reverse the pins when I mounted it on
the backside. I had to
ITEM DESCRIPTION DIGI-KEY laugh.
(unless noted otherwise) However, I saved
C1, C4-10, C13-15 0.1 μF, 25V, Capacitor, 0805 399-1168-1-ND the board by swapping
C2, C3
C11, C12
10 μF, 25V, Capacitor
0.47 μF, 16V, Capacitor, 0805
478-5257-1-ND
478-1403-1-ND
PARTS the inverter’s pins with
some wirewrap wire. I
R1, R4, R5, R7
R2, R3
10K, Resistor, 0805
3K, Resistor, 0805
311-10.0KCRCT-ND
311-3.0KARCT-ND
LIST corrected my mistake
R6, R8 470, Resistor, 0805 311-470ARCT-ND on the next order of
R9, R10 2K, Resistor, 0805 311-2.00KCRCT-ND boards.
D1, D2 1N4148, Diode, SOD23 1N4818WTPMSCT-ND
Q1 5V Regulator, 100 ma, SOT223 NCV4264-2ST50T3GOSCT-ND
U1 74HCT04, Hex Inverter, TSSOP 1727-4085-1-ND Drag
U2-U5
U6
TB6612, Dual Motor Driver, SSOP
74HCT14, Inverter, Schmitt, TSSOP
TB6612FNGC8ELCT-ND
296-8395-1-ND
Soldering
U7 ATtiny2313, MCU, 8-bit, SOIC ATTINY2313-20SURCT-ND A friend suggested
U8 74HCT1G04 Single Inverter, SSOP 1727-6051-1-ND a website that explained
LED1 LED, Red, 1206 1830-1092-1-ND
H1, H2, H3, H5, H6 Headers: 1,3,7,7,7 pins (25 pins total) S1232E-36-ND how to “drag-solder”
H4, H7, H8 Headers: 3,3,7,7 pins (20 pins total) 3M156862-36-ND fine-pitch ICs. The
PCB Printed Circuit Boards; set of 3 ExpressPCB, custom YouTube link is
DISP1 Seven-Segment Electromagnetic Display Ebay, see link in article 6PB0u8irn-4. I’m sure
SW1 Tactile Pushbutton, SPST, NO CKN10741-ND
TOOL1 Flux Pen KE-1803, Kester this technique is old hat
TOOL2 AVR Programmer/Debugger ATATMEL-ICE-BASIC-ND to lots of folks but it
or AVRISP mkII (Ebay) was new to me.
TOOL3 Atmel Studio 7 IDP Microchip Alas, there was
38 July/August 2018
Goodsell - Steampunk-Electromechanical Display - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:42 PM Page 39
Programming the
ATtiny2313
I chose to program the ATtiny2313 in
assembly using Atmel Studio because I had used
the same chip in another recent project. The only
tricky part was the “missed pulse” section that
■ FIGURE 8. Front view: The six-pin ISP programming
locked in the dial count when the rotary dial connector is in the upper right of the right MicroC board.
finished turning. The rest was easy.
Actually, if you just want to use SPI to talk to
the displays, a smaller chip could probably be
employed, including PICs. The assembly program
is available with the article downloads.
To program the µC, two different Atmel In-
System Programmers (ISP) are available. The
AVRISP mkII is obsolete but still available on eBay
for about $50. The current AVR
programmer/debugger from the manufacturer is
the ATATMEL-ICE for $91. In both cases, when the
chip is being programmed, it has to be powered-
up by a separate 5V supply.
That concludes my description of the design,
construction, programming, and operation of the
EMDs. However, I’d like to say a few more words
about my “ambitious” telephone project, in case
anyone is interested.
■ FIGURE 9. Rear view: The five-pin single inverter chip (U8) is
located on the back of the left driver board, in the lower right.
So, What’s this
Telephone Project electronic switching gradually took over. By the 1990s, the
all About? SXS switches were completely phased out.
In days gone by, telephone operators manually routed This brings us to my vintage step-by-step switching
the calls by using switchboards with plugs, jacks, lever system. I embarked on the project — called a Private
switches, and lots of wires. It was labor-intensive, but nice Branch Exchange (PBX) — because when I was a kid I
to hear the operator say “Number Please?” went on a field trip to the telephone company and the
In 1891, a man named Strowger envisioned an rows and rows of clicking SXS switches left a lasting
electromechanical system to replace the operators. The impression on me. With the advent of eBay, it’s much
end result was the rotary dial which selected the number easier to find old telephone equipment.
to call, and electromechanical step-by-step (SXS) switches I bought the five SXS switches from a guy on the east
to automatically route the calls. coast. I built a sturdy frame for them and added a ton of
Soon, the Central Offices were filled with thousands electronics, displays, relays, switches, lights, power
and thousands of clicking step-by-step switches, and supplies, and an Arduino Mega to make them do some
operators were only needed for long distance calls. Over fun things.
the years, improvements were made to the switches, but A photo of the backside of the PBX with its numerous
July/August 2018 39
Goodsell - Steampunk-Electromechanical Display - Jul-Aug 18_Blank Project NV.qxd 6/12/2018 4:42 PM Page 40
■ FIGURE 10.
The back of the
telephone
demonstrator
contains
numerous
subassemblies,
relays, and a blue
Arduino Mega
2560 system
controller.
subassemblies is
shown in Figure
10.
In operation,
my PBX can pulse-
dial and ring the
touch-tone phone
(#54321).
It can connect
to an outside line
by dialing 9, then
dial up any
number in the
world, including cell phones. Plus, I used the Arduino
Mega to add a six-number auto-dial memory function
Introducing the much like modern phones.
NEW PV Jr.
Finally, it has a secret “Spirit of the Telephone” hidden
inside the circuitry that randomly replays Alexander
Graham Bell’s first call in 1876, and a comedic routine by
our favorite TV operator, Lily Tomlin.
Mini Circuit Board Holder I’m not alone in my fascination with old telephones.
There are two major groups — Antique Telephone
Collectors Association (ATCA) and Telephone Collectors
International (TCI) — whose members have constructed
DESIGNED much more elaborate (by a factor of 100) step-by-step
switching systems in their garages and basements. These
FOR OVER folks are really serious about vintage telephones and
telephone equipment.
THE EDGE
COMPONENT Afterthoughts
BOARDS Hopefully, other innovative experimenters will find
Model applications for these funky displays and devise alternate
220 schemes to drive groups of them, which may cut down on
the number of components.
In the meantime, just remember, steampunk rules!
NV
Innovative H olldi
o din
Holdingngg SSolutions
olutio
olutiio
ut ons
n
800-759-7535
40 July/August 2018
Romi
Versatile robot platform with
integrated battery compartment,
Balboa motors, and wheels; several
add-on board options available
Programmable balancing
robot kit that can stand
itself up and drive
around on two wheels
...and more
Everything from Zumo
mechanical parts and Complete integrated Mini
jumper wires to motor Sumo robot on a tracked
drivers and voltage chassis, featuring a
regulators variety of sensors
Finding the right parts for your robot can be difficult, but you also don’t want to spend all
your time reinventing the wheel (or motor controller). That’s where we come in: Pololu
has the unique products—from A-Stars to Zumos—that can help you take your robot from
idea to reality.
BUILD IT YOURSELF
CABLE CONTINUITY
downloads at www.nutsvolts.com/
magazine/issue/2018/07.
TEST JIG
If you’re like me, you likely ■ FIGURE 1.
have a drawer or shoebox
stuffed with assorted USB
cables that are used to
either charge or program a
USB device. The problem
often is that some cables
may only be useful for
charging, and which only
have the +Vcc and ground
wires intact with one or
both data wires either
broken or not connected in
the first place.
ALLELECTRONICS.com
up more space.
I hope you find this test jig
handy. NV
Surplus & New Parts & Supplies since 1967
Order Online or Toll Free 1-800-826-5432
The little breakout boards are
available from suppliers such as AC POWER CORD WITH 6 VDC, 25 RPM GEAR MOTOR
SparkFun. SparkFun part numbers
INLINE ROCKER SWITCH New gear head motor
prepped with an arm
are as follows: that rotates an offset axle
in a 1" circle. Motor is
• Type A USB: BOB-12700 1.45"D x 3.00"L. No-load specs: 25RPM @
6Vdc, 150mA. Prepped w/ wire leads and
• Micro-B USB: BOB-12035 70" power cord with on-off rocker switch
drive arm. Includes a custom mounting
mid-way. Black SPT-2 18 AWG zip cord
• Mini-B USB: BOB-09966 bracket and slotted metal link rod.
rated 300V, cULus. $
• Jumpers F/F: PRT-11710 or CAT# LCAC-456 250each
CAT# DCM-470
$ 75 10 for $4.25 each
12796 100 for $1.85 each 4 each 100 for $3.75 each
July/August 2018 43
Gualtieri - Inductor Winding - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 4:50 PM Page 44
Does Inductor
Winding Have
You Tied in
Knots?
By Dev Gualtieri, Tikalon LLC To post comments on this article and find any associated files and/or
(gualtieri@ieee.org) downloads, go to www.nutsvolts.com/magazine/issue/2018/07.
FIGURE 3. A solenoid
coil wrapped on a
ferrite core.
July/August 2018 45
Gualtieri - Inductor Winding - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 4:50 PM Page 46
where L is the inductance in henrys, N is the number of magnetic core can be moved into and out of a coil to
turns, µ0 is the permeability of free space (4π x 10−7 H/m), make a variable inductor.
A is the cross-sectional area of the coil in square meters, As an example that multi-layer coils closely follow this
and ℓ is the length of the coil in meters. This formula same equation, I measured the inductance of the 52-turn
applies only to long single layer coils, but it’s generally coil shown in Figure 3 and got 93 mH. When I put a
close for shorter coils and most multi-layer coils, as I’ll second layer of 42 turns over this, the inductance was 315
show later. mH. Scaling by the ratio of the square of the turns gives
If we wind a coil on a magnetic material (such as a us a calculated inductance of 303 mH, which is just a few
ferrite rod), the inductance is greatly increased (Figure 3). percent less.
That’s because the permeability of the core is much
greater than the permeability of free space. The magnetic Toroid
core concentrates the magnetic field lines inside the coil
where they have the greatest effect. Magnetic flux “leaks” out of each end of a short
Depending on the core material, the inductance solenoid coil, and that’s why the inductance equations
increase can be much more than a thousand, although given above are specified for the ideal case of an infinite
common radio frequency values range from about 200 for length.
VHF to 1,000 for lower frequencies. A simple fix for such leakage is to join the ends
The magnetic permeability of ferrite is large, so the together to create a toroid, as shown in Figure 4.
magnetic field lines are concentrated in the coil, thereby The inductance of a single layer winding on a toroid is
increasing inductance by a large factor. given as:
The inductance equation for such a coil is the same as
for an air-core coil multiplied by the relative permeability L = N2Kµ0A/2pr
K of the magnetic core:
which is our familiar equation with the length replaced by
L = N2Kµ0A/ℓ the unwrapped length of the toroid; that is, its
circumference at the midpoint, with the distance from the
The relative permeability is the ratio of the center of the circle to the midpoint being the radius r.
permeability to the permeability of free space. The Toroids offer a slightly greater inductance than short
solenoids for the same number of turns, since the
magnetic field lines are all contained inside the
core.
Ferrite Materials
While iron is a magnetic material, it doesn’t
make a good inductor core. That’s because it’s also
an electrical conductor, and the alternating currents
applied to a surrounding coil will lose energy by
heating the iron through induced eddy currents.
Think in terms of not putting metal objects into a
microwave oven.
There’s also the problem that the iron will
“saturate;” that is, become so charged with a
magnetic field that it can’t be made to magnetize
further.
There are various ways around this problem;
one of which is to load the iron with silicon to form
a steel alloy that’s less conducting, and to form the
core from thin sheets that are insulated from each
other. This is the method used to make cores for
most low frequency transformers. Another is to
make the iron into a fine powder and encapsulate
each grain.
At radio frequencies, we need a better material
FIGURE 4. An inductor wound on a toroidal ferrite core. than iron or steel; one that won’t saturate and is an
46 July/August 2018
Gualtieri - Inductor Winding - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 4:50 PM Page 47
Quality Factor
You can’t wire your house with FIGURE 5. An op-amp gyrator circuit. RC forms a phase-shifting
small diameter wire since the wire circuit, and the simulated inductance is proportional to this phase
shift. The resistor RL must generally be at least a few hundred ohms
resistance is too high; you’ll get a for most op-amps, so the inductor Q is limited.
voltage drop across that resistance.
Too small a diameter wire will
likewise diminish the effectiveness of an inductor, which only at low frequencies, so gyrator inductors will only
ideally should have zero resistance at low frequencies. work at low frequencies. As can be seen in Figure 5, the
The quality of an inductor — known as its Q — is a simulated inductance has one terminal grounded, so this
measure of how well it acts as a perfect inductor at a limits the types of circuits in which gyrator inductors can
given frequency F: be used.
Also, the inductor resistance RL must be reasonably
Q = XL/R = 2pFL/R large since op-amp inputs have limitations. RL must
generally be at least a few hundred ohms for most op-
where XL is called the inductive reactance (essentially, the amps, so the inductor Q is limited.
“AC resistance”) which is equal to 2pFL. The Q factor
effectively shows how much better an inductor is at Litz Wire
responding to alternating current than direct current. It
also shows how narrow a band-pass filter you can build The “skin effect” is the tendency for high frequency
from an inductor and capacitor. currents to preferentially flow near the surface of wire. In
effect, the middle portion of the wire is wasted conductor at
Gyrators high frequencies; when you’re winding an inductor, you end
up with a higher resistance for the same number of turns.
Inductors and capacitors are complementary devices. An easy way around this is to use Litz wire, which is a
Capacitors pass high frequencies while blocking low multi-stranded single-conductor wire. Litz wire allows a
frequencies. A capacitor’s ability to block direct current is parallel combination of smaller wires that mitigates the
one of its most important functions. skin effect.
An inductor quite differently
passes low frequencies and blocks
the high frequencies.
There’s an electrical circuit called
a gyrator that uses a capacitor to
make a simulated inductor. Gyrators
are built around an amplifier. They
can be implemented using active
components, including transistors,
but it’s most common to use an
operational amplifier (op-amp) as
shown in Figure 5. Gyrators can be
used to simulate huge values of
inductance, but they have a few FIGURE 6. A resonant parallel combination of an inductor and
limitations. capacitor driven by a signal generator and monitored by an
Op-amps generally work well oscilloscope.
July/August 2018 47
Gualtieri - Inductor Winding - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 4:50 PM Page 48
Vintage Computing
Amigo Color BASIC —
The Missing Manual
By Dane Weston
The original online daneweston15@gmail.com
T
documentation for
the Amigo retro he commands not covered previously include Color BASIC bitwise operators,
computer was SRAM commands, access to the hardware counter registers on one Parallax
intended to help Propeller cog, and a few odds and ends. The tips include a map of screen
readers mentor memory that allows direct read or write access to the Amigo display, and how to
youngsters on build your own hardware “shields” for your Mentor’s Friend. I hope you and a
young protégé can use this additional data to add some zest to your Amigo
computer adventures!
programming
fundamentals. It also Bitwise Operators
included an
“overview of most Let’s begin with the bitwise operators. Color BASIC implements some of the
Color BASIC bitwise operators found in Propeller Assembler and Spin without elaboration or
complication, and you and your Amigo may find them useful in addressing some
commands.” A programming tasks.
couple of astute As shown in Figure 1, these bitwise operators include shift left (SHL), shift
readers working right (SHR), rotate left (ROL), rotate right (ROR), arithmetic shift right (SAR), bit
beyond introductory reverse (REV), bitwise logical and ( & ), and bitwise logical or ( | ).
mentoring have Depending on your background and experience, each of these operator’s
functions may or may not be intuitive. For me, the easiest way to understand
asked me about the them is just to try them out and see what happens. The code snippet that
full command set. follows (available with the downloads as BINARY.BAS) offers one way to do this,
This article covers and illustrates a couple of the bitwise operators in the process:
those “missing”
5 REM ——- BINARY.BAS ——-
commands, plus a
10 CLS
couple of tips and 20 PRINT “ “: INPUT “Expression to Convert to Binary? “;n
tricks that Amigo 25 PRINT “N = “;n
owners may find 30 PRINT “N = %”;
helpful. For 40 GOSUB 500
reference, you can 50 DISPLAY 13,13: PRINT “Again (Y/N)?”
60 a=INKEY
find the complete 70 IF a=0 THEN GOTO 60
Color BASIC 2.2L 80 IF a<>”N” AND a<>”n” THEN GOTO 20
command set with 90 PRINT “ “: PRINT “Bye!”
the article 100 END
downloads. 495 REM ——- Bit Mask / Print ——-
July/August 2018 49
Weston - Missing Manual - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 4:59 PM Page 50
Vintage Computing
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/magazine/issue/2018/07.
Vintage Computing
CLEAR
PRINT PEEK 0
0
POKE 0,100
PRINT PEEK 0
100
POKE 1,”A”
PRINT PEEK 1
65
DISPLAY PEEK 1
A
POKE 2,965
PRINT PEEK 2 FIGURE 4: Your Amigo can use SRAM to store 32-bit
197 integers and string data.
POKE 2,-965
PRINT PEEK 2 interesting possibilities to address Color BASIC’s lack of
59 strings and a DATA statement. It’s also easy to store 32-bit
CLEAR integers using four SRAM bytes. Here’s how.
PRINT PEEK 0, PEEK 1, PEEK 2 Enter the following code (or copy it from the article
0 0 0 downloads) and RUN it on your Amigo. As shown in
Figure 4, SRAM.BAS will prompt you to enter a number
These examples should give you a feel for the SRAM (any 32-bit integer) and then a string, store these in SRAM,
commands. and then retrieve and display them.
A couple of points are worth mentioning, even if they
seem obvious to you. The CLEAR command does zero-out 10 REM —- SRAM.BAS —-
all 32767 SRAM locations, and it takes several seconds to 15 COLOR 63,22
complete. You can only store one eight-bit byte in an 20 CLS
SRAM location, and if you try to write a number greater 25 LOCATE 10,0: PRINT “—- Exploring Amigo SRAM —
than 255 or less than zero, only the eight least significant -”
bits will be saved. 30 LOCATE 2,2: INPUT “Enter a number: “;n
An alphanumeric (or graphics) character can be saved 35 LOCATE 4,4: PRINT “Saving “;n;” to SRAM...”
and recalled with eight bits, which opens up some 40 a=100: GOSUB 200
45 LOCATE 2,10: PRINT “Enter a string: “;
Command Action Performed 50 x=4: y=12: LOCATE x,y REM <— COL,ROW of
String Start
55 L=INKEY : IF L=0 THEN GOTO 55
Reads data from SRAM. Returns the eight-bit
byte value stored at SRAM address a (0 to 60 IF L=13 THEN DISPLAY 5: GOTO 75
PEEK a
32767). Typically used on the right of the 65 IF L=200 THEN DISPLAY 8,32,8: GOTO 55
assignment operator, as in x = PEEK a. 70 IF L>12 THEN DISPLAY L: GOTO 55
75 a=200: GOSUB 400
100 LOCATE 2,22: PRINT “Press Any Key to
Writes to SRAM. Places the eight-bit byte
value v at SRAM address a. If v is less than 0 Retrieve Info...”
POKE a,v
or greater than 255, only the eight least 105 IF INKEY =0 THEN GOTO 105
significant digits will be saved. 110 a=100: GOSUB 300
115 LOCATE 4,6: PRINT “Retrieved Integer = “;n
Clears SRAM memory (0 to 32767) to zeros. 120 LOCATE 2,14: PRINT “Retrieved String:”
CLEAR Also occurs when the REBOOT command is 125 LOCATE 4,16
executed, but not when NEW or RUN is
issued. 130 a=200: GOSUB 500
FIGURE 3: The Color BASIC 2.2L SRAM commands 135 LOCATE 2,24: PRINT “Again (Y/N)?
manage your Amigo’s volatile storage. “
July/August 2018 51
Weston - Missing Manual - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 4:59 PM Page 52
Vintage Computing
• Lines 10-199 provide the body of this little program, Our explanation of saving strings to SRAM touched
handling the user interface and calling subroutines to store on direct access to Amigo screen memory, so let’s discuss
and retrieve 32-bit integers and strings. Only two items that useful trick next.
here may need some explanation. Color BASIC uses over 5K of the 32K Propeller main
First, x and y in Line 50 save the column/row memory to support the 50x37 character video display,
coordinates of the first letter of the string being input. with three bytes of memory dedicated to each character
(We’ll use a trick to get the string characters from screen cell. These three bytes provide character, foreground color,
memory, and we’ll need these coordinates to do that.) and background color information about that specific cell
Second, Lines 55-70 place keystroke characters on the of the display, and their position on the memory map
screen, parsing them to exclude non-printable characters doesn’t change with a given Color BASIC binary.
(Line 70), provide a backspace capability (Line 65), and In other words, as long as you’re running the Color
identify the end-of-string (Line 60). BASIC 2.2L that ships with the Amigo, the screen memory
Note ASCII 13 <Enter> is used to stop placing map remains constant regardless of what your program or
characters on the screen. You can’t use it as the string your onboard experiment is doing.
terminator because it jumps to the beginning of the next With a little detective work, it’s possible to discover
line on the screen, and we need to use contiguous cells in this memory map and then use the BYTE command to
screen memory for SRAM input. read from or write to screen memory directly. Here are
I used the ASCII 5 graphics character as the string the formulas you can use to convert screen XY
52 July/August 2018
Weston - Missing Manual - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 4:59 PM Page 53
Vintage Computing
Vintage Computing
10 p=24
15 OUTA [p]=1
20 FRQA = 24365
25 CTRA = %00100 SHL 26 + p
30 OUTA [p]=0
35 IF INKEY =0 THEN GOTO 35
40 FOR n = 24365 TO 48730 STEP 25
45 FRQA = n
FIGURE 6: One cog counter configured as a
numerically controlled oscillator. The PHSx register 50 NEXT n
accumulates the value in FRQx every clock cycle and 55 PAUSE 1000
places bit 31 on APIN. CTRx CTRMODE must be set to 60 CTRA = 0
%00100 to enable this mode of operation.
I tried extensively commenting this code to explain
mode of operation which follows.
If you’re intrigued by this powerful capability of your Command Function
Amigo, check out the excellent Parallax application note
at https://www.parallax.com/sites/default/files/ Provides read/write access to the Control
downloads/AN001-P8X32ACounters-v2.0.pdf. You’ll find Register in counter A or counter B.
CTRMODE (Bits 26..30) selects the counter
a superb introduction to using the Propeller cog counters mode of operation. PLLDIV (bits 23..25) sets
in a variety of applications, including RF carrier synthesis, CTRA / CTRB the PLL division factor for PLL modes. APIN
pulse width modulation, digital-to-analog conversion, (bits 0..5) and BPIN (bits 9..14) select the I/O
pin(s) used for that mode of operation.
frequency measurement, and many others. (Both counter A and counter B have an APIN
We’ll just introduce the Color BASIC counter and a BPIN.)
commands and what they do, and then use those
commands to create a numerically controlled oscillator Provides read/write access to the
PHSA / PHSB accumulator register in counter A or counter
(NCO) that generates a tone through the audio section of B.
your Amigo.
Figure 6 shows a block diagram of a cog counter FRQA / FRQB Provides read/write access to the value-to-
add register in counter A or counter B.
configured as a numerically controlled oscillator. It’s a
good place to begin our explanation of the counters and FIGURE 7: The Color BASIC 2.2L counter commands
how to use them with Color BASIC. give you access to two powerful configurable state
Each counter contains three registers that control its machines on one cog of the Propeller.
54 July/August 2018
Weston - Missing Manual - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:26 PM Page 55
Vintage Computing
Vintage Computing
ww
www.embeddedARM.com
w.embeddedARM.com
TS-4900
TS-4900
Computer
Computer on M
Module
odule
W
WiFi
iFi and Bluet
Bluetooth
ooth Enabled
1 GH
GHzz i.MX6 C
Computer
omputer M
Module
odule
Single or Q
Quad
uad Core
Core
TS-7970
TS-7970
Single Board
Board Computer
Computer
GHzz i.MX6 ARMCPU
1 GH
Single or QQuad
uad Core
Core
Up ttoo 2 GB DDR3 RRAM
AM
4 GB MLMLCC eMMC Flash
Flash
Choose your
your own
own adventure.
adventure. W
WiFi
iFi and Bluetooth
Bluetooth
Vintage Computing
80 m=t//10
90 PRINT “Elapsed Time =
“;s;”.”;m;” sec”
100 DISPLAY 13,13: PRINT “Again
(Y/N)?”
110 k=INKEY : IF k=0 THEN GOTO 110
120 IF k<>”N” AND K<>”n” THEN GOTO
10
130 PRINT “Bye!”
D E S – WE MACHINE
which provides everything you need, including the circuit
board, all components (including an EEPROM pre-loaded
GN IT
with Color BASIC), and a 2GB SD card with sample
programs. If you already have a Propeller board with
connectors for a PS/2 keyboard, VGA monitor, and 2GB YOU DESI re s
lo s u
SD card, you can “roll your own” Amigo by downloading ls & E n c
C u s to m Pane
the Color BASIC source from the Nuts & Volts website, c tu ri n g
updating the I/O pin assignments to match your a n u fa
tM w a re
A D S o ft
hardware, and then loading the compiled Color BASIC tF re e C
h ip p in g e n ts
binary to the EEPROM on your board. Or, if you are truly tF re e S e q u ir e m
ambitious, download the Amigo schematic from the Nuts im u m O rd e r R
tN o M in
& Volts website and build out the circuits using your 5 Days
favorite construction techniques, then download the tB u il t in
Color BASIC source or binary and Flash it to your www.frontpanelexpress.com
EEPROM.
July/August 2018 57
Cicchinelli - A Digital-Analog Final Part 5 - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:05 PM Page 58
A Digital
Analog — Part 5
When a PIC can Replace a 555
This final article in our series will examine those circuits from the “555
Timer IC Circuits” by Forrest Mims which were not covered in any of
the preceding four articles. As in the other installments, some will use
the PIC replacement from the first installment (December 2016),
while others will develop specific programs using a PIC to emulate a
particular implementation of a 555.
By Larry Cicchinelli To post comments on this article and find any associated files and/or
downloads, go to www.nutsvolts.com/magazine/issue/2018/07.
J
ust as a quick review, that first article described a
general-purpose 555 replacement using a coupled to the trigger of section 2 which also has a
microprocessor: the PIC12F1572. The second article pullup.
(May 2017) reviewed the circuits and their PIC The operation is quite straightforward: The high to low
equivalents, which used the 555 basically as a mono- edge of the trigger signal causes section 1 to output a
stable multivibrator. Part 3 (December 2017) discussed positive pulse. At the end of the pulse, the low-going edge
the less complex audio oscillator circuits. The fourth article triggers section 2. The purpose of the circuit is to generate
(February 2018) covered the more complex audio an output that is delayed from the triggering pulse.
oscillator circuits.
Where I have modified component values SCHEMATIC 1. 556
in any circuits from the Mims book, I show the cascaded timer.
original values in parentheses. Also, those
components marked with an asterisk (*) are
additional components and are not in the
original.
Mims Circuit 6
Circuit 6 in Schematic 1 shows a 555 being
used as a cascaded timer. The output of the
first section is used as the trigger for the second
section. The trigger for section 1 is essentially
capacitively coupled to ensure that the input
pulse width is shorter than the output pulse
width. Resistor R5 is there to discharge C2; R2
is a pullup that keeps the trigger input high
except when the trigger signal transitions to
58 July/August 2018
Cicchinelli - A Digital-Analog Final Part 5 - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:05 PM Page 59
Mims Circuit 7
Circuit 7 (which is shown in Schematic 4) is titled
as an intervalometer. It’s simply a 556 with section 1
wired as an astable and section 2 as a monostable
driving a relay. The period of section 1 determines
how often the relay is activated, while the pulse width
of section 2 determines the length of time the relay is
activated.
The timing diagram in the book has the
output of section 1 inverted. The output SCHEMATIC 4. 556 intervalometer.
should be shown as high for most of the time
with a short low pulse. Also, the 555 (in
monostable mode) is triggered on a negative-
going edge which the diagram would show if
the upper trace was to be inverted.
The diodes are for protection against the
high voltage inductive kick which occurs
when the relay is turned off. D1 prevents it
from reaching the 555, while D2 should
prevent the voltage across the coil from
exceeding the reverse breakdown voltage of
the diode. I believe a better placement for D2
would be what’s shown by D3 in Schematic
4. This would clamp the high voltage to one
diode drop above the power supply.
July/August 2018 59
Cicchinelli - A Digital-Analog Final Part 5 - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:05 PM Page 60
Mims Circuit 24
The light/dark detector shown in Schematic 8 uses a
photoresistor connected to the Reset input as a gate for
the 555 wired as an astable multivibrator. The Reset input
has to be high in order for the 555 to oscillate. The
position of the switch determines whether the 555 is
enabled when light hits the photoresistor (lower resistance
when exposed to light) or does not hit it.
The threshold of the Reset input is about 1V but the
input resistance will be different depending on the
July/August 2018 61
Cicchinelli - A Digital-Analog Final Part 5 - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:05 PM Page 62
July/August 2018 63
Cicchinelli - A Digital-Analog Final Part 5 - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:05 PM Page 64
Mims Circuit 28
The last circuit in the book
(Schematic 13) is a DC-DC
converter. It uses a 555 in its astable
configuration at about 2.9 kHz with a
low pulse width of about 7 µs. This is
very close to a 98% duty cycle.
In my experimenting with the
circuit, I found that I could not even
get close to Mr. Mims results using
the values and configuration in his
schematic. I had to make some
changes to get nearly the same
results.
I used a different transformer
which would have affected my
results. Refer to Schematic 14 for my
final 555 circuit.
The first problem I found with
the original circuit was that the 555
was getting quite hot. I believe this
was due to the very high duty cycle
64 July/August 2018
Cicchinelli - A Digital-Analog Final Part 5 - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:05 PM Page 65
PBP3
PICBASIC PRO™ Compiler
PBP3 Compiler
Prototyping Boards
Experimenter Boards
www.melabs.com
Contact us at info@melabs.com
July/August 2018 65
Titus - ASCII data from PS-2 Keyboards - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:12 PM Page 66
T
he PS-2 keyboard engineers assigned a respectively. A PS-2 keyboard does, however, transmit key
unique code to each key. So, for example, codes in a UART-type format: a start bit; eight data bits;
the W key produces 0x1D and the X key an odd-parity bit; and a stop bit (Figure 1). The least-
produces 0x22 (all values given in significant bit (LSB) of a key code gets shifted out first.
hexadecimal). These codes don’t directly You might think a UART could handle this serial
translate into ASCII values; 0x57 and 0x58, information, but keyboard clock frequencies can vary
FIGURE 1. A
PS-2 keyboard
transmits data
and clock
signals when I
press the W
key, which has
the assigned
code 0x1D
(MSB first).
66 July/August 2018
Titus - ASCII data from PS-2 Keyboards - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:12 PM Page 67
By Jonathan A. Titus
Use a System-
on-a-Chip (SoC)
For this project, I chose a
Cypress Semiconductor
CY8CKIT-059 5LP prototyping
kit (Figure 3) and the free
between 10 kHz and about 16 kHz, so a UART set for a Cypress PSoC™ Creator software you can download and
fixed bit rate might not work in all cases (Note 1). Many install on a host PC. Cypress sells the prototype kit for
MCUs include a serial-peripheral interface (SPI) port that $10. The board connects to a PC via a USB cable.
can operate as a slave device and receive serial data. In Print the documents, “PSoC 5LP Prototyping Kit
this mode, the keyboard can
supply the needed serial data
and clock signals. The MCU can
then process the information and
act accordingly.
FIGURE 3. A CY8CKIT-059 5LP prototyping kit. The four block stays active at all times.
contacts on the left mate with a female USB connector. Like many other PSoC components, the SPI port
These signals communicate data and programs between
the PSoC chip and your host PC. Photo courtesy of Cypress requires an internal synchronizing clock. I chose a clock
Semiconductor Corp. from the list of blocks and set it for a 1 MHz output. The
documents mentioned earlier explain how to start a
Guide” and Cypress AN77759 “Getting Started with PSoC project like this, configure blocks, assign physical I/O pins
5LP,” and use them to get off to a quick and easy start. to signals, and build a project with the PSoC Creator
(Directions are included with the article downloads.) software. (I connected the MOSI to a PSoC output pin,
A Cypress 5LP PSoC (Programmable System-on-a- but this project does not use it.)
Chip) device includes many “building blocks” for functions A rapid double-click on the SPI slave block opens the
such as SPI, USB, and UART ports; EEPROM; clocks; SPIS_1 Configure window shown in Figure 5. Here, you
analog-to-digital converters (ADC); pulse-width modulators select one of four modes, and as you examine each, the
(PWM); and so on. timing diagram changes to illustrate the signals for that
Unlike other MCUs, the 5LP devices only implement mode. I chose the clock-phase (CPHA = 1) and the clock
(or “connect”) the blocks you want. You select a function, polarity (CPOL = 1) that match the keyboard clock and
drag its block into the PSoC Creator schematic drawing data signal levels and edges shown earlier (refer back to
area, and set parameters. Figure 1).
In most cases, you don’t need to set bits in registers. The PSoC SPI block works with from three to as many
Each block has its own datasheet, and example programs as 16 bits. I chose 11 bits to match the number of bits
give you a head start. When you “build” a project, the transmitted by a keyboard. I also chose LSB first as the
PSoC creates the APIs for you. The documentation for shift direction for incoming data to match the keyboard’s
each block lists the APIs and explains their uses. data format. This setting simplifies software for keyboard
decoding.
Configure an SPI Port for 11 The Advanced section of this window (Figure 6) lets
me select an external clock: the 1 MHz clock shown in
Bits Figure 4. This clock signal is external to the SPI block and
Figure 4 shows an SPI slave port as I configured it. used only within the PSoC to synchronize processor and
The MOSI (master-out, slave-in) pin connects to the logic activities. I also chose an SPI buffer memory size for
keyboard’s data-output signal. The keyboard clock four 11-bit values, and no interrupts. Anyone familiar with
connects to the SPI serial-clock input (sclk). I connected peripheral setup in a typical MCU will appreciate the ease
the slave-select input (ss) internally to a logic 0, so the SPI of SPI setup.
That simplicity applies to other blocks, too.
You don’t search through lists of registers to find
a bit that enables a peripheral and then tinker
with other bits to get the behavior you want. The
PSoC Creator handles those details. The software
does the same things for a UART in this project.
The UART sends ASCII values to a terminal
emulator on my PC.
A separate window lets you assign the
signals to physical I/O pins. In this project, the
FIGURE 8. Don't
Table 1. Keyboard and PSoC Prototyping Kit Connections. let the list of PSoC
files and folders
Keyboard Signals PSoC Signals
intimidate you.
Name Connector Pin Name Signal Pin Name You'll only work
with the main.c
+5V In 4 VDD +5V Power J2_01 file unless you use
GND In 3 GND Ground J2_02 an SPI interrupt,
which would add
Clock Out 5 P3.1 GPIO J2_24 only one other file
for an ISR.
Keyboard Data Out 1 P3.0 GPIO J2_25
July/August 2018 69
Titus - ASCII data from PS-2 Keyboards - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:12 PM Page 70
Every Key has Its Code lock). Please refer to Figure 9 as I explain the software
operations. Suppose I press the letter G. The “Get Key
Because every key has a unique code, you might try Code” software section converts the 11-bit keyboard
to use that code as an index into an array of ASCII values; information into the eight-bit keyboard code
basically, a lookup table. That’s a good idea. You could (Keyboard_Data in the software). This keyboard value
create the array ASCII_Equivalent[ ] in which to store the equals the G key code, 0x34.
ASCII values. Then, the W key code 0x1D, for example, The next software section tests the value to determine
would direct software to array element if it equals the key-release code, 0xF0, or either shift key
ASCII_Equivalent[0x1D] that would hold the W key’s ASCII code, 0x12 or 0x59. In this case, the G key value matches
code. So, do we save the value for an uppercase or none of these three conditions. So, the program continues
lowercase W in the array? It depends. The software must and the value from some previously pressed key goes into
monitor codes from the two shift keys (one on the left and variable Old_Data; the G key value, 0x34, gets put into
one on the right of the keyboard) and decide which ASCII the New_Data variable.
value to retrieve. So, we create two arrays — LC_Array[ ] This process lets the software later determine if the
and UC_Array[ ] — for lowercase and uppercase ASCII key just released has the same code as the key pressed
values. earlier. It’s simply a way to detect an error, such as
Table 2 shows part of the information for each array. pressing two keys at once. More about this shortly.
The downloads for this article include the complete table, Next, the software tests the KeyRelease_flag, but
and the PSoC software includes both arrays and all PSoC because I haven’t released the G key this flag is false.
files. Gray rows in the table indicate an unused code or Then, based on the state of the Shift_ flag, the MCU
no value assigned for a key such as F1 or F2. decides whether to fetch the ASCII value for the
uppercase UC_Array[ ] or from the lowercase LC_Array[ ]. I
A Flowchart Maps Our Way haven’t touched a shift key, so the Shift_flag is false, and
the software gets the lowercase g ASCII value 0x67. The
The translation of key codes into ASCII values gets software then goes back to await arrival of a new key
more involved as shown in the software flowchart (Figure code. (In my software, the ASCII value goes to my host PC
9). This code runs in an infinite loop, but you could use it and the terminal displays “g.”)
as the basis for an interrupt-service routine (ISR). That When I release the G key, the software must
approach goes beyond the scope of this article. recognize the key release code and then ignore the key
The keyboard software has three main tasks. First, it code that closely follows (refer back to Figure 2). Without
waits for the SPI buffer memory to become “not empty,” this test, the software would sense two key codes from the
which signals new information has arrived in the SPI port. pressed and released key, and a terminal would display
Second, the software must properly detect the shift key’s “gg.” Here’s how the software avoids the “double g”
condition to choose an uppercase or lowercase ASCII problem.
value. Third, it must handle the key release code and the
key code that follows it to ensure we don’t get duplicate
characters when we release a key.
Detect a Key Release
The software uses two true-false flags: KeyRelease_flag, When I release the G key, the keyboard transmits the
which when true indicates the software has detected the key release code, 0xF0, which the software detects and
0xF0 key release code; and Shift_flag that gets set to true then sets the KeyRelease_flag to true. Next, the program
when the software senses a pressed shift key (but not caps goes back to wait for another value from the SPI port. In
this key release
Table 2. A portion of the lowercase and uppercase information for PS-2 keyboard-to-ASCII example, the
conversions. The keyboard does not assign codes 0x17 through 0x19 to any keys.
PS-2 Keyboard Scan Code Lower-Case Characters Upper-Case Characters
Note 1. A person
Decimal Hex LC Keyboard Char LC ASCII Value UC Keyboard Char UC ASCII Value in a support group
20 14 c 63 C 43 reported using a
UART with a
21 15 q 71 Q 51 12,000 bits per
22 16 1 31 ! 21 second (bps) clock.
23 17 0 0 Worth a try, but an
SPI port can better
24 18 0 0 handle clock
25 19 0 0 frequency changes
from keyboard to
26 1A z 7A Z 5A keyboard. My PS-2
27 1B s 73 S 53 keyboard produced
a clock signal
28 1C a 61 A 41
equivalent to
29 1D w 77 W 57 13,700 bits/sec.
70 July/August 2018
Titus - ASCII data from PS-2 Keyboards - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:12 PM Page 71
Shift Happens
The two shift keys operate the
same way as other keys. Each sends its
code when pressed and sends the key
release code and its shift key code
again when released. The flowchart in
Figure 9 shows how the shift key
affects the choice of ASCII value.
When I press the left shift key, the
software receives 0x12 and tests it for a
match with the key release code (no
match) and the code for each shift key.
The software detects a match with one
of the two shift key codes and branches
to test the KeyRelease_flag. If this flag is
false, the software sets the Shift_flag
and goes back to get the next code
from the SPI port.
As long as I press the shift key, the
Shift_flag remains set and the software
selects ASCII values from the uppercase
UC_ASCII array. When I release the FIGURE 9. Flowchart for the PS-2 keyboard code
shift key, it produces the key release code (0xF0) and that converter that produces corresponding ASCII
condition causes the software to set the KeyRelease_flag. values for shifted and unshifted keys.
July/August 2018 71
Ford - Magnetic Loop Antennas - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:23 PM Page 72
Antenna, tripod
without 40M fixed
capacitor.
72 July/August 2018
Ford - Magnetic Loop Antennas - Jul-Aug 18_Blank Rough NV.qxd 6/12/2018 5:23 PM Page 73
Magnetic loop antennas are becoming even more popular these days
because they can be very efficient for their size, do not need radials
(even though most designs are vertically polarized), have useful takeoff
angles, and can be easily rotated to peak or null a signal. The cost of
this is small bandwidth, high voltage capacitors, and the necessity to
keep resistance losses very low.
y loop design presented here eliminates the use torch to get the extra heat works great. Fortunately, the
Post comments on this article and find any associated files and/or downloads at
www.nutsvolts.com/magazine/issue/2018/07.
Tripod overview.
Correspondence in May 2017 in part: aware user, and 2.1 meters (6.9 feet) for the general
public.”
“Additionally, for a one meter diameter loop operating Others have suggested even more distance (Notes 1,
at a continuous 10W, including ground reflection, 2, 3, and 4) certainly with 100W.
compliance distances are nearly constant over the 40-10
meter bands at less than 1.5 meters (4.9 feet) for the Have fun and be safe! NV
76 July/August 2018
NV New Products - Jul-Aug 18_Mar15 -NV - NewProducts.qxd 6/12/2018 5:50 PM Page 77
PLUG-IN
CONNECTORS
W ürth Elektronik eiSos introduces
its new “REDFIT IDC SKEDD
WR-WST connectors” product family:
solderless, space-saving, and multi-
pluggable connectors for signal
transmission.
The electronics and
electromechanical components
manufacturer is using the patented
SKEDD technology from its sister
July/August 2018 77
THE DESIGN CYCLE n BY FRED EADY
P
I/
ICBASIC PRO version 3.1 is a very powerful programming tool. A quick outside view n
p
of the PICBASIC PRO command structure may lead one to believe that its programs can P
only consist of the calls listed in the User Guide. Not so! In fact, PICBASIC PRO logic is w
w
much like C language logic. With a few out-of-the-box programming techniques, just about re
lo
any C source file can be converted to PICBASIC PRO source.
S
LCD
Now, we can set the WCOL bit within our PICBASIC
If you consult the Explorer 8 User’s Guide, you will PRO code like this:
find that the board’s LCD is driven by an MCP23S17
I/O expander. The MCP23S17 speaks SPI. There are no WCOL = 1
native PICBASIC PRO SPI functions. So, our first task is to
port the SPI driver contained in the development board’s The MCP23S17 is not required to return any data to
n PIC16F1719 example code package. the host PIC microcontroller using the SPI portal as it is
Let’s start our port with code that defines the bits only attached to the LCD. So, our SPI communications will
within the SPI engine’s register stack. We will be coding only have to flow from the host PIC to the MCP23S17.
with bits found within the SSP1STAT and SSP1CON1 Here is the basic SPI communications code the MPLAB
registers. The C source to set the SSP1CON1 WCOL bit Code Configurator generated:
looks like this:
uint8_t SPI_Exchange8bit(uint8_t data)
SSP1CON1bits.WCOL = 1; {
// Clear the Write Collision flag, to allow
Setting the WCOL bit in PICBASIC PRO looks like this: writing
SSP1CON1bits.WCOL = 0;
SSP1CON1.7 = 1 SSPBUF = data;
while(SSP1STATbits.BF == SPI_RX_IN_PROGRESS)
As you can see, the C source tends to self-document {
itself, while the identical operation in PICBASIC PRO is a }
bit cryptic. To make our ported PICBASIC PRO code more return (SSPBUF);
readable, we will plant some aliases on the bits within the }
SSP1STAT and SSP1CON1 registers:
The C implementation of the SPI_Exchange8bit
;*********************************************;* function simply clears the WCOL collision bit, stuffs the
PIR1 BITS data we want to send into the SSPBUF, and waits for the
e ;********************************************* SSPBUF to fill with incoming data from the slave device.
SSP1IF VAR PIR1.3 The incoming data is returned to the caller.
;************************************************ In our case, the slave device is the MCP23S17 and
;* SSP1STAT BITS no real data is clocked in as the MCP23S17’s SPI output
;************************************************ pin is not connected. Our PICBASIC PRO port of the SPI_
SMP VAR SSP1STAT.7
;SAMPLE BIT Exchange8bit function takes this form:
CKE VAR SSP1STAT.6
;SPI CLOCK SELECT BIT
P VAR SSP1STAT.4
;STOP STATUS BIT I2C ONLY ;************************************************
S VAR SSP1STAT.3
;START STATUS BIT I2C ONLY ;* GLOBAL VARIABLES
m RW VAR SSP1STAT.2
;TRANSMIT STATUS BIT I2C ;************************************************
p ONLY dataOut VAR BYTE
BF VAR SSP1STAT.0
;BUFFER FULL/EMPTY STATUS dataReturned VAR BYTE
BIT ;************************************************
;************************************************ ;* SSP1BUF/SPI CONSTANTS
;* SSP1CON1 BITS ;************************************************
;************************************************ EMPTY CON 0
WCOL VAR SSP1CON1.7
;COLLISION BIT FULL CON 1
SSPEN VAR SSP1CON1.5
;SPI ENABLE BIT SPI_RX_IN_PROGRESS CON 0
CKP VAR SSP1CON1.4 ;CLOCK NULL CON 0
POLARITY BIT ;************************************************
SSPM3 VAR SSP1CON1.3
;MODE SELECT BIT ;* SPI Exchange8bit
SSPM2 VAR SSP1CON1.2
;MODE SELECT BIT ;************************************************
SSPM1 VAR SSP1CON1.1
;MODE SELECT BIT SPI_Exchange8bit:
SSPM0 VAR SSP1CON1.0
;MODE SELECT BIT WCOL = 0
July/August 2018 79
;************************************************ ;************************************************
;* IO EXPANDER CONSTANTS ;* GLOBAL VARIABLES w
80 July/August 2018
* The fourth and final LCD function simply clears the #pragma config CP = OFF // Flash Program Memory
display and positions the cursor at the home position: Code Protection->Program memory code protection
is disabled
* void LCD_Clear(void) { #pragma config BOREN = ON // Brown-out Reset
LCD_WriteCommand(LCD_CLEAR); Enable->Brown-out Reset enabled
* LCD_GoTo(0, 0); #pragma config CLKOUTEN = OFF // Clock Out
} Enable->CLKOUT function is disabled. I/O or
oscillator function on the CLKOUT pin
The PICBASIC PRO port is almost not a port at all as
it consists of functions we have already ported. There is no // CONFIG2
need to preload the cmd, row, and col variables: #pragma config WRT = OFF // Flash Memory Self-
Write Protection->Write protection off
;************************************************ #pragma config PPS1WAY = ON // Peripheral Pin
;* LCD_Clear Select one-way control->The PPSLOCK bit cannot be
;************************************************ cleared once it is set by software
e cmd = LCD_CLEAR #pragma config ZCDDIS = ON // Zero-cross detect
call LCD_WriteCommand disable->Zero-cross detect circuit is disabled at
row = 0 POR
col = 0 #pragma config PLLEN = OFF // Phase Lock Loop
call LCD_Goto enable->4x PLL is enabled when software sets the
return SPLLEN bit
#pragma config STVREN = ON // Stack Overflow/
Underflow Reset Enable->Stack Overflow or Underflow
Almost There will cause a Reset
The SPI and LCD port are finished. However, we need #pragma config BORV = LO // Brown-out Reset
to take care of some other necessities before we can apply Voltage Selection->Brown-out Reset Voltage
our ported code. I relied on the configuration fuse settings (Vbor), low trip point selected.
that PICBASIC PRO set for the PIC16LF1708 with only a #pragma config LPBOR = OFF // Low-Power Brown
couple of exceptions. I turned off the watchdog timer and Out Reset->Low-Power BOR is disabled
the power-up timer: #pragma config LVP = OFF // Low-Voltage
Programming Enable->High-voltage on MCLR/VPP must
* #CONFIG be used for programming
__config _CONFIG1, _FOSC_INTOSC & _WDTE_OFF
* & _PWRTE_OFF & _MCLRE_ON & _CP_OFF & _BOREN_ON & If you don’t have any special requirements, it’s much
_CLKOUTEN_OFF easier to use the PICBASIC PRO-supplied configuration
__config _CONFIG2, _WRT_OFF & _PPS1WAY_OFF & fuse data. The Code Configurator can also be used to
_ZCDDIS_ON & _PLLEN_OFF & _STVREN_ON & _BORV_LO & generate the system oscillator and watchdog configuration
* _LPBOR_OFF & _LVP_OFF values, which are directly portable. You need only replace
#ENDCONFIG the C hexadecimal notation “0x” with the PICBASIC PRO
* hexadecimal notation “$:”
You can also use the Code Configurator to generate
the configuration fuse settings. It will generate this: ;************************************************
;* INITIALIZE OSCILLATOR
// CONFIG1 ;************************************************
#pragma config FOSC = INTOSC // Oscillator OSCCON = $72 ;SCS INTOSC; SPLLEN disabled;
Selection Bits->INTOSC oscillator: I/O function IRCF 8MHz_HF;
on CLKIN pin OSCSTAT = $00 ;SOSCR disabled;
#pragma config WDTE = OFF // Watchdog Timer OSCTUNE = $00 ;TUN 0;
Enable->WDT disabled BORCON = $00 ;SBOREN disabled; BORFS disabled;
#pragma config PWRTE = OFF // Power-up Timer ;************************************************
Enable->PWRT disabled ;* INITIALIZE WATCHDOG TIMER
#pragma config MCLRE = ON // MCLR Pin Function ;************************************************
Select->MCLR/VPP pin function is MCLR WDTCON = $16 ;WDTPS 1:65536; SWDTEN OFF
July/August 2018 83
;************************************
************
;* GLOBAL VARIABLES
;************************************
************
lcdBuf
VAR BYTE[17]
;************************************
************
;* MAIN PROGRAM LOOP
;************************************
************
call SPI_Initialize
call LCD_Initialize
ARRAYWRITE lcdBuf,[“ DESIGN CYCLE”,0]
call LCD_WriteString
row = 1
col = 0
call LCD_GoTo
n PHOTO 2. It works. You didn’t have any doubts, did you? ARRAYWRITE lcdBuf,[“ PICBASIC
PRO”,0]
call LCD_WriteString
PICBASIC PRO has no built-in provisions for PPS DO
(Peripheral Pin Select). However, PPS is a walk in the park LOOP
to set up for the PIC16LF1708. We must assign I/O pins
to the PIC’s SPI portal. The Explorer 8 board schematic The zero behind the ASCII strings in the ARRAYWRITE
tells us that the PIC’s SDO pin is expected to be assigned lines of code produce a zero-terminated string, which
to RC5 and the SCK pin should be assigned to RC3. The our LCD_WriteString function is looking for as an ending
PIC16LF1708 datasheet tells us that loading registers character.
RC5PPS and RC3PPS with binary 10010 and 1000, I will leave you with Photo 2 and the full download of
respectively, will accomplish our SPI pin assignment task: the PICBASIC PRO source code for this article. You can
now add the Explorer 8 development board and the skill of
;************************************************ porting C to PICBASIC PRO to your Design Cycle. NV
;* INITIALIZE I/O
;************************************************
TRISA = %11111011
TRISB = %11110001
TRISC = %10010111 Explorer 8 Development
RC5PPS = $12 ;SDO Board
RC3PPS = $10 ;SCK
XC8 C Compiler
The TRISx values were copied from the development MPLAB X
board PIC16F1719 example code. The port being changed Microchip
is the C binary notation “0b” to the PICBASIC PRO binary
notation “%.” www.microchip.com
PICBASIC PRO 3
Smoke Test ME Labs
Well, it all compiles. However, that doesn’t mean it will www.melabs.com
work. So, the plan is to initialize the SPI portal and LCD.
84 July/August 2018
W e are clearly blessed with so many good wireless services. We’re all addicted to
our 4G LTE smartphones for text, email, and even voice. And now, 5G is in the
works. Bluetooth wireless is everywhere in our hands-free auto audio, Bluetooth
speakers, and headphones, and dozens of other products. On top of that, our go-to
wireless is Wi-Fi. Our first question when we visit someone or set up in a new environment
is “what is the Wi-Fi password?” We take it for granted as we do electrical power service.
We only miss it when it goes away.
86 July/August 2018
These are 1024QAM modulation that will help deliver while before you see a critical mass of 11ax.
speeds up to 7 GB/s for a single user and multi-user MIMO Always go for the latest standard but relax knowing
that uses beamforming to target specific users. MU-MIMO that all these devices are backward-compatible to retain
is expected to boost data rates on crowded networks by a interoperability with older 11n and even 11g in some
factor up to four. Table 1 summarizes the three main Wi-Fi cases.
standards.
Routers are also available. Examples are those from
D-Link such as the AX6000 and AX11000 that work in the
Wi-Fi Issues
5 GHz band. Under the right conditions, they can produce Perhaps the biggest issue is the growing potential for
link speeds of 6 Gb/s or 11 Gb/s, respectively, using 4x4 interference. Wi-Fi does use the unlicensed 2.4 GHz and
MIMO. 5 GHz bands that are loaded with lots of other radios.
Figure 2 shows a front-end module (FEM) from The 2.4 GHz band is already shared with Bluetooth,
t Ethertronics that operates in the 5 GHz band. It includes ZigBee, 802.15.4 ISM band radios, and cordless phones.
d Ethertronics active antenna steering technology along with Furthermore, the allocated Wi-Fi bands are limited so there
a +18.5 dBm power amplifier that works with both 11ac is some contention for the channels that occurs in areas
e and 11ax in 80 and 160 MHz channels. where multiple Wi-Fi access points are closely adjacent.
ds Don’t forget! To receive the benefits of any of these On top of that, the growing adoption of the Internet
newer standards like 11ac and ax, you must have the same of Things (IoT) using Wi-Fi will potentially put thousands --
technologies on both ends of the link. To get full 11ac even millions -- of more devices in the same spectrum that
benefits, the router or AP must meet the standard as well will surely lead to even more interference.
as your laptop, iPad, or smartphone. Most of the newer Another issue that has risen over the years is more
phones and laptops incorporate 11ac. However, it will be a users per access point. Each AP can handle multiple
connections at a time, but it slows the data rate for each.
The newer standards have addressed this capacity problem
by using MIMO and boosting speed.
Another forthcoming problem is running out of
spectrum. Wi-Fi has only been allotted a certain amount
of space in the 2.4 and 5 GHz bands. With the new 11ac
and 11ax standards using ever wider channels (up to
160 MHz), the spectrum is used up quickly and capacity
limited. More spectrum is needed if the quest for ever
higher speeds continues.
One possibility is the 3.5 GHz band that may offer
some additional space. More of the 5 GHz band would
be ideal, but many others are seeking space in that band
as well. No one seems to know now where the extra
spectrum will be or when.
In case you didn’t know, the cellular carriers are all
using a part of the Wi-Fi 5 GHz spectrum for offloading
Figure 2. The Ethertronics EC714 front-end module some high speed data streams. Two technologies are used:
(FEM) operates in the 5 GHz band and is designed to be
one is called LTE Licensed Assisted Access (LAA), and
incorporated into 11ax and 11ac equipment.
LTE-U for unlicensed. When the cellular network is at its
July/August 2018 87
peak in activity, it may not be able to deliver high speed Using 1, 2, 4, 8, or 16 MHz channels, it can achieve data
streaming to a customer. So, the cellular operator offloads rates up to about 100 kb/s. Speed is not usually needed
the data streaming to their Wi-Fi network. That works, but in most IoT uses, so it’s not a problem. The propagation
eats up spectrum that could otherwise be used by other capability in the 902-928 MHz band is excellent and
services. under good conditions like high antennas, range can be a
kilometer or more.
What’s Next? Neither 11af or 11ah have been widely adopted. Most
IoT applications today are the slower Wi-Fi standards,
The real question is where does Wi-Fi go from here? Bluetooth, ZigBee, Z-Wave, or some variation of the
Up to now, the IEEE 802.11 standard group has focused 802.15.4 standard like Thread. All of these with the
mainly on incremental boosts in data rate and capacity. At exception of the Z-Wave operate in the already crowded
this point, more speed may not be necessary. 2.4 GHz band.
For example, an upgrade of the 11ad 60 GHz standard Another emerging wireless technology is Li-Fi or Light
designated 11ay is in the works. It offers a channel Fidelity. It uses visible light as the data carrier. White LEDs
bandwidth of 8 GHz and a 4x4 MIMO configuration that illuminate spaces and are modulated by the data. High
can generate a max speed of up to 20 Gb/s. Do we need data rate downloads are easily accommodated. The range
it? is limited because of the direct line of sight (LOS) path light
Also consider that Wi-Fi has multiple offshoots that takes, but it could be useful in some office or industrial
have not been based on the speed/capacity upgrade settings as it is very secure. Li-Fi is not officially part of the
path. For example, a modified version of 802.11a called Wi-Fi family, but who knows what will happen?
802.11p has been proposed for vehicle-to-vehicle (V2V) Finally, the big question is how does the new fifth
communications systems that are planned to enhance the generation (5G) wireless network impact Wi-Fi? 5G
advanced driver assistance systems (ADAS) that are now will deliver Wi-Fi like speeds to homes and businesses.
being installed in most new cars. V2V allows cars to talk Theoretically, it should complement Wi-Fi but it may also
to one another so as to share location, speed, direction, replace Wi-Fi in some applications. We shall see. NV
stopped, or turning condition, and other data that can help If you want to dig into Wi-Fi in more detail, you can
avoid collisions.
start at these websites:
Then, there are the 802.11af and 802.11ah standards.
Both use a version of the Wi-Fi protocols but in different
frequency bands. Both target IoT applications. For
example, the 11af version uses the available “white space.”
White space is the empty 6 MHz wide VHF and UHF TV
channels commonly available in most areas. These lower Wi-Fi Alliance
frequencies in the 54 to 698 MHz range permit longer www.wi-fi.org
range communications of many kilometers. Traditional Wi-
Fi range is typically only up to about 100 meters. IEEE Working Group 802
As mentioned, the 11ah standard also targets IoT uses. www.eee802.org
It’s designed to use the 902-928 MHz ISM band in the US.
88 July/August 2018
July/August 2018 89
TECHFORUM READER - TO - READER
>>> QUESTIONS build that would be useful? Also, what Take your time in cleaning and
is the theory of how such a detector pasting — the leaked corrosion so
Smooth LEDs? would work? tends to be very tenacious, etc., and re
What makes some LED #7184 Denzel Meier sometimes difficult to remove. Be lo
replacement bulbs dimmable, Winnsboro, SC aware that you’ll use lots of Q-tips as Th
while others are not? Some of the you’ll want fresh ones when they get re
replacements I have purchased do not PCBs With PTHs dirty and ratty. re
dim very smoothly. They seem to dim Is there a hobbyist method for Ken Simmons dr
in steps and then just turn off before making circuit boards with plated Auburn, MI no
lowering to where I need them to be. through holes at home? Also curious
The previous incandesants dimmed by what is meant by multilayer #2 Baking soda is a good acid yo
much more smoothly down to a soft boards. I'm just getting started, so neutralizer. It will stop further lu
glow. Is there a different, (maybe forgive if this is an obvious newbie damage, but does nothing to restore ba
more expensive) type/technology question. damage done. The oxide already
that would more closely emulate Leonelo Márquez deposited will need to be removed
the incandesants? I'm using an X10 #7185 Maplewood, MN with a scraping tool of some kind, and
controller for the dimming, could this will, without doubt, reveal damage.
>>> ANSWERS
[#
be the problem? Bill van Dijk P
#7181 Everett Barham Canada
Elvaston, IL [#2184 - February 2018] ke
Neutralizing Battery Corrosion #3 If the watch is really expensive, I de
TV Image Capture What’s the best way to neutralize would bring it to a watch maker shop a
What’s the best way to capture battery corrosion? I inherited an old, and pay for the cleaning. At home, a
images from my TV? I’m looking to but expensive quartz watch from for my electronics, I use dish washing th
do something like a computer “print my grandfather and found a heavily liquid — pour a few drops onto the
screen.” corroded coin battery inside the corrosion and let it soak overnight.
#7182 Sharon Fitzgerald watch case. I need to neutralize the This usually dissolves the acidic ke
Chattanooga,TN corrosion without damaging the corrosion. You can still clean with a th
movement. Q-tip, then rinse and carefully dry the
Phone Line Intercom watch.
We use our cell phones as our #1 First, use a Q-tip and 90%+ Werner
main phone service, so our “land isopropyl alcohol to clean the via Internet
line” is no longer being used. Is there corrosion — do NOT immerse
a way to use the house phone wiring or flood the watch with alcohol! #4 Sorry, but I suspect this is going
along with the old phones as a whole When you’re done with this step, to be difficult to impossible. I have
house intercom system? I have a CAREFULLY use canned air to used white vinegar to neutralize and
detached garage/workshop away GENTLY dry the cleaned area. remove the deposits and corrosion
from the house where this would Then, apply a paste made from but:
be especially useful, not to mention baking soda and water to the cleaned 1. The corrosion/battery acid and
almost every room is wired. Would I areas and let it sit for 20-30 min. The possibly the addition of the vinegar
need to disconnect from the phone baking soda will stop any corrosive acid end up removing the coatings on
company "grid" to do this? action by any corrosion not removed metal parts which makes them less
#7183 Jay Bousquet by the first alcohol cleaning. robust.
Lexington, NC Finally, use a dry Q-tip to remove 2. A watch has extremely small
as much of the baking soda paste parts and the connections may be
Show Me The Power as possible, then finish cleaning any ruined already. You need to first take
When renovating houses residue with Q-tips and alcohol. Use the watch completely apart to see
as a hobby, I need to locate the canned air to dry the cleaned area the extent of the damage inside it. If
powerlines inside the walls and also and ensure you don’t get any of the the damage is confined to the battery
underground. What curcuit can I paste blown into the watch. port, you may be in luck.
90 July/August 2018
Use a Q-tip cotton swab with bits, or two eight-bit values in rapid you press the “A” key, for example,
some vinegar on it; place it on the succession. Not all microcontrollers the keyboard’s circuit produces the
residue/corrosion and keep it there can. (If you lack a good SPI port, hex code 1C. When you release the
long enough to soak into the residue. emulate it in software.) Use the MOSI A key, the keyboard transmits a key-
Then, twist the swab to remove the signal for the key-code transmissions release code F0, followed by the key’s
residue. If more removal is needed, and use the SCLK signal to emulate code again.
repeat this process. You can also use the keyboard’s clock output. The bits The shift key works the same
ns dry swabs to remove more residue if transmitted when you press a key way. To send an uppercase A your
MI no more vinegar is needed. look much like those put out by a microcontroller or processor board
Once all the residue is removed, standard UART: a start bit; eight data would send the SHIFT key code,
you should use a contact cleaner/ bits; an odd parity bit; and a stop bit. the A key code (then a short delay),
lubricator/protector fluid to coat the The keyboard’s clock output followed by the key release code and
battery contacts. produces a logic 1 in its idle state and the A key code again. Then, it would
Phil Karras creates a positive edge for each of send the key release code followed
via email the 11 bits. An SPI port configured by the shift key code.
d as CPOL=1, CPHA=1, provides Remember, your code must
[#5181 - May/June 2018] the proper timing. Note: The least- calculate an odd-parity bit and insert
k PS2 Emulation significant bit of an eight-bit key value it in the 11-bit value to send. You can
a My Sony CD changer has a PS2 gets sent first. My old PS-2 keyboard find parity generator code on the
keyboard port to enter the CD title, produces clock signals at 13.7 kHz. Internet. Also, ensure you send the
I details, etc. Instead of typing, is there That’s a good frequency to start with key and release values in bit-reversed
p a way to emulate a PS2 interface on for the SPI port. form. Thus, the 1C code (0001 1100)
a PC or processor board to automate A PS-2 keyboard assigns a for A must get transmitted as 0011
g the key presses? unique non-ASCII code to every 1000. You can simply set up your
key. Find a list of the keys and code so it uses the “reverse-bit”
Yes, you can emulate a PS-2 assigned codes here: https:// values to start with.
keyboard. An SPI master port will do techdocs.altium.com/display/FPGA/ Jon Titus
the job as long as it can handle 11 PS2+Keyboard+Scan+Codes. When Herriman, UT
e
er
et
July/August 2018 91
T accustomed to using the PICAXE and BASIC Stamp). After a month, I’ve written
complete flight code and even designed a camera system for the Pi. So, this month,
I’ll fill you in on how I got the Raspberry Pi flight computer to where I can start planning to
build an airframe. Next stop, near space!
Nearly Flight Ready The PICAXE uses the BASIC code shown next to
digitize sensor voltages with 10 bits of resolution and to w
I’ve finally incorporated the following items into the store the results into the shared EEPROM. Note that pin
RaspPi Zero flight computer: a Geiger counter to measure C.3 connects the Pi to the PICAXE and is used to signal the a
cosmic rays; a weather station to measure air temperature, PICAXE to stop updating the EEPROM while the Pi reads its
pressure, and relative humidity; a GPS to measure time, 3D stored data.
location, speed, and heading; and a digital camera. That’s e
everything I need for a really neat near space mission. Plus, i2cslave %10100000,i2cfast,i2cword ‘ memory R
plenty of room remains on the flight computer for the speed: 400 kHz, 1 word records ge
additional experiments that I’ll dream up later. pause 1000
th
ADC:
Geiger Counter and Weather Data if pinC.3 = 0 then goto ADC ‘ wait until
to
th
The PICAXE on board the RaspPi flight computer RPi is not reading EEPROM re
collects sensor data using its built-in ADC (analog-to-digital readadc10 C.0,W0 ‘ digitize
converter). Afterwards, it stores that data into the shared voltage (repeat 3 times) ev
EEPROM for the Pi to read when it’s ready. count C.2,5000,W3 ‘ count geiger P
92 July/August 2018
b0 = bus.read_byte(address)
# get the byte of data and
increment the address
:
:
b7 = bus.read_byte(address)
# get the next byte of data &
increment address
The Raspberry Pi runs hotter than the rest of the flight computer PCB (printed circuit board) or
PICAXE. Based on a recommendation of one of my near space friends, Mark N9XTN, I took a thermal
image of the powered-up flight computer (Figure A).
seconds before reading another GPS sentence. As a result, executed once since there’s only one GPGGA sentence to
I programmed it to read the GPS every second and then store.
throw away four sequential sentences.
text = textcount+”,” # append a comma to
the end of the string
Storing Data text = text+textd0 # append the first
Analog sensor data is binary by its nature, but the GPS data to the record count
data is ASCII text. These data types must be converted into text = text+GPSSentence # append the GPGGA
the same format before they can be combined together sentence to the data to store
and stored in the SD card. Since I’ll use Excel to analyze
the data, I choose to convert all the data into ASCII. First, After creating the string of data that the Pi collected,
however, both bytes from the analog-to-digital conversion it’s time to write the text to the file stored on the SD card.
must be combined into a word before it can be converted The Python commands to open the file, append the new
into ASCII text (a string variable). The commands to do this data, and close the file look like this:
are:
file = open(Logfile,”a+”) # open the log file
d0 = (b1*256)+b0 # combine the two and append data
bytes to make a word of data file.write(text) # write the data into
textd0 = str(d0) # convert binary the log file
data into text file.close() # close the log file
After converting each analog voltage into text, it’s It’s taken me a good month to get to this point. I
1
time to concatenate them together along with the GPS think it’s worth it, however, even if just for the learning F
d
sentence. The commands to do that are shown next. Note opportunity. Next time, I’ll talk about the camera that I a
that the first line of code adds a comma to the string so found for the Raspberry Pi and how I plan to integrate it a
that Excel knows where to divide the text data into its into the flight computer.
proper fields (I store the flight computer’s data as a comma With any luck, my RaspPi flight computer will be taking
delimited file). a trip into near space this summer.
The second command gets repeated four times (once Onwards and Upwards,
for each analog measurement). The last line of code is Your Near Space Guide NV
94 July/August 2018
ELECTRONET
For the ElectroNet online, go to
www.nutsvolts.com
click Electro-Net
USBUSB-FIFO
Add USB to your next project--
It's easier than you might think!
USB-UART USB/Microcontroller Boards
RFID Readers Design/Manufacturing Services Available
Absolutely NO driver software development required!
www.dlpdesign.com
LIGHTING HARDWARE
WANTED
ADvertiser INDEX
■L O O K F O R ■S E A R C H F O R ■F I N D Find your favorite advertisers here! Accutrace .................................99
All Electronics Corp. ................43
ACTUATORS DEVELOPMENT Hitec Commercial Solutions
Hitec Commercial Solutions PLATFORMS/TOOLS Pololu Electronix Express ...................33
Technologic Systems SDP/SI
AUDIO/VIDEO ServoCity ExpressPCB ............................27
Zeppelin Design Labs EDUCATION Front Panel Express ................57
ME Labs SERVICES
BATTERIES/CHARGERS PoLabs Octopart Hammond Manufacturing ........76
Hitec Commercial Solutions
EMBEDDED SYSTEMS TEST EQUIPMENT Hitec Commercial Solutions ......2
BUYING ELECTRONIC Saelig Co. Inc. Electronix Express
SURPLUS Technologic Systems PoLabs Labcenter Electronics ................3
Saelig Co., Inc.
All Electronics Corp. SequimTek
ENCLOSURES Measurement Computing ......100
CIRCUIT BOARDS Front Panel Express
Hammond Manufacturing TOOLS ME Labs ..................................65
Accutrace PanaVise
ExpressPCB PoLabs Octopart .....................................7
PCB Fab Express KITS
Saelig Co., Inc. Zeppelin Design Labs PanaVise .................................40
TRANSFORMERS
Hammond Manufacturing
COMPONENTS LCDs/DISPLAYS PCB Fab Express ....................64
All Electronics Corp. Saelig Co., Inc.
Electronix Express WIRE, CABLE AND Pico Technology ......................21
Octopart MICROCONTROLLERS / CONNECTORS
Saelig Co., Inc. I/O BOARDS All Electronics Corp. PoLabs ....................................27
ME Labs Pololu .......................................41
DATA LOGGING Technologic Systems WIRELESS PRODUCTS
Measurement Computing Technologic Systems
Saelig Co., Inc. ........................15
Pico Technology MISC./SURPLUS
All Electronics Corp. SDP/SI .....................................77
DESIGN/ENGINEERING/
REPAIR SERVICES MOTORS / MOTOR SequimTek .................................7
Accutrace CONTROL
ExpressPCB ServoCity .................................98
Hitec Commercial Solutions
DESIGN SOFTWARE Technologic Systems ...............56
Labcenter Electronics ROBOTICS
Electronix Express Zeppelin Design Labs ..............23
July/August 2018 95
NV Webstore - Jul-Aug 18_NV Webstore June 2016 working.qxd 6/12/2018 8:31 PM Page 96
Hacking Electronics: Learning Programming the Raspberry Pi, Beginner's Guide to Reading
Electronics with Arduino and Second Edition: Getting Started Schematics, 3E
Raspberry Pi, Second Edition with Python by Stan Gibilisco
by Simon Monk by Simon Monk
Navigate the roadmaps
Up-to-date hacks that An updated guide of simple electronic
will breathe life into to programming circuits and complex
your Arduino and your own RaspPi systems with help from
RaspPi creations! projects an experienced
This intuitive DIY engineer. With all-new
Learn to create inventive art and demo circuits
guide shows how to programs and fun games
wire, disassemble, you can build, this
on your powerful hands-on, illustrated
tweak, and re- Raspberry Pi with no
purpose household guide explains how to
programming experience understand and create
devices and required. This practical
integrate them with your RaspPi and high-precision
book has been revised to fully cover the electronics diagrams.
Arduino inventions. You’ll discover how to new Raspberry Pi 2, including upgrades to
build an Internet-controlled hacked electric Find out how to
the Raspbian operating system. DIY identify parts and connections, decipher
toy, ultrasonic rangefinder, remote- projects include a hangman game, RGB
controlled robotic rover, audio amp, slot element ratings, and apply diagram-based
LED controller, digital clock, and information in your own projects.
car brakes and headlights — even a smart RasPiRobot with an ultrasonic rangefinder.
card reader!
$30.00 $15.00 $25.00
96 July/August 2018
NV Webstore - Jul-Aug 18_NV Webstore June 2016 working.qxd 6/12/2018 8:32 PM Page 97
CD-ROM SPECIAL
EDUCATIONAL
July/August 2018 97
EXTREME
S E R V O G E A R B O X E S
BUILT FOR
A P P L I C A T I O N S
FEATURES...
32P GEARS: MULTIPLIES THE TORQUE BY UP TO 7x
AVAILABLE AT SERVOCITY.COM
sales@servocity.com • 620-221-0123
(408)748-9600
ITAR I SO 9001:2008 UL Approved
1 YEAR
www.mccdaq.com/ULforLinux
Contact us
1.800.234.4232
©2018 Measurement Computing Corporation, 10 Commerce Way, Nor ton, M A 02766 • info @mccdaq.com