Documente Academic
Documente Profesional
Documente Cultură
50
CANADA
$6.50
U.S.
Vol. 31 No. 2 NUTS & VOLTS TOUCHTONE CONTROLLER • DIGITAL ALARM CLOCK • 16-BIT EXPERIMENTER February 2010
GREAT VALUE Call
educat for
io
discou nal
IN TEST & MEASUREMENT nt
350 MHZ 2 /4 CHANNEL DIGITAL OSCILLOSCOPE HMO 3522 / HMO 3524 3 GHZ SPECTRUM ANALYZER HMS 3000 / HMS 3010
1GHz:
HMS1000
HMS1010
5 4 GSa /s Real time, 50 GSa /s Random sampling, low noise flash A /D converter 5Frequency range 100 kHz…3 GHz
(reference class) 5
Amplitude measurement range -114…+ 20 dBm
5 2 MPts memory per channel, memory oom up to 100,000:1 DANL -135dBm with Preamp. Option HO3011
5 MSO (Mixed Signal Opt. HO 3508 / HO 3516) with 8 /16 logic channels 5Sweep time 20 ms…1000 s
5 Vertical sensitivity 1 mV...5 V/div. (into 1 MΩ / 50 Ω) Offset control ± 0.2...± 20 V 5
Resolution bandwidth 100 Hz…1 MHz in 1–3 steps, 200 kHz (-3 dB)
5 12 div. x-axis display range additional 200 Hz, 9 kHz, 120 kHz, 1 MHz (-6 dB)
20 div. y-axis display range with VirtualScreen function 5Spectral purity ‹ -100 dBc / Hz (@ 100 kHz)
5 Trigger modes: slope, video, pulsewidth, logic, delayed, event 5Video bandwidth 10 Hz…1 MHz in 1–3 steps
5 FFT for spectral analysis 5 Lowest noise fan 5Tracking Generator (HMS 3010) -20 dBm / 0 dBm
5 6 digit counter, Autoset, automeasurement, formula editor, ratiocursor 5Integrated AM and FM demodulator (int. speaker)
5 Crisp 6.5” TFT VGA display, LED backlight, DVI output 5Detectors: Auto-, min-, max-peak, sample, RMS, quasi-peak
PROGR. 2 / 3 /4 CHANNEL HIGH-PERFORMANCE POWER SUPPLY HMP SERIES 25 / 50 MHZ ARBITRARY FUNCTION GENERATOR HMF2525 / HMF2550
5 HMP2020: 1 x 0…32 V/0…10 A 1 x 0…5.5 V/0…5 A, max. 188 W 5 Frequency range 10 μHz...25 MHz / 50 MHz
5 HMP2030: 2 x 0…32 V/0…5 A 1 x 0…5.5 V/0…5 A, max. 188 W 5 Output voltage 5 mVpp...10 Vpp (into 50 Ω) DC Offset ±5 mV...5 V
5 HMP4030: 3 x 0...32 V/0...10 A, max. 384 W 5 Arbitrary waveform generator: 250 MSa /s, 14 Bit, 256 kPts
5 HMP4040: 4 x 0...32 V/0...10 A, max. 384 W 5 Sine, Square, Pulse, Triangle, Ramp, Arbitrary
5 188 / 384W output power realized by intelligent power management waveforms incl. standard curves (white, pink noise etc.)
5 Low residual ripple: ‹ 150 μVrms due to linear post regulators 5 Total harmonic distortion 0.04 % (f ‹ 100 kHz)
5 High setting- and read-back resolution of up to 1 mV / 0.2 mA 5 Burst, Sweep, Gating, external Trigger
5 HMP4030/HMP4040: Keypad for direct parameter entry 5 Rise time ‹ 8 ns, in pulse mode 8...500 ns variable-edge-time
5 Galvanically isolated, earth-free and short circuit protected output channels 5 Pulse mode: Frequency range 100 μHz...12.5 MHz / 25 MHz,
5 Advanced parallel- and serial operation via V/I tracking pulse width 10 ns…999 s, resolution 5 ns
5 EasyArb function for free definable V/I characteristics 5 Modulation modes AM, FM, PM, PWM, FSK (int. and ext.)
5 FuseLink: individual channel combination of electronic fuses 5 10 MHz Timebase: ± 1ppm TCXO, rear I / O BNC connector
5 Free adjustable overvoltage protection (OVP) for all outputs 5 Front USB connector: save & recall of set-ups and waveforms
5 All parameters clearly displayed via LCD/glowing buttons 5 3.5” TFT: crisp representation of the waveform and all parameters
LCR - BRIDGE HM8118 1,2 GHZ/3 GHZ RF- SYNTHESIZER HM8134-3/HM 8135
HAPRO Electronics
Tel: +1- 516 - 794 - 4080 · Fax: +1-516 - 794 -1855 · sales @ haproelectronics.com www.hameg.com
STEREO DIGITAL TO SD CARD SPEECH
ANALOG CONVERTER KIT RECORDER & PLAYER KIT
KC-5487 $90.75 plus postage & packing KC-5481 $43.50 plus postage & packing AV SIGNAL
If you listen to CDs through a DVD player, you can get sound Use this kit to store your WAV files on MMC/SD/SDHC cards. BOOSTER KIT
quality equal to the best high-end CD players with this DAC kit. It It can be used as a jukebox, a sound effects player or an
has one coaxial S/PDIF and two TOSLINK inputs to connect a expandable digital voice KC-5350 $63.50 plus postage & packing
DVD player, set-top box, DVR, computer or any other linear PCM recorder. You can use it as You may experience some signal
digital audio source. It also has stereo RCA outlets for a free-standing recorder loss when using long AV
connection to a home theatre or hi-fi amplifier. This kit requires or in conjunction with any cables. This kit will boost
some SMD soldering skills. See website for full specifications. Windows, Mac or Linux your composite, S-Video
PC. Short form kit includes and stereo audio signals,
• Short form kit with I/O, DAC and switch PCB and on-board overlay PCB, SD card preserving them for the
components only. socket and highest quality transmission to your home theatre,
• Requires: PSU (KC-5418 $11.75) electronic components. projector or large screen TV. Kit includes case, PCB, silk-
and toroidal transformer screened punched panels and all electronic components with
clear English instructions. Requires 9VAC wall adaptor.
1-800-784-0263 www.jaycar.com
Nuts & Volts 2010
February www.nutsvolts.com
Page 37
Page 26
6 February 2010
SSH Encrypted
SERIAL TO ETHERNET SOLUTIONS
Instantly network-enable
any serial device
Works out of the box -
Device P/N: SB70LC-100CR
no programming is required
Kit P/N: NNDK-SB70LC-KIT
Customize to suit any application
Device
K P
Kit P/
e P/N: SB700-EX-100CR
P/N:
N: NNDK-SB700EX-KIT
/N:
Need a custom solution?
SB700EX
2-port serial-to-Ethernet server
$129 Qty. 1000
NetBurner Serial to Ethernet
Development Kits are available to
customize any aspect of operation
with RS-232 & RS-485/422 support including web pages, data filtering, or
custom network applications. All kits
include platform hardware, ANSI C/C++
compiler, TCP/IP stack, web server, e-
mail protocols, RTOS, flash file system,
Eclipse IDE, debugger, cables and power
supply. The NetBurner Security Suite
option includes SSH v1 & v2 support.
ADVANCED TECHNOLOGY
DESTRUCTION OF THE UNIVERSE
BACK ON TRACK
s you probably know, the Large Hadron Collider
A (LCH) was created by the European Organization for
Nuclear Research (CERN, www.cern.ch) with various goals
in mind; most notably to slam opposing particle beams of
10 February 2010
T E C H K N OW L E D G EY 2 010
UPGRADES
ccording to some widely circulated statistics, a
A laptop is stolen every 53 seconds; more than
12,000 of them disappear each week from US N ew desktops
these days
airports alone, and only three percent are ever seem to be
recovered. Many software and hardware solutions mostly
are on the market — some with good success rates evolutionary
and some without — but few have that highly rather than
desirable quality of being free. One that is both revolutionary,
free of charge and has received largely positive and that includes
reviews is Prey: a lightweight application offered by the newest iMac
the Prey Project (preyproject.com). Available for models. Still, it’s
Windows, Mac OS X, and Linux, the open-source pretty nice that ■ Newest iMacs come with
21.5 or 27 inch displays.
program runs in the background and periodically you can now get
wakes up, goes online, and checks to see if it has one with a 27-inch, 2560 x 1440 pixel widescreen display that’s
been designated missing or stolen. If so, you can suitable for watching high-def movies and TV shows. Both come
sign into the Prey website and follow its with a wireless keyboard and Magic Mouse which replaces
movements using another computer. You can also mechanical buttons, scroll wheels, and scroll balls with a seamless
receive reports about what applications are multi-touch surface that allows a user to scroll through
running, files that have been modified, etc., and if documents, pan across large images, or swipe to move forward
the laptop has a built-in webcam, you may even or backward through web pages or photos. The Magic Mouse
get a picture of the thief. Prey will automatically can be configured as either a single- or two-button mouse, thus
check for open Wi-Fi access points, so you don’t resolving a long-running dispute between traditional Mac users
have to wait for the thief to make his own and those who are more accustomed to PC-style input devices.
connection. If, on the other hand, Prey doesn’t The machines start at $1,199 for a 21.5 inch model with a 3.06
detect anything unusual, it just goes back to sleep. GHz Core 2 Duo processor and ratchet up to $1,999 if you want
Obviously, it isn’t foolproof, because a wary the big screen and a quad-core processor. If you bump the 27-
machine snatcher can delete it or reformat your incher up to 16 GB of RAM and a 2 TB drive, you’re suddenly at
hard drive. Still, it’s better than nothing, and $3,649, so frills don’t come cheap. You can test price your own
remember that magic word that warms the cockles configuration at store.apple.com/us. ▲
of every cheapskate’s heart: “free.” ▲
February 2010 11
CIRCUITS AND DEVICES
NEW INK ENABLES means the industry now has the capability to print
CHEAP ELECTRONICS electronics on a wider range of materials and at a lower
cost.”
f you’re looking for a cheap way to add intelligence With the new process, circuits can be printed like any
I and/or computing power to plastics, fabrics, and other
flexible surfaces, check out the new low temperature
continuous-feed document without the need for clean
room facilities or other exotic setups. In addition, the ink
silver ink developed at the Xerox Research Centre of has been improved such that the molecules align
Canada. “For years, there’s been a global race to find a themselves in the best configuration to conduct
low cost way to manufacture plastic circuits,” said Paul electricity. Cited product applications include low cost
Smith, laboratory manager. “We’ve found the silver bullet RFID tags; lightweight, flexible e-readers; signage; sensors;
that could make things like electronic clothing and solar cells; and novelty applications including wearable
inexpensive games a reality today. This breakthrough electronics. Interested parties are encouraged to contact
Xerox for samples of the materials, including the new ink.
No specific contacts were offered, but you can always
start at www.xerox.com. ▲
THREE-AXIS GYROSCOPE IN A
SINGLE PACKAGE
pretty nifty gadget recently introduced by
A STMicroelectronics is the LYPR540AH three-axis
analog gyroscope which — in a single package —
measures angular rates along three orthogonal axes. The
sensor offers 360° detection for high precision 3D
gesture and motion recognition in mobile phones, game
controllers, personal navigation systems, and other
portable devices. If you combine it with a three-axis
accelerometer (and ST claims to have sold more than
600 million of them), the device enables the creation of
inertial measurement units (devices that track and
deliver information on the type, rate, and direction of
motion). The gyro offers two outputs for each axis: a
400-dps full-scale value for high accuracy of slow
motion and a 1,600-dps full-scale value for fast
movements. They operate in a temperature range from
-40 to 85°C and measure only 4.4 x 7.5 x 1.1 mm.
Samples are available, and the devices are priced at
$3.60 in manufacturing quantities. NV
12 February 2010
OPEN COMMUNICATION
THE LATEST IN NETWORKING AND WIRELESS TECHNOLOGIES
■ BY LOUIS E. FRENZEL W5LEF
OFDM, including both FFT and wavelet processes. This is medium. Initially, it can support data rates of over 100
the only modulation method proven to stand up to the Mb/s with a promise of 1 Gb/s in later versions. It also
noisy AC line. HPNA and MoCA use the cable TV coax used a forward error correction (FEC) method called the
that exists in most homes. It too uses OFDM. quasi-cyclic low density parity check (QC-LDPC) to
Collectively, all these standards have never achieved the improve transmission reliability. It has all sorts of other
volume level of wireless home networking with Wi-Fi. The features that make it a quality, high-end wired networking
lack of a single compatible standard is considered to be the method. For more details, go to www.homegridforum.org.
problem. So, the industry has set out to create a worldwide There are no chips or end products yet, but these
wired home networking standard that is referred to as G.hn. are in the works. It will be interesting to see what
products emerge. Or, will the existing standards continue
WELCOME TO G.HN with the potpourri of different incompatible standards?
We shall see. NV
G.hn is the short hand
designation for the International
Telecommunications Union’s (ITU)
attempt to create one world standard
that could serve everyone.
Furthermore, the goal was to The New
produce a networking technology
that would be used not only to link High-Performance Catalog
home PCs to the Internet, but also
could serve to connect home Industry’s only full-featured online catalog
entertainment devices like HDTV sets •Browse •Search •Check Stock
Sto
ock
k •B
•Buy
Buy
and DVD players, as well as be the
connection method of choice for
Internet service providers (like cable
companies with their set top boxes).
On top of that, they wanted a
standard that could be used to
connect the home electrical system
and appliances for monitoring and
control as proposed by the so-called
“smart grid” green effort by many
utilities. Figure 2 shows the vision of
the HomeGrid Forum — an
organization that supports and
promotes the G.hn standard.
The G.hn standard has been in
the works since about 2006 but it
finally emerged from a long
development period in October last
year. It is now complete enough
where the chip companies can begin
working on ICs to implement the
modems. The formal designation is
G.9960 and its companion standard
G.9972 offers up a co-existence Try It Now at www.mouser.com
mechanism that allows G.hn devices
to work with devices using other
standards. Their overall goal was to
come up with a technology that WARNING: Designing with Hot, New Products
would work over coax, twisted pair, May Cause A Time-to-Market Advantage.
Mad Blaster Warble Alarm Laser Light Show Retro Nixie Tube Clock
If you need to simply get atten- Just like the big concerts, you Genuine Nixie tubes popular in
tion, the “Mad Blaster” is the can impress your friends with the 50’s brought back in one of
answer, producing a LOUD ear your own laser light show! the neatest digital clocks around
shattering raucous racket! Super for Audio input modulates the today! Hand made teak maple base, 12/24 hour for-
car and home alarms as well. Drives laser display to your favorite music! mat, soft fade-out, auto-dim, and a crystal time base at
any speaker. Runs on 9-12VDC. Adjustable pattern & speed. Runs on 6-12VDC. 20ppm! Tube kits also available.
MB1 Mad Blaster Warble Alarm Kit $9.95 LLS1 Laser Light Show Kit $49.95 IN14TM Teak Maple Nixie Clock Kit $329.95
Air Blasting Ion Generator Tickle-Stick Shocker Speedy Speed Radar Gun
Generates negative ions along with a The kit has a pulsing 80 volt tickle Our famous Speedy radar gun
hefty blast of fresh air, all without any output and a mischievous blink- teaches you doppler effect the
noise! The steady state DC voltage ing LED. And who can resist a fun way! Digital readout dis-
generates 7.5kV DC negative at 400uA, blinking light and an unlabeled plays in MPH, KPH, or FPS. You
and that’s LOTS of ions! Includes 7 wind switch! Great fun for your desk, supply two coffee cans! Runs on
tubes for max air! Runs on 12-15VDC. “Hey, I told you not to touch!” Runs on 3-6 VDC. 12VDC or our AC125 supply.
IG7 Ion Generator Kit $64.95 TS4 Tickle Stick Kit $12.95 SG7 Speed Radar Gun Kit $69.95
A
timing circuit like an LM555 chip. The circuit of Figure 1 is
COUNT DOWN TIMER If the display shows 3:00 at start, the rather complex, but I admit
next display would be 2:59, 2:58, that I designed it faster than
Q
We play a lot of board 2:57, and so on down to 2:00 and I could have written a
games at the kitchen then 1:59, 1:58, down to 0:00, then program to do this job. A nine-volt
table. I would like to build stop. I want to be able to stop the battery does not have a lot of power
a digital timer to count timer if a person makes a word so I used CMOS chips and a liquid
down from, say 3:00 or 3:30 before the end, and be able to reset crystal display. I had not used that
minutes to 0:00, then stop. A buzzer it. I am not into PIC programming type of display before, so I
or LED would then tell that time is yet, so could you show me a circuit breadboarded it to be sure I
up. I was thinking of three buttons: using discrete parts and chips? The understood how it works. The DIP
a set button, a start button, and a power supply will be a nine-volt switches — S1, S2, and S3 — are used
stop button, plus DIP switches to battery. to set the start time. The switches are
set the start time. It would need a — Robert Cuneo weighted: 1, 2, 4, and 8, so for three
■ FIGURE 1
18 February 2010
QU E ST I O N S & A N S W E R S
Q
SETHR: I need help for
H=M+H+1
PORTC = H a project that I
PAUSE 2000
IF PORTA pin1 = 1 THEN GOTO SETHR would like to
‘REM HOLD THE H BUTTON DOWN UNTIL build. I have a
‘THE DESIRED HOUR IS REACHED
IF PORTA pin1 = 0 THEN RETURN large analog clock, (six
‘REM RELEASE THE H BUTTON TO STOP
ENDIF ‘INCREMENTING THE HOUR foot diameter) on an
GOTO SETHR ‘DOESN’T GET HERE IF PORTA pin3 = 0 outbuilding. I would like
LINE3: PAUSE 30000 REM PAUSE 30 SECONDS to have 12 red LEDs to
IF PORTA PIN2 = 1 THEN GOTO LINE3 follow the hands around
REM HOLD THE BUTTON DOWN FOR AS in steps of five minutes
REM MANY 30 SECOND INCREMENTS AS
REM YOU WANT TO CHANGE THE TIME and 12 green to step the
IF PORTA PIN2 = 0 THEN RETURN
ENDIF hours off. I would like to
END use a PICAXE 28 with
20 February 2010
QU E ST I O N S & A N S W E R S
■ FIGURE 7
74xx595 output expansion. I would up. My first attempt at a program did I have ordered a USB cable from
also need some means of setting the not work because I thought I could SparkFun and will let you know next
minutes and hours. program the B port as a port, but I month if it actually works.
— Eric Fulton can’t (dumb system). Each of the B The wire diagram is Figure 7
port outputs have to be programmed and the program is Figure 8. In
A
I can foresee a problem in individually (pain). My comments in Figure 7, I show only one of the 12
that the PICAXE frequency the program should be sufficient LED drivers to save space. The transistor
will not be exact so you explanation of how it works. I is a P-type MOSFET available from
will have to periodically planned to test it, but I was shipped a Mouser. For the hour LED driver, I
reset the time. Some feedback could nine-pin serial cable instead of the show how you would connect multiple
be done to automatically synchronize USB that was ordered and it gives an LEDs in case you want to have a
the clock and PICAXE but I am not error message “hardware not found.” cluster instead of a single LED. NV
going to be that complicated. The
74xx595 is an eight-bit shift register;
ADDRESS:
February 2010 21
What is
the missing
component?
Industry guru Forrest M. Mims III has created yet another stumper.
The Ultra Simple Sensors Company assigned its engineering staff to
design a circuit that would trigger an LED when a few millimeters
of water is present in a basement or boat. What is the water sensor
behind the puzzle piece? Go to www.Jameco.com/search5 to see if
you are correct and while you are there, sign-up for our free full
color catalog.
1-800-831-4242 | www.Jameco.com
22 February 2010
■ HARDWARE
EXPANSION OF WAVE
NEW
P R O
parameters — including advanced
D
T S
variable gain and pressing the T/div
knob will toggle between zoom
OSCILLOSCOPE and edge-to-edge measurements modes. Buttons on the front panel
SERIES between channels — the WaveAce
oscilloscope broadens the ways a
that open and close menus or switch
modes are backlit to let the user
user can understand and analyze know exactly what mode the
waveforms. Additional features such WaveAce is operating in. The 40
as Pass/Fail testing, user-definable MHz WaveAce 101 price is $695
digital filters, and a waveform while prices for the new four channel
sequence recorder simplify and models range from $1,690 to $2,790.
shorten debug time.
A new remote control command For more information, contact:
set has been implemented in the four LeCroy
channel models to make the Tel: 1-800-5LeCroy
WaveAce even more useful and Web: www.lecroy.com
February 2010 23
SHOWCASE
flexible tube inside the outer jacket and robust connectors, they are offered in
For more information, contact:
9/125, 50/125, and 62.5/125 µm sizes and custom lengths for use in a wide
range of harsh environments. JEM Electronics, Inc.
Available with SC, ST, MTRJ, FC, MU, E2000, SUS, and other connector 23 National Dr.
types, these fiber optic patch cords come in single- and multi-mode styles up to Franklin, MA 02038
500+ meters long. Insertion loss is ≤ 0.2 dB, return loss is 55 dB, and Tel: 508-520-3105
repeatability is ≤ 0.2 dB (single mode PC) and the stainless metal tube tensile Fax: 508-520-3109
strength is ≥ 20 Kgf. The firm is ITAR certified, meets ISO 9001-2008, TS16949,
Web:
and ISO13485 specifications, and are RoHS compliant. The patch cords are
priced according to size, length, and cable and connector type. Price quotations www.jemelectronics.com
24 February 2010
SHOWCASE
16-bit microcontroller
with resident BASIC
* Host on virtually any platform or OS
* 87 I/O pins, 16-channel 10-bit ADC
* No software to install
* USB or RS232
$75
or le
ss*
Easy object-based
programming using
any terminal program!
* Educational discounts available
www.soBASICsoEasy.com
http://www.NKCelectronics.com
Build This Versatile Digital
ALARM CLOCK
BY CHRIS SAVAGE
It seems that time is slipping away at an ever increasing pace.This is especially true
when we’re doing the things we enjoy. Hence the saying, “time flies when you’re
having fun.”When I was younger, I always had a watch so I’d know when it was time
to go home, go to bed, etc. As I got a little older and ventured out on my own, I
didn’t care as much about time and stopped wearing a watch altogether (the late
nights and early mornings seemed to blend in together).These days, time is more
important than ever with a family, job, appointments, and meetings. I find that I
don’t have enough devices that tell time (watch, computer, iPod, etc.). Suddenly, I
developed a fascination with timekeeping and found myself compelled to build my
own clocks and timers.The real bonus here is that once you’ve mastered keeping
time, you can do all kinds of things with it — from the way you display it, to the way
you signal specific points in time (alarms).
The Heartbeat of Time create some unique time-pieces. In the spirit of keeping it
simple and to make it easier to learn how you can build your
own clock, I will demonstrate a basic design that we have
In order to keep track of time, we’ll need a device that can been using in our house for a few years now. The three
accurately update itself, even when power is lost. For me, that clocks you see in Figure 1A, 1B, and 1C are all based on the
device is the DS1302 from Maxim Integrated Products. The same control board design. Each is unique in its appearance
DS1302 is a battery-backed, real time clock with RAM. The and also in its function to some degree. By combining the
DS1302 counts seconds, minutes, hours, date, month, day, common elements on the control board (such as the clock
and year with leap year compensation until 2100. It also contains chip, alarm amplifier, and display driver), we can keep the
31 bytes of battery-backed, general-purpose RAM. With a base programming code simple and common to all three
synchronous serial interface and wide operating voltage, the versions while having the ability to customize each clock
DS1302 is an ideal choice for both 5V and 3.3V microcontrollers. for basic things such as display and input configuration.
A B C
26 February 2010
■ FIGURE 2 - The main control board. ■ FIGURE 3 - Seven-segment display board.
display driver, a DS1302 RTC, a DS1804 digital segment displays that I got from both Jameco, as well as
potentiometer, an LM386 amplifier, and all the support from some older Parallax kits. These seem to have a
components. What it doesn’t contain is the display or common pinout and were available in green or red.
input functions. Instead, an interface is available for both When selecting the T1 LEDs to use for the colon,
the display (along the bottom of the board) and the input alarm, and AM/PM indicators, try to use an LED with a
(along the left side). This allows for further customization similar forward voltage to the seven-segment displays. This
of the display and input without having to redesign the will help ensure that the brightness is consistent, especially
control board. The eight available I/O all contain 10K when using dimming as the MAX7219 maintains current
pull-up resistors making it easy to connect switches, for the entire display. Since the LEDs are free-standing on
photocells, thermistors, or even a quadrature encoder the board, I used heat shrink tubing to block the light from
for input. the side of the displays. Colored translucent plastic was
obtained for a filter for both the red and green displays.
The Display Board Be careful when cutting this stuff. I actually cracked a few
pieces and had to get more to finish the project. There are
Figure 3 shows the display board. This board was guides available on cutting and drilling Plexiglas, so I won’t
made to connect directly to the control board either by go into that here.
connectors or wires. The mounting holes are aligned with
holes on the control board allowing you to stack it right Circuit Design
on the board (see Figure 4). Trimmed component leads
were recycled to connect the display board to the control Looking at the schematic (Figure 8), you can see the
board (see Figure 5). This concept was used for all three individual blocks for each project all broken down in their
clocks and expanded on by connecting the stacked basic components. What the schematic does not contain
boards directly to each unique enclosure (see Figure 6). In
populating the display board, I used common seven- ■ FIGURE 5. Component leads used to connect the
display board to the control board.
■ FIGURE 4. Stacked
display board.
February 2010 27
■ FIGURE 6. Display board mounted to enclosure. ■ FIGURE 7. Display board details.
are the inputs for setting time, etc. These are customizable time when the power fails.
and are slightly different on each clock. So, we’ll cover the
design of the common components. Design Pitfalls
The BASIC Stamp 2 is the brains of the operation
here. I could have used a more powerful BASIC Stamp As with any project, when you change something
model and probably would have if I had used a rotary even a little bit from what you started with, your outcome
encoder on any of these, but I decided to keep it simple. can vary significantly. This was the case during the original
The Stamp drives the display using the MAX7219 driver build of these clocks. You may have noticed in Figure 5
IC. While a little pricey, I really like this chip and find that the extra components tack-soldered on to the back of the
it greatly simplifies things, especially if your display control board. When I prototyped the design, I used the
contains more than four digits (adding seconds). The Parallax Professional Development Board — my favorite
DS1302 is on the same synchronous serial bus as the resource for Stamp prototyping. I used the on-board
MAX7219 which saves two I/O lines. The DS1804 is amplifier for testing sound output, but when I designed
used in this design to provide a volume control for the the LM386 amplifier in the circuit I first built, I used a
LM386 audio amp IC. The battery backup keeps the generic configuration. Imagine my surprise when the
alarm sounded not
only different, but had
BILL OF MATERIALS poor volume control
and range. The
QTY DESIGNATOR COMPONENT SOURCE PART #
1 PCB1 Digital Alarm Clock Control PCB ExpressPCB N/A patches were made to
1 PCB2 Digital Alarm Clock Display PCB ExpressPCB N/A attempt to correct this
1 U1 BASIC Stamp 2 Module Parallax Inc. BS2-IC and I have updated
1 U2 MAX7219 8-Digit 7-Segment Driver Digi-Key MAX7219CNG+-ND the ExpressPCB files
1 U3 DS1302 Real Time Clock w/RAM Parallax Inc. 604-00005
1 U4 DS1804 Digital Potentiometer Digi-Key DS1804-100+-ND
(available in the
1 U5 LM386 Audio Amplifier IC Digi-Key LM386N-3-ND download package at
1 VR1 LM7805 5V Voltage Regulator RadioShack 276-1770 www.nutsvolts.com)
6 D1-D6 Red T1 LED RadioShack 276-026 accordingly (so you
4 DS1-DS4 Green 7-Segment LED Display N/A * See Article Text
1 RN1 10K, 8 Bussed Jameco 857080
don’t have to do this
3 R1-R3 10K, 1/4W, 5% Parallax Inc. 150-01030 if you have a board
1 R4 1K, 1/4W, 5% Parallax Inc. 150-01020 made).
1 R5 10 ohm, Metal Oxide Parallax Inc. 150-01000
6 C1-C6 0.1 µF, 50V, 20%, Mono, Radial Parallax Inc. 200-01040
1 C7 0.01 µF, 50V, 20%, Poly, Radial Parallax Inc. 200-01031
Clock
1 C8 0.05 µF, Ceramic, Radial N/A * See Article Text Features
3 C9-C11 10 µF, 35V, Electrolytic, Radial Parallax Inc. 201-01060
1 C12 220 µF, 35V, Electrolytic, Radial RadioShack 272-1029 At first, these
1 X1 32768 Hz Crystal, 6 pF Parallax Inc. 251-03230 would seem to be
1 J1 2.1 mm Barrel Jack Digi-Key CP-202A-ND
1 J2 DB-9 Connector - Female RadioShack 276-1538 ordinary digital clocks.
1 B1 3V Lithium Battery N/A * See Article Text However, each clock
1 SP1 Speaker N/A * See Article Text has additional
0 ENC1 Project Enclosure (Optional) N/A * See Article Text features. Some are
0 ENC2 Project Enclosure (Optional) N/A * See Article Text
0 ENC3 Project Enclosure (Optional) N/A * See Article Text common to all three
clocks such as
28 February 2010
■ FIGURE 8. Overall schematic.
crescendo alarm capability, multiple alarm times, 12 or 24 subroutines that handle all the details such as
hour format, battery backup, and dimmable display. Other reading/setting the time, reading/writing to the RAM, etc.
features are unique for a particular clock or are modified
to act differently than the others. For example, the clock Parts Resources
with the translucent case uses a photo resistor to help the
clock determine if it is light or dark in the room. This data What? You don’t have that in your junk box? No
is used to adjust the brightness of the display. Another problem! I listed some sources for the components.
clock has a programmed set of times in which it brightens Everything used was something I had in my spare parts
or dims its display. These settings are stored in the cabinet. Two of the enclosures came from RadioShack.
battery-backed RAM and restored on power-up. The The translucent enclosure was purchased from a surplus
crescendo alarm capability allows the clock to start the dealer such as All Electronics, although it has been a few
alarm at the lowest volume and ramp it up as time goes years so you might need to look around. I remember
on at a rate you select. In fact, you can even change the
alarm sound ■ FIGURES 9A and 9B. Case milling and installation.
itself. There
are many
customizable
options here and
very little code
needs to be
modified to
enable these
features. The
base code
contains
A B
February 2010 29
those enclosures were available in red, clear, and blue, so good way to make use of those spare parts.
I took the red cover from one and the clear case from
another to make the clock more techie looking. During Customizing Things
prototyping, I used two AA batteries for the battery
backup, but then I found some CR2032 coin cell battery In fact, you should always feel free to experiment with
holders on eBay and bought a dozen or so. That’s what I the elements of a design. It can be just a matter of
used, so if you have the board made from ExpressPCB, aesthetics or perhaps that the speaker isn’t loud enough
remember you may need to make some changes if your for you. Just be sure you’ve tested those changes before
battery holder mounts differently or if you use a different you commit to a PCB (lest you end up having to patch
type of backup battery altogether. Please feel free to your design like I did). Of course, these three clocks have
adjust the components to what you have on hand. It’s a been running for over three years now and there is very
little I would change in the overall
design if I started over.
In a future article, I will show you
a very interesting variation on the
concepts here. A hybrid binary/
digital clock which displays the time
in the traditional numeric form we’re
all used to (12 and 24 hour modes
supported), as well as in binary with
each one having a matching binary
representation of itself displayed in
real time. The day of the week, the
date, and temperature are also
available on a separate LCD display.
Everything talked about here can
be found on the Nuts & Volts
website. Additional information,
updates, and forum discussions can
be found by visiting the project
website located in the resources
sidebar. This is a great place to see
what others have done and learn
how to make specific modifications
to your clock. Take care and have
fun! NV
RESOURCES
Project Page
www.savagecircuits.com/
alarmclock/
Project Discussion
http://forums.savagecircuits.com/
index.php?topic=35.0
Parts Resources:
Parallax, Inc.
www.parallax.com
Digi-Key
www.digikey.com
Jameco
www.jameco.com
RadioShack
www.radioshack.com
30 February 2010
A QUICK TOUR OF THE 16-BIT
MICRO EXPERIMENTER
BY THOMAS KIBALO MODULE
The 16-bit Experimenter Module was introduced in the December ‘09 issue of
Nuts & Volts. The technology is exciting and we are going to discuss several of its
on-board capabilities this month. We’ll supplement some of this discussion with
experiments to allow you to gain a better understanding of how you can use the
Experimenter for your own applications. All the experiments are written in C code
using our own custom function library. We’ll try to keep things as straightforward
and simple as possible, but you may need to brush up on some of the basic C syntax.
■The
PIC24FJGA64002
Block Diagram.
with and a description of what they do. Their titles pretty display row. The next step is to initialize the LCD and
much explain what they do. clear the display contents before use. Then, we
position the cursor to the beginning of row one (cursor
• LCD_Initialize () — Initializes the LCD display and position = 0) and write out message #1. Next, we
makes it ready for output. This needs to be called before position the cursor at the beginning of row two (cursor
any other LCD function is called. position = 16) and write out message #2. Just to keep
• clear_display () — Clears the display and places the things interesting, we’ll position the cursor in the middle
cursor at row 1 column 1 (top left corner). of line three (cursor position = 36) and write out five
• position_cursor (position) — Places the cursor at a characters. If you haven’t figured it yet, cursor positions
designated position; a number from 0-47. 0 to 15 correspond to the top row (row #1) of the
• write_string_LCD (string name) — Writes a string to the LCD display. Positions 16-31 are row #2 and positions
display at the current cursor position (see explanation 32-47 correspond to row #3. The LCD is initialized so
later). that the cursor itself is not visible; the cursor position
• write_character_LCD (character) — Writes a single automatically advances to the next position when data is
character to the display at the current cursor position. written to the display. Any data that is written must be in
ASCII format.
An example project LCDDEMO is supplied. This A copy of the LCDDEMO MAIN code is shown in
project shows how to use each of the above LCD the figure along with the resulting Experimenter LCD
functions and how to call them from your MAIN file. Let’s display, from when the code is executed. Notice that we
walk through the flowchart and then the code. have #include “lcd.h” at the top of the file to allow us to
LCDDEMO starts by declaring two strings: reference the LCD library. Try to match up the code to the
message #1 and message #2. Each message is configured flowchart with the code to understand the library syntax.
to be under 16 characters to keep the display nice and To help you along, there are lots of comments included in
neat; that is, keeping each message to within a single the code.
Writing to the Experimenter LCD
■The LCDDEMO MAIN Code. using these library functions is
straightforward. To prove this to yourself,
try modifying the code to configure
your own display message. You’ll will
find that writing your own messages to
the LCD is a snap!
February 2010 33
■ The EEPROMDEMO your use. Let’s walk through it. A flowchart is provided.
Flowchart. To keep things interesting and more meaningful, we will
use both the pushbutton and LCD library functions we
learned earlier. The demo counts the number of user
pushbutton sequences, and then stores this count in
EEPROM; it allows for recovery of this count (even when
cycling power). All pushbutton actions are at the
discretion of the user. The intent of the demo is to allow
the user to independently store and update the data (as
well as zero it), then cycle power and examine the
result. To make things easy, only one address is used
(0x1238) but you can try other even address locations.
Remember with this eight-bit EEPROM, we need to use
even addresses for storage and retrieval of 16 bits.) The
result should demonstrate that data contents — as set by
the user — can be stored and retrieved using the
25LC256 EEPROM and its library.
You need to make sure that the library is included as
files in your own project builds and that “#include
total. In general, for your experiments, you need to NVM.H” is part of your main file. For this demo, we
establish what data you want to store and how that data added “BUTTON.H” and “LCD.H” to use their specific
will be organized over the 16K. In a future article, we will libraries, as well. We’ve actually added several new
actually use this same library capability to configure the functions in this demo that have not been covered yet but
Experimenter as a data-logging device for temperature. are worthy of our attention
• write_array_LCD (array name, number of elements) —
Working with the EEPROM, LCD, Writes the content of an array for a prescribed number
Buttons — EEPROMDEMO of elements to the LCD display, starting at the current
cursor position. This is a method for dynamically updating
The EEPROM library is really straightforward. Take a the display with real data versus fixed strings. This is a
quick look at the functions listed below: member of the LCD function library we hadn’t covered yet.
• binary_to_ASCIIConvert (data) — This function
• InitNVM () — Initializes the Experimenter EEPROM converts binary data to its ASCII equivalent and places
for access. This must be called first before any other the ACSII values in their proper position in an array. The
EEPROM library function is called. NVM stands for array is typically used as output to the LCD display using
Non-Volatile Memory. the function described above. The processed data is
• iReadNVM (address) — Reads the EEPROM at an address stored in the following memory locations, as well as
and returns the 16-bit value stored at that location. inside the array:
• iWriteNVM (address, data) — Writes a 16-bit data value
to the EEPROM at the designated address. •Bcd10000
•Bcd1000
Using the EEPROM library function, we do the basic •Bcd100
initialization of SPI to access the EEPROM, and then read •Bcd10
and write from it once it is initialized. •Bcdunits
An example project EEPROMDEMO is available for
The initialization code for EEPROMDEMO is shown
■The EEPROMDEMO in the figure. There are the normal string identification
Code. messages, Message Button [] (1 to 4), the data variable itself,
and several new twists — a blank array designated count [],
variables bcd10000, bcd1000, bcd100, bcdtens, and bcdunits.
In addition, there is a new prototype function definition
binary_to_ASCIIConvert (). Let’s try to put it together.
To date, we have not actually presented live data to
the LCD display — only fixed strings. The use of count [],
bcd10000, bcd1000, bcd100, bcdtens and bcdunits
variables, and binary_to_ASCIIConvert () remedy this. The
binary_to_ASCIIConvert () takes data as an argument and
then processes it to develop the ASCII equivalent in the
34 February 2010
bcd10000, bcd1000, bcd100, bcdtens and
bcdunits variables, as well as in its proper
position (most significant to least significant
digits) in the blank array convert []. This is not
the whole story, though. We have another LCD
library function “write_array_LCD ().”
This function allows a character array like
convert [] to be presented on the LCD display
like the string arguments earlier. By updating
the convert [] with the ASCII results from
binary_to_ASCIIConvert (), we can use
write_array_LCD () to update the LCD with
the latest data values live. To gain a better
understanding, examine the EEPROMDEMO
code shown in the figure and some of the
Experimenter displays that occur as part of your
EEPROMDEMO operation. This program structure
of updating the LCD display with live data can
be an important part in future Experimenter
applications.
■ EEPROMDEMO MAIN Code.
Analog Anyone?
The I/O Expansion Bus and ADC GND. Since the program has a continuous loop, the
conversion and LCD updates are continuously happening.
The I/O expansion bus is the way in which you can Turn the pot and watch the results. This program uses
hook up and integrate the Experimenter to other “#include ADC.H” and #include LCD.H” to reference
electronics on your solderless breadboard. It will become needed libraries.
a major player in future articles. The bus consists of 10 The ADC library functions that are used are:
I/O pins that are completely software configurable. As a
rule, we typically “program” our pin I/O functions as •InitADC (IOpin) — Initializes the designated expansion
needed in the beginning of the program and then “Lock” bus pin for ADC operation as an input channel. There
the program for application use. We’ll go through several are only five possible pins available for use on the I/O
examples over the course of time to help you get a handle expansion. They are designed in the code as: pin1, pin7,
on this programmable feature. pin8, pin9, pin10 (make sure to use the exact syntax as
The PIC24 Analog-to-Digital Converter (ADC) is a 10- shown here). This function must be called first before any
bit converter that has up to 11 input channels and ADC library function. Only one pin can be designated as
performs conversions up to 500K per second. With the an input at a time.
Experimenter, five of these 11 channels are available as •ReadADC (IOpin) — This function performs an ADC
ADC inputs with the I/O expansion bus. They are I/O conversion on the input voltage present on the pin and
expansion pins 1, 7, 8, 9, and 10. Using our ADC
library, we are able to make any of these pins act ■ ADC Demo.
as an ADC input and perform an ADC conversion.
The conversion automatically converts voltage
signals at the input of the pin between 0 volts to
+3.3 volts, to a numeric 10-bit value 0 to 1023,
representing that voltage. This capability allows
the PIC24F to measure external voltage sources
(i.e., sensor outputs). Let’s try it.
An ADCDEMO program using the ADC
library is available. Here we use the library to
configure an I/O expansion pin (in this case, pin
10) as an ADC input and then perform a
conversion. The conversion is displayed on the
LCD in both count and voltage. An external
potentiometer (pot) is required to act as a variable
voltage source. Hook the wiper of the pot to pin
10 and the other sides of the pot to +3.3V and
February 2010 35
returns an integer value from 0 to 1023 representing the Ideas for the Future
measured voltage. We have covered several important subsystems for the
Experimenter showing a number of functional capabilities.
Examine the MAIN code using MPLAB IDE; it is well Coverage included hardware as well as software examples
documented. Try changing the pin value to one of the for you to work on. Working the software examples will
other pins, then rebuild and reload the program. Move the help to solidify these capabilities for your consideration in
pot wiper over to this pin to get readings. The ADC library your projects. Within each software project, text files are
is an important tool for performing external voltage included that fully describe the libraries being used. We
measurements with the Experimenter. We will use it again are just touching the surface here. There are more features
in subsequent articles. and interesting applications to come. NV
4.5V
_
BS170 3 2
R T Wiring is as my Circuit
1 1
RL2
18 Board Configuration 3
2
1
1
4 + 1K
C1 R1
Q2 #4 SW2
2 1 2
0.1µF
1 2 11 _
100K 10 1 2
R2 IC1 12 10
IC4c CN1
220K C4
HT9170B 13 2
RL3 1 1
0.1µF 3 1
2 2
3 + 1K
3
C2 C7 Q3 4
1 7 17 1 2
#2 SW3 5
0.1µF 20pF
_ 6
XTL1 R4 4514B 7
*see text 3.579545MHz 330K 2 11
1 2
8
A 0
3 9 9
B 1 RL4
C6 21 10 2 1 10
2
8 16 2
22
C 2
8 3 1
20pF D 3
7 + 1K
11 23
4
6 Q4
5 1
INH 5
5 2 #3 SW4 CN2
12 FL 6
4 _ 1
7
18 1 2 2
6 13 IC2 8 17
PHONE 9
20
LINE 14 10
19 2
RL5 1
11
9 14 3 1
8 2 1 5 4 3 12
13 + 1K
GREEN RED 13
Q5
IC4a IC4b 14
16
15 2
#6 SW5
15
15 4023B
_
9 6 1 2
IC3c RL6
BATTERY PACK or IC3d 8 2 1
12 10 3 1
AC-DC 5VDC Regulated Supply C3 + 1K
11 9
.22µF
1.5v 1.5v 1.5v
13 Q6 #7 SW6
2
4.5V _
2 12 12 11 21
1 2
power switch IC3b
5
IC3a
1 4
3 1 D1 2 6 'X' [see text]
2
1 4093 1
FIG. 1
4.5V R3 CG
R5 C5
100K 100K 1µF
1 2.2µF
2 2
electrically pressed by connecting the drain [+] and source weighted’ [8, 4, 2, 1] number from 0 to 15. Each of the
[-] pins of each FET directly across the connections of each four binary output pins are also wired directly into IC2, a
switch as indicated in Schematic 1. As each FET [Q1-Q6] 4514 [1-of-16] binary decoder which outputs the decimal
is turned on by its respective IC2 output pin, it electrically number equivalent to the original TT input number. For
closes the switch. example, a single TT input to IC1 for the number 9 would
Although the transmitters indicated in this project contain two frequencies: 852 Hz for low and 1,477 Hz for
have only one switch for on and off activation to their high. The two output binary bits [pin 11 and pin 14] are,
receivers, some models have wireless transmitters with respectively, 1 and 8 = 9, with both wired to the
both switches. If these latter-type transmitters are used, associated binary input pins of IC2 which momentarily
then wire each switch to a separate output FET for a total causes ONLY the number 9 output [pin 17] to go high,
of three transmitters, i.e., Q1 on/Q2 off; Q3 on/Q4 off; (leaving all other output pins low).
Q5 on/Q6 off [refer to schematic]. Referring to Schematic 1 again, IC4 contains three
Notice that IC1 is also capable of decoding all 16 TT triple-input NAND gates. Two gates are directly wired to
tones [0-9; *, #, A, B, C, D] and output each as a ‘binary- both the IC1 output and IC2 input pins associated with
the binary numbers of 11 and 12 which are, respectively,
■ Super Switch. the * and # on the phone keypad. IC4b output pin 6 goes
low when the * [11] key is pressed; IC4a output pin 9
goes low when the # [12] is pressed. IC3 contains four
two-input NAND gates. IC3c and IC3d are wired in a 'flip-
flop' configuration, being set or reset as per the low
outputs of IC4a or IC4b.
When the * key is pressed [binary 11], IC4b output
pin 6 goes low and sets IC3c output pin 10 to a high
state. This enables the IC3b gate at input pin 5. To reset
the flip-flop, the # key is pressed [binary 12], providing a
low state to input pin 12 of IC3d. Output pin 15 of IC1 is
normally at a low state. When any number is pressed on
the keypad, pin 15 goes — and remains — high for as long
38 February 2010
as the key is pressed. ■ Wireless unit.
In this condition, the
R3/C3 one-shot
timing circuit is not
charged.
Gaining
Control
To enable
control of the
wireless transmitters
via IC2, the * [11]
key must be pressed ■Transmitter switch wiring.
first and, when released, pin 15 immediately goes low
again. This action charges the C3/R3 timing circuit, That’s about it. Using a circuit board is the ideal way
providing a low pulse [approximately .0147 s] to input to construct this project. Most wireless transmitter/receiver
pins 1-2 of IC3a. It’s inverted to high again at output pin 3 units of this sort provide an operating distance from 50 to
and into the D1/R5/C5/IC3b timing network. It is then 100 feet. As mentioned previously, there are various
wired to input pin 6 which — when enabled by the flip- manufacturers, with transmitters having either one or two
flop being set at input pin 5 — causes output pin 4 of switches. The units used here are the "Super Switch 3,"
IC3b to go into an enabling low state on IC2 at pins 1-23. which can be purchased through Northern Tool Co.
This causes the respective output pin number to go (www.northerntool.com; part #9719052). They offer a
momentarily high for the charge time set by R5xC5x.67, variety of frequencies for using multiple units, a single
or approximately 150 ms. At this point, IC2 output pin 19 on/off switch action on both the transmitter and receiver
[#11] goes high but it is not connected to anything wall module, and a 60 foot operating range.
because the * input is only used to set the flip-flop. It also
allows all following number inputs to momentarily turn Putting It To Use
FETs Q1 to Q6 on to activate their associated wireless
transmitter switches (which will be electrically pressed in With this device attached to your phone line, you will
the same manner). have a handy controlling unit to operate multiple wireless
Resistors RL1-RL6 provide a load across the FETs and transmitters from anywhere in the world. For example, if
switches to prevent shorting. All source pins on the FETs you are using a local cordless phone, simply press the talk
are wired together to capacitor CG, providing a common button. When the dial tone is heard, press the * key to
ground connection between the wireless transmitters and enable IC2, then press your transmitter activation
circuit board power. Immediately following the IC3b number[s]. You will most likely hear an operator message
timing period discharge, output pin 4 returns high again but it won't interfere with your inputs. When finished,
and all output pins to IC2 will go low. To disable any simply press the # key and hang up. For remote operation,
further inputs to IC2, the # key is pressed, resetting the you must have an answering machine connected to your
flip-flop so that output pin 4 of IC3b remains high on IC2 phone line and then dial your phone number. As soon as
input pins 1-23. This inhibits all further outputs in this the answering machine is done telling you to leave a
condition. message, press the * key, enter the transmitter number[s],
■ Lid from the container with the ■ Container with the clear lid on. ■ Lid on with decorative cover.
components installed.
February 2010 39
placed in with the CDs when you buy them. A hole was
drilled in the CD lid for the phone line cord to pass
through. I placed contact paper around the CD lid to be a
little decorative.
Construction Hints
You can use the battery power supply configuration
shown in Schematic 1 or you can use an AC-DC regulated
five-volt power supply. The battery holder mentioned in
the Parts List has a switch built in and provides 4.5 volts
using Duracell batteries. Mount the resistors and diode to
the PCB first. Then solder in the four IC sockets [or ICs],
■ Available kit components. followed by the capacitors and the crystal, not too close
to the board.
then press the # key and hang up. (You will need to devise (Note: IC1 manufacturer diagnostic specs have
your own method of keeping track of the AC wall receiver capacitors C6 and C7 indicated. Although I have provided
on or off, positions. Whatever position you left it in after for their installation on the circuit board, I have omitted
you pressed the # key will remain until it’s changed by them and the circuit works very well. Depending on your
you.) Normal phone use is never disrupted and it will not phone service, you may not need them installed and can
change anything until the * key is pressed and the eliminate them. Use them only if you are experiencing
transmitters are activated again. problems.)
You can purchase an inexpensive cordless phone unit Now, solder in the FETs, keeping the FET leads long
[Uniden brand works] and plug the controller directly into and mounted high on the board. Lastly, connect the CN1
the base unit line input without being attached to the and CN2 headers, the phone line cord and the battery
phone line. To do this, make sure that the RED phone line holder or power supply wires. Double-check the solder
wire is connected to the T input [to capacitor C1] and DO connections as you go along.
NOT CONNECT the GREEN wire to anything. If it does
not work, ONLY reverse the wires. Follow operating
procedures outlined. If you are using it through the phone PARTS LIST
line, then connect both wires. PART SUPPLIER/PART#
To be somewhat imaginative, I put two transmitters, IC1: HT9170B DTMF decoder www.futurlec.com
IC2: 4514 4-bit 1-of-16 decoder [Jameco #13522]
the circuit board, and battery case into an empty CD IC3: 4093 quad 2-input NAND gates [Jameco #13400]
container [see photos]. Using a glue gun, I dabbed glue all IC4: 4023 triple 3-input NAND gates [Jameco #12845]
around the soldered wire connections and secured the XTL: [3.579545] [Jameco #14533]
IC 14-pin sockets (2) [Jameco #526192]
other components on the clear plastic disk that's usually IC 18-pin socket [Jameco #683139]
IC 24-pin socket [Jameco #683163]
■ Inside the enclosure. R1, R3, R5: 100K [Jameco #691340]
R2: 220K [Jameco #691420]
R4: 330K [Jameco #691657]
RL1-RL6: 1K FET load resistors [Jameco #690865]
Q1-Q6: BS-170 FETs [Jameco #256031]
C1, C2, C4: .1 μf [Jameco #151116]
C3: .22 μf [Jameco #33507]
C5: 2.2 μf [Jameco #609561]
CG: 1 μf [Jameco #330431]
*C6, C7: 20 pf [see text] [Jameco #332322]
D1: 1N914 [Jameco #179207]
Power: 4.5V battery holder with switch [Jameco #216144]
or five-volt AC-DC reg. supply [Jameco #308700]
CN1: 10-pin male header [Jameco #103393]
wire-wrap connections to transmitter switches;
CN2: two-pin male header [Jameco #879406]
wire-wrap connections to transmitter switches;
RJ-11: Phone line/plug, 7 ft; [Jameco #115588]
cut cord end; tin wires for circuit board connection
Wireless Light Switches www.northerntool.com [Part #9719052]
Misc: Wire-wrap wire and tool, solder equipment, wire,
enclosure, project assembly material.
Circuit boards and kits are available through the
Nuts & Volts website (www.nutsvolts.com).
40 February 2010
Testing the Circuit Operation the transmitter switch grounds together and have only one
wire connected back to the circuit board at the X point.
If you’re putting the project together without a circuit
board, then all you will really need is a volt meter and a Last Call
logic probe for the following test procedures. Determine
where and how you want to mount the wireless I tested this project by having someone call me with
transmitters, then remove the enclosures and the batteries. their cell phone from Florida and follow all the procedures
On the transmitter circuit board across the switch mentioned. It worked without any complications, just as it
terminals, use your volt meter; one side will be ground did with on-premise and local phone calls. I also used it
[black wire] and the other will be positive [red wire]. without the base unit of my cordless phone plugged into
As per Schematic 1, wire-wrap an appropriate length of the phone line and I had no problems whatsoever. NV
wire onto the #1 CN1 header terminal
and touch-solder the other end of the
wire to the positive side of the
transmitter switch. Prepare and wire-wrap
another piece of wire of the same
length from the #2 CN1 header terminal
to the negative side of the transmitter
switch. Double-check all wiring,
replace the battery in the transmitter,
and insert its associated receiver into
an AC wall outlet, making sure it is
set to off. Plug the phone line cord
into a spare phone jack and then
provide power to the controller circuit
board. With a desk phone earpiece off
hook or cordless handset talk button
pressed, you should hear a dial tone.
Press the * key and then the number
5. You may hear an operator
message or other signal at this point,
but it will not affect further testing.
If all the wiring is correct, then
the transmitter LED momentarily
flashes and the receiver should turn
on. If nothing works, then check the
soldering connections, and inputs
and outputs on IC1 with a logic
probe. If all is well, press the number
5 again; the receiver module should
turn off. If so, press the # key to lock
out the control function.
Now press the number 5 again
and the receiver module should
remain off. Press the * key, followed
by the number 5, and the receiver
should turn on. Press the number 5
once more to turn the receiver off,
followed by pressing the # key to
disable the remote control function.
Test the other five outputs from IC2
to their respective transmitters.
Notice that all of the FET source
pins to the transmitter switches are
common to the positive side of
capacitor CG [at X]. Depending on
your assembly, you can wire each of
February 2010 41
Experiments with
Alternative Energy
Part 7 - Experimenting with the
Whirlybird Wind Turbine By John Gavlik, WA6ZOK
Last time, I showed you how if you’ve already built your Whirlybird In a typical single-phase full-wave
to build the Whirlybird™ wind turbine and want to know more rectifier (Figure 2), two of the four
three-phase AC wind turbine about how it works, this article is for diodes conduct current during the
along with some background you. If you are just thinking about positive portion of the AC sine wave
information on wind turbine building it, this may convince you to (D1 and D4) while the other two
do so. Either way, you’ll learn a good
technology. This time, I’ll show
deal more about wind turbine
you some of the interesting technology. Let’s get started.
experiments that can be done
with this device. Here are the Three-Phase
topics I’ll address:
Rectification
• Three-Phase Rectification
• Understanding Three-Phase The kind of three-phase
Voltage Output rectification that’s done with the
Whirlybird wind turbine is full-wave
• Smoothing The Rectified rectification as opposed to half-wave
DC Output rectification (Figure 1). Remember,
a diode conducts current in only one
• Wind Speed, RPM, and direction (from positive to negative)
Power Output and blocks current flowing the other
way. Half-wave rectification requires
• The Effects of Magnetic only one diode while full-wave
Coupling rectification requires at least four.
The major difference between a
• Star versus Delta Windings single phase and three phases is that
we have three coil groups as
• Hands Off Braking compared to one. So, the question is
“how does one effectively expand
Most of these topics are really the four-diode, full-wave rectifier
the titles of the experiments that I’ve circuit to accommodate two more
developed around the Whirlybird coils?” The simple answer is “add two
wind turbine, and I’ll be referring to more diodes.” The question then
them in some detail in this article. So, becomes “how does that work?”
Well, let’s start with how a full-wave
Figure 1. Half-Wave and rectifier works and move up to a
Full-Wave Rectification.
three-phase rectifier.
Figure 2. Three-Phase
Full-Wave Rectifier
Current Flow.
42 February 2010
conduct current during the negative
portion (D2 and D3). The result is
wave is displaced [in time] from the
others based on the 120 angular
Understanding Three-
that the negative portion of the sine degree coil separation. Phase Voltage Outputs
wave is “flipped” to positive which To make things simpler, I’ve made
provides double the power producing the leg numbers correspond to the phase This is where I’ll get into
capability as compared with a half-wave numbers 1, 2, and 3. By studying the interfacing the Parallax BS2 or
rectifier. The diodes themselves require phase relationships for the three legs, I
a minimum activation voltage or “drop” hope you can see how the technique Figure 3. Effect of Diode Voltage
of typically 0.6 volts before current works for all three legs Drop in Full-Wave Rectified Voltage.
actually can begin to flow through with just two extra diodes.
them. This is called the forward-biased If you don’t “get it” at first,
voltage (Figure 3) which accounts for look again; it’s important
the “flat,” no voltage portion of the in regards to what you
rectified voltage traces. will learn about next.
To extend this
full-wave rectified Figure 5. 28X2 Hookup Schematic.
scheme to three-phase,
let’s first consider
the three coils that
make up the three-
phase circuit. For
simplicity, I’ll use the
Star configuration
although the Delta
configuration works
exactly the same
way. Figure 2 shows
the three coils
grouped as three
“legs” with two coils
per leg, so mentally
treat each leg as a
voltage source that
generates a sine
wave; only each sine
Figure 4. BS2
Hookup Schematic.
February 2010 43
Figure 6. appear jagged, they are actually
Whirlybird smooth (see sidebar). The jaggedness
Spinning Up
to Speed. is due to the firmware sampling
technique (Figure 11) that takes
confusing and individual voltage samples of different
cluttered; clicking parts of the phase waveforms over a
the graphic icon period of several milliseconds. Unlike
switches under an oscilloscope that captures the
each of the phase waveforms all at once, our slower
meters turns off BS2 and 28X2 micros must take
the phase voltage discrete samples of each of the
plots to display phases at various times; mainly
just the rectified because they are both programmed
DC by itself in the interpretative Basic language
(Figure 7). As you and not the faster C or assembly
can see, this is languages. Each discrete sample
not a smooth DC consisting of all three phases and the
signal but one rectified DC voltage is then
PICAXE 28X2 microcontrollers to the that follows the voltage peaks of the transmitted to the computer to create
wind turbine. Figures 4 and 5 show three phases. Nevertheless, it looks the waveforms you see plotted.
the schematic diagrams for attaching far less confusing without the clutter
the Whirlybird wind turbine to the of the other three-phase plots. Smoothing the
BS2 and 28X2, respectively. The A/D To get a better idea of how the
converter inputs pick up the three rectified DC signal is created, Figure 8
Rectified DC Output
independent voltage phases after shows only a rectified Phase 1 (black
they are rectified along with the line) along with the DC signal (green As Figure 12 illustrates, by
rectified DC voltage. The rectified line). Here you can witness how the DC adding a 330 µf capacitor across the
DC voltage is routed through the one signal follows the peak of this phase 100 ohm load the rectified waveform
ohm current sense resistor into a 100 voltage, riding just below it due to the smoothes out considerably — not
ohm potentiometer load. This way, 0.6 volt rectifier diode drops just exactly pure DC but getting there.
we can measure the effects of discussed. Figure 9 shows Phase 2 When the input voltage is higher
variable loading on the turbine, as (blue line) added to the plot where it than the capacitor’s voltage (at the
well as learn about the three-phase begins to become even clearer as to moment), the rectified DC charges
voltages. For the most part, these two how the rectified DC signal follows the the capacitor to the peak DC level.
schematics will suffice for the rest of phase voltage peaks. Finally, Figure When the input voltage falls below
the discussion in this article. 10 shows all three phases along with the capacitor’s voltage, the capacitor
In Figure 6, you can see the the rectified DC voltage. Seeing it discharges its stored energy into the
computer plot of the three-phase one phase plot at a time generally load. Thus, the capacitor helps to
voltages (black, blue, and red) along makes more sense than seeing all the stabilize the rectified voltage; so
with the rectified DC voltage (green) signals plotted at once the first time. adding more capacitance is a way to
as the turbine spins up to speed. At It should also be noted that while make the rectified DC smoother.
this point, the display will look the plots of the phase voltages
Figure 7. Rectified DC Wave Only. Figure 8. Phase 1 and 2, and Rectified DC.
Wind
Speed,
RPM,
and Power
Output
As one would
expect, wind speed
affects the RPM
and DC voltage
levels; the greater
the wind speed,
the greater the
RPM and DC
44 February 2010
Figure 9. Phase 1 and
2, and Rectified DC.
voltage, and vice
versa. What is most
interesting, however,
is the effect of the
wind force itself. In
general, if the wind
speed is doubled
the output power
increases by eight
times — the cube
of the wind speed.
The other main
variable is the Figure 10. Phase 1, 2, and 3,
blade area or — in our case — the speed. The one I’ve chosen can measure and Rectified DC.
area of the turbine fan that captures wind speed in meters per second as
the wind. These and other variables called for by the above equation (Figure as wind speed — or maybe more so
are expressed by the following equation 13). With it, you can set up the turbine — magnetic coupling is an important
for wind turbine output power: in front of a large table fan and measure consideration in every wind turbine’s
the voltage, current, and power at design. In effect, the closer the
P = 0.5*?*A*V³*E different fan speed settings and distances rotating magnets are to the coils, the
from the turbine (Figure 14). Replace more power that will be generated.
Where: the wind turbine with the anemometer The Whirlybird design is ideal for
P = Power in Watts and measure the average wind speed adjusting and measuring this effect;
ρ = Air Density in Kg/m³ (about 1.225 at each electric fan speed setting by here’s what you can do.
Kg/m³ at sea level, less higher up) adjusting the anemometer position at First, set the wind turbine in front
A = Rotor Swept Area in m² = πr² (r = left, center, and right. With both the of a large table fan and let it ramp up
radius of the rotor or fan) wind speed and the measured power, to speed. Adjust the potentiometer
V = Wind Speed in m/s (cubed) you can plug in the air density and load to any desired resistance and
E = Efficiency in percent rotor swept area numbers and compute measure the power. Then, stop the
the efficiency, E, at different wind fan and disassemble the turbine into
If the radius of the rotor blades is velocities. You’ll see the efficiency is the rotor and stator halves (refer to
doubled, the swept area is quadrupled. quite low, mainly because the Whirlybird Part 6 if this is unclear). Next, add a
If the wind speed is reduced by half, is primarily a “drag” type as opposed to single flat washer as an additional
the power is reduced to 1/8 of the a “lift” type (typically seen in models spacer between the rotor and stator
original power. Efficiency is the wild with curved blades that act like an
card in the equation where many airplane wing). We’ll cover more about Figure 12. Capacitor Filtered
other factors go into the unique this type of wind turbine in the Rectified DC Voltage.
design of each wind turbine. next article. Regardless, this is
This equation was derived not a great way to understand the
too long ago by Albert Betz relationship between wind
(1885–1968) who was a German speed, RPM, and output power.
physicist and a pioneer of wind
turbine technology. Betz found out The Effects
that we can only harvest [at a
maximum] 16/27 or 0.593 of the
of Magnetic
power from the wind. This number is Coupling
called the Betz coefficient and is the
theoretical maximum efficiency that Probably as significant
a turbine can harvest from the wind.
You can validate this equation by Figure 11. Phase
using an Sampling Technique.
inexpensive
hand-held
anemometer to
measure the
turbines wind
February 2010 45
Figure 15. Adding Washer Spacers.
SJValley
faster speeds are not exactly the
FREE same, they are close enough to
AVR Bootloaders:
FLASH, EEPROM & lockbits illustrate the point. So, what is it
engineering Sample Code about the Star and Delta windings
Libraries: UART, I2C, that makes this difference in the
http://www.sjvalley.com voltage and current production? Leg
Timers, PWM
AVR Eclipse Tutorial resistance is the key!
Sensor Drivers The basic reason all of this is true
is because the total coil resistance for
USB Development Kit Graphic each leg is different when wired in
- Atmega324 Development Kit either a Star or Delta configuration.
- Pre-installed -Atmega640
-64K ROM
Assuming that each coil is wound
Bootloader
-8K RAM with the same wire thickness and
number of turns, the coil resistance
for each of the three coils will be the
FM Radio Reciver
Motor Controller RS232 with DAC and 3-Amp, Adjustable same. However, the total resistance
5-Amp Continious Current Transeiver Regulator Board
Headphone output per leg is much different when wired
in either a Star or Delta arrangement.
In the Whirlybird wind turbine,
each “coil” measures about 26 ohms
which is the sum of the four
$17.99 $6.99 $29.99 $9.99 individual coils that are wired
DS1307
SERIAL LCD Wireless Temperature Real-Time 12-bit SPI or I2C together in series as shown in Figure
With EEPROM Support & Light Sensor 3-Axis Accellerometer
Clock 18. Therefore, when we speak about
coils here, assume that we mean the
“coil group” as a whole. For the
following discussion, refer to the Star
February 2010 47
#19
Serial Communications
Part 2 – A Simple Follow alon
k & ki
g with this
ts are ava
series!
ilable in our
Terminal
Joe’s b o o volts.com
e b st o re a t www.nuts
w
by Joe Pardue
using DevInfo; ■ FIGURE 3. Add New Item Form. ■ FIGURE 4. Settings Form.
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.
20 for $25.95 each • 100 for $24.95 each 100 for $3.25 each $ 753
each
CAT# NMH-AA $2.95 each
8 for $2.75 each • 60 for $2.40 each
MANUFACTURERS - We Purchase EXCESS INVENTORIES... Call, Write, E-MAIL or Fax YOUR LIST.
February 2010 55
■ BY RON HACKETT
PICAXESHARPENING YOUR TOOLS OF CREATIVITY
PRIMER
56 February 2010
PICAXE PRIMER
■ FIGURE 7. Breadboard
Circuit in Operation.
assemble the breadboard
circuit for our first
experiment. The
schematic was presented
earlier in Figure 3 and the
parts list is contained in
Figure 6. Similarly to our
previous project, I haven’t
included the standard
PICAXE programming
circuitry in the schematic
because it’s included on
the programming adapter
that I’m using. Figure 7 is
a photo in the completed
breadboard circuit for our ■ FIGURE 8. Breadboard Circuit
first experiment. As you can see, it Programming Editor to install it to with LED Display Removed.
was a bit of a challenge to fit all the your breadboard circuit. If “HELP”
circuitry on the two small doesn’t immediately arrive, you will of input circuitry to receive the serial
breadboards. If you would rather need to troubleshoot the wiring of input from the master processor and
have more space to work with, you your breadboard circuit. the necessary headers to connect to
could certainly use larger the breadboard, LED, and
breadboards. In the photo in Figure
7, I have placed a piece of red
DESIGNING A programming adapter. There is,
however, one addition to the circuit
transparent plastic on top of the LED STRIPBOARD VERSION that requires a brief explanation. The
display because the lighted display OF THE MAX7219 input circuitry includes a 1N4148
photographs better that way. Figure 8 diode (D1) that is connected
is a photo of the same setup with the
CIRCUIT between the 08M’s data input pin
four-digit display removed so you can (input 3) and +5V. As indicated in the
see the wiring underneath. The upper When your breadboard setup is documentation for the serin
six pins of the display fit in the six functioning correctly, we’re ready to command in Part II of the PICAXE
vacant holes just above the mid-line construct the stripboard version of manual, this diode is necessary
of the breadboard between the the project. Figure 9 presents the whenever the 08M’s input 3 is used
vertical orange jumpers. schematic for the circuit, which is to receive serial data. Also, be sure
Once you have assembled your essentially the same as the to connect the cathode of the
breadboard circuit, we’re ready to breadboard version with the addition diode (not the anode) to +5V as
move on to the software
portion of our experiment.
Our first program for the
LED board will take full
advantage of the
MAX7219’s automatic BCD
decoding to simply print the
message “HELP” on the
display. The necessary
software (LED7219help.bas)
is available on the N&V
website. Download it and
take a few minutes to read
through it to see how the
details of our discussion of
the 7219 have been
implemented in the
software. When you
understand how the ■ FIGURE 9. Schematic for the
program functions, use the four-digit LED Stripboard Circuit.
February 2010 59
has 19 traces with holes. the sockets (which is why we are
ID Part
- Stripboard, 20 traces x 25 holes
However, it also has one trace using machined-pin sockets); be sure
- Jumper wire on each side without any to install these parts before soldering
D1 Diode, 1N4148 holes whatsoever, for a total the sockets in place. Also, there is
R1 Resistor, 100k, 1/4 W
R2 Resistor, 47k, 1/4 W
of 21 traces. In the layout, all one more jumper (from D25 to P25)
Prog Adapter Header, female, 4-pin rt. angle the traces are shown as that is shown as running on top of
BB Adapter Header, female, 4-pin rt. angle having holes in them, but I another component (the breadboard
C1, C2 Capacitor, .01uF
IC1 DIP socket, 8 machine-pin
actually used the small connector).
- PICAXE-08M stripboard with one “hole- In this case, that’s correct; in
IC2 DIP socket, 24 machine-pin less” trace along its left edge addition to carrying a signal (the sin
- MAX7219 Display Driver
C3 Capacitor, electrolytic, 10uF
(at column A). connection), this jumper also serves
- LED display, 4-digit, 7-segment There are two jumpers the purpose of “pinning” the
- Header, male, 5-pin, double-ended that need to terminate in the breadboard connector to the
(for connecting to Breadboard)
optional 2 Headers, male, 5-pin straight
“column A” trace: one from stripboard so that the connector
(see text) (Reverse-mountable) S7 to A7, and one from E21 doesn’t bend and weaken as the
optional 2 Headers, female, 6-pin straight to A21. Rather than drilling result of repeated insertions and
(see text) (for LED display)
two holes in trace A (at A7 extractions into and out of the
■ FIGURE 10. Parts List for the and A21), you can see in the breadboard. You may also want to
four-digit LED Stripboard Circuit. layout that I inserted one end of each add an additional jumper over the
of these jumpers in trace B and top of the programming adapter (but
shown in the schematic. extended it on the bottom of the I don’t think that connector will be
Figure 10 lists the necessary board so that I could solder it at stressed near as much as the
parts which are also very similar to trace A. (I also severed trace B breadboard connector). If you do, be
those of the breadboard circuit we appropriately so that I didn’t make sure to insulate it to avoid any
constructed earlier. The additional contact with any other circuit accidental connection to the jumper
parts include the necessary headers connection.) You can take the same that terminates at T17.
and the 1N4148 diode we just approach or drill the necessary two Finally, the two six-pin straight
discussed. The stripboard layout is holes. If you prefer, you could also female headers shown in rows 2
shown in Figure 11. Before you use the larger stripboard so that you and 8 are optional; you can include
actually begin assembling the circuit, have holes in trace A, and insert one them if you want to be able to
there are a couple of aspects of the end of each of those two jumpers remove the LED display from the
layout that I want to clarify. directly into trace A. board, or you can solder the LED
First, as you can see, the Second, there are four jumpers directly into the same holes if
stripboard needs to contain 20 traces and one resistor that are shown in you prefer. The two five-pin,
with 25 holes each. By now, you the layout as running on top of the reverse-mountable male headers just
probably know that the smaller two IC sockets. I did this so that the above the breadboard connector are
stripboard that’s available on my site required connections would be clear also optional. If you want to be able
in the layout. However, these five to locate the LED display some
■ FIGURE 11. Layout for the four-digit parts need to be installed underneath distance from your master processor
LED Stripboard Circuit. circuit, you can connect a 10-pin
ribbon cable assembly from the
bottom of the stripboard to the
master processor circuit. You can
also add these headers at a later time
if you want to.
ASSEMBLING THE
STRIPBOARD CIRCUIT
As usual, read through the
complete list of assembly instructions
that follows to be sure you
understand the entire procedure
before assembling the board. As you
carry out the following steps, you
may want to refer to the photo
of the completed stripboard circuit
60 February 2010
PICAXE PRIMER
February 2010 61
We hav e ov e r 180 r elat e d t i tles in our webs tor e!!
The Nuts & Volts WEBSTORE
CD-ROMS SPECIALS
ELECTRONICS
Beginner’s Guide to Embedded C Build Your Own Electronics Encyclopedia of Electronic
Programming Volume 2 Workshop Circuits, Volume 7
by Chuck Hellebuyck by Thomas Petruzzellis by Rudolf F. Graf / William Sheets
In this “Volume 2,” NEW IN THE BESTSELLING SERIES!
Chuck takes the YOUR DREAM ELECTRONICS LAB ONE THOUSAND MORE LEADING-
reader to the next IS WAITING INSIDE!
level by introducing EDGE CIRCUIT DESIGNS!
how to drive This value-packed
displays, how to use resource provides Designed for quick
interrupts, how to everything needed to reference and
use serial communi- put together a fully on-the-job use, the
cation, and how to functioning home Encyclopedia of Electronic
use the internal electronics workshop! Circuits,Volume 7, puts
hardware peripherals From finding space to over 1,000 state-of-the-
of the PIC16F690 stocking it with com-
microcontroller such art electronic and
ponents to putting the integrated circuit
as SPI, PWM, and timers. shop into action —
When you have finished reading this book designs at your
and completed the projects, you’ll be well building, testing, and fingertips. Organized
beyond the title of Beginner! troubleshooting systems — popular elec- alphabetically by
$39.95 tronics author Tom Petruzzellis’ Build Your circuit type, this all-new collection includes
The components that are added to the Own Electronics Workshop has it all! And the the latest designs from industry giants such
PICKit 2 that Chuck uses in his new book best part is, this book will save you money, as Advanced Micro Devices, Motorola,
can also be purchased through the Nuts & big time! Teledyne, General Electric, and others.
Volts Webstore. Reg $29.95 Sale Price $24.95 $39.95
$12.95
Programming Op Amps for Everyone, Programming and Customizing
A Beginner's Guide Third Edition the Multicore Propeller
by Richard Mansfield by Bruce Carter and Ron Mancini Microcontroller NE W!
Essential Programming by Parallax
Skills--Made Easy! Written by a team of
This book will get you OP AMPS Propeller experts,
started right away FOR EVERYONE this authoritative
writing a simple but provides the theoretical guide shows you how
useful program in Visual tools and practical to realize your design
Basic Express Edition, and know-how to get the concepts by taking
then moves on to more most from these full advantage of the
advanced projects, versatile devices - this multicore Propeller
including a quiz program new edition substantially microcontroller's
and a protected personal updates coverage for low-speed and unique architecture.
diary.You'll develop real-world high-speed applications, and provides step The book begins with a review of the
programming skills, like designing user by step walkthroughs for design and Propeller hardware, software, and Spin
interfaces and working with variables, selection of op amps and circuits. language so you can get started right away.
arrays, loops, and procedures. $29.95 $79.95* $49.95*
62 February 2010
Order online @ www.nutsvolts.com
Or CALL 1-800-783-4624 today!
BOOK & KIT COMBOS THE EVIL GENIUS SERIES
From the
Smiley Workshop
C Programming for
Microcontrollers
by Joe Pardue
Book $44.95 Kit $66.95
Do you want a low cost way to learn C programming for
microcontrollers? This 300 page book and software CD show you
how to use ATMEL’s AVR Butterfly board and the FREE WinAVR C
compiler to make a veryinexpensive system for using C to develop
microcontroller projects.
February 2010 63
CALL 1-800-783-4624 today!
Or Order online @ www.nutsvolts.com
PROJECTS
16 Bit Micro Experimenter Board 3-Phase Wind Turbine Kit DC-to-DC Converter Kit
NE W!
SPECIAL OFFER
Getting Started With PICs
Volume 2
by Chuck Hellebuyck
Getting Started With
PICs Vol 2 continues
where the first book
left off.This book
contains the
collection of the next
12 articles that were
published in Nuts &
Volts magazines of
2007. A great
compliment to Vol 1
and a must have if you’re entering the
world of Pics & Progamming.
Reg $29.95
Introductory Price $24.95
February 2010 65
ELECTRONET
click Electro-Net
66 February 2010
THE DESIGN
ADVANCED TECHNIQUES FOR DESIGN ENGINEERS
CYCLE
■ BY FRED EADY
//this code is part of dcHidApiDlg.cpp The VID entered in the descriptor can be used to
void CdcHidApiDlg::DetectDevice(void) trace the manufacturer of the device. However, we can
{
unsigned int activeDevices, also specify the manufacturer with a string in the device
vendor_id,product_id; descriptor:
char *manufacturer,*serial_num,
*device_name;
mdeviceList *pList = m_DeviceList; //Manufacturer string descriptor
ROM struct{BYTE bLength;BYTE bDscType;WORD
string[9];}sd001={
Once we have declared all of the variables we need sizeof(sd001),USB_DESCRIPTOR_STRING,
{‘M’,’i’,’c’,’r’,’o’,’c’,’h’,’i’,’p’
for the GetList function, we prepare the GetList function }};
to get information on every HID-class device that is
available by not specifying any information in the call that There is no serial number entry in the descriptor.
can be traced to any particular HID-class device that has Therefore, we should expect an empty serial number
made itself available: structure entry to be returned from the TRAINER. If you
require a serial number, the header text of the
vendor_id = 0xFFFF; MCHPFSUSB Framework usb_descriptor.c file can be used
// 0xFFFF => Any vendor ID
product_id = 0xFFFF; as a guide to adding the necessary serial number
// 0xFFFF =>Any product ID descriptor code.
serial_num = NULL;
// NULL=> Any serial number This whole process would be useless without a PID
device_name = NULL; and VID entry. So, here are the Vendor ID (VID) and
// NULL=> Any device name Product ID (PID) entries that I entered into the TRAINER’s
manufacturer = NULL,
// NULL=> Any manufacturer descriptor:
Upon invocation, the GetList API function will ROM USB_DEVICE_DESCRIPTOR device_dsc=
{
return the number of HID-class devices that respond 0x12, // Size of this descriptor
to the function’s request. In addition, each device that // in bytes
responds will fill a structure entry in the array of USB_DESCRIPTOR_DEVICE,
// DEVICE descriptor type
structures in m_DeviceList which is referenced by the 0x0200, // USB Spec Release Number
pointer *pList: // in BCD format
0x00, // Class Code
0x00, // Subclass code
activeDevices = hidDevices.GetList( 0x00, // Protocol code
vendor_id, // Vendor ID USB_EP0_BUFF_SIZE,
product_id, // Product ID // Max packet size for EP0,
manufacturer, // Manufacturer // see usb_config.h
serial_num, // Serial number 0x04D8, // Vendor ID
device_name, // Device name 0x003F, // Product ID
pList, // Device list 0x0002, // Device release number in
2); // max number of // BCD format
// devices 0x01, // Manufacturer string index
0x02, // Product string index
0x00, // Device serial number string
The data that flows from a responding device to the // index
m_DeviceList structure originates in the TRAINER’s device 0x01 // Number of possible
// configurations
descriptor. };
February 2010 69
■ SCREENSHOT 1. This is a capture of the data that
flows from the PIC32MX795F512L TRAINER into the
m_DeviceList structure entry. Note that the second
entry is available to us but not put to use.
return;
}
rc = 0;
if(activeDevices)
{ Screenshot 2 is a result of the positive response to the
rc = hidDevices.Open( Open API function call. The Open API call did not change
pList->VendorID,
pList->ProductID, the contents of the m_DeviceList array. So, we can display
pList->Manufacturer, the PIC32MX795F512L TRAINER GetList values with our
pList->SerialNumber, positive link message.
pList->DeviceName,
TRUE); // Use non-blocking reads I failed to mention that I had a little HID analog-to-
} digital (A-to-D) conversion routine in my pocket. So, I’m
70 February 2010
THE DESIGN CYCLE
void CdcHidApiDlg::OnGetVolts()
{
char xmit_buf[100];
char recv_buf[100];
unsigned int wrc,rrc;
float raw_volts;
CString vReading;
memset(xmit_buf, 0,
sizeof(xmit_buf));
xmit_buf[1] = 0x37;
wrc = hidDevices.Write(xmit_buf);
PIC32MX795F512L TRAINER
TO VISUAL C++
If all has gone as planned, the TRAINER received
the 0x37 command and executed the A-to-D converter
February 2010 71
■ SCHEMATIC 1. As you can see, I’ve 3V3
100
U1
99
98
97
96
95
94
93
92
91
90
89
88
87
86
85
84
83
82
81
80
79
78
77
76
VCAP/VDDCORE
RE4
RE3
RE2
RG13
RG12
RG14
RE1
RE0
RA7
RA6
RG0
RG1
C1TX/RF1
RD6
RD5
RD4
C1RX/RF0
VDD
RD7
RD13
RD12
RD3
RD2
RD1
3V3 1 75
RG15 VSS
2 VDD RC14 74
3 73 20pF C9
C1 RE5 RC13
4 RE6 RD0 72
100nF 5 71
RE7 RD11
6 RC1 RD10 70
3V3 7 69 Y1
RC2 RD9 OC 8MHz
8 RC3 RTCC/IC1/RD8 68
9 RC4 RA15 67
R1 10 66
4.7K RG6 RA14
11 RG7 VSS 65
12 64 20pF C8
RG8 PIC32MX795F512L OSC2
13 MCLR OSC1 63
14 RG9 VDD 62
3V3 15 61
VSS RA5 C7
16 VDD RA4 60
17 59 100nF J1
C2 RA0 RA3 VBUS
18 RE8 RA2 58
100nF 19 57 1
RE9 D+ 1
20 VBUSON/RB5 D- 56 2 2
21 RB4 VUSB 55 3 3
22 RB3 VBUS 54 4 4
23 RB2 RF8 53 5 5
24 RB1 RF2 52 6 6
25 RB0 USBID/RF3 51
R2
PGEC2/RB6
PGED2/RB7
470 R3 MINI-B USB RECPT
470
C6
AVDD
ICSP
AVSS
RD14
RD15
RA10
RB10
RB11
RB12
RB13
RB14
RB15
RF13
RF12
VDD
VDD
VSS
VSS
RA9
RB8
RB9
RA1
RF4
RF5
100nF
3V3
1
RB1 2
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
RB0 3
4
5
6
3V3 3V3 3V3
C3 C4 C5
100nF 100nF 100nF
VR1 TC1262-3.3
VBUS 3V3 R6 470 VBUS
1 3 U2
IN OUT 5V0 R5 470
C13 C12 5 1
COM
EN OC
OC
TPS2041BDBVT
The Report ID byte and the echoed command byte value must be converted to a floating point value. Twisting
precede the actual raw voltage data in the receive buffer. the potentiometer’s wiper and clicking on the Read
Since the 10 bits of incoming raw voltage data is in byte Voltage button produced the content contained within
format, we need to convert the pair of voltage bytes to an Screenshot 3.
integer. In that we must do some scaling of the integer
voltage value for display in the ListBox, the integer voltage
AS EASY AS RS-232
■ PHOTO 1. This is a shot of my slightly modified I never thought I would admit it. With the
PIC32MX795F512L TRAINER. The voltage from the MCHPFSUSB Framework working on the TRAINER side
potentiometer’s wiper is one of many data types that
can be transferred in a HID report. If you send a 0x80 and the Kadtronix Library operating within Microsoft’s
instead of the 0x37, you’ll gain control of the LEDs Visual C++ component of VS 2008, coding a useful HID
attached to RB0 and RB1.
SOURCES
Microchip
MCHPFSUSB Framework ; PIC32MX795F512L
www.microchip.com
Microsoft
Visual Studio 2008
www.microsoft.com
Kadtronix
Kadtronix USB HID API Library
www.kadtronix.com
EDTP Electronics, Inc.
PIC32MX795F512L TRAINER
www.edtp.com
72 February 2010
THE DESIGN CYCLE
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
February 2010 73
CLASSIFIEDS
KITS/PLANS SURPLUS
BOOKS
%RRNV
3,&0LFURFRQWUROOHU
VTFRP
6WHSSHU0RWRUV DESIGN/ENG
VWHSSHUVWXIIFRP
SERVICES
&1&
FQFLQWURFRP
OSCILLOSCOPES
7 in 1 Scope ! ROBOTICS
YOUR COMPLETE
GADGETS CircuitGear CGR-101™ is a unique new,
low-cost PC-based instrument which provides
SOLUTION!
the features of seven devices in one USB- • PCB Design
• PCB Simulation
powered compact box: 2-ch 10-bit 20MS/sec
2MHz oscilloscope, 2-ch spectrum-analyzer,
3MHz 8-bit arbitrary-waveform/standard-
function generator with 8 digital I/O lines.
• CAD/CAM Menu
121747, Hobby Vers., $175
What’s more – its open-source software runs
with Windows, Linux and Mac OS’s! Only $180
1-888-7SAELIG
121743, Pro. Version, $275 Looking for robots?
info@saelig.com
www.saelig.com
www.KELVIN.com www.servomagazine.com
74 February 2010
CLASSIFIEDS
MICROCONTROLLERS COMPONENTS
>>> QUESTIONS with a tungsten torch (TIG) requires a used in radios, cordless tools, etc. It
variable frequency higher than the 60 must be switchable to allow testing of
Motion Sensing Faucet Hz to make the best weld due to the various voltages between 2V and 36V.
I want to create a motion sensing nature of aluminum oxide and alloy. It #2106 Travis Branch
electronic flow faucet. The solenoid is suggested in my reading that Winston Salem, NC
valve is normally closed with an commercial TIG welder circuits change
operating voltage of 24V. the sine wave to a square wave. Battery Substitution
I'm new to this hobby, so I'm not My welder has lugs on the I have a Victoreen 592b Geiger
sure where to start as far as the circuit transformer to switch to in order to type device. It requires nine batteries;
design goes. I thought of purchasing select the range of amperage for weld- six of them are the 22.5V photo style
an electronic light switch and ing steel. I will continue to set a range battery, the other three are unknown.
modifying it to trip the solenoid valve, for the metal thickness of aluminum. There is no part number or voltage
but the switches are expensive. My concept is to add an auxiliary listed, but the location for them makes
#2101 TJ Treinen box to house the power supply for the them as 1-1/8" diameter and a little
Oklahoma City, OK electronics, the cooling fan, and either over 1/2" high.
the cable to a foot switch or rheostat I have searched the web and the
Spot Welder mounted to the torch head or surface Victoreen site but cannot find
Where can I find or make a simple mounting. A selector switch will turn anything about any kind of battery
spot welder suitable for rebuilding the TIG feature on or off to continue fitting this description or any
battery packs? to use the original welding feature or information about this device. Can
#2102 John to TIG weld. anyone help with the information so I
I have found circuits where the can use my old friend?
Centrally Monitor Door Status frequency can be varied, but at low #2107 Norm Doty
I want to monitor the open or voltage and amperage — nothing in Hollywood, FL
close status of 20 or more doors in a the ranges I need. The components
building. Are there devices made that would be smoked immediately when Vehicle Speed Threshold Trigger
would send a location address and switched on, or an arc was struck. To assist with parking, I'm
magnetic door switch status via Cat 5 One article on converting an AC to installing front and side view cameras
cable about 200’ back to a central DC MIG welder suggested the diodes on my truck. The vehicle is already
panel? I would like these devices to in the rectifier have a peak invert volt- equipped with a rear-view camera (with
share a common pair and be powered age of 1,000 volts for the momentary display and associated electronics), and
from the central panel too. The panel time when striking the arc, and be able I also have a video switcher to select
would light up an LED. to handle the amperage of the original the desired view. As viewing any video
#2103 Mike Carland welder — 225 amps. Although I am while driving may be dangerous
Valencia, CA not going to convert my welder to DC, though, my goal is to disable the
the information of peak voltage and camera outputs at, say, 5 mph.
AC Motor Control amperage for any suggested circuit I'd like to use a PIC to monitor
I would like a diagram for a three- design may be helpful. vehicle speed and output a signal
phase AC motor control that I can #2105 John Johnson when the speed threshold is met. The
build myself. I can find all kinds for St. Clair Shores, MI truck's PCM currently provides a 5V
DC, but not AC. Could someone point squarewave pulse signal which
me in the right direction? Battery Load Tester appears to be close to the actual
#2104 Sebastian Jaime I am looking for a circuit for testing vehicle speed (mph), e.g., 12 Hz = 10
WB4WLZR the load of rechargeable batteries mph. Any help utilizing a PIC to
Miami, FL
All questions AND answers are submitted by readers and NO GUARANTEES
Welder Conversion by Nuts & Volts readers and are intended WHATSOEVER are made by the publisher.
I am working on a project to to promote the exchange of ideas and The implementation of any answer printed
provide assistance for solving technical in this column may require varying degrees
enhance my Lincoln 225 amp 220 volt problems. Questions are subject of technical experience and should only be
AC welder. I wish to find a circuit that to editing and will be published on a attempted by qualified individuals.
can change the 60 Hz AC to a variable space available basis if deemed suitable Always use common sense and good
higher frequency. Welding aluminum by the publisher. Answers are submitted judgement!
76 February 2010
> > > YO U R E L E C T R O N I C S Q U E S T I O N S A N S W E R E D H E R E BY N & V R E A D E R S
February 2010 77
TECHFORUM
READER-TO-READER
the port will output a waveform with a than four LEDs, it should be possible to an interrogator device so I can transfer
specific duty cycle. Changing the duty sample the PWM output pin and drive daily/hourly water use to my computer
cycle will change the brightness of the the remaining output pins. in order to monitor water consumption.
LED. I was able to use the pwmout Code example: Is this possible without buying an
command to slowly ramp the bright- b0 = 0 industrial reader?
ness of an LED up and down with a b1 = 0
myled:
short program. I could easily tweak the pwmout 2,50,b0 If the Sensus water meter
code to change the overall cycle time pause 5 radio-read system is the same one we
or rate at which the LED changes if b1=0 then evaluated a few years ago for the city
brightness. inc b0 of Detroit, your only option is to install
Programming the PICAXE is easy if b0=255 then your own separate meter in series.
using free software from www.picaxe b1=1 There are models with pulses that
endif
.co.uk. There are several parts else represent units of flow, and some can
distributors in the US including www. dec b0 generate an ASCII data stream of the
phanderson.com who also sells a if b0=0 then dials on demand.
inexpensive prototype PC board kit b1=0 Most water systems have policies
with programming interface and volt- endif that do not allow customers to
age regulator for $8. A single PICAXE endif interface with their meters. This is their
goto myled
can be reprogrammed thousands of cash register, and their policy is "DO
times, so it's easy to experiment and Bob Kovacs NOT TOUCH." They worry about
debug your program until you get it Barnegat, NJ setting precedents, so your chances of
working the way you want. getting an approval for an interface
The PICAXE can source or sink up [#10091 - October 2009] are slim to none. Reading it without
to 25 mA per pin, so several LEDs Radio Read Interrogation Device permission would be considered
could be supported by a single PICAXE My city has installed an Invensys tampering because accessing the
circuit by wiring them in series and/or water meter with a Sensus radio read radio will deplete the battery that
parallel. If you need to control more transceiver. I would like to build/buy powers the radio.
The Sensus radio is powered by a
battery expected to last many years.
The radio idles in a low power monitor
mode and is awakened by a signal
from the passing drive-by reader
vehicle, after which it transmits three
reads at random intervals. The random
transmissions are necessary because
the wake-up signal will trigger all
meters within range. It has been too
long since this pilot project was
scrapped and replaced by a fixed-base
system, but I think the Sensus
system (we tested several) had an
acknowledge to prevent a re-trigger to
save the battery and to allow missed
meters to get through. The data format
is proprietary, and it contains the
meter's ID to distinguish it from your
neighbor's. The reads are sorted by the
reading system software. In summary,
the radio cannot support additional
reads. Daily reads would divide the
battery life proportionately which
would be unacceptable to the utility,
and it is nearly impossible to restrict
the signal enough to avoid triggering
other near-by meters.
There is an interface that is read
by a touch wand. The wand supplies
78 February 2010
the power by induction, and the touch have transformers. They put out three the output voltage by changing the
pad can be paralleled with the radio. I or four amps. How do they do it? duty cycle and/or frequency of the
don't know if it can be retro-fit to your drive signal to the power MOSFET
model Invensys meter. Again, the Your solution would be to use a gate. The key to small compact size
politics probably will block any chance switchmode power supply. This is the lies in the high switching frequency
of getting your utility to provide the technology that allows small compact which enables the use of small ferrite
device, and Sensus may not be willing designs for low voltage, high current core transformers.
to give you the information you need output power supplies. Now to the designing of
to simulate the touch reader. You Basic operation is as follows. Input switchmode power supplies. This is
probably could install your own meter of 90-240 VAC is rectified and not for the novice nor for someone
for what the utility would charge to smoothed somewhat by capacitors; inexperienced in the field of power
provide the touch pad. the resulting DC is applied to a electronics simply because of the high
Dennis Green, PE high-speed power MOSFET switching voltages involved and the critical
Head Water Systems Engineer device whose gate is operated by a nature of switchmode power supply
Detroit Water & Sewerage Dept PWM controller at a high frequency design. If you want to find out more
(30-400 kHz). The power MOSFET about switchmode power supplies,
[#11091 - November 2009] drives the primary coil of a ferrite core some good books and websites
Power Supply transformer (yes, transformers are (www.smpstech.com; www.smps.us)
I am designing a project where involved) at the frequency produced are available. However, if you just
weight is at a premium. I need some by the PWM controller; the secondary need to get your project going, any
help designing a transformerless power of the transformer is then connected electronics parts supplier (even
supply that can deliver 12-14 volts at to a rectifier diode/s to produce DC, surplus electronics suppliers) will carry
three amps. It needs to be auto and then capacitors and filters to ready-made and approved units in
switching 110/220 VAC. I designed a smooth the DC and reduce high virtually any voltage or current
few projects in the past but they frequency components produced by combination to suit your needs.
always had a transformer. I see things the switching action. Feedback loops Alberto Bonini
like laptop power supplies that don't enable the PWM controller to regulate ONT, Canada
February 2010 79
&2/.4 0!.%,3 %.#,/352%3
#USTOMIZED FRONT PANELS CAN BE EASILY
DESIGNED WITH OUR FREE SOFTWARE
&RONT 0ANEL $ESIGNER
s #OST
EFFECTIVE PROTOTYPES
AND PRODUCTION RUNS
s 7IDE RANGE OF MATERIALS OR
CUSTOMIZATION OF PROVIDED
MATERIAL
s !UTOMATIC PRICE CALCULATION
s &ABRICATION IN OR DAYS
3AMPLE PRICE
PLUS 3(
WWWFRONTPANELEXPRESSCOM
80 February 2010
■ LOOK FOR
AMATEUR
■ SEARCH FOR
Find your favorite advertisers here!
■ FIND
Dimension Engineering .........................30 EMBEDDED TOOLS Pololu Robotics & Electronics ...............24 Integrated Ideas & Tech. ...........54
ExpressPCB .........................................41 Mouser Electronics ..............................15 Robot Power ........................................54 Jameco ......................................22
Futurlec ................................................79 NetBurner ...............................................7 Solarbotics/HVW ..................................30
Jaycar Electronics ........................4
PCB Pool .............................................12
Lakeview Research....................25
SJ Valley Engineering ..........................46 ENCLOSURES SATELLITE
LeCroy..........................................5
Front Panel Express LLC ......................80
Lemos International Co., Inc. ...............25
COMPONENTS Integrated Ideas & Tech. ......................54 Lemos International Co., Inc. ....25
HobbyLab .............................................25 WeirdStuff Warehouse .........................24 NetBurner ...............................................7 Surplus Gizmos .........................73
microEngineering Labs .........................73 Technological Arts .....................25
Mouser Electronics ..............................15 MOTORS WIRE, CABLE
Trace Systems, Inc. ..................36
Net Media ...............................................2 BaneBots ...............................................9 AND CONNECTORS
WeirdStuff Warehouse ..............24
Parallax, Inc. ..........................Back Cover Jameco ................................................22 DesignNotes.com, Inc. ..........................25
XGameStation ...........................25
Pololu Robotics & Electronics ...............24 Jameco ................................................22
February 2010 81
CircuitSpecialists.com
1000’s of Items Online! 1-800-528-1417 Fax: 480-464-5824 Since 1971
t,
2.4GHz 2 Camera Wireless
Wireless System men ,
force lumbing
Aardvark
w E n P
L a o n ,
l for ecti
Idea ire Insp enence, any
s t F i n t M
Po Ma s, &
a c i lities ompanie
F
rity C
Secu UsesI Wireless Inspection Camera
r
Othe With Color 3.5" LCD Recordable Monitor
Your Extended Eyes & Hands!
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
CircuitSpecialists.com
1000’s of Items Online! 1-800-528-1417 Fax: 480-464-5824 Since 1971
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