Nuts and Volts 2008-08
Nuts and Volts 2008-08
$7.00
0 8>
7:45 PM
3
CANADA
74470 89295
7/9/2008
$5.50
U.S.
Cover.qxd
0
Vol. 29 No. 8 NUTS & VOLTS PRIUS HACK • AUDIO SPECTRUM ANALYZER • MODEL TRAIN CONTROLLER August 2008
Full Page.qxd 12/4/2007 4:26 PM Page 2
Full Page.qxd 6/2/2008 11:31 AM Page 3
Free
Book
with Kit
Full Page.qxd 7/7/2008 2:24 PM Page 4
Dual Channel Digital Scope with industry
standard probes or POD connected analog
inputs. Fully opto-isolated.
Capture and display analog and logic signals
together with sophisticated cross-triggers for
precise analog/logic timing.
Display analog waveforms and their spectra
simultaneously. Base-band or RF displays with
variable bandwidth control.
Eight logic/trigger channels with event capture
to 25nS. BS100U Mixed Signal Storage Scope & Analyzer
Innovations in modern electronics engineering are leading the new wave of
DSP Waveform Generator
inventions that promise clean and energy efficient technologies that will
Optional flash programmable DSP based function
generator. Operates concurrently with waveform change the way we live.
and logic capture. It's a sophisticated world mixing digital logic, complex analog signals and
Mixed Signal Data Recorder high speed events. To make sense of it all you need to see exactly what's
Record to disk anything BitScope can capture. going on in real-time.
Supports on-screen waveform replay and export.
BS100U combines analog and digital capture and analysis in one cost
User Programmable Tools and Drivers effective test and measurement package to give you the tools you need to
Use supplied drivers and interfaces to build navigate this exciting new frontier.
custom test and measurement and data
acquisition solutions.
Standard 1M/20pF BNC inputs Smart POD Connector Opto-isolated USB 2.0 12VDC with low power modes
www.bitscope.com
Full Page.qxd 3/5/2008 12:22 PM Page 5
SB72EX $139
data filtering, or custom network
applications. All kits include
2-port serial-to-Ethernet server platform hardware, ANSI C/C++
Qty. 100 compiler, TCP/IP stack, web server,
with RS-232 & RS-485/422 support
e-mail protocols, RTOS, flash file
system, Eclipse IDE, debugger,
cables and power supply.
AU G U S T 2 0 0 8 w w w. n u t s v o l t s. c o m
Projects
38 MODEL TRAIN SWITCH CONTROL
VIA PC OR PIC
Either version of this control system
can easily replace your old manual
controllers, plus the circuits are
versatile enough to use in other
applications.
■ By Dan Gravatt Page 38
● ● ● ● Advanced Level
44 AUDIO SPECTRUM
ANALYZER
The device described here is a
configurable audio spectrum
analyzer incorporating FFTs
and a graphical LCD. You’ll also
be able to vew audio signals
up to approximately 20 kHz.
(And who doesn’t need that?)
■ By Larry Cicchinelli
● ● ● ● Advanced Level
Page 44
Departments
Be sure to check the Nuts & Volts website
08 DEVELOPING 66 ELECTRO-NET for downloads that go along with these projects.
PERSPECTIVES 86 CLASSIFIEDS
10 READER FEEDBACK 88 NV WEBSTORE
34 NEW PRODUCTS 94 TECH FORUM
36 SHOWCASE 97 AD INDEX
Nuts & Volts (ISSN 1528-9885/CDN Pub Agree #40702530) is published monthly for $24.95 per year by T & L Publications, Inc., 430 Princeland Court, Corona, CA 92879.
PERIODICALS POSTAGE PAID AT CORONA, CA AND AT ADDITIONAL MAILING OFFICES. POSTMASTER: Send address changes to Nuts & Volts, P.O. Box 15277, North Hollywood, CA
91615 or Station A, P.O. Box 54, Windsor ON N9A 6J5; cpcreturns@nutsvolts.com.
6 August 2008
TOC Aug08.qxd 7/9/2008 7:50 PM Page 7
Features
52 HOW TO USE THE PUSHBUTTON
ROTARY ENCODER
Learn how using a pushbutton rotary
encoder can help you design and build
better, more user-friendly
microcontroller projects.
■ By Jack Botner
61 SMILEY’S WORKSHOP:
AN AVR C PROGRAMMING SERIES
This new series of workshops will
introduce C programming for the
AVR microcontroller.
■ By Joe Pardue
12 TECHKNOWLEDGEY
Columns 68 PERSONAL
2008 ROBOTICS
Events, Advances, and News Understanding, Designing &
Topics covered include Constructing Robots
a flying saucer, a DORKBOT: People doing
computer inside a pen, weird things with
another win for the electricity.
good guys, plus other
interesting stuff. 76 OPEN
COMMUNICATION
Page 16 16 PICAXE PRIMER The Latest in Networking
Sharpening Your Tools of and Wireless Technologies
Creativity Ten things you may not
Getting started with know about Bluetooth.
the PICAXE-28X1
microcontroller. 79 THE DESIGN CYCLE
Advanced Techniques for
26 Q&A Design Engineers
Reader Questions Answered Up the logic food chain.
Here
Fly zapper, vacuum tube
circuit, solar tracker,
more.
August 2008 7
DevPerspectives.qxd 7/8/2008 3:34 PM Page 8
Metal Fabrication
Quality prototype parts within 24 hours!!
Materials from 0.001” to 6.000” in
thickness.
8 August 2008
DevPerspectives.qxd 7/9/2008 12:28 PM Page 9
According to patent applications, neural networks [2]. Perhaps application — United States Patent
HP’s memristor design is based on memristors will make it possible 20080079029, ‘Multi-terminal
a sandwich of titanium dioxide to implement affordable, semi- electrically actuated switch’ —
films that loosely resembles the autonomous robots with a semblance provides additional information,
construction of a capacitor. However, of intelligence. including specifics on materials
unlike capacitors, one layer of If you’re like me, you probably and doping.
titanium film is an insulator while the can’t wait to order an assortment of It’s not likely that memristors
other layer is doped so that it is a memristors from Mouser or Jameco. will make time travel or anti-gravity
conductor. Wires on either side of However, we’re not there yet. We’ll possible. However, it’s a new
the sandwich are used to pass a probably have to be content with a building block that will undoubtedly
charge through the film. Current SPICE simulation or other virtual have myriad practical applications
through the film lowers the resistance experience for months, if not a year in areas ranging from computing
of the film by a factor of 1,000. In or more. and entertainment to automotive
this respect, the memristor seems a One of the unfortunate aspects electronics. And you can be
lot like an active device to me, but of memristors — from the perspective certain that Nuts & Volts will be
it’s nonetheless classified as a passive of an electronics experimenter eager featuring projects that illustrate the
circuit element. to create the first ‘must have’ device utility of the memristor — just as
Some of the first applications of using memristors — is that just about soon as I can get my hands on
memristors will likely be high-density, every imaginable application is one. NV
energy-efficient memory devices patented. Take a look at uspto.gov or
that compete with Flash memory www.freepatentsonline.com. One
REFERENCES
devices. However, as with any new of the most straightforward patent
technology, it’s difficult to predict applications — United States Patent [1] Chua, L. Memristor — The missing
circuit element. IEEE Transactions on
what will come of the memristor. 20080090337 — is for an electrically Circuits Theory, Volume 18, Issue 5,
Because the memristor has qualities actuated switch. The application Sep 1971 Page(s): 507 – 519.
of both analog and digital circuitry, provides a good background on
[2] Johnson, RC. First proof of circuit
one application identified by HP is the mathematics and physics of a theory’s ‘missing link?’ EETimes.
the development of memristor-based memristor. A second patent Monday, May 5, 2008. Page(s): 1-6.
August 2008 9
ReadFeed Aug08.qxd 7/9/2008 4:11 PM Page 10
READER FEEDBACK
READY TO DIVE INTO you to correct them.
EVERYTHING FOR ELECTRONICS
Published Monthly By
PCB PRODUCTION You'll sometimes get the four-layer T & L Publications, Inc.
component in two-layer board errors 430 Princeland Ct.
Thank you, thank you, thank you! when you reuse components that Corona, CA 92879-1300
For some time now, I have been have been laid out in a four-layer board (951) 371-8497
FAX (951) 371-3052
sitting on the fence thinking I need to design. For instance, if you reuse a
Webstore orders only 1-800-783-4624
figure out how to create my own PCBs component from a four-layer board www.nutsvolts.com
using expresspcb.com. I have been that has been attached to one of the
reluctant to wade into those waters, internal four-layer planes, that will flag Subscriptions
Toll Free 1-877-525-2539
however, because of my inexperience an error in a two-layer design as the
Outside US 1-818-487-4545
with this aspect of electronics. Just last planes don't exist. P.O. Box 15277
week I recall thinking to myself, “I wish Hope that helps, and again, thanks North Hollywood, CA 91615
someone would write an article that for reading.
would step me through the process.” Fred Eady FOUNDER/ASSOCIATE PUBLISHER
Jack Lemieux
The June issue of Nuts & Volts just
arrived! So, thank you very much. I PUBLISHER
think it's time to go “swimming.” GIVING THE WRONG Larry Lemieux
publisher@nutsvolts.com
Greg Lewis SIGNALS
I have enjoyed reading your ASSOCIATE PUBLISHER/
Response: You are welcome, you magazine for a few years now, since VP OF SALES/MARKETING
Robin Lemieux
are welcome, you are welcome! all the other electronic magazines have display@nutsvolts.com
Thanks for taking time to read the dissappeared. But I have also noticed
article. I’m glad it was useful to you. sometimes that answers to some of EDITOR
Bryan Bergeron
Fred Eady the readers questions are not always techedit-nutsvolts@yahoo.com
correct and lead me to believe that
whoever gave the answer does not CONTRIBUTING EDITORS
Jeff Eckert Russ Kincaid
MORE SWIMMING know as much as they think. I have Vern Graner Fred Eady
REVIEWS emailed in several times with my views, Ron Hackett Louis Frenzel
Joe Pardue Jim Fell
I would like to thank you for the but have not seen any results. Today, I Jack Botner Dan Gravatt
well-written article “PCB Basics: From would like to give a simple comment Larry Cicchinelli
Your Brain to a Finished Board,” on the digital TV questions.
CIRCULATION DIRECTOR
appearing in the Nuts & Volts June I have been an electronics Tracy Kerley
2008 issue. This is exactly the sort of technician/broadcast technologist for subscribe@nutsvolts.com
basic how-to article I need to advance about 25 years; I think this gives me SHOW COORDINATOR
my own skills. some insight to comment on this. Audrey Lemieux
I have a question. When you click As far as the simple explanation
MARKETING COORDINATOR
the “Order Boards...” option, is on how they can fit three digital TV WEBSTORE
ExpressPCB smart enough to know signals in the same space as one analog Brian Kirkpatrick
whether the board needs to be two channel — it is really simple. THEY sales@nutsvolts.com
layer or four layer and default to what SEND LESS INFORMATION!!!! It has WEB CONTENT
the design actually needs? been a couple years since I have Michael Kaudze
website@nutsvolts.com
Bob Cochran worked in the broadcast industry, and
Greenbelt, MD there are probably many people out PRODUCTION/GRAPHICS
there that can give a more in-depth Shannon Lemieux
Joe Keungmanivong
Response: Thanks for reading! explanation, but here is mine.
When you begin your design, you In the early 1990s at one place I ADMINISTRATIVE ASSISTANT
Debbie Stauffacher
should set the board type to two or four worked, we were testing coax cable to
layer. The program is not smart enough handle digital TV signals in the studio Copyright © 2008 by T & L Publications, Inc.
All Rights Reserved
to determine the type of board to use environment. The analog bandwidth All advertising is subject to publisher’s approval. We are
versus the design criteria. needed was 6 MHz minimum, the not responsible for mistakes, misprints, or typographical
errors. Nuts & Volts Magazine assumes no responsibility
There are things you can't do in equivalent digital signal ran at 270 for the availability or condition of advertised items or for
two-layer mode that apply only to megabits per second. End result: the honesty of the advertiser. The publisher makes no
claims for the legality of any item advertised in Nuts &
four-layer boards. You need much more bandwidth to Volts. This is the sole responsibility of the advertiser.
The order program will pick up send the same signal in digital format Advertisers and their agencies agree to indemnify and
protect the publisher from any and all claims, action, or
four-layer things that can't happen in than analog. expense arising from advertising placed in Nuts & Volts.
two-layer boards and post an error for This creates large problems. To use Please send all editorial correspondence, UPS, overnight
mail, and artwork to: 430 Princeland Court, Corona, CA
continued on page 92
10 August 2008 92879.
Full Page.qxd 7/7/2008 11:06 AM Page 11
2008
■ BY JEFF ECKERT
TECH KNOWLEDGEY
EVENTS, ADVANCES, AND NEWS
ADVANCED TECHNOLOGY
FLYING SAUCER: the surrounding air, and that swirling device developed by scientists at the
PATENT PENDING air creates lift and momentum and National Institute of Standards and
provides stability against wind gusts.” Technology (NIST, www.nist.gov) and
PHOTO BY DANIELLE ZAWOY, UNIVERSITY OF FLORIDA.
The saucer-like shape serves to Germany’s University of Konstanz
increase the area of the air-vehicle (www.uni-konstanz.de). We’re talking
interface and maximize lift. A major about an ultrafast laser that offers a
advantage to this concept is that the record-breaking combination of high
vehicle will have no moving parts and speed, short pulses, and high average
the ability to take off vertically, power: This dime-sized device
hover, and fly not only in Earth-like produces 10 billion pulses per
atmospheres but also in places like second, each about 40 quadrillionths
Titan, Saturn’s most inviting moon. of a second in duration, with an
Some pretty substantial hurdles average of 650 mW power. As it
exist, though, so don’t get prematurely turns out, the laser — when used as
excited. For one thing, it remains to a frequency comb (see www.nist.
be seen if anyone can create a power gov/public_affairs/newsfromnist_
source capable of generating enough frequency_combs.htm for a detailed
plasma to raise itself against Earth’s definition) — could provide 100
gravity. In addition, the plasma creates times the sensitivity of existing
enough EMI that communicating with astronomical tools used in the search
the vehicle is highly problematic. for Earth-like planets orbiting distant
The present design is aimed at a stars. In practical terms, this means
■ Artist’s conception of a WEAV flying six-inch prototype. But it isn’t going to we should be able to detect starlight
above the Mars surface. exist in hardware for a while, so if you “wobbles” created by such planets
see a UFO outside your window, down to a few centimeters per
he US Patent Office recently you can still jump to extraterrestrial second rather than the present one
T received an application for
something that resembles a traditional
conclusions. But the Air Force and
NASA reportedly have expressed
meter per second.
Standard frequency combs have
flying saucer, but the applicant isn’t a interest in the concept, so you “teeth” (see illustration) that are too
Martian — the culprit is Assoc. Prof. never know. finely spaced for instruments to read.
Subrata Roy, of the University of But the new laser bounces light
Florida’s Dept. of Mechanical & LASER MAY AID SEARCH between sets of mirrors to eliminate
Aerospace Engineering (www.mae. FOR PLANETS some blocks of teeth, thus creating a
ufl.edu). The design is properly “gap-toothed” comb that displays
known as a “wingless electromagnetic lso presenting possibilities for only every 10th or 20th tooth. The
air vehicle,” or WEAV. The innovative
part of the concept is that the WEAV
A space exploration is a laser next step is to incorporate the device
in a ground-based
will be powered by magnetohydrody- PHOTO COURTESY OF M. KIRCHNER AND S. DIDDAMS, NIST.
telescope or satellite.
namics, which is basically the science Other possible
of how electrically conductive fluids applications include
— which include plasmas and liquid remote sensing of gases
metals — are affected by magnetic and precision control
fields. In this case, “the conducting of high-speed optical
fluid will be created by electrodes communications.
that cover each of the vehicle’s
surfaces and ionize the surrounding ■ Experimental data from
air into plasma ... the force created a “gap-toothed” frequency
by passing an electrical current comb, false colored to
show a power range from
through this plasma pushes around low (red) to high (blue).
12 August 2008
Tech2008.qxd 7/3/2008 2:01 PM Page 13
TECHKNOWLEDGEY 20 08
AND DEVICES
SUPERCONDUCTOR
CABLE ENERGIZED
ou don’t get to see super-
Y conductors in operation every
day, but back in April, the Long
Island Power Authority (LIPA,
www.lipower.org) fired up the first
high-temperature superconductor
(HTS) power transmission cable
system in its commercial power grid.
The cables shown entering the
ground in the photo can carry as
much power as all of the overhead
lines shown in the background. The ■ LIPA’s new power
138 kV system can handle 574 MW transmission cable.
of power (enough to run 300,000
homes) via the three individual power cables of the same size), and it 2,000 ft (610 m) cable system is
cable phases running in parallel (150 virtually eliminates the typical seven cryogenically cooled using a liquid
times the current handled by copper to 10 percent resistance loss. The nitrogen refrigeration system. Return
TECHKNOWLEDGEY 20 08
on investment may take a while, as Using an external N-channel The LT3755 uses True Color
the project cost $58.5 million, about MOSFET, it can drive as many as PWM™ dimming to deliver constant
half of which was funded by the 14 1A white LEDS from a 12V input color with a dimming range of up to
Department of Energy. But the mission to deliver over 50W. The high-side 3,000:1. Two versions are available:
is to “modernize the electric grid, current sense allows it to be used in the standard LT3755, which offers
enhance security and reliability of the boost, buck, buck-boost, or SEPIC an open LED status pin; and the
energy infrastructure, and facilitate and flyback topologies. Frequency LT3755-1, which replaces the pin
recovery from disruptions to energy can be adjusted between 100 kHz with a frequency synchronization pin;
supply.” Sounds like a worthy goal. and 1 MHz and, because the device In production quantities, they’ll run
is better than 94 percent efficient in you about $2.75 each. For $3.15,
HEFTY DVR STORAGE boost mode, no heatsinking is you can get an extended-temperature
required. version. NV
ou’re probably familiar with
Y Seagate’s line of hard drives
aimed at computer data storage, but
the company recently announced the
Seagate® Showcase, a series of
products that extend the storage
capacity of DVRs. Designed for
compatibility with Motorola’s eSATA
capable high-definition products (but
you also can connect via a standard
USB 2.0 cable), they are slated for
for Engineers
market soon, perhaps by the time
you read this. The boxes will initially
come with 1 TB of storage, which
translates into 200 hr of HD movies
or 1,000 hr of standard-def TV.
The Showcase family features
Seagate’s Pipeline HD series of
hard drives.
The Pipeline drives are designed
specifically for DVRs, providing top-
notch high-definition performance
and capacity with “bedroom-quiet
acoustics,” low-power operation, and
the ability to support up to 12
simultaneous HD streams. The drives
are Windows Vista certified, making
them suitable for home media
centers. The list price has not been
divulged, but the product does come
with a one year warranty and free
www.mouser.com
tech support even after the warranty
expires. You can check for price and
availability at www.seagate.com. Over A Million Products Online
■ BY RON HACKETT
PICAXE PRIMER
SHARPENING YOUR TOOLS OF CREATIVITY
PICAXE PRIMER
accesses a new 16-bit background in a special area of memory. This readtable): Allows for a 256-byte
timer/counter, with a user-accessible means that your program no longer data lookup table in EEPROM; we’ll
timer variable. It can operate in one has to sit and wait for serial input; it find it useful for LCD menu text.
of two modes: timer mode and can be doing other tasks while serial
counter mode. In timer mode, your data is being received and when it’s • I2C Commands (hi2cin, hi2cout,
program can set up a timer that runs convenient, it can retrieve the hi2csetup): The 28X1 is able to
in the background and increments at received data for processing. function as either an I2C master
a frequency you can specify, e.g., In addition to the new features or slave which (among other
once per second. “In the whose presence is clearly announced advantages) allows for the networking
background” means that your on the 28X1’s pin-out, there are of multiple 28X1 processors.
program can go about its business many additional new commands and
and check the timer variable improvements to older commands • IR Commands (irin, irout): IR
periodically to determine its current that can be discovered by reading communication can now be
value. In other words, it’s possible to the documentation. Don’t forget, you implemented on any I/O pin.
include a real-time clock function in will need to install the latest version Also, the irin command includes a
your program without needing an of the Programming Editor software “timeout” feature so your program
external clock chip; we will do (available at www.rev-ed.co.uk/ won’t hang if data is not received.
exactly that in the near future. In picaxe) to be able to use these new
counter mode, your program can features in your programs. We’ll • Keyboard Input (kbin): Similar to
count the number of pulses received explore the vast majority of them in the older “keyin” command, but now
on input 0 (again, in the background) detail as we need them in our various also includes a timeout feature.
so it can be carrying out other tasks I/O projects in the coming months.
simultaneously. In the meantime, the following • Memory Access (get, put): Provide
Pins 13, 22, 23, and 25 are all summary list of the major access to the 128-byte scratchpad
used to implement the 28X1’s new improvements in the 28X1 should memory area for additional data/
hardware PWM command which is whet your appetite: variable storage.
used for advanced motor control and
is a more powerful alternative to the • ADC Commands (calibadc, • One-Wire Commands (owin,
more traditional “pwmout” command calibadc10): In the past, ADC owout, readowsn): Provides full
(pins 12 and 13) which we will also readings have been based on the support for the 1-Wire protocol on
implement in an upcoming Primer supply voltage. Therefore, in battery- any I/O pin.
installment. powered systems, changes in the
Pins 14, 15, and 16 provide the supply voltage produced inaccuracies • Power-reduction Commands
necessary I/O lines to implement the in the ADC readings. The new (disablebod, enablebod, hibernate):
standard three-wire SPI protocol. commands allow access to a fixed, Implements the new ULPWU
SPI is a much faster alternative to internal 0.6V supply for increased feature. We’ll explore disablebod
RS-232 serial communications; many accuracy. and enablebod next.
inexpensive peripheral SPI chips are
readily available to carry out a variety • Data Storage Table (table, • Serial Communications
of communications functions. For
example, the Max7219 is a 24–pin ■ FIGURE 2.
chip that can be used to interface Reset - 1 28 - Out 7 PICAXE-28X1
with up to eight seven-segment LED ADC 0 / In A0 / ULPWU - 2 27 - Out 6 pin-out.
displays. An upcoming Primer I/O ADC 1 / In A1 - 3 26 - Out 5
project will use the MAX7219 to ADC 2 / In A2 - 4 25 - Out 4 / hpwm D
implement a stand-alone, four-digit
ADC 3 / In A3 - 5 24 - Out 3
seven-segment LED display.
I’ve saved the best until last — Serial In - 6 23 - Out 2 / hpwm B
pins 17 and 18 can now be used in Serial Out - 7 22 - Out 1 / hpwm C
conjunction with the new hardware- Gnd - 8 21 - Out 0
based “hserin” and “hserout” Resonator - 9 20 - +V
commands. These commands
Resonator - 10 19 - Gnd
support much higher serial baud
rates than the older serin and serout In 0 / Out C0 / timer clock - 11 18 - In C7 / Out C7 / ser rx / kb data
commands (which are also still In 1 / Out C1 / pwm 1 - 12 17 - In C6 / Out C6 / ser tx / kb clock
available). More importantly, hserin In 2 / Out C2 / hpwm A / pwm 2 - 13 16 - In C5 / Out C5 / spi sdo
can operate in the background and In 3 / Out C3 / i2c sci / spi sck - 14 15 - In C4 / Out C4 / i2c sda / spi sdi
automatically save the received data
August 2008 17
PicaxePrimer.qxd 7/3/2008 3:39 PM Page 18
(disconnect, reconnect, serin, support an external resonator; each get some idea of just how much
serout, serrxd, sertxd): The of the earlier 28-pin chips did so, as power we might be able to conserve,
disconnect command stops the 28X1 well. However, the 28X1 provides I carried out a little experiment with a
from looking for a new program more external resonator choices. simple 28X1 circuit, but before we
download, which enables your Also, with a top speed of 20 MHz, get into the details and the results, I
program to use the download cable the 28X1 is the fastest PICAXE need to introduce a term that may be
for data communications (using currently available (40 MHz X2 new to some readers. The 28X1 has
serrxd and sertxd) with your PC (e.g., processors are already being a feature called “brownout detection”
via a terminal program). The serin developed). Of course, the option or BOD; its function is to cleanly
command now includes a timeout of increased speed is in itself a big reset the chip in the event of a power
feature so your program won’t hang improvement. However, the 28X1’s brownout (i.e., a temporary drop in
if data is not received. Also, the new resonator flexibility is an even more the input voltage). It’s a great feature
hardware serial commands (discussed significant advance. for line-powered circuits, but not
previously) allow for automatic serial In addition to the external really necessary with battery-power,
input in the background. resonator choices of 20, 16, 10, 8, and it does require a fair amount of
and 4 MHz, the 28X1 also supports power to operate. Fortunately, the
• Sound Output (play, sound, tune): internal oscillator speeds of 8, 4, 2, 28X1 supports software commands
Sound and music output can now be and 1 MHz, as well as 500, 250, 125, to enable or disable BOD (enablebod
implemented on any output pin. and 31 kHz. What’s so great about and disablebod).
that, you might ask, and why would I had three goals in mind when I
• SPI Commands (hspiin, hspiout, anyone ever want to run a program set up my experiment. The first was
hspisetup): Enables higher at 31 kHz, anyway? Well, for any to measure the 28X1 supply current
communication speeds. CMOS processor (which includes at each of its internal resonator
all the PICAXE chips), power speeds. I focused on the internal
• Timer Commands (settimer, consumption is directly proportional resonators because the Microchip
settimer count): New 16-bit to processor speed — so slower data sheet for the PIC16F886 (the
background timer/counter. program speed goes hand in hand chip on which the 28X1 is based)
with lower power requirements. In contains data that shows that the
There are also several significant other words, if your project is battery external resonators consume
additions in the area of mathematical powered, the more you can slow significantly more power, even at
computations. We don’t have space to down the speed of program the same speed (i.e., 4 MHz external
list them here, but we’ll get to many execution, the longer your batteries vs. 4 MHz internal).
of them in upcoming installments of will last. The second goal was to
the Primer. All of the new features determine the magnitude of the
and commands are covered in the supply current reduction obtained by
documentation, especially Part 2 of
A LITTLE EXPERIMENT disabling BOD at each internal speed.
the PICAXE manual — have a read! As you already know, once we Finally, since power consumption
have completed a few of our also decreases with lower supply
upcoming I/O projects we’re going voltages, I took all my measurements
RESONATOR to develop a battery-powered with a five-volt power supply and
ENHANCEMENTS data-logging system, so the prospect then repeated the process with a
of a significant reduction in power 3.3-volt supply. When I recorded
The 28X1 isn’t the first PICAXE to consumption is of special interest. To each measurement, I made sure that
the 28X1 wasn’t powering any
external components (e.g., an
5.0-volt Power Supply 3.3-volt Power Supply LED) because the additional
Speed BOD Enabled BOD Disabled BOD Enabled BOD Disabled power usage would confound
8 MHz 1.82 1.75 1.07 1.03
the results.
4 MHz 1.07 0.98 0.64 0.59 If you examine the resulting
2 MHz 0.68 0.60 0.42 0.38 data (presented in Figure 3), you
1 MHz 0.49 0.41 0.31 0.27 can see that all three variables
500 kHz 0.39 0.32 0.25 0.21 influenced power consumption
250 kHz 0.35 0.27 0.23 0.19 exactly as we would expect: For
125 kHz 0.32 0.24 0.21 0.17 both supply voltages, lower
31 kHz 0.11 0.03 0.06 0.02 resonator speeds resulted in
lower supply currents; compared
Note: See text for important information about the 28X1 Brown-Out Detection feature.
■ FIGURE 3. 28X1 internal
resonator supply currents.
18 August 2008
PicaxePrimer.qxd 7/3/2008 3:39 PM Page 19
PICAXE PRIMER
PICAXE is running at 4 MHz. This is desperation (I hate to admit I can’t of your hardware and software setup
never a problem at power-up or figure something out on my own!) I and the nature of the problem, and
reset; in those two cases, the 28X posted a message on the PICAXE you’re very likely to get some helpful
automatically defaults to its 4 MHz forum (www.picaxeforum.co.uk) feedback.
internal resonator. However, if the detailing the problem. Within a day The second problem I
28X1 is currently running software or so, there were several responses encountered is even more perplexing
that has changed the speed to confirming my results, and by the than the reversed BOD commands.
anything other than 4 MHz, you may second day a response from As I mentioned earlier, I used a
get a “hardware not found” error and “Technical” (the RevEd guru who push-button on input 3 to give myself
the program will fail to download. moderates the forum) indicated that time to write down the current
The solution is to do the following: the strange results were due to a bug readings. After each internal
Hold down the 28X1’s reset button, in the 28X1 software and that the resonator speed change, the program
initiate the download, and then release bug would be corrected in the next idles in a loop until the button is
the reset button — the program should update to the Programming Editor pressed (at least that’s what I intend-
download successfully. software. In the meantime, I’ll just ed). The idling works properly at
use the two commands as if their every speed except 31K; in that case,
meanings were reversed, which is the software seems to reset itself. My
PROBLEMS, PROBLEMS, what I did to obtain the data deadline for submitting this article to
PROBLEMS ... presented earlier in Figure 3. Of N&V arrived and I still haven’t figured
course, when the bug is corrected, out what’s going on. I haven’t posted
Actually, my little experiment I’ll need to reverse the commands the problem on the forum yet, but at
didn’t proceed nearly as smoothly as again to straighten things out. some point I may have to give in and
the results might suggest. As I carried This little saga is one indication ask for help again! In any case, I’m
out the measurements, I encountered of just how helpful the PICAXE forum sure we’ll revisit this issue in future
two very surprising and perplexing can be and how responsive RevEd is installments of the Primer, but even if
problems. First, every measurement I to input from its user base. If you’re 31K turns out to be unsuitable for
made with the disablebod command not already a forum member, I would our battery-powered data-logger, it’s
in effect was higher than the highly recommend joining. The great to know that we can reduce
corresponding measurement with members are very knowledgeable our supply current by 90% by simply
enablebod in effect. This, of course, and willing to help. If you have a disabling BOD (with whichever
is exactly the opposite of what it question, first search the archives command works!), switching to a
should be, and I spent a fair amount because your problem may have 3.3-volt supply, and turning down
of time examining both the hardware already been addressed. If you can’t the internal resonator speed from
and software to see if I could find find what you’re looking for, post a 8 MHz to 125 kHz. In order to get a
the source of the problem. Finally, in message with a thorough description rough estimate of how long we might
expect a battery-powered 28X1
system to operate, I made a couple
of assumptions and calculated what I
think is a very conservative estimate
of battery life. I chose the Eveready
Energizer six-volt lantern battery
(#528 or 529) for two reasons: It has
a huge capacity (26,000 mAh — see
http://data.energizer.com) and
six volts should give us more than
enough headroom to supply a
3.3-volt low-dropout regulator.
As we saw in Figure 3, at 3.3 volts
the 28X1 will draw 0.17 mA at 125
kHz with BOD disabled. Of course,
we’ll also want to take various
measurements (e.g., temperature)
and perform other tasks occasionally,
so let’s triple that and assume 0.5
mA current draw on average. A full
day of operation will consume 24h x
■ FIGURE 6. Complete 0.5 mA = 12 mAh, so we can expect
setup with multimeter. 26,000/12 = 2167 days (almost six
20 August 2008
PicaxePrimer.qxd 7/8/2008 12:51 PM Page 21
PICAXE PRIMER
WHAT’S NEXT?
That’s it for our overview of the
major new features of the 28X1. It’s
an impressive chip and in future
installments, we’ll delve more deeply
into the details of many of the
features we only touched on this
month. If you want to get a head
start with any new feature or
command, don’t forget that Part 2
of the PICAXE Manual contains the
complete documentation — there’s
lots of valuable information in there.
In the next installment of the
Primer, we’ll develop our first I/O
device for use with the 28X1 (or
any processor, for that matter) — a
multi-function infrared board capable
of sending and/or receiving IR
signals in the SIRC protocol, as well
as functioning as an object detector
for robots or home control projects.
We will also explore the 28X1’s new
hserin command, which can operate
automatically in the background
while our program is tending to other
matters. In the meantime, if you want
to review the basics of PICAXE
infrared communication, take a look
at last February’s column. NV
August 2008 21
NutNVolt200808.qxd 7/7/2008 11:44 AM Page 22
Mini-Kits...
We Put The FUN In Electronics! The Building Blocks!
USB Experimenters Kit High Power LED Strobe Personal Guitar Amp Tickle-Stick
The kit has a pulsing 80 volt
tickle output and a mischie-
vous blinking LED. And who
can resist a blinking light?! Great
fun for your desk, “Hey, I told you not to touch!”
Runs on 3-6 VDC
TS4 Tickle Stick Kit $12.95
Learn how USB works! Super bright LED’s! Brand new, popular choice!
Get hands-on experience devel- The fragile glass Xenon tube is The new PGA1 allows you to Super Snoop Amplifier
oping USB interfaces! 5 digital gone, replaced with high intensity practice both your regular and Super sensitive amplifier that will
inputs, 8 digital outputs, 2 analog LED’s! Variable flash rate and bass guitars in peace! Also works pick up a pin drop at 15 feet! Full
I/O’s! Includes diagnostic soft- built-in audio trigger input to sync as a great DI to feed your home 2 watts output. Makes a great “big
ware and DLL for use with to your audio. Additional display stereo amplifier! CD/MP3 input ear” microphone. Runs on 6-15 VDC
Windows based systems. The boards also available. Runs on allows you to play to your favorite
mystery is solved with this kit! 12VDC or use our AC125 PS. music. Includes case shown! BN9 Super Snoop Amp Kit $9.95
K8055 USB Exp. Kit 49.95 LEDS1C LED Strobe Kit 44.95 PGA1 Guitar Amp Kit 64.95 Dripping Faucet
Produces a very pleasant, but
ECG Heart Monitor Plasma Generator HV Ion Generator obnoxious, repetitive “plink, plink”
sound! Learn how a simple transis-
tor oscillator and a 555 timer can make
such a sound! Runs on 4-9 VDC.
EDF1 Dripping Faucet Kit $12.95
Touch Switch
Check your own heart! Generate 2” sparks! Make a blast of fresh air! Touch on, touch off, or momen-
tary touch hold, your choice! Uses
Provides a visible and audible dis- Produces a stunning and shocking Generates a steady state DC volt- CMOS technology. Runs on 6-12 VDC
play of your heart rhythm! 25kV at 20kHz from a solid state age at constant non-pulsed cur- and drives any load up to 100 mA.
Variable gain, bright “beat” LED, circuit! Build your own plasma rent at 7.5kV DC negative, 400uA. TS1 Touch Switch Kit $9.95
and monitor output for display on bulbs, light fluorescent tubes That’s a LOT of ions! Learn how
your scope. Just like the lab! Re- without wires and more! A great modern spacecraft use ions to
usable sensors are included. learning kit. Runs on 16VAC, accelerate through space. Runs Voice Switch
Runs on a safe 9VDC battery. order our PS21 power supply. on 12VDC or our AC125 PS. Voice activated (VOX) provides a
switched output when it hears a
ECG1C ECG/EKG Kit 44.95 PG13 Plasma Gen Kit 64.95 IG7 Ion Gen Kit 64.95 sound. Great for a hands free PTT
switch, or to turn on a recorder or light! Runs on
20W SubMini Audio Amp Digital Voice Storage Speed Radar Gun 6-12 VDC and drives a 100 mA load.
VS1 Voice Switch Kit $9.95
LED Blinky
Our #1 Mini-Kit for 31 years!
Alternately flashes two jumbo red
LED’s. Great for signs, name badges,
model railroading, and more. Runs on 3-15 VDC.
20 watts and no heat! Multiple message storage! Now YOU can be the cop!
BL1 LED Blinky Kit $7.95
Delivers a super clean 20W out- The Bullshooter-II provides up to Our famous Speedy radar gun
put from one SMT package! Ultra 8 minutes of digital voice storage teaches you doppler effect the DTMF Tone Decoder
efficient class D design produces that can be broken down into 8 fun way! Digital readout displays
no heat. PCB can be snapped separate stored messages! Great in MPH, KPH, or FPS. 1/8th mile Decodes DTMF Touch Tones from
into a small circle for special for announcements, etc. Built-in range is typical. You supply two telephones, radios, etc. 200mA
applications. Runs on 18VDC for mic plus external input. Runs on coffee cans! Runs on 12VDC or output drives relays, LEDs, digi-
rated output, use our SPS18 PS. 12VDC or our AC125 PS. our AC125 power supply. tal devices, and more. Decodes
0-9, *, #, A, B, C, D. Runs on 5VDC
UAM2 20W SMT Amp Kit 34.95 BS2C Bullshooter-II Kit 69.95 SG7 Speedy Radar Kit 59.95 TT7 DTMF Decoder Kit $24.95
Doppler Direction Finder Touch-Tone Reader Signal Magnet Antenna Code Practice Oscillator
Great starter kit for young and
old! Learn code the easy way
with this easy to build kit!
Adjustable tone and built-in key lets you practice
anywhere you go! Runs on 9V battery.
CPO3 Code Practice Oscillator Kit $14.95
Find that transmitter quick! Read the number dialed! Pulls in distant stations! Light Activated Switch
Track down jammers and hidden The Tone Grabber captures dialed Super Hi-Q ferrite rod antenna Save electricity and have your
transmitters with ease! 22.5 phone numbers, repeater codes, with Faraday shield eliminates devices turn off at dusk and on at
degree bearing indicator with control codes, or anything that noise from power lines, dimmers, dawn! Closes an on-board SPDT
adjustable damping, phase inver- uses touch-tone signaling. Flash static and more! Great results relay. Adjustable sensitivity over a wide range.
sion, scan and more. Includes 5 micro stores 640 digits! Phone from 500kHz to 15MHz. Super Runs on 12-15VDC.
piece antenna kit. Runs on line and audio inputs. Runs on for AM broadcast band! Includes
12VDC vehicle or battery power. 12VDC or our AC125 PS. power supply. MK125 Light Activated Switch Kit $8.95
DDF1 Dir. Finder Kit 169.95 TG2C Tone Grabber Kit 69.95 SM100 Sig Magnet Kit 89.95 Water Sensor Alarm
The sump pump quits...and what do
✔ It’s impossible to give you full specs on these products you do? You don’t live in the base-
The Solution!
Runs on a standard 9V battery (not
Visit www.ramseykits.com included).
Free Giveaways and ALL the MK108 Water Sensor Alarm Kit $7.95
information you ever needed!
NutNVolt200808.qxd 7/7/2008 11:48 AM Page 23
And at 40 watts, you’re probably already wondering about the heatsink require- With the CarChip Pro you'll have complete access to all your vehicles diagnostic
ments to dissapate the heat, right? Stop wondering, there’s no heat, so there is data at your fingertips! Sort miles by type (business, personal or driver), set
no heatsink required! And all that power is generated in a single SMT device the thresholds for alarms, calculate gas mileage, log extreme acceleration and brak-
size of your thumbnail on a small 2½” square board! ing, speed, engine parameters, and a whole lot more! And as you know,
extreme acceleration does not equal fuel economy! Find out who’s driving your
The high impedance input is designed to use your choice of either a balanced line vehicle like a race car...and deal with it!
input or an unbalanced signal source using easy to connect Euro terminal blocks.
Logic connections to ground are also provided to mute and/or shut down the The CarChip Pro is great if you have a new driver in the family. Easily monitor
amplifier. You can also enable the built-in over temperature signal to activate one their performance and let them gain additional privileges with a good driving
of these controls automatically! Easy to use board jumpers offer selectable gain of record! You have the proof!
+22dB, +25dB, +29.5dB or +36dB to match your input levels. Board jumpers
also enable protection and shutdown options as well as stereo/mono/bridge No more taking your car in to see why your “check engine” light is on. The
mode. The amplifier also features built-in click and pop suppression to protect CarChip Pro will automatically provide the trouble codes and allow you to reset
not only your ears and sanity, but your speakers and equipment! it! CarChip Pro includes storage for up to 300 hours of driving data! If you're
unfortunate enough to be involved in an accident, it even records all the vehicle’s
Power input for maximum rated output is 18VDC at 2.64A. Input voltage can be parameters for the last critical 20 seconds of operation! Includes USB cable, soft-
reduced to a minimum of 10VDC while maintaining the same high efficiency ware and complete instructions.
operation with reduced output power. If you’re looking for an incredible stand- 8226 Davis OBDII CarChip Pro Data Logger $99.95
alone stereo (or mono) amplifier to build into your equipment, vehicle, speakers,
or application, the UAM4 is the latest and the greatest!
Digital Controled FM
UAM4 40W Subminiature Stereo Audio Amplifier Kit $69.95 Stereo Transmitters
✔ Rock stable PLL synthesized exciter
Passive Aircraft Airband Receiver ✔ Front panel digital control and
✔ Monitors the entire 118-136 MHz aircraft display of all parameters!
band without tuning! ✔ Professional metal case
✔ Great for air shows! ✔ Super audio quality!
✔ Passive design, can be used onboard aircraft! ✔ 25mW kit and 1W export models!
✔ Patented circuit and design! For nearly a decade we’ve been the leader in hobbyist FM radio transmitters.
For decades we have been known for our novel and creative When it became time for a new model, we started from the ground up! We told
product designs. Well, check this one out! An aircraft receiver our engineers we wanted a new technology transmitter that would provide
that receives all nearby traffic without any tuning. It gets better... FM100 series quality without the advanced mixer features. They took it as a
there is no local oscillator so it doesn't produce, and can't pro- challenge and designed not one, but TWO transmitters!
duce, any interference associated with all other receivers with an
LO. That means you can use it onboard aircraft as a passive The FM30 is designed using through-hole technolo-
device! And what will you hear? The closest and strongest traffic, gy and components and is available only as a do-it-
mainly, the one you're sitting in! How unique is this? We have a patent on it, yourself kit, with a 25mW output very similar to our
and that says it all! FM25 series. Then the engineers redesigned their
brand-new design using surface mount technology
This broadband radio monitors transmissions over the entire aircraft band of 118- (SMT) for a very special factory assembled and test-
136 MHz. The way it works is simple. With AM the strongest man wins! The ed FM35WT version, with 1W output for our export-
strongest signal within the pass band of the radio will be heard. Just imagine the only market! Both are designed around an RF tight
excitement at air shows. No need to look up frequencies, just listen to the air-air, vinyl clad metal enclosure for noise free and inter-
air-to-ground, and air boss traffic active at the moment! Receiver sensitivity is less ference free operation. All settings are done
than 2uV for detectable audio. Headset cord is coupled as the antenna giving through the front panel digital control and LCD dis-
you great reception. Also includes a set of stereo ear buds. Runs on a standard play and are stored in non-volatile memory for
9V battery. Available as a thru-hole kit or factory assembled & tested SMT version. future use.
ABM1 Passive Aircraft Airband Receiver Kit $89.95 Both the FM30 and FM35WT operate on 13.8 to 16VDC and include a 15VDC
ABM1WT Factory Assembled & Tested ABM1, SMT Version $159.95 110/220VAC plug in power supply. The stylish black anodized aluminum case
measures 5.55"W x 6.45"D x 1.5"H. and is a great match to your other equip-
ment.
3-In-1 Multifunction Lab
(Note: After assembly of this do-it-yourself hobby kit, the user is responsible for
The handiest item for your bench! Includes a complying with all FCC rules & regulations within the US, or any regulations of
RoHS compliant temp controlled soldering sta- their respective governing body. FM35BWT is for export use and can only be
tion, digital multimeter, and a regulated lab shipped to locations outside the continental US or valid APO/FPO addresses or
power supply! All-in-one small unit for your valid customs brokers for end delivery outside the continental US.)
bench! It can’t be beat! The PS provides 3, 4.5, 6, 7.5, 9, and 12VDC regulated
outputs at 2A peak. Unclutter your bench today with the 3-In-1 Lab! FM30B Digital FM Stereo Transmitter Kit, 0-25mW $199.95
LAB1U 3-In-1 Multifunction Lab $129.95 FM35BWT Export Only Transmitter Assembled, 1W $299.95
th
Year!
In Our 36 800-446-2295
www.ramseykits.com
MORE than just friendly on-line ordering!
590 Fishers Station Drive Clearance Specials, User Forums, Dealer Information, FAQ’s, Kit Building Guides, Downloads, Live
Weather, Live Webcams, and much more!
Victor, NY 14564
(800) 446-2295 Prices, availability, and specifications are subject to change. We’re not responsible for typos, mistakes, stupids, or
August sunburns! Robin’s soldering quest continues, but the boat has won over! Visit www.ramseykits.com for the 112 Pages! Get The
(585) 924-4560 latest pricing, specials, terms and conditions. Copyright 2008 Ramsey Electronics, LLC...so there! Latest Catalog Today!
Page24.qxd 7/8/2008 3:25 PM Page 24
24 August 2008
Full Page.qxd 7/7/2008 2:20 PM Page 25
Q&A.qxd 7/7/2008 4:05 PM Page 26
This calls for a flip-flop. I have mounts in a rectangular hole; you will
RAILROAD CROSSING
LIGHT CONTROLLER
I am a volunteer
A used a 555 oscillator driving
an SN74LS74 and two solid-
state switches (see Figure 1).
The oscillator is designed to run at 2 Hz,
have to file it to fit, and the toggle
switch mounts in a round hole — just
drill it. A five volt power supply is
needed and the power is low, under
Q worker/helper at a small
local history museum
located in Tullahoma,TN.
We have a two arm RR crossing light
that has been modified with small
but you may want to make the
frequency variable by replacing R2
with a rheostat connected 500K pot.
The SN74LS74 is a dual D type
flip-flop and I have connected them
1/2 watt. If you don’t have a spare
kicking around, this $8.70 unit from
Mouser will do: 826-DA4-050US.
AUTOMATIC ON/OFF
110V holders and lamps. I would in parallel to give more drive to the
like to buy/build a controller to solid-state switch. The output is SWITCH
alternately light the lamps so that arranged to pull down because TTL
when one goes out, the other will does not pull up very well. The switch My project is to design and
come on. Do you happen to have
any ideas?
— Greg Klein
is an opto triac rated at two amps, so
it will operate a 100 watt lamp with
no problem. The rocker switch Q build an automatic on/off
circuitry for a remotely
located audio amplifier. The
■ FIGURE 1
26 August 2008
Q&A.qxd 7/7/2008 4:05 PM Page 27
QU E ST I O N S & A N S W E R S
maximum 5 and minimum just under two coils for old VW Beatles without
unity. The op-amp unity gain the caps and the local auto supply VACUUM TUBE
bandwidth is 3.5 MHz so that is not a store (Pep Boys) wants an arm and a EQUIVALENT CIRCUIT
concern and distortion will be nil as leg for the caps.
long as the amplitude of the output Also, for me to use your circuit I I have a circuit that I got
does not exceed VCC-two volts peak.
FLY ZAPPER
In the September ‘07 issue
would need it to fire about 2X per
second. I’ll call it RussKin’s Critter
Getter. Any ideas on that? I’ll bet that
arm and leg that many people have
the same problem with critters!
Q from a magazine (transistor),
but I wonder if I could
convert it to tubes. I know
tubes are old technology, but I like
them. My endeavor was the circuit in
QU E ST I O N S & A N S W E R S
■ FIGURE 4
tubes should be operated push-pull, seven watts. The bias current in the
class AB, for reasonable power final stage is arbitrary; I chose 10 800 MHZ BUSINESS
output and low distortion. I have mA, so you would adjust the negative BAND COMMUNICATION
modified your design in Figure 5. The bias to obtain one volt DC at each
final stage is AC coupled because cathode. Matched 6V6 tubes will be Can you tell me where I
there is no point in maintaining DC
coupling, and it would be difficult.
The first stage gain is about 60
(6.8K/110), but the second stage is
just a phase splitter — it has no
necessary. According to my tube
manual, the output transformer
should be 10KCT: eight ohms. I
have labeled the schematic with
the expected voltages and currents.
Q might get a book on FM
communication decoding
and encoding? Or, maybe
at least a schematic? If it matters, it’s
for the 800 MHz business band FM. I
gain. You will need a preamp to get If you build it, let me know how have been monitoring the band for
the maximum power output of it works! 4+ years now — just a hobby.
■ FIGURE 5
August 2008 29
Q&A.qxd 7/7/2008 4:06 PM Page 30
QU E ST I O N S & A N S W E R S
■ FIGURE 10
Q column, you provided a
PIC-based charger circuit
for NiMH batteries
voltage divider (R4, R5) would also
need adjusting.
— Dave Carpenter
August 2008 31
Q&A.qxd 7/7/2008 4:07 PM Page 32
Microcontrollers
USB Connectivity for
Embedded Designs
Digital Signal
Controllers
The Microchip name and logo, the Microchip logo and PIC are registered trademarks of Microchip Technology Incorporated in the USA and in other countries. © 2008, Microchip Technology Incorporated. All rights reserved.
Serial Analog
EEPROMs
2nd line
Microchip Direct...
If you need Full-Speed USB 2.0 device, embedded host, dual role and USB Starter Kits accelerate development
On-The-Go solutions, Microchip Technology has them available today. of USB designs using 8-, 16- or 32-bit MCUs
We offer 8-, 16- and 32-bit MCUs with USB connectivity, providing easy starting at only $59.98
migration with a single development environment. This maximizes
pin compatibility and seamless code migration from 20 to 100 pins,
enabling you to scale your USB design with ease.
www.microchip.com/usb
AUG08 - NewProducts.qxd 7/9/2008 2:07 PM Page 34
■ HARDWARE
T S
34 August 2008
AUG08 - NewProducts.qxd 7/9/2008 2:08 PM Page 35
■ H A R D W A R E ■ S O F T W A R E ■ G A D G E T S ■ T O O L S
PROPELLER
PROTO BOARD
USB TEXT
August 2008 35
AUG08 - NewProducts.qxd 7/9/2008 2:11 PM Page 36
■ H A R D W A R E ■ S O F T W A R E ■ G A D G E T S ■ T O O L S
FULL FEATURED a keyboard for rapid entry of including sine, square, pulse, triangle,
waveform parameters, are among ramp, sine (x) x, exponential up, and
FUNCTION the advanced, cost-effective features exponential down, plus noise;
GENERATORS of the new Protek Model B8040FD,
1 µHz-40 MHz DDS function
provides AM, FM, PM, FSK, ASK,
and PSK modulation and bursts of up
SHOWCASE
PP:KLWH
ZDWHUFOHDU
/('9
PFG
$%
VHFRQGYRLFHUHFRUGHUSOD\EDFNPRGXOH
SUHDVVHPEOHG $
7KH9HOOHPDQ3HUVRQDO6FRSH
LVDFRPSOHWH06VSRUWDEOH
oscilloscope. (HPS10) $146.
QGV
7KRXVD
L WH P VRQ
PRUH
E LWH
V
RXUZH
36 August 2008
AUG08 - NewProducts.qxd 7/9/2008 5:56 PM Page 37
■ H A R D W A R E ■ S O F T W A R E ■ G A D G E T S ■ T O O L S
waveforms. In addition, it has a built- models: the B8003FD, with a 1 µHz at $599. All units have the same
in 100 MHz frequency counter and to 3 MHz frequency range at $387; features and functions as the
an RS-232 interface. All these fea- the B8010FC, with a 1 µHz to 10 MHz “flagship” model, except for
tures are available at a cost-saving frequency frequency ranges.
user price of $778. range at $484;
This instrument heads the firm’s and the B8020 For more information, contact:
Series B8000FD series of dual output FD, with a Protek Test and
DDS function generators which also 1 µHz to Measurement
include three (3) “lower frequency” 20 MHz range Web: www.protektest.com
SHOWCASE
Coming Soon!
A Social Networking Site for
You, the Electronics
Enthusiast!
www.solderbynumbers.com
.com
Www.electronicdesignmexico.com
August 2008 37
Gravatt.qxd 7/9/2008 2:17 PM Page 38
●●●●
MODEL TRAIN SWITCH CONTROL
VIA PC OR PIC
BY DAN GRAVATT
38 August 2008
Gravatt.qxd 7/9/2008 2:18 PM Page 39
of the voltage on a coil does not change the track QuickBASIC on CD and don’t even know it; it can be
switch’s position and, in fact, the manual electrical found on the Windows 98SE installation disk in the direc-
controllers that come with the track switches use tory D:\tools\oldmsdos. Running QuickBASIC in a DOS
low-voltage AC. A momentary current pulse is applied to window under Windows 98SE, I had no problem writing
one or the other of the coils to make the track switch data to the printer port LPT1 using the command “OUT
change position. Unlike an electromechanical relay, &h378” where “378” is the hexadecimal address of LPT1.
no current is required to hold the track switch in If you use other programming environments or operating
position; continuously energizing either coil will cause it systems, make sure they allow you to write data directly
to burn out. to LPT1 without interference.
A second type of track switch — known as a The software performs three tasks. First, after
slow-motion or “tortoise” switch — uses a small DC motor prompting you to power-up the circuit, all track switches
and reduction gears to gradually move the track switch are reset to a known position — I arbitrarily chose “straight
from one position to the other. This type of switch is ahead.” This is done one at a time to avoid overloading
favored by modeler railroaders who want to more the power supply for the track switches. After this is
realistically simulate the movement of a real railroad finished, a table showing the track switch positions is
switch mechanism. Tortoise track switches also contain displayed along with a prompt to select a track switch to
electrical limit switches to provide feedback on the track be moved. Any time a track switch is selected, one byte
position without having to look at it — a good thing when of data is sent through LPT1 to the external decoder/driver
your model railroad is large. circuit to energize the selected coil, followed by a second
The control system I describe here is designed to byte of data to de-energize that coil. The table of track
operate snap-type track switches. However, most of the switch positions is then updated, and the software is
circuitry and code could also be applied to operating ready to move another track switch.
tortoise switches, with some modifi-
cations to the power output driver
stages. L ISTING 1
REM toggles model railroad switches using two 74HC4514 4-to-16 decoders on LPT1
PC-Based Control
System DIM switch(1 to 15) AS INTEGER
OUT &H378, 0
The PC-based control system CLS: INPUT "Power up the switch controller, then press enter", null
takes advantage of the ubiquitous PRINT: PRINT "Resetting switches, please wait..."
FOR x = 1 to 15
eight-bit parallel port, which is easily OUT &H378, x
interfaced to external TTL circuitry SLEEP 1
to operate the track switches. Any OUT &H378, 0
laptop or desktop PC will suffice switch(x) = 0
for this application, as long as its NEXT x
operating system will allow you to
Main:
directly access the printer port CLS: PRINT "Model Train Switch Control v1.0"
LPT1. Since I am not much of a PRINT
programmer, the user interface is PRINT "Switch Position Status:"
strictly bare-bones, but it could be PRINT
replaced by any custom graphical FOR x = 1 to 15
PRINT "Switch "; x; " is ";
interface you would care to write,
IF switch(x) = 0 THEN PRINT "Straight" ELSE PRINT "Turning"
as long as it follows the underlying NEXT x
principles for interfacing with the PRINT
external circuitry. INPUT "Select switch (1 through 15) to move: ", move
PC Circuit Theory outputs to go high, and they are used to drive LEDs
indicating the circuit status — green for ready and off
The decoder/driver circuit for the track switches is when active. Current limiting resistors are used between
very straightforward, consisting primarily of two the parallel port and the decoder inputs to help isolate
74HC4514 4 to 16 decoders and 30 TIP120 NPN the parallel port from the external circuitry. I found that
Darlington power transistors (Figure 2). There are two the current needed to drive the power transistors was
nearly identical halves of the circuit: one for driving all the less than one milliamp — well within the output drive
“straight ahead” coils in the track switches; and one for specification for HC TTL devices, so I omitted any
driving all the “turn” coils. (Note that only one of the 15 current limiting resistors between the decoders and
track switch driver circuits is shown in Figure 2 for clarity.) power transistors.
The four low bits of the parallel port feed one decoder’s Model railroads often include track switches at both
inputs, and the four high bits feed the other’s. The “0” ends of a track segment (such as a siding) that are
output of the decoders is not used since — for operated in parallel to allow a train to access that track
programming simplicity — the decoder’s Inhibit input is segment. The current rating of the TIP120 is more than
not controlled by the parallel port. Thus, one of the adequate to drive a pair of track switches in parallel, as
decoder outputs must be active at all times and, as stated each coil typically draws around 1A at 12 volts DC
before, the coils will burn out if continuously energized. (although this varies by manufacturer; I tested the circuit
The software’s “ready state” causes the “0” decoder using an Atlas-brand track switch). The TIP120 has a
built-in reverse-protection
diode to absorb the voltage
spikes generated as the
coils de-energize, protecting
the transistors and decoders
from damage.
The power supply
portion of the circuit is
designed to be operated
from the 20 VAC accessory
supply available on most
model railroad power
packs. Thus, no separate
power supply is necessary,
and the DC voltage
available from the bridge
rectifier (around 28 VDC)
is more than sufficient to
operate the track switch
solenoids. Current draw
from the 7805 voltage
regulator is minimal, so no
heatsink is required. The
low duty cycle of the
TIP120 transistors means
they do not need
heatsinks either.
Circuit layout and
construction is not critical,
though I would not
recommend using point-to-
point wiring. One word of
caution is in order on the
circuit’s operation: Make
sure the circuit is connected
to the PC’s parallel port
■ FIGURE 2. PC-based control and the software is running
system decoder/driver circuit. before applying power to
the circuit. This ensures
40 August 2008
Gravatt.qxd 7/9/2008 2:19 PM Page 41
LISTING 2
' Toggles model railroad switches using PIC16F876 and one 74HC4514 4-16 decoder
' HD44780-based LCD connects as follows:
' DB4-PortA.0, DB5-PortA.1, DB6-PortA.2, DB7-PortA.3, RS-PortA.4
' E-PortB.3, RW-Ground, DB0-3 No connect
' PortC.0-3 to decoder
' PortB.4 to INHIBIT pin on 74HC4514 so all 16 outputs can be used
Main:
if switch(switchnum) = 0 then LCDOUT $fe, 2, "Switch ", dec switchnum + 1, " is Straight ", $fe, $c0, "Press ENTER
to toggle "
if switch(switchnum) = 1 then LCDOUT $fe, 2, "Switch ", dec switchnum + 1, " is Turning ", $fe, $c0, "Press
ENTER to toggle "
pause 500
select case PORTB
case 243 ' up button on PortB.2, low when pressed
switchnum = switchnum + 1
if switchnum > 7 then switchnum = 0
case 245 ' down button on PortB.1, low when pressed
switchnum = switchnum - 1
if switchnum > 8 then switchnum = 7
case 246 ' enter button on PortB.0, low when pressed
if switch(switchnum) = 0 then
switch(switchnum) = 1
PORTC = switchnum
else
switch(switchnum) = 0
PORTC = switchnum + 8
endif
pulsout PortB.4, 40000
end select
goto main
PIC Software
Development
The popular Microchip
PIC16F8761 forms the heart of
this project, and flowing through
that heart is the code in Listing 2
(file available on the Nuts &
Volts website). This code
performs the same three main
tasks that the PC-based software
performs and, in addition,
monitors three switch inputs
and drives the two-line by 24-
character parallel-mode LCD.
The three pushbutton
switches making up the user
interface include an up button
to increment the track switch
number, a down button to
decrement it, and an enter
button to move the selected
track switch. All three buttons
have a repeat action when held
down, to scroll through the
track switches or cause one
switch to move repeatedly (not
very useful, but fun to watch
for a few seconds). The code
determines which switch is
pressed by checking the value
of PORTB, which represents
the state of all eight Port B I/O
lines as one value. Pins PortB.5
through PortB.7 are unused and
always high, while PortB.3 (the
enable output for the LCD) is
42 August 2008
Gravatt.qxd 7/9/2008 2:20 PM Page 43
PARTS LIST
PC-Based Control System:
ITEM DIGI-KEY P/N (except for LCD) QTY
❑ 74HC4514 four to 16 decoders MM74HC4514N-ND 2
❑ TIP120 NPN Darlington power transistors TIP120-ND 30
❑ 7805 Linear voltage regulator, TO-220 package MC7805CT-BPMS-ND 1
❑ KBL04 four amp diode bridge KBL04-E4/51GI-ND 1
❑ 1000 µF 50 volt electrolytic capacitor P5186-ND 1
❑ 10 µF 50 volt electrolytic capacitor P5178-ND 1
❑ Two amp fuse F2705-ND with 3520K-ND clips 1
❑ 1K resistors 1.0KH-ND 10
❑ Green LEDs 511-1195-ND 2
low and PortB.4 (the inhibit output for the 74HC4514 straight and turn coils, outputs 0-7 drive the straight coils
decoder) is high when the state of PORTB is being read. and outputs 8-15 drive the turn coils. When the enter
Valid values of PORTB for the SELECT CASE button is pressed, the binary value of the track switch
command correspond to PortB.3 and either PortB.0, coil to be activated is placed on PortC.0-PortC.3, and a
PortB.1, or PortB.2 being pulled low. Pressing more than PULSOUT command on PortB.4 sends a 400 millisecond
one button at a time — which might lead to unpredictable negative pulse to the 74HC4514’s Inhibit pin which
track switch movements — yields an invalid value of briefly enables the selected output. Adding a second
PORTB which is ignored. To minimize the parts count, 74HC4514 decoder with its inputs driven by
the internal Port B weak pull-ups are enabled, so no PortC.4–PortC.7 and its Inhibit pin driven by PortB.5
external pull-up resistors are needed for the three allows up to 16 track switches to be controlled, with
pushbutton switches. some minor changes to the code.
The position status of each track switch is stored in an
eight-bit array variable which is updated each time the Wrap-Up
enter button is pressed. The position status and/or
selected switch number is updated on the display with I hope that one of the approaches described here will
each pass through the main program loop. The LCDOUT inspire you to replace your old manual controllers with
command from PICBASIC PRO is used to drive the LCD, something more user-friendly. Or, for those not into model
which uses a standard HD44780 controller chip. All of railroads, I encourage you to come up with other uses for
PICBASIC PRO’s default parameters and pin assignments the circuits and code described here. Send your results to
for the LCDOUT command are used. Nuts & Volts. I’m sure the readers would enjoy them! NV
●●●●
AUDIO SPECTRUM
ANALYZER
BY LARRY CICCHINELLI
NOTE:
Circuit board artwork is available on the
Nuts & Volts website at www.nutsvolts.com.
44 August 2008
Cicchinelli.qxd 7/9/2008 3:54 PM Page 45
Attenuator circuit (Figure 3) must perform: (1) give the programmable amplification function. The three circuits
input signal a fixed 2.5V offset; and (2) present an are essentially identical except for the gain values. This
approximately 1 VRMS signal to the input of the ADC. description references the circuit of IC1.2. The values
The 2.5V offset is required because the op-amps and ADC of the feedback resistors (R10 and R11) need to be
are powered by a single supply (+5V) and will operate determined based on your specific requirements. The gain
properly only with positive input signal voltages. This of the circuit is RFB/R9 (RFB is the feedback resistor). You
circuit allows the input voltage to be symmetrical around can calculate the resistor values based on the signals you
ground. Resistors R1 and R2 form a voltage divider that want to measure and the gain required to get 1 VRMS.
allows you to measure voltages greater than what can be IC3 is an analog switch that allows you to select between
sent through the op-amp circuits. The voltage applied to two gain values for the stage by switching R11 in or
the input side of R5 needs to be symmetrical about shorting it. With the switch closed, the gain is 1 (0 db);
ground and no larger than about 1 VRMS. with the switch open, the gain is 10 (20 db). The reason
The circuit of IC1.1 gives the input signal the required the switch for R11 (IC3) looks backwards as compared to
2.5V offset by configuring the op-amp as a “follower with IC4 and IC5 is that the board was easier to lay out with
gain.” The gain is two and is set by the formula: (R4/R3) + 1. pins 1 and 2 reversed.
The reason for the gain of two is that R5 and R6 essentially These resistor values and the relay allow for the
form a divide-by-two circuit. The resistors in this circuit following attenuation/gain values: attenuation = 28:1
(R3-R6) should not be modified. Neither should the voltage (about -30db); gain = 0 db, 10 db, 20 db, 30 db, 40 db,
divider formed by R7 and R8 that develops the 2.5V and 50 db. You can also get attenuation values of -10 db
offset. The loading of R5 and R6 on the 2.5V is negligible. and -20 db by using the attenuator and the appropriate
The circuits of IC1.2 and both halves of IC2 perform a gain values. I have elected to use 1% resistor values since
46 August 2008
Cicchinelli.qxd 7/8/2008 12:59 PM Page 47
August 2008 47
Cicchinelli.qxd 7/8/2008 1:02 PM Page 48
■ FIGURE 7.
An overview of
the enclosure
wiring.
August 2008 49
Cicchinelli.qxd 7/8/2008 1:07 PM Page 50
T
his article will introduce you to the Greyhill 62P22-L4 at 22° of rotation. There are no stops and no reason why
pushbutton rotary encoder1. I will describe what it is, it cannot be rotated endlessly either clockwise or counter-
how it works, and how to integrate it into your project. clockwise. This model comes in two different rotational
A demonstration will be presented using a PIC16F84A2, torque and two different pushbutton forces; the L4 model
along with the project code written in C. is the lower torque and lower force model. (Other types
with a variety of features such as integrated joystick are
The G reyhill 6 2P22-LL 4 also available.)
This rotary encoder requires a +5 VDC supply at
I chose this device more or less at random, because 30 mA. It uses an internal LED and optical detector to
it was in stock from my favorite supplier. The shaft produce its output. The pushbutton is a mechanical
rotates with soft detents, and can be pressed in as a contact type and requires a few milliseconds to debounce
pushbutton. Each detent is (four at make and 10 at break3).
■ FIGURE 1. The encoder. The rotary encoder outputs a two bit
■ FIGURE 2. Encoder logic states. binary code on its Output A and Output
B pins. This gives four unique values,
after which the code repeats itself. Once
you know the previous and current output
values and the code sequence, you
can determine which way the shaft has
been rotated.
If you assume that Output A is the low
order bit and Output B is the high order
bit, when rotated clockwise the encoder
outputs 0, 1, 3, 2. When rotated counter-
clockwise, the output is 0, 2, 3, 1. (There is,
52 August 2008
Botner.qxd 7/9/2008 1:59 PM Page 53
of course, no reason why the bit order could not Pin Description
be reversed and the output sequence changed
correspondingly.) 1 Supply (+5 VDC through a 150 ohm resistor)
2 Ground
To produce a number in the sequence shown, place
3 Output B
Outputs A and B in a byte in working storage like this:
4 Output A
bit 7 bit 0 5 Pushbutton
0 0 0 0 0 0 B A
6 Pushbutton
At startup, the program must read the encoder value, ■ TABLE 1
since it could output any of its four values. The value is
■ FIGURE 3.
saved in memory as the previous value. The encoder is
then polled until the value changes. Comparing the
What C an I D o Pin numbers
previous value and current value to the sequence 0, 1, 3, With I t? viewed from
the top.
2, you can tell which way the shaft has been rotated and The obvious use of the
act accordingly. Then the current value is saved as the encoder is for the clockwise rotation to
previous value and polling continues. signal an “up” type event, the counter-
Note that the encoder outputs require pullup resistors. clockwise rotation “down,” and the
In my demonstration example, I use the internal pullups pushbutton to signal some kind of
available at port B of the PIC16F84A for the encoder and request or mode selection. For example, let’s say you are
the pushbutton. Otherwise, 10K resistors to the +5V designing a programmable thermostat with an LCD
supply are recommended. readout. You want it to control either a furnace or air
The pushbutton is debounced and read like any conditioner, so it has three states: cool, heat, and off. You
pushbutton. According to the specifications, the longest could use up and down buttons for the temperature, and
settle time is 10 milliseconds — which is pretty fast — so a three position switch for the state. Or, you could use
your code can be responsive to button presses. an encoder. Rotating the shaft raises or lowers the
Finally, the encoder supply pin requires a 150 ohm temperature setting. Pressing the button changes the
resistor between it and the +5V supply. The encoder’s mode, activating a menu which allows you to select heat,
pinouts are shown in Table 1. cool, or off (by rotating the shaft). Pressing the button
■ FIGURE 4.
Demo project
schematic.
August 2008 53
Botner.qxd 7/9/2008 2:01 PM Page 54
again returns the unit to run mode. resistors are not needed. The PIC uses a 3.58 MHz crystal
This is a very simple thermostat, but it is now easy to oscillator, but any crystal up to the maximum frequency
extend the design with more features, taking advantage supported by the PIC is okay, as long as the timer0
of the flexibility of the encoder and LCD display. You interval parameters are adjusted accordingly. J1 is used for
can add a clock and time of day programs; you can set in-circuit Flash programming (I use a Pickit24) and is not
the clock; you can add a fan on/off function; and so on, required for operation. The buzzer and the LED display
without having to add any more hardware to your design. are connected to the remaining I/O pins configured as
Another application is a power controller, possibly to outputs. (If you don’t want to bother with a buzzer, just
control the temperature of a soldering iron. The pulse replace it with an LED and 470 ohm limiting resistor.) U2
width modulation feature of many microcontrollers is provides regulated five volts so that a battery or wall wart
ideal for power control of a resistive load, with the help can be used to power the project.
of a power MOSFET. The device could have a one or
two digit LED display showing the power level, and a The S oftware
rotary encoder to turn the heat up or down. The
encoder’s pushbutton could be used as an on/off The hardware design of microcontroller projects is
switch. (In fact, the power would always be on to the deceptively simple, because so much of the work is done
microcontroller, but turning the unit off instructs the in the software. Polling for input events is a major task,
processor to set the output power level to zero and which must be carefully coordinated with the other work
disable the LED display.) being done by the processor. Improper or poor design
If you add hardware debouncing to the pushbutton may result in input events being missed or responded to
and connect it to an external interrupt pin, a press of the sluggishly. The way I manage this problem is to use the PIC’s
button can be used to put the microcontroller into sleep timer to do all the input polling and switch debouncing. It
mode and the interrupt caused by another press used to then posts event flags to the foreground code, which is
wake it up. Battery operated applications would benefit free to respond to events as they occur.
from the decreased power consumption when the unit This architecture works well when an event signals an
was off. action that can be processed quickly. I do this for my
encoder inputs, where I am incrementing or decrementing
The D emonstration P roject the display. Other kinds of events that require time to
perform can be more difficult to handle. For my button
This simple project uses a PIC16F84A to manage a press, I want to sound the buzzer for a period of time, but
rotary encoder as input and a single digit LED display and I do not want to tie up the main code with a long delay.
buzzer as output. On power up, ‘0’ is displayed. Rotate In this case, the solution is to sound the buzzer in
the encoder clockwise, and the number is incremented to response to the button press, and then schedule an event
9, then back to zero again. Rotate counter-clockwise and to turn the buzzer off later (conveniently done in our
the display becomes ‘9’ and decrements down to 0. timer interrupt routine). The benefit is no time-wasting
Pressing the encoder pushbutton makes the buzzer sound. delay loops at all in the program.
The rotary encoder S1 is interfaced to U1 with three To see how the rotary encoder is managed in the
I/O pins configured as inputs. The port B internal pullups software, have a look at encoder_demo.c and
are used for each PORTB input port, so external pullup encoder_demo.h in the downloads available on the
Nuts & Volts website at
■ Project top. www.nutsvolts.com.
2) An interrupt handling
function isr (PICC) or interrupt
(BoostC) is provided to handle
■ Project bottom. timer0 interrupts. The choice of
54 August 2008
Botner.qxd 7/9/2008 2:02 PM Page 55
August 2008 55
Fell.qxd 7/9/2008 1:26 PM Page 56
I
first converted a car to purely low cost, traditionally lead-acid motor can take the car only about
electric operation in 1999 and batteries the range is severely limited one mile at less than 31 mph.
after several improvements — and a long, cross-country run must I wanted to reduce the fuel
particularly to the battery pack — the be planned like a military campaign. consumption of the Prius from 60
car was moderately successful. I was There must be charging points every mpg to 100 mpg — a massive cost
generally able to travel about 50 50 miles or so, and you need to stop savings — by the addition of a large
miles on a charge and considerably for a couple of hours at each to Li-Ion pack. This article described
more if care was taken. The car restore some charge. how I achieved this using E-blocks
completed the London to Brighton In 2005, I started looking at the and Flowcode from Matrix
Electric Vehicle (EV) Run in 2005 hybrid cars that were available and Multimedia as a control system.
and 2006. the Toyota Prius in particular. The
Unfortunately, the achilles heel of interesting thing about the Prius How It Works
the EV is still the battery pack. With was that it could run for a limited
period as an EV, however with the Figure 1 shows how the Toyota
■ FIGURE 1. The basic topology NiMH battery pack the electric Prius works. Essentially, it is a normal
of the Prius drive system.
car with the addition of an electric
motor/generator in the drive train.
When the driver needs to slow down,
the brake pedal puts the ‘motor’ into
generator mode which charges the
battery up. Conversely, at low speeds
the motor is used to assist the
conventional petrol engine which
decreases fuel consumption.
When I started the project, a few
groups in the US were experimenting
with supplementary battery packs to
increase the range of the Prius. The
Toyota — along with most modern
cars — has a very complex electronic
control system. The part that deals
with drive and battery management
uses CANbus for communication.
The operation of the drive among
56 August 2008
Fell.qxd 7/9/2008 1:30 PM Page 57
other things is based on the State Of outside source — the second battery! Circuit Details
Charge (SOC) of the battery pack. The second problem was how to
If the SOC is low, the management control this external charging source. I was lucky enough to have
system will recharge when The control system needed to be acquired a set of 56 Thunder Sky
descending a hill, braking, or use any such that the existing batteries’ SOC Li-Ion cells which I could use as a
surplus energy from the engine. If the could be manipulated so that the second battery. These are connected
SOC is high, then the battery pack Toyota management system saw a in series to give a resulting DC voltage
will be used to drive the car at low high SOC and used the battery instead of around 210V and more than 50
speed or to supplement the engine of the engine wherever possible. Ah. The Toyota’s NiMh battery
when driving, climbing hills, or The first problem was simple. I produces around 240V DC, so I
overtaking. In practice, the SOC connected my EV charger across the knew that I would need an inverter
is moving about the entire time, Toyota battery pack and charged the to allow the additional battery pack
dependent upon traffic and pack. The SOC increased up to fully to charge the Toyota’s own battery.
driving patterns. charged (about 80% SOC). The I also wanted to be able to recharge
I saw two main problems in battery manager took into account the Li-Ion batteries overnight, so I
adding a large battery pack in parallel the pack temperature and voltage, needed a recharge circuit. I needed a
with the existing battery. The first was and computed the SOC quite circuit to control the flow of charge
what would the reaction be from the happily. Solving the second problem into the Prius’ own battery, as well.
Toyota management system if — out — transferring energy to the You can see the circuit in Figure 2.
of the blue — the existing battery Toyota’s battery — was the main
started receiving charge from an area of work. ■ FIGURE 2. Block schematic
of the system.
August 2008 57
Fell.qxd 7/9/2008 2:39 PM Page 58
August 2008 59
Fell.qxd 7/9/2008 1:41 PM Page 60
■ FIGURE 9. A close-up of the Prius display showing the 99.9 mpg achieved.
References
Elektor February 2006 Easy CAN
Microchip www.microchip.com
Plug-in Prius Wiki group at: www.eaa-phev.org/wiki/Main_Page
Follow links to plug-in hybrids, then Prius.
The E-blocks Easy CAN bus pack includes a copy of Flowcode, two
PICmicro multiprogrammers, two CAN bus boards, an LCD display,
switch board, LED boards, and accessories.
60 August 2008
Pardue.qxd 7/9/2008 3:29 PM Page 61
by Joe Pardue
rted n
this
ow with are
Get sta e’s book & kit at
Jo
series! in our websto m
available
tsvolts.c o
re
Introducing the AVR C
PART 1:
www.nu
Programming Workshop Series
C
programming and micro- difference is that their book is They are specific-purpose languages
controllers are two big topics, machine independent and gives lots that work only on specific micro-
practically continental in size, of examples based on manipulating processors. C is a general-purpose
and like continents, are easy to get text, while these workshops are programming language that can work
lost in. Combining the two is a little machine dependent, specifically based on any microprocessor that has a
like traipsing from Alaska to Tierra del on the AVR microcontroller, and the C compiler written for it.
Fuego. Chances are you’ll get totally examples are as microcontroller C abstracts the concepts of what
lost and if the natives don’t eat you, oriented as I can make them. a computer does and provides a text
your infected blisters will make you based logical and readable way to
want to sit and pout. I’ve been down Why C? get computers to do what computers
this road so many times that I do. Once you learn C, you can move
probably have my own personal rut Back in the dark ages of easily between microcontroller
etched in the metaphorical soil, and microprocessors, software families, write software much faster,
I can point to the sharp rocks I’ve development was done exclusively and create code that is much easier
stepped on, the branches that have in the specific assembly language of to understand and maintain.
whacked me in the face, and the the specific device. These assembly
bushes from which the predators languages were character based Why AVR?
leapt. If you get the image of a ‘mnemonic’ substitutions for the
raggedy bum stumbling through the numerical machine language codes. There are many excellent micro-
jungle, you’ve got me right. Consider Instead of writing something like: controller families out there, but I
these workshops a combination 0x12 0x07 0xA4 0x8F to get the chose the AVR because — among
roadmap, guidebook, and emergency device to load a value into a memory many reasons — it was designed with
first aid kit for your journey into this location, you could write something the C programming language in
fascinating, but sometimes dangerous like: MOV 22, MYBUFFER+7. mind, has Flash memory that can be
world. The assembler would translate configured with a bootloader (more
I highly recommend that you that statement into the machine on all this later), and has the best
get the book The C Programming language for you. user forum I’ve ever used: www.avr
Language — Second Edition by I’ve written code in machine freaks.net.
Kernighan and Ritchie, here after language (as a learning experiment) The AVR is fast, cheap, in-circuit
referred to as K&R. Dennis Ritchie and believe me when I tell you
(Figure 1) wrote C, and his book is that assembly language is ■ FIGURE 1. C being invented.
the definitive source on all things C. a major step up in
In Figure 1, Ritchie (inventor of productivity. But a device’s
the C programming language) stands assembly language is tied
next to Ken Thompson, original to the device and the way
inventor of Unix, designing the the device works.
original Unix operating system at Bell Assembly languages are
Labs on a PDP-11. hard to master and
I have chosen to follow that become obsolete for you
book’s organization structure in this the moment you change
series of workshops. The main microcontroller families.
August 2008 61
Pardue.qxd 7/8/2008 11:56 AM Page 62
programmable, and development hallelujah and amen. (Agreed! -Ed.) kind of a jet plane ride over the
software can be had for FREE (really territory.
free, not crippled or limited in any Workshop Goals
way). I’ve paid thousands of dollars for Quick Start Guide for
development boards, programming What I hope to accomplish with the AVR Learning
devices, and C compilers for the this series is to help you learn SOME
other micros, but never again — I like C programming on A SPECIFIC
Platform
free. The hardware used in these microcontroller and provide you
workshops — the Atmel AVR Butterfly with enough foundation knowledge Software
— can be modified with a few that you can go off on your own AVR Studio — FREE and darn well
components to turn it into a decent somewhat prepared to tackle the worth it.
learning system and the needed many kinds of microcontrollers and AVR Studio is provided free by
components can be had for less than C programming systems that infest the good folks at Atmel Corporation,
$40. You can’t get a better learning the planet. who seem to understand that the
system for 10 times this price and Both C programming and more helpful free stuff they give
you can pay 100 times this and not microcontrollers are best learned developers, the more they will sell
get as good. while doing projects. I’ve tried to their microcontrollers. Actually, this
You will often stumble across provide projects that enhance the software could cost hundreds and
arguments on the Internet as to learning process, but I’ve got to still be darn well worth it, but unless
which microcontroller or admit that some of the projects are you just really like Norway, don’t
programming language is the ‘best.’ pretty lame and are put in mainly send them any money; they’ll get
People take sides and soon a to help you learn C syntax and theirs on the backend when you start
religious war breaks out. I don’t want methods. buying thousands of AVRs for your
to enter that fray, so I’ll just say that I know how easy it is to get next great invention. The workshop
the AVR is the best microcontroller bogged down in all the detail and is based on version 4.14 and if you
and C is the best programming lose momentum on this journey, so use a newer version you may find
language and if you don’t believe we’ll begin with a quick start guide differences in it and our discussions.
me, you are bound for perdition — and learn just enough to get our You can find AVRStudio at
learning platform tools working — www.atmel.com under the AVR
■ FIGURE 2. Developer Terminal. Tools & Software section: http://
atmel.com/dyn/products/tools_card.
asp?tool_id=2725).
Developer Terminal
Figure 2 shows the PC terminal
we will use to communicate with
the AVR in our workshop. You can
get the terminal installer and related
documents from www.smiley
micros.com. The source code in
C# and Visual Basic .NET for this
terminal is discussed in detail in the
book Virtual Serial Port Cookbook
(by me) and is available from
www.smileymicros.com and
Nuts & Volts (www.nutsvolts.com).
62 August 2008
Pardue.qxd 7/8/2008 11:57 AM Page 63
SMILEY’S WORKSHOP ☺
Hardware ■ FIGURE 3.
It is simply amazing what the The Butterfly
Butterfly has built in: front.
Butterfly++ Mini-Kit
Construction
The Butterfly provides an
excellent learning platform, but it
can be even better with a few extra
parts that Smiley Micros supplies in
■ FIGURE 8.
Close-up of power
connections.
64 August 2008
Pardue.qxd 7/8/2008 11:59 AM Page 65
SMILEY’S WORKSHOP ☺
Bill of Materials ITEM Supplier/PN
ITEM Supplier/PN ■ 3” Wire AWG 22 Jameco/36792
■ AVR Butterfly Digi-Key/ATAVRBFLY ■ 2.2K ohm Jameco/690742CG
■ CdS LDR Digi-Key/PDV-P9005-1 ■ Two-AA Bat. Box Jameco/216119CG
■ Two 2x5-pin header Digi-Key/S7108 ■ DB-9 Female Ctr. Circuit Specialists/DE-09S
■ Four-pin header Digi-Key/S71035 ■ Green LED Circuit Specialists/
■ Two-pin header Digi-Key/S71037 BAG-GREEN3MM
working okay by two methods. side of the AVR Learning Platform We’ll write our first C program
A simple test is to turn the power off and learn about the AVRStudio IDE and create a set of Cylon Eyes in
on the Butterfly and then WITH THE and the WinAVR C compiler toolset. hardware. NV
JOYSTICK BUTTON PRESSED TO
THE CENTER, turn the power back
on. Now each time you press the
joystick button to the center, you The Standard for checking Locate shorted or leaky
should see a series of question marks Capacitors in-circuit components or conditions
(???????) in the Simple Terminal Good enough to be the to the exact spot in-circuit
receive window. This is the Butterfly choice of Panasonic, Still cutting up the pcb,
bootloader wondering what the heck Pioneer, NBC, ABC, Ford, and unsoldering every
is going on. JVC, NASA and thousands part trying to guess at
of independent service where the short is?
Another test is to turn the
technicians. $209
Butterfly on and click the joystick up
to get the LCD scrolling. Move the Inexpensive enough to pay for itself in just Your DVM shows the same shorted reading all
joystick straight down three times till one day’s repairs. At $209, it’s affordable. along the pcb trace. LeakSeeker 82B has the
you see ‘Name,’ then move the resolution to find the defective component.
joystick to the right twice till you see And with a 60 day trial period, satisfaction Touch pads along the trace, and LeakSeeker
‘Enter name.’ Move the joystick guaranteed or money-back policy, the only beeps highest in pitch at the defect’s pad. Now
straight down once and you will see thing you can lose is all the time you’re you can locate a shorted part only a quarter of
‘Download name,’ then push down currently spending on trying to repair all an inch away from a good part. Short can be
those dogs you’ve given up on. from 0 to 150 ohms
the joystick center for a moment until
you see ‘Waiting for input.’ CapAnalyzer 88A LeakSeeker 82B
In Developer Terminal, make Available at your distributor, or call 561-487-6103
sure the ‘Send Text: Immediate’ radio
Electronic Design Specialists www.eds-inc.com
button is checked. Type in your
name, then in the ‘Send HEX
Immediate’ dropdown box, select
and click on 0x0D that tells the
Butterfly you are finished sending
characters. Your name should appear
on the LCD.
This isn’t easy and there are
many opportunities to mess up along
the way. Many folks get this going
right away, but others seem to have
fits getting over this hurdle, so I’ve
provided a Workshop 1 Supplement:
Problems Communicating with the
Butterfly (on www.nutsvolts.com) to
help you get past this point. Trust me,
if you see the ????? or get your name
scrolling on the LCD, you are over
a major hump and subsequent
workshops will be easier to get going
than this step.
Well, that was a lot and we
haven’t really gotten started yet. Next
month, we will look at the software
August 2008 65
ElectronetAUG08.qxd 7/9/2008 8:14 PM Page 66
Hobby Engineering
Kits, Parts, Tools and Books
www.HobbyEngineering.com
ALL
QUALITY Parts
FAST Shipping
ELECTRONICS
DISCOUNT Pricing
CALL, WRITE, FAX or E-MAIL
for a FREE 96 page catalog.
C O R P O R A T I O N Outside the U.S.A. send $3.00 postage.
75W HALOGEN FLOOD LAMP 12 VDC AUDIO ALERT IR RECEIVER MODULE FOR
Philips # 75PAR30L/ Medium-loud high-pitched audio REMOTE CONTROL
HAL/FL40. 120V 75W alert signal. Operates on 12Vdc TSOP2138YA. Miniaturized
PAR 30 halogen flood (6-14Vdc). Plastic assembly receiver for infrared remote
lamp. Standard 0.84" diameter x 0.51" high. control systems. Photo detector
medium screw base.
3.75" diameter.
940 Lumen output.
PC pins on 0.6" centers.
CAT# SBZ-201 1
$ 25
each
and preamplifier in one package.
The epoxy package is designed as
an IR filter. The demodulated output signal
2000 hour life. 3V LITHIUM COIN CELL can be directly decoded by a microprocessor.
Individually boxed.
CAT# HF-75 3
$ 75
each
15 for
$3.50 ea. WITH SOLDER TABS
Sanyo CR2016 3V 75mA coin
Carrier frequency 38 kHz. The module is part
of a plastic assembly for right-angle pc
mounting and is easily separated from the
MOTOROLA "HANDS FREE" cell with surface-mount solder
HEADSET
Made by
tabs. Can be easily soldered to
wires. Cell is 0.79" diameter x 0.07" thick.
Battery circumference is protected with PVC
assembly.
CAT# PCM-1
BNC FEMALE BREAKOUT TO
2 for
1
$ 00
Motorola this insulation. CAT# LBAT-51
comfortable MICRO-MINI-HOOKS
hands-free
headset provides
great sound quality
60 ¢
each
10 for 50¢ each
50 for 40¢ each Mueller # BU-5214-A-4-0.
BNC female to micro-
mini-grabbers.
on both ends of the conversation. 18 VOLT 1.4 AMP Rating
The earpiece lays on the ear, TRANSFORMER 300 VRMS
outside of the ear canal, eliminating
the discomfort associated with in-ear
headsets. Standard 2.5mm stereo phone plug
works on many cell phones and
18 Volt 1.4 Amp
transformer.
Removed from
5 Amps. Red and black leads.
CAT# MTC-6 6
$ 75
each
MINI OPTICAL SCROLL MOUSE
cordless home phones.
CAT# PHN-39
$ 006
each
new equipment.
Wire leads (primary) are
2" long. Secondary
solder terminals have solder on them.
Miniature optical mouse is ideal
for use with laptop
12V 1A CHARGER FOR computers. Plugs
2" x 2.45" x 2.10" high. Mounting holes on into USB port.
LEAD-ACID BATTERIES 2.9" centers.
Input: AC 100-240 V
50/60 Hz.
Output: 12Vdc
CAT# TX-1814
4
$ 85
each
Works on a variety of
surfaces. Provides
more precise control
1 Amp Max.
24 VDC 6.5A POWER SUPPLY than touch pads. Small (about half the size of
a standard mouse) and portable.
Charging Voltage:
13.8Vdc. Float charge
Voltage: 14.8Vdc.
Potrans #FS-15024-1M
ITE Power Supply
Input: 100-120V 4A
CAT# MSE-15
8
$ 75
each
MANUFACTURERS - We Purchase EXCESS INVENTORIES... Call, Write, E-MAIL or Fax YOUR LIST.
August 2008 67
PersonalRobotics.qxd 7/8/2008 11:12 AM Page 68
■ BY VERN GRANER
PERSONAL ROBOTICS
UNDERSTANDING, DESIGNING & CONSTRUCTING ROBOTS & ROBOTIC SYSTEMS
DORKBOT
People Doing Weird Things With Electricity
SO, YOU’VE BEEN WORKING ON YOUR electronic masterpiece for a few weeks
(months?) and it’s finally finished, so ... now what? Where can you go to show
off your little beauty, the
child of your imagination,
the fruits of your labor?
How about Dorkbot?
PERSONAL ROBOTICS
■ FIGURE 2. Dorkbot
Austin at Cafe Mundi.
have been privately
organized and funded,
some have been
sponsored by such big
names as South by
Southwest (SXSW),
Make Magazine, Amaze
Entertainment, and the
International Game
Developers Association
(IGDA) (Figure 3).
Due to the nature
of a Dorkbot event, the
main facilitators have
changed as new folks become the current Dorkbot Austin crew of
interested and some of the early Rodney Gibbs, Luke Iseman, Chase
movers and shakers have moved on Hammock, and Nick Pietraniec have
to other projects. Though David stepped in to make sure the event
Nunez and Rich LeGrand are no lives on. ■ FIGURE 3. Dorkbot poster by Noel
longer working with Dorkbot Austin, I did get a moment to chat with Waggener; subculturepress.com.
70 August 2008
PersonalRobotics.qxd 7/8/2008 11:28 AM Page 71
PERSONAL ROBOTICS
■ FIGURE 6. RoboSpinArt
demo board for software ■ FIGURE 7. Vern Graner glues a servo ■ FIGURE 8. Kym Graner operating the
development and proof of motor back on the RoboSpinArt demo RoboSpinArt machine at Dorkbot.
concept testing. board moments before show time. (Photo by James Delaney.)
beverages being consumed (which been a wonderful venue for The such as the RoboSpinArt machine
certainly adds to the festive nature of Robot Group to test out and (Nuts & Volts, January ‘08) and
the event!) and kids running around demonstrate some of our newest the Power Flowers (Nuts & Volts,
having fun and beeping/zapping/ designs. It has provided a sympathetic July ‘08).
blinking things everywhere (Figure 5). and knowledgeable audience for The first time I presented a
At the Austin shows I’ve attended, some of our more notable projects concept project, all I had to show
the “master of chaos” David Nunez
was usually scampering about trying Q&A ABOUT SELF-ORGANIZATION: DORKBOT
to make sure the next presenter was
ready to go, introducing each new AN INTERVIEW WITH DOUGLAS REPETTO
segment, and generally making sure “I generally try to stress that each also run many (but not all) of the
everyone has what they need and Dorkbot is autonomous and some of mailing lists from the server. Other
them are quite different in form and than that shared web resource, each
has a good time.
spirit from one another. So, it’s difficult Dorkbot is more or less completely
In addition to being just a heck to make very general, overriding autonomous. Very early on when
of a lot of fun to attend, Dorkbot has statements. Of course, journalists live there were just three or four
for general, overriding statements, so Dorkbots, I decided that the best thing
■ PHOTO 4. A Gameboy SP powers sometimes it’s a hopeless cause ...”
a small LEGO-based robot. to do would be to give up any
—Douglas Repetto, Dorkbot creator control I might have over the other
organizations. At first, I was worried
What are the aims of the project you about other people using the name in
are involved in? ways I didn’t like, or organizing
Dorkbot has only a motto: meetings in ways I didn’t agree with,
“People doing strange things with but I quickly realized that if I really
electricity.” Different groups have wanted to be inclusive I would have
interpreted the motto in different to let go and let other people find
ways. When I thought of the motto, their own way. We have a Dorkbot-
I purposely made it broad and overlords mailing list, and we
inclusive so that it would interest exchange occasional messages
many different kinds of people doing between the various people who run
different kinds of things. Artists, all the different Dorkbots around the
inventors, scientists, engineers. The world. But even that is very low
exciting thing to me is to learn about volume. I think that the main thing
strange things that creative people that has given Dorkbot an identity
are doing around the world, with no of sorts is the website and the motto.
regard for genre, style, school of People see that it is not super
thought, area of expertise, etc. self-serious. That it is informal and
friendly. That it is about creativity.
How is the project organized? I think that is enough.
It is mostly dis-organized. We
have a server at the Computer The above interview excerpt courtesy
Music Center at Columbia University of “Pixelache 2008 Helsinki.” To read the
(where I work). That hosts many of the rest of the interview, point your web
Dorkbot websites (but not all). We browser to ttp://tinyurl.com/3sewrq.
August 2008 71
PersonalRobotics.qxd 7/8/2008 11:30 AM Page 72
■ PHOTO 7. A ceramic, wood, ■ PHOTO 8. “Gator Girl” animatronic ■ PHOTO 9. Paul Atkinson checks out
and light bulb sculpture by sculpture in aluminum by Brooks Coleman. the POV display at Dorkbot SXSW.
Denise Scioli. (Photo by James Delaney.)
72 August 2008
PersonalRobotics.qxd 7/9/2008 11:56 AM Page 73
PERSONAL ROBOTICS
■ PHOTO 10. Bob Comers robot made ■ PHOTO 11. Sami Graner interacts ■ PHOTO 12. The Ping Pong Printer
from PVC pipe and recycled “kiddie car” with a “Biomechanical” by “Professor with its new ball-feed hopper
motors and wheels. Conrad” (a.k.a., Marvin Niebuhr). by Rick Abbot.
version of “show and tell.” You would think this Dorkbot Austin, look around for me there.
free-form method of (non? dis?) organization would Otherwise, you can always reach me via email
lead to chaos, but every Dorkbot I’ve attended has run at vern@txis.com if you have any questions or
surprisingly smooth. comments. NV
If this sounds like something you’d like to do, but
there isn’t a Dorkbot scheduled in your city, you can start I’d like to say a special thank you and goodbye to one of the
founders of Dorkbot Austin, David Nunez. A good friend and long
your own Dorkbot. All you need to do is send an email time collaborator with The Robot Group, we wish him Favorable
to Douglas Repetto (his email address is on the main Chance and Deity Velocity in his endeavors out east!
Dorkbot.org website). He’ll set you up with a mailing list
and a link on the main site, and you’re off! If there is a
Dorkbot near you, you should make a point of at least Extreme Robot Speed Control!
attending if not signing up to present something. What
better way to meet folks than to stand up before a small
idewinder 6
6
14V - 50V - Dual 80A H-bridges - 150A+ Peak!
Adjustable current limiting
crowd of other tech geeks just like yourself and talk about S 6
6
Temperature limiting
Three R/C inputs - serial option
your project? 6
6
Many mixing options - Flipped Bot Input
Rugged extruded Aluminum case
I’d like to close this month by thanking everyone who $399 6 4.25" x 3.23" x 1.1”
OSMC
$2
3AMPLE PRICE
PLUS 3(
WWWFRONTPANELEXPRESSCOM
s Co Mot
r
ete
s or xis erom
3-A cel ntr or
n
Se
Ac 9.95
$1 oll
ers
R
QT ce 4.9
5
c t an 9
.4 $1
fle $3 y
rra !
Re sor TReX Jr
Se
n o
s n
en -se
r A sing Robot Controllers Dual Motor
e S line Controller:
c r voltage dual H-bridge
tan fo Instantly switches
f lec r e a t regulator trimmer pot between radio control
Re G (on ADC7) (RC) or analog voltage and
R
QT power LED asynchronous serial (RS-232
(green) or TTL), plus a multitude of
Solder Paste Stencils red user LED
additional features. $59.95
Use our low-cost
solder paste stencils
From $25 (on PD1)
programming
to quickly assemble
your surface-mount
ATmega48/168
microcontroller
connector Custom Laser Cutting
designs. 20 MHz clock From $25
Baby Orangutan B-48 and B-168
starting at $24.95
Founding Sponsor
,
CONFERENCE&EXPO 08
NOV. 18-19, 2008 Gold Sponsor
SANTA CLARA, CA
Silver Sponsors
Join the International Technical Design and Development
Event for the Personal, Service, & Mobile Robotics Industry
EXCLUSIVE OFFER:
USE PRIORITY CODE RDNAV AND
SAVE $300 ON A CONFERENCE PASS
WWW.ROBODEVELOPMENT.COM Q 800-305-0634 BOSTON
ENGINEERING™
For Information on
Sponsorship and
Exhibiting
Opportunities,
contact
Ellen Cotton at
ecotton@ehpub.com
or 508-663-1500 x240
OpenComm.qxd 7/7/2008 4:33 PM Page 76
O P E N C O M M U N I C AT I O N
The goal is to create wearable wireless of this standard that will carry the
BLUETOOTH PROFILES devices in watches, running shoes, and Bluetooth protocol and profiles but
DEFINE THE medical monitoring devices. Many of with the ability to transmit at rates up
APPLICATIONS the newer Bluetooth chips contain to the 480 Mb/s range over short
the standard Bluetooth transceiver in distances. The Bluetooth version
The Bluetooth standard defines not addition to a low power (LP) transceiver. will operate above 6 GHz and is
only the radio interface just described expected to be available in 2009.
but also a comprehensive data trans-
mission protocol. The protocol spells out
HIGHER SPEED VERSION
how the data is packaged into packets, OF BLUETOOTH WILL USE BLUETOOTH TEAMS UP
transmitted, and received. It is a flexible ULTRA WIDEBAND (UWB) WITH WI-FI TO BOOST
protocol that can be adapted to almost DATA RATES
any type of data. The protocol is The fastest version of Bluetooth
implemented in a software stack that is called EDR and can transmit at a The Bluetooth UWB effort is
defines the sequence of operations. rate up to 3 Mb/s. That is fast on-going but in the meantime, the
While designers are free to create their enough for most audio and low Bluetooth SIG has adopted another
own application on top of the Bluetooth speed applications and that rate has way to speed up some transmissions.
protocol, it is a difficult process. certainly not limited Bluetooth’s Specifically, it has created a way to
To make Bluetooth more attractive adoption. But for faster data transfers let the Bluetooth protocol and
to a wider range of applications, the SIG like downloading photos from a profiles operate over a Wi-Fi radio if
has developed a wide range of Profiles. digital camera or transmitting video, present. Wi-Fi is the wireless local
These are special software packages a faster radio technology is needed. area network (WLAN) standard of
designed to implement the most popular Recently, the Bluetooth SIG the IEEE, also known as 802.11. It is
applications. The Profiles define the adopted the WiMedia ultra wideband available in several versions: a, b, g,
applications. Among the Profiles (UWB) radio technology. This and n. Bluetooth radios will
available are one for cell phone headset, wireless standard developed by the incorporate what is called a generic
wireless headphones, wireless printer WiMedia Alliance can transmit data alternate MAC/PHY. MAC means
to PC connections, human interface at a rate to 480 Mb/s over several media access control and PHY
devices (keyboards, mouse, etc.), meters. It uses orthogonal frequency means physical layer interface. The
automotive hands-free kits, cordless division multiplexing (OFDM) in the MAC part of the radio defines how
phones, fax machine links, video 3.1 to 4.7 GHz range. Its main use the data is packaged and transmitted
streaming, and a whole bunch of oth- so far has been a very successful while the PHY defines the radio
ers. The Profiles speed up and simplify wireless USB cable replacement. The interface like RF and modulation. This
the application development and help Bluetooth SIG is developing a version alternate MAC/PHY will be able to
ensure compatibility of similar products.
One popular application is the use of ■ FIGURE 1. The Cambridge Silicon Radio BlueCore7 is the lates generation of
Bluetooth in the hand controllers for Bluetooth transceivers designed for cell phones and other applications. The chip
the Nintendo Wii game console. itself is a tiny 3.2 x 3.6 mm. It contains four separate radios as depicted in the
diagram, a conventional FM receiver with RDS, a GPS satellite navigation receiver,
a low power Bluetooth transceiver, and a standard Bluetooth transceiver with EDR.
LOW POWER VERSION
OF BLUETOOTH NOW
AVAILABLE
A couple of years ago, Nokia — the
leading cell phone maker — developed
a low power wireless technology similar
to Bluetooth. Nokia joined with several
other companies to develop this tech-
nology into a standard. It was called
WiBree and a consortium was founded.
Last year, the WiBree group merged
with the Bluetooth SIG to further
develop this method. It uses a simpler
version of Bluetooth to significantly
cut operating power so that wireless
devices can be operated from coin
batteries like those in wrist watches.
August 2008 77
OpenComm.qxd 7/7/2008 4:34 PM Page 78
dynamically select either the Bluetooth out there. Most of the short-range to adopt these technologies to sup-
radio or the Wi-Fi radio based on the technologies are competitive with port Bluetooth in some applications.
need for faster transmission, or not. one another in some way. Yet even So you can almost write off Wi-Fi and
with the competition, Bluetooth has UWB as competition. That leaves
carved out a healthy niche, if you can ZigBee as the only clear competitor.
BLUETOOTH IS call billions of units sold a niche. ZigBee is that technology
SUCCESSFUL DESPITE Bluetooth had a head start on most developed around the IEEE 802.15.4
THE COMPETITION of the other technologies and that is standard that targets industrial
partially the reason Bluetooth is so control, building monitoring and
If you follow the wireless field at well entrenched. While Bluetooth control, remote meter reading, and
all, you know that there are many applications may overlap a bit with other applications where sensor
other wireless standards and methods Wi-Fi and UWB, the SIG was smart outputs are observed and used to
initiate controls or record the data.
It uses very low power so a ZigBee
transceiver can operate for months
or even years on a coin battery.
ZigBee’s big claim to fame is its
ability to form mesh networks among
hundreds of radio nodes. While
Bluetooth has some limited network-
ing capability, it was not designed for
mesh networks. So, while the two
technologies may butt heads in a few
applications, for the most part each
has its own sphere of uses.
The only other short-range
technology that may come close to
Bluetooth in volume is ISM band
radios that operate in the 315, 433,
and 915 MHz range. These are used
in garage door openers, remote
keyless entry devices for vehicles,
tire pressure monitoring, remote
thermometers, and toys. These
devices are usually much simpler
so do not need the sophisticated
protocol of Bluetooth.
WHO MAKES
BLUETOOTH CHIPS?
NEW! HIDmaker FS for Full Speed FLASH PIC18F4550
Creates complete PC and Peripheral Both PC and Peripheral programs As I mentioned earlier, the
programs that talk to each other over understand your data items (even odd leading Bluetooth chip company is
USB. Ready to compile and run! sized ones), and give you convenient Cambridge Silicon Radio (CSR). They
• Large data Reports variables to handle them. were one of the first vendors and
• 64,000 bytes/sec per Interface PIC18F Compilers: PICBASIC Pro, they still maintain a wide lead over
• Easily creates devices with multiple MPASM, C18, Hi-Tech C. the others. Other Bluetooth chip
Interfaces, even multiple Identities! companies are Broadcom and Texas
• Automatically does MULTITASKING PIC16C Compilers: PICBASIC Pro,
• Makes standard or special USB HID MPASM, Hi-Tech C, CCS C. Instruments. Figure 1 shows CSR’s
devices latest transceiver chip which
NEW! “Developers Guide for USB HID PC Compilers: Delphi, C++ Builder, incorporates the latest Bluetooth EDR
Peripherals” shows you how to make Visual Basic 6.
radio, a low power transceiver, a GPS
devices for special requirements. HIDmaker FS Combo: Only $599.95 satellite navigation receiver, and a
standard FM radio all in one. It is
DOWNLOAD the HIDmaker FS Test Drive today! expected that this chip will save lots
www.TraceSystemsInc.com of space and power when built into
301-262-0300 cell phones. NV
78 August 2008
DesignCycle.qxd 7/7/2008 4:11 PM Page 79
THE DESIGN
ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
CYCLE
■ BY FRED EADY
y guitar amp and stereo projects became clocked registers. FPGA logic is rooted in LUTs (Look-Up
M transistorized. I even started to wonder about what
was inside of those “magical” calculators. As I transitioned
Tables) such as the one you see in Figure 1. Basically,
we can configure the LUT to be any type of logic gate
from teen to adult, building stereo equipment and guitar with up to four inputs. The clock signal in Figure 1 would
amps gave way to transistor and IC-based logic projects. normally be provided by the FPGA’s internal clock
The transition was complete. Well, not quite. routing system. Depending on our desired logical
These days, my guitar amplifiers are all tube-based. function, the LUT infrastructure allows us to pass our logic
However, I’m still “solid-state” when it comes to logic. In output through the D flip-flop for registered operation
past Design Cycle columns, we’ve explored the nuances or bypass the D flip-flop for an unregistered output
of many a microcontroller. We have also recently delved operation.
into the world of CPLDs. It’s time to move up another step The power of the LUT comes in numbers. The FPGA
on the logic food chain. In this installment of Design fabric allows for interconnection of a large number of
Cycle, we are going to tackle the FPGA. LUTs. Using the FPGA’s internal interconnection fabric
allows us to combine the logic contained within a large
number of LUTs to generate complex logical operations.
FPGA 101 In this spin of Design Cycle, we will be basing our
FPGA is short for Field Programmable Gate Array. FPGA designs on Xilinx FPGAs. Thus, the generic concept
In reality, an FPGA is actually a programmable solderless of a LUT is similar to what Xilinx calls a CLB (Configurable
breadboard populated with interconnectable logic blocks. Logic Block). A CLB is made up of function generators,
An FPGA differs from a CPLD (Complex Programmable registers, and reprogrammable routing controls. Equating a
Logic Device) in that the FPGA contains
considerably more logic gates. Also, an
FPGA may contain memory and high-level
embedded building blocks such as adders
and multipliers. OUTPUT
CPLD logic is based on sum-of-product
logic arrays that interconnect and feed
PROGRAMMABLE
TO FPGA LOGIC
DELAY
I/O PIN
PROGRAMMABLE
TO FPGA LOGIC
DELAY
CLOCK
website. Let’s begin by directing our attention to the bank Bank 0 = pins 109 – 144
of LEDs on the starter kit printed circuit board (PCB). We’ll Bank 1 = pins 73 – 108
write a bit of Verilog code to instruct the FPGA to do Bank 2 = pins 37 – 72
something constructive with the LEDs and slide switches Bank 3 = pins 1 – 36
I’ve captured in Photo 3.
That works out to a bank being a complete side of
the square FPGA package you see in Photo 1. If you
TURNING ON THE LIGHTS WITH VERILOG orient pin 1 of the 50A in the upper left corner (looking
Most of you already know how to program down onto the legend side of the FPGA IC), Bank 0
microcontrollers and personal computers in Basic or C. consists of the pins along the top pin row of the FPGA.
For you C and Basic programmers, picking up Verilog will The successive FPGA banks flow in a clockwise direction
be effortless. However, since making assumptions turns with Bank 1 being made up of the right-hand pin column
me into a donkey, I will approach Verilog as if all of you of the 50A. Bank 2 runs along the bottom row of the
know little to nothing about C, Basic, or Verilog. FPGA and Bank 3 is positioned in the left-hand column
I’ve pulled the LED and slide switch area from the of pins opposite to Bank 1. Believe it or not, the same
schematic and transplanted them into Schematic 1. The banking scheme is applied to the 700A BGA package
700A is packaged in a BGA (ball grid array) package, with ball A1 oriented in the upper left corner and ball
which explains the alphanumeric FPGA pin identifiers AB22 in the bottom right corner.
(W21, Y22, etc.). Since we’re taking hardware pointers One must understand the basic I/O principles of a
from the Spartan-3A starter kit, I’ll point out that all of the microcontroller before being able to code more complex
LED FPGA I/O pins are located in Bank 1 of the 700A. I/O-oriented tasks. The same holds true for FPGAs. So,
The reason for this is that Spartan-3A FPGAs allow up to let’s write some Verilog code that will mirror the slide
24 mA of drive current from I/O pins located in Bank 1 switch positions in the LED bank. A slide switch is in the
and Bank 3. “ON” position when the slide switch common terminal
Banks 0 and 2 are only able to supply a presents a logical high to the FPGA. Conversely, the slide
maximum of 16 mA of drive current. The slide switches switch “OFF” state is represented by a logical low at the
are also strategically pinned to the 700A. All of the slide FPGA input pin. We’ll illuminate the corresponding LED
switches are pinned to dedicated FPGA input pins located when a slide switch is “ON.”
in Bank 2. From the perspective of our targeted 50A, Verilog is based on modules. Verilog modules use
here’s how the FPGA bank pins fall out: ports as I/O mechanisms. The arguments associated
with a module are contained in the port list,
which follows the name of the module in the
3V3IO
SW0 R133 390 LED7 module declaration. Consider this Verilog
W21 code snippet:
V8
lot like C to me. As we add more Verilog source, you’ll output wire led3_out
notice the minimal use of braces ({}). Verilog likes to );
replace braces we use so often in C with begin and end
always @(sw0_in,sw1_in,sw2_in,sw3_in)
statements. Braces do have a place in the Verilog scheme begin
of things as Verilog employs braces to concatenate and if(sw0_in)
replicate. led0_out = 1;
Our slide_to_led code won’t do much in its current else
state. Since we want to control the LEDs with the led0_out = 0;
slide switches, the most logical Verilog code would look // if/else code for rest of switches goes here
like this: end
endmodule
module slide_to_led(
input sw0_in,
input sw1_in,
input sw2_in, Verilog uses the data type wire to connect modules
input sw3_in, and gates. Think of a Verilog wire just as you would a
output led0_out, piece of wire in one of your electronic projects. I
output led1_out, added the Verilog wire data type into our Verilog module
output led2_out,
output led3_out manually for illustrative purposes as Verilog defaults
); all of the module arguments to the data type of wire.
Verilog wires can only be read/driven by a continuous
always @(sw0_in,sw1_in,sw2_in,sw3_in) assignment statement or tied to an input or output of a
begin
if(sw0_in) module or gate. Thus, we can’t write a logical “1” or
led0_out = 1; logical “0” directly to led0_out as we attempted to do
else in our Verilog module code because led0_out is a
led0_out = 0; Verilog wire.
// if/else code for rest of switches goes here
The fix for our faulty Verilog module is simple:
end
endmodule module slide_to_led(
input wire sw0_in,
input wire sw1_in,
Naturally, we would include the appropriate if/else input wire sw2_in,
statements to cover all of the rest of the LEDs and slide input wire sw3_in,
switches. The Verilog if/else statements are just like their C output reg led0_out,
counterparts with the exception of the C braces, which output reg led1_out,
are replaced by Verilog begin and end operators when the output reg led2_out,
need arises. The good old do/while(1) loop-forever C code output reg led3_out
);
has been replaced here by the Verilog always @ loop
code. Everything between begin and end inside of the always @(sw0_in,sw1_in,sw2_in,sw3_in)
always loop is executed every time one of the slide switch begin
logic levels is changed. In other words, a Verilog always if(sw0_in)
loop runs freely and triggers on the arguments in the led0_out = 1;
else
sensitivity list. In our case, the logic levels of the slide
led0_out = 0;
switches make up our always @ sensitivity list. There are
times when you can run a Verilog always loop without a // if/else code for rest of switches goes here
sensitivity list. Doing a plain vanilla always loop is just like end
running a never-ending while(1) C loop. endmodule
After all of that typing, we would find that this code
doesn’t work. The key to writing some working code The Verilog data type reg is short for register. Verilog
lies behind understanding what Verilog is doing to us registers are able to hold their values from procedure to
here. Here’s what the code really looks like under the procedure. We can also read them and write them. Don’t
Verilog covers: get too cozy with the concept of a Verilog register being a
piece of silicon as reg is a Verilog data type just like a
module slide_to_led( Verilog wire. All we really care about is how, when, and
input wire sw0_in, where to use regs and wires best.
input wire sw1_in, Now would be a good time to show you how
input wire sw2_in, continuous assignment works. Let’s use our original
input wire sw3_in,
output wire led0_out,
default-to-wire module code and add some Verilog
output wire led1_out, assignment code to handle getting the slide switch states
output wire led2_out, out to the LEDs:
August 2008 83
DesignCycle.qxd 7/7/2008 4:13 PM Page 84
assign led0_out = led0; To double-check our scan rate math, let’s compute
assign led1_out = led1; the period of 11.92 Hz and take a snapshot of the scan
assign led2_out = led2;
assign led3_out = led3;
rate with a CleverScope:
■ SCREENSHOT 1. I captured
this waveform on the LED0
anode. As you can see,
our scan rate math is confirmed
on both sides of the center
of the waveform.
USB Programmer for PIC® MCUs LAB-X Experimenter Boards BASIC Compilers for PICmicro®
Pre-Assembled Board Easy-To-Use BASIC Commands
$89.95 (as shown)
Available for 8, 14, 18, 28, Windows 98/Me/2K/XP/Vista
RoHS and 40-pin PIC® MCUs
2-line, 20-char LCD Module PICBASIC™ Compiler $99.95
Compliant
9-pin Serial Port BASIC Stamp 1 Compatible
Programs PIC Sample Programs Supports most 14-bit Core PICs
MCUs including Built-In Serial Comm Commands
Full Schematic Diagram
low-voltage (3.3V)
devices Pricing from $79.95 to $349.95 PICBASIC PRO™ Compiler $249.95
Supports most PICmicro® MCU Families
Includes Direct Access to Internal Registers
Software for
Windows With Accessories for $119.95: PICPROTO™ Prototyping Boards Supports In-Line Assembly Language
98, Me, NT, Includes Programmer, Software, USB Cable, Interrupts in PICBASIC and Assembly
XP, and Vista. and Programming Adapter for 8 to 40-pin DIP.
Double-Sided with Plate-Thru Holes Built-In USB, I2C, RS-232 and More
Circuitry for Power Supply and Clock Source Level Debugging
Large Prototype Area
EPIC™ Parallel Boards Available for Most PIC® MCUs See our full range of products, including
Port Programmer Documentation and Schematic books, accessories, and components at:
starting at $59.95 Pricing from $8.95 to $19.95 www.melabs.com
August 2008 85
Classifieds Aug08.qxd 7/9/2008 4:17 PM Page 86
CLASSIFIEDS
COMPONENTS CONNECTORS/WIRE/CABLE
T The RF Connection
C Silver Teflon PL-259/Gold Pin, $1.00
H
E R O
N
213 N. Frederick Ave., Ste. 11NV
N or 10/$9.00
F E
C
Gaithersburg, MD USA 20877
T
I
O Call for Specials of the Month
Nhttp://www.therfc.com/
Full Line of Audio Connectors for Icom,
Complete Selection of MIL-Spec Coax, Kenwood, and Yaesu
RF Connectors and Relays 8 Pin Mike Female $2.50
UG-21B/U N Male for RG-213/214 .$5.00 8 Pin Mike Male Panel $2.50
UG-21D/U N Male for RG-213/214 .$3.25 13 Pin DIN for Kenwood $2.75
N Connectors for 9913/Flexi4XL/9096 8 Pin DIN for Icom $1.00
uM-FPU V3.1 UG-21B/9913 .....$6.00 / Pins Only......$1.50 8 Pin DIN for Kenwood $1.50
UG-21D/9913 ..$4.00 / Extra Gasket.$0.75 Prices Do Not Include Shipping
Floating Point Coprocessor UG-176/U Reducer RG-59/8X, $0.25 Prices subject to change without notice.
32-bit IEEE 754 or 5/$1.00 Orders 800-783-2666
SPI or I2C UG-175/U Reducer RG-58/58A, $0.25 Info 301-840-5477
DIP-18, SOIC-18 or 5/$1.00 FAX 301-869-3680
Fast – Easy to Use
Extensive floating point support,
GPS input, FFT, 12-bit A/D, matrix BOOKS
operations, user-defined functions.
www.micromegacorp.com
%RRNV
3,&0LFURFRQWUROOHU
VTFRP
6WHSSHU0RWRUV HARDWARE
VWHSSHUVWXIIFRP
WANTED
&1&
FQFLQWURFRP DEC EQUIPMENT
WANTED!!!
Digital Equipment Corp.
and compatibles.
Buy - Sell - Trade
OSCILLOSCOPES CALL KEYWAYS 937-847-2300
or email buyer@keyways.com
Bargain Test Gear ! +D\GHQ,'86$
Portable, benchtop 25Mhz 100MS/s
022
2-ch color LCD Scope. Download
5 waveforms via USB1.1 to PC. 7.8"
PDS 640 x 480 Color LCD 3.5lbs.
Volt/Time Automatic Measurement
Peak-to-peak Value, Average,
RMS, Frequency and Cycle. FREE
1x/10x probes, USB cable. Compare
with expensive LCD scopes!
PDS5022S $325!
SPI Bus Analyzer - SPI protocol SECURITY
ess exerciser and analyzer for
Xpr standard SPI and non-standard
SPI 4-wire and 3-wire serial protocol
interfaces up to 50 Mbps. PC
control via free GUI Control
Panel Software. SPI sniffer,
chip-to-chip emulation.
SATELLITE $9.95!
CLASSIFIEDS
AUDIO/VIDEO MICROCONTROLLERS PCB SOFTWARE
YOUR COMPLETE
SOLUTION!
• PCB Design
• PCB Simulation
MicroStamp11 KITS/PLANS • CAD/CAM Menu
World’s Smallest 68HC11
Microcontroller Module! 121747, Hobby Vers., $175
telemetry
z 121743, Pro. Version, $275
microrobotics
z
smart toys
z
animatronics
z
www.KELVIN.com
model railroading
z
home automation
z
www.technologicalarts.com
Toll-free (USA & Canada):
1-877-963-8996
Visa • MasterCard • Discover • Amex
LCDs/DISPLAYS GADGETS
ELECTRONICS
Beginner's Guide to Embedding Troubleshooting and Repairing Build Your Own Electronics
t C Programs Major Appliances: 2nd Edition Workshop
B e sl e r by Eric Kleinert By Thomas Petruzzellis
Se l
by Chuck Hellebuyck
The C language has been covered in many Now covering both YOUR DREAM ELECTRONICS LAB
books but none as dedicated to the gas and electric IS WAITING INSIDE!
embedded microcontroller beginner. appliances, the This value-packed
Through his down-to- updated second resource provides
earth style of writing, edition of everything needed
Chuck Hellebuyck Troubleshooting and to put together a
delivers a step-by-step Repairing Major fully functioning
introduction to learning Appliances offers you
how to program micro- home electronics
a complete guide to workshop! From
controllers with the C the latest tools,
language. In addition, he finding space to
uses a powerful C techniques, and parts stocking it with
compiler that the reader for troubleshooting and repairing any appli- components to put-
can download for free in ance. Packed with over 200 illustrations, ting the shop into
a series of hands-on projects with sample the book includes step-by-step procedures action — building, testing, and trou-
code so you can learn right along with him. for testing and replacing parts, instructions bleshooting systems — popular electronics
For the hardware, he found the best low for reading wiring diagrams, charts with author Tom Petruzzellis’ Build Your Own
cost but effective development starter kit troubleshooting solutions, advice on using Electronics Workshop has it all! And the best
that includes a PIC16F690 microcontroller tools and test meters, safety techniques, part is, this book will save you money, big
and everything else the beginner needs to and more. $59.95* time! Reg $29.95 Sale Price $24.95
program and develop embedded designs.
$39.95
Programming and Customizing Getting Started in Electronics Electronics: A First Course
the PICAXE Microcontroller Second Edition
by Forrest M. Mims III Bes
by David Lincoln Author Forrest Mims teaches you the S e l l t by Owen Bishop
Here’s everything you basics, takes you on a e r Electronics: First Course
tour of analog and digital starts with the basics of
need to harness the electricity and component
power of PICAXE, components, explains
how they work, and types, and introduces
the inexpensive yet students to practical work
versatile chip that’s shows you how they are
combined for various almost straightaway. No
taken the electronics prior knowledge of
community by storm. applications. Includes
circuit assembly tips and electronics is assumed. The
This beginner-friendly second edition now has
guide from IT pro and 100 electronic circuits
and projects you can additional applicability to BTEC First
PICAXE expert David Electronics from Edexcel with coverage of
Lincoln shows you build and test. Forrest M. Mims, III, has
written dozens of books, hundreds of fundamental topics required by students of
just what Revolution Education’s PICAXE this qualification, as well as other essential
can do — and helps you make it do it! articles, invented scientific devices, and
loves to share his knowledge with eager new topics that reflect recent technological
Packed with ready-to-build projects for all
students! $19.95 developments.$ $36.95
the flavors of PICAXE.. $39.95
88 August 2008
NVWebstoreAug08.qxd 7/9/2008 5:10 PM Page 89
August 2008 89
NVWebstoreAug08.qxd 7/9/2008 5:12 PM Page 90
Digital LED Conversion Kit Switching Regulator Kit Voice Changer Kit
Need to regulate your
power output? Take a look
at this new and improved
regulator. For more infor-
mation, please check out
your June 2008 issue or
go to our webstore @
www.nutsvolts.com Have fun with the whole family with this
200% More Efficient Subscriber’s Price $29.95 project. Put your newly changed robotic
Turn all your old style bulb Non-Subscriber’s Price $32.95
flashlights into bright, five voice on your outgoing phone message, or
Kit includes an article reprint.
LED, energy efficient, use it on those annoying telemarketers!
4.5 VDC digital flashlights. PCBs can be bought separately. For more information, please check
For more information, out your May 2008 issue
go to our website @ Subscriber’s Price $39.95
www.nutsvolts.com
Without Flashlight Housing Non-Subscriber’s Price $45.95
As seen on the $22.49 PCBs can be bought separately.
February 2008
cover With Flashlight Housing $ 20.95*
$25.95 Both include an article reprint.
Both include an article reprint.
Garage Door Alarm Kit The Amateur Scientist 3.0 H.V.P.S. Kit
The Complete Collection
by Bright Science, LLC
There are 1,000
projects on this
CD, not to mention
the additional
technical info and
bonus features. It As seen on the
As seen in the doesn’t matter if April 2008 cover
November 2007 you’re a complete It’s fun to collect and experiment with
issue novice looking to forgotten technology!
do their first But, you’ll need a stable high voltage
Have you ever laid in bed and power supply to get started.
science fair project
wondered ... is the garage door open?
Get more info @ or a super For more info, go to the Nuts & Volts Webstore
tech-head gadget www.nutsvolts.com
www.nutsvolts.com
Subscriber’s Price $49.95 freak; there are enough projects on the sin-
KIT Subscriber’s Price $49.45
Non-Subscriber’s Price $57.45 gle CD-ROM to keep you and 50 of your
Kit includes article reprint, complete instructions, parts friends busy for a lifetime! $26.99
Non-Subscriber’s Price $54.95
list, and hole drilling templates. Both include an article reprint.
90 August 2008
WE ACCEPT VISA, MC, AMEX, and DISCOVER. Prices do not include shipping and may be subject to change.
NVWebstoreAug08.qxd 7/9/2008 4:45 PM Page 91
August 2008 91
ReadFeed Aug08.qxd 7/9/2008 4:12 PM Page 92
less bandwidth, don't send all the sync verb, why not “edict”?) all broadcast
info. H/V sync in the analog signal takes TV stations to have digital over-the-air
up about 20% of the bandwidth. In the programing. These are on other
digital world, all that can take up one frequencies from their VHF/UHF
byte. Saved a bunch of space there!!! programing. The MIGLIA tuner outputs
Do some creative compression, data on USB 2.0 and came with a driver
processing, error correction, remove package called eyeTV2. Unfortunately,
parts of the image people won't notice, the password issued for the tuner
and before you know it you have restricts the driver to only access the
squeezed that digital signal into less USB port, even though there are other
space than the analog one. drivers provided which may have made
I get tired of everyone saying that the Firewire port available for input,
the digital signal is better — it’s not all and thus the STB viewable.
the time. I would tell people if they There are channels from my STB
thought that, then they had not seen a that I cannot get from local broadcasters
really good analog signal! If you take a that I wish to view with my setup. I can
good look at a digital TV picture, you only assume that the STB must utilize
will see lots of picture faults. Most a standard protocol if it is to be
people don't notice these faults and the compatible with any TV set that has a
broadcast companies can get away with Firewire input. There are discussions
it. If, in the past, a broadcast company on line about recording from STBs, my
broadcast a picture with as many only interest is to view. Please, do you
impairments as in the digital picture, have any advice?
their phones would be ringing off the Thanks in advance for your most
hook. Thank you for your time. kind consideration.
Donovan Stenger Tall Henning
Broadcast Technologist
Response: You have quite a nice
setup there. While Firewire has been
TRYING TO TUNE IN around for a while, it’s not in common
Apparently I always have things use to connect home theater equipment.
backwards! If the advertisers are to be The Scientific Atlanta “Explorer”
believed, the whole world wants to 3250HD you have specifies the Firewire
watch video on their iPod, iPhone, or connectors as “reserved for future use.”
laptop. Apple even comes out with iTV Depending upon which of the two main
figuring people's monitors to be smaller software OS your box is running, these
than the wide screen TVs they are sure connectors may someday be active.
to own. Not me! Until then, I think you will have to find
I have an Apple 30” Cinema another way to hook up your STB.
Display connected to a 2 GHz dual I assume you are using your Mac
G5 running Mac OSX 10.4.x Thanks as the hub, probably hoping to let it
to iDVD, I can watch DVDs on this, perform DVR functions. If not, I would
but the problem came with trying to suggest replacing the STB with a unit
watch cable TV. that has DVI or HDMI output. You
When I upgraded from analog to could use a DVI switch (perhaps
digital cable service from Time/Warner, w/remote control) to toggle between
I insisted on a set top box E/W a the computer and STB. And you could
Firewire® output. After connecting have a DVR in the STB as well (for a
everything together, the G5 reports fee, of course).
seeing the Scientific Atlanta “Explorer” Probably not what you wanted
3250HD STB at the Firewire input, but to hear, but unless you want to go
refuses to T anything with it. shopping for a new STB (cable
In the interim, I have opted to use a companies are now required by law
MIGLIA TVMini HD (now discontinued) to let you buy your own), there’s
digital over-the-air tuner. The FCC in its nothing else you can do.
infinite wisdom has edicted (if the news Jeff Mazur
readers on TV can make “impact” a Author of previous NV HDTV articles
92 August 2008
Full Page.qxd 7/9/2008 9:27 AM Page 93
August 2008 93
TechForum.qxd 7/9/2008 8:22 PM Page 94
able to help you. They are not reduce the input voltage to lower the produced by stamping and are read
inexpensive, but they are capable of high voltage level and power dissipa- only, in a 120 mm diameter x 1.2 mm
doing almost any COB assembly. tion, with a resistor in series or a lower thick format. The data begins on the
Robert Zusman voltage supply. The high voltage level inner tracks and spirals outward,
Scottsdale, AZ depends on T1 — a different T1 would allowing smaller disks (80 mm
yield a different high voltage level. You Mini-CD) and novelty shaped disks to
[#6081 - May 2008] can measure the high voltage level at be used. The read laser operates at
Has anyone adapted surplus the device under test (DUT) terminals 780 nm (infrared).
computer parts for other uses? For with nothing other than the meter Later, the same 120 mm disks
example: adapting on old sound card connected there. Tests should be brief, were adapted for computer data stor-
for use as an amplifier. If so, please tell in any event, as the meter displays the age, under the “Yellow Book”
what you did and how. Also, can some- zener voltage immediately. Standard for CD-ROMs. The “Orange
one explain the similarities and differ- Ed Schick Book” Standard further defined a
ences between audio CDs and DVDs? Harrison, NY WORM (Write Once Read Many) disk
that can be recorded by an end user
#1 The power supply in the PC can #2 While many good quality and drive — called CD-R — and a fully
be used, with just a small modification. interesting function PC parts can be read-erase-write disk called CD-RW, by
There are a number of write-ups telling recycled, it’s quite hard to make the “burning” the inner disk surface with a
you how on the web — here's one: surplus boards play outside of the PC higher power laser.
http://web2.murraystate.edu/andy. environment. This is because most — if Various speed enhancements
batts/ps/powersupply.htm not all — PC peripherals require have been made; the 1X disk spins at
You can find many uses for parts programming at start-up. Even simple approximately 200-500 RPM, and
scrounged from old PCs. devices such as audio cards require records in real time (80 mins audio or
Figure 1 is a zener tester circuit configuration from the PC’s operating 700 MB data for a complete disk),
built exclusively from parts out of a system (the “driver files” loaded to the currently 52X drives record the same
defective CRT monitor. Attach a volt OS when the cards are first installed). 700 MB of data in about 90 seconds!
meter and the zener to be tested In operation, digital commands to con- For full length movies, a higher
across the DUT terminals. The meter figure the audio paths and signal levels density 120 mm disk called DVD
measures the zener voltage on zeners are established every time the PC (Digital Versatile Disk) was added in
up to about 100 volts. The oscillator boots. It’s better to view these surplus 1997, with six times the data density
and transformer produce the high cards as a source for components, but the same physical size as the CD.
(about 100) voltage; the Q2-Q3 circuit and/or as practice for soldering rather The DVD uses a 650 nm (visible red,
limits the current to about 12 mA. The than for adaptation to other projects. same as a laser pointer) reading laser,
part numbers available from a differ- All compact discs (CDs) operate and is also available as a WORM disk
ent CRT monitor may not be the same on the same principle that was and erasable disk media. There are
— but all of them have high voltage invented by Philips and Sony in 1980 three standards in common use
transistors (needed for Q2 and Q3) and presented as the “Red Book” causing confusion. The “plus” stan-
and a suitable transformer. Power Standard. It was designed for high dard (DVD+R) can only be recorded
dissipation in Q2 can run over a watt, quality audio, using digital encoding once, unlike the “minus” standard
so you want to select Q2 from those and various error correcting schemes (DVD-R, DVD-RW) and DVD-RAM
available in the monitor for maximum to overcome fingerprints or blemishes standard. DVD-RAM is popular with
power dissipation. You can also on the disks. The disks were mass camcorders and personal video
recorders since 1998, and stores data
in concentric tracks (like a hard drive
or floppy) while CD, DVD+R, and
DVD-R use a spiral track.
The DVD disks can have data
on both sides, and are further
enhanced by “dual-layer” technology
that allows data to be stored on a
second internal layer.
The latest addition to optical
media is the Blu-Ray disk which uses a
405 nm wavelength laser — allowing a
Figure 1
six fold increase in data storage
compared to DVD. Blu-Ray (BR)
technology became the winner of the
recent high definition disk format wars
August 2008 95
TechForum.qxd 7/9/2008 8:34 PM Page 96
when Toshiba abandoned the compet- Standard Product (ASSP) like http:// [#7083 - July 2008]
ing DVD HD format is February 2008. tinyurl.com/4rbvjs. Another approach How can I interface data
Peter Stonard would involve a uC (microcontroller) collecting hardware (data loggers and
Campbell, CA — many of which have ADC real-time hardware) with Microsoft
converters and I/O for driving an LCD Excel through serial or USB ports?
[#6083 - May 2008] module on a single chip.
How can I configure a small Peter Stonard #1 There are two parts to solving
LCD display as a voltmeter and/or amp Campbell, CA this job. Communication between
meter? the PC and data loggers, and
#2 There are basically two ways this converting the data to a format that
#1 The raw LCD component is a can be done, depending upon the MS Excel understands. If the data
glass screen with the LCD liquid type of LCD display you want to use. loggers/real time hardware store the
sandwiched inside and transparent The easiest way is to use a digital data, then send it on command; a
terminals that usually connect to a panel meter (available from quite a serial terminal program (like
socket, ribbon cable, or other PCB- few N&V advertisers), LCD, or LED, Hyperterminal) with "capture to file"
friendly contacts, such as this one with a voltage divider for the volt- turned on may be used to collect the
http://tinyurl.com/4hxuv6 An LCD meter application or a shunt for the data. On the other hand, if the data
module is similar but has the driver ammeter. (Figure 2) The other way is loggers send the data as it happens,
electronics embedded on the glass. to use a microcontroller with an A/D then a specialized communication
The raw display needs the electronics converter driving a HD44780-based program is needed. This is because
to be added, and both voltage levels LCD panel. There are several books Hyperterminal isn't designed to have
and timing are critical to operate which cover this subject quite well: capture to file left on for long
the LCD — so an LCD module with Programming the PIC Microcontroller periods. For a format that MS Excel
interface electronics is preferred. with MBasic by Jack Smith is an excel- understands, I suggest CSV (Comma
Starting with an LCD module, lent starting point using Basic as the Separated Values) files. This would be
such as http://tinyurl.com/4enbco programming language and Advanced done with a program or script that
would still require additional circuits to PIC Microcontroller Projects in C by parses the raw data and creates the
scale the analog input voltage, rectify Dogan Ibrahim if you want to use C. CSV file. A USB-to-serial converter
it for AC ranges, and convert it to a PIC in Practice by D.W. Smith covers looks like a serial port, allowing
digital data stream that is decoded to this subject in assembler. Keep in terminal programs to work over USB
drive the LCD display. There are mind that the A/D converter will give connections. A data logger that has a
custom and Application Specific you a 10-bit word for most PIC USB port — instead of a serial port —
Integrated Circuits (ASIC) to do this, microcontrollers and needs to be should come with an interface
and these are built into commercial converted, which is tedious to write in program for the PC.
LCD voltmeter modules — which assembler, but is the fastest alternative. Dale Yarker
can be had for little money on There are other ways, such as using I2C via email
auction sites. or SPI A/D converters (Microchip
To build an LCD voltmeter from Technology's MCP3421 18-bit I2C A/D #2 There are several low cost
scratch would be uneconomical but or their 22-bit converter). Shareware utilities that can read data
fun for a hobbyist. A good place to Walter Heissenberger from your COM port and populate a
start is with an Application Specific Hancock, NH MS Excel spreadsheet, for example:
COMxL RS232C from Lye-tech,
http://tinyurl.com/4ac7xr
Peter Stonard
Campbell, CA
■ LOOK FOR
AMATEUR
■ SEARCH FOR
Find your favorite advertisers here!
■ FIND
Solarbotics/HVW ..................................65
MISC./SURPLUS
AD INDEX Abacom Technologies ...............51
Trace Systems, Inc. .............................78
RADIO AND TV All Electronics Corp. .............................67 ActiveWire, Inc. .........................37
Ramsey Electronics, Inc. ................22-23 XGameStation ......................................37
Front Panel Express LLC ......................74
All Electronics Corp. ..................67
WeirdStuff Warehouse .........................36
BATTERIES/ DESIGN/ AP Circuits ................................51
August 2008 97
Full Page.qxd 7/9/2008 9:30 AM Page 98
Full Page.qxd 7/9/2008 10:04 AM Page 99
CircuitSpecialists.com
FLUKE TRMS Electronic Logging Soldering Station
CircuitSpecialists.com DMM w/ TrendCapture w/Ceramic Element & Seperate
1000’s of Items Online! Solder Stand
The Fluke 287 True-rms Electronics
•Ceramic heating
1-800-528-1417 Logging Multimeter with TrendCapture
quickly documents design perform- element for more
Fax: 480-464-5824 ance and graphically displays what
happened. Its’ unique logging and
accurate temp control
•Temp control knob
Since 1971 graphing capabilities mean you no in F(392° to 896°)
& C(200° to 489°)
longer need to download logged read-
ings to a PC to detect a trend. This •3-prong grounded
item is Limited to Stock on Hand!. power cord/static safe tip Item #
•Seperate heavy duty
Item # S pecial iron stand CSI-STA
CSI-STATION1A
FLUKE 287 Purchase •Replaceable iron/easy disconnect
Limited Offer! Only $359.00! •Extra tips etc. shown at web site $39.95!
Also Available w/Digital Display &
Stepper Motors MicroProcessor Controller
&
Stepper Motor PROTEK PC Based Item #
Controllers 40/60/100MHz DSO’s CSI-STA
CSI-STATION2A
Part #: Frame Holding Torque: Price: •Bandwidth: 40, 60 or
Size: 100MHz $51.95
42BYGH404 NEMA 17 3.4kg.cm/47oz.in $16.00 •Real Time Sampling
Rate: 100MS/s
57BYGH207 NEMA 23 8kg.cm/111oz.in $21.50 •Measurements via USB
57BYGH303 NEMA 23 15kg.cm/208oz.in $25.95 interface ESD Safe CPU Controlled SMD
57BYGH405 NEMA 23 20kg.cm/277oz.in $28.90 •Includes Windows XP & Hot Air Rework Station
85BYGH450B-03 NEMA 34 48kg.in/665oz.in $68.00
Vista compatible software, Oscilloscope Probe Kit,
USB cable and User Manual The heater and air control
85BYGH450C-03 NEMA 34 63kg.cm/874oz.in $89.00 system are built-in and
Item #: Freq. Price adjusted by the simple touch
Part #: Dim: MicroStep: Price:
PROTEK DSO-2090 40MHz $279.00 of the front keypad for pre-
XCW220 100 x 61 1(200), 1/2(400), 1/4(800), $39.95
x 19mm 1/8(1600) PROTEK DSO-2150 60MHz $359.00 cise settings. Temperature
CW220 99 x 65 1/2(400), 1/8(1600) $38.90
range is from 100°C to
x 30mm PROTEK DSO-2250 100MHz $549.00 480°C / 212°F to 896°F, and
CW230 115 x 72 1(200), 1/2(400), 1/4(800), $48.50 the entire unit will enter a
x 32mm 1/8(1600), 1/16(3200), temperature drop state after 15 minutes of non-
1/32(6400), 1/64(12800) use for safety and to eliminate excessive wear.
CW250 140 x 94 1(200), 1/2(400), 1/8(1600) $54.90 Dual Output DC Bench
x 45mm
Power Supplies Only Item#
CW860 147 x 97
x 30mm
1(200), 1/2(400), 1/4(800),
1/8(1600), 1/16(3200),
$96.00
High stability digital read-out bench
$159.00! CSI825A++
1/32(6400), 1/64(12800), power supplies featuring constant
128(25600), 1/5(1000),
1/10(2000), 1/25(5000),
voltage and current outputs. Short- Our Premium All in One
circuit and current limiting protec-
1/50(10000), 1/125(25000),
tion is provided. SMT PC boards Repairing System
1/250(50000)
and a built-in cooling fan help •Combines the function of
ensure reliable performance and a Hot Air Gun, Soldering
long life. All 3 Models have a Iron and a Desoldering
Mini RF Transmitter, Receiver 1A/5VDC Fixed Output on the rear panel. Gun.
& Transceivers •Microprocessor
Item #: Price 1-4 Price 5+ controlled ESD safe unit
Ideal for setting up short range wireless links CSI3003X-5 with all digital display
$105.95 $99.50 •Desoldering tool comes
for remote control or data acquisition! 0-30V/0-3A with zero crossing
•Transmitter Module w/Power Amplify CSI5003X5 $114.95 $109.00 circuitry preventing electrical surges and equipped
•Operating supply voltage: 5-12V Only 0-50V/0-3A with air cylinder type strong suction vacuum pump.
•Frequency: 418MHz $9.95! •The 24V soldering iron is compatible with the
CSI3005X5 $119.00 $114.00 compound tip design.
•Frequency tolerance: ±300KHz Only
•Modulation: ASK/OOK 0-30V/0-3A •Uses lead-free or standard solder.
•Controlled by SAW device FREE CSI486
$249.00!
•Antenna included Item # Smoke Filter (a $27.99 value) Item#
STPA-418H-B
STPA-418H-B with the purchase of a
•Shielded Transceivers CSI-9000 CSI-9000
•Receiver Module •DATA in RF out
•Operating supply voltage: 5V •RF in DATA out
•Frequency: 418MHz •Data rate: 1.2 to
Triple Output DC Bench
•Sensitivity: -102dBm 10kbps Power Supplies
•Band wide: 3.0MHz (-3dB) •Output power: +10dBm •Output: 0-30VDC x 2 @ 3
•Sensitivity: -108dBm Only or 5 Amps & 1fixed output
Item # Only •Operating supply voltage: 5V
RXB4411S-418-RH
RXB4411S-418-RH $15.95! $19.95 @ 5VDC@3A
•Frequency: 915MHz or 2.4GHz •Stepped Current: 30mA
•Antenna included Each!
•Programmable Transceiver +/- 1mA
Only
•Operating supply voltage: $9.95!
1.8-3.6V Item #: Price 1-4 Price 5+
Item # EZ915 ( A ) 915MHz
•Frequency range: 300-928MHz and CSI3003X3 $188.00 $183.00
•Data rate: 1.2-500kbps Item # EZ2400 ( B ) 2.4GHz 0-30Vx2@3A
•Output power: -30 to +10dBm
•Programmable via SPI CSI3005XIII $249.00 $234.00
Item # 0-30Vx2@3A
•Antenna included CC1100B
CC1100B
C i r c u i t S p e c i a l i s t s , I n c . 2 2 0 S . C o u n t r y C l u b D r. , M e s a , A Z 8 5 2 1 0
P h o n e : 8 0 0 - 5 2 8 - 1 4 1 7 / 4 8 0 - 4 6 4 - 2 4 8 5 / Fa x : 4 8 0 - 4 6 4 - 5 8 2 4
backcvr.qxd 7/7/2008 10:55 AM Page 100