www.circuitcellar.

com
THE wORLD’S SOURCE fOR EMBEDDED ELECTRONICS ENGINEERING INfORMATION
$7.50 U.S. ($8.50 Canada)
MARCH 2011
ISSUE 248
ROBOTICS
MCU-Based Digital
Pan Head Controller
Computer-Controlled
Machining
Build a Remotely
Operated Vehicle
Super-Regenerative
Receiver
PLUS
Designer Competency
Project-Essential Concepts
// Scheduling
// State Machines
// Simulation
// Code Validation
IMPLEMENTATION: DSP for Lighting Apps INSIGHT: Understand & Control Current Consumption DESIGN TIP: Timekeeping with an RTCC
ORIGIN: Italy ORIGIN: United States ORIGIN: United States
PAGE: 38 PAGE: 60 PAGE: 66
Cover - 248_Layout 1 2/9/2011 2:34 PM Page 1
Low-cost Industrial
Serial to Ethernet Solutions
- |nstantly network-enable any serlal devlce
- No programmlng ls requlred for serlal to Lthernet appllcatlon
- Customlze to sult any appllcatlon wlth a development klt
SBL2e Chip
2-port serlal-to-Lthernet server
wlth elght A/D converter lnputs
and optlonal SP|, |2C perlpheral
devlce support
SBL2e 200
2-port serlal-to-Lthernet server
wlth four A/D converter lnputs,
optlonal |2C perlpheral support
and l0-pln header
SBL2e
Serial-to-Ethernet server
with RS-232 support
SBL2e XA
Lxternal server wlth up to
four A/D converter lnputs,
up to elght dlgltal |/O and up
to two UAPTS (one PS-232)
SBL2e 100
2-port serlal-to-Lthernet server
wlth four A/D converter lnputs,
optlonal |2C perlpheral support
and P145 connector
Hardware Features
Up to three serlal ports, l0/l00 Mbps Lthernet, up to l0 dlgltal |/O,
l2-blt A/D converters, operatlng temperature -40 to 85 C, 32-blt performance
Software Features
TCP/UDP/Telnet/HTTP modes, DHCP/Statlc |P support, web-based or
AT command conñguratlon
Low Prices
S8L2e Chlp.................... $l0.50 (Oty. l0k, Devlce P/N: S8L2eCH|P-236|P)
S8L2e 200...................... $l9.95 (Oty. l000, Devlce P/N: S8L2e-200|P)
S8L2e l00...................... $2l.95 (Oty. l000, Devlce P/N: S8L2e-l00|P)
S8L2e X........................... $79.00 (Oty. l000, Devlce P/N: S8L2eX-l00|P)
S8L2e XA........................ $79.00 (Oty. l000, Devlce P/N: S8L2eXA-l00|P)
Need a custom solution?
Net8urner Serlal to Lthernet Development Klts are avallable to customlze any
aspect of operatlon lncludlng web pages, data ñlterlng, or custom network
appllcatlons. All klts lnclude platform hardware, ANS| C/C++ compller, TCP/|P
stack, web server, e-mall protocols, PTOS, and N8 Lcllpse |DL.
Information and Sales | sales«netburner.com
Web | www.netburner.com Telephone | l-800-695-6828
C2_Layout 1 2/9/2011 10:45 PM Page 1
9.qxp 8/7/2008 11:04 AM Page 1
3x faster
and backward
compatible with TS-72xx
S


Most products stocked and available
for next day shipping Engineers on Tech Support
Design your solution with one of our engineers (480) 837-5200
Custom configurations and designs w/
excellent pricing and turn-around time
Over 25 years in business
Never discontinued a product
N

Open Source Vision
High-End Performance
with Embedded Ruggedness
128MB DDR RAM
Gigabit ethernet
2 host USB 2.0 480 Mbps
12K LUT customizable FPGA
512MB high-speed
(17MB/sec) onboard Flash
Sleep mode uses 200 microamps
2 SD sockets
Linux 2.6 and Debian by default
10 serial ports
qty 100
229
$
Unbrickable
design
5 ADC (10-bit) 2 SATA ports
110 GPIO
Boots Linux 2.6 in 0.7 seconds
Internal PCI Bus, PC/104 connector
shown
w/ optional
SD Cards
Low power - 4W@5V
qty 1
269
$











TS-TPC-7390
200 MHz ARM9
Dedicated framebuffer- 8MB RAM
800 x 480 video core
64MB SDRAM (128MB opt)
Runs Eclipse IDE out-of-the-box
Boots Linux 2.6 in less than 2 seconds
Unbrickable, boots from SD or NAND
Runs X Windows GUI applications
512MB Flash w/ Debian Linux
Mountable aluminum frame
Low Power, Industrial Quality Design
qty 1
449
$
Audio codec with speaker
7” Color Touch Panel Computer
More Touch Panel Computers on our website
q
TS-7800
500 MHz ARM9


Embedded Systems






























2_Layout 1 2/9/2011 2:56 PM Page 1



Systems
Technologic
Visit our TS-7800 powered website at
We use our stuff.
www.embeddedARM.com
M






New Products















design
5







TS-4200: Atmel ARM9 with super low power
Low profile w/ 6mm spacing
Common pin-out interface
Several COTS baseboards for evaluation & development
TS-4300: Cavium ARM11 with dual 600 MHz and FPU
TS-4700: Marvell PXA168 with video and 1.2 GHz CPU
Secure connection w/ mounting holes
Dual 100-pin connectors
TS-4500: Cavium ARM9 at very low cost
qty 100
92
$
starts at
series
T















qty 1
185
$

TS-SOCKET Macrocontrollers
Jump Start Your Embedded System Design
E
TS-SOCKET Macrocontrollers are CPU core modules that
securely connect to a baseboard using the TS-SOCKET
connector standard. COTS baseboards are available or
design a baseboard for a custom solution with drastically
reduced design time and complexity. Start your embedded
system around a TS-SOCKET Macrocontroller to reduce
your overall project risk and accelerate time to market.
TS-4800: Freescale iMX515 with video and 800 MHz CPU
75 mm / 2.953 in.
5
5

m
m

/

2
.
1
6
5

i
n
.
Current projects include:
Ideal for gateway or firewall, protocol
converter, web server, WiFi audio, and
unattended remote applications
64MB DDR-RAM
480Mbit/s USB, Ethernet, PoE option
RS-232, RS-485, CAN, RTC
Customizable FPGA - 5K LUT
Boots Linux 2.6.24 in < 3 seconds
Micro-SD Card slot
Power via 5-12 VDC, USB, PoE (opt.)
Low power (3.2 watts), fanless
Un-brickable, boots from SD or flash
Optional DIN mountable enclosure
256MB ultra-reliable XNAND drive
Header with SPI and 11 DIO
TS-WIFIBOX-2
A Complete Solution for 802.11g WiFi Applications
3_Layout 1 2/9/2011 2:56 PM Page 1
FOUNDER/EDITORIAL DIRECTOR
Steve Ciarcia
EDITOR-IN-CHIEF
C. J. Abate
ASSOCIATE EDITOR
Nan Price
WEST COAST EDITOR
Tom Cantrell
CONTRIBUTING EDITORS
Jeff Bachiochi
Robert Lacoste
George Martin
Ed Nisley
NEW PRODUCTS EDITOR
John Gorsky
PROJECT EDITORS
Ken Davidson
David Tweed
ADVERTISING
800.454.3741 • 978.281.7708 • www.circuitcellar.com/advertise
ADVERTISING REPRESENTATIVE
Peter Wostrel
Strategic Media Marketing, Inc.
1187 Washington St., Gloucester, MA 01930 USA
800.454.3741 • 978.281.7708
peter@smmarketing.us • www.smmarketing.us
Fax: 978.281.7706
ADVERTISING COORDINATOR
Valerie Luster
E-mail: val.luster@circuitcellar.com
CONTACTS
SUBSCRIPTIONS
Information: www.cc-access.com, E-mail: subscribe@circuitcellar.com
Subscribe: 800.269.6301, www.cc-access.com, Circuit Cellar Subscriptions, P.O. Box 5650,
Hanover, NH 03755-5650
Address Changes/Problems: E-mail: subscribe@circuitcellar.com
GENERAL INFORMATION
860.875.2199, Fax: 860.871.0411, E-mail: info@circuitcellar.com
Editorial Office: Editor, Circuit Cellar, 4 Park St., Vernon, CT 06066, E-mail: editor@circuitcellar.com
New Products: New Products, Circuit Cellar, 4 Park St., Vernon, CT 06066, E-mail: newproducts@circuitcellar.com
AUTHORIZED REPRINTS INFORMATION
860.875.2199, E-mail: reprints@circuitcellar.com
AUTHORS
Authors’ e-mail addresses (when available) are included at the end of each article.
CIRCUIT CELLAR®, THE MAGAZINE FOR COMPUTER APPLICATIONS (ISSN 1528-0608) is published monthly by Circuit Cellar
Incorporated, 4 Park Street, Vernon, CT 06066. Periodical rates paid at Vernon, CT and additional offices. One-year (12 issues)
subscription rate USA and possessions $45, Canada/Mexico $60, all other countries $63. Two-year (24 issues) subscription
rate USA and possessions $80, Canada/Mexico $110, all other countries $116. All subscription orders payable in U.S. funds
only via Visa, MasterCard, international postal money order, or check drawn on U.S. bank. Direct subscription orders and sub-
scription-related questions to Circuit Cellar Subscriptions, P.O. Box 5650, Hanover, NH 03755-5650 or call 800.269.6301.
Postmaster: Send address changes to Circuit Cellar, Circulation Dept., P.O. Box 5650, Hanover, NH 03755-5650.
Circuit Cellar® makes no warranties and assumes no responsibility or liability of any kind for errors in these programs or schematics or for the
consequences of any such errors. Furthermore, because of possible variation in the quality and condition of materials and workmanship of read-
er-assembled projects, Circuit Cellar® disclaims any responsibility for the safe and proper function of reader-assembled projects based upon or
from plans, descriptions, or information published by Circuit Cellar®.
The information provided by Circuit Cellar® is for educational purposes. Circuit Cellar® makes no claims or warrants that readers have a right to
build things based upon these ideas under patent or other relevant intellectual property law in their jurisdiction, or that readers have a right to
construct or operate any of the devices described herein under the relevant patent or other intellectual property law of the reader’s jurisdiction.
The reader assumes any risk of infringement liability for constructing or operating such devices.
Entire contents copyright © 2011 by Circuit Cellar, Incorporated. All rights reserved. Circuit Cellar is a registered trademark of Circuit Cellar, Inc.
Reproduction of this publication in whole or in part without written consent from Circuit Cellar Inc. is prohibited.
Cover photography by Chris Rakoczy—Rakoczy Photography
www.rakoczyphoto.com
PRINTED IN THE UNITED STATES
Robotics is a term that conjures up a variety of images,
from humanoid prototypes to Hollywood animatronic
designs to floor-vacuuming consumer appliances. Since
1988, we’ve published articles about projects pertaining to
such robotic electronics applications. In fact, many of our
readers both directly and indirectly contributed to the devel-
opment of those systems, many of which are now common-
ly used in residential and industrial environments. But this
issue doesn’t feature typical robotics applications. We’re
highlighting a topic a bit more specific: control electronics.
MCU-based machine control is one of the most fascinat-
ing fields of electronics engineering. And, each year, it’s
growing in importance as engineers find new ways to incor-
porate MCU-based sensor systems and motorized designs in
the industrial automation, defense, aerospace, and consumer
electronics industries (to name only a few). Thus, we’re ded-
icating much of this issue to the ever-evolving field of con-
trol electronics.
Turn to page 20 to learn how Richard Lord built a panning
control system. The motorized design enables a photogra-
pher to rotate a camera to take uniformly overlapping
images without distortion.
Next, consider Brian Senese’s remotely operated vehicle
(ROV) project, which he describes on page 28. You know
how a basic RC vehicle system works. But that isn’t Brian’s
focus. Again, what’s important is the concept of electronics
control. The idea is to plan, build, and then program an effi-
cient system that provides end users with complete control
over a mobile vehicle. The possibilities for such applications
are endless.
On page 38, Marco Signorini addresses the important
topic of light control, which is particularly important in
automotive, aerospace, and entertainment applications. He
describes how to embed a DSP device and a series of con-
stant-current generators to drive a group of high-power
LEDs. Follow his lead to build a lighting control system of
your own.
Brian Millier uses control electronics in a more industri-
al environment: his workspace. In an article titled “CNC
Router Design,” he presents his computer-controlled CNC
router system. A master at instrumentation engineering
(just refer to his previous Circuit Cellar articles), Brian
understands that precision cutting and drilling are the keys
to working successfully with metals, woods, and plastics.
We’re confident these projects will inspire you to develop
your own electronics control systems. However, if after read-
ing this issue you still have a hankering for a classic robotics
project like the vision-guided balancing robot Hanno Sander
described in Circuit Cellar 224 (March 2009), go to www.cc-
webshop.com and search away!
Control Electronics
cj@circuitcellar.com
4
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
T
ASK
M
ANAGER
Circuit Cellar’s mission is to collect, select, and disseminate need-to-know informa-
tion around the world in the fields of embedded hardware, embedded software, and
computer applications. Circuit Cellar uses an assortment of print and electronic con-
tent-delivery platforms to reach a diverse international readership of professionals,
academics, and electronics specialists who work with embedded, MCU-related tech-
nologies on a regular basis. Our aim is to help each reader become a well-rounded,
multidisciplinary practitioner who can confidently bring innovative, cutting-edge engi-
neering ideas to bear on any number of relevant tasks, problems, and technologies.
PUBLISHER
Hugo Van haecke
ASSOCIATE PUBLISHER
Shannon Barraclough
CUSTOMER SERVICE
Debbie Lavoie
Kim Hopkins
CONTROLLER
Jeff Yanco
ART DIRECTOR
KC Prescott
MARKETING ASSISTANT
Daniel Netkin-Colllins
GRAPHIC DESIGNERS
Grace Chen
Carey Penney
STAFF ENGINEER
John Gorsky
THE WORLD’S SOURCE FOR EMBEDDED ELECTRONICS ENGINEERING INFORMATION
Task_Masthead_248_masthead.qxd 2/11/2011 9:25 AM Page 4
Mouser and Mouser Electronics are registered trademarks of Mouser Electronics, Inc. The Newest Products for Your Newest Designs is a registered trademark of Mouser Electronics, Inc
mouser.com
Semiconductors and electronic
components for design engineers.
You’ll find the newest products for your newest designs.
Get what’s next at Mouser.
Scan Here
mouser.com
We’ve got what
design engineers
need. The future.
m
5_Layout 1 2/8/2011 3:08 PM Page 1
6
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
INSIDE ISSUE
TASK MANAGER 4
Control Electronics
C. J. Abate
NEW PRODUCT NEWS 8
TEST YOUR EQ 15
CROSSWORD 74
INDEX OF ADVERTISERS 79
April Preview
PRIORITY INTERRUPT 80
Forks in the Road
Steve Ciarcia
16 THE CONSUMMATE ENGINEER
The Super-Regenerative Receiver
George Novacek
56 LESSONS FROM THE TRENCHES
The Project-Ready Designer
A Refresher on Project-Essential Concepts
George Martin
60 FROM THE BENCH
Direct Line Connection
When You Don’t Require Line Isolation
Jeff Bachiochi
66 SILICON UPDATE
Time Traveler
Embedded Timekeeping and More
Tom Cantrell
20 Panning Control
A Digital Indexing Panoramic Tripod Head
Richard Lord
28 Remotely Operated Vehicle Design
Brian Senese
38 Embedded DSP for Lighting
Marco Signorini
46 CNC Router Design
A Look at Computer-Controlled Machinery
Brian Millier
March 2011 • Robotics
Panning Control System
ROV Design and Construction
p. 20
Embedded DSP
p. 38
p. 28
TOC_248_toc.qxd 2/11/2011 9:34 AM Page 6
www.nxp.com/cortex-m0
We’re changing how engineers think about design, with Cortex-M0

solutions that
let you save power, reduce cost, shrink your design, and get to market fast.
Lowest active power — as low as 130µA/MHz
Superior Code Density — 50% less code for most tasks
Higher performance — LCP1100 runs at over 45 DMIPS
Smallest size — the LPC1102 has a footprint of 5 mm
2
Low-cost toolchain — LPCXpresso for less than USD 30
Show us how you switched from your old 8-/16-bit habit to the new 32-bit NXP
Cortex-M0 solution and we’ll send you a FREE LPCXpresso development board.
Cortex-M0 a simple choice
7_Layout 1 2/8/2011 3:09 PM Page 1
8
CIRCUIT CELLAR
®

www.circuitcellar.com
N
EW
P
RO
DU
CT
NE
W
S
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Edited by John Gorsky
LINUX-BASED ARM9 READY-TO-GO SYSTEM ON MODULE
The M-502 is an ARM9, Linux-based system on module (SoM). The M-502 is powered by a 400-MHz ARM926EJ-S ARM
Thumb processor with a memory management unit, and it’s equipped with 64-MB SDRAM, 128-MB NAND flash, and 2-MB data
flash. The M-502 is also pre-installed with Linux 2.6.29 OS, busybox utility collection, lighttpd webserver, and various hardware
device drivers. The module also provides flexibilities in peripheral expansion by integrating one 10/100-Mbps ethernet, two
USB 2.0 hosts, four UARTs with hardware/software flow control, and 32 programmable digital I/Os. In addition, the M-502
comes with a secure datacard (SD) interface, serial peripheral interface (SPI), I
2
C bus, I
2
S bus, and an 8-bit local bus. The GNU
C/C++ cross compiler is included in the development kit, allowing users to develop their application software on PCs without
the need to learn and purchase an extra commercial developing tool.
The M-502 SoM combines powerful computing capabilities, large memory
space, and high scalability, making it easy for users to develop their application
without compromising system performance. Flexible and reliable design leaves
users worry free when focusing on their application software development,
reducing 80% of the development time and cost normally required.
Contact Artila for pricing.
Artila Electronics Co., Ltd.
www.artila.com
HALL SENSOR FOR 360° NAVIGATION IN HMIs
The AS5013 is a complete Hall sensor IC for human-machine interface (HMI) applications requiring low power. The sensor
comprises a contactless magnetic encoder IC that monitors the displacement of a magnet incorporated in a knob relative to
its center position, and it provides x and y position information via an I²C interface. The AS5013 is used in the EasyPoint mini-
joystick module, which consists of a mechanical stack incorporating a navigation knob, a magnet, and the encoder IC. Its sim-
ple construction and contactless sensing technology give the module very high reliability, and it is designed for any kind of
360° navigation input device.
The IC includes user-selectable power-saving modes, five integrated Hall sensing elements for detecting up to ±2-mm lateral
displacement, a high-resolution ADC, an XY coordinate and motion
detection engine, and a smart power management controller. The XY
coordinate registers and magnetic field information for each Hall sensor
element are transmitted over the I²C interface to the host processor.
The HMI device also provides two interrupt modes: motion detect, and
data ready; and two operating modes: idle mode, with less than 3 µA cur-
rent consumption, and low-power mode, with selectable readout rate.
The low-power AS5013 operates over a power supply range of 2.7 to
3.6 V, and down to a 1.7-V peripheral supply voltage.
The AS5013 contactless magnetic encoder IC is available now and
costs $2.92 in 1,000-piece quantities.
austriamicrosystems
www.austriamicrosystems.com
OPTICAL FINGER NAVIGATION MODULE
The Optical Finger Navigation (OFN) Module can add a unique human interface component to BASIC Stamp or Propeller projects.
OFN Modules are becoming popular as user input devices in many smart phones as a replacement for track-
balls, which are subject to mechanical wear and tear. OFN technology is similar to the technology used in
optical mice, and movement across the sensor can be read by any MCU using I
2
C communication.
The module features a built-in center select button, an on-board red LED that illuminates
when finger movement is detected, easy I
2
C communication to interface with virtually any
microcontroller, and an on-board voltage regulator. Resolution is selectable from 500 to
1,000 cpi, and the module offers a breadboard-friendly package with 0.1″ pin spacing.
Application ideas include video game input, mouse replacement, or user input for comput-
ing devices. The Optical Finger Navigation Module (part number 27903) costs $19.99.
Parallax, Inc.
www.parallax.com
Press Proof
Changes
Art
npn248_Layout 1 2/10/2011 11:42 AM Page 8
www.circuitcellar.com

CIRCUIT CELLAR
®
9
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
LOW-POWER DIGITAL AMBIENT-LIGHT SENSOR
The MAX9635 is a digital ambient-light sensor (ALS) with a unique adaptive gain block. The MAX9635 consumes 100× less
power than the nearest competitive product, significantly extending battery life.
Replicating the optical response of the human eye with electronic components is difficult. Traditional light sensors measure
the amount of light in an environment regardless of wavelength. These designs are unduly influenced by ultraviolet and
infrared light, which are not perceptible by the human eye.
Maxim’s BiCMOS technology enables the integration of two photodiodes along with an optical filter to reject ultraviolet and
infrared light. This allows the MAX9635 to replicate the
optical response of the human eye and accurately
measure visible light in a variety of environmental set-
tings. Advanced algorithms correct for any spectra vari-
ations between light sources, ensuring an extremely
accurate lux response.
The MAX9635 is equipped with an adaptive gain
block that automatically selects the optimum gain
range. The adaptive gain block provides the industry’s
widest dynamic range (more than 4,000,000 to 1),
enabling the MAX9635 to measure light levels from
0.045 lux to 188,000 lux. As an added benefit, the
device’s low-light sensitivity makes it suitable for appli-
cations in which the sensor IC is placed behind black
glass, which greatly reduces the amount of ambient
light.
Pricing starts at $1.20 in 1,000-piece quantities.
Maxim Integrated Products
www.maxim-ic.com
N
EW
P
RO
DU
CT
NE
W
S
Edited by John Gorsky
NPN
npn248_Layout 1 2/10/2011 11:42 AM Page 9
MICRO-PROXIMITY SWITCH
The R12575 is a micro-proximity switch that’s ideal for use in noncontact position sensing in very small spaces. Built
around the proven GR200 ultra-small magnetic reed switch, the R12575 measures just 0.379″ in length and 0.098″ in diam-
eter, yet provides unparalleled sensitivity and performance. These new switches are ideal for a variety of applications where
size reduction is required without sacrificing performance. Typical applications include security systems, safe applications, and
industrial control applications where the equipment design leaves little space for the proximity sensor.
The R12575 is well suited for applications where the magnetic field is very low and where space limitations are a major
design factor. There is no power draw in the off state, which is an important consideration for battery-driven applications. Lead
length and termination can be customized for specific customer specifications.
In addition to a small footprint and tight sensitivity range, with three standard sen-
sitivity ranges available, the R12575 series is responsive—with a typical operating
time of 0.2 ms, and a typical release time of 0.1 ms. The R12575 has a power rating
of 3 VA maximum and will switch 0.1 Amp. DC (maximum) with a carry current rating
of 0.5 Amps. DC. Switching voltage is 50 VDC (maximum). Boasting an operating
range of -40° to 125°C, they are well suited for use wherever small size and sensitivi-
ty are required for non-contact position sensing applications.
Contact Standex for pricing information.
Standex Electronics, Inc.
www.standexelectronics.com
10
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
NPN
LOW-COST, SMALL FORM FACTOR GPS RECEIVER
The MS20 is a new GPS receiver with excellent tracking and acquisition
capabilities. The MS20 GPS module is a highly sensitive, compact single-chip
solution for GPS applications. It includes an RF receiver, complete baseband
processor, flash memory, and a power control unit. The RF receiver minimizes
systems costs by using single-conversion low-IF digital architecture with high-
level integration, and leaving a few off-chip matching and decoupling compo-
nents.
The baseband processor is controlled by adaptive signal processing, and
navigation firmware is optimized for execution on a low-power microprocessor.
Optimal signal acquisition and tracking strategies are enabled by sophisticated
adaptive control algorithms.
The MS20 costs $21 in 10,000-piece quantities.
NavSync Ltd.
www.navsync.com
SMALL ISOLATED DC-TO-DC CONVERTER
The ADuM6000 is the industry’s smallest isolated DC-to-DC converter. Offering a 5-kV root-mean square (RMS) isolation rat-
ing in a 10 mm × 10 mm package, the ADuM6000 is a 0.5-W device that integrates Analog Device’s proprietary iCoupler digi-
tal isolation technology and isoPower DC-to-DC converter. The new digital isolator enables designers to free up valuable circuit-
board real estate while eliminating the time-consuming step of securing medical or other safety approvals (e.g., IEC-60601-1),
all at a fraction of the cost of alternative devices, including optocouplers.
The ADuM6000 digital isolator enables designers to reduce the form factor of their system module or to maintain the same
form factor even as they add more features and functions. With alternate solutions, such as optocouplers and separate, isolat-
ed DC-to-DC converters, it may not be possible to add new functionality to existing system modules.
Also now available are ADuM620x series dual-channel digital isolators that feature isoPower integrated, isolated DC-to-DC
converter technology and 5-kV RMS isolation rating. The ADuM620x series includes the ADuM6200, ADuM6201, and
ADuM6202 digital isolation products that differ by channel configuration.
ADI’s isoPower integrated, isolated DC-to-DC converter uses the same chip-scale
transformer technology. But instead of transmitting data, isoPower employs switches,
rectifiers, and regulators to generate power that is isolated to the same degree as the
data channels.
The ADuM6000 costs $3.96 in 1,000-piece quantities.
Analog Devices, Inc.
www.analog.com
npn248_Layout 1 2/10/2011 11:42 AM Page 10
www.circuitcellar.com

CIRCUIT CELLAR
®
11
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
ARM9 SBC WITH LINUX
NanosG20 is a universal Linux computer that consumes just 200 mW during normal use. Its diverse interfaces allow you to
connect Nanos quickly and efficiently into its environment and offer a wide variety of usage scenarios.
The full-fledged Debian Linux ensures a comfortable environment and direct access to common Linux software like Samba,
Apache, and other powerful network applications. Nanos uses a modern Linux core with support for numerous USB devices
like WLAN, Bluetooth, USB mass storage, and much more.
NanosG20 comes with its own compiler for easy pro-
gram development. There is no need to install additional
software on a development computer. Simply use Samba
or NFS to unlock a directory on the Nanos, write scripts or
programs in your favorite editor, and then use SSH, Tel-
net, or the serial console to compile and test on the
Nanos.
As with any other Linux system, NanosG20 offers the
choice of a variety of programming and scripting lan-
guages: C, C++, Java, Python, Perl, TCL/TK, and many
more. Nanos uses very little electricity as it is, but with
its energy-saving modes like power-down or standby, it
consumes even less, allowing the board to be battery
powered.
The NanosG20 costs around $135. A developer bun-
dle containing an enclosure and power supply is also
available.
Ledato GmbH
www.ledato.de
NPN
npn248_Layout 1 2/10/2011 11:42 AM Page 11
12
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
NPN
NEW LOW-COST FLOATING-POINT MCUs
Bridging the gap between low-cost Piccolo and high-performance Delfino floating-point microcontrollers are the new low-cost
TMS320F2806x Piccolo floating-point MCUs. The new Piccolo MCUs offer an enhanced math engine specifically designed to
simplify programming and optimize performance in real-time control applications that may require integrated communications.
Developers of energy-efficient motor control and renewable-energy applications can now use a single F2806x MCU to cost-
effectively execute control loops, as well as power line communications protocols and modulation schemes. Balancing per-
formance with the integration and ease-of-use inherent to MCUs, the new F2806x MCUs also deliver a broader range of con-
nectivity and memory options and are backed by TI’s robust tools and free control-
SUITE software.
Key features and benefits of F2806x Piccolo floating-point MCUs include a cutting-
edge math engine comprising an 80-MHz floating-point C28x core, new Viterbi com-
plex math unit (VCU), and control law accelerator (CLA) options. Increased communica-
tions and throughput are provided via USB 2.0 full-speed (host and device), CAN, and
direct memory access (DMA). The MCUs also feature IQmath library for code compati-
bility and scaling throughout the C2000 platform, including the low-cost Piccolo series
and high-performance Delfino floating-point series.
The new Piccolo F2806x floating-point MCUs start at $4.95 in 1,000-piece volumes.
Texas Instruments, Inc.
www.ti.com
RUGGED PC/104-PLUS SBC
The Ampro CoreModule 745 is a PC/104-Plus module that supports a range of Intel Atom processors from the power-effi-
cient N450 running at 1.66 GHz to the performance-oriented dual-core D510. With a thermal design power (TDP) as low as 9
W, the CoreModule 745 simplifies cooling requirements and enables conduction-cooled solutions for small-sealed enclosures
in space-constrained applications.
Rugged by design, the module supports a wealth of legacy I/O interfaces, including ISA and PCI buses. Serial ports, one GbE
port, and up to 2 GB of DDR2 667-MHz RAM are also incorporated into an expanded PC/104 footprint.
The CoreModule 745 operates at temperatures from –40° to 85°C, and withstands vibration
up to 11.95 Grms, and shock up to 50 Grms. With a 4-GB solid-state drive soldered
onboard, the module is a complete solution with no moving parts. The module also
features a full 16-bit ISA bus, PCI 32-bit bus, one GbE port, two RS-232
serial ports, one RS-232/422/485 port, four USB 2.0 ports, and
eight GPIO. In addition, the CoreModule 745 offers excellent
graphics performance with an LVDS panel interface and legacy
CRT support. For harsh environments, optional conformal
coating is offered.
The CoreModule 745 is available now in production
quantities with QuickStart Kits, including cables, 2-GB
DDR2 RAM, device drivers, and board support packages for
many popular operating systems, including VxWorks, Win-
dows CE, Windows XP Embedded, Linux, and QNX.
Contact ADLINK Technology for pricing.
ADLINK Technology, Inc.
www.adlinktech.com
NEW STEPPER MOTOR CONTROLLER IC
The USMC-01 is a unique stepper motor controller IC. The chip can operate as a slave or mas-
ter. As a slave, it runs under another microcontroller (or PC) or it can operate in auto-run (mas-
ter) mode, which allows the user to add a few switches and run the stepper motor manually. The
controller allows the RPMs of stepper motors to be switch selectable. Gray encoded inputs
ensure that only one input needs to be changed at a time to switch between consecutive RPM
settings. The RPM calculations are made for 1.8° per step, 200 steps per revolution motors.
The USMC-01 generates control signals that can be used with for both unipolar and bipolar stepper motors with appropriate
drivers like the L298 and L293 or even discrete transistors. In addition to its master and slave modes, the controller also fea-
tures eight RPM selections in free-running mode. The USMC-01 offers half/full-wave step modes and direction control.
The USMC-01 costs $9.95.
Images Scientific Instruments, Inc.
www.imagesco.com
npn248_Layout 1 2/10/2011 11:42 AM Page 12
www.circuitcellar.com

CIRCUIT CELLAR
®
13
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
NPN
MODULAR CORTEX-M3 TOUCH SCREEN LCD-BASED DEV KIT
The latest addition to Future Designs’s touch screen LCD kit family, the DK‐57TVS‐LPC1788, is based on the NXP LPC1788
microprocessor. The system’s “brain” is a SOMMDIMM‐LPC1788 SoC module, featuring an NXP LPC1788 120-MHz Cortex‐M3
microcontroller. The SOMDIMM‐LPC1788 features include an internal real-time clock, Ethernet PHY, 8-MB SDRAM, a microSD
memory card connector, mini JTAG, 4 KB of internal EEPROM, and a secure external I
2
C EEPROM. The DK‐57VTS‐LPC1788 also
features a 5.7″ VGA display (640 × 480 resolution) with a four‐wire resistive touch-screen interface. Communication protocols
include a USB host and device, RS-232/485, CAN, a SPI and I
2
C, and peripherals, such as a three‐axis digital accelerometer
and temperature sensor.
The kit is based on FDI’s µEZ (pronounced
“Muse”) rapid development platform, which
includes an extensive library of open‐source soft-
ware, drivers, and processor support, all under a
common framework. µEZ development works on
the premise of “design once, reuse many times.”
µEZ enables companies to focus on innovation and
on their own value‐added applications while mini-
mizing development time and maximizing software
reuse.
The kit also includes a J‐Link Lite JTAG debugger
from Segger and comes complete with all cables
and power supplies. All documentation is included
on the 2-GB USB flash drive, so everything can
easily be copied to the PC.
The DK‐57VTS‐LPC1788 costs $460.
Future Designs, Inc.
www.teamfdi.com
npn248_Layout 1 2/10/2011 11:42 AM Page 13
14
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
ECONOMICAL, ECO-FRIENDLY ELECTRONIC LABELING SYSTEM
The new Green Machine and MaxiLabel Pro Ver. 3.0 Labeling Software for Windows is a technologically advanced and envi-
ronmentally friendly label printer system for anyone who needs to design and print professional pressure-sensitive labels in
house and on demand.
The Green Machine is a rugged label, heat-shrink tube and barcode ther-
mal-transfer printer with advanced features, including a large, high-intensity
backlit display for use in all lighting conditions. It also has innovative new
hot keys for the instant selection of type styles and point sizes, 12
Euro/Latin language prompts and a hot key, and the exclusive PEELGUARD
electronic tape trimmer that rounds label corners on demand, creating more
permanent and professional-looking labels. The Green Machine is available
in PC or standalone models.
The Green Machine and supplies are designed and built with energy con-
servation and environmental compliance to the greatest extent possible,
including the distinguished European Union Eco-Design Directive
(2009/125/EC). Used in the field or on the desktop, the Green Machine
runs on standard AA batteries or an international AC adapter (both included
with the printer). For longer portable life, special nickel hydride rechargeable
batteries can be used. Supply cartridges are recyclable and made from
recycled plastic.
Combined with K-Sun’s MaxiLabel Pro Ver 3.0 software, the Green
Machine offers maximum power to create hundreds of ANSI safety, industri-
al, and general symbols, plus the ability to easily import custom images.
Add-on symbols libraries include laboratory/medical, electrical, and home-
land security.
Pricing for the Green Machine starts at $339.
K-Sun Corp.
www.ksun.com
NPN
OUTDOOR THERMOELECTRIC COOLER SERIES
The AA Outdoor Cooler Series is a ruggedized Air-Air Thermoelectric Assembly (TEA) that uses impingement flow to transfer
heat. It offers dependable, compact performance by cooling or heating enclosures via convection. A bipolar thermostatic con-
troller with predetermined set points is integrated inside the TEA to maintain its tight form factor. The unit is available in two
popular set point configurations. The LK-81 is programmed to cool when the internal temperature of the enclosure exceeds
25°C and heat when the temperature drops below 10°C.
Products in this series are available in four models offering
150 or 200 W capacities and 24 or 48 V operation.
The LE-80 series is programmed to cool when the inter-
nal temperature of the enclosure exceeds 35°C and heat
when the temperature drops below 5°C. Products in this
series are also available in four models that also offer 150
or 200 W capacities and 24 or 48 V operation.
The AA Outdoor Cooler series has been designed to
pass rigorous Telcordia test requirements, such as earth-
quake resistance, salt, fog, wind-driven rain, high tempera-
ture exposure, and dust contaminants. This is due to the
selection of world-class components, such as brand fans
with the highest degree of environmental protection,
heavy-duty anodization on the high-density heat sinks, life-
time-guaranteed waterproof connectors, overheat protec-
tion, and double environmental seals for the thermoelec-
tric modules (TEMs).
Contact Laird Technologies for pricing.
Laird Technologies, Inc.
www.lairdtech.com
npn248_Layout 1 2/10/2011 11:42 AM Page 14
www.circuitcellar.com

CIRCUIT CELLAR
®
15
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Tes t Your
Edited by David Tweed
CIRCUIT CELLAR
What’s your EQ?—The answers are posted at
www.circuitcellar.com/eq/
You may contact the quizmasters at eq@circuitcellar.com
EQ
Problem 1—The following circuit is designed to give
an extra voltage boost to a load at turn-on. It might be
used, for example, to drive a relay or solenoid that
requires significantly more voltage and current to “pull
in” than it does to simply “hold.” The control input is
simply a logic-level signal that is either off (GND) or on
(VCC). Let’s analyze its operation.
When does Q2 turn on?
Problem 2—When do D1 and D2 conduct?
Problem 3—How much of the load current does
Q1 need to handle?
Problem 4—If the load is an inductive load, such
as a relay or solenoid, should a reverse-biased
diode be added across it?
Problem 5—What can you do if you need more
than 2× voltage boost at turn-on?
Contributed by David Tweed
Fantastic New
LPC1768 Controller
www.futurlec.com
We are your one-stop shop for Microcontroller Boards,
PCB Manufacture and Electronic Components
LPC1768 Controller
.
O
N
LY
$
1
7
.9
0
• Includes LPC1768
Microcontroller with
512kB Flash Memory
• 240 x 320 Color LCD
with Touch Screen
• USB, LAN, CAN, SPI,
I2C Connections
• Joy-Stick and
SD Card Socket
Save On LEDand LCDPanel Meters
• New Digital LED Volt and Amp Panel Meters
• Easy to Read Ultrabright Displays
• No Additional Parts Required
• Ideal for Control Panels and Solar Systems
Great NewTouch Keypad
• Complete and Ready-To-Run
• Utilizes Capacitive Touch
Sensing Technology
• Runs on both 3.3V and 5V power supplies
• Outputs both ASCII and Binary Codes for the Key Pressed
O
N
LY
$
8
.9
0
O
N
LY
$
1
1
9
.9
0

Since 1985
OVER
24
YEARS OF
SINGLE BOARD
SOLUTIONS
Phone: (618) 529-4525 · Fax: (618) 457-0110 · www.emacinc.com
2.6 KERNEL
EQUIPMENT MONITOR AND CONTROL
Low Cost Panel PC
l
Vortex86DX 1 GHz Fanless CPU
l
5.7" VGA LCD with Touchscreen
l
1 RS232/422/485 serial port
l
Mini-PCI Expansion slot
l
2 USB 2.0 Host Ports
l
10/100 BaseT Ethernet & Audio
l
PS/2 mouse & keyboard
l
CompactFlash & MicroSD card sockets
l
Resolution/Colors: 640 x 480 @ 256K
l
Low Power Consumption
l
Linux, Embedded XP or Windows CE OS Options
l
Wide Input Voltage and Wireless Options
Setting up a Panel PC can be a Puzzling experience. However, the PDX-057T
comes ready to run with the Operating System installed on flash disk. Just apply
power and watch the User Interface appear on the vivid color LCD, be it MS Windows
or Linux X-Windows desktop. Interact with the PDX-057T using the responsive
integrated touchscreen. Everything works out of the box, allowing you to
concentrate on your application rather than building and configuring device drivers.
Just Write-It and Run-It... Starting at $440 Qty 1.
For more info visit: www.emacinc.com/panel_pc/pdx089.htm
eq-248_Layout 1 2/10/2011 1:41 PM Page 15
16
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
You won’t find a super-regenerative circuit in many modern radio receivers.
It has frequency stability issues, a limited data rate, and audio quality
shortcomings. But when it comes to remote control applications—especially
those being developed on a tight budget—a super-regenerative circuit can
be a viable option.
I
n the world of oratory competitions, the
term super-regenerative is a lightweight
compared to a tongue-twister like the 34-let-
ter word supercalifragilisticexpialidocious.
But in the engineering world, a sensitive, low-
cost super-regenerative receiver is hard to
beat. In my last column, I mentioned it as the
old, reliable, workhorse of wireless control
that’s second to none in terms of the cost/per-
formance ratio. Many engineers believe it’s on
the way to becoming obsolete. But while the
principle is some 90 years old, I find it’s still
alive, well, and offered by RF module vendors.
CIRCUIT ANALYSIS
The pedigree of this circuit extends to the
early days of radio. You can trace it back to
the 1920s and a design by Edwin Armstrong.
Then, vacuum tubes were expensive, and the
engineers were looking for ways to make sen-
sitive receivers with as few tubes as possible.
They knew that when positive feedback was
applied across an amplifier, oscillations would
ensue at some point; but just before that hap-
pened, the gain of the amplifier would be
approaching infinity. This principle, called
“regeneration,” was used to advantage in the
radio receivers of the day. Unfortunately, due
to the instability caused by a number of fac-
tors, it was necessary to continually adjust
the feedback by hand, or the radio would
oscillate and howl or the signal would fade
away. Armstrong developed a circuit that
would automatically keep the feedback just
The Super-Regenerative
Receiver
by George Novacek (Canada)
T
HE CONSUMMATE ENGINEER
Figure 1—A typical super-regenerative receiver block diagram
RF Preamp (optional)
Baseband amplifier
and low-pass filter
Time variable loop gain
Quench oscillator
Bit slicer and Schmitt trigger
Data
-Gm(t)
l(t)
~
Tuned LC Circuit
Press Proof
Changes
Art
2011-3-006-Novacek_Layout 1 2/9/2011 4:34 PM Page 16
www.circuitcellar.com

CIRCUIT CELLAR
®
17
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
and Schmitt trigger circuit would be
used for data transmission only. But
the super-regenerative receiver can
demodulate AM and FM signals,
which would then be available on
the output of the baseband amplifier.
Refer back to Figure 1. The pream-
plifier serves to amplify the received
signal and to isolate the super-regen-
erative circuits from the antenna. It
prevents back radiation of the super-
regenerative oscillations to satisfy
FCC rules, provides antenna match-
ing, and stabilizes the load of the res-
onant tank circuit. The preamplifier
is usually aperiodic and unless it has
below the onset of oscillations and
called the effect “super-regeneration.”
At a repetition rate above the
received baseband and below the RF
range, the amplifier would automati-
cally increase its positive feedback
until oscillations were about to
begin. At that point the bias condi-
tions of the amplifier would be
changed and the oscillations
quenched. In effect, the receiver
would sample the incoming RF sig-
nal at the quench rate with its maxi-
mum sensitivity usually reaching the
noise floor. Since the quench signal
repetition rate is well above the
baseband range, a simple low-pass
filter effectively suppresses it. The
achievable RF sensitivity of the
super-regenerative receiver is in a
range of –30 to –100 dBm (decibels
referenced to 1 mW).
Paradoxically to its common
occurrence, due to its nonlinear oper-
ation, circuit analyses of this receiv-
er are scarce. One, if not the best,
analysis of the super-regenerative
receiver is Eddie Insam’s 2002 Elec-
tronics World article, “Designing
Super-Regenerative Receivers.” Any-
one interested in understanding how
this receiver works should study his
paper.
INSIDE A RECEIVER
Figure 1 is a block diagram of a
typical super-regenerative receiver. It
should be noted that the bit slicer
Figure 2—This is a working circuit with a preamplifier, Schmitt trigger, and more.
1-800-348-8051
www.kell.com
Leodìng £mbedded
Development Tools
Tbe complete oevelopment envlronment tor ARM
®
,
Corte×
"
, 8051, ano C166 mlcrocontroller oeslgns.
2011-3-006-Novacek_Layout 1 2/9/2011 4:34 PM Page 17
18
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
a significantly better noise figure than the super-regener-
ative detector, it has very little effect on the overall
receiver sensitivity.
The time variable loop gain (i.e., the feedback amplifi-
er) causes the resonant tank to oscillate at its resonant
frequency. Because of the periodic quenching signal, the
super-regenerative circuit operates in an intermittent
oscillatory fashion. The negative conductance –Gm(t) is
varied in such a way that the oscillator is driven in and
out of oscillations without being allowed to reach a sta-
ble oscillatory state.
When an RF signal around the oscillator resonant fre-
quency arrives at the time when the circuit is about to
begin to oscillate, the injected RF signal from the anten-
na (or the pre-amp) forces the oscillations to start sooner.
The difference in the start-up time is detected by the
super-regenerative circuit and forms the envelope of the
received signal.
The beauty of the receiver is that it can be built with a
single transistor. It should be noted, however, that all the
functional blocks also could be built as separate circuits.
For a good example of this, refer to the article listed in
the Resources section by Cedric Mélange, et al. This
design is very useful for experimentation, but I am not
convinced of its practicality. The main advantages of the
super-regenerative receiver beside its sensitivity are sim-
plicity, low power, and low cost. If I were to build a
receiver with so many parts (as in the Mélange article), I
would choose a superhet. Or, even better, I would pur-
chase a monolithic receiver module, such as a Micrel
“Quik Radio.”
Figure 2 is the actual working circuit I showed last
month, with the preamplifier and the data shaping bit
slicer and a Schmitt trigger added. Q1 and its associated
components form the aperiodic preamplifier, which, as I
already pointed out, may be used but doesn’t always have
to be used. Its improvement of sensitivity, and therefore
range, is often insignificant. Q2 forms the super-regener-
ative receiver, also called super-regenerative detector.
The RF signal resonating in the L1/C3 tank circuit is
George Novacek (gnovacek@nexicom.net) is a professional engineer
with a degree in Cybernetics and Closed-Loop Control. Now retired,
he was most recently president of a multinational manufacturer of
embedded control systems for aerospace applications. George wrote
26 feature articles for Circuit Cellar between 1999 and 2004.
RESOURCES
E. Insam, “Designing Super-Regenerative Receivers,”
Electronics World, April 2002.
C. Mélange, J. Bauwelinck, and J. Vandewege, “Low-
Power, Super-Regenerative Receiver Targets 433-MHz
ISM Band,” EDN, 2006.
S. Rumley, “Super-Regenerative Receivers for Remote
Keyless Access Applications,” Valon Technology,
www.valontechnology.com/images/REGEN.PDF.
coupled to collector Q2. C5 provides the necessary posi-
tive feedback for Q2 to oscillate at the resonant frequen-
cy of approximately 315 MHz. L1, C7, and R14 are the
quench oscillator. R14 is also the load on which the base-
band signal envelope appears. R2, R10, and D1 bias the
base of Q2 into active an region for Q2 to start oscillat-
ing. D1 improves temperature stability of the circuit.
The quench oscillator should be running at a rate at
least twice the maximum baseband frequency. Remember
Nyquist? Generally, it is set between 20 and 120 kHz,
which is high enough to be removed from the baseband
with a simple low-pass filter.
The baseband signal is amplified by Q3. Its low-pass
characteristics ensure attenuation of the quench frequen-
cy riding on top of the on/off-keyed (OOK) digital data.
The following op-amp U1 works as a combined bit slicer
and Schmitt trigger. Bit slicing performed by C4/R6 and
the op-amp eliminate the DC component of the received
signal, which can be especially troublesome when a
strange transmitter operates in the same frequency band.
Adding a positive feedback by R11 turns U1 into a
Schmitt trigger with output clean enough to drive logic
circuits.
CONTROL APP ADVANTAGES
Why isn’t the super-regenerative circuit used in every
radio receiver around us? Because it has poor selectivity
and frequency stability, limited data rate, and the audio
quality of an AM or FM modulated signal is barely
acceptable. But for control applications, especially the
cost-sensitive ones, its advantages outweigh the draw-
backs. However, there are now monolithic receivers on
the market without many of those shortcomings. At low
prices, and with low power consumption, these success-
fully compete with the discrete component designs in all
aspects. So, while there may no longer be an incentive to
“roll your own,” it never hurts to understand how things
work. I
When an RF signal around the
oscillator resonant frequency
arrives at the time when the circuit
is about to begin to oscillate, the
injected RF signal from the antenna
(or the pre-amp) forces the oscil-
lations to start sooner. The differ-
ence in the start-up time is detected
by the super-regenerative circuit
and forms the envelope of the
received signal.
2011-3-006-Novacek_Layout 1 2/9/2011 4:34 PM Page 18
19_Layout 1 2/10/2011 12:18 PM Page 1
20
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
An electronic panning controller enables a photographer to rotate a camera
to provide uniformly overlapping images that can be merged successfully
without distortion. Here you learn how to build a digital indexing panoramic
tripod head from start to finish.
Panning Control
T
F
E
A
T
U
R
E
ARTICLE
by Richard Lord (USA)
here has been a great interest in wide-view
panoramic photography from the very first record-
ed images of the 1840s. With the invention of flexible
film in the 1880s, several manufacturers began offering
specialized panoramic cameras that wrapped the film
around a curved surface and pivoted
the lens during the exposure. The
advent of digital photography and
image-processing software has ush-
ered in another way to create
panoramic images—by stitching
multiple overlapping photos togeth-
er into a single larger image. While
many modern digital cameras and
software packages offer tools to
make stitching somewhat easier,
significant geometric distortions
result from attempts to merge hand-
held images.
Several manufacturers now offer
mechanical indexing panoramic
adapters of varying degrees of
sophistication that allow a camera
to be accurately rotated to provide
uniformly overlapping images that
can be merged successfully without
distortion. The simplest of these
pan heads merely provide a means
to lock the axes of rotation at vari-
ous angles. More sophisticated ver-
sions include indexing plates that
make it easier to step between fixed
angles. However, the angle required
to provide the correct overlap of each step varies with the
focal length of the lens, so mechanical indexing can be
very awkward to use, often requiring calculation and care-
ful setting of each angle to get a good result. I’m someone
who loves to find new ways to use inexpensive microcon-
trollers to solve problems, so I saw
this as a natural and obvious appli-
cation of technology.
I faithfully attend a couple of elec-
tronic flea markets every year and
am always on the lookout for inex-
pensive electromechanical gadgetry.
As a result, when I was ready to
start this project, I had already
amassed a useful collection of step-
ping motors and drivetrains to
choose from. Thus, it was inevitable
that as an avid photographer I would
be destined to make my own digital
indexing pan head (see Photo 1). My
goal was to make the design
extremely simple to use with no
angle calculations—just a simple
user interface where I set the start
position, the step size (determined
by moving the pan head while look-
ing through the viewfinder), and the
number of steps needed to reach the
final position.
The pan head actually moves to
these positions as the parameters
are entered, so setting up a pan
sequence is very intuitive. I also
A Digital Indexing Panoramic Tripod Head
Photo 1—The pan head design
2011-3-015_Lord_Layout 1 2/9/2011 4:36 PM Page 20
www.circuitcellar.com

CIRCUIT CELLAR
®
21
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
added a smooth video panning mode where I set start and
end positions and the duration of the pan.
ANOTHER DIMENSION
While rotation about a single pan axis covers many situ-
ations, there are obviously times when you might find
yourself inside a large interior space where you might want
to change the elevation axis and create a view that is sever-
al overlapping images high as well as wide. Since I was
already developing a controller for the pan axis, it didn’t
seem to be too big a stretch of the imagination or the elec-
tronics to add an elevation axis drive motor as well.
If simple panoramas had been my only interest, I proba-
bly would have settled for a simple mechanical pan head.
However, I had a bigger goal in mind—much bigger, in fact.
As a fairly serious photographer, I find that sometimes I
would like to produce poster-sized images. As the size of
the printed image increases, the resolution of the camera
image must also increase or else the individual image pic-
ture elements (pixels) will start to become visible.
Viewing an image from several feet away, the unaided
human eye can distinguish about
100 lines per inch of detail in any
direction. This means for a high-
quality photographic print of a
digital image, the printed image
must have a minimum of 200 dots
per inch (dpi) of resolution to
avoid having visible evidence of
the individual pixels that make up
the image, and more resolution is
better. An image captured with a
1-megapixel camera might look
fine in a 4” × 5” snapshot, but
clearly the image quality will suffer
when blown up to 16” × 20”, where
the same image is spread over 16
times the area of the 4” × 5” print.
Based on the 200-dpi minimum, a
high-quality printed image takes
at least 40,000 pixels per square
inch of area. This works out to a
maximum of 25 square inches per
megapixel, and it means a 12-
megapixel camera is not sufficient
Photo 2—The pan
drive motor
to produce a quality 16 × 20 print.
To create really sharp 32″ × 40″ and larger photographic
prints, you need 50 to 100 megapixels per image. If you
have $20,000 to $50,000 of spare change, you can buy
large-format digital cameras with this kind of resolution,
but for the rest of us, this kind of investment is out of the
question. However, using the same image stitching tech-
nique that works for forming panoramic photographs from
overlapping horizontal images, you can form very high-res-
olution images from a two-dimensional array of overlap-
ping lower-resolution photographs. By using a telephoto
setting and smaller angles for the horizontal and vertical
steps, the image that is formed in this way might cover the
same field of view as a single lower-resolution photograph,
but with a resolution of 100 megapixels instead of the 10
megapixels of the single exposure. Of course, this doesn’t
work well for action photographs. It may take several min-
utes to capture all the overlapping images, so the baseball
has long ago reached the catcher’s mitt and the race car has
already completed another lap by the time the digital pan
head has gotten halfway through its dance. However, for
still life subjects and scenic views, the two-axis digital tri-
pod head provides the opportunity to produce exquisitely
detailed large prints with an affordable camera.
SYSTEM OVERVIEW
As you can see from the picture of the full two-axis pan
head in Photo 1, this project includes some mechanical con-
struction for the elevation drive mechanism. I am fortunate
enough to have recently acquired a small lathe/milling
machine setup, so this project has been an opportunity to
hone some mechanical skills. However, the basic pan mech-
anism was built with hand tools and existing materials.
One of the stepping motor mechanisms in my collection
of flea-market bargains was a roll-
paper spindle drive mechanism,
shown in Photo 2, that had once
been part of large-format plotter.
The drive included a nice bearing
assembly for the 0.375” spindle
shaft and a 5:1 gear reduction to
drive this shaft from a six-lead 1.8°
stepping motor. This was all
mounted in an enclosure that was
designed to clamp onto the back of
the plotter. By orienting it so the
spindle shaft was pointing straight
up, I had the essential mechanism
of the pan drive without any extra
effort. I merely had to remove the
original clamping mechanism for
the plotter and replace it with a
plastic box containing the con-
troller electronics. Then I had to
figure out how to mount my cam-
era on top of the convenient
turntable that had once been the
spool for the paper roll when it was Photo 3—A look inside the pan head
2011-3-015_Lord_Layout 1 2/11/2011 9:46 AM Page 21
22
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
part of the plotter. The guts of the pan head and controller
can be seen in Photo 3.
For the elevation drive, I came up with a slightly smaller
six-lead stepping motor with an attached 4:1 belt-drive
reduction driving a 0.5″ diameter 0.20″ pitch sprocket. To
complete the vertical drive, I had to buy a timing belt and a
3.25″ sprocket from an online company, Stock Drive Prod-
ucts, for a total of $10. A friend supplied me with a 3″ bear-
ing and some scrap aluminum, which I was able to use to
make the rest of the elevation drive. The elevation drive
plugs into the controller with a five-pin DIN connector so
that the digital pan head can be used with other camera
mounts if the elevation feature isn’t needed.
CIRCUITRY
Stepping motors come in several flavors of winding con-
figurations. There are many exotic ICs designed specifically
for driving stepping motors, but they come in high-density
surface-mount packages that are hard to work with for
home-brew projects.
Having the unipolar six-lead version for both motors
greatly simplified the design of the drive electronics. These
motors have two center-tapped coils and can be driven by
tying the center tap to the power source and then ground-
ing either end of the winding to provide either polarity of
magnetic field. I just happened to have a whole drawer full
of 75451 peripheral drivers in my parts bin. These parts
have been around for a long time, but Digi-Key still sells
them for $0.83 each. This eight-pin DIP provides dual high-
voltage open-collector outputs, each capable of sinking 350
mA, making them ideal for driving these smaller unipolar
stepping motors.
Each 75451 drives the two ends of a single winding, so
only one of the two drivers is active at a time, reducing
heat dissipation. As you can see in Figure 1, there are two
75451 drivers for each motor. I added 1N4002 clamping
diodes to ground and to the power rail for each output to
prevent voltage spikes from feeding back into the circuitry
and damaging either the driver or the controller (a lesson
learned the hard way in an earlier design that destroyed the
microcontroller). The diodes are mounted in close proximi-
ty to the outputs and are bussed together to nearby bypass
and bulk capacitors so the energy is closely contained and
doesn’t wander around the circuit board where it could
introduce either voltage or current spikes into the rest of
the circuitry. To be even more secure, I added series resis-
tors between the driver inputs and the microcontroller and
also provided the peripheral drivers with their own 78L05
regulator, separate from the power for the microcontroller.
The rest of the circuitry for this controller is pretty sim-
ple. At its heart is a Microchip Technology PIC16F877A
with a 20-MHz resonator connected between the clock
pins. In addition to the four outputs for each motor, the
controller connects to a 2 × 24 character LCD and four
Figure 1—The PIC16F877-based pan head circuitry
2011-3-015_Lord_Layout 1 2/9/2011 4:36 PM Page 22
“screen.” The leftmost button
enables you to go back to the
previous menu screen. For
those parameters that affect
the position of the pan head,
the head actually moves as
the value is changed. For the
pan axis, the middle buttons
are labeled with left and right
arrows corresponding to the
rotation of the camera toward
the left (counterclockwise) or
the right (clockwise). For the
elevation axis and for non-
motion parameters, the labels
change to “up” and “down”
arrows.
To enter a new pan axis
motion “program” into the
digital pan head, press the “Prog” but-
ton and then select “1-Axis.” The
upper line then displays “Pan Start
Pos=+0000” representing straight
ahead. (If you are editing an existing
program, the display will show the
current start position and the pan
drive will move to that position.) The
left and right arrow buttons can then
be used to move the pan head to the
initial position of the pan sequence.
Once you press the “Enter” button,
you’re then prompted to define the
“Pan Step Size.” The pan head is posi-
tioned while looking through the
camera viewfinder until the desired
image overlap is achieved.
Next, you program the “Pan Step
Count,” advancing the head to its
final position by moving the pan head
a step size per count. Signed arith-
metic is used to make all the calcula-
tions, so the pan head can be pro-
grammed to step in either direction
from any start position.
Finally, you’re prompted to enter
the “hold” time that the pan head
will wait after pressing the shutter
before stepping to the next position
(basically, how much time it takes the
camera to write the image to the
memory card). The position “pro-
gram” can then be saved in one of 10
12-byte EEPROM blocks for later
recall, or it can be run directly.
For a two-axis program the eleva-
tion start, step size, and count are pro-
grammed first, followed by the pan
parameters. Running the program
www.circuitcellar.com

CIRCUIT CELLAR
®
23
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
push button switches. I added
two optically isolated outputs to
switch the two-stage shutter
input on my camera, an input
for an external remote switch
for single-stepping the pan head,
and an RS-232 port to allow
control of the digital pan head
from a computer. The controller
board is shown in Photo 4.
My method of board construc-
tion is to buy the prototyping
boards at RadioShack that have
holes on 0.10” centers with pad-
per-hole copper on one side.
These are relatively cheap and
very easy to use. Wherever pos-
sible, I try to use integrated cir-
cuits in DIP packages inserted
into high-quality machined pin sock-
ets. I first wire the grounds by bending
the leads from the bypass capacitors to
run along a row of pads on the solder
side and then beef the wire up by sol-
dering it to each pad and flowing the
solder along the wire. This forms a
sort of ground plane as can be seen in
Photo 5. I then wire in the power,
either using the same technique or by
using scrap #26 wire from ribbon
cable. Finally, I wire the signals by sol-
dering short pieces of #30 wire-wrap
wire that are cut to length. This tech-
nique lets me adapt and change wiring
fairly easily. Wherever possible, I use
0805-size surface-mount resistors
which fit nicely between tenth-inch
pads on the solder side. This construc-
tion method is relatively inexpensive,
so it is not a big deal to start all over
again if there’s a better arrangement of
the parts.
Somewhere on the board, I always
add a small loop of 18-gauge solid wire
connected to ground to clip on the
ground lead of an oscilloscope for
debugging. When developing the soft-
ware, I often find it useful to tem-
porarily add code to set or clear an
output. For example, to determine the
duration of the interrupt handler, I
temporarily set the shutter output pin
at the beginning and clear it at the end
of the interrupt routine.
MAKING IT GO
I love programming PIC controllers
in assembly language. I find it an
enjoyable challenge to work directly
within the constraints of the hard-
ware. Assembly language is an effi-
cient way to squeeze the most per-
formance out of inexpensive 8-bit
microcontrollers with limited stack
and code space.
For the digital pan head, I wanted to
create an intuitive user interface.
After playing on paper with several
alternatives, I decided that I could
provide all the features that I wanted
with a 2 × 24 character LCD and four
push buttons mounted directly below
the display. The function that each
button performs is defined using the
six characters of the bottom line of
the display that are directly above that
button. The button labels change as
the context changes. The upper line of
the display is used to define the cur-
rent context or “screen.” For
“screens” that are used to adjust the
value of a parameter, the upper line
shows the parameter name and value.
The two middle buttons are used to
decrease or increase the value of the
parameter. When adjusting parameter
values, the buttons are set up to “auto
repeat” so that large changes are easy
to program. Each time you press the
button, the parameter is initially
changed by a single count, but holding
the button down causes the change to
repeat automatically, slowly at first
and then more rapidly if the button
continues to be pressed. The right-
most button is used to “Enter” that
value and advance to the next menu
Photo 4—The controller board
2011-3-015_Lord_Layout 1 2/9/2011 4:36 PM Page 23
is possible to achieve a great many intermediate posi-
tions. However, for less precise requirements, it is often
sufficient to simply provide several intermediate power
values for each winding. For my initial experiments, I
decided to use the microcontroller’s interrupt timer to
pulse-width modulate the power at 0%, 25%, 50%, 75%,
and full on, creating 32 steps per stepping cycle. This gave
very smooth motion and precise control; but with the
microcontroller running at its maximum of 20 MHz and
the interrupt handler pared to a minimum amount of
code, the best I could achieve for the PWM rate was about
8 kHz, causing the stepping motors to audibly “sing” at
the intermediate power positions. I finally decided to
eliminate the 25% and 75% steps, and I was able to up
the 50% PWM rate to around 18 kHz, which put it above
my hearing.
The power output for the motors is controlled in the
interrupt handler using two 8-bit “mask” registers, where
each bit corresponds to an output to a motor winding.
The upper 4 bits correspond to the negative and positive
outputs for both windings of the pan axis motor. The
lower 4 bits correspond to the outputs for the elevation
axis. These bit masks are set by the foreground software
from table look up from the stepping table (see Table 1)
using the 4 LSBs of the 16-bit motor position register as
an index into the table. At each interrupt, the contents of
the 100% mask register are loaded into the accumulator.
The interrupt handler increments a counter. If the LSB is
high, a logical OR is performed with the contents of the
50% mask register. The contents of the accumulator are
then written to the motor output port.
If a bit is set in the 100% mask, then that motor output
is turned on all the time. If a bit is not set in the 100%
mask but is set in the 50% mask, then the corresponding
24
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
causes the head to turn to the start position, wait for a
settling time, actuate the shutter, wait for the hold time,
and then step to the next position. For two-axis programs,
the pan sequence is repeated for each elevation position.
Since there is significant mass to the pan head, the
motor control software includes the ability to accelerate
from a slower speed at the start of the motion and to
decelerate as the pan head nears the target position. The
settling time, duration of the shutter activation, and
acceleration, deceleration, and slew rates of the motor
axes are controlled by general system parameters stored
in EEPROM that can be programmed from the setup
menu that is reached by holding down
the leftmost and rightmost buttons
during power-up.
The stepping motors are driven by
table look up, indexed by the current
position counter for each axis. Initial-
ly, I chose the common half-step
method, where a single winding is
energized for the intermediate half
step between the full-step positions
(where two windings are powered) pro-
ducing eight half steps per motion
cycle or 0.9° of rotation of the motor
shaft between entries in the look-up
table. When I decided to add a slow
continuous pan feature for shooting
video, I found that half-stepping pro-
duced a jerky motion.
More precise control of stepping
motors can be achieved by a technique
called “microstepping” in which the
amount of power sent to each winding
is modulated to achieve intermediate
positions. Using sine look-up tables, it
Table 1—The stepping motor sequencing chart. Note the following: Motor output = 100%
mask “OR” (50% mask “AND” INTERRUPT_CTR[0] ). Pan motor = upper nibble [7:4]. Eleva-
tion motor = lower nibble [3:0].
Four-step Eight-step Sixteen-step Motor windings Bit mask nibbles
1.8° 0.9° 0.45° B-leads A-leads 100% 50%
-b+b-a+a -b+b-a+a
step 00 step 00 100% OFF 0100 0000
step 01 100% 50% 0100 0001
step 00 step 01 step 02 100% 100% 0101 0000
step 03 50% 100% 0001 0100
step 02 step 04 OFF 100% 0001 0000
step 05 -50% 100% 0001 1000
step 01 step 03 step 06 -100% 100% 1001 0000
step 07 -100% 50% 1000 0001
step 04 step 08 -100% OFF 1000 0000
step 09 -100% -50% 1000 0010
step 02 step 05 step 0A -100% -100% 1010 0000
step 0B -50% -100% 0010 1000
step 06 step 0C OFF -100% 0010 0000
step 0D 50% -100% 0010 0100
step 03 step 07 step 0E 100% -100% 0110 0000
step 0F 100% -50% 0100 0010
Photo 5—A look under the controller
2011-3-015_Lord_Layout 1 2/9/2011 4:36 PM Page 24
www.circuitcellar.com

CIRCUIT CELLAR
®
25
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
winding is powered on alternate interrupts, thus being
energized with 50% of the power. Each time the motor
position register is incremented or decremented for either
axis, a new pair of bit masks is generated.
The control scheme yields 0.45° motor steps with 16
steps per motion cycle. With the 5:1 gear reduction on the
pan axis and 24:1 reduction on the elevation axis, this is
sufficient to produce satisfactory results without the
accompanying howling of the motors that was caused
when I had attempted to use the 32-step table.
The interrupt for the motor PWM also provides the
timing for the button repeat function, slew rates for the
stepping motors, and millisecond counts for the various
time settings. This timing is accomplished by decrement-
ing a counter programmed with the number of interrupts
per millisecond. Once this counter reaches zero it is
reloaded and a separate “millisecond delay” counter is
tested. If it is nonzero, this counter is decremented once
for each millisecond. When the main software needs to
create a delay, it sets this delay counter with the desired
number of milliseconds and then tests its value and loops
until the value is zero. A similar delay counter decre-
ments in tenths of a second for the longer delays.
I also provided an RS-232 port that can activate the
shutter, read the current positions of the two stepping
motors, read the current “screen,” and remotely press any
of the buttons. I also included the ability to specify the
absolute or relative position of either motor. With this
latter capability, a computer can be used to drive the pan
head in complex two-axis motion (see Table 2).
DESIGN EXPLORATION
I designed the digital pan head to work with a specific
digital camera (a Canon Digital Rebel) and centered both
axes of rotation on the plane of the image sensor. I have
subsequently discovered that this is the wrong location to
eliminate parallax errors. The rotation needs to occur at
the plane of the convergence of light rays in the lens,
which varies with each lens or zoom setting. As a conse-
quence, I need to modify the camera mount with a slide
that will allow the camera to be moved forward or back-
ward and then clamped in the position that will properly
place the center of rotation. I also plan to add adjustments
to compensate for different lens heights above the camera
base and different locations of the tripod socket with
respect to the lens, so that the digital pan head can be
used with other cameras.
I haven’t yet explored the ability to create complex
motion using the positioning commands through the RS-
232 port, but this can open up the possibility to do some
very creative things such as painting geometric shapes
with lights during night photography. I’m just starting to
explore all the capabilities of the digital pan head, but it’s
already proving to be a very versatile tool for a very mod-
est investment of less than $100. It has also been a fun
project to build. I
Richard Lord (rhlord@comcast.net) holds a B.S. in Electrical
Engineering and an M.S. in Biomedical Engineering. During
his career, he has designed digital electronics for an aero-
space company and several telecommunication test equip-
ment manufacturers. Working as a consultant in the
1980s, Richard designed several medical pulmonary test
instruments and the electronics for an autonomous under-
water robot. His interests include digital electronics, pho-
tography, jazz, and river conservation.
PROJECT FILES
To download the code, go to ftp://ftp.circuitcellar.com/
pub/Circuit_Cellar/2011/248.
SOURCES
PIC16F877 Microcontroller
Microchip Technology, Inc. | www.microchip.com
Table 2—Commands that can be sent to the digital pan head through the RS-232 port
(9600 Baud, 8 bit, no parity)
Cmd arg Function Response Return format
v – Display current software version Returns current software version + prompt [text string]
dp – Display current program Returns current program values + prompt [decimal table]
ge – Get elevation position Returns current Elevation position + prompt [4-digit signed decimal]
gp – Get pan position Returns current Pan position + prompt [4-digit signed decimal]
sh – Activate shutter Returns prompt after completion
gs – Get current system state Returns current display page + prompt [2-digit decimal]
sw 0–4 Press key 1–4 (sw0 releases key) Returns prompt
db – Get all system variables (debug) Returns 192 system variables + prompt [hexadecimal table]
kl – Lock (disable) front panel keypad Returns prompt
ku – Unlock front panel keypad Returns prompt
The following motion commands require that the keypad be locked/disabled. They return the command prompt once the motion is completed.
ea –9999 to 9999 Move to absolute elevation position
er –9999 to 9999 Relative move of elevation position
pa –9999 to 9999 Set absolute pan position
pr –9999 to 9999 Relative move of pan position
2011-3-015_Lord_Layout 1 2/9/2011 4:36 PM Page 25
Prices and item descriptions subject to change. E. & O.E
The world of electronics
at your fingertips!
Elektor Shop
BOARDS, BOOKS, DVDs AND MORE AT WWW.ELEKTOR.COM/SHOP
C
D
/
D
V
D
-
R
O
M
s
See the light on Solid State Lighting
DVD LED Toolbox
This DVD-ROM contains carefully-sorted
comprehensive technical documentation
about and around LEDs. For standard
models, and for a selection of LED modules,
this Toolbox gathers together data sheets
from all the manufacturers, ap pli cation
notes, design guides, white papers and so on.
It offers several hundred dri vers for powering
and controlling LEDs in different configu-
rations, along with ready-to-use modules
(power supply units, DMX controllers, dim-
mers, etc.). In addition to optical systems,
light detectors, hardware, etc., this DVD also
addresses the main shortcoming of power
LEDs: heating. This DVD contains more than
100 Elektor articles on the subject of LEDs.
ISBN 978-90-5381-245-7 • $46.00
Software Tools & Hardware Tips
CD Ethernet Toolbox
This CD-ROM contains all essential in for-
mation regarding Ethernet interfaces. It
includes a collection of datasheets for de-
dicated Ethernet interface ICs from many
different manufacturers. What’s more, we
have compiled a collection of all articles
on this topic that have appeared in Elektor
magazine and complemented them with
additional documentation and links to intro-
ductory articles on Ethernet interfaces.
ISBN 978-90-5381-214-3 • $31.50
Packs 1.2 gigabytes worth of tools and documents
DVD Wireless Toolbox
On this DVD-ROM you’ll find a number of technical documents and tools that will enable you to
add wireless data exchange to your electronics systems. The choice of equipment depends on
the transmission distance: a few centimetres using Near Field Communication (NFC) or Radio
Frequency Identification (RFID), tens of metres with the Bluetooth, Wi-Fi or ZigBee systems, or
indeed thousands of kilometres using a module for receiving GPS data. In accordance with the
principle of our Toolbox series, we’ve brought together technical documentation (spec. sheets,
application notes, user guides, etc.) on various devices according to the frequency and/or proto-
col used. All of the documents are PDF files (in English). Browsing around the DVD is made easy
by an HTML menu. Finally, this Wireless Toolbox DVD contains a collection of articles on this
topic (RFID, xBee, DCF77, GPS, infrared, etc.) that have appeared in Elektor magazine.
ISBN 978-90-5381-268-6 • $46.00
N
E
W
!
This DVD and more are available at
w
w
w
.elektor.com
/shop
26_Layout 1 2/11/2011 9:59 AM Page 1
K
i
t
s

&

M
o
d
u
l
e
s
Elektor US
PO Box 180
Vernon, CT 06066
USA
Phone: 860-875-2199
Fax: 860-871-0411
E-mail: sales@elektor.com
B
o
o
k
s
Elektor is more
than just your favorite
electronics magazine.
It’s your one-stop shop
for Elektor Books,
CDs, DVDs,
Kits & Modules
and much more!
www.elektor.com/shop
NetWorker
An Internet connection would be a valuable
addition to many projects, but often designers
are put off by the complexities involved. The
‘NetWorker’, which consists of a small printed
circuit board, a free software library and a ready-
to-use microcontroller-based web server, solves
these problems and allows beginners to add In-
ternet connectivity to their projects. More ex-
perienced users will benefit from features such
as SPI communications, power over Ethernet
(PoE) and more.
-ODULEREADYASSEMBLEDANDTESTED
Art.# 100552-91 • $85.50
Visual Studio
C# 2010 Programming
and PC interfacing
This book is aimed at anyone who wants to
learn about C# programming and interfacing
to a PC. It covers programming concepts from
the basics to object oriented programming,
displaying graphs, threading and data bases.
The book is complete with many full program
examples, self assessment exercises and links
to supporting videos. All code examples used
are available – free of charge – from a special
support website. Pro fes sio nal quality software
tools are downloa dable –also free of charge–
from Micro soft.
305 pages • ISBN 978-0-905705-95-8 • $47.60
Bestseller!
An introduction to digital control electronics
Experiments with
Digital Electronics
This book presents fundamental circuits using
gates, flip-flops and counters from the CMOS
4000 Series. Learning these fundamentals is best
done using practical experiments. Each of the
50 experiments presented in this book has a cir-
cuit diagram as well as a detailed illustration of
the circuit’s construction on solderless bread-
board. Building these digital circuits will improve
your knowledge and will be fun to boot. Many of
the circuits have practical real-life applications.
176 pages • ISBN 978-0-905705-97-2 • $42.80
Reign with the Sceptre
This open-source & open-hardware project
aims to be more than just a little board with a
big microcontroller and a few useful peripherals
— it seeks to be a 32-bit ARM7 fast prototyping
system. To justify this title, in addition to a very
useful little board, we also need user-friendly
development tools and libraries that allow fast
implementation of the board’s peripherals. Am-
bitious? Maybe, but nothing should deter you
from becoming Master of Embedded Systems
Universe with the help of the Elektor Sceptre.
0#"POPULATEDANDTESTED
TESTSOFTWARELOADED
Art.# 090559-91• $143.60
Associated starter kit available
ARM Microcontrollers
This is the perfect book for people who want
to learn C and who want to use an mbed ARM
microcontroller in an easy and fun way. The
mbed NXP LPC1768 uses cloud technology, a
revolutionary concept in software development.
This means you do not need to in-stall software
on your PC in order to programthe mbed! The
only thing you need is a brow -ser such as Micro-
soft Internet Explorer, and a USB port on your PC.
No previous expe -rience or knowledge required.
You can get access to your project from any PC
anywhere in the world and continue working
on it. When you are done a few mouse clicks
transfer the program to your mbed hardware.
250 pages • ISBN 978-0-905705-94-1• $47.60
Bestseller!
27_Layout 1 2/8/2011 3:12 PM Page 1
28
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
You can control a remotely operated vehicle (ROV) or mobile robot wirelessly
with a basic RC transceiver and a little know-how. This design uses FM
signals to transmit data. A receiver on the ROV then demodulates the FM
signal and enables motor control.
Remotely Operated Vehicle Design
A
F
E
A
T
U
R
E
ARTICLE
by Brian Senese (USA)
fter enrolling two of my children in the “science
olympics” at their school, I found that I also had
a role to play as a volunteer coach for a “robo-cross” event.
Under the direction of the coach, each student is chal-
lenged to build a robot for a contest involving picking up
items and then placing them into containers for points.
To prepare for the event, I visited the previous year’s
coach to get some helpful tips. (While I met with him I dis-
covered that he had built “battlebots” in his machine shop.
These were serious industrial-strength robots that could
fight in an arena.) When he showed me the winning robot
from the prior robo-cross event, I knew I was in trouble.
To make matters worse, I found that it took a small for-
tune to buy commercially available robot electronics such
Photo 1a—The prototype ROV competed in a “robo-cross” event
and placed sixth overall in a field of more than 40 contenders.
b—This second-generation “cousin” design incorporates significant
improvements, such as standardizing one motor, improving the
gearing mechanisms, and, above all, simplifying the electronics.
c—Eight AA cell batteries are held under the ROV.
a) b)
c)
2011-3-015_Senese_Layout 1 2/10/2011 11:28 AM Page 28
www.circuitcellar.com

CIRCUIT CELLAR
®
29
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
as a radio control (RC) transmitter (more than $100), motor
controller (five at $30 each), gearhead DC motors (five at
$20 each), and metal components. Kids love robotics, but
at $400 a pop, such dreams are shattered.
There is a less expensive way to work with robotics, and
that is to make a robot from scratch, using surplus elec-
tronics and some smart engineering. Much can be learned
when creating your own robot and I mean this in the glob-
al sense: electronics, software,
mechanical and materials engi-
neering to be precise.
In this article I describe the
design of a second-generation
remotely operated vehicle (ROV)
based on a prototype that was
conceptualized and built by two
students. I’ll focus on the under-
lying electronics and software,
which you can easily extend to
any mechanical contraption. The beauty of this project is
that the entire ROV was about $150 with spare material
left over.
PROTOTYPE DESIGN
Photo 1 shows two ROVs, the prototype as well as the
second-generation version, which should be easy to identi-
fy. The chassis sits atop two drive wheels that are con-
trolled with two independent motors. A third swivel wheel
provides maneuverability; it also reduces the amount of
force required in turning the robot if the design were to use
two statically mounted wheels instead. Eight AA NiCad
cells are mounted on the bottom of the chassis providing
9.6 V of power.
Mounted on top of the chassis are the electronics,
mechanical arm, bucket, and flap. The
bucket is positioned to the side of the ROV
so that it can scoop up objects that are in
tight corners. And, with only three wheels,
balancing the robot, especially when it
picks up golf balls, can be a problem. Coun-
terweights on the arm opposite the bucket
are necessary to reduce the amount of
power required by the motor in lifting any
load.
You can tilt the bucket to hold objects
inside once they are loaded. The flap is used
to coax smaller objects into the bucket (e.g.,
small coins) as well as hold items in place
while the robot is moving. All of the
mechanical parts (except wheels) are
attached to separate motors using gears.
You’ll note that the gearing is different for
each of the three moving elements. Gearing
determines both the speed at which the part
moves and the amount of force that can be
applied in moving that piece.
An inexpensive, commercially available
VEX transmitter/receiver—which is general-
ly marketed as a surplus item on the internet—provides
radio control. The trick in using this hardware is in deci-
phering the receiver output and then using this informa-
tion to control the five motors. This is accomplished with
a Microchip Technology PIC18F4620. Additional circuitry
is required to handle the current drawn in driving each
motor as well as protect the controlling processor from
noise spikes created when motors are turned on and off.
The ROV electronics are
responsible for receiving a radio
signal, demodulating and decod-
ing it, and then controlling the
five motors onboard. This design
is atypical since it does not fol-
low the conventional motor con-
trol methods used in commercial
devices. First of all, the hardware
and software is designed to
directly control DC motors that
have a maximum current draw of 2 A. Additionally, the
signal scheme used by the VEX transmitter/receiver pair is
nonstandard and it cannot be used with anything other
than the VEX robot controller, which limits its use.
The project files (software, a schematic, and a mechani-
cal template) are available on the Circuit Cellar FTP site.
You can use the files for a design capable of picking up
objects ranging from small coins to golf balls and moving
across obstacles as high as 0.25″ in height.
MOTOR SELECTION
Motors are the most critical component in an ROV or
robot. Speed and torque govern ROV operation and are
inversely related. In general, the faster a motor runs, the
lower its output torque.
Figure 1—DC motor control is accomplished through an H-bridge circuit where
current can be passed through the motor in one of two directions acting to
move the motor either in a forward or reverse direction. Power FETs typically
act as switches to accommodate the high current requirements. Two control
lines determine the direction in which the current is passed through the motor.
Motor
Ground (0 V)
9.6 V
A B
1
4 2
3
Motor
Ground (0 V)
9.6 V
A B
1
4 2
3
Motor
Ground (0 V)
9.6 V
A B
1
4 2
3
+ +
Forward Reverse Brake
The ROV electronics are
responsible for receiving a
radio signal, demodulating
and decoding it, and then
controlling the five motors
onboard.
2011-3-015_Senese_Layout 1 2/10/2011 11:29 AM Page 29
30
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Another consideration is the nominal voltage that is
required by the motor, which in turn determines the batteries
required. For common DC motors, a gear head is usually
attached to reduce motor RPM and increase output torque to
a point making the motor useful. Let’s look at how a motor is
selected. Fortunately, it requires only simple math to arrive
at an approximation. Taking a more rigorous approach would
include the transient effects of motor inductance, yet this is
not necessary for our purposes.
In this ROV, two Namiki DC motors with RPM of 70 at 6
V (50 mA) were used to drive each 3″ wheel. RPM for differ-
ent voltage inputs can be approximated by using 70 RPM per
6 V, or 11.7 RPM per volt. Power is supplied by 8 AA batter-
ies, providing a maximum of 9.6 V. If maximum power is
applied to the drive motors, they will turn at 112 RPM (i.e.,
9.6 V × 11.7 RPM/V). With a 3″ wheel attached to the motor
spindle, the ROV has a maximum traveling speed of:
This is sufficient to maintain control within the confines
of tight spaces.
′ × ( ) × ×
′′
3
1
60
17
112 RPM
min
seconds
=
second
π
The torque available from both motors will determine if
they are strong enough to move a fully loaded metal ROV
across a floor, over small objects, or up an incline. Nominal
torque first must be calculated at a specific motor speed
using the manufacturer’s specifications and an internal
motor resistance measurement. For this project, it came
out to be 6 Ω in using a standard ohmmeter.
There are two problems with this calculation. First, the
motor starts at 0 RPM, not 70 RPM as is specified for this
level of torque. Secondly, to achieve maximum power, 9.6 V
must be applied to the motor. To get an accurate torque esti-
mate, you must use a variable called a “motor constant”
(Km), which relates motor torque to input current. Note that
Km = Torque (N-m)/input current (A) = 0.038 N-m/0.05 A =
0.76. You can use Km to give a torque reading when the
motor is at a stall (0 RPM) and when you apply maximum
Torque =
Electrical power - Internal power loss
Rotational sspeed (rad/s)
=
A 6 V 0.05 A 0.05 A 6 0 05
2
. × ( ) − × × ( ) Ω
π 70 RPM
s/min
= 0.03888 N-m
×
60
Figure 2—The complete control system. Control signals originate from the transmitter, are demodulated by the receiver, processed by the
microcontroller, and eventually used to control five motors.
2011-3-015_Senese_Layout 1 2/10/2011 11:29 AM Page 30
www.circuitcellar.com

CIRCUIT CELLAR
®
31
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
voltage. You first estimate the amount of current provided to
the motor when it is at rest: 1 A (i.e., 9.6 V/6 Ω). Using Km,
you can calculate stall torque for the motor as 0.76 N-m (i.e.,
0.76/1 A).
Now add the effects of the 3″ wheel, which will convert
the torque into a forward driving force. This force can be
determined as:
With two motors working in tandem, 40 N of force can be
brought to bear in moving the ROV.
Resistance to moving across a flat surface originates
from the drive wheels. This force can be found to be 0.6 N
per wheel, which is negligible. For an ROV with a mass of
3.5 kg, 40 N of force will yield an acceleration of 11 meters
per second with the ROV reaching maximum speed in 34
ms. Needless to say, the motors selected are more than
adequate in terms of moving the robot quickly and easily.
Refer to Photo 1. Note that opposite from the drive
wheels a single swivel wheel is used to allow the robot to
turn easily and provide greater maneuverability. The drive
wheels are powered independently and can be controlled to
move in forward or reverse.
Torque
Distance from motor spindle
=
0.76 N-m

0.0254
1 5 . ′′ ×
m
= 20 Newtons
′′ 1
There are three other motors of the same type onboard to
lift the arm, tilt the bucket, and close the flap. The use of
gears makes mechanical control easier. In the case of the
arm, the gear ratio is 10 (motor pinion) to 50 (gear attached
to arm). This reduces the rotational speed of the motor by a
factor of five and increases torque by a factor of five as
well. Gearing is an essential design consideration since it
offers a way through which fine tuning can be applied to
mechanical control. Without gearing, a direct connection
between the arm and motor would result in an arm that
rotates at 360 degrees in 1 second (using 70 RPM at 6 V).
MOTOR CONTROL
Regarding motor control, the direction of spindle rota-
tion is determined by the polarity of the voltage applied to
the two input leads. Speed is managed by varying input
voltage. This is best achieved using PWM and varying duty
cycle between 0% and 100%. Not only is this easier to
implement, but it is also offers greater power efficiency
since it eliminates the need for a power absorbing variable
resistor. When placed in series with a motor, such a resis-
tor would act to control the voltage applied to the motor.
Current through the resistance results in power loss.
DC motors are often controlled with an H-bridge (see
Figure 1). As I mentioned, a motor can draw 1 A when in a
Figure 3—The design features a PIC18F4620, which is used to process the incoming datastream originating from the open-collector receiver.
An interrupt-driven input pin deciphers the serial PPM stream and responds by manipulating two output control signals (per channel) which
are fed to an H-bridge circuit. Motors are connected directly to the H-bridge and diodes act to protect the circuitry from transient spikes gen-
erated by each motor.
Robot
Circuit board
5 V
Motor #1
Motor #2
Motor #3
Motor #4
Motor #5
Motor #6
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
40
39
38
37
36
35
34
33
32
31
30
29
28
27
26
25
24
23
22
21
Ground
Data
Processor with motor controllers
Analog control channels
(#1 through #4)
Digital control channels
(#5 through #6)
Power supply
(batteries)
Transmitter
Channel #1 - analog signal
Channel #2 - analog signal
Channel #3 - analog signal
Channel #4 - analog signal
Channel #5 - analog signal
Channel #6 - analog signal
Receiver
Channel #1 - analog signal
Channel #2 - analog signal
Channel #3 - analog signal
Channel #4 - analog signal
Channel #5 - analog signal
Channel #6 - analog signal
P
I
C
1
8
F
4
4
2
0
P
I
C
1
8
F
4
5
2
0
0
Front
Back
2011-3-015_Senese_Layout 1 2/10/2011 11:29 AM Page 31
32
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
stalled state. To accommodate this amount of current,
power FETs are generally used as electronic switches in the
H-bridge with the added benefit that there is a negligible
voltage drop between drain and source when the device is
in an “on” state. Almost all available battery voltage is
applied to the motor in such a configuration. The first-gener-
ation ROV made use of discrete FETs in forming an H-bridge
for each individual motor used. You can see in Photo 1 what
a rat’s nest that creates. The second-generation ROV was
designed to use a dual full-bridge driver (L298N), an older
inexpensive IC capable of handling up to 2 A. A drawback
to using this solution is that there is a small voltage drop
across the internal switches that reduces available power
to the motor. This trade-off was acceptable as it reduced
the number of components as well as cost.
Two control lines are required per single motor. Setting
one of these lines high while holding the other line low
allows current to flow through the motor in one direction.
Figure 4—A VEX receiver
demodulates information from
the transmitter which is in pulse
position modulation format. A
LO sync pulse that is 9 ms in
duration signals the beginning of
channel data. Six channels are
encoded, four of which are ana-
log and two are digital. A pulse
trough of 0.5 ms indicates full
speed reverse where 1.5 ms
indicates full speed ahead. An
idle channel has a pulse trough
of 1 ms.
20 ms
0.5 ms
0.5 ms
Reverse motor
at full speed
Forward motor
at full speed
Neutral
1.0 ms 1.5 ms
5 V
Ground (0 V)
0.5 to 1.5 ms
C
h
a
n
n
e
l

#
6
C
h
a
n
n
e
l

#
5
C
h
a
n
n
e
l

#
4
C
h
a
n
n
e
l

#
3
C
h
a
n
n
e
l

#
2
C
h
a
n
n
e
l

#
1
2011-3-015_Senese_Layout 1 2/10/2011 11:29 AM Page 32
www.circuitcellar.com

CIRCUIT CELLAR
®
33
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
By reversing the control line input,
current flows through the motor in
the opposite direction. Introduce to
this PWM and you have complete
motor control and can vary speed as
well as direction. The PIC18F4620 allo-
cates two I/O lines per motor. Figure 2
illustrates the interface between the
processor, an H-bridge IC (L298N), and
each of the five motors. Figure 3 shows
the relationship between the circuit
board, transmitter, receiver, and power
supply. You also see the channels and
motors.
Note the extensive use of diodes
placed around each motor. This is a pro-
tective measure to prevent the L298N
from being fried. It also serves to limit
the amount of noise generated as a
result of the motors being turned on and
off. DC motors act like large inductors.
When suddenly turning off a motor,
current continues to flow through the
internal windings. When met with large
resistance (controlling circuit being high
impedance in an off state), a large volt-
age spike is created. Diodes limit this
spike, yet in doing so introduces a differ-
ent problem. Diodes are tied to the
power supply lines. When a spike is
being dissipated, the instantaneous cur-
rent draw affects the power line voltage.
With a noisy power supply comes
unpredictable processor operation and
erratic motor operation. Capacitors are
added to the power supply lines to
reduce such noise spikes to the point
where processor instability is eliminated.
WIRELESS CONTROL
RC vehicles use readily available com-
mercial short-range transmitters. The
VEX transmitter/receiver is an example.
The controller provides two joysticks
that manipulate four analog channels
(forward/reverse with speed control) and
two sets of push buttons that provide
two digital channels (foward/reverse
with full speed only). This unit was
meant to be used with existing VEX
robot hardware and therefore uses a
funky encoding scheme for all six chan-
nels and then transmits this signal. The
receiver provides a signal that has to be
decoded and processed, providing the
control signals to five of the ROV’s
motors. One channel (digital) remains
unoccupied. This solution is a fraction
of the cost of others that are commer-
cially available.
Let’s now consider decoding this
stream, which makes use of the
PIC18F4620. All six control channels
originating from the transmitter and
demodulated by the receiver are first
separated and then further processed to
create a set of control signals that are
eventually provided for each individual
motor. The receiver has an open-collec-
tor output, a good feature allowing it to
operate with different power supply volt-
ages and making it easy to interface to
our processor. This output is formatted
as a pulse position modulation (PPM)
datastream format (see Figure 4), which
is fed into an I/O pin on the PIC18F4620
that supports interrupts. Initially, this
pin is polled in order to find the low-
going synchronization pulse that lasts
approximately 9 ms and is used to iden-
tify channel positioning. Each of the four
analog control channels (channels 1
through 4) is represented by an 0.5-ms
high pulse followed by a variable low-
going trough that can vary anywhere
from 0.5 to 1.5 ms in length, depending
on the position of the analog controller
at the transmitter. The two digital con-
trol channels (channels 5 and 6) create a
trough that is either 0.5 or 1.5 ms in
duration. Trough duration determines
both speed and direction of the motor
associated with that channel.
For a motor in an idle state, the
trough duration is 1 ms. For full-speed
forward, the trough duration is 1.5 ms.
Full speed reverse creates a trough that
is 0.5 ms long.
The PIC18F4620 is programmed to
identify the initial synch pulse by
polling the incoming signal while in a
continuous loop. When it reads a low
signal on I/O pin #33 (RB0) for 5 ms, the
channel counter is reset (set to 1), indi-
cating that the first channel soon will be
available for decoding. The interrupt on
this input is then enabled and pro-
grammed to be triggered on a rising
edge. When the pulse goes high, the first
channel has arrived and is ready to be
decoded. Within the interrupt, an inter-
nal timer is reset to 0 (marking the start
of the first channel) and the interrupt is
then re-enabled to be triggered on the
2011-3-015_Senese_Layout 1 2/10/2011 11:29 AM Page 33
34
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
motor speed and motor direction for
each individual channel.
The inner loop uses the duty
cycle/direction information and sets
two I/O output pins for each channel
that are fed into an H-bridge circuit
used in driving the motors.
METAL TIPS
Building an ROV or robot requires a
fair amount of mechanical engineering
as well. Aluminum sheet metal is use-
ful because it is inexpensive, easy to
to 2) and the process starts again with
the timer being zeroed when the rising
pulse triggers the interrupt again. Pro-
cessing activity within the interrupt is
limited to either resetting or reading a
timer value and storing it to memory
for later analysis.
The entire program, as captured in
Figure 5, measures pulse width dura-
tion to calculate motor speed and direc-
tion through a set of nested loops. The
outer loop is used to calculate and set
the duty cycle, which determines
next rising edge.
When the interrupt is triggered again,
the timer is reread and the value is
stored in memory (an array that is asso-
ciated with the channel number) for
later reference. The idea is to measure
the time between rising pulse edges and
then estimate the width of the trough,
which provides information about both
the direction and speed of the motor
connected to each channel.
After the first channel is measured,
the channel counter is incremented (set
After channel 6 is measured,
disable the interrupt service
routine. Start at step .
With this routine “enabled”, it gets executed every time there is a
LO to HI transition on the incoming data line. Once it executes,
the program continues to run executing until the last
channel is read and then it starts over at step .
C
h
a
n
n
e
l

#
1
C
h
a
n
n
e
l

#
2
C
h
a
n
n
e
l

#
3
C
h
a
n
n
e
l

#
4
C
h
a
n
n
e
l

#
5
C
h
a
n
n
e
l

#
6
Interrupt service routine
2b
3
1
1
1
2a 3
0.5 ms
Neutral
1.0 ms
4
Measure the time that passes between
rising pulse edges and store this information.
If the input signal is
LO for 5 ms, then go
to step 2a.
Enable the interrupt
service routine
If the time measured is 1.5 ms
(0.5 ms pulse + 1.0 ms
trough), then set the output
pins on Port C (RC0, RC1) to
LO (motor is brake).
0.5 ms
Forward (full speed)
1.5 ms
If the time measured is greater than 2.0 ms
(e.g., 0.5 ms pulse + 1.5 ms trough), then set
the output pins on Port C (RC0, RC1) to RC0=
HI pulse and RC1 = LO (motor goes forward).
0.5 ms
Reverse (full speed)
0.5 ms
If the time measured is less than 1.5 ms (e.g.,
0.5m pulse + 0.5 ms trough), then set the
output pins on Port C (RC0, RC1) to RC0= LO
pulse and RC1 = HI (motor goes backward).
9
Figure 5—This is the algorithm used to
decode the receiver data and generate
motor control signals. A sync pulse is first
detected followed by an interrupt-driven
measurement of pulse duration. From these
measurements, motor speed and direction
are calculated and appropriate control sig-
nals are sent to the motor driver circuits.
2011-3-015_Senese_Layout 1 2/10/2011 11:29 AM Page 34
www.circuitcellar.com

CIRCUIT CELLAR
®
35
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Brian Senese (brian.senese@sybase.com) holds an MS in
Electrical Engineering. He is a senior product manager at iAny-
where/Sybase in San Diego, CA. Brian’s interests include
offroading, jetskiing, sailing, and playing with embedded Linux.
PROJECT FILES
To download the code, go to ftp://ftp.circuitcellar.com/pub
/Circuit_Cellar/2011/248.
SOURCES
VEX Transmitter/receiver
Innovation First International | www.vexrobotics.com
PIC18F4620 Microcontroller
Microchip Technology | www.microchip.com
DC Motors
Namiki Precision Jewel Co. | www.namiki.net
hope that kids will want to try and build their own ROV or
robot from this information and then take it to the next level
by designing an entirely new contraption from imagination.
The electronics can be reused over and over again, unlike
those of an FM tube radio I built from plans when I was 14. I
nearly electrocuted myself and used the hammer for some-
thing other than shaping metal. But that’s a story for another
time. I
cut, strong, and light. Unfortunately, it is difficult (not impos-
sible) to bend because it is a brittle material. Using a vise to
hold the metal piece and a hammer to bend the metal can
work if you are careful.
I started to use cold rolled steel sheet for parts that
required bending. This type of sheet metal can be bent with-
out fracture and is readily available from metal shops. Even
though it has been stressed while cold, it will bend (perhaps
not as easily as hot rolled steel, which is harder to get at
metal yards in small quantities). Cutting and drilling through
steel is definitely harder as well; it should be since it is far
stronger than aluminum. Bending steel is best accomplished
by using a metal “brake.” I can’t imagine using a hammer
and vise to make a fold.
DIY ROV DEVELOPMENT
A robot template is available on the Circuit Cellar FTP
site. You can print the document and glue (rubber cement) it
to aluminum sheet metal. With the pattern in place, you can
use a metal shear or hacksaw to cut out the parts. You then
can drill holes as specified on the template, make bends
(again, as indicated on the template), and assemble the
design. Attaching gears and wheels requires special attention.
I find epoxy works well.
The days when kids built their own go-karts or made crys-
tal radios from wire and a diode seem to be gone. Unfortu-
nately, ready-made kits that take minutes to build and short
circuit the learning curve seem to have taken over. It’s my
NEED-TO-KNOW INFO
Knowledge is power. In the computer applications
industry, informed engineers and programmers don’t
just survive, they thrive and excel. For more need-to-
know information about some of the topics covered
in this article, the Circuit Cellar editorial staff rec-
ommends the following content:

Robot Navigation and Control
by Guido Ottaviani
Circuit Cellar 244, 2009
Guido built a navigation control subsystem for an
autonomous differential steering explorer robot. Here
he describes a robotic platform and a communication
system for remote management. Topics: Robot Naviga-
tion, H-Bridge, Motor, Telemetry

Inertial Rolling Robot
by Jeff Bingham & Lee Magnusson
Circuit Cellar 200, 2007
This H8/3664-based rolling robot is capable of iner-
tial movement. A DC electric motor is attached to a
pendulum and suspended inside an inflated ball, which
provides the driving force. Topics: Rolling Robot,
Motor, H-Bridge, PWM, Servo

Go to Circuit Cellar’s webshop to find these articles
and more: www.cc-webshop.com
FrontPanelExpress.com
(206) 768-0602
Q
Cost effective prototypes and production runs
Q Powder-coated finish and panel thickness up
to 10mm now available
Q
Choose from aluminum, acrylic or customer
provided material
Q
1, 3 and 5-day lead times available
Custom Front Panels
& Enclosures
Sample price $57.32 + S&H
FREE
Software
Designed by you using our
FREE software, Front Panel Designer
2011-3-015_Senese_Layout 1 2/10/2011 11:29 AM Page 35
63.qxp 1/7/2009 3:20 PM Page 1
41.qxp 1/7/2009 3:07 PM Page 1
38
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
It’s possible to embed one DSP device and a series of constant-current
generators to drive a set of high-power LEDs in an elaborate lighting system.
This project uses digital signal processing (DSP) technology to create a
modern version of a 1970s-era light system.
Embedded DSP for Lighting
T
F
E
A
T
U
R
E
ARTICLE
by Marco Signorini (Italy)
his project uses digital signal processing (DSP) tech-
nology to create a modern version of a psychedelic
light system from the 1970s. I replaced old-style lights with
high-power LEDs, and I created filter banks, implemented
with analog components in the original systems, with DSP
techniques. A Microchip Technology dsPIC30F2020 is at
the center of the system (see Photo 1).
HIGH-POWER LED LIGHTING
LED lighting has become popular. The benefits of LEDs are
their efficiency, lifespan, robustness, and small size. Plus,
LEDs are available in many colors and their switching speeds
make them excellent alternatives to traditional light sources
in traffic signals, automobiles, and entertainment systems.
High-power LEDs should be current driven. The 1-W
devices in my lighting project require 350 mA to properly
operate. In order to maintain high efficiency, it is not a
good idea to use a series resistor as a current limiter. A
switching, current-limited power supply is required. Even
better, in order to build a complete psychedelic light sys-
tem, a three-channel, current-limited power supply is
required: one for the red channel, one for the yellow chan-
nel, and one for the green channel. This could be an expen-
sive project in terms of the number of components required
when implemented with analog technologies. But it could
be really efficient if implemented in the digital domain
with pulse-width modulation (PWM) techniques.
The same hypotheses are valid for the filter banks
required to “split” the music frequencies into three differ-
ent channels. In the 1970s, this was done with a set of
operational amplifiers that were also used to rectify and
integrate the resulting filtered signal. In the digital era, you
can replace them with a unique DSP device.
And what happens if the DSP core is packaged with four
PWM channels, a ready-to-use ADC, and some memory?
That’s what I wondered when I started developing this project.
SYSTEM OVERVIEW
Before going into the hardware details, I’ll delineate some
logical blocks. A simple block diagram is represented in
Figure 1. Following the audio signal flow, you can start to
analyze the system from the electret microphone. The sig-
nal captured is amplified and filtered by a fifth-order, low-
pass filter. The resulting signal is applied to a digital-con-
trolled, variable-gain amplifier and then goes onto the ADC
present in the DSP. From this point, all the following
stages are implemented in the digital domain. Here we can
find first a high-pass filter, useful to remove a possible DC Photo 1—The LED lighting system on a prototype board
2011-2-017_Signorini_Layout 1 2/11/2011 10:08 AM Page 38
www.circuitcellar.com

CIRCUIT CELLAR
®
39
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
residual from the incoming signal, fol-
lowed by a filter bank able to split the
converted signal into three compo-
nents: a low band, a middle band, and
a high band.
Filtered and unfiltered signals are
evaluated by a signal power estima-
tion block that calculates four pro-
portional values. One value is used to
control the external programmable-
gain amplifier (PGA). The remaining
values are fed into the three-channel,
software-based PWM generator. This
is able to generate three independent
125-Hz waveforms with a 16-step
variable duty cycle used for dimming
purposes. These waveforms modu-
late, in software, the three hardware-
based PWM channels that generate a
150-kHz square wave suitable to drive
the external buck switching circuit
MOSFETs.
HARDWARE
Figure 2 depicts the analog front-
end subsystem. Figure 3 shows the
power supply, the DSP, and the digi-
tally controlled current generators.
Following the audio signal flow, the
signal received by the electret micro-
phone, MIC1, is amplified by the first
Microchip Technology MCP608 op
Figure 1—The complete project. The dashed line contains blocks that are implemented
inside the DSP device (either in hardware or by a software routine set).
A/D
Converter
SPI
In/out
Gain and
antialias
filter
High-pass
filter
(100 Hz)
RS-232
Output
(It sends
internal
variables)
Signal
power
estimator
dsPIC30F2020
Three-channel
software
PWM
Three-channel
Hw PWM
(Current
control)
Three-channel
HEXFET
and
LEDs Low-band
filter
Pass-band
filter
High-pass
filter
Electret
microphone
Variable
gain 1:1
to 1:31
amp (IC2). In conjunction with IC3 (a
Microchip Technology MCP6022), it
implements the fifth-order antialiasing
filter and is able to amplify the input
signal by a factor of 10. In addition,
the MCP608 (IC1) provides a VDD/2
voltage that’s used as a “virtual
ground level” for the analog signals.
With a signal fluctuating around
VDD/2 instead of ground, you don’t
need to have a bipolar power supply
that includes negative voltages. The
voltage shift is achieved through the
100-kΩ R11 resistor.
The filtered signal is fed into IC4, a
Microchip Technology MCP6S26
PGA. The PGA output is connected to
the ADC inside the dsPIC30F2020.
The DSP is also connected to the PGA
through a SPI. Unfortunately, the SPI
serial I/O pins are shared with the
dsPIC in-circuit debugger (ICD2) capa-
bilities. This explains the presence of
JP4 and JP5, which need to be shorted
to GND when debugging or program-
ming the device. (This makes it
impossible to change the external gain
when debugging, but it is not really
important.)
High-power LEDs are driven by
three independent buck-configuration,
constant-current generators imple-
mented by three P-channel MOSFETs
and related feedback networks. The
PWM waveforms, generated by the
dsPIC30F2020, are properly shifted by
two TC4427A low-side
MOSFET drivers. The
resistors R1, R6, and R11
are inserted to increase
the MOSFETs’ switching
time in order to reduce the
emitted switching noise
(EMI). The current that
flows through inductors
L1, L2, and L3 and the
LEDs produces a feedback
voltage through the 1-Ω
resistors R3, R8, and R13.
The feedback signals, fil-
tered by R4, R9, R14, C5,
C15, and C17 to remove
unwanted glitches are sent
to the dsPIC analog inputs.
Resistors R2, R5, and R7
are needed to eliminate
spurious pulses when the
dsPIC is not initialized. Figure 2—The analog input and antialias filter subsystem
2011-2-017_Signorini_Layout 1 2/11/2011 10:11 AM Page 39
40
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
The dsPIC30F020 contains all the logic needed to imple-
ment a fully compliant serial line that is useful for debug-
ging purposes. In order to connect an external PC, the TTL
levels produced and received by the dsPIC have to be trans-
lated following the RS-232-C physical specifications. This
is easily done by the MAX232 chip (IC3) and the related
passive components.
A 5-V linear voltage regulator (IC2) provides power for
the analog and digital components. The unregulated source
is used to power the LEDs.
FILTER DESIGN
As previously noted, even if the filters that split the
incoming signal into three bands are implemented in digi-
tal format, a front-end analog antialiasing filter is required.
When studying digital signal techniques, one of the most
important phenomena is related to the so-called Nyquist
theorem. It defines the frequency limits that an analog sig-
nal, fed into an ADC working at fixed rate F
S
, has to satisfy
to be properly mapped in the digital domain. In detail, the
Nyquist theorem affirms that one ADC, working at a fixed
rate F
S
, will be able to handle properly all signals with fre-
quencies less than F
S
/2. All portions of input signal residing
in the spectral portion located over F
S
/2 will be “folded
back” below F
S
/2 with the same amplitude (Lit1). This
effect, called aliasing, can be eliminated by filtering out the
frequency portion above F
S
/2 before the digital conversion.
To ensure that amplitudes of aliased frequencies found
in the digital domain have minimal impact on real signal
amplitudes, the antialiasing filter needs to be able to
attenuate signals over F
S
/2 by a factor that’s less than the
ADC’s signal-to-noise ratio (SNR). The dsPIC30F020 pro-
vides a 9-bit ADC block, resulting in an SNR near 55 dB.
The audio signal spectrum I want to convert, on the other
hand, is limited to 20 kHz. This forces me to select an
A/D sampling rate F
S
over 40 kHz. We would like to have
Figure 3—The power supply, variable-gain amplifier, DSP, and buck switching circuits
Photo 2—An antialias filter graph generated by FilterLab
2011-2-017_Signorini_Layout 1 2/9/2011 4:45 PM Page 40
www.circuitcellar.com

CIRCUIT CELLAR
®
41
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
a microphone as an input source for the audio signal, so
we need to develop an antialiasing filter with gain greater
than 1.
Microchip Technology’s FilterLab is an interesting tool
for speeding up the development of analog filters. By fol-
lowing the “wizard,” I can quickly define an initial filter
implementation that best matches all my requirements.
The resulting filter, unfortunately, was not within my tar-
get. However, iterating several times through the wizard
and relaxing some initial requirements, the tool was able
to provide a good solution. The selected microphone offers
a flat response up to 15 kHz, so I chose a Chebyshev design
for the filter with a 16-kHz cutoff frequency. With these
characteristics, the filter is able to attenuate by more
than 24 dB all frequencies over 20 kHz. Note that it’s not
the required -55 dB, but the attenuation provided by the
microphone provides a good compromise. As you can see
in Photo 2, the filter has an overall 20-dB gain.
The diagram shows that the digitized audio signal is
filtered by a high-pass filter, used to remove any offset or
DC residuals, and then feeds into a three-way filter bank
(low-pass, band-pass, and high-pass filters). These four fil-
ters are implemented in the digital domain via a set of
multiplication and sum operations performed by the
DSP. As you might think, implementing all in a single
dsPIC30F020 was very exciting.
Speaking of the filter bank (just forget for a moment
the filter used for the DC removal), I decided to obtain at
least 30 dB of rejection in the stop band, and 1-dB maxi-
mum ripple in pass-band frequencies, with stop frequen-
cies partially overlapping. This offers good channel sepa-
ration with the most flat response. These requirements
are listed in Table 1.
Momentum Data Systems’s dsPIC FD Lite is a tool
that helps design digital filters. It was really useful
because I could test different filter implementations,
simulating and comparing the resulting frequency charts.
The memory constraints imposed by the dsPIC30F020—
specifically related to the X_Memory space used by the
DSP core to perform fast computations—make it impossi-
ble to implement the filters using finite impulse response
(FIR) techniques. Simulating the best-matching FIR filters
shows that 318 bytes of memory would be needed for the
filter coefficients alone (using Kaiser window: 63 taps for
low- and pass-band filter, 33 taps for high-pass filter, for a
total of 159 coefficients).
Infinite impulse response (IIR) techniques are less expen-
sive in terms of memory requirements, but at the expense
of ripple magnitude in the passband. The simulations,
made through the tools, revealed interesting results using a
fourth-order elliptic filter for low-pass and high-pass filters
and an eight-order elliptic filter for the band-pass filter
stage. The memory required for the IIR filters’ 16 coeffi-
cients is just 32 bytes. Photo 3 is an example of a frequency
graph generated by the tool. Note that the filter can pro-
vide more than 40 dB of rejection in stop band.
Due to the good performance characterizing IIR filters,
DC removal was implemented in the same way. I used a
fourth-order elliptical high-pass filter with a frequency cut-
off equal to 100 Hz and a 50-Hz frequency stop.
GENERATORS
The dsPIC30F020 is a DSP suitable to be used in
switching power supplies. It contains a four-channel,
high-frequency PWM generator with hardware current-
fault control. For this reason, it can be efficiently used to
implement a three-channel, constant-current generator
required to drive three high-power LEDs in a buck config-
uration.
The powerful PWM generator stage is so flexible that it
is possible to directly drive three external MOSFETs and
evaluate the generated impulse feedback voltage without
any software intervention. This is perfect to replicate the
LP Filter PB Filter HP Filter
Cut-off frequency 1 kHz 2 kHz and 9 kHz 11 kHz
F stop 2 kHz 1 kHz and 11 kHz 9 kHz
Table 1—LP, PB, and HP filters
Photo 4—Data monitor and control interface in MPLAB IDE showing a
simulated input signal and the corresponding filtered output buffer
Photo 3—An IIR band-pass filter frequency graph, as reported by
dsPIC FD Lite
2011-2-017_Signorini_Layout 1 2/9/2011 4:45 PM Page 41
42
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
buck topology as explained in Microchip’s AN874, reduc-
ing the required component count.
The software initializes the PWM registers in order to
generate a 150-kHz square wave with a 90% duty cycle.
This working frequency was selected because it best
matches the requirements to reduce the size of the induc-
tors (an inductor’s dimensions are directly proportional to
the current flowing through it and inversely proportional
to the frequency), and it’s easily tolerated by the selected
MOSFET and drivers. The current that lights the LED,
when flowing in the feedback resistor, generates a signal
voltage. The 1-Ω resistor produces 370 mV at the LED’s
rated current. The feedback voltage is fed directly to the
dsPIC analog input, where it is compared by an internal
analog comparator with a voltage reference provided by an
internal DAC stage properly initialized
by the software. The comparison result is
used to blank the PWM channel output
for the required PWM cycle time. All is
done without any software intervention
(except for peripheral initialization). The
DSP’s time is freed and available to per-
form calculations for filtering purposes
and to generate a low-frequency (125 Hz)
PWM signal useful to modulate the
amplitude of each LED.
FIRMWARE
I developed the firmware in C language.
The files are posted on the Circuit Cellar
FTP site.
For the filtering stages, it uses
Microchip’s DSP libraries included in the
C30 compiler. The main loop is responsi-
ble for initializing the micro and the
related peripherals. It then periodically
calls the proper DSP processing routines
sequence at a rate specified by the inter-
rupt routine through some shared flags.
The main loop is also responsible for handling the informa-
tion related to the estimated signal power and to call some
routines, if required, to modify the external PGA gain. Last
but not least, it’s in charge of sending all debug informa-
tion through the serial port when compiled with the proper
debug option.
The adc.c file implements the routines needed to initial-
ize the ADC module and the related ISR. The ADC pro-
duces 40,000 samples each second. These samples are
stored in a double buffer implemented by the inbuffer.c
file. A double buffer is needed to prevent overlaps between
samples coming from the ADC and the already-collected
samples processed by the filter banks. With this solution,
the ADC result is placed in an area of RAM different from
the DSP working area, and the two areas are swapped at
the end of any filter calculation. A new DSP computation
phase is started by the main loop as soon as the ADC com-
pletes its working area.
In the filterbank.c file are the routines used to initialize
the filters and to filter the input buffer for each band. They
use the filter coefficients generated by the dsPIC FD Lite
tool, linked as assembler code to the project.
The buffers containing the filtered signal have to be eval-
uated in order to decide if and how much the correspon-
ding LED has to be lit or if the PGA gain has to be modi-
fied. This is implemented in the pwmeter.c file. The power
estimation value is calculated as an average of squared
sample amplitudes. The result is averaged with a previous-
ly calculated fractional value in order to maintain the sig-
nal history integrity. To perform fast computations, the
DSP’s 17 × 17-bit multiplier and 40-bit accumulator sup-
ported by the compiler’s built-in functions were used. This
makes it possible to fetch data, multiply, accumulate, and
shift the result in a single instruction.
Photo 5—This is a hardware-generated PWM signal in channel 4 and
relative feedback voltage in channel 1.
Photo 6—The PsyLight debugging console. An application is running.
2011-2-017_Signorini_Layout 1 2/11/2011 10:13 AM Page 42
Keynote Speaker
Steve Wozniak
Co-Founder, Apple Computer, Inc.
and electronics industry visionary delivers the
opening keynote speech on Tuesday, May 3rd
at ESC Silicon Valley!
Join the industry’s leading embedded systems event
(Translation: Can’t miss event)
ESC brings together the largest community of designers, technologists,
business leaders and suppliers in one place.
Categories and Tracks that address the most relevant issues facing engineers and the industry.
Take a moment to review this content, so that you can customize your educational experience.
Applications
t).*BOE.VMUJNFEJB
t4ZTUFNT"SDIJUFDUVSF
t3FMJBCJMJUZ4FDVSJUZBOE1FSGPSBODF
t3FNPUF.POJUPSJOHBOE8JSFMFTT/FUXPSLJOH
Embedded Software
t-JOVY"OESPJE0QFO4PVSDF
t1SPHSBNNJOHGPS4UPSBHF*0BOE/FUXPSLJOH
t1SPHSBNNJOH-BOHVBHFTBOE5FDIOJRVFT
t3504BOE3FBM5JNF4PGUXBSF
t4PGUXBSF1SPDFTTFTBOE5PPMT
t8JOEPXTGPS&NCFEEFE
t2VBMJUZ%FTJHOBOE6OUFMMFDUVBM1SPQFSUZ
t4BGFUZ%FTJHO
Hardware for Embedded Systems
t$IBMMFOHFTBOE4PMVUJPOTJO&NCFEEFE%FTJHOT
t$POOFDUJWJUZBOE4FDVSJUZ
t.FNPSZJO&NCFEEFE%FTJHOT
t.JDSPDPOUSPMMFSTJO
&NCFEEFE%FTJHOT
t1PXFSJOH&NCFEEFE%FTJHOT
t1SPHSBNNBCMF-PHJDJO
&NCFEEFE%FTJHOT
Tools and Best Practices
t#FTU1SBDUJDFT
t%FCVHHJOHBOE0QUJNJ[JOH
t%FTJHOBOE5FTU
t.BOBHJOHBOE1SPDFTT
t5PPMT
Topics in Embedded-System Design
t"SDIJUFDUVSF%FTJHO
t%41$PNNVOJDBUJPOBOE
$POUSPM%FTJHO
t)8BOE1MBUGPSN%FTJHO
t2VBMJUZ%FTJHOBOE
*OUFMMFDUVBM1SPQFSUZ
t4BGFUZ%FTJHO
43_Layout 1 2/8/2011 3:14 PM Page 1
44
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
clipped samples found in the
input buffer; and the selected
external PGA gain factor.
IMPROVEMENTS TO COME
This project demonstrates it’s
possible to embed in a single
inexpensive DSP device a series
of constant-current generators
that are able to drive a set of 1-W, high-power LEDs. It
shows how the same device could be used to perform some
real-time audio processing, modulating the perceived LEDs’
light similarly to old psychedelic light display systems.
The design process was really interesting thanks to some
highly productive tools that enable you to simulate and
experiment with a lot of technical solutions before writing
the C code. However, I have some improvements in mind.
The most important is related to the DC removal. Current-
ly implemented by a high-pass filter, it could be replaced by
an ad hoc moving-average mean estimator that evaluates
the mean offset and subtracts it from the incoming signal.
Another really interesting improvement would be to
replace the transformer-based power source with a more
efficient, autoranging switching power supply, using the
fourth PWM channel available in the dsPIC30F020. And
last but not least, spending some time to select a set of
higher-voltage MOSFETs would enable you to drive chains
of high-power LEDs for each channel, increasing the overall
light generated by the system. I
The power estimator is also
responsible for calculating a prop-
er gain to be applied to the input
signal through the external PGA.
This is accomplished by some
algorithms that take care of
parameters such as the number of
consecutive samples with maxi-
mum dynamics found in the input
buffer. The number of consecutive “clipped” samples is
counted by a specific function. If this number is greater
than a quarter of the input buffer length, I assume the
incoming signal has been “squared” by a high external gain
and should be attenuated.
The value calculated by the power estimator is dynami-
cally compressed by the pwmdriver.c routines through one
of the experimentally defined curves, selected at compile
time. These routines also implement the state machine
required to generate the software-based PWMs that modu-
late the LEDs.
TESTING & DEBUGGING
I developed and tested the firmware mainly in a simulat-
ed dsPIC30F020 environment via Microchip’s MPLAB IDE.
When the prototype board was assembled, the in-circuit
debugger was useful for debugging the hardware and tuning
some firmware parameters.
The simulated environment enables me to apply an
“analog signal” to the virtual ADC to provide stimulus for
the test code and, interestingly, to the simulated dsPIC reg-
isters. This was mainly done using text-based, comma-sep-
arated files containing test waveforms generated using
open-source audio editors (e.g., Audacity) and a simple C
binary-to-text conversion tool written ad hoc. Displaying
input, output, and filtered buffers in a graphical way
through the “data monitor and control interface” panel
was an invaluable aid when developing and debugging the
filter banks (see Photo 4).
The circuit was implemented through a prototype board.
I performed tests principally with a digital oscilloscope
connected to the feedback resistors. The LEDs were
replaced with 10-Ω, 5-W resistors in series with 1N4007
diodes to avoid damaging the expensive high-power LEDs.
Photo 5 is an example of a generated PWM square wave
found at the dsPIC output pin (in the oscilloscope channel
4) and the resulting feedback signal in channel 1.
I experimentally tuned some firmware parameters—like
the coefficients associated with the external gain change or
the compression curve needed to have a better and more
fluid light display—with an ad hoc Windows console appli-
cation. It presented, in a graphical fashion, the values sent
by the firmware through the serial interface. Photo 6 is a
live, running application. You can see various firmware
internal parameters: the fractional values for input, low-
band, mid-band, and high-band power estimation; a graphi-
cal representation of low-band, mid-band, and high-band
compressed amplitudes; the current score value calculated
by the automatic gain-control engine; the number of
Marco Signorini (marco.signorini@libero.it) has a degree in
Telecommunications Engineering from the Politecnico di Milano,
Italy. After working as a researcher at STMicroelectronics and
Whirlpool Europe, he now co-owns INGEGNI Tech S.r.l., which is
a private system-integration company focused on open-source
technology and VoIP deployment. Marco is an amateur radio
operator and enjoys programming and developing embedded
systems that can operate in network environments.
PROJECT FILES
To download the code, go to ftp://ftp.circuitcellar.com/pub
/Circuit_Cellar/2011/248.
RESOURCES
B.C. Baker, “Anti-Aliasing, Analog Filters for Data
Acquisition Systems,” AN699, Microchip Technology,
1999.
K. Curtis, “Buck Configuration High-Power LED Driv-
er,” AN874, Microchip Technology, 2006.
SOURCES
dsPIC30F2020 DSC and MCP6S26 PGA
Microchip Technology | www.microchip.com
dsPIC FD Lite
Momentum Data Systems, Inc. | www.mds.com
This project demonstrates it’s possible
to embed in a single inexpensive DSP
device a series of constant-current
generators that are able to drive a set
of 1-W, high-power LEDs.
2011-2-017_Signorini_Layout 1 2/9/2011 4:46 PM Page 44
www.trincoll.edu/events/robot
Saturday, April 9
ͻǣͲͲ aǤmǤȄͺǣ͵Ͳ pǤmǤ
Robot Piactice

ͳͲǣͲͲ aǤmǤȄͳͳǣ͵Ͳ aǤmǤ
Robotics Woikshops

ͳʹǣ͵Ͳ pǤmǤȄͳǣͶͷ pǤmǤ
Robotics Keynote Speakeis

ʹǣͲͲ pǤmǤȄͶǣ͵Ͳ pǤmǤ
Connecticut Council on
Developmental Disabilities presents
RoboWaiter Competition


Sunday, April 10
ͳͳǣͲͲ aǤmǤȄͶǣͲͲ pǤmǤ
Versa Valves, Inc. presents
Firefighting Home Robot Contest
Connecticut
Council On
Developmental
Disabilities
45_Layout 1 2/8/2011 3:15 PM Page 1
46
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Self-sufficiency is a goal toward which many electronics engineers
aspire. Reaching that goal involves more than fine-tuning your design
and programming skills. It also requires you to have an accessible set of
reliable tools for bringing projects to completion. Here you learn how to
build one such instrument—a CNC router.
CNC Router Design
I
F
E
A
T
U
R
E
ARTICLE
by Brian Millier (Canada)
am basically a one-man shop when it comes to most
of my projects. I design and build custom electronic
devices, and write any firmware and application software
that is required. I usually do the necessary mechanical
and cabinet work. In the past, I’d have to occasionally
depend on a machinist friend for assistance when a proj-
ect required tools such as a milling machine or lathe. But
not any more. I recently devel-
oped my own computer-con-
trolled milling machine and
router.
“THE LOAN”
As luck would have it, back
when I was working at Dal-
housie University in Halifax,
Canada, I knew a faculty
member who had a small,
unused Taig milling machine,
complete with a third-party
computer control (CNC)
option. He let me have at it,
and within a day or so, it was
assembled and I had scrounged
up a spare computer to run
the control software.
My first attempts at cutting
patterns in aluminum panels
were unsatisfactory. But, after
talking to the machinist, I
realized that I had to signifi-
cantly reduce the turning
speed of the mill bit, and he
also gave me a high-quality mill bit to work with. Ques-
tion: Why do companies bundle the cheapest, poorest
quality bits or blades with their tools, thus ensuring that
your first experience will be disappointing? However,
after that disappointing start, I was soon able to produce
decent-looking cutouts in panels and cabinets.
While Taig calls its product a “MicroMill,” it is somewhat
A Look at Computer-Controlled Machinery
Photo 1—This is the “on-loan” Taig setup I had in my shop at Dalhousie University.
2011-3-016_Millier_Layout 1 2/11/2011 10:38 AM Page 46
10,000-RPM spindle speed range is
well suited for general-purpose metal
work, but it would be too slow for
some tasks, such as engraving with
very small bits.
Generally, customers outfit the
Taig MicroMill with NEMA 23 step-
per motors for all three axis drives.
Using the standard 200-step/turn
stepper motors, and given the Taig’s
1/2″ 20-TPI lead screws, the step res-
olution is 0.000125″ when using only
a simple half-step controller. Step
resolution of five times greater than
this is possible when using a 10-
microstep controller, such as the
Geckodrive controllers, which are
very popular with small
CNC machines. Note that
I am referring to the elec-
trical resolution of the
stepper drive alone; in
practice, the overall
mechanical resolution is
less than this due to the
tolerances of the lead
screw/lead nut, and other
parts. However, Taig
claims an overall working
accuracy of 0.0005″, which
is excellent.
Modern NEMA 23
hybrid stepper motors,
such as those manufac-
tured by Keling, are avail-
able with high torque rat-
ings (200 to 300 oz-in) for
www.circuitcellar.com

CIRCUIT CELLAR
®
47
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
bigger and sturdier than other small
units, such as Sherline devices that
are basically designed for small work,
such as jewelry. The Taig is built
like a miniature version of an indus-
trial-grade vertical milling machine,
such as the Bridgeport unit that we
had in our machine shop. Photo 1
shows the “CNC-ready” version of
the Taig MicroMill, which is the
model that I had on loan. I have
mounted three Keling stepper motors
to drive the x, y, and z axes. The
stepper motor controller is housed in
the enclosure to the left. The blue
motor on the left turns the cutting
tool via a stepped pulley/belt arrange-
ment. The square black spindle
assembly in the center contains bear-
ings and a holder to take one of the six
collets to hold mill bits of various
shank diameters up to a maximum of
0.375″.
Performing cuts with a vertical
mill involves mounting your work to
the cross-slide table, which moves
side to side (x-axis) and front to back
(y-axis) under control of the x/y-axis
motors. The spindle, to which the
rotating cutting tool is mounted,
moves up and down (z-axis) under
control of a third axis drive motor.
The Taig mill I have is the
“extended model,” which has a
cross-slide table that’s 3.5″ wide ×
18.5″ long, but the standard model is
a bit smaller. The table travel for
this larger model is 12.5″ in the x-
axis and 5.5″ for the y-
axis. The tower, upon
which the spindle/motor
is mounted, is not that far
back from the cross-slide
table itself. That limits
the size of your work
piece in the y direction. In
practice, you can’t mill a
hole in your work piece
more than about 5.5″
away from the top (or bot-
tom) of the piece itself,
without having the piece
hit the tower itself. Any-
one using a drill press has
likely run into this
“throat size” limitation.
The Taig mill is adequate
for some of my projects,
but I often run into travel limita-
tions when working on some of my
larger cabinets/panels, such as 19″
rack panels. The exception is 1U/2U
panels, which can be held down to
the table using clamps on the top
and bottom.
An important consideration in a
machine like this is how well the
cross-slide table performs in terms of
rigidity. If there’s flexing or “play” in
either the x-axis or y-axis, the cut
will be rough and inaccurate, and the
tool will vibrate or “chatter” during
milling. You don’t want that. The
Taig mill is well designed in this
respect, with hefty steel ways in
which the table can travel, as well as
adjustable brass gibs (to compensate
for wear over time). Also, a very
important criterion in a CNC mill is
that the drive train for each axis must
be free of backlash. On a manually
controlled mill, some backlash in an
axis drive can be tolerated or compen-
sated for by the operator; but, in a
CNC machine, the computer is gener-
ally unable to correct for this short-
coming. The Taig mill uses 0.5″ diame-
ter Acme lead screws and antibacklash
lead nuts for each axis drive train, so
backlash is not a problem.
The Taig’s spindle drive assembly
is quite sturdy and accurately
machined. There really isn’t run-out
(“wobble”) in the cutting tool as it
spins. This is important as it affects
the accuracy of a cut. The 1,000-to-
Figure 1—A 1 × 2 section of the 8020 alu-
minum extrusion showing the slots for car-
riage bolt fasteners
Photo 2—A closeup of the linear carriage assembly, running on the
0.25″ steel rails
2011-3-016_Millier_Layout 1 2/11/2011 10:39 AM Page 47
48
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
than what I really needed.
It was at this point that I had a “Eureka” moment. I
came across a website describing CNC router kits and
parts based around the 8020 extrusion system. Building a
CNC router using this method enables a person who does
not have a lot of machining tools (such as a milling
machine) to build a CNC router accurately from scratch.
The best way to explain the “8020” extrusion system is
to take a look at a piece of it. As you can see in Figure 1,
this particular profile is made up of two “X” shaped sec-
tions. Looking closely at the open areas in the profile,
you can see it is shaped to accept common carriage-head
bolts, which can slide anywhere along the length of the
profile. While 8020, Inc. produces many different profiles
(both Imperial and Metric), the 15 Series is ideal for a
CNC router. There are numerous 15-Series profiles avail-
able (1 × 1, 1 × 2, 2 × 2, etc.) and the slot-to-slot spacing
is 1.5″ throughout the series. The slots accept 5/16″ × 18
carriage bolts. For places where you need a different type
of fastener, 8020, Inc. makes hundreds of specialty brack-
ets and fasteners for that purpose. Think of the 8020 sys-
tem as a Lego set for industrial purposes.
Just as important as the flexibility of this system is the
fact that 8020 can supply any of these extrusions cut pre-
cisely to length for a few dollars per cut. This is critical
because many designers don’t have a way of performing
such accurate cuts themselves. The 8020 website has a
number of manuals that include examples and methods
of using their components.
Another piece of the puzzle was finding a company
that makes and sells linear carriages, bearing blocks, and
NEMA 23 (or 34) stepper motor mounts, all sized to
mount perfectly on the 15-Series extrusion. (Refer to the
Sources section at the end of this article.) Photo 2 shows
a smaller carriage running on a 0.25″ thick steel rail,
which is used for my router’s x-axis.
The final piece to the mechanical puzzle is the axis
drive mechanism itself. Photo 3 shows the y-axis drive
around $40. Looking at some older, larger NEMA34 step-
per motor “pulls” in my surplus motor drawer, it’s obvi-
ous that the new stepper motors are much more power-
ful—and that’s at a fraction of the price and half the size!
Given the affordability of stepper motors and matching
controllers, it’s unlikely that one would opt to outfit a
Taig MicroMill with a much more expensive servomotor
drive, although it’s possible. The big advantage of a ser-
vomotor drive is in increased travel speed. However, for a
small mill like the Taig, it’s unlikely this is an important
consideration.
In a nutshell, I was very pleased with the Taig’s opera-
tion for my aluminum panel/cabinet work. However, I
was running into travel limitations on some larger work-
pieces. Thus, I started thinking about buying or building
a larger unit for myself.
DECISIONS, DECISIONS
I ruled out buying a larger CNC vertical milling
machine mainly due to the price. It was much more
expensive than the roughly $2,200 Taig CNC machine. I
briefly looked at some decent-sized, manually operated
vertical milling machines. They all were made in Asia
and were not well suited for CNC retrofitting for several
reasons, not the least of which were backlash issues.
I then changed my focus to CNC routers, which are
designed somewhat differently and are more commonly
used for wood and plastics. Since I really only needed to
mill thin aluminum panels (and also do carpentry as a
hobby), the CNC router seemed to be a good compro-
mise. On the Internet (YouTube is a good resource), I
found many examples of homemade DIY routers, as well
as some commercial units and kits. At the low end were
commercial/DIY units, the frames of which were either
particle board (MDF) or plastic. These are really only
good for working with plastics and foam, so I ruled them
out. There were also many examples of rather sturdy
units, framed with steel or aluminum, which had table
travels of 2′ × 4′ or greater. In this case, they were too
heavy and expensive to ship, and larger and more costly
Photo 3—A closeup of the y-axis drive train assembly
Photo 4—A moving gantry router, built using an 8020 aluminum
extrusion. (Source: www.glacialwanderer.com/hobbyrobotics/?p=17,
Maurice Ribble)
2011-3-016_Millier_Layout 1 2/11/2011 10:40 AM Page 48
www.circuitcellar.com

CIRCUIT CELLAR
®
49
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
and authored a great online-illustrated “build guide” for
this particular machine. Refer to Ribble’s blog listed in
the Resources section at the end of this article.
The advantage of the moving gantry router is that it
maximizes the amount of x/y travel for a given machine
footprint. The disadvantage is that the gantry is a rather
large, heavy assembly that must move smoothly and
accurately on the steel rails mounted to the bottom of
the frame. To accurately cut metal, this large gantry has
to be very precise and sturdy. The thought of that was a
bit daunting.
With that concern in mind, I instead decided to build a
“moving table” router. I came across a website run by
Ilya Dontsov in Russia. He describes such a unit, based
on the 8020 extrusion system (see Resources). My unit
differs from his in several ways, but the concept is the
same. Ilya was a great resource. We had a great e-mail
exchange during my router “build.”
Photo 5 shows my finished router located in my car-
pentry shop. You can see that the frame rests securely on
a home-built aluminum base unit. Just above the frame
is the moving table, which is about 19″ square and con-
structed entirely from precut 8020 extrusions. The
table’s left and right extrusions fasten to the three table
cross members using 8020 Inc.’s 3278 end fasteners,
which make for very accurate, strong joints. This is
important as the table assembly must be perfectly square
and tight to properly mate with the y-axis carriage
assemblies and move smoothly along the steel rails.
In this design, the gantry, which contains the x-axis
and z-axis linear motion assemblies, is fix-mounted to
the frame. This makes it much lighter and, at the same
time, it’s easy to make it plenty rigid.
What I have yet to mention, which also biased my
choice of designs, was yet another “Eureka” moment. I
had been immediately impressed by the 8020 extrusion
system, but I was somewhat concerned about shipping
all that heavy extrusion into Canada from the United
States, since shipping would be expensive. Fortunately, I
mechanism used in my router. (The x-axis is similar.)
The Keling stepper motor is mounted to the motor
mount plate, which comes predrilled to mount onto the
end of an 8020 extrusion. To the right is the bearing
block, also designed to mount directly to the 8020 extru-
sion using 5/16″ × 18 bolts and T-nuts placed in the
extrusion’s slots. The blue item is part of a thrust bear-
ing assembly.
While you would generally need a true flexible cou-
pling to connect the stepper motor to the Acme lead
screw, all of the previously mentioned parts are very
accurately machined, so the best way to couple the
motor to the Acme screw is to use an antibacklash cou-
pler designed to connect the motor’s 0.25″ shaft to a 1/2″-
10 Acme screw.
The Acme lead screw and lead nut convert the rotation
of the stepper motor into linear motion. Acme lead
screws come in many sizes and specs, but the 0.5″ size is
well suited for a machine of this size. I chose an Acme
screw with 10 threads per inch and what is called “single
start.” These will move 0.1″ per revolution of the motor
and provide higher linear torque. Many larger router kits
use “five-start” Acme screws, which move 0.5″ per
motor revolution. These move the carriage five times as
fast for a given motor speed, but with much less linear
torque. I’m not interested in high-speed axis motion, and
preferred the increased torque provided by the single-
start Acme screws. I was surprised to find that Acme
lead screws were not readily available in Canada, at least
not for someone looking for a few feet of them. My only
source of Acme screws was McMaster-Carr in the United
States.
I used DumpsterCNC antibacklash lead nuts recom-
mended to me by people who had previously built 8020-
based routers. These lead nuts have to match the Acme
screw threads you choose, of course.
GANTRY VS. TABLE
Having settled on a basic construction method, I then
had to decide on the style of router I wished to build.
There are two distinct types: moving table and moving
gantry. The most common option is the moving gantry
type, as shown in Photo 4. As you can see, the frame is
fixed to the table, but it’s mounted on short legs to pro-
vide for clearance below. There is a large gantry, which
extends both above and below the frame, and which
moves from one end of the frame to the other, providing
for x-axis travel (or y, depending on your point of refer-
ence). At the top of the gantry is the y-axis assembly.
Fastened to that is the z-axis assembly, used to move the
cutting tool (a router) up and down.
The workpiece is mounted to the frame using some
form of mounting jig, or, alternatively, a sacrificial
wood/plastic board is fastened to the frame to form a full
top. This particular machine is an 8020-based design. It
uses the same carriage assemblies, motor mounts, bearing
blocks, and so forth as described in the previous section,
as well as 0.5″ cold-rolled steel rails. Maurice Ribble built
Photo 5—My moving table CNC router, shown in my home carpentry
shop
2011-3-016_Millier_Layout 1 2/9/2011 4:48 PM Page 49
used a power transformer that provided closer to the 50
VDC that the G540 is capable of handling.
I used limit switches at each end of all three axes to
provide for overtravel protection. The G540 has numer-
ous inputs for such limit switches, and I also incorporat-
ed an emergency stop switch, which shuts off all the
motors in case something goes wrong. The G540 also has
several outputs, one of which I used to drive a solid-state
relay module which turns the spindle router on and off,
under computer control.
MACH 3 SOFTWARE
All CNC machines require an intelligent controller of
some sort. In the past, CNC was only used in profession-
al machine shops and was implemented using dedicated
control electronics, in much the same way that factory
machinery is run by dedicated PLC circuitry. Today, with
lower-cost CNC-ready tools available to smaller machine
shops, it is much more common to see the dedicated
controller replaced by a standard PC computer running
CNC application software.
My “loaner” Taig mill came bundled with a licensed
copy of the Artsoft Mach 3 CNC control software. The
CD-ROM also contained a variety of allied programs,
such as those that convert the output of various mechan-
ical drawing programs into the “G-Code” used by Mach 3
and all other CNC controllers.
Photo 6 shows the Mach 3 program as it appears on my
screen, although the layout can also be customized by
the user. For a beginner like me, this software is much
more than adequate to serve my needs, so it would be
pointless for me to try and compare it to any other com-
mercial and freeware programs that are available. I would
say, though, that Mach 3 comes with far and away the
best setup/operator’s manual (in PDF format) that I have
ever encountered. Setting up and configuring a CNC
machining tool is not trivial, so read this manual thor-
oughly, early on!
While the purpose of a CNC controller is to run the
50
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Photo 7—My PS/2 remote control pod, using six force-sensing resis-
tors for the jog switches
was approached by a colleague to dispose of a German-
made rack cabinet, which had housed a now-defunct sci-
entific instrument. Examining it, I discovered that it was
built entirely from aluminum extrusion, along with some
cast aluminum corner assemblies. While all of the cabi-
net’s extrusions were sized in metric, and not as versatile
a profile as the 8020 extrusions, it was nevertheless pos-
sible to build the basic frame unit, as well as the base
unit (which contains the controller and computer) com-
pletely from aluminum parts recovered from this cabinet.
In the end, I found a Canadian supplier of the 8020 extru-
sion and fittings, but it was nice to be able to recycle all
of this surplus aluminum (which is extremely energy-
intensive to manufacture).
CNC STEPPER CONTROLLER
I originally tried a three-axis, 2.5-A stepper controller
that I found in an online auction, but it did not work
properly, so I returned it. I then did what I should have
originally done. I ordered a Geckodrive G540, which is a
well-respected American-made four-axis controller, han-
dling up to 3.5-A (per phase) stepper motors, and power
supplies up to 50 VDC. It has an advanced 10-microstep
drive algorithm with mid-band resonance compensation,
and operates well without a ventilation fan in my shop.
I purchased Keling KL23H276-30-8B stepper motors for
the three axes. These motors provide 282 oz-inch of
torque and are rated at 2.1 A per phase, which matched
the controller I had initially ordered. The Geckodrive
G540 controller handles these motors nicely, but since it
is capable of providing 3.5A, it would have been better to
have ordered the Keling KL23H284-35-4B, which are a bit
more expensive, but provide 387 oz-inch of torque. Since
I had chosen single-start Acme screws, the somewhat
lower torque was not an issue in my case.
I powered the G540 using a surplus power transformer
I had on hand, driving a full-wave rectifier and a large fil-
ter capacitor. Here again, this 30-VDC power supply pro-
vided the ideal voltage for the eBay controller, but I
could have gotten better performance in my system had I
Photo 6—The Mach 3 CNC control software
2011-3-016_Millier_Layout 1 2/11/2011 10:40 AM Page 50
like me, you’ve been reading a lot
about touch switches, touch screens,
and the like. There was quite a per-
sonal temptation to incorporate such
technology, since I am very
impressed with my Apple iPod
Touch and iPad and their excellent
capacitive touch-screen interface.
However, for “jogging” purposes,
there were a few considerations
which led me to favor another
method. It would be advantageous if
the jog speed were somehow propor-
tional to how hard one pushed the
switch—that is, if you “leaned” on
the switch, the axis would rapidly
move to a general target location,
whereas a light touch could be used
to “home in” on the specific target
location. When using Mach 3’s
screen-based remote pod, pressing
the Shift key prior to hitting any of
the jog motion buttons switches to a
“rapid” speed. This feature can easily
be incorporated into the remote pod,
allowing for slow/fast axis motion.
Since there was a distinct possibili-
ty that metal shavings from the cut-
ter could end up on the remote pod, I
felt that there would be a good
chance of false triggering if using
touch-based technologies. You defi-
nitely don’t want false triggering on
a CNC machine!
What I settled on was a sensor
known as a force-sensing resistor
(FSR), manufactured by Interlink
Electronics. These FSRs come in var-
ious shapes and sizes, but the model
I chose is a circular pad, about 0.75″
www.circuitcellar.com

CIRCUIT CELLAR
®
51
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
tool under computer control, there
still exists the need to manually
position the workpiece on the
machine initially, and to manually
set spindle height. This manual con-
trol is called “jogging” in the trade.
To accomplish this, Mach 3 imple-
ments a “keyboard and screen”
implementation of a remote control
pod. This is perfectly functional, but
you have to place your computer
keyboard/mouse close to the tool
itself, making them susceptible to
metal shavings.
I decided it would be more conven-
ient if I had a small remote control
pod to perform such manual posi-
tioning. While these are commercial-
ly available, I decided to design and
build one of my own. Finally, some
electronics!
EXTERNAL CONTROL
Many of the control “buttons” on
the Mach 3 screen can be activated
by keyboard hot keys, in addition to
the mouse itself. The jogging “hot
keys” I wished to implement in the
remote pod are defined by default as
follows: x motion (left and right
arrow keys), y motion (up and down
arrow keys), and z motion (page up
and page down keys). You can rede-
fine these (under Config, System
Hotkeys menu), but these defaults
make sense, so I stuck with them.
To implement the remote pod, it is
mainly a matter of designing what is
commonly called a “keyboard
wedge.” A “wedge” is a device that
plugs into a PC’s keyboard port and
emulates a keyboard by sending out
specific key scan codes in response
to the user’s actions on whatever
input device the wedge uses. A true
keyboard wedge allows for a “real”
PC keyboard to be plugged into it,
and merges both the “real” key-
board’s data and the wedge’s own
data into one stream (hence, the
“wedge” moniker). In the case of my
remote pod design, I don’t allow the
“real” keyboard to be plugged into
the pod, choosing instead to merely
plug a standard USB keyboard into a
free USB port.
What type of keyboard did I decide
to emulate? The old PS/2 style or
the newer USB style? Actually, the
answer is both. I initially built a
USB-style pod for the Taig mill.
After I built my own CNC router, I
needed another pod for it, and this
time I chose the PS/2 interface, as it
turns out to be much simpler and
less expensive to design the pod this
way.
The Mach 3 software is designed
to use the standard PC parallel print-
er port for its machine-control inter-
face. Basically, any PC that has a
parallel printer port will also have a
PS/2 port, although I grant that such
computers are becoming less avail-
able over time.
SPECIAL SWITCHES
I put considerable thought into the
type of switches I was going to use
for “jogging” the three axes. If you’re
Figure 2—The remote pod is almost completely made up of the FSRs and the MCU.
2011-3-016_Millier_Layout 1 2/9/2011 4:48 PM Page 51
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
CIRCUIT CELLAR
®

www.circuitcellar.com
52
in diameter, as seen in Photo 7. These are rugged devices,
with a sticky backing that adheres nicely to a metal
panel. The sensor connections are made via a standard
flex circuit, which can be easily bent at right angles to
the pad, and made to exit via a small slot in the panel.
With no force applied, these sensors have a resistance
greater than 1 MΩ. When pressed with one’s finger, this
resistance decreases, reaching down to about 2 kΩ with a
firm finger press. Beyond very low forces of about 20 g,
the device responds in an inverse power-law relationship.
These sensors make ideal motion-control switches for
the CNC remote pod. They are
immune to contamination from
metal shavings or cutting fluid.
They don’t suffer from false trigger-
ing problems, as long as one sets
the pressure threshold sensitivity
properly. In small quantities, they
cost about $7, which is about the
same as any good-quality mechani-
cal switch (which would not have
the touch sensitivity).
In this application, I wired each
sensor up as the upper resistor in a
voltage divider, and fed the divider
output directly to one of the eleven
10-bit ADC channels contained in
an Atmel ATtiny461 MCU. With no pressure applied to
the FSR, the ADC will see virtually 0 V. A light finger
press will result in about 0.5 V going to the ADC. Final-
ly, with a heavy finger press, the ADC voltage will
exceed 3.4 V, which is the threshold, fixed in firmware,
that switches over to high-speed axis motion.
I use one of the remaining ADC channels to sample the
wiper of a pot that is connected across the VCC supply.
You adjust this pot to represent the minimum FSR pres-
sure needed to activate the “low-speed” axis motion,
which is a personal preference.
THE CIRCUIT & FIRMWARE
Figure 2 is a schematic of the PS/2-based remote pod,
which is pretty straightforward. Apart from the six FSR
sensor switches, wired as voltage dividers to six of the
MCU’s ADC channels, there isn’t a whole lot more to
the circuit. The pod is connected to the PC’s PS/2 key-
board port using a cable that I salvaged from a surplus
PS/2 keyboard. The four-wire PS/2 interface consists of
+5 V and ground wires, as well as a clock and a bidirec-
tional data line. The remote pod uses very little power
and is easily powered from the 5-V keyboard power sup-
plied by the PC. Both the data and clock lines are pulled
up to VCC by 4.7-kΩ resistors. The Atmel ATtiny461
MCU contains an internal 8-MHz RC clock, which is
accurate enough for this application, so no external crys-
tal/resonator is required.
The firmware is written using the Bascom-AVR BASIC
compiler. It consists of two main sections: the FSR sens-
ing loop and the PS/2 keyboard emulation routines. I
used an add-on PS/2 keyboard emulation library, avail-
able for Bascom AVR, rather than trying to roll my own.
The FSR sensing loop is fairly straightforward. To start
with, you read ADC channel 6, which is connected to
the pressure threshold pot. Whatever value you see here
is what you use to compare the six FSR readings with to
determine if any of them has been pressed hard enough
to be considered a valid slow-speed trigger event. Should
a particular FSR provide a voltage to its respective ADC
channel that exceeds this threshold, a SELECT-CASE
structure is executed, which sends out the proper key
scan code to the PC (preceded by the “make” scan code).
If a scan of all six ADC channels results in no readings
above the pressure threshold, then no buttons are
pressed. In this case, you send out a “break” scan code
followed by the scan code value of the last key that was
sent out. The preceding routine handles the slow-speed
axes’ motion.
In the case of a firmer press on any of the FSRs, its
respective ADC channel will return a much higher value.
I empirically determined that an ADC value of 700 corre-
sponds to a pressure that is considerably greater than the
slow-speed threshold, but it is not so firm as to make it
uncomfortable to achieve. Therefore, in the aforemen-
tioned loop, when the six ADC channels are being
polled, the value is first checked to see if it exceeds 700.
If it does, then we have to send out whatever keystrokes
are necessary to invoke high-speed motion on the proper
axis. Here it gets a bit more complicated. In Mach 3, to
jog at high speed, you must first release any jog key that
you may have depressed, next hold the shift key down,
and then, with the shift key still held down, press the
desired jog key.
To mimic this in my program, whenever I sense that
an FSR has been pressed hard, I first check to see
whether the last time this FSR was checked, if it was
pressed hard, or just gently. If it turns out that the last
time it was just pressed gently (usually the case), then I
first send out the proper scan codes to indicate that the
applicable key has been released. Then I follow up with
the scan code for the shift key. Lastly, I send out the scan
codes to indicate that the same key (shifted) has been
Apart from the six FSR sensor switches, wired as voltage
dividers to six of the MCU’s ADC channels, there isn’t a
whole lot more to the circuit. The pod is connected to
the PC’s PS/2 keyboard port using a cable that I salvaged
from a surplus PS/2 keyboard. The four-wire PS/2 inter-
face consists of +5 V and ground wires, as well as a clock
and a bidirectional data line. The remote pod uses very
little power and is easily powered from the 5-V keyboard
power supplied by the PC. Both the data and clock lines
are pulled up to VCC by 4.7-kΩ resistors.
2011-3-016_Millier_Layout 1 2/11/2011 10:41 AM Page 52
53_Layout 1 2/8/2011 4:19 PM Page 1
54
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
struck again. The firmware uses just 1,410 bytes of flash
memory, so it would be possible to substitute the lesser
ATtiny261 MCU.
Photo 7 shows the PS/2 remote pod mounted in a
Hammond 1455N1201 extruded aluminum enclosure.
These work particularly well because the top panel slides
in and out, facilitating assembly. The top panel and the
circuit board have to be “sandwiched together” due to
the way the FSR flex connectors are mounted to the PC
board.
THE FINISH LINE
This turned out to be my most involved DIY project in
recent memory. It was unlike any of my usual electronic
projects. When building custom, small-quantity electron-
ics projects, I often find it practical to “design it as I
build it.” I regularly use hand-wired Vectorboards and
chip sockets. And with much of the functionality embed-
ded in the MCU firmware (which is crafted last), the
method generally works out well.
In the case of a precise mechanical tool such as the
CNC router, it’s imperative that you do a whole lot of
planning well in advance of even ordering the necessary
parts. Knowing exact dimensions are critical, as most of
the metal is ordered cut to size. Details like thread size
and component strength are essential. Also important are
sticky details such as whether your design will enable
you to place tools in the necessary spots to tighten the
bolts sufficiently. Undoubtedly, I spent more time research-
ing this endeavor, before even ordering a single part, than I
routinely spend building an entire electronics project.
This project also made me much more aware of how
pampered the modern electronics enthusiast is when it
comes to parts supply. A typical electronics project BOM
can be fulfilled from one or two huge distributors, drawing
from their 1-million-part inventory. They are happy to sell
you one or 1,000 of a specific component, and you can
expect delivery in a day or two for a very low courier fee.
In this project, I had to ferret out numerous suppliers,
many of which were small web-based businesses that had
much longer delivery times and accepted only PayPal. I
also learned to pay attention to the invaluable advice
available from the CNCZone forum, which is home to
many professional machinists with expertise in tech-
niques, as well as practical experience regarding many of
these smaller vendors. In the two cases where I struck
out on my own and ignored advice on the forum, I was
either disappointed or just plain ripped off. So, caveat
emptor! Overall, though, working on this project was an
extremely enjoyable experience. I
PROJECT FILES
To download a manufacturer list, go to ftp://ftp.circuit
cellar.com/pub/Circuit_Cellar/2011/248.
RESOURCES
“DIY 80/20 Aluminum Extrusion CNC Machine,”
www.8020CNC.com.
DIY CNC Machinist Forum, www.cnczone.com.
M. Ribble, “My CNC Engraver (Part 1),” Hobby
Robotics Blog, August 3, 2008,
www.glacialwanderer.com/hobbyrobotics/?p=17.
SOURCES
Mach 3 CNC Control software
Artsoft | www.machsupport.com
ATtiny461 MCU
Atmel Corp. | www.atmel.com
Force-sensing resistor
Interlink Electronics | www.interlinkelec.com
Brian Millier (bmillier1@gmail.com) runs Computer Inter-
face Consultants. He was an instrumentation engineer in
Author’s note: Go to the Circuit Cellar FTP site to down-
load a complete list of companies that manufacture and
sell the motor controllers, mechanical parts, and special-
ized fasteners I used for this project.
NEED-TO-KNOW INFO
Knowledge is power. In the computer applications
industry, informed engineers and programmers don’t
just survive, they thrive and excel. For more need-to-
know information about some of the topics covered
in this article, the Circuit Cellar editorial staff rec-
ommends the following content:

Build a Three-Axis CNC Mill Machine
by Gordon Dick
Circuit Cellar 201, 2007
Gordon shows you how to design and build a com-
puter-controlled wood mill machine. The system
includes an old medical X-ray machine, a Galil DMC-
2133 three-axis intelligent motion controller, and an
old 386 laptop. Topics: CNC, Mill, Servo Amp, Motion
Controller, Cabling

Electronic Gear Control
Add Electronic Gears to a Metal Lathe
by John Dammeyer
Circuit Cellar 196, 2006
John upgraded his metal lathe with a PIC-based gear
control system. In this article, he explains how to
design and write code for an electronic gearbox. Topics:
Gearbox, Lathe, RS-232, Threads, Stepper Motor, CNC

Go to Circuit Cellar’s webshop to find these articles
and more: www.cc-webshop.com
the Department of Chemistry at Dalhousie University
(Halifax, Canada) for 29 years.
2011-3-016_Millier_Layout 1 2/9/2011 4:48 PM Page 54
Pick a Tool.
Any Tool.
Find the Right Development Tool, Compare it to Other Tools, Evaluate It,
and Buy It from Digi-Key Tools Xpress -- Without Leaving Our Site.
The Digi-Key Tools Xpress
intuitive research engines are
used by engineers worldwide to
locate, compare and evaluate
hardware or software
development tools.
Compare before you buy: tools are
listed side-by-side, with features and
performance specs, availability, and prices,
so you can make an educated decision!
Digi-Key Tools Xpress, engineered
by Embedded Developer, is the
only site in the industry where
engineers can quickly find,
compare and buy the leading
development tools.
Join the thousands of engineers worldwide who use
Digi-Kev Tools Xpress for their development tool needs.
FIND. COMPARE. BUY.
www.DevtoolsXpress.com
Pick-A-Tool(Digi-Key) Ad_Layout 1 3/25/10 3:29 PM Page 1
69_Layout 1 8/31/2010 2:24 PM Page 1
56
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Project management should involve more than creating a bill of materials
and then soldering and testing until the project deadline. You should also
frequently review design essential topics, reconsider all tool options
(from hardware to languages), and even attend conferences to stay
informed on new technology and design techniques.
I
by George Martin (USA)
often jot down and then store my
thoughts on essential design-related topics
until I have enough to write an entire column.
Project preparedness is one such topic. Well,
the time to focus on this subject is now.
SCHEDULING & SIMULATION
For a long time, I’d been capably scheduling
both simple and complex projects, doing either
manually or with project management software.
But what I’d been missing was the ability to work
with that schedule to absorb the real-world issues
that always arise. I now have a solution.
As a Circuit Cellar columnist, I’m frequently
offered books to review. Most are very detailed
and specific on a topic and, while good books,
they don’t necessarily cover things I can talk
about in this column. But recently, I was given
Claudia Baca’s book, Project Management for
Mere Mortals, which is about project manage-
ment and, more specifically, project scheduling.
The book covers project scheduling, handling
problems, and keeping bosses and customers
satisfied. It’s a good book even if you don’t
schedule projects for a living. It will give you
some valuable insight on how to run projects.
I use simulation quite often. It’s a must for
complicated projects, and it even helps to docu-
ment what’s going on with simple projects. On
the messaging system I’m working on, the simu-
lation shows the gain and bandwidth for each of
the system’s functional blocks. It’s usually more
time consuming to enter the schematic than it is
to run the simple simulation and record the
L
ESSONS FROM THE TRENCHES
results. But, it helps me to talk to the customer
and work through difficult problems. For larger,
more complicated systems, it’s great to see where
marginal operation might be lurking. I use a Lin-
ear Technology simulator. It’s available for free,
as in free beer. Other vendors offer similar prod-
ucts.
My son-in-law is a manager for a construc-
tion project. It’s a five-story lab building at
Stanford University. The drawings for the build-
ing are designed and available only in CAD for-
mat (paperless). The construction schedule con-
tains between 2,000 and 3,000 line items. They
have a program that lets you select several
views of the project (even sections through the
building) and then it runs the schedule against
the CAD drawings. The output is a time lapse
picture (model) of the building as it’s built per
the schedule. On the first run, they found some
items that appeared in the output too soon. For
example, a light fixture was hung before the con-
duit (or even the wall) was in place. Looking back
into the schedule, they found that these items did
not have the proper linkage to predecessor tasks.
After a simple change on paper, the output
looked great. Imagine running a project with hun-
dreds of workers, and someone trying to hang a
lamp before there was a wall to support it. It
makes many of our problems sound trivial.
STATE MACHINES
I recently wrote a column on state machines.
The editors at Circuit Cellar marked it up and
reported that I wasn’t using the term state
A Refresher on Project-Essential Concepts
The Project-Ready Designer
2011-3-013-Martin_Layout 1 2/10/2011 9:52 AM Page 56
www.circuitcellar.com

CIRCUIT CELLAR
®
57
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
machine properly. What I was
doing was really a command
processor. They were correct, so
I changed my article to reflect
their input. Well, after the article
was published I got an e-mail
from the fellow who actually did
the closing ceremony for the
recent Olympic Games in Cana-
da. Of course, he liked the article
and said that was exactly how he
did state machines except for a
slight difference in how he imple-
mented the timers. He went on to
explain his work represented the
largest CAN network ever implement-
ed. I had quite a chuckle.
I suspect that state machines were
invented and implemented in hardware
with rather rigid formal definitions.
Now that us software folks have gotten
our hands on the topic we’ve bent the
rules (probably actually broken most of
them) to suit our purposes.
CODE VALIDATION
What is an embedded system? A
good (useful) definition I recently
heard was that an embedded system is
a system where the original program-
ming never changes. So the system
has one purpose and, setting upgrades
aside, it was never repurposed. Seems
like a useful definition.
I use Source Publisher and Under-
stand from Scientific Tools. I use
Source Publisher more because it
seems I can generate code (both typing
and cut and paste) faster that I can
keep track of that code. So, the nicely
structured printout and highlighted
nature of the output helps me keep up.
Understand, is quite a different
product. If you’ve got a large legacy
system written in C, you can give that
to the program and you will get a dic-
tionary of variables and procedures.
Also, for a given routine you’ll get
who and where it’s called and which
routines are called by that routine.
Another feature of Understand is it
can generate flow charts directly from
your C code. This became most useful
on a recent medical project. The task
was to replace an obsolete micro
(National Semiconductor COP8) with
a more current device (Renesas
M16C28). I did that, and moving C
experts on the panel just how we
were going to accomplish that one.
Was it to just work longer hours?
They didn’t have a ready answer,
but they did suggest the use of an
RTOS with all of its support and
automatic code generation from
UML and other sources. IAR was
on the panel, and they offer such
products. Check out their state
machine tools to lessen the burden
of code generation.
UML
This brings me to the Unified
Modeling Language (UML). I use UML
as a drawing tool. It helps me think
through problems and present infor-
mation to others. I have talked about
that before and suggested you look
into getting started using UML. I use
No Magic’s MagicDraw package. It
has a basic package for a single-user
personal version, as well as an enter-
prise version. Several readers have
asked me if they could upgrade from
the personal version later for the dif-
ference. I was sure they could and
asked the factory, which said “yes,”
within limits (like the same version,
in a reasonable amount of time).
My assignment for 2011 is to upgrade
and try the automatic code generation
feature. Since I’m using the diagram-
ming portion of the product, why not go
all the way? I’ll keep you posted.
C CODE
Several years ago, I talked Circuit
Cellar’s founder, Steve Ciarcia, into let-
ting me write a column on C language.
Since we are friends who have worked
together for several years, he trusted
that I had something to offer. Well,
solely as a result of my efforts (major
joke here), check out the quality of the
code and flowcharts in the latest
issues. In all seriousness, C has become
the primary language for coding, the
flow charts show improved organiza-
tion, and structure and the scope of
projects has grown. Sophisticated
libraries are now matter-of-factly refer-
enced in articles. Good job, readers!
WHAT’S NEXT?
That brings me to the end of this
month’s article. I think that it will just
code from CPU to CPU was not all
that difficult. It was the assembly
code that caused all the gray hairs. It’s
not easily ported.
For that same medical project, the
code needed to be validated. And that
meant testing the modules against a
flowchart. Previously, the company
drew the charts by hand. Well, with
Understand, I could just press a button
and I had a PDF representing the flow-
chart for the procedure. This feature
alone saved several man-days of work
right at the end of the project when
everyone was pushing for results.
DEVCON 2010
I attended DevCon hosted by Renesas
last Fall. This is a technology get-togeth-
er between Renesas engineers, compa-
nies that support Renesas devices (as in
RTOS vendors), and end users like me
and you (Circuit Cellar readers). No
sales personnel were allowed. This four-
day conference involved lectures and
classes during the days, and meals and
keynote speakers in the evenings. I
believe it is held every two years, and if
you have a chance to attend one, it’s
well worth the time.
I sat in on the TCP/IP, USB, capacitive
touch, and RX610 evaluation board pre-
sentations. One of the sessions was
about software design. Marketing studies
report C is the predominate language for
designing embedded systems. Some say
about 25% to 30% of us are using C and
the percentage is growing. C++ comes in
less popular, and its usage is dropping
over time. The other fact is that the sys-
tems are getting more complicated and
time to market is shrinking. That
shouldn’t surprise you. So, I asked all the
I use simulation quite
often. It’s a must for com-
plicated projects, and it
even helps to document
what’s going on with simple
projects. On the messaging
system I’m working on, the
simulation shows the gain
and bandwidth for each of
the system’s functional
blocks.
2011-3-013-Martin_Layout 1 2/11/2011 10:45 AM Page 57
ß0w, ¡ß£8£'$
£¥£ß M08£
¡0 0I$00¥£8.
N
E
W
:

exclusive access to
w
w
w
.elektor-plus-usa.com
!
All 11 issues including the Summer Circuits edition
Included in your PLUS subscription: Annual DVD 2010
50% cheaper than normal retail price
Up to 40% discount on selected Elektor products
Elektor is delivered to your doorstep every month
Read your copy before everyone else
NEW: On your personalized Elektor PLUS website,
you have permanent access to the three latest editions
of the magazine in PDF format, as well as to a fast
Elektor search engine!
ß
£
w
I
www.eIekter.cemIusa º Fhene 860-875-2199
The upgraded Elektor PLUS subscription!
$ubscribe new
Your Elektor PLUS subscription gives
you exclusive access to the new
website www.elektor-plus-usa.com
where the three latest editions of
Elektor magazine are available in PDF
files (i.e. the current issue and the two
preceding ones). With a simple click
you download the complete edition
(front to back!) or any single article.
www.elektor-plus-usa.com also
supplies the most extensive Elektor
search engine found on the web
(all issues since 1998).
elektor.com
[Microcontrollers & Embedded Analog Audio Digital Test & Measurement]
5
0
+
p
a
g
e
s
b
u
ild
&
le
a
rn
June 2010
US $ 7.95 - Canada $ 7.95
m home-made tags
m wireless electricity
InterScepter Extension Board
opens doors (and ports) for you
DMX512 Interface
Simulator
no-wheels car electronics
Free Audio Measuring Software
LiPo Balancer
Starry Night
elektor.com
[Microcontrollers & Embedded … Analog … Audio… Digital … Test & Measurement]
5
0
+

p
a
g
e
s
b
u
ild
&
le
a
rn
September 2010
US $ 7.95 - Canada $ 7.95
Give your projects simple grace with the
Digital
Multi-Effects Unit
Elektor Project Case
The Elektor
15 configurable
sound effects
for small microcontrollers
Antennas and PC Software
focus on circuit simulation
Audio DSP Kickoff
Unilab V/I Display
US $ 7.95 - Canada $ 7.95
www.elektor.com
EMBEDDED GUIDE 2010
32 pages of microcontroller projects
Elektor DSP Radio Scanner
PCB Prototyper
NetWorker
A professional PCB router
with optional extensions
An advanced webserver
with a micro
50-watt Power LED
Heating System Monitor
Stroboscopic PC Fan
[Microcontrollers & Embedded
Measurement]
FR
EE 3
2
-p
ag
e
S
U
P
P
L
E
M
E
N
T
December 2010
58_Layout 1 2/8/2011 3:17 PM Page 1
www.circuitcellar.com

CIRCUIT CELLAR
®
59
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
be a waste of paper and ink for me to
continue to focus on C code in my
articles. By now I’ve covered all you
need know to get a project up and
running in C. I have not talked about
pointers to arrays of functions, but
you have the foundation to do that on
your own. If you’ve followed these
articles closely, you might not have
your black belt in C, but you should
be well on your way.
Next, I will start presenting com-
plete projects. I’ll start simply, with a
specification and interaction with the
user. I’ll then move on to system
design, hardware/software design, pro-
totyping, and testing. I hope some of
the projects will interest you.
I’ve threatened to design a spring
tester because I need one. But we just
recently sent a show dog off to be
bred and I thought about recording
the temperature, pressure, accelera-
tion, and such of her crate as she trav-
els on the airplane. And then, with all
the fuss about body scanners at the
airport, how about a radiation moni-
tor? I also picked up a Texas Instru-
ments MSP430 watch development
platform. That has potential.
I compete in the shooting sports, so
perhaps there’s a project hidden there.
Or, how about a radio that functions
like a VCR recording your favorite
programs?
As you can see, our plate is filling
up fast. If you have anything that
piques your interest or curiosity, drop
me a line and I’ll add it to the list.
Until then, keep all your #defines
IN_CAPS, make all your tasks the
same priority, develop a style for your
C code, and acquire and release your
shared resources in the same order
across all your tasks (alphabetical
order is a good one). If that didn’t
make sense, stayed tuned. I
George Martin (gmm50@att.net) began
his career in the aerospace industry in
1969. After five years at a real job, he
set out on his own and co-founded a
design and manufacturing firm
(www.embedded-designer.com). His
designs typically include servo-motion
control, graphical input and output, data
acquisition, and remote control systems.
George is a charter member of the Ciarcia
RESOURCES
C. Baca, Project Management for Mere Mortals, Addison-Wesley Profes-
sional, 2007.
SOURCES
Magic Draw
No Magic, Inc. | www.nomagic.com/dispatcher.php
Understand software
Scientific Toolworks, Inc. | www.scitools.com
Design Works Team. He is currently working on a mobile communications system that
announces highway information. He is also a nationally ranked revolver shooter.
2011-3-013-Martin_Layout 1 2/11/2011 10:46 AM Page 59
60
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
F
ROM THE BENCH
If you’re using a low-current microcontroller and your circuit’s total power
consumption is minimal, it doesn’t make sense to implement a power sup-
ply that might consume more current than the circuit requires. Here you
learn how to use a linear shunt regulator for low-current applications.
When You Don’t Require Line Isolation
W
by Jeff Bachiochi (USA)
ith today’s low-current micros
able to chug out the MIPS at a
handful of milliamps, total circuit consump-
tion can often remain low. It seems like a
waste to use a power supply that can eat up
more current while idling than your circuit
requires. You can steal small amounts of cur-
rent directly from the AC line, and you can
do so without bulky transformers or having
to worry about heat dissipation from those
series resistors normally required to drop the
voltage down to a usable level. In this article,
I’ll explain how Supertex has improved on
the idea of using a linear shunt regulator like
a Zener diode for low-current applications.
The circuit in Figure 1 has been used for
years to regulate small currents. Once the
Zener diode has sufficient reverse (leakage)
current flowing, its voltage drop will remain
constant until too much current destroys it.
The Zener diode’s wattage determines the
maximum current through it, while the leak-
age current is the minimum current to sus-
tain regulation. As long as the Zener diode
current remains within these limits, the volt-
age across the Zener diode will remain regu-
lated to the manufactured specification.
Zener voltages are available from 1.2 to high-
er than 200 V! Therefore, a circuit placed
across the Zener will be held to that Zener’s
voltage as long as the aforementioned rule is
not broken. To use this type of circuit, you
need to know the additional circuitry’s cur-
rent requirements. A fixed current require-
ment is the easiest to design for. When
placed in parallel with the Zener, the series
resistor is sized for the combination of the
Zener current and the additional circuit’s
current. However, if the additional circuit
current will vary, the current through the
Direct Line Connection
Figure 1—Providing a Zener diode with a minimum of reverse current produces a
constant voltage drop equal to its Zener voltage. The remainder of the source volt-
age must be dropped across its series resistor and the resistor’s value sets the cur-
rent flowing through the Zener. Any load placed in parallel with the Zener will have
the Zener voltage as its source and will share the series resistor’s current with the
Zener.
2011-3-002-Bachiochi_Layout 1 2/10/2011 10:19 AM Page 60
61
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
AC/DC
We need to rectify the AC line voltage to change the
alternating voltage of the source into rectified DC. Figure 2
shows the substitution of a capacitor for the series resis-
tor in the original figure (half wave) and the addition of
1N4001 diodes for full-wave rectification. Previously, we
found that the Zener and the load share the circuit cur-
rent. When the load is not using any current, the total
design current flows through the Zener diode. In this
case, this is wasted power. Adding a switch to the input
is one way to eliminate this waste. When the load
requires no current, the switch shorts the rectified out-
put. When the load requires current, the switch opens
and allows current to flow into the load.
In Figure 3 this switch is realized using an FET and a
diode. The diode prevents current stored in the circuit’s
output capacitor from discharging through the shunt
FET when shorted to circuit ground. All that’s necessary
now is some device to control the FET so the load
remains at a specified voltage. Enter the Supertex SR10.
The SR10 contains an internal FET switch and the
control circuitry to maintain a regulated voltage output
(V
OUT
) to the load. An internal voltage divider provides
three preset taps for 6 V/12 V/24 V regulation. Connect-
ing one of these taps to the feedback pin provides an
input to the SR10’s comparator which controls the FET’s
state. The user may substitute an external voltage
divider to obtain a V
OUT
other than one of the available
internal presets.
The SR10 uses synchronous switching—that is, the
FET only turns on when the source voltage is low (less
than V
SYNC
, in sync with the zero crossing). This means
that the current may not get diverted from the load for
some time after the V
OUT
has exceeded its regulation
point. This produces a bit of overshoot to the regulated
output. You can minimize overshoot by sizing the out-
put capacitor correctly. This is analogous to minimizing
output ripple.
Note that the series AC capacitor will remain charged
when the source voltage has been removed. This situation
exposes the user to a shock hazard at the plug. A large
value resistor placed across the AC capacitor will safely
Zener must vary in a complementary way because the
series resistor current remains constant. When the cur-
rent through the additional circuitry is minimal, make
sure the maximum Zener current isn’t exceeded or the
Zener will burn up. And when the additional circuit cur-
rent is maximum, make sure there is still a minimum
current flowing through the Zener or it won’t regulate
properly.
The voltage across the series resistor will be the differ-
ence between the supply and the Zener voltage. The cur-
rent through it is the total of the Zener current and the
additional circuitry’s current. Refer again to Figure 1.
The 1N4735A is a 6.2-V Zener diode. When connected to
a 12-V supply, about 6 V will be dropped across the
series resistor. At a current of 50 mA, 0.3 W of heat
must be dissipated (i.e., 6 V × 0.05 A = 0.3 W). When
connected to a 120-V supply, 114 V will be dropped across
the series resistor, and at a current of 50 mA, that’s 5.7 W
of heat that will need to be dissipated (114 V × 0.05 A =
5.7 W). That’s about as hot as a Christmas tree-sized
incandescent night light! Using a 10-W resistor to dissi-
pate this heat is bulky, taking up valuable real estate,
and will potentially require you to handle ventilation
issues.
This discussion is about connection to the AC line
voltage. Since the source voltage is varying (AC), we
have a trick we can use to cut down the wasted energy
we drop across the series resistor. In the aforementioned
case, the resistor is 2,200 Ω (i.e., 114 V/0.05 A = approxi-
mately 2.2 kΩ). We can replace the series resistor with a
series capacitor where capacitive reactance is as follows:
(Xc) = 2.2 kΩ. Since the Xc is imaginary, there is no dissi-
pation. By rearranging this familiar formula for finding
the capacitive reactance of a capacitor (i.e., Xc = 1/[2πfc]),
we get C = 1/(2πf × Xc), and we can determine what
capacitor will have a capacitive reactance of 2,200 Ω (i.e.,
1/[2π × 60 × 2,200] = 2 µF). But let’s not get ahead of our-
selves here. Note that we need to add a few more com-
ponents to the basic circuit.
Figure 2a—By substituting an appropriate (AC-rated) capacitor for
the series resistor, the Zener current is regulated by the capacitive
reactance and the Zener diode will regulate it during the positive half
(wave) cycles of the AC source. b—The addition of a full-wave bridge
allows the Zener diode to regulate during both half cycles of the AC
source.
Figure 3—If you add a switch, diode, and output capacitor, surplus
input current can be eliminated by shorting out the source. The
diode prevents the output capacitor from discharging during this
time.
a) b)
www.circuitcellar.com

CIRCUIT CELLAR
®
2011-3-002-Bachiochi_Layout 1 2/10/2011 10:19 AM Page 61
this is a good attempt at pre-
venting disorientation, the
addition of a third prong
assures a completely separate
earth ground.
If you refer to the half wave
rectifier in Figure 2a, you’ll
notice that the load is connected
to neutral. When using a full
wave rectifier as in Figure 2b,
the load is not at a neutral
potential. It is a diode drop
above the neutral wire
(ground). It is dangerous
enough working with line
voltages, so take extra precau-
tion and prevent damage to
your test equipment by pay-
ing attention to what is and
isn’t ground. I strongly sug-
gest using an isolation trans-
former between the AC line
and your circuitry if you are
planning to probe around
with a grounded scope.
PROJECT POWER
I was looking for a way to
power a small circuit I designed
to mimic the rotating beacon of a
model lighthouse (see Photo 1). The
circuit uses a ring of high-power
white LEDs to simulate rotation
without actually having any
mechanical movement. To give a
smooth rotational appearance, each
LED is driven by its own PWM.
I started this design by deciding
what the maximum size of the ring
of LEDs could be. For a 4′ model of a
lighthouse, somewhere around 2″ is
a reasonable ring size. I can use
LEDs with body diameters of from 3
to 10 mm (approximately 0.1 to
0.4”). The circumference of a 2″
diameter circle is approximately
6.3″. If I place 10-mm-wide LEDs
bleed off this charge without adding
any significant power loss. While
this AC capacitor self limits short
circuit current, the input can be
fused should you require catastrophic
failure protection.
HOT CHASSIS
While the neutral side of a two-
wire AC main is supposed to be at
ground potential, this can actually
be at some potential other than
ground and presents a safety hazard,
so one shouldn’t depend on it being
at ground. Never remove or circum-
vent the third wire in a three-wire
power cable. Many old nonpolarized
two-wire appliances used a metal
chassis connected directly to one
side of the line and, depending on
the rotation of the plug, might be at
a hot or neutral potential. If the non-
polarized plug is plugged in so the
hot wire is connected to the appli-
ance chassis, any exposed chassis
screw creates a safety hazard. Thus,
the reason for making two wire
plugs (and outlets) polarized by
widening the neutral prong. While
around the perimeter of a 2″ disk, I
could almost fit 16 LEDs (i.e.,
6.3″/0.4″ = 15.75″). Using these
would increase the outside diameter
of the assembly by two times their
height, 13 mm, for an increase of
around 1″ in diameter. If I wanted to
use T1-3/4 LEDs (5.6 mm), the cir-
cumference would be reduced to 4″
(16 LEDs × 0.25″ = 4″) or a diameter
of about 1.3″. With this smaller
(diameter) disk, I could always
mount the 10-mm LEDs by spacing
them away from the disk’s edge.
If I kept the design fairly modular,
adding or subtracting a few LEDs
would be easy. I picked a SOIC-28
pin Microchip Technology
PIC18F2431. While the SSOP-28 is
almost twice as small, that also
means the pin pitch would be 0.67
mm. This is really tough to hand
solder. So, since I wasn’t forced into
the smallest size by lack of real
estate, I went with the easiest to
assemble. As you can see in Figure 4,
I used the familiar five-pin ICD
header to allow using the
debugger/programmer. It is mounted
on the underside of the PCB below
the PIC and offers a convenient way
to power the circuit from the SR10
circuitry, which will interconnect
through this header (more on this in
a bit).
To keep with this modular idea, I
needed a way of assigning each PWM
to a particular bit number on a par-
ticular port. This way the same code
can be used for each PWM. To do
this, I made extensive use of indirect
pointers. Each LED therefore has its
own set of registers, a PWM value, a
PORT address, a PORT pin bit mask,
and a position mask for the FLAG
register. The FLAGS register holds a
direction indicator (bit) for each
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
CIRCUIT CELLAR
®

www.circuitcellar.com
62
Photo 1—Here is a typical scale-model lighthouse
used for decorative landscaping. These are becom-
ing popular as are scale-model windmills.
Heat dissipation is a concern for any product. In the
case of stealing small currents, you may have to get
rid of 5 to 10 W of wasted power if you don’t take
some measures to eliminate it. The SR10 incorporates
everything you need to produce a compact line operated
small current source.
2011-3-002-Bachiochi_Layout 1 2/10/2011 10:19 AM Page 62
www.circuitcellar.com

CIRCUIT CELLAR
®
63
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
able to present all of the states
between 0% (OFF) and 100% (ON).
The time for each tick is based on
the amount of time it takes to exe-
cute the DoPWM routine. The
DoPWM routine compares each of
the PWMx values to the present tick
counter PHASE. LEDx is turned OFF
unless PWMx is greater than
PHASE, and then LEDx is turned
ON. To go through this once for all 16
LEDs requires 185 µs. This means it
will take ~48 ms (256 × 185 µs =
47,360 µs) for a single loop of the
PWM PHASE cycle.
With a resolution of 256 bits, a
ramp up (or down) will require
approximately 12 s (i.e., 48 ms × 256
= 12,288 ms). Yup, that’s right over
LED. With 16 LEDs, two byte regis-
ters are required with direction bits
for LEDs 1 through 8 in the first
byte and for LEDs 9 through 16 in
the second byte (see Figure 5). These
FLAGS are the keys to how this
works. If a bit “x” in the pattern
generator is 0, then the Ramp routine
will reduce the PWMx value for
LEDx by one until it reaches zero, in
which case it will remain at zero
(value of 0 = 0% PWM). If a FLAG
bit is 1, then the Ramp routine will
increase the PWMx value for LEDx
by one until it reaches 255, in which
case is will remain at 255 (value of
255 = 100% PWM).
Using 256 values means that PWM
resolution is 8-bit or 256 ticks to be
Figure 5—Two 8-bit registers create a pattern generator. Each LED will illuminate when its
associated bit is a 1. A 0 will dim the LED. By periodically shifting all of the bits, every LED
will have its chance to turn on.
0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 1
8 7 6 5 4 3 2 1 16
FLAGSH FLAGSL
LEDs
15 14 13 12 11 10 9
Figure 4—The rotating LED beacon contains 16 LEDs driven off of the PORT bits of a small
SMT microcontroller. The total operating current for this circuit is 15 mA.
Motors & servos
Wheels & ball casters
Chassis & more!
Line followers
Mini-sumos
Robot arms
3pi Robot
$99.95
Item #975
Sensors & controllers
Discrete components
Cables & batteries
Pololu Simple
Motor Controllers
QTR
reflectance
sensors
$2.49
Laser cut your
own custom
chassis, front
panels & more!
Use our low-cost plastic
solder paste stencils to
quickly assemble your
surface-mount designs.
Both starting at only $25!
High-performance,
C-programmable,
ATmega328P-based robot
(with Arduino support)
1-877-7-POLOLU
www.pololu.com
Custom Laser Cutting &
Solder Paste Stencils
Save 10%
with coupon code
CCLLR3PI78
Mechanical Components
Pololu Wheels
$6.98 - $9.95
Electronic Parts
$31.95 - $59.95
Robot Kits
Linear
actuators
$89.95 - $109.95
2011-3-002-Bachiochi_Layout 1 2/10/2011 10:19 AM Page 63
CURRENT SOURCE
Designing with the SR10 is simple. While
there are some decisions you need to make
about which additional components you want
to include to complement your application,
component selection is common for all circuit
varieties, except in the selection of the series
AC capacitor’s value (see Figure 6). You can
avoid math if you take advantage of the C
S
selection
chart found in the SR10’s datasheet. Film capacitors are
often used in high-voltage AC circuits because they have
a lower ESR, which minimizes internal heating. The
large physical size of these capacitors makes them an
unsuitable candidate for SMT.
I used the same PCB form factor for this power supply
circuit as previously used for the LED disk. It uses a
similar diameter round PCB with alignment mounting
holes and a mating connector. Most scale model light-
houses built for outdoor use have a standard (Edison)
E26 candelabra base socket for an incandescent bulb. I
removed the (burnt out) guts of a compact florescent
bulb. Is it my imagination or do these last fewer hours
than an equivalent incandescent? The base of this bulb
will become the base of my rotating beacon module. I
want to enclose all the circuitry into a sealed unit for
two reasons. First, this will insulate all dangerous (line
level) connections from the user. And, since it will be
used outside, it needs to have some protection from the
elements.
BULB HOUSING
You might recall my August 2009 article in which I
described how to build a threat-level display (“Threat-
Level Indication System,” Circuit Cellar 229). I demon-
strated how to use an FTDI FT245R USB parallel port as
a PC-connected output device. To build the stacked
color-coded display I shopped the grocery aisles for a
suitable container. This same container made a perfect
protective case for this project. The candelabra base is
firmly attached to container’s cover. I drilled a 1″ hole in
the cover, stuck the base through from the inside, and
used quickset epoxy glue to hold the base onto the cover.
64
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
12 seconds. Since we want all 16 LEDs to go through
this cycle, that brings the rotation to over 3 minutes (12
s × 16 = 192 s). No lighthouse I know of has a rotation
cycle of minutes. A more suitable time would be no
more than a few seconds.
As it turns out, humans require about an 8% change to
the relative brightness to perceive a change has occurred.
At 1-bit resolution (two states, one change) the change in
brightness is 100% (i.e., 100%/[states-1] = 100%). For 2
bits of resolution (four states, three changes) that would
be 33% change per bit. For 3 bits, it’s 14% (i.e., 100%/7)
and 6.6% for 4 bits. Assuming linear changes, 4 bits is all
that’s necessary to fool the human eye into squashing
together the incremental change over time and have it
perceived as continuous.
If we take the preceding timings and recalculate for 4-
bit PWM resolution, we get some new numbers. The
PWM PHASE cycle now takes 3 ms. The ramp time now
requires 48 ms. This produces a rotational cycle of 768
ms. Less than once per second is too fast. Instead of
using the execution of the program to determine the
ultimate loop time, we can insert a timer into the loop.
Ordinarily, you might use this approach to assure pre-
cise control of a loop. In this case precision isn’t the
goal. By increasing the timer reload value, we can
increase the loop time and slow down the total rotation-
al cycle time to the timing we’re trying to emulate. The
minimum time here is approximately once per second.
This can easily be set to anything between 1 and 10 sec-
onds by using larger reload values.
Indirect pointers can be useful. While they allow one
to use data in a clever and flexible way, they add a level
of complexity to code that can make it difficult to
understand and debug. I challenged my ability creating
this modular code. Thankfully, the
application was simple enough that it
didn’t involve too many hours of clev-
erness. When finished, I had to sit
back and ask: Was this complication
worth the trouble? To help me answer
this question, I decided to recode the
application using neither modular
code nor indirect pointers. I used just
plain straight-line code. Table 1 is a
comparison of the two versions of
code. The straight-line code was
quicker to write, needed less debug-
ging, and was far easier to understand
than the modular code. This is a per-
fect example of keeping things simple.
Figure 6—The SR10 circuit requires few external components. Most components including
the optional fuse and bleeder resistor can be SMT parts. The large physical size of C
S
may
require using a through-hole part.
Version HEX (file size) DoPWM (time µs)
Indirect pointers with modular code 2K 185
Straight-line code 3K 59
Table 1—While these results show the typical reduction in code size and the
increase in execution time by making use of loops and modular code, it might
not be the best direction to take in every application.
2011-3-002-Bachiochi_Layout 1 2/10/2011 10:19 AM Page 64
optical device I mentioned in my
November 2010 article, “Recharging
Portable Devices: A DIY Power
Adapter Design” (Circuit Cellar 244).
It seems there are a lot of readers
out there who are experts in minuti-
ae. So, I thought I’d make this a con-
tinuing exercise for those of you
who might be privy to the answers
of some curiosities. I’ll call it: “Who
knows?”
Let’s start off with a question that
popped up during the background
work phase of this project. Who
knows where the “T” designation
(i.e., T – 1¾) came from when used
to describe the size of LEDs and
small incandescents? I
www.circuitcellar.com

CIRCUIT CELLAR
®
65
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
PROJECT FILES
To download the code, go to
ftp://ftp.circuitcellar.com/pub/
Circuit_Cellar/2011/248.
SOURCES
PIC18F2431 Microcontroller
Microchip Technology |
www.microchip.com
SR10 CCSS Regulator
Supertex, Inc. |
www.supertex.com
Jeff Bachiochi (pronounced BAH-key-AH-
key) has been writing for Circuit Cellar since
1988. His background includes product
design and manufacturing. You can reach
him at jeff.bachiochi@imaginethat now.com
or at www.imaginethatnow.com.
The SR10 power supply PCB con-
nects to the AC leads coming up
from the candelabra base. It fits in
the candelabra’s plastic shell and
provides 5-V power to the LED PCB
through two pins of its solder-side
ICD connector. Photo 2 is the fin-
ished project. At first, I tried a
translucent cover by sanding the
plastic surfaces of the container to
reduce the point source nature of
the LEDs. But in the end, I deter-
mined the clear cover offered higher
visibility, especially from a distance.
For the best results, use an LED that
has a viewing angle of at least
360°/LED count, or in this case
22.5°.
HEAT AVOIDANCE
Heat dissipation is a concern for
any product. In the case of stealing
small currents, you may have to get
rid of 5 to 10 W of wasted power if
you don’t take some measures to
eliminate it. The SR10 incorporates
everything you need to produce a
compact line operated small current
source.
Supertex offers the SR10DB1
(demo board) for those who wish to
play with a PCB of the SR10 circuit-
ry. The series parts are socketed, so
you can easily substitute compo-
nents of various values. There are
jumper selections for full/half wave
as well as output voltage.
WHO KNOWS?
I’d like to thank all the readers
who’ve responded with suggested
manufacturers for the old electro-
Photo 2—This project
can replace the stan-
dard light bulb used in
a scale model light-
house, as shown in
Photo 1. This gives
these works of art a
more realistic source
of light for guiding
lost wanderers home
to port. Can you say,
“Fog horn?”
2011-3-002-Bachiochi_Layout 1 2/10/2011 10:19 AM Page 65
66
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
T
he datasheet for the Microchip Technology
MCP794xx real-time clock/calendar
(RTCC) is just 20 pages long. Nevertheless,
there’s more going on under the hood than the
datasheet’s brevity might imply. Yes, there’s a
clock, and, yes, there’s a calendar, but the ’794
goes beyond simple timekeeping with the
addition of key features. Let’s take a closer
look.
With just eight pins to deal with, ’794
design-in is blessedly easy (see Figure 1). Pins
X1 and X2 are the connections for the ubiqui-
tous 32.768-kHz “watch crystal” or digital
equivalent. VSS and VCC are the main supply,
which can be anything between 1.8 and 5.5 V.
VBAT is the battery back-up supply, typically
a 3-V coin cell. As its name implies, the
multi-function pin (MFP) can serve as alarm,
clock waveform, or general-purpose output.
SCL and SDA are the I
2
C bus connections to
the host. Do note that the maximum speed of
the I
2
C interface depends on the operating
voltage—100 kHz or 400 kHz for VCC less
than or greater than 2.5 V, respectively.
Those of you who’ve worked with RTCs late-
ly will recognize that the ’794 pinout is kind of
a de facto standard that’s been adopted by a
number of suppliers. It’s really the features
Imagine if electronic gadgets couldn’t keep track of time. Wow, that would put a
crimp in our style. Fortunately, with a little help from a quartz crystal (or, these
days, perhaps a silicon MEMS equivalent), there are chips that can keep on ticking
while they take a licking.
Time Traveler
by Tom Cantrell (USA)
S
ILICON UPDATE
under the hood that make the ’794 unique.
Depending on the model (see Figure 2), the
’794 extras include 64 bytes of SRAM, 128
bytes of EEPROM, and a factory or field-pro-
grammed ID. Other RTCs have some of these
Figure 1—In addition to keeping track of the time and
date, the ’794 RTCC integrates other handy features
including 64 bytes of EEPROM, 64 bytes of RAM, and a
factory- and field-programmable 8-byte ID.
Embedded Timekeeping and More
Time stamp/alarms
RTCC X1
X2
VBAT
VSS
VDD
MFP
SRAM
I
2
C SCL
SDA ID
VBAT Switch
EEPROM
O
s
c
i
l
l
a
t
o
r
2011-3-003-Cantrell_Layout 1 2/10/2011 10:16 AM Page 66
www.circuitcellar.com

CIRCUIT CELLAR
®
67
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
calculator and you come up with a
back-up time of some 342,857 hours,
or nearly 40 years! In a real design,
there will be losses (battery self dis-
charge) and environmental considera-
tions (higher voltage and higher tem-
perature equal higher current) that
need to be factored in, but the point
remains that a typical battery will
probably last quite a while (e.g., 10
years).
The long-life expectations had me
asking about the other shoe that
might drop—namely, EEPROM data
retention. There’s no spec in the
datasheet, so I sent off a query to
Microchip and was informed they
claim the bits will last 200 years!
Write cycle endurance is a healthy 1
million cycles, so chances are you
won’t have to worry about the EEP-
ROM giving out before the battery
does.
In an otherwise mains-powered
application, the 700 nA (i.e., VBAT)
spec is the only one that matters and
concern about the active power con-
sumption is surely much ado about
nothing. But in a fully battery-pow-
ered application, active power con-
sumption could be a consideration.
EEPROM writes stand out, with
power consumption an order of mag-
nitude higher than other memory
accesses (3 mA versus 300 to 400 µA
for EEPROM read and SRAM
read/write). And the higher current is
required for a relatively longer time
since it takes 5 ms (typical) to write
features, but none of the others I’m
aware of have all three.
There are some other less obvious
embellishments that may not seem
like a big deal, until you find out you
need them. For instance, when the
main supply (i.e., VCC) fails, the ’794
automatically switches to the battery
back-up supply (VBAT). At the same
time, it stores the time and date
when VCC failed in battery-backed
registers. Similarly, when VCC is
restored, that time and date is stored
in a separate set of registers. It’s not
hard to imagine applications (e.g.,
refrigeration, security) that would be
well served by knowing when a
power failure occurred and how long
it lasted.
Calibration is another feature you
may not need, but would be sorely
missed if you do. All the more so to
the degree your application is subject
to temperature extremes and requires
long term accuracy. The ’794 has an
8-bit calibration register you can pro-
gram to add or subtract up to 127
clock cycles each minute, which
works out to a range of ±11 seconds
per day (±67 minutes per year).
Besides accuracy, the other reality-
check for an RTC is the battery’s
power. According to the ’794
datasheet, the typical power con-
sumption in battery back-up mode is
700 nA. On the supply side, a popu-
lar 3-V lithium coin cell, the
CR2032, specs capacity as 240 mAh
(to 2 V). Plug the numbers into the
the EEPROM versus tens to hundreds
of microseconds (dictated by the
speed of the I
2
C bus) for other memo-
ry accesses. When the chip is pow-
ered by VCC, but otherwise idle,
power consumption drops to a few
microamps.
If indeed EEPROM write power
consumption happens to be a con-
cern (energy-harvesting apps come to
mind), it’s worth noting that accord-
ing to the ’794 datasheet it takes the
same time (i.e., 5 ms) to write a sin-
gle byte as it does an 8-byte page.
Furthermore, page writes are more
I
2
C efficient (i.e., less time and
power) since one 8-byte transfer
requires far fewer clocks than eight
separate single-byte transfers.
Better yet, ask yourself if you real-
ly need the EEPROM at all. Perhaps
you can just get by with the SRAM
(i.e., ’0x instead of ’1x parts) since
backing the SRAM up is essentially
“free” from a power perspective (i.e.,
it’s included in the 700-nA spec). But
a look at the chip pricing reveals the
EEPROM costs only a nickel or so
(e.g., ’79400 is $0.68 at 1,000 units
versus $0.74 for the ’79401), so feel
free to go ahead and splurge.
One other EEPROM write issue to
keep in mind is the special “write-
busy polling” technique used to
Figure 2—The ’794 lineup encompasses variants with and without EEPROM and with or with-
out factory-programmed ID (“Extended Universal Identifier” in IEEE-speak).
1 Kb
64 Bits
No EE
64 Bits
64 Bytes
Unique ID
programming
64 Bytes
Blank EUI-48 EUI-64
MCP79410
• EE, SRAM
• Blank ID
MCP79411
• EE, SRAM
• EUI-48
MCP79412
• EE, SRAM
• EUI-64
MCP79400
• SRAM
• Blank ID
MCP79401
• SRAM
• EUI-48
MCP79402
• SRAM
• EUI-64
EEPROM
ID
SRAM
Memory and programming options
Figure 3—Instead of a status register or pin,
the ’794 tweaks the I
2
C protocol to use “ACK
polling” to check if an EEPROM write opera-
tion is complete.
Send
EEWrite command
Send control byte
with R/*W = 0
Send stop
condition to
initiate EEWrite cycle
Did device
acknowledge
(ACK = 0)?
Next
operation
Send start
No
Yes
2011-3-003-Cantrell_Layout 1 2/10/2011 10:16 AM Page 67
detect write completion (see Figure 3). I’m wondering if
this might be a bit “too clever” for typical I
2
C interfaces
or firmware. It may not be a problem, but you’ll have to
confirm that in your own application.
TIME HAS COME TODAY
Since the ’794 is such a simple chip, the easiest way to
explain all the features and functions is to go through
every single register bit by bit (see Figure 4). The first
registers (address 0x00–0x02) are where the action is as
they store the current time (i.e., hours, minutes, and sec-
onds). At the top of register 0x00, you’ll find the ST con-
trol bit, which is super important as it serves to ST(art)
and ST(op) the 32.768-kHz oscillator. Needless to say,
once you start the clock running you’ll want to be very
careful about stopping it intentionally or inadvertently
since, absent reinitialization, the “real-time” will start
getting “unreal.”
As an aside, this is an opportune moment to lodge my
generic gripe against packing various status, control, and
data bits, some read-only, some write-only, some
read/write, together.
Address 0x03 combines the day of the week (one to
seven) with three important status and control bits. As
its name implies, VBAT Enable (VBATEN) determines
whether or not the automatic switchover to VBAT occurs
when VCC fails (i.e., it falls below 1.5 V). As with the
aforementioned oscillator control bit (ST), once you
enable battery backup, you’ll want to be very careful it
stays that way. The next bit, VBAT, is set by hardware
when a power failure and VBAT switchover occurs. It
needs to be cleared in software, more on that in a
moment. Finally, the OSC On (OSCON) bit is set and
cleared by hardware to indicate whether the oscillator is
running. Along with the ST bit, it gives you a hook for self
test and diagnosis. If you turn on the oscillator with ST
but it remains off as far as OSCON is concerned, it’s likely
the crystal is broken. Just don’t be fooled by the fact that
there’s a bit of delay after setting ST before the appearance
of the clock is noted in OSCON. Patience, grasshopper.
Next up are the day, month, and year registers
(0x04–0x06). Notice there’s no provision for keeping
68
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Figure 4—The RTCC registers include time, data, and control registers (0x00–0x09), two alarms (0x0A–0x0F, 0x11–0x16), and power-fail and
power-restore timestamps (0x18–0x1B, 0x1C–0x1F).
Address
ST 10 Seconds
10 Seconds
Seconds
Minutes
Hours
Seconds
Minutes
Hours
10 Hours
10 Hours
V
BAT
VBATEN Day Day
Date Date
Month 10 Months
EXTOSC RS2 RS1 RS0
CALIBRATION
UNIQUE UNLOCK ID SEQUENCE
Reserved - Do not use
Month
Year Year
Day
Date
Month
Year
Control Reg.
Calibration
Unlock ID
Hours
Minutes
Seconds
01h
01h
01h
01h
80h
00h
00h
00h
00h
00h
1 - 7
01 - 31
01 - 12
00 - 99
1-12 + AM/PM
00 - 23
00 - 59
00 - 59
Day
Month
Date
Reserved
Year
Hours
Minutes
Seconds
01h
01h
01h
01h
00h
00h
00h
00h
1 - 7
01 - 31
01 - 12
00 - 99
1-12 + AM/PM
00 - 23
00 - 59
00 - 59
10 Minutes
10 Minutes
10 Hours
AM/PM
10 Hour
AM/PM
OSCON
10 Dates
10 Months
10 Dates
LP
10 Years
SQWE ALM1 ALM0 OUT
ALM0POL ALM0C2 ALM0C1 ALM0C0 ALM0IF
ALM1POL
BIT 6 BIT 5 BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 FUNCTION RANGE
RESET
STATE
BIT 7
00h
01h
04h
05h
06h
07h
08h
09h
0Ah
0Bh
0Ch
0Dh
0Eh
0Fh
10h
11h
12h
13h
02h
03h
14h
15h
16h
17h
18h
19h
1Ah
1Bh
1Ch
1Dh
1Eh
1Fh
12/24
12/24
10 Seconds Seconds
Minutes
Hours 10 Hours
Reserved - Do not use
Day
Date
Month
Day
Month
Date
Reserved
Hours
Minutes
Seconds
01h
01h
01h
01h
00h
00h
00h
1 - 7
01 - 31
01 - 12
1-12 + AM/PM
00 - 23
00 - 59
00 - 59
10 Minutes
Day
10 Minutes
10 Hours
AM/PM
10 Months
10 Dates
Day
ALM1C2 ALM1C1 ALM1C0 ALM1IF
12/24
ALM1POL
Minutes
Hour 10 Hours
10 Hours 10 Hours
AM/PM
Day
Date
Month
Month
00h
00h
00h
00h
00h
00h 10 Minutes
10 Hours
AM/PM
10 Months
Date
Month
00h
00h 10 Months
10 Dates
10 Dates
12/24
12/24
2011-3-003-Cantrell_Layout 1 2/10/2011 10:16 AM Page 68
www.circuitcellar.com

CIRCUIT CELLAR
®
69
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
that clock (e.g., 32.768, 8.192, and
4.096 kHz, once per second) is select-
ed with the RS0-RS2 bits. Note that
the general-purpose and square wave
output options for MFP are only in
effect when the chip is powered by
VCC. When running on the battery,
MFP reverts to its role as an alarm
output, with the ALM0 and ALM1
bits enabling either, neither, or both
of the two alarms available.
Register 0x08 contains the calibra-
tion factor described earlier—it’s a
signed 8-bit number that adds (i.e.,
slows the clock) or subtracts (i.e.,
speeds the clock) the corresponding
number of clock cycles once per
minute.
Register 0x09 guards write access
to the 8-byte unique chip ID. Writing
a 2-byte sequence (0x55, 0xAA) to
this register unlocks the unique ID
track of the century—so, yes, there
will be a “Y2.1K” problem. There’s
also no automatic adjustment for
daylight savings time since that
varies around the world (something
Apple recently learned the hard way
when iPhones used as alarm clocks
woke up users in some regions an
hour early and others an hour late).
However, the chip does keep track of
leap years for you with the LP bit,
which is set and cleared by hardware.
Register 0x07 contains a variety of
control bits, all read/write via soft-
ware. EXTOSC allows you to use a
digital, rather than crystal, 32.768-
kHz clock source. OUT sets the level
on the MFP pin if you choose to use
it as a general purpose output. Alter-
natively, you can output a clock on
MFP by setting the Square Wave
Enable (SQWE) bit. The frequency of
Photo 1—An ARM mbed module and Microchip evaluation board make it easy to check out
the ‘794. A few jumpers, a few lines of code, and a few minutes are all it takes.
Figure 5—The Microchip RTCC evaluation board provides a recipe for your own design. Just
add a crystal and battery and season to taste with a few discretes.
The PicoScope 4224 and 4424
High Resolution Oscilloscopes
have true 12-bit resolution
inputs with a vertical accuracy
of 1%. This latest generation of
PicoScopes features a deep
memory of 32 M samples.
When combined with rapid
trigger mode, this can capture
up to 1000 trigger events at a
rate of thousands of waveforms
per second. The PicoScope 4226
and 4227 up the sample rate
(250 MS/s Max) and add arbitary
waveform generator and external
trigger capabilities.
f PC-based - capture, view and
use the acquired waveform on your
PC, right where you need it
f Software updates - free
software updates for the life of the
product
f USB powered and connected -
perfect for use in the field or the lab
f Programmable - supplied with
drivers and example code
www.picotech.com/pco428
1-800-591-2796
12 bits (up to 16 bits with resolution enhancement)
PicoScope 4224: 80 MS/s Max
PicoScope 4226: 125 MS/s Max
PicoScope 4227: 250 MS/s Max
PicoScope 4424: 80 MS/s Max
32 M samples shared between active channels
PicoScope 4224: 2 Channels
PicoScope 4226: 2 Channels W/ AWG and Ext
PicoScope 4227: 2 Channels W/ AWG and Ext
PicoScope 4424: 4 Channels
USB 2.0
Rising edge, falling edge, edge with hysteresis,
pulse width, runt pulse, drop out, windowed
The new PicoScope 4000 Series
high-resolution oscilloscopes
P
i
c
o
S
c
o
p
e

4
0
0
0

S
e
r
i
e
s
Resolution
Sample Rate
Buffer Size
Channels
Connection
Trigger Types
2011-3-003-Cantrell_Layout 1 2/10/2011 10:16 AM Page 69
70
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
for writing using standard EEPROM
byte- or page-write commands.
Register blocks 0x0A–0x0F and
0x11–0x16 comprise the date and time
settings for the pair of alarms. Notice
that there’s no setting for years so you
can’t set an alarm for 12/31/99 to
warn of the imminent “Y2.1K” prob-
lem. Joking aside, even the most Rip
Van Winkle of applications would be
wise to wake up at least once a year
to celebrate a birthday and make sure
everything still works. Each alarm has
a polarity bit that determines whether
a 1 or 0 is driven on the MFP pin to
signify an alarm. The polarity has to
be the same for both alarms, so hard-
ware automatically sets ALM2POL to
equal ALM1POL. The ALMxIF bits
are set by hardware to signal that an
alarm has occurred until subsequently
cleared by software. Finally, three
alarm control bits determine the exact
alarm timing. Options include second,
minute, hour, or day matching which
is an easy way to generate periodic
alarms. Or you can specify an explicit
date and time for an alarm to occur
when all fields (i.e., seconds to
months) match.
If you don’t need to use one or both
alarms, feel free to use the alarm reg-
isters as an extra bit of SRAM in a
pinch. The fact the values you write
to the registers aren’t limit checked by
the hardware works to your advan-
tage. So, for example, you could set
every bit in register 0x0A, even
though the result (0x7F) is not a valid
value for seconds (i.e., not between 0
and 59 using BCD coding).
The final two blocks of registers are
for the power-fail (0x18–0x1B) and
power-restore (0x1C–0x1F) “time-
stamp,” which tracks the occurrence
of power (VCC) outages. After a power
fail and restoration, the timestamps
remain latched until you rearm by
clearing the VBAT bit (which was set
by the power failure) in register 0x03.
So, if the timestamps matter, the first
thing your application should do after
powering up is deal with them (e.g.,
log the event in the SRAM) and then
rearm. Notice that timestamp resolu-
tion is minute-by-minute since there
are no seconds fields.
TIME CARD
Microchip offers an RTCC evalua-
tion board that makes it easy (and
inexpensive at just $45) to see if their
Photo 2—You don’t need fancy software just to kick the tires. Decipher the ’794 register
dump and you’ll see it’s 6:29:56 AM on November 8, 2010 and there was a 5-minute power
failure from 6:22 to 6:27 AM.
2011-3-003-Cantrell_Layout 1 2/10/2011 10:16 AM Page 70
www.circuitcellar.com

CIRCUIT CELLAR
®
71
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
chip can pass the test of time. Along
one edge the board has connectors
that are compatible with their MCU
evaluation gear. For those who prefer
to hook the RTC to something else,
there’s a prototyping-friendly six-pin
header on the other edge. As you can
see in Figure 5, the board provides
access to the key signals and includes
the crystal and battery (there’s a coin-
cell holder on the back of the PCB).
As well, the schematic shows the
cast of supporting characters: capaci-
tors for the crystal and power-supply
bypass, a current limit resistor and
blocking diode for the battery, and
pull-up resistors for the open-collec-
tor I
2
C lines (i.e., SDA and SCL).
I happened to have one of the
ARM mbed gadgets sitting on my
desk and figured I’d use it to give the
RTCC a test drive (see Photo 1). The
mbed C library includes routines for
I
2
C bus access so no bit-banging
required. It was a simple matter of
plugging in some jumpers and hack-
ing a few lines of code to get the
RTCC up and running. (For more
information, refer to my article,
“Easy (E)mbed: An Alternative
Approach to Embedded Program-
ming,” Circuit Cellar 227, 2009.)
The quick and easy mbed develop-
ment environment encourages a
casual programming style that’s great
for experimenting. In the old days, I
might have taken more care to come
up with an elaborate and full-fea-
tured test suite. But it turns out I
needed nothing more than some sim-
ple code snippets to read and write
the RTCC registers and memory to
get answers to my questions. It’s
easy to just punch the key parame-
ters (e.g., register address and write
data) directly into the code and then
“blow and go.”
The first program was simple. I
just wrote an RTCC register and
then read and displayed the contents
of all of them. I edited and ran the
program a few times to initialize the
date and time fields. In the real
world, you’d take advantage of the
ability to load the entire block of
registers with a single multi-byte
transfer, but I wanted to be able to
jump around. Finally, I wrote register
0x00 with 0x80 to set the ST bit and
start the oscillator. Commenting out
the register write statement and re-
running the program, I was happy to
see the clock ticking away.
Hooking up a scope, I played
around wiggling the MFP pin using
the control bits in register 0x07 (e.g.,
OUT, SQWE, etc.). Next, after
installing a battery in the coin-cell
Photo 3—Whether using the Microchip I2C polling scheme or a software delay, make sure
you accommodate the EEPROM write cycle timing. Without the 5-ms wait statement after the
EEPROM page write, a subsequent EEPROM read goes sour. Put in the wait statement and all
goes well.
2011-3-003-Cantrell_Layout 1 2/10/2011 10:16 AM Page 71
72
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
on options), the extras (e.g., EEPROM, SRAM, unique ID)
can justify the cost. And there are some other subtle, but
nevertheless real, potential cost savings. For example,
having Microchip personalize each chip with a unique ID
simplifies your factory MCU flash programming flow. Or
perhaps you’re just making a few hundred gadgets that
need a globally unique ID (e.g., MAC address). The ver-
sions of the ’794 with a preprogrammed ID (i.e., ’x1 and
’x2) are only a nickel more than the blank ID parts, so in
low volume, it’s cheaper to buy some chips than pay IEEE
a license fee.
But wait, what about the “Y2.1K” problem? Well, let’s
just worry about it then. I
holder, I set the VBATEN bit (register 0x03) to enable
automatic battery backup. Now, cycling the RTCC power
(i.e., yanking the VCC jumper) I could see that time was
maintained across power outages. I was also able to see
the power-fail and power-restore timestamp feature in
action (see Photo 2), remembering to clear the VBAT bit
(to rearm the timestamp) after each power cycle.
Testing the SRAM is easy enough. Just change the I
2
C
addresses to point to the SRAM and the program writes a
byte and then reads it back for display so you can make
sure it got safely stashed away. To confirm battery backup
works, pull the VCC jumper, and while you’re waiting for
the electrons to dissipate, take a moment to comment out
the I
2
C (i.e., SRAM) write statement in the program and
reload the mbed. Now plug in the VCC jumper and run
the program again to display the SRAM data and make
sure it survived the power cycle.
It was all pretty simple and there weren’t any real sur-
prises. The only real question I had left was about the
special “write busy” I
2
C polling scheme described earlier.
I’d feared the RTCC or mbed might get confused or hung
up, but fortunately, their I
2
C routines played well togeth-
er. Indeed, accessing the EEPROM was pretty much as
easy as SRAM since you don’t even have to worry
whether a location is erased (i.e., 0xFF) or not so just go
ahead and blast away.
Now I was wondering if the “write busy” polling might
actually be working as intended out of the box (i.e., Is the
mbed I
2
C write routine actually waiting around for the
’794 to signal EEPROM write completion?) I was pretty
sure that would not be the case, but there have been plen-
ty of times I’ve been surprised by stuff working when I
had my doubts.
Anyway, no harm in trying, so I hacked the code a bit
to exercise the byte and page-write functions. My intu-
ition was confirmed when I tried to write one EEPROM
location and then another immediately with no interven-
ing delay to discover bits were lost (see Photo 3).
Let’s see. Should I hook up a logic analyzer to the I
2
C
lines, dig under the hood of the mbed I
2
C routines, and
write/test/debug bit-banging code to manhandle the
RTCC “write busy” protocol? Or should I just add a 5-ms
delay in software after each EEPROM write command?
Next question.
The software delay worked fine. However, this exercise
does serve as a reminder that, unless you’re in a real
hurry, it’s always a good idea to verify write success in
software (i.e., read back and compare) just in case.
CLOCK JOCK
Given that many modern MCUs include the functional-
ity, I was a bit surprised there’s still seemingly a decent
market for stand-alone real-time clock chips. It must be
the case though, since RTC suppliers include the very
same outfits (e.g., Microchip Technology, STMicroelec-
tronics, and NXP) making the advanced MCUs.
Beyond the headline clock functionality, at well under a
buck ($0.68 to $0.81 in 1,000-piece quantities depending
Tom Cantrell has been working on chip, board, and sys-
tems design and marketing for several years. You may
reach him by e-mail at tom.cantrell@circuitcellar.com or
directly at microfuture@att.net
SOURCES
mbed Microcontroller
ARM | www.mbed.org
MCP7941x RTCC
Microchip Technology | www.microchip.com
NEED-TO-KNOW INFO
Knowledge is power. In the computer applications
industry, informed engineers and programmers don’t
just survive, they thrive and excel. For more need-to-
know information about some of the topics covered
in this article, the Circuit Cellar editorial staff rec-
ommends the following content:

Crystal Properties
Circuit Models, Measurement, and Conversion
by Ed Nisley
Circuit Cellar 241, 2010
You must understanding a crystal’s properties to get
oscillators working. Here you learn about a crystal’s
circuit model, how to measure a crystal’s properties,
and how to convert the values into parameters for the
model. Topics: Crystals, Capacitance, Inductance

’Net-Enabled Alarm Clock
by DJ Delorie
Circuit Cellar 216, 2008
DJ’s Internet-connected alarm clock provides three
primary features: automatic time setting on power-up,
streaming MP3 music, and remote management. The
PIC-based clock is connected to an ENC28J60 Ethernet
chip. Topics: Timekeeping, Real-Time Clock, Remote
Protocols

Go to Circuit Cellar’s webshop to find these articles
and more: www.cc-webshop.com
2011-3-003-Cantrell_Layout 1 2/10/2011 10:16 AM Page 72
27_Layout 1 1/7/2011 11:10 AM Page 1
74
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
1
2 3
4
5
6
7
9
11 12 13
14 15
16 17 18
19
10
8
The answers will be available in the next issue and at
www.circuitcellar.com/crossword.
Down
1. Tcl, Lisp, Fortran
3. Minimum power delivered
5. CR2032 is a standard
7. Empty set size
8. Schmitt
9. 0.001″
12. Element in a “ground island”
13. 1,024 Petabytes
14. Speaker for high-frequency sounds
17. X
Across
2. 1,000 Watt-hours [two words]
4. Where electricity enters/exits a device
6. Balanced/unbalanced
10. OOK is on/off what?
11. SiO [two words]
15. 0 to 9, Counter
16. Measurement, Calibration, used with main scale
18. Quick fix
19. Rust [two words]
crossword2_Layout 1 2/11/2011 10:52 AM Page 78
www.circuitcellar.com

CIRCUIT CELLAR
®
75
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
THE DIRECTORY OF
PRODUCTS AND SERVICES
AD FORMAT: Advertisers must furnish digital files that meet our specifications (www.circuitcellar.com/advertise). ALL TEXT AND OTHER ELEMENTS MUST
FIT WITHIN A 2" x 3" FORMAT. E-mail adcopy@circuitcellar.com with your file or send it to IDEA BOX, Circuit Cellar, PO Box 180, Vernon, CT 06066.
For current rates, deadlines, and more information contact Peter Wostrel at 800.454.3741, 978.281.7708 or peter@smmarketing.us.
The Vendor Directory at www.circuitcellar.com/vendor/
is your guide to a variety of engineering products and services.
I
DEA
B
OX
http://www.mosaic-industries.com
Mosaic Industries, Inc. (510) 790-1255
Mosaic Industries Inc.
tel: 510-790-1255 fax: 510-790-0925
www.mosaic-industries.com
Add Speed and Color
to Your Instrument
L 1/4 VGA Color STN Display
L 16-bit HCS12 processor clocked at 40 MHz
L Touchscreen-operated GUI
L Dual RS232/485 ports, SPI and I
2
C ports
L 16 10-bit A/D inputs
L 512K on-chip Flash, 512K RAM with Flash backup
L Plug-in I/O expansion, including Ethernet, Wi-Fi, GPS,
24-bit data acquisition, UART, USB, Compact Flash,
relays, and more ...
(IGH0ERFORMANCE)NSTRUMENT#ONTROLLER
PDQ Screen
TM
www.TechnologicalArts.com
Adapt9S12
Modular Prototyping System
For education & development
Evaluate * Educate * Embed
Toll-free (USA & Canada):
1-877-963-8996
Topologies Supported:
Planar, Stack, Backplane, Tower
MCU Families Supported:
S12A, C, D, E, NE, XD, XE, XS
ib-248_Layout 1 2/11/2011 11:09 AM Page 75
76
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8

16M B FLA SH /32M B R A M

200 M hz A rm 9 C PU

16 D igitaII/O

W atchdog

10/100 Ethernet

B attery backed C Iock /C aIendar

A udio
In/O ut
2 U SB
2 SeriaIPorts
ib-248_Layout 1 2/10/2011 10:48 AM Page 76
www.circuitcellar.com

CIRCUIT CELLAR
®
77
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
‡ Industrial packaging
‡ Weather resistant
‡ Standard ô´ILWWLQJ
‡ $99.95USD qty. 1
www.maxbotix.com
‡ High acoustic power
‡ Real-time calibration
‡ Tiny size
‡ $39.95USD qty. 1
‡ Power-up calibration
‡ Smallest MaxSonar
‡ Low power, 2.5V-5.5V
‡ $29.95USD qty. 1
XL-MaxSonar-EZ
LV-MaxSonar-EZ
MaxSonar-WR (IP67)
MaxSonar-WRC (IP67)
‡ Compact packaging
‡ Weather resistant
‡ Quality narrow beam
‡ $99.95USD qty. 1
MaxSonar
Perfect for OEMs & Engineers
www.robotpower.com
Phone: 253-843-2504 s sales@robotpower.com
Extreme Motor
Speed Control!
>> Also H-bridges, gearmotors, plans, schematics <<
6
6 Single H-bridge or dual half
6 Current and Temp protected
6 Control brushed, brushless,
steppers, lights, solenoids etc.
6V-28V - 13A / 30A+ Peak
MegaMoto™
Motor Control for Arduino™
MADE IN
THE USA
ib-248_Layout 1 2/11/2011 2:25 PM Page 77
78
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
1 2
3
4 5
6
7 8
9 1 0
11 12 13 14
15 16
17
18
19
T R
X
B
A
P
A
N
R
L
O
S
S
G
R
O
U
N
D
U
M
P
R
N
I
A
N
A
C
A
T
O
P
O
L
O
G
I
E
S
D
T
A
V
O
L
A
T
I
L
E
T
M
R
F
I
L
A
M
E
N
T
E
I
W
O
T
C
O
N
D
U
I
T
N
R
E
F
E
V
A
L
U
A
T
I
O
N
K
I
T
N
T
S
I
M
F
Q
I
A
T
T
I
T
U
D
E
T
P
C
A
P
A
C
R
E
S
E
T
T
N
I
Z
S
H
I
E
L
D
O N
Created with EclipseCrossword - www.eclipsecrossword.com
Across
5. TRANSMIT—Tx
6. RADOME—Radar dome; can have
shapes such as planar or spherical
8. APPEND—Add to end
9. BALUN—What you get when you
combine balance and unbalance
11. TRANSMITTERIDENTIFICATION—
TX ID [two words]
15. WIFI—IEEE 802.11
16. QUARTZ—Timing XTAL
19. PROPAGATION—Wave transmission
Down
1. NACA—Before NASA
2. EVALUATIONKIT—EVKIT [two words]
3. SHIELD—A cover that protects users
from high voltages
4. VOLATILE—Memory requiring power
7. CONDUIT—Piping for wires
8. ATTITUDE—Orientation with respect
to motion
10. LOSS—Drop in dB
12. RX—Receive
13. TOPOLOGIES—Bus, Star, Ring, P2P
14. ACRES—1 square mile = 640 ____
17. GROUND—Earth wire
18. FILAMENT—Tungsten wire through
which electricity passes
CROSSWORD ANSWERS from Issue 247
TCPmaker for control over the Web

Easy as 1-2-3:
1. Dene Your Data, with variable names that
YOU create.
2. Lay Out Your Content (with gorgeous
web-ready screen controls that you can grab
on to) using TCPmaker’s drag & drop Visual
Page Designer.
3. Generate Your Code, for all Microchip C
compilers, to “wire it all together.”
NO PC PROGRAMMING AT ALL – just point your
web browser at your device!
www.tracesystemsinc.com
888-474-1041
From the makers of HIDmaker FS:
Simple Upgrade Management System
Low cost integrated system manages upgrades
across dierent processors & connectivity types:
> Lets your end users upgrade your PIC
rmware safely, simply, and securely.
> Automatically delivers upgrade by email.
> Simple for non-technical end users.
> Encrypted system protects your rmware
from theft or from being programmed into the
wrong device.
> Grows with your product line: for a new
product w/ dierent processor or connectivity
type, just add another SUMS bootloader.
UART-WiFi, UHF EPC Gen2 RFID
Reader, Powerline Communication
Lonu Runue LHI RIIÐ reuder (6
meters, 1± meters, und ±= meters)
(ISO1Sooo-6C IPC G±)
TTL LART to WiIi
www.linksprite.com
LART to Power line
Communicution
Modules
Bluetooth modules
Cellulur modules
Sinule Bourd Computer
with Win CI 6.o, Linu×,
und Android. Optionul
on-bourd Cellulur, WiIi,
GPS
JPIG Seriul
Cumeru
See our full range of products, including
books, accessories, and components at:
www.melabs.com
USB Programmer for
PIC
®
MCUs
(as shown)
$89.95
RoHS
Compliant
Programs PIC MCUs including low-voltage (3.3V) devices.
Includes Software for Windows 98, Me, NT, XP, and Vista.
With Accessories for $119.95:
Includes Programmer, Software, USB Cable, and
Programming Adapter for 8 to 40-pin DIP.
microEngineering Labs, Inc.
www.melabs.com 888-316-1753
PICBASIC PRO

Compiler
PICBASIC PRO

Compiler $249.95
Bridges the gap between ease
of use and professional level
results. The simplicity of the
language allows both hobbyist
and engineer to master it
quickly, but the engineer
appreciates what’s happening
under the hood. This is a true compiler that
produces fast, optimized machine code
that's stable and dependable.
Supports:
More than 300 PIC
®
Microcontrollers
Direct Access to Internal Registers
In-Line Assembly Language
Interrupts in PICBASIC and Assembly
Built-In USB, I2C, RS-232 and More
Source Level Debugging in MPLAB
ib-248_Layout 1 2/11/2011 11:13 AM Page 78
76 AAG Electronica, LLC
75 All Electronics Corp.
13 AP Circuits
17 ARM
77 Bitwise Systems
77 BusBoard Prototype Systems Ltd.
53 CC Gold
19 Comfile Technology, Inc.
76 Custom Computer Services, Inc.
33 CWAV
75 Decade Engineering
70 DesignNotes
26, 27 Elektor
59 Elektor
Page
15 EMAC, Inc.
43 ESC Silicon Valley
55 Embedded Developer
59 ExpressPCB
13 ezPCB/V-Module
75 FlexiPanel Ltd.
35 Front Panel Express LLC
15 Futurlec
32 Grid Connect, Inc.
71 Humandata Ltd.
36, 37 IC Bank
1 Imagineering, Inc.
78 Ironwood Electronics
C3 Jameco
70 Jeffrey Kerr, LLC
9, 32 JK microsystems, Inc.
75, 76 JK microsystems, Inc.
70 Lakeview Reasearch
77 Lawicel AB
9 Lemos International Co., Inc.
78 LinkSprite
77 Maxbotix, Inc.
77 MCC, Micro Computer Control
78 microEngineering Labs, Inc.
75 Mosaic Industries, Inc.
5 Mouser Electronics, Inc.
C2 NetBurner
7 NXP Semiconductors
Page Page Page
C4 Parallax, Inc.
69 Pico Technology Ltd.
63 Pololu Corp.
77 Robot Power
65 Saelig Co. Inc.
77 Tag-Connect
2, 3 Technologic Systems
75 Technological Arts
77 Tern, Inc.
78 Trace Systems, Inc.
76 Triangle Research Int’l
45 Trinity College Robotics Contest
11 WIZnet Co., Inc.
www.circuitcellar.com

CIRCUIT CELLAR
®
I
NDEX OF
A
DVERTISERS
P
REVIEW
of April Issue 249
Theme: Embedded Programming
May Issue 250
Deadlines
Space Close: Mar. 11
Material Close: Mar. 18
Theme
Measurement & Sensors
Bonus Distribution
ESC Chicago; Sensors Expo;
SID Int'l Symposium
ATTENTION ADVERTISERS
Call Peter Wostrel
now to reserve your space!
800.454.3741 or 978.281.7708
e-mail: peter@smmarketing.us
79
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
Microprogramming a CPU (Part 1): The Architecture, Programmer Model, and SMP
Reprogrammable UAV Autopilot System (Part 1): System Hardware and Software
DSP-Based Color Organ: Use the Convolution Technique to Create High-Performance Filters
Testing Platform: Construct a Custom Scope and Analyzer
THE CONSUMMATE ENGINEER Reliable Programming: Work Toward Fault-Free Software
THE DARKER SIDE Noise Figures 101
ABOVE THE GROUND PLANE Thermal Performance
FROM THE BENCH Boot Up: Bootloading Essentials
79-advertiser's index_Layout 1 2/11/2011 11:25 AM Page 79
80
CIRCUIT CELLAR
®

www.circuitcellar.com
M
a
r
c
h

2
0
1
1



I
s
s
u
e

2
4
8
P
RIORITY
Not that it is relevant for any other reason than to let you in on how the conversation started, but the primary local
pastime down here at the cottage is “happy hour.” There are a bunch of home town bars and eateries along the beach
where all the “regulars” meet and greet each other as well as mingle with the “touristas.” The conversation this partic-
ular afternoon was more serious than usual.
Sitting next to me was a 50-ish gentleman who, while quite personable, seemed troubled. Invariably, the conversa-
tion ended up discussing the economy and he confided (as much as you can at a bar anyway) that he had been laid
off from his engineering job downstate and was searching for prospects elsewhere. I hesitated to tell him that upstate
here at the cottage, most people still think “engineer” has something to do with trains, but then again, he wasn’t in the
bar looking for a job. I wanted him to say that it was indeed an economic issue and the layoff was temporary.
Unfortunately, that was not the case. Apparently the changing needs of the company required a new skill set, and
he was no longer part of the solution. The processors and development packages he felt comfortable using were
becoming obsolete, as well as the design techniques he employed. He was an engineer of a different age who had
become too complacent. He wasn’t keeping up and he was replaced by a younger engineer with an up-to-date skill
set.
I might be the last person you want to listen to for career advice, especially when all of my advice is usually about
starting your own business so you lessen the occasions and consequences of bureaucratic nonsense controlling your
destiny. But, bitter and warped opinion aside, I do understand that most engineers have to deal with the establishment,
and surviving it takes both wit and wisdom. Here’s my take on it.
Engineering jobs in the private sector do not offer career-long job security and you can’t expect to just drift into
retirement collecting a salary. Unless your engineering performance contributes value to the business, you will be
replaced. Be it design or management, the secret to longevity is about understanding what skill set is required at the
different stages in your career.
Virtually all of us start as design engineers, and many choose to stay there for their whole careers. I applaud those
with the stamina to do it forever because maintaining an up-to-date skill set as a designer is not inconsequential. First,
use the Internet because it is the greatest knowledge repository there is. Download and try new software and tools.
Keep familiar with the latest processors and development techniques. Second, you need to network, network, network.
Engage other engineers and share ideas. Go to trade shows, conferences, or take a class and learn from others.
Third, don’t get trapped by narrow job descriptions. Seek other assignments and out-of-the box responsibilities, espe-
cially ones with high visibility and exposure. Finally, publish, publish, publish. Take the time to write an article about
something you know. Believe me, knowing that thousands of smart people may read something you write keeps you
on your toes.
The other big career fork for engineers is whether to move into project management. Of course, unless you do all
the above to maintain your design skills, you better be good at it, because you aren’t going back (not easily anyway).
The secret to success here is your engineering training along with expertly applied BS (seriously).Corporate project
teams consist of a bunch of people with a variety of talents. You’ll have to deal with bean counters, lawyers, manufac-
turing guys, and design engineers. You can learn what they know, but they can’t easily learn what you know. You will
have the ability to speak to the engineers as peers and gain their respect. With a little knowledge and a bit of infor-
mation you’ll earn the confidence of the entire team. It’s a lot easier for you to learn the basics of finance, contracts,
and manufacturing techniques than it is for these people to become EEs. Your management role benefits from the
comprehension and ingenuity you have being an engineer but leaves the nitty gritty of implementing it to the team.
I guess if there is a lesson here it is don’t become complacent. Don’t wait until a technical deficit appears before
expanding your skill set (albeit learning a new compiler or becoming a junior bean counter for the next finance meet-
ing). The demands of being an electrical engineer are evolutionary. Your skill set needs to follow that evolution or you
could be sitting at the bar telling a stranger that you are looking for a job, too.
Forks in the Road
steve.ciarcia@circuitcellar.com
by Steve Ciarcia, Founder and Editorial Director
INTERRUPT
steve_edit_248_Layout 1 2/10/2011 10:56 AM Page 96
A fictional engineer we'll call John Archer spent a decade designing hardware
and writing code for microprocessor-controlled games manufactured by a toy
company. Citing a market for "back to basics" toys, the company president said
he wanted to introduce a new line of simple games that would flash a red LED
when a target was struck by a rubber band, rubber ball, or other reasonably-
safe projectile. The catch: The game should not use a battery or external
source of power. How did Archer solve this very different assignment?
Go to www.Jameco.com/teaser9 to see if you are correct.
The puzzle was created by Forrest M. Mims III
1-800-831-4242 | www.Jameco.com
Sign up for our e-newsletter
and get a FREE comic book.
www.Jameco.com/adventure1
What is
the missing
component?
F
R
E
E
!
F
R
E
E
!
C3_Layout 1 2/9/2011 10:51 PM Page 1
C4_Layout 1 2/8/2011 3:21 PM Page 1

Low-cost Industrial

Serial to Ethernet Solutions

SBL2e Chip

SBL2e 200

SBL2e 100

Hardware Features

SBL2e
Serial-to-Ethernet server with RS-232 support
Software Features

Low Prices

Need a custom solution?

SBL2e XA
Information and Sales Web Telephone

Embedded Systems
High-End Performance with Embedded Ruggedness
Unbrickable design

TS-7800

500 MHz ARM9
Low power - 4W@5V 128MB DDR RAM 512MB high-speed (17MB/sec) onboard Flash

$ $

229
qty 100

269
qty 1

12K LUT customizable FPGA
shown w/ optional SD Cards

Internal PCI Bus, PC/104 connector 2 host USB 2.0 480 Mbps Gigabit ethernet 2 SD sockets 110 GPIO 2 SATA ports

3x faster and backward compatible with TS-72xx

10 serial ports 5 ADC (10-bit)

Sleep mode uses 200 microamps Boots Linux 2.6 in 0.7 seconds Linux 2.6 and Debian by default

TS-TPC-7390 7” Color Touch Panel Computer
Low Power, Industrial Quality Design Mountable aluminum frame 200 MHz ARM9 64MB SDRAM (128MB opt) 512MB Flash w/ Debian Linux 800 x 480 video core Dedicated framebuffer- 8MB RAM Audio codec with speaker Boots Linux 2.6 in less than 2 seconds Unbrickable, boots from SD or NAND Runs X Windows GUI applications Runs Eclipse IDE out-of-the-box More Touch Panel Computers on our website

$

449
qty 1

Over 25 years in business Open Source Vision Never discontinued a product
Engineers on Tech Support

Custom configurations and designs w/ excellent pricing and turn-around time
Most products stocked and available for next day shipping

Design your solution with one of our engineers (480) 837-5200

fanless Power via 5-12 VDC. protocol converter. Current projects include: TS-4200: Atmel ARM9 with super low power TS-4300: Cavium ARM11 with dual 600 MHz and FPU Dual 100-pin connectors Secure connection w/ mounting holes Common pin-out interface Low profile w/ 6mm spacing TS-4500: Cavium ARM9 at very low cost TS-4700: Marvell PXA168 with video and 1. qty 100 92 TS-SOCKET Macrocontrollers Jump Start Your Embedded System Design TS-SOCKET Macrocontrollers are CPU core modules that securely connect to a baseboard using the TS-SOCKET connector standard. RS-485. Ethernet. PoE option Boots Linux 2.11g WiFi Applications Low power (3. 75 mm / 2.165 in.6. WiFi audio.2 watts). RTC Header with SPI and 11 DIO 480Mbit/s USB. PoE (opt.24 in < 3 seconds Un-brickable. and unattended remote applications series starts at $ 55 mm / 2.2 GHz CPU TS-4800: Freescale iMX515 with video and 800 MHz CPU Several COTS baseboards for evaluation & development Technologic Systems We use our stuff.5K LUT Optional DIN mountable enclosure $ 185 qty 1 Ideal for gateway or firewall. boots from SD or flash Customizable FPGA . web server.953 in.com .) 64MB DDR-RAM 256MB ultra-reliable XNAND drive Micro-SD Card slot RS-232. CAN. Start your embedded system around a TS-SOCKET Macrocontroller to reduce your overall project risk and accelerate time to market.embeddedARM.New Products TS-WIFIBOX-2 A Complete Solution for 802. Visit our TS-7800 powered website at www. USB. COTS baseboards are available or design a baseboard for a custom solution with drastically reduced design time and complexity.

7708 • www. or information published by Circuit Cellar®. Next. NH 03755-5650 Address Changes/Problems: E-mail: subscribe@circuitcellar. We’re highlighting a topic a bit more specific: control electronics. Reproduction of this publication in whole or in part without written consent from Circuit Cellar Inc. Follow his lead to build a lighting control system of your own.454. A master at instrumentation engineering (just refer to his previous Circuit Cellar articles).cc-access. Inc.circuitcellar. many of which are now commonly used in residential and industrial environments. The possibilities for such applications are endless. J.smmarketing. Inc. we’re dedicating much of this issue to the ever-evolving field of control electronics. 4 CIRCUIT CELLAR® • www.2199. Turn to page 20 to learn how Richard Lord built a panning control system. consider Brian Senese’s remotely operated vehicle (ROV) project. build. E-mail: subscribe@circuitcellar. or check drawn on U.875.3741 • 978. we’ve published articles about projects pertaining to such robotic electronics applications.O. multidisciplinary practitioner who can confidently bring innovative.269. Vernon. Vernon. All rights reserved.3741 • 978. All subscription orders payable in U. CT 06066. descriptions.0411. Vernon.S. CT and additional offices.luster@circuitcellar. 1187 Washington St. go to www.O. E-mail: editor@circuitcellar. Brian Millier uses control electronics in a more industrial environment: his workspace. Entire contents copyright © 2011 by Circuit Cellar. ADVERTISING 800. However. if after reading this issue you still have a hankering for a classic robotics project like the vision-guided balancing robot Hanno Sander described in Circuit Cellar 224 (March 2009).2199. In fact. But that isn’t Brian’s focus. The information provided by Circuit Cellar® is for educational purposes. and entertainment applications. Hanover. Incorporated. all other countries $63. Abate ASSOCIATE EDITOR Nan Price WEST COAST EDITOR Tom Cantrell CONTRIBUTING EDITORS Jeff Bachiochi Robert Lacoste George Martin Ed Nisley NEW PRODUCTS EDITOR John Gorsky PROJECT EDITORS Ken Davidson David Tweed PUBLISHER Hugo Van haecke ASSOCIATE PUBLISHER Shannon Barraclough CUSTOMER SERVICE Debbie Lavoie Kim Hopkins CONTROLLER Jeff Yanco ART DIRECTOR KC Prescott MARKETING ASSISTANT Daniel Netkin-Colllins GRAPHIC DESIGNERS Grace Chen Carey Penney STAFF ENGINEER John Gorsky March 2011 – Issue 248 obotics is a term that conjures up a variety of images. Direct subscription orders and subscription-related questions to Circuit Cellar Subscriptions. Since 1988. NH 03755-5650 or call 800.7708 peter@smmarketing. and then program an efficient system that provides end users with complete control over a mobile vehicle.cc-access. and plastics. He describes how to embed a DSP device and a series of constant-current generators to drive a group of high-power LEDs. Circuit Cellar. problems. E-mail: newproducts@circuitcellar. CT 06066.com Circuit Cellar’s mission is to collect.6301. Box 5650.269. Furthermore. Hanover.O. MA 01930 USA 800. aerospace. CIRCUIT CELLAR®. is prohibited.com GENERAL INFORMATION 860. MCU-related technologies on a regular basis.281.” he presents his computer-controlled CNC router system.rakoczyphoto. academics. E-mail: info@circuitcellar.com Subscribe: 800. 4 Park St. which is particularly important in automotive. funds only via Visa. P. MCU-based machine control is one of the most fascinating fields of electronics engineering.com AUTHORS Authors’ e-mail addresses (when available) are included at the end of each article. and electronics specialists who work with embedded. The motorized design enables a photographer to rotate a camera to take uniformly overlapping images without distortion. Our aim is to help each reader become a well-rounded.com New Products: New Products.281. Circuit Cellar Subscriptions. from humanoid prototypes to Hollywood animatronic designs to floor-vacuuming consumer appliances.com and search away! cj@circuitcellar.us • www. or that readers have a right to construct or operate any of the devices described herein under the relevant patent or other intellectual property law of the reader’s jurisdiction. Circuit Cellar.7706 ADVERTISING COORDINATOR Valerie Luster E-mail: val. Postmaster: Send address changes to Circuit Cellar.com . Periodical rates paid at Vernon.com.875. Box 5650. In an article titled “CNC Router Design.com PRINTED IN THE UNITED STATES CONTACTS SUBSCRIPTIONS Information: www. Box 5650.281.. and disseminate need-to-know information around the world in the fields of embedded hardware. And.com AUTHORIZED REPRINTS INFORMATION 860. 4 Park Street.com Cover photography by Chris Rakoczy—Rakoczy Photography www. E-mail: reprints@circuitcellar.. Thus. Again. NH 03755-5650. and consumer electronics industries (to name only a few). because of possible variation in the quality and condition of materials and workmanship of reader-assembled projects. all other countries $116.871. each year. Circulation Dept.com Editorial Office: Editor. and computer applications. select. which he describes on page 28. THE MAGAZINE FOR COMPUTER APPLICATIONS (ISSN 1528-0608) is published monthly by Circuit Cellar Incorporated. international postal money order. Circuit Cellar® disclaims any responsibility for the safe and proper function of reader-assembled projects based upon or from plans. Circuit Cellar uses an assortment of print and electronic content-delivery platforms to reach a diverse international readership of professionals.circuitcellar.us Fax: 978.com. many of our readers both directly and indirectly contributed to the development of those systems. Circuit Cellar is a registered trademark of Circuit Cellar. www. You know how a basic RC vehicle system works. CT 06066. Circuit Cellar® makes no warranties and assumes no responsibility or liability of any kind for errors in these programs or schematics or for the consequences of any such errors. woods. it’s growing in importance as engineers find new ways to incorporate MCU-based sensor systems and motorized designs in the industrial automation. But this issue doesn’t feature typical robotics applications. embedded software. We’re confident these projects will inspire you to develop your own electronics control systems.454.6301. aerospace. Canada/Mexico $60. The reader assumes any risk of infringement liability for constructing or operating such devices. The idea is to plan.T R ASK MANAGER Control Electronics THE WORLD’S SOURCE FOR EMBEDDED ELECTRONICS ENGINEERING INFORMATION FOUNDER/EDITORIAL DIRECTOR Steve Ciarcia EDITOR-IN-CHIEF C. Marco Signorini addresses the important topic of light control. what’s important is the concept of electronics control. Brian understands that precision cutting and drilling are the keys to working successfully with metals. MasterCard... On page 38. Canada/Mexico $110. defense. Fax: 860. cutting-edge engineering ideas to bear on any number of relevant tasks. P. Gloucester.ccwebshop. P. 4 Park St. bank. One-year (12 issues) subscription rate USA and possessions $45. Hanover. Circuit Cellar® makes no claims or warrants that readers have a right to build things based upon these ideas under patent or other relevant intellectual property law in their jurisdiction. and technologies. Two-year (24 issues) subscription rate USA and possessions $80.com/advertise ADVERTISING REPRESENTATIVE Peter Wostrel Strategic Media Marketing.S.

Get what’s next at Mouser. You’ll find the newest products for your newest designs. Inc. mouser.com Mouser and Mouser Electronics are registered trademarks of Mouser Electronics. The Newest Products for Your Newest Designs is a registered trademark of Mouser Electronics. The future. Inc .com We’ve got what design engineers need. Scan Here m mouser.Semiconductors and electronic components for design engineers.

Abate NEW PRODUCT NEWS TEST YOUR EQ CROSSWORD INDEX OF ADVERTISERS April Preview PRIORITY INTERRUPT Forks in the Road Steve Ciarcia CIRCUIT CELLAR® • 4 8 15 74 79 80 60 March 2011 – Issue 248 66 6 www. 38 p. 28 16 56 THE CONSUMMATE ENGINEER The Super-Regenerative Receiver George Novacek LESSONS FROM THE TRENCHES The Project-Ready Designer A Refresher on Project-Essential Concepts George Martin FROM THE BENCH Direct Line Connection When You Don’t Require Line Isolation Jeff Bachiochi SILICON UPDATE Time Traveler Embedded Timekeeping and More Tom Cantrell TASK MANAGER Control Electronics C.circuitcellar. J. 20 Embedded DSP p.INSIDE ISSUE March 2011 • 248 Robotics 20 28 38 46 Panning Control A Digital Indexing Panoramic Tripod Head Richard Lord Remotely Operated Vehicle Design Brian Senese Embedded DSP for Lighting Marco Signorini CNC Router Design A Look at Computer-Controlled Machinery Brian Millier ROV Design and Construction Panning Control System p.com .

shrink your design.com/cortex-m0 . www. reduce cost.Cortex-M0 a simple choice We’re changing how engineers think about design. and get to market fast. with Cortex-M0™ solutions that let you save power.nxp. Lowest active power — as low as 130µA/MHz Superior Code Density — 50% less code for most tasks Higher performance — LCP1100 runs at over 45 DMIPS Smallest size — the LPC1102 has a footprint of 5 mm2 Low-cost toolchain — LPCXpresso for less than USD 30 Show us how you switched from your old 8-/16-bit habit to the new 32-bit NXP Cortex-M0 solution and we’ll send you a FREE LPCXpresso development board.

The IC includes user-selectable power-saving modes. and it provides x and y position information via an I²C interface. In addition. and down to a 1. the M-502 comes with a secure datacard (SD) interface. which consists of a mechanical stack incorporating a navigation knob. Ltd. large memory space.artila. March 2011 – Issue 248 Artila Electronics Co. OFN Modules are becoming popular as user input devices in many smart phones as a replacement for trackballs.6. and 32 programmable digital I/Os. busybox utility collection.0 hosts. and movement across the sensor can be read by any MCU using I2C communication.parallax. serial peripheral interface (SPI).1″ pin spacing. reducing 80% of the development time and cost normally required. The HMI device also provides two interrupt modes: motion detect. a high-resolution ADC. The AS5013 is used in the EasyPoint minijoystick module. The XY coordinate registers and magnetic field information for each Hall sensor element are transmitted over the I²C interface to the host processor. The sensor comprises a contactless magnetic encoder IC that monitors the displacement of a magnet incorporated in a knob relative to its center position. easy I2C communication to interface with virtually any microcontroller. an XY coordinate and motion detection engine. The GNU C/C++ cross compiler is included in the development kit. and two operating modes: idle mode. with less than 3 µA current consumption. www. four UARTs with hardware/software flow control.7-V peripheral supply voltage.austriamicrosystems. The AS5013 contactless magnetic encoder IC is available now and costs $2. Application ideas include video game input. Contact Artila for pricing. five integrated Hall sensing elements for detecting up to ±2-mm lateral displacement.29 OS. and 2-MB data flash. Its simple construction and contactless sensing technology give the module very high reliability. Flexible and reliable design leaves users worry free when focusing on their application software development..99. and it’s equipped with 64-MB SDRAM. and it is designed for any kind of 360° navigation input device. and a smart power management controller. Parallax. Inc. and an 8-bit local bus. an on-board red LED that illuminates when finger movement is detected.com PRODUCT NEWS NEW Edited by John Gorsky 8 CIRCUIT CELLAR® • www. Linux-based system on module (SoM). and various hardware device drivers. allowing users to develop their application software on PCs without the need to learn and purchase an extra commercial developing tool. and data ready. with selectable readout rate. a magnet. and an on-board voltage regulator. The M-502 SoM combines powerful computing capabilities. and high scalability.com . two USB 2. The module features a built-in center select button. The M-502 is powered by a 400-MHz ARM926EJ-S ARM Thumb processor with a memory management unit.com OPTICAL FINGER NAVIGATION MODULE The Optical Finger Navigation (OFN) Module can add a unique human interface component to BASIC Stamp or Propeller projects. 128-MB NAND flash.com LINUX-BASED ARM9 READY-TO-GO SYSTEM ON MODULE The M-502 is an ARM9. and low-power mode. Resolution is selectable from 500 to 1. I2S bus. austriamicrosystems www. OFN technology is similar to the technology used in optical mice. which are subject to mechanical wear and tear. or user input for computing devices.92 in 1. The Optical Finger Navigation Module (part number 27903) costs $19. I2C bus. The low-power AS5013 operates over a power supply range of 2.HALL SENSOR FOR 360° NAVIGATION IN HMIs The AS5013 is a complete Hall sensor IC for human-machine interface (HMI) applications requiring low power. lighttpd webserver. The M-502 is also pre-installed with Linux 2.6 V. mouse replacement. and the module offers a breadboard-friendly package with 0.circuitcellar. The module also provides flexibilities in peripheral expansion by integrating one 10/100-Mbps ethernet. and the encoder IC. www.7 to 3.000-piece quantities. making it easy for users to develop their application without compromising system performance.000 cpi.

Advanced algorithms correct for any spectra variations between light sources. which are not perceptible by the human eye. ensuring an extremely accurate lux response.com NPN www. Pricing starts at $1. the device’s low-light sensitivity makes it suitable for applications in which the sensor IC is placed behind black glass. The adaptive gain block provides the industry’s widest dynamic range (more than 4.045 lux to 188. significantly extending battery life. Replicating the optical response of the human eye with electronic components is difficult.20 in 1. These designs are unduly influenced by ultraviolet and infrared light.LOW-POWER DIGITAL AMBIENT-LIGHT SENSOR The MAX9635 is a digital ambient-light sensor (ALS) with a unique adaptive gain block. Traditional light sensors measure the amount of light in an environment regardless of wavelength. The MAX9635 is equipped with an adaptive gain block that automatically selects the optimum gain range. enabling the MAX9635 to measure light levels from 0.000. Maxim’s BiCMOS technology enables the integration of two photodiodes along with an optical filter to reject ultraviolet and infrared light.000 lux. As an added benefit.com • CIRCUIT CELLAR® 9 March 2011 – Issue 248 . which greatly reduces the amount of ambient light. Maxim Integrated Products www.circuitcellar.000 to 1). The MAX9635 consumes 100× less power than the nearest competitive product.000-piece quantities. This allows the MAX9635 to replicate the optical response of the human eye and accurately measure visible light in a variety of environmental settings.maxim-ic.

complete baseband processor.com LOW-COST. Contact Standex for pricing information. Also now available are ADuM620x series dual-channel digital isolators that feature isoPower integrated. safe applications. The ADuM620x series includes the ADuM6200. it may not be possible to add new functionality to existing system modules. The ADuM6000 digital isolator enables designers to reduce the form factor of their system module or to maintain the same form factor even as they add more features and functions. It includes an RF receiver. ADuM6201.navsync. DC. NavSync Ltd. Boasting an operating range of -40° to 125°C. and regulators to generate power that is isolated to the same degree as the data channels. Lead length and termination can be customized for specific customer specifications. The R12575 has a power rating of 3 VA maximum and will switch 0. rectifiers.379″ in length and 0. the R12575 measures just 0. www.circuitcellar.com NPN CIRCUIT CELLAR® • 10 www. they are well suited for use wherever small size and sensitivity are required for non-contact position sensing applications.com MICRO-PROXIMITY SWITCH The R12575 is a micro-proximity switch that’s ideal for use in noncontact position sensing in very small spaces. Inc.analog.2 ms. Offering a 5-kV root-mean square (RMS) isolation rating in a 10 mm × 10 mm package. Built around the proven GR200 ultra-small magnetic reed switch. These new switches are ideal for a variety of applications where size reduction is required without sacrificing performance. Optimal signal acquisition and tracking strategies are enabled by sophisticated adaptive control algorithms. with three standard sensitivity ranges available. isoPower employs switches. The new digital isolator enables designers to free up valuable circuitboard real estate while eliminating the time-consuming step of securing medical or other safety approvals (e. March 2011 – Issue 248 Standex Electronics. With alternate solutions. There is no power draw in the off state. Switching voltage is 50 VDC (maximum). But instead of transmitting data.1 Amp. and industrial control applications where the equipment design leaves little space for the proximity sensor..com . Typical applications include security systems. The baseband processor is controlled by adaptive signal processing. such as optocouplers and separate. In addition to a small footprint and tight sensitivity range. www. the ADuM6000 is a 0.96 in 1. and a power control unit. The ADuM6000 costs $3. The R12575 is well suited for applications where the magnetic field is very low and where space limitations are a major design factor. and ADuM6202 digital isolation products that differ by channel configuration. flash memory. DC (maximum) with a carry current rating of 0.000-piece quantities. yet provides unparalleled sensitivity and performance. and leaving a few off-chip matching and decoupling components. ADI’s isoPower integrated.098″ in diameter. isolated DC-to-DC converter uses the same chip-scale transformer technology.SMALL ISOLATED DC-TO-DC CONVERTER The ADuM6000 is the industry’s smallest isolated DC-to-DC converter. which is an important consideration for battery-driven applications. isolated DC-to-DC converters. the R12575 series is responsive—with a typical operating time of 0. compact single-chip solution for GPS applications. SMALL FORM FACTOR GPS RECEIVER The MS20 is a new GPS receiver with excellent tracking and acquisition capabilities.g. www. The MS20 GPS module is a highly sensitive. and a typical release time of 0. The MS20 costs $21 in 10.5 Amps.000-piece quantities.standexelectronics. Inc. isolated DC-to-DC converter technology and 5-kV RMS isolation rating. and navigation firmware is optimized for execution on a low-power microprocessor.5-W device that integrates Analog Device’s proprietary iCoupler digital isolation technology and isoPower DC-to-DC converter. including optocouplers. IEC-60601-1). all at a fraction of the cost of alternative devices.1 ms. Analog Devices. The RF receiver minimizes systems costs by using single-conversion low-IF digital architecture with highlevel integration.

circuitcellar. C++. As with any other Linux system.ARM9 SBC WITH LINUX NanosG20 is a universal Linux computer that consumes just 200 mW during normal use. and many more. Bluetooth. Apache. and much more. Python. allowing the board to be battery powered. There is no need to install additional software on a development computer. NanosG20 offers the choice of a variety of programming and scripting languages: C. write scripts or programs in your favorite editor. Its diverse interfaces allow you to connect Nanos quickly and efficiently into its environment and offer a wide variety of usage scenarios. NanosG20 comes with its own compiler for easy program development. it consumes even less. Telnet. A developer bundle containing an enclosure and power supply is also available. Ledato GmbH www. The full-fledged Debian Linux ensures a comfortable environment and direct access to common Linux software like Samba. Nanos uses a modern Linux core with support for numerous USB devices like WLAN.de NPN www.ledato. TCL/TK. and then use SSH. Java. or the serial console to compile and test on the Nanos. Perl. and other powerful network applications. but with its energy-saving modes like power-down or standby.com • CIRCUIT CELLAR® 11 March 2011 – Issue 248 . The NanosG20 costs around $135. Simply use Samba or NFS to unlock a directory on the Nanos. USB mass storage. Nanos uses very little electricity as it is.

0 full-speed (host and device). Inc. and up to 2 GB of DDR2 667-MHz RAM are also incorporated into an expanded PC/104 footprint. CAN. The USMC-01 costs $9.0 ports. one RS-232/422/485 port.ti.com NPN CIRCUIT CELLAR® • 12 www. optional conformal coating is offered.com RUGGED PC/104-PLUS SBC The Ampro CoreModule 745 is a PC/104-Plus module that supports a range of Intel Atom processors from the power-efficient N450 running at 1. as well as power line communications protocols and modulation schemes. including cables.com . The CoreModule 745 is available now in production quantities with QuickStart Kits. For harsh environments. In addition to its master and slave modes. two RS-232 serial ports. Key features and benefits of F2806x Piccolo floating-point MCUs include a cuttingedge math engine comprising an 80-MHz floating-point C28x core. With a 4-GB solid-state drive soldered onboard. The controller allows the RPMs of stepper motors to be switch selectable.95 Grms. including VxWorks. The new Piccolo F2806x floating-point MCUs start at $4. and direct memory access (DMA). new Viterbi complex math unit (VCU).66 GHz to the performance-oriented dual-core D510. it runs under another microcontroller (or PC) or it can operate in auto-run (master) mode.imagesco. including ISA and PCI buses. four USB 2. Inc.8° per step. The RPM calculations are made for 1. www. With a thermal design power (TDP) as low as 9 W.NEW LOW-COST FLOATING-POINT MCUs Bridging the gap between low-cost Piccolo and high-performance Delfino floating-point microcontrollers are the new low-cost TMS320F2806x Piccolo floating-point MCUs. www. which allows the user to add a few switches and run the stepper motor manually. and QNX. Gray encoded inputs ensure that only one input needs to be changed at a time to switch between consecutive RPM settings.com NEW STEPPER MOTOR CONTROLLER IC The USMC-01 is a unique stepper motor controller IC. device drivers. the module supports a wealth of legacy I/O interfaces. The new Piccolo MCUs offer an enhanced math engine specifically designed to simplify programming and optimize performance in real-time control applications that may require integrated communications. As a slave. and withstands vibration up to 11. Windows CE. one GbE port. March 2011 – Issue 248 ADLINK Technology.95 in 1. 2-GB DDR2 RAM. Windows XP Embedded. the CoreModule 745 offers excellent graphics performance with an LVDS panel interface and legacy CRT support. In addition. and eight GPIO. Inc. and board support packages for many popular operating systems.95. The USMC-01 generates control signals that can be used with for both unipolar and bipolar stepper motors with appropriate drivers like the L298 and L293 or even discrete transistors. Balancing performance with the integration and ease-of-use inherent to MCUs. Developers of energy-efficient motor control and renewable-energy applications can now use a single F2806x MCU to costeffectively execute control loops. Images Scientific Instruments. 200 steps per revolution motors. The CoreModule 745 operates at temperatures from –40° to 85°C. the CoreModule 745 simplifies cooling requirements and enables conduction-cooled solutions for small-sealed enclosures in space-constrained applications. Linux. The MCUs also feature IQmath library for code compatibility and scaling throughout the C2000 platform. the controller also features eight RPM selections in free-running mode. The USMC-01 offers half/full-wave step modes and direction control.adlinktech. www.000-piece volumes. the new F2806x MCUs also deliver a broader range of connectivity and memory options and are backed by TI’s robust tools and free controlSUITE software. Contact ADLINK Technology for pricing. PCI 32-bit bus. Serial ports. including the low-cost Piccolo series and high-performance Delfino floating-point series. the module is a complete solution with no moving parts.circuitcellar. Texas Instruments. one GbE port. The module also features a full 16-bit ISA bus. Increased communications and throughput are provided via USB 2. and shock up to 50 Grms. The chip can operate as a slave or master. and control law accelerator (CLA) options. Rugged by design.

The DK‐57VTS‐LPC1788 costs $460. µEZ development works on the premise of “design once. Inc. and a secure external I2C EEPROM. all under a common framework. 4 KB of internal EEPROM. Future Designs.teamfdi. 8-MB SDRAM.circuitcellar. a microSD memory card connector. The system’s “brain” is a SOMMDIMM‐LPC1788 SoC module.com • CIRCUIT CELLAR® 13 March 2011 – Issue 248 . drivers. www. The SOMDIMM‐LPC1788 features include an internal real-time clock. the DK‐57TVS‐LPC1788. such as a three‐axis digital accelerometer and temperature sensor. mini JTAG. The kit also includes a J‐Link Lite JTAG debugger from Segger and comes complete with all cables and power supplies. Communication protocols include a USB host and device.com NPN www. and peripherals. is based on the NXP LPC1788 microprocessor. CAN.” µEZ enables companies to focus on innovation and on their own value‐added applications while minimizing development time and maximizing software reuse. reuse many times. RS-232/485. which includes an extensive library of open‐source software.7″ VGA display (640 × 480 resolution) with a four‐wire resistive touch-screen interface. so everything can easily be copied to the PC. All documentation is included on the 2-GB USB flash drive. The kit is based on FDI’s µEZ (pronounced “Muse”) rapid development platform. a SPI and I2C. featuring an NXP LPC1788 120-MHz Cortex‐M3 microcontroller.MODULAR CORTEX-M3 TOUCH SCREEN LCD-BASED DEV KIT The latest addition to Future Designs’s touch screen LCD kit family. The DK‐57VTS‐LPC1788 also features a 5. Ethernet PHY. and processor support.

salt. heavy-duty anodization on the high-density heat sinks. ECO-FRIENDLY ELECTRONIC LABELING SYSTEM The new Green Machine and MaxiLabel Pro Ver. The Green Machine is available in PC or standalone models. A bipolar thermostatic controller with predetermined set points is integrated inside the TEA to maintain its tight form factor. high temperature exposure. Products in this series are available in four models offering 150 or 200 W capacities and 24 or 48 V operation. It offers dependable.com NPN CIRCUIT CELLAR® • 14 www. the Green Machine offers maximum power to create hundreds of ANSI safety. www. The LE-80 series is programmed to cool when the internal temperature of the enclosure exceeds 35°C and heat when the temperature drops below 5°C. Combined with K-Sun’s MaxiLabel Pro Ver 3. Used in the field or on the desktop. Add-on symbols libraries include laboratory/medical. heat-shrink tube and barcode thermal-transfer printer with advanced features. This is due to the selection of world-class components. Inc. including a large. electrical. The LK-81 is programmed to cool when the internal temperature of the enclosure exceeds 25°C and heat when the temperature drops below 10°C. and general symbols. and dust contaminants.lairdtech. March 2011 – Issue 248 Laird Technologies. Contact Laird Technologies for pricing. plus the ability to easily import custom images. 12 Euro/Latin language prompts and a hot key. the Green Machine runs on standard AA batteries or an international AC adapter (both included with the printer). Products in this series are also available in four models that also offer 150 or 200 W capacities and 24 or 48 V operation. and the exclusive PEELGUARD electronic tape trimmer that rounds label corners on demand. The Green Machine and supplies are designed and built with energy conservation and environmental compliance to the greatest extent possible. such as brand fans with the highest degree of environmental protection.com . and double environmental seals for the thermoelectric modules (TEMs). compact performance by cooling or heating enclosures via convection. overheat protection. wind-driven rain. special nickel hydride rechargeable batteries can be used. industrial. such as earthquake resistance. fog. and homeland security. The AA Outdoor Cooler series has been designed to pass rigorous Telcordia test requirements.0 Labeling Software for Windows is a technologically advanced and environmentally friendly label printer system for anyone who needs to design and print professional pressure-sensitive labels in house and on demand.ECONOMICAL.com OUTDOOR THERMOELECTRIC COOLER SERIES The AA Outdoor Cooler Series is a ruggedized Air-Air Thermoelectric Assembly (TEA) that uses impingement flow to transfer heat. creating more permanent and professional-looking labels. The Green Machine is a rugged label. It also has innovative new hot keys for the instant selection of type styles and point sizes.circuitcellar. The unit is available in two popular set point configurations. high-intensity backlit display for use in all lighting conditions. including the distinguished European Union Eco-Design Directive (2009/125/EC).ksun. For longer portable life. K-Sun Corp. 3. Pricing for the Green Machine starts at $339. lifetime-guaranteed waterproof connectors.0 software. www. Supply cartridges are recyclable and made from recycled plastic.

90 Y ONL 0 $8.” The control input is simply a logic-level signal that is either off (GND) or on (VCC).circuitcellar.com www.9 Save On LED and LCD Panel Meters • New Digital LED Volt and Amp Panel Meters • Easy to Read Ultrabright Displays • No Additional Parts Required • Ideal for Control Panels and Solar Systems ONL Y $ Great New Touch Keypad We are your one-stop shop for Microcontroller Boards.9 0 • Complete and Ready-To-Run • Utilizes Capacitive Touch Sensing Technology • Runs on both 3. I2C Connections • Joy-Stick and SD Card Socket ON $11 LY 9. such as a relay or solenoid. LAN.futurlec.CIRCUIT CELLAR Test Your Edited by David Tweed EQ Problem 1—The following circuit is designed to give an extra voltage boost to a load at turn-on.com • CIRCUIT CELLAR® 15 March 2011 – Issue 248 17. CAN. for example. Let’s analyze its operation.3V and 5V power supplies • Outputs both ASCII and Binary Codes for the Key Pressed .com/eq/ You may contact the quizmasters at eq@circuitcellar. should a reverse-biased diode be added across it? Problem 5—What can you do if you need more than 2× voltage boost at turn-on? When does Q2 turn on? Contributed by David Tweed What’s your EQ?—The answers are posted at www. SPI.circuitcellar. to drive a relay or solenoid that requires significantly more voltage and current to “pull in” than it does to simply “hold. It might be used. PCB Manufacture and Electronic Components. Problem 2—When do D1 and D2 conduct? Problem 3—How much of the load current does Q1 need to handle? Problem 4—If the load is an inductive load. www.com Fantastic New LPC1768 Controller LPC1768 Controller • Includes LPC1768 Microcontroller with 512kB Flash Memory • 240 x 320 Color LCD with Touch Screen • USB.

It has frequency stability issues. You can trace it back to the 1920s and a design by Edwin Armstrong. But while the principle is some 90 years old. a sensitive. Armstrong developed a circuit that would automatically keep the feedback just Tuned LC Circuit Baseband amplifier and low-pass filter Bit slicer and Schmitt trigger RF Preamp (optional) -Gm(t) Data March 2011 – Issue 248 l(t) Time variable loop gain ~ Quench oscillator Figure 1—A typical super-regenerative receiver block diagram CIRCUIT CELLAR® • 16 www.circuitcellar. well. and offered by RF module vendors. due to the instability caused by a number of factors. reliable. CIRCUIT ANALYSIS The pedigree of this circuit extends to the early days of radio. workhorse of wireless control that’s second to none in terms of the cost/performance ratio. it was necessary to continually adjust the feedback by hand. Many engineers believe it’s on the way to becoming obsolete. I find it’s still alive.” was used to advantage in the radio receivers of the day. and the engineers were looking for ways to make sensitive receivers with as few tubes as possible. In my last column. oscillations would ensue at some point. But when it comes to remote control applications—especially those being developed on a tight budget—a super-regenerative circuit can be a viable option. I n the world of oratory competitions.T HE CONSUMMATE ENGINEER by George Novacek (Canada) The Super-Regenerative Receiver You won’t find a super-regenerative circuit in many modern radio receivers. But in the engineering world. and audio quality shortcomings. but just before that happened. This principle. Unfortunately. lowcost super-regenerative receiver is hard to beat. vacuum tubes were expensive. Then. or the radio would oscillate and howl or the signal would fade away. a limited data rate. I mentioned it as the old.com . the gain of the amplifier would be approaching infinity. called “regeneration. They knew that when positive feedback was applied across an amplifier. the term super-regenerative is a lightweight compared to a tongue-twister like the 34-letter word supercalifragilisticexpialidocious.

a simple low-pass filter effectively suppresses it. and stabilizes the load of the resonant tank circuit. The preamplifier serves to amplify the received signal and to isolate the super-regenerative circuits from the antenna. which would then be available on the output of the baseband amplifier. due to its nonlinear operation. the amplifier would automatically increase its positive feedback until oscillations were about to begin. It should be noted that the bit slicer www.com • """ CIRCUIT CELLAR® 17 March 2011 – Issue 248 below the onset of oscillations and called the effect “super-regeneration. The achievable RF sensitivity of the super-regenerative receiver is in a range of –30 to –100 dBm (decibels referenced to 1 mW).Figure 2—This is a working circuit with a preamplifier. Paradoxically to its common occurrence. The preamplifier is usually aperiodic and unless it has ! ! $ . In effect. Refer back to Figure 1.” At a repetition rate above the received baseband and below the RF range.” Anyone interested in understanding how this receiver works should study his paper. circuit analyses of this receiver are scarce. provides antenna matching. “Designing Super-Regenerative Receivers. At that point the bias conditions of the amplifier would be changed and the oscillations quenched. analysis of the super-regenerative receiver is Eddie Insam’s 2002 Electronics World article. and more. and Schmitt trigger circuit would be used for data transmission only. if not the best. Since the quench signal repetition rate is well above the baseband range. the receiver would sample the incoming RF signal at the quench rate with its maximum sensitivity usually reaching the noise floor. But the super-regenerative receiver can demodulate AM and FM signals. It prevents back radiation of the superregenerative oscillations to satisfy FCC rules. Schmitt trigger.circuitcellar. One. #% INSIDE A RECEIVER Figure 1 is a block diagram of a typical super-regenerative receiver.

low power.circuitcellar. refer to the article listed in the Resources section by Cedric Mélange. and R14 are the quench oscillator. The difference in the start-up time is detected by the super-regenerative circuit and forms the envelope of the received signal. the injected RF signal from the antenna (or the pre-amp) forces the oscillations to start sooner. Bit slicing performed by C4/R6 and the op-amp eliminate the DC component of the received signal. “LowPower. is often insignificant. limited data rate. For a good example of this. RESOURCES E. The quench oscillator should be running at a rate at least twice the maximum baseband frequency.net) is a professional engineer with a degree in Cybernetics and Closed-Loop Control.. 18 March 2011 – Issue 248 CIRCUIT CELLAR® • www. But for control applications. as I already pointed out. may be used but doesn’t always have to be used. Rumley. I would purchase a monolithic receiver module. oscillatory fashion. and the audio quality of an AM or FM modulated signal is barely acceptable. which. there are now monolithic receivers on the market without many of those shortcomings. he was most recently president of a multinational manufacturer of embedded control systems for aerospace applications. the feedback amplifier) causes the resonant tank to oscillate at its resonant frequency. It should be noted. Vandewege. the injected RF signal from the antenna (or the pre-amp) forces the oscillations to start sooner.com/images/REGEN. however. I George Novacek (gnovacek@nexicom. “Designing Super-Regenerative Receivers. R14 is also the load on which the baseband signal envelope appears. L1. it has very little effect on the overall receiver sensitivity. Its improvement of sensitivity. it is set between 20 and 120 kHz. Or. Q2 forms the super-regenerative receiver.com .” Electronics World.” Figure 2 is the actual working circuit I showed last month. Insam. Adding a positive feedback by R11 turns U1 into a Schmitt trigger with output clean enough to drive logic circuits. while there may no longer be an incentive to “roll your own. April 2002. The following op-amp U1 works as a combined bit slicer and Schmitt trigger. and with low power consumption.” it never hurts to understand how things work. George wrote 26 feature articles for Circuit Cellar between 1999 and 2004. also called super-regenerative detector. Mélange. especially the cost-sensitive ones. R10. and J. and D1 bias the base of Q2 into active an region for Q2 to start oscillating. The time variable loop gain (i. even better. The main advantages of the super-regenerative receiver beside its sensitivity are simplicity. The difference in the start-up time is detected by the super-regenerative circuit and forms the envelope of the received signal. At low prices.e.valontechnology. with the preamplifier and the data shaping bit slicer and a Schmitt trigger added. S. which is high enough to be removed from the baseband with a simple low-pass filter.” Valon Technology. C. C7. its advantages outweigh the drawbacks. The negative conductance –Gm(t) is varied in such a way that the oscillator is driven in and out of oscillations without being allowed to reach a stable oscillatory state. and low cost. The beauty of the receiver is that it can be built with a single transistor. Remember Nyquist? Generally. This design is very useful for experimentation.PDF. I would choose a superhet. such as a Micrel “Quik Radio.a significantly better noise figure than the super-regenerative detector. J. www. which can be especially troublesome when a strange transmitter operates in the same frequency band. Q1 and its associated components form the aperiodic preamplifier. Its low-pass characteristics ensure attenuation of the quench frequency riding on top of the on/off-keyed (OOK) digital data. that all the functional blocks also could be built as separate circuits. CONTROL APP ADVANTAGES Why isn’t the super-regenerative circuit used in every radio receiver around us? Because it has poor selectivity and frequency stability. the super-regenerative circuit operates in an intermittent When an RF signal around the oscillator resonant frequency arrives at the time when the circuit is about to begin to oscillate. “Super-Regenerative Receivers for Remote Keyless Access Applications. but I am not convinced of its practicality. If I were to build a receiver with so many parts (as in the Mélange article). The baseband signal is amplified by Q3. Bauwelinck. these successfully compete with the discrete component designs in all aspects. et al. Now retired. and therefore range. When an RF signal around the oscillator resonant frequency arrives at the time when the circuit is about to begin to oscillate. So. However. 2006. The RF signal resonating in the L1/C3 tank circuit is coupled to collector Q2. Super-Regenerative Receiver Targets 433-MHz ISM Band. D1 improves temperature stability of the circuit. Because of the periodic quenching signal. R2.” EDN. C5 provides the necessary positive feedback for Q2 to oscillate at the resonant frequency of approximately 315 MHz.

.

March 2011 – Issue 248 here has been a great interest in wide-view panoramic photography from the very first recorded images of the 1840s. the angle required Photo 1—The pan head T to provide the correct overlap of each step varies with the focal length of the lens. I faithfully attend a couple of electronic flea markets every year and am always on the lookout for inexpensive electromechanical gadgetry. I’m someone who loves to find new ways to use inexpensive microcontrollers to solve problems. and the number of steps needed to reach the final position.F EATURE ARTICLE by Richard Lord (USA) Panning Control A Digital Indexing Panoramic Tripod Head An electronic panning controller enables a photographer to rotate a camera to provide uniformly overlapping images that can be merged successfully without distortion. The simplest of these pan heads merely provide a means to lock the axes of rotation at various angles. Several manufacturers now offer mechanical indexing panoramic adapters of varying degrees of sophistication that allow a camera to be accurately rotated to provide uniformly overlapping images that can be merged successfully without distortion. I had already amassed a useful collection of stepping motors and drivetrains to choose from. More sophisticated versions include indexing plates that make it easier to step between fixed angles. I also design CIRCUIT CELLAR® • 20 www. it was inevitable that as an avid photographer I would be destined to make my own digital indexing pan head (see Photo 1). Here you learn how to build a digital indexing panoramic tripod head from start to finish. Thus. With the invention of flexible film in the 1880s. The pan head actually moves to these positions as the parameters are entered. My goal was to make the design extremely simple to use with no angle calculations—just a simple user interface where I set the start position. However. the step size (determined by moving the pan head while looking through the viewfinder). significant geometric distortions result from attempts to merge handheld images. so I saw this as a natural and obvious application of technology. While many modern digital cameras and software packages offer tools to make stitching somewhat easier. when I was ready to start this project.com . so mechanical indexing can be very awkward to use. often requiring calculation and careful setting of each angle to get a good result.circuitcellar. As a result. several manufacturers began offering specialized panoramic cameras that wrapped the film around a curved surface and pivoted the lens during the exposure. The advent of digital photography and image-processing software has ushered in another way to create panoramic images—by stitching multiple overlapping photos together into a single larger image. so setting up a pan sequence is very intuitive.

but for the rest of us. This means for a highshown in Photo 2. However. the resolution of the camera machine setup. but spindle shaft was pointing straight clearly the image quality will suffer up. By orienting it so the fine in a 4” × 5” snapshot. Since I was already developing a controller for the pan axis. . but with a resolution of 100 megapixels instead of the 10 megapixels of the single exposure. the unaided One of the stepping motor mechanisms in my collection human eye can distinguish about of flea-market bargains was a roll100 lines per inch of detail in any paper spindle drive mechanism. head in Photo 1. the image that is formed in this way might cover the same field of view as a single lower-resolution photograph. An image captured with a designed to clamp onto the back of 1-megapixel camera might look the plotter. To create really sharp 32″ × 40″ and larger photographic prints. If simple panoramas had been my only interest. digital image. I merely had to remove the times the area of the 4” × 5” print.8° the individual pixels that make up stepping motor. this kind of investment is out of the question. I am fortunate would like to produce poster-sized images.Photo 2—The pan drive motor added a smooth video panning mode where I set start and end positions and the duration of the pan.000 pixels per square troller electronics. I had the essential mechanism when blown up to 16” × 20”.circuitcellar. Viewing an image from several feet away. a the plotter and replace it with a high-quality printed image takes plastic box containing the conat least 40. that had once quality photographic print of a been part of large-format plotter. It may take several minutes to capture all the overlapping images. the two-axis digital tripod head provides the opportunity to produce exquisitely detailed large prints with an affordable camera.375” spindle per inch (dpi) of resolution to shaft and a 5:1 gear reduction to avoid having visible evidence of drive this shaft from a six-lead 1. so the baseball has long ago reached the catcher’s mitt and the race car has already completed another lap by the time the digital pan head has gotten halfway through its dance. you can form very high-resolution images from a two-dimensional array of overlapping lower-resolution photographs. and more resolution is mounted in an enclosure that was better. this doesn’t work well for action photographs. using the same image stitching technique that works for forming panoramic photographs from overlapping horizontal images.com • CIRCUIT CELLAR® 21 March 2011 – Issue 248 While rotation about a single pan axis covers many situations. ANOTHER DIMENSION www. there are obviously times when you might find yourself inside a large interior space where you might want to change the elevation axis and create a view that is several overlapping images high as well as wide. As you can see from the picture of the full two-axis pan However. This works out to a figure out how to mount my cammaximum of 25 square inches per era on top of the convenient megapixel. Then I had to inch of area. in fact. original clamping mechanism for Based on the 200-dpi minimum.000 of spare change. so this project has been an opportunity to image must also increase or else the individual image pichone some mechanical skills. I probaSYSTEM OVERVIEW bly would have settled for a simple mechanical pan head. you need 50 to 100 megapixels per image. This was all the image. anism was built with hand tools and existing materials. I find that sometimes I struction for the elevation drive mechanism. However. By using a telephoto setting and smaller angles for the horizontal and vertical steps. direction. I had a bigger goal in mind—much bigger.000 to $50. the printed image The drive included a nice bearing must have a minimum of 200 dots assembly for the 0. As the size of enough to have recently acquired a small lathe/milling the printed image increases. Of course. this project includes some mechanical conAs a fairly serious photographer. the basic pan mechture elements (pixels) will start to become visible. If you have $20. and it means a 12turntable that had once been the megapixel camera is not sufficient Photo 3—A look inside the pan head spool for the paper roll when it was to produce a quality 16 × 20 print. for still life subjects and scenic views. where of the pan drive without any extra the same image is spread over 16 effort. it didn’t seem to be too big a stretch of the imagination or the electronics to add an elevation axis drive motor as well. you can buy large-format digital cameras with this kind of resolution. However.

making them ideal for driving these smaller unipolar stepping motors.com . but they come in high-density surface-mount packages that are hard to work with for home-brew projects. In addition to the four outputs for each motor.20″ pitch sprocket. I had to buy a timing belt and a 3. the controller connects to a 2 × 24 character LCD and four CIRCUIT CELLAR® • www. but Digi-Key still sells them for $0. Stock Drive Products. separate from the power for the microcontroller. for a total of $10. CIRCUITRY Stepping motors come in several flavors of winding configurations. The elevation drive plugs into the controller with a five-pin DIN connector so that the digital pan head can be used with other camera mounts if the elevation feature isn’t needed. I came up with a slightly smaller six-lead stepping motor with an attached 4:1 belt-drive reduction driving a 0. I added series resistors between the driver inputs and the microcontroller and also provided the peripheral drivers with their own 78L05 regulator. A friend supplied me with a 3″ bearing and some scrap aluminum.circuitcellar. I just happened to have a whole drawer full of 75451 peripheral drivers in my parts bin. The diodes are mounted in close proximity to the outputs and are bussed together to nearby bypass and bulk capacitors so the energy is closely contained and doesn’t wander around the circuit board where it could introduce either voltage or current spikes into the rest of the circuitry. I added 1N4002 clamping diodes to ground and to the power rail for each output to prevent voltage spikes from feeding back into the circuitry and damaging either the driver or the controller (a lesson learned the hard way in an earlier design that destroyed the microcontroller). reducing heat dissipation. For the elevation drive. The rest of the circuitry for this controller is pretty simple. each capable of sinking 350 mA. so only one of the two drivers is active at a time. there are two 75451 drivers for each motor.83 each. Each 75451 drives the two ends of a single winding. There are many exotic ICs designed specifically for driving stepping motors. These parts 22 March 2011 – Issue 248 have been around for a long time. To be even more secure. which I was able to use to make the rest of the elevation drive. To complete the vertical drive. At its heart is a Microchip Technology PIC16F877A with a 20-MHz resonator connected between the clock pins. Having the unipolar six-lead version for both motors greatly simplified the design of the drive electronics. These motors have two center-tapped coils and can be driven by tying the center tap to the power source and then grounding either end of the winding to provide either polarity of magnetic field.5″ diameter 0. The guts of the pan head and controller can be seen in Photo 3.Figure 1—The PIC16F877-based pan head circuitry part of the plotter.25″ sprocket from an online company. This eight-pin DIP provides dual highvoltage open-collector outputs. As you can see in Figure 1.

Running the program . I added two optically isolated outputs to switch the two-stage shutter input on my camera. When developing the software. I decided that I could provide all the features that I wanted with a 2 × 24 character LCD and four push buttons mounted directly below the display. or it can be run directly. I find it an www. The controller board is shown in Photo 4. the middle buttons are labeled with left and right arrows corresponding to the rotation of the camera toward the left (counterclockwise) or the right (clockwise). I wanted to create an intuitive user interface. For example. The button labels change as the context changes. the parameter is initially changed by a single count. These are relatively cheap and very easy to use.” For “screens” that are used to adjust the value of a parameter. you’re then prompted to define the “Pan Step Size.” advancing the head to its final position by moving the pan head a step size per count. to determine the duration of the interrupt handler. Wherever possible. To enter a new pan axis motion “program” into the digital pan head. For a two-axis program the elevation start. press the “Prog” button and then select “1-Axis. either using the same technique or by using scrap #26 wire from ribbon cable. how much time it takes the camera to write the image to the memory card). Finally. The two middle buttons are used to decrease or increase the value of the parameter. so the pan head can be programmed to step in either direction from any start position. Once you press the “Enter” button. Assembly language is an efficient way to squeeze the most performance out of inexpensive 8-bit microcontrollers with limited stack and code space.) The left and right arrow buttons can then be used to move the pan head to the initial position of the pan sequence. This technique lets me adapt and change wiring fairly easily.” The pan head is positioned while looking through the camera viewfinder until the desired image overlap is achieved. Signed arithmetic is used to make all the calculations. This construction method is relatively inexpensive. you’re prompted to enter the “hold” time that the pan head will wait after pressing the shutter before stepping to the next position (basically.10” centers with padper-hole copper on one side. step size. I always add a small loop of 18-gauge solid wire connected to ground to clip on the ground lead of an oscilloscope for debugging. I use 0805-size surface-mount resistors which fit nicely between tenth-inch pads on the solder side. an input for an external remote switch for single-stepping the pan head. and count are programmed first. For the pan axis. For the elevation axis and for nonmotion parameters. This forms a sort of ground plane as can be seen in Photo 5. the buttons are set up to “auto repeat” so that large changes are easy to program. When adjusting parameter values. Finally. After playing on paper with several alternatives. My method of board construction is to buy the prototyping boards at RadioShack that have holes on 0. I first wire the grounds by bending the leads from the bypass capacitors to run along a row of pads on the solder side and then beef the wire up by soldering it to each pad and flowing the solder along the wire. The function that each button performs is defined using the six characters of the bottom line of the display that are directly above that button. 4—The controller board enjoyable challenge to work directly within the constraints of the hardware.circuitcellar. For those parameters that affect the position of the pan head. Each time you press the button. and an RS-232 port to allow control of the digital pan head from a computer. Next. the head actually moves as the value is changed. followed by the pan parameters. The position “program” can then be saved in one of 10 12-byte EEPROM blocks for later recall. (If you are editing an existing program. the upper line shows the parameter name and value. slowly at first and then more rapidly if the button continues to be pressed. Somewhere on the board. For the digital pan head. but holding the button down causes the change to repeat automatically. I often find it useful to temporarily add code to set or clear an output. The upper line of the display is used to define the current context or “screen.MAKING IT GO I love programming PIC controllers in assembly language. The rightmost button is used to “Enter” that value and advance to the next menu “screen. so it is not a big deal to start all over again if there’s a better arrangement of the parts. the labels change to “up” and “down” arrows.com • CIRCUIT CELLAR® 23 March 2011 – Issue 248 push button switches. I wire the signals by soldering short pieces of #30 wire-wrap wire that are cut to length.” The upper line then displays “Pan Start Pos=+0000” representing straight ahead. I temporarily set the shutter output pin at the beginning and clear it at the end of the interrupt routine. the display will show the current start position and the pan drive will move to that position. I then wire in the power.” The leftmost button enables you to go back to the previous menu screen. you program the “Pan Step Count. Wherever possible. I try to use integrated cirPhoto cuits in DIP packages inserted into high-quality machined pin sockets.

25%. deceleration.9° of rotation of the motor step 04 step 08 -100% OFF 1000 0000 shaft between entries in the look-up step 09 -100% -50% 1000 0010 table. where a single winding is step 03 50% 100% 0001 0100 energized for the intermediate half step 02 step 04 OFF 100% 0001 0000 step between the full-step positions step 05 -50% 100% 0001 1000 (where two windings are powered) prostep 01 step 03 step 06 -100% 100% 1001 0000 ducing eight half steps per motion step 07 -100% 50% 1000 0001 cycle or 0.circuitcellar. it CIRCUIT CELLAR® • is possible to achieve a great many intermediate positions. I decided to use the microcontroller’s interrupt timer to pulse-width modulate the power at 0%. and slew rates of the motor axes are controlled by general system parameters stored in EEPROM that can be programmed from the setup menu that is reached by holding down the leftmost and rightmost buttons Four-step Eight-step Sixteen-step Motor windings Bit mask nibbles during power-up. and then step to the next position. then that motor output is turned on all the time. and full on.45° B-leads A-leads 100% 50% The stepping motors are driven by -b+b-a+a -b+b-a+a table look up. creating 32 steps per stepping cycle. This gave very smooth motion and precise control. duration of the shutter activation.9° 0. a logical OR is performed with the contents of the 50% mask register. wait for the hold time. Initialstep 01 100% 50% 0100 0001 ly. causing the stepping motors to audibly “sing” at the intermediate power positions. where each bit corresponds to an output to a motor winding. wait for a settling time. For two-axis programs. I found that half-stepping prostep 06 step 0C OFF -100% 0010 0000 duced a jerky motion. but with the microcontroller running at its maximum of 20 MHz and the interrupt handler pared to a minimum amount of code. the motor control software includes the ability to accelerate from a slower speed at the start of the motion and to decelerate as the pan head nears the target position. the contents of the 100% mask register are loaded into the accumulator. positions. If the LSB is high. Elevation motor = lower nibble [3:0]. The lower 4 bits correspond to the outputs for the elevation axis. However. When I decided to add a slow step 02 step 05 step 0A -100% -100% 1010 0000 continuous pan feature for shooting step 0B -50% -100% 0010 1000 video. actuate the shutter. then the corresponding www. it is often sufficient to simply provide several intermediate power values for each winding. Since there is significant mass to the pan head. The settling time. Note the following: Motor output = 100% is modulated to achieve intermediate mask “OR” (50% mask “AND” INTERRUPT_CTR[0] ). Pan motor = upper nibble [7:4]. The power output for the motors is controlled in the interrupt handler using two 8-bit “mask” registers.Photo 5—A look under the controller 24 March 2011 – Issue 248 causes the head to turn to the start position. The upper 4 bits correspond to the negative and positive outputs for both windings of the pan axis motor. for less precise requirements. 75%. 1. 50%. the best I could achieve for the PWM rate was about 8 kHz. The contents of the accumulator are then written to the motor output port.8° 0. These bit masks are set by the foreground software from table look up from the stepping table (see Table 1) using the 4 LSBs of the 16-bit motor position register as an index into the table. and acceleration. the pan sequence is repeated for each elevation position. step 0D 50% -100% 0010 0100 More precise control of stepping step 03 step 07 step 0E 100% -100% 0110 0000 motors can be achieved by a technique step 0F 100% -50% 0100 0010 called “microstepping” in which the amount of power sent to each winding Table 1—The stepping motor sequencing chart. If a bit is set in the 100% mask. which put it above my hearing. For my initial experiments.com . At each interrupt. If a bit is not set in the 100% mask but is set in the 50% mask. and I was able to up the 50% PWM rate to around 18 kHz. The interrupt handler increments a counter. I finally decided to eliminate the 25% and 75% steps. indexed by the current step 00 step 00 100% OFF 0100 0000 position counter for each axis. I chose the common half-step step 00 step 01 step 02 100% 100% 0101 0000 method. Using sine look-up tables.

His interests include digital electronics. read the current positions of the two stepping motors. he has designed digital electronics for an aerospace company and several telecommunication test equipment manufacturers. in Electrical Engineering and an M. I also plan to add adjustments to compensate for different lens heights above the camera base and different locations of the tripod socket with respect to the lens. With the 5:1 gear reduction on the pan axis and 24:1 reduction on the elevation axis. ea er pa pr –9999 to 9999 –9999 to 9999 –9999 to 9999 –9999 to 9999 Move to absolute elevation position Relative move of elevation position Set absolute pan position Relative move of pan position Return format [text string] [decimal table] [4-digit signed decimal] [4-digit signed decimal] [2-digit decimal] [hexadecimal table] Table 2—Commands that can be sent to the digital pan head through the RS-232 port winding is powered on alternate interrupts.com CIRCUIT CELLAR® 25 March 2011 – Issue 248 DESIGN EXPLORATION To download the code. . I haven’t yet explored the ability to create complex motion using the positioning commands through the RS232 port. I also included the ability to specify the absolute or relative position of either motor. so that the digital pan head can be used with other cameras. This timing is accomplished by decrementing a counter programmed with the number of interrupts per millisecond. which varies with each lens or zoom setting. I’m just starting to explore all the capabilities of the digital pan head. They return the command prompt once the motion is completed. With this latter capability. Inc. slew rates for the stepping motors. I Richard Lord (rhlord@comcast. in Biomedical Engineering. It has also been a fun project to build. The rotation needs to occur at the plane of the convergence of light rays in the lens. read the current “screen. When the main software needs to create a delay.(9600 Baud.45° motor steps with 16 steps per motion cycle.circuitcellar.circuitcellar. Richard designed several medical pulmonary test instruments and the electronics for an autonomous underwater robot. The interrupt for the motor PWM also provides the timing for the button repeat function.microchip. no parity) Cmd arg Function Response v – Display current software version Returns current software version + prompt dp – Display current program Returns current program values + prompt ge – Get elevation position Returns current Elevation position + prompt gp – Get pan position Returns current Pan position + prompt sh – Activate shutter Returns prompt after completion gs – Get current system state Returns current display page + prompt sw 0–4 Press key 1–4 (sw0 releases key) Returns prompt db – Get all system variables (debug) Returns 192 system variables + prompt kl – Lock (disable) front panel keypad Returns prompt ku – Unlock front panel keypad Returns prompt The following motion commands require that the keypad be locked/disabled. If it is nonzero. jazz. it sets this delay counter with the desired number of milliseconds and then tests its value and loops until the value is zero. I need to modify the camera mount with a slide that will allow the camera to be moved forward or backward and then clamped in the position that will properly place the center of rotation. but it’s already proving to be a very versatile tool for a very modest investment of less than $100.net) holds a B. 8 bit. Once this counter reaches zero it is reloaded and a separate “millisecond delay” counter is tested.S. and river conservation.” and remotely press any of the buttons. I also provided an RS-232 port that can activate the shutter. A similar delay counter decrements in tenths of a second for the longer delays. During his career. thus being energized with 50% of the power. this is sufficient to produce satisfactory results without the accompanying howling of the motors that was caused when I had attempted to use the 32-step table. The control scheme yields 0. PROJECT FILES I designed the digital pan head to work with a specific digital camera (a Canon Digital Rebel) and centered both axes of rotation on the plane of the image sensor.S. a computer can be used to drive the pan head in complex two-axis motion (see Table 2).com • SOURCES PIC16F877 Microcontroller Microchip Technology. | www. this counter is decremented once for each millisecond. Working as a consultant in the 1980s. but this can open up the possibility to do some very creative things such as painting geometric shapes with lights during night photography. and millisecond counts for the various time settings. www. a new pair of bit masks is generated.com/ pub/Circuit_Cellar/2011/248. I have subsequently discovered that this is the wrong location to eliminate parallax errors. As a consequence. photography. go to ftp://ftp. Each time the motor position register is incremented or decremented for either axis.

DMX controllers. For standard models. Finally. tens of metres with the Bluetooth. this DVD also addresses the main shortcoming of power LEDs: heating. white papers and so on. this Toolbox gathers together data sheets from all the manufacturers. What’s more. DCF77. etc. E. xBee. and for a selection of LED modules. we’ve brought together technical documentation (spec. this Wireless Toolbox DVD contains a collection of articles on this topic (RFID.).00 CD Ethernet Toolbox This CD-ROM contains all essential information regarding Ethernet interfaces.2 gigabytes worth of tools and documents DVD Wireless Toolbox On this DVD-ROM you’ll find a number of technical documents and tools that will enable you to add wireless data exchange to your electronics systems. Wi-Fi or ZigBee systems. In accordance with the principle of our Toolbox series.elektor..c Software Tools & Hardware Tips CD/DVD-ROMs Packs 1.E . DVDs AND MORE AT WWW. infrared.BOARDS. It includes a collection of datasheets for dedicated Ethernet interface ICs from many different manufacturers. The choice of equipment depends on the transmission distance: a few centimetres using Near Field Communication (NFC) or Radio Frequency Identification (RFID). ISBN 978-90-5381-245-7 • $46. etc. BOOKS. ap pli cation notes.00 ore are This DVD and m available at om/shop www. All of the documents are PDF files (in English). along with ready-to-use modules (power supply units.) on various devices according to the frequency and/or protocol used. etc. etc. Browsing around the DVD is made easy by an HTML menu. hardware. This DVD contains more than 100 Elektor articles on the subject of LEDs. or indeed thousands of kilometres using a module for receiving GPS data.COM/SHOP Elektor Shop The world of electronics at your fingertips! See the light on Solid State Lighting N W! E DVD LED Toolbox This DVD-ROM contains carefully-sorted comprehensive technical documentation about and around LEDs. design guides. In addition to optical systems. sheets. & O. dimmers. user guides. we have compiled a collection of all articles on this topic that have appeared in Elektor magazine and complemented them with additional documentation and links to introductory articles on Ethernet interfaces. application notes. GPS.ELEKTOR. It offers several hundred drivers for powering and controlling LEDs in different configurations.50 Prices and item descriptions subject to change.) that have appeared in Elektor magazine. light detectors. ISBN 978-90-5381-268-6 • $46. ISBN 978-90-5381-214-3 • $31.

and a USB port on your PC. The ‘NetWorker’.# 100552-91 • $85. Many of the circuits have practical real-life applications.com/shop Kits & Modules big microcontroller and a few useful peripherals — it seeks to be a 32-bit ARM7 fast prototyping system.80 C# 2010 Programming and PC interfacing This book is aimed at anyone who wants to learn about C# programming and interfacing NetWorker An Internet connection would be a valuable addition to many projects. CDs. When you are done a few mouse clicks transfer the program to your mbed hardware. from becoming Master of Embedded Systems You can get access to your project from any PC anywhere in the world and continue working on it. these problems and allows beginners to add InThe book is complete with many full program ternet connectivity to their projects.60 .60 Bestseller! Associated starter kit available ARM Microcontrollers This is the perfect book for people who want to learn C and who want to use an mbed ARM microcontroller in an easy and fun way. Amsoft Internet Explorer.# 090559-91• $143.elektor. Art. To justify this title. power over Ethernet are available – free of charge – from a special (PoE) and more. but often designers are put off by the complexities involved. It covers programming concepts from circuit board. CT 06066 USA Phone: 860-875-2199 Fax: 860-871-0411 E-mail: sales@elektor. self assessment exercises and links perienced users will benefit from features such to supporting videos. 176 pages • ISBN 978-0-905705-97-2 • $42. DVDs. More exexamples. threading and databases. to-use microcontroller-based web server. support website. but nothing should deter you No previous expe-rience or knowledge required. 250 pages • ISBN 978-0-905705-94-1• $47.Books Bestseller! An introduction to digital control electronics Visual Studio Experiments with Digital Electronics This book presents fundamental circuits using gates. Art. we also need user-friendly on your PC in order to programthe mbed! The development tools and libraries that allow fast only thing you need is a brow-ser such as Microimplementation of the board’s peripherals.50 305 pages • ISBN 978-0-905705-95-8 • $47. Kits & Modules and much more! Reign with the Sceptre This open-source & open-hardware project aims to be more than just a little board with a www. solves displaying graphs. All code examples used as SPI communications. in addition to a very useful little board. Building these digital circuits will improve your knowledge and will be fun to boot. The mbed NXP LPC1768 uses cloud technology. a free software library and a readythe basics to object oriented programming. flip-fl ops and counters from the CMOS 4000 Series. bitious? Maybe. Learning these fundamentals is best done using practical experiments. Professional quality software tools are downloadable –also free of charge– from Microsoft.com Universe with the help of the Elektor Sceptre.60 Elektor US PO Box 180 Vernon. It’s your one-stop shop for Elektor Books. This means you do not need to in-stall software Elektor is more than just your favorite electronics magazine. Each of the 50 experiments presented in this book has a circuit diagram as well as a detailed illustration of the circuit’s construction on solderless breadboard. which consists of a small printed to a PC. a revolutionary concept in software development.

c—Eight AA cell batteries are held under the ROV.) When he showed me the winning robot from the prior robo-cross event. I found that I also had a role to play as a volunteer coach for a “robo-cross” event. improving the gearing mechanisms. simplifying the electronics. I knew I was in trouble. To make matters worse.F EATURE ARTICLE by Brian Senese (USA) Remotely Operated Vehicle Design You can control a remotely operated vehicle (ROV) or mobile robot wirelessly with a basic RC transceiver and a little know-how. such as standardizing one motor. A receiver on the ROV then demodulates the FM signal and enables motor control. I visited the previous year’s coach to get some helpful tips. I found that it took a small fortune to buy commercially available robot electronics such b) c) Photo 1a—The prototype ROV competed in a “robo-cross” event and placed sixth overall in a field of more than 40 contenders. and. (While I met with him I discovered that he had built “battlebots” in his machine shop. To prepare for the event. This design uses FM signals to transmit data.com . Under the direction of the coach. 28 March 2011 – Issue 248 CIRCUIT CELLAR® • www. b—This second-generation “cousin” design incorporates significant improvements. above all. each student is challenged to build a robot for a contest involving picking up items and then placing them into containers for points.circuitcellar. These were serious industrial-strength robots that could fight in an arena. A a) fter enrolling two of my children in the “science olympics” at their school.

and then low the conventional motor conbased on a prototype that was controlling the five motors trol methods used in commercial conceptualized and built by two onboard. This design design of a second-generation radio signal. small coins) as well as hold items in place while the robot is moving. than the VEX robot controller. devices. software. First of all. This is accomplished with at $400 a pop. demodulating is atypical since it does not folremotely operated vehicle (ROV) and decoding it. Gearing current can be passed through the motor in one of two directions acting to determines both the speed at which the part move the motor either in a forward or reverse direction. Additionally. bucket. the prototype as well as the You can use the files for a design capable of picking up second-generation version. A third swivel wheel provides maneuverability. demodulating and decodneering to be precise. motor radio control. lower its output torque. with only three wheels.25″ in height. which should be easy to identiobjects ranging from small coins to golf balls and moving fy. And. responsible for receiving a radio mechanical and materials engisignal. All of the mechanical parts (except wheels) are Ground (0 V) Ground (0 V) Ground (0 V) attached to separate motors using gears.www.6 V 9. a schematic. when creating your own robot and I mean this in the globThe ROV electronics are al sense: electronics.6 V of power. Photo 1 shows two ROVs.6 V . You can tilt the bucket to hold objects 4 2 4 2 4 2 inside once they are loaded. the faster a motor runs. The chassis sits atop two drive wheels that are conacross obstacles as high as 0. The flap is used Brake Reverse Forward to coax smaller objects into the bucket (e. commercially available VEX transmitter/receiver—which is generally marketed as a surplus item on the internet—provides as a radio control (RC) transmitter (more than $100). Two control lines determine the direction in which the current is passed through the motor. You’ll note that the gearing is different for Figure 1—DC motor control is accomplished through an H-bridge circuit where each of the three moving elements. I’ll focus on the underand software is designed to lying electronics and software. The bucket is positioned to the side of the ROV so that it can scoop up objects that are in tight corners. but tion to control the five motors. The beauty of this project is signal scheme used by the VEX transmitter/receiver pair is that the entire ROV was about $150 with spare material nonstandard and it cannot be used with anything other left over. The trick in using this hardware is in decicontroller (five at $30 each). 9. Counterweights on the arm opposite the bucket + + are necessary to reduce the amount of A B Motor Motor Motor power required by the motor in lifting any A B A B load. An inexpensive. the hardware students. Speed and torque govern ROV operation and are 9. and metal components. directly control DC motors that which you can easily extend to have a maximum current draw of 2 A. The ROV electronics are ing it. the Mounted on top of the chassis are the electronics. which limits its use. Power FETs typically moves and the amount of force that can be act as switches to accommodate the high current requirements. the any mechanical contraption. Kids love robotics. The project files (software. it also reduces the amount of force required in turning the robot if the design were to use MOTOR SELECTION two statically mounted wheels instead. Additional circuitry There is a less expensive way to work with robotics. especially when it 1 1 1 3 3 3 picks up golf balls.g. Eight AA NiCad Motors are the most critical component in an ROV or cells are mounted on the bottom of the chassis providing robot. such dreams are shattered. applied in moving that piece. Much can be learned noise spikes created when motors are turned on and off. In general. and flap. can be a problem.6 V 9. and then controlling the In this article I describe the responsible for receiving a five motors onboard. a Microchip Technology PIC18F4620.circuitcellar. and is required to handle the current drawn in driving each that is to make a robot from scratch. balancing the robot..com • CIRCUIT CELLAR® 29 March 2011 – Issue 248 mechanical arm. and a mechaniPROTOTYPE DESIGN cal template) are available on the Circuit Cellar FTP site. using surplus elecmotor as well as protect the controlling processor from tronics and some smart engineering. inversely related. gearhead DC motors (five at phering the receiver output and then using this informa$20 each). trolled with two independent motors.

Note that Km = Torque (N-m)/input current (A) = 0. Fortunately.6 V. You can use Km to give a torque reading when the motor is at a stall (0 RPM) and when you apply maximum CIRCUIT CELLAR® • 30 www.76.e. processed by the microcontroller. providing a maximum of 9. To get an accurate torque estimate. Taking a more rigorous approach would include the transient effects of motor inductance.05 A = 0.Figure 2—The complete control system.6 V × 11. yet this is not necessary for our purposes. For this project.com . If maximum power is applied to the drive motors.05 A × 6 V ) − ( 0. are demodulated by the receiver. or up an incline. With a 3″ wheel attached to the motor spindle.05 A × 6 Ω) = 0. the motor starts at 0 RPM.03888 N-m 2π × 70 RPM 60 s/min (3′ × π ) × 112 RPM × 1 min 17 ′′ = 60 seconds second This is sufficient to maintain control within the confines of tight spaces. Torque = Electrical power . you must use a variable called a “motor constant” (Km). which relates motor torque to input current. 9.circuitcellar.7 RPM per volt.Internal power loss = Rotational speed (rad/s) (0. not 70 RPM as is specified for this level of torque.05 A × 0. which in turn determines the batteries required. and eventually used to control five motors.7 RPM/V). Let’s look at how a motor is selected. the ROV has a maximum traveling speed of: The torque available from both motors will determine if they are strong enough to move a fully loaded metal ROV across a floor. it came out to be 6 Ω in using a standard ohmmeter. There are two problems with this calculation. to achieve maximum power. Secondly. two Namiki DC motors with RPM of 70 at 6 V (50 mA) were used to drive each 3″ wheel. it requires only simple math to arrive at an approximation. a gear head is usually attached to reduce motor RPM and increase output torque to a point making the motor useful.038 N-m/0. they will turn at 112 RPM (i. In this ROV.6 V must be applied to the motor. March 2011 – Issue 248 Another consideration is the nominal voltage that is required by the motor. Nominal torque first must be calculated at a specific motor speed using the manufacturer’s specifications and an internal motor resistance measurement. over small objects. For common DC motors. 9. or 11. RPM for different voltage inputs can be approximated by using 70 RPM per 6 V.. Power is supplied by 8 AA batteries. First. Control signals originate from the transmitter.

40 N of force will yield an acceleration of 11 meters per second with the ROV reaching maximum speed in 34 ms. the motors selected are more than adequate in terms of moving the robot quickly and easily. but it is also offers greater power efficiency since it eliminates the need for a power absorbing variable resistor.com • CIRCUIT CELLAR® 31 March 2011 – Issue 248 With two motors working in tandem. An interrupt-driven input pin deciphers the serial PPM stream and responds by manipulating two output control signals (per channel) which are fed to an H-bridge circuit.5 × 0. voltage. Refer to Photo 1.analog signal Channel #3 . Speed is managed by varying input voltage. Now add the effects of the 3″ wheel. This is best achieved using PWM and varying duty cycle between 0% and 100%. the direction of spindle rotation is determined by the polarity of the voltage applied to the two input leads. 40 N of force can be brought to bear in moving the ROV. The use of gears makes mechanical control easier. MOTOR CONTROL Regarding motor control. Gearing is an essential design consideration since it offers a way through which fine tuning can be applied to mechanical control.6 N per wheel.analog signal Channel #2 .0254 m ′′ 1′′ There are three other motors of the same type onboard to lift the arm.analog signal Channel #4 ..analog signal 5V Ground Data 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 Back Digital control channels (#5 through #6) Figure 3—The design features a PIC18F4620. You first estimate the amount of current provided to the motor when it is at rest: 1 A (i. Current through the resistance results in power loss. Not only is this easier to implement. Using Km. Without gearing.76 N-m (i.analog signal Channel #5 .e. and close the flap. DC motors are often controlled with an H-bridge (see Figure 1). As I mentioned. the gear ratio is 10 (motor pinion) to 50 (gear attached to arm). you can calculate stall torque for the motor as 0. tilt the bucket. which is used to process the incoming datastream originating from the open-collector receiver.6 V/6 Ω). For an ROV with a mass of 3. This force can be found to be 0.analog signal Channel #4 . 9.analog signal Channel #6 .analog signal Channel #5 . Needless to say.circuitcellar. When placed in series with a motor. which is negligible. Note that opposite from the drive wheels a single swivel wheel is used to allow the robot to turn easily and provide greater maneuverability. This force can be determined as: Torque 0.e.5 kg.analog signal Channel #6 ..76/1 A). This reduces the rotational speed of the motor by a factor of five and increases torque by a factor of five as well. The drive wheels are powered independently and can be controlled to move in forward or reverse. which will convert the torque into a forward driving force. In the case of the arm. 0. www. Motors are connected directly to the H-bridge and diodes act to protect the circuitry from transient spikes generated by each motor. a direct connection between the arm and motor would result in an arm that rotates at 360 degrees in 1 second (using 70 RPM at 6 V). such a resistor would act to control the voltage applied to the motor.76 N-m = 20 Newtons = Distance from motor spindle 1.analog signal Receiver Channel #1 . a motor can draw 1 A when in a PIC18F4420 PIC18F4520 Power supply (batteries) .Analog control channels (#1 through #4) Robot Front Circuit board Processor with motor controllers 0 Motor #1 40 39 38 37 36 35 34 33 32 31 30 29 28 27 26 25 24 23 22 21 Motor #2 Motor #3 Motor #4 Motor #5 Motor #6 Transmitter Channel #1 .analog signal Channel #2 . Resistance to moving across a flat surface originates from the drive wheels.analog signal Channel #3 .

com .5 ms 0. power FETs are generally used as electronic switches in the H-bridge with the added benefit that there is a negligible voltage drop between drain and source when the device is in an “on” state. A LO sync pulse that is 9 ms in duration signals the beginning of channel data. Channel #1 Channel #2 Channel #3 Channel #4 Channel #5 32 March 2011 – Issue 248 Channel #6 CIRCUIT CELLAR® • www. Almost all available battery voltage is applied to the motor in such a configuration.5 ms Ground (0 V) Figure 4—A VEX receiver demodulates information from the transmitter which is in pulse position modulation format. Reverse motor at full speed Neutral Forward motor at full speed 20 ms 0. an older inexpensive IC capable of handling up to 2 A.5 ms indicates full speed ahead.0 ms 1.5 ms 1. Setting one of these lines high while holding the other line low allows current to flow through the motor in one direction. Two control lines are required per single motor. The second-generation ROV was designed to use a dual full-bridge driver (L298N).stalled state. four of which are analog and two are digital. A drawback to using this solution is that there is a small voltage drop across the internal switches that reduces available power to the motor.circuitcellar. Six channels are encoded.5 ms indicates full speed reverse where 1. This trade-off was acceptable as it reduced the number of components as well as cost. A pulse trough of 0.5 to 1.5 ms 5V 0. The first-generation ROV made use of discrete FETs in forming an H-bridge for each individual motor used. An idle channel has a pulse trough of 1 ms. You can see in Photo 1 what a rat’s nest that creates. To accommodate this amount of current.

Each of the four analog control channels (channels 1 through 4) is represented by an 0. receiver. transmitter. Figure 2 illustrates the interface between the processor. Figure 3 shows the relationship between the circuit board. One channel (digital) remains unoccupied. When met with large resistance (controlling circuit being high impedance in an off state). the first channel has arrived and is ready to be decoded.5 ms in duration.5 ms. This unit was meant to be used with existing VEX robot hardware and therefore uses a funky encoding scheme for all six channels and then transmits this signal. which is fed into an I/O pin on the PIC18F4620 that supports interrupts. the instantaneous current draw affects the power line voltage.5 to 1. Trough duration determines both speed and direction of the motor associated with that channel. When a spike is being dissipated. current continues to flow through the internal windings. All six control channels originating from the transmitter and demodulated by the receiver are first separated and then further processed to create a set of control signals that are eventually provided for each individual motor. DC motors act like large inductors. Diodes are tied to the power supply lines. The PIC18F4620 allocates two I/O lines per motor. With a noisy power supply comes unpredictable processor operation and erratic motor operation. Capacitors are added to the power supply lines to reduce such noise spikes to the point where processor instability is eliminated. The interrupt on this input is then enabled and programmed to be triggered on a rising edge. The controller provides two joysticks that manipulate four analog channels (forward/reverse with speed control) and two sets of push buttons that provide two digital channels (foward/reverse with full speed only). Let’s now consider decoding this stream. This solution is a fraction www. yet in doing so introduces a different problem. Introduce to this PWM and you have complete motor control and can vary speed as well as direction. This output is formatted as a pulse position modulation (PPM) datastream format (see Figure 4).By reversing the control line input. Note the extensive use of diodes placed around each motor. Full speed reverse creates a trough that is 0. The two digital control channels (channels 5 and 6) create a trough that is either 0. The PIC18F4620 is programmed to identify the initial synch pulse by polling the incoming signal while in a continuous loop. When the pulse goes high. of the cost of others that are commercially available. Diodes limit this spike. current flows through the motor in the opposite direction. For full-speed forward. a large voltage spike is created. this pin is polled in order to find the lowgoing synchronization pulse that lasts approximately 9 ms and is used to identify channel positioning. The receiver has an open-collector output. an H-bridge IC (L298N).com • CIRCUIT CELLAR® 33 March 2011 – Issue 248 . which makes use of the PIC18F4620. the trough duration is 1 ms. and power supply. When suddenly turning off a motor. For a motor in an idle state.5-ms high pulse followed by a variable lowgoing trough that can vary anywhere from 0. the channel counter is reset (set to 1). providing the control signals to five of the ROV’s motors. When it reads a low signal on I/O pin #33 (RB0) for 5 ms. an internal timer is reset to 0 (marking the start of the first channel) and the interrupt is then re-enabled to be triggered on the WIRELESS CONTROL RC vehicles use readily available commercial short-range transmitters.circuitcellar. It also serves to limit the amount of noise generated as a result of the motors being turned on and off.5 or 1.5 ms long. You also see the channels and motors. a good feature allowing it to operate with different power supply voltages and making it easy to interface to our processor. Within the interrupt. This is a protective measure to prevent the L298N from being fried. The VEX transmitter/receiver is an example. Initially. indicating that the first channel soon will be available for decoding. depending on the position of the analog controller at the transmitter. the trough duration is 1. The receiver provides a signal that has to be decoded and processed. and each of the five motors.5 ms in length.

5 ms March 2011 – Issue 248 to 2) and the process starts again with the timer being zeroed when the rising pulse triggers the interrupt again. The entire program. the timer is reread and the value is stored in memory (an array that is associated with the channel number) for later reference. RC1) to RC0= LO pulse and RC1 = HI (motor goes backward). Aluminum sheet metal is useful because it is inexpensive. which provides information about both the direction and speed of the motor connected to each channel. 4 After channel 6 is measured. 0. After the first channel is measured.2b Interrupt service routine Measure the time that passes between rising pulse edges and store this information. then go to step 2a.5 ms (0. From these measurements.0 ms trough). next rising edge.5 ms trough).5 ms (e.5m pulse + 0. 0. METAL TIPS Building an ROV or robot requires a fair amount of mechanical engineering as well. easy to CIRCUIT CELLAR® • 34 www. A sync pulse is first detected followed by an interrupt-driven measurement of pulse duration. When the interrupt is triggered again. the program continues to run executing 3 until the last 1 .. RC1) to LO (motor is brake).5 ms 1.5 ms pulse + 1. then set the output pins on Port C (RC0.0 ms (e. Once it executes.5 ms 0. Start at step 1 .5 ms Figure 5—This is the algorithm used to decode the receiver data and generate motor control signals. it gets executed every time there is a LO to HI transition on the incoming data line. 0. channel is read and then it starts over at step 1 Channel #2 Channel #3 Channel #1 Channel #4 Channel #5 Channel #6 If the input signal is LO for 5 ms. 0.g. Processing activity within the interrupt is limited to either resetting or reading a timer value and storing it to memory for later analysis. 9 Neutral 2a Enable the interrupt service routine 3 If the time measured is 1. the channel counter is incremented (set Reverse (full speed) If the time measured is less than 1. measures pulse width duration to calculate motor speed and direction through a set of nested loops. The outer loop is used to calculate and set the duty cycle.5 ms trough). then set the output pins on Port C (RC0.0 ms Forward (full speed) If the time measured is greater than 2. The inner loop uses the duty cycle/direction information and sets two I/O output pins for each channel that are fed into an H-bridge circuit used in driving the motors. 0. motor speed and direction are calculated and appropriate control signals are sent to the motor driver circuits.5 ms 1.5 ms pulse + 1.com . as captured in Figure 5.circuitcellar. disable the interrupt service routine. The idea is to measure the time between rising pulse edges and then estimate the width of the trough.g. which determines motor speed and motor direction for each individual channel. RC1) to RC0= HI pulse and RC1 = LO (motor goes forward). then set the output pins on Port C (RC0.. With this routine “enabled”.

it is difficult (not impossible) to bend because it is a brittle material. they thrive and excel.com PIC18F4620 Microcontroller Microchip Technology | www. You then can drill holes as specified on the template. and playing with embedded Linux. | www.com DC Motors Namiki Precision Jewel Co. H-Bridge.cc-webshop.namiki. ready-made kits that take minutes to build and short circuit the learning curve seem to have taken over.cut. Bending steel is best accomplished by using a metal “brake. sailing. Topics: Robot Navigation.com • CIRCUIT CELLAR® 35 March 2011 – Issue 248 . He is a senior product manager at iAnywhere/Sybase in San Diego. The days when kids built their own go-karts or made crystal radios from wire and a diode seem to be gone.com Custom Front Panels & Enclosures FREE Software Sample price $57. I Brian Senese (brian. hope that kids will want to try and build their own ROV or robot from this information and then take it to the next level by designing an entirely new contraption from imagination. Attaching gears and wheels requires special attention. CA. PWM. which provides the driving force. It’s my To download the code. You can print the document and glue (rubber cement) it to aluminum sheet metal. make bends (again.circuitcellar. and light. Motor. The electronics can be reused over and over again. acrylic or customer provided material 1.vexrobotics. With the pattern in place. strong. jetskiing. informed engineers and programmers don’t just survive. Unfortunately.senese@sybase. I started to use cold rolled steel sheet for parts that required bending. Servo — Go to Circuit Cellar’s webshop to find these articles and more: www. 2007 This H8/3664-based rolling robot is capable of inertial movement. A DC electric motor is attached to a pendulum and suspended inside an inflated ball.com/pub /Circuit_Cellar/2011/248. I find epoxy works well. and assemble the design. it will bend (perhaps not as easily as hot rolled steel. SOURCES VEX Transmitter/receiver Innovation First International | www. Here he describes a robotic platform and a communication system for remote management. For more need-toknow information about some of the topics covered in this article. Front Panel Designer Cost effective prototypes and production runs Powder-coated finish and panel thickness up to 10mm now available Choose from aluminum. as indicated on the template). This type of sheet metal can be bent without fracture and is readily available from metal shops. Even though it has been stressed while cold. you can use a metal shear or hacksaw to cut out the parts.32 + S&H Designed by you using our FREE software.com) holds an MS in Electrical Engineering.com (206) 768-0602 www. 2009 Guido built a navigation control subsystem for an autonomous differential steering explorer robot. unlike those of an FM tube radio I built from plans when I was 14.” I can’t imagine using a hammer and vise to make a fold. it should be since it is far stronger than aluminum. Cutting and drilling through steel is definitely harder as well. Brian’s interests include offroading.net NEED-TO-KNOW INFO Knowledge is power. Using a vise to hold the metal piece and a hammer to bend the metal can work if you are careful.circuitcellar. go to ftp://ftp. Motor. PROJECT FILES DIY ROV DEVELOPMENT A robot template is available on the Circuit Cellar FTP site. I nearly electrocuted myself and used the hammer for something other than shaping metal. which is harder to get at metal yards in small quantities). Telemetry — Inertial Rolling Robot by Jeff Bingham & Lee Magnusson Circuit Cellar 200.microchip. Topics: Rolling Robot. H-Bridge. In the computer applications industry. 3 and 5-day lead times available FrontPanelExpress. But that’s a story for another time. Unfortunately. the Circuit Cellar editorial staff recommends the following content: — Robot Navigation and Control by Guido Ottaviani Circuit Cellar 244.

.

.

From this point. and some memory? That’s what I wondered when I started developing this project. And what happens if the DSP core is packaged with four PWM channels. This could be an expensive project in terms of the number of components required when implemented with analog technologies. you can replace them with a unique DSP device. The signal captured is amplified and filtered by a fifth-order. it is not a good idea to use a series resistor as a current limiter. implemented with analog components in the original systems. T his project uses digital signal processing (DSP) technology to create a modern version of a psychedelic light system from the 1970s. and I created filter banks.circuitcellar. lowpass filter. I’ll delineate some logical blocks. and entertainment systems. High-power LEDs should be current driven. But it could be really efficient if implemented in the digital domain with pulse-width modulation (PWM) techniques. in order to build a complete psychedelic light system. a ready-to-use ADC. current-limited power supply is required: one for the red channel. and one for the green channel. useful to remove a possible DC CIRCUIT CELLAR® • March 2011 – Issue 248 Photo 1—The LED lighting system on a prototype board 38 www.F EATURE ARTICLE by Marco Signorini (Italy) Embedded DSP for Lighting It’s possible to embed one DSP device and a series of constant-current generators to drive a set of high-power LEDs in an elaborate lighting system. HIGH-POWER LED LIGHTING LED lighting has become popular. In the digital era. and small size. The 1-W devices in my lighting project require 350 mA to properly operate. SYSTEM OVERVIEW Before going into the hardware details. this was done with a set of operational amplifiers that were also used to rectify and integrate the resulting filtered signal. This project uses digital signal processing (DSP) technology to create a modern version of a 1970s-era light system. In order to maintain high efficiency. LEDs are available in many colors and their switching speeds make them excellent alternatives to traditional light sources in traffic signals. A Microchip Technology dsPIC30F2020 is at the center of the system (see Photo 1). all the following stages are implemented in the digital domain. variable-gain amplifier and then goes onto the ADC present in the DSP. one for the yellow channel. Even better. automobiles. The resulting signal is applied to a digital-controlled. A switching. you can start to analyze the system from the electret microphone. The benefits of LEDs are their efficiency. current-limited power supply is required. Following the audio signal flow. A simple block diagram is represented in Figure 1. Plus. In the 1970s. Here we can find first a high-pass filter. a three-channel. I replaced old-style lights with high-power LEDs.com . with DSP techniques. robustness. The same hypotheses are valid for the filter banks required to “split” the music frequencies into three different channels. lifespan.

In addition. and a high band. The feedback signals. is amplified by the first Microchip Technology MCP608 op Figure 2—The analog input and antialias filter subsystem www.) High-power LEDs are driven by three independent buck-configuration. . Filtered and unfiltered signals are evaluated by a signal power estimation block that calculates four proportional values. C15. The remaining values are fed into the three-channel. The current that flows through inductors L1. Following the audio signal flow. The filtered signal is fed into IC4. MIC1. Unfortunately. in software. The resistors R1. (This makes it impossible to change the external gain when debugging. The voltage shift is achieved through the 100-kΩ R11 resistor. you don’t need to have a bipolar power supply that includes negative voltages. constant-current generators implemented by three P-channel MOSFETs and related feedback networks. The PWM waveforms. This is able to generate three independent 125-Hz waveforms with a 16-step variable duty cycle used for dimming purposes. but it is not really important. In conjunction with IC3 (a Microchip Technology MCP6022). These waveforms modulate. and C17 to remove unwanted glitches are sent to the dsPIC analog inputs. the SPI serial I/O pins are shared with the dsPIC in-circuit debugger (ICD2) capabilities.Variable gain 1:1 to 1:31 A/D Converter Gain and antialias filter SPI In/out High-pass filter (100 Hz) RS-232 Output (It sends internal variables) Low-band filter Electret microphone Signal power estimator Pass-band filter High-pass filter Three-channel HEXFET and LEDs Three-channel software PWM Three-channel Hw PWM (Current control) dsPIC30F2020 Figure 1—The complete project. C5. HARDWARE Figure 2 depicts the analog frontend subsystem. software-based PWM generator. Resistors R2. the three hardwarebased PWM channels that generate a 150-kHz square wave suitable to drive the external buck switching circuit MOSFETs. a middle band. R9. R14. residual from the incoming signal. a Microchip Technology MCP6S26 PGA. the MCP608 (IC1) provides a VDD/2 voltage that’s used as a “virtual ground level” for the analog signals. and R7 are needed to eliminate spurious pulses when the dsPIC is not initialized. The dashed line contains blocks that are implemented inside the DSP device (either in hardware or by a software routine set). One value is used to control the external programmablegain amplifier (PGA). which need to be shorted to GND when debugging or programming the device. the DSP. R6. R8. and R13. generated by the dsPIC30F2020. the signal received by the electret microphone. filtered by R4. and R11 are inserted to increase the MOSFETs’ switching time in order to reduce the emitted switching noise (EMI). Figure 3 shows the power supply. L2. This explains the presence of JP4 and JP5. are properly shifted by two TC4427A low-side MOSFET drivers. The PGA output is connected to the ADC inside the dsPIC30F2020. followed by a filter bank able to split the converted signal into three components: a low band. and the digitally controlled current generators. R5.circuitcellar.com • CIRCUIT CELLAR® 39 March 2011 – Issue 248 amp (IC2). With a signal fluctuating around VDD/2 instead of ground. it implements the fifth-order antialiasing filter and is able to amplify the input signal by a factor of 10. and L3 and the LEDs produces a feedback voltage through the 1-Ω resistors R3. The DSP is also connected to the PGA through a SPI.

All portions of input signal residing in the spectral portion located over FS/2 will be “folded back” below FS/2 with the same amplitude (Lit1). We would like to have FILTER DESIGN As previously noted. and buck switching circuits The dsPIC30F020 contains all the logic needed to implement a fully compliant serial line that is useful for debugging purposes. variable-gain amplifier.com . a front-end analog antialiasing filter is required. on the other hand. even if the filters that split the incoming signal into three bands are implemented in digital format. has to satisfy to be properly mapped in the digital domain. fed into an ADC working at fixed rate FS. the Nyquist theorem affirms that one ADC. will be able to handle properly all signals with frequencies less than FS/2. The unregulated source is used to power the LEDs. In order to connect an external PC. The dsPIC30F020 provides a 9-bit ADC block.Figure 3—The power supply. This effect. To ensure that amplitudes of aliased frequencies found in the digital domain have minimal impact on real signal amplitudes. one of the most important phenomena is related to the so-called Nyquist theorem. working at a fixed rate FS. A 5-V linear voltage regulator (IC2) provides power for the analog and digital components. March 2011 – Issue 248 Photo 2—An antialias filter graph generated by FilterLab CIRCUIT CELLAR® • 40 www. When studying digital signal techniques. The audio signal spectrum I want to convert. In detail. It defines the frequency limits that an analog signal. can be eliminated by filtering out the frequency portion above FS/2 before the digital conversion. resulting in an SNR near 55 dB. the antialiasing filter needs to be able to attenuate signals over FS/2 by a factor that’s less than the ADC’s signal-to-noise ratio (SNR). the TTL levels produced and received by the dsPIC have to be translated following the RS-232-C physical specifications. This is easily done by the MAX232 chip (IC3) and the related passive components. DSP. is limited to 20 kHz. This forces me to select an A/D sampling rate FS over 40 kHz. called aliasing.circuitcellar.

band-pass. but at the expense of ripple magnitude in the passband. As you can see in Photo 2. it can be efficiently used to implement a three-channel. DC removal was implemented in the same way. and high-pass filters). so I chose a Chebyshev design for the filter with a 16-kHz cutoff frequency. Microchip Technology’s FilterLab is an interesting tool for speeding up the development of analog filters. Photo 3 is an example of a frequency graph generated by the tool. These four filters are implemented in the digital domain via a set of multiplication and sum operations performed by the DSP. GENERATORS The dsPIC30F020 is a DSP suitable to be used in switching power supplies. constant-current generator required to drive three high-power LEDs in a buck configuration. I decided to obtain at least 30 dB of rejection in the stop band. high-frequency PWM generator with hardware currentfault control.circuitcellar.Cut-off frequency F stop LP Filter 1 kHz 2 kHz PB Filter 2 kHz and 9 kHz 1 kHz and 11 kHz HP Filter 11 kHz 9 kHz Table 1—LP. By following the “wizard. but the attenuation provided by the microphone provides a good compromise. for a total of 159 coefficients). made through the tools. revealed interesting results using a fourth-order elliptic filter for low-pass and high-pass filters and an eight-order elliptic filter for the band-pass filter stage. It was really useful because I could test different filter implementations. With these characteristics. These requirements are listed in Table 1. as reported by dsPIC FD Lite Momentum Data Systems’s dsPIC FD Lite is a tool that helps design digital filters. with stop frequencies partially overlapping. This is perfect to replicate the Photo 4—Data monitor and control interface in MPLAB IDE showing a simulated input signal and the corresponding filtered output buffer www. The diagram shows that the digitized audio signal is filtered by a high-pass filter. The powerful PWM generator stage is so flexible that it is possible to directly drive three external MOSFETs and evaluate the generated impulse feedback voltage without any software intervention. and HP filters a microphone as an input source for the audio signal. Photo 3—An IIR band-pass filter frequency graph. This offers good channel separation with the most flat response.com • CIRCUIT CELLAR® 41 March 2011 – Issue 248 . Simulating the best-matching FIR filters shows that 318 bytes of memory would be needed for the filter coefficients alone (using Kaiser window: 63 taps for low. The memory required for the IIR filters’ 16 coefficients is just 32 bytes. was not within my target. However. As you might think. implementing all in a single dsPIC30F020 was very exciting. The memory constraints imposed by the dsPIC30F020— specifically related to the X_Memory space used by the DSP core to perform fast computations—make it impossible to implement the filters using finite impulse response (FIR) techniques. It contains a four-channel. 33 taps for high-pass filter. Note that it’s not the required -55 dB.and pass-band filter. unfortunately. I used a fourth-order elliptical high-pass filter with a frequency cutoff equal to 100 Hz and a 50-Hz frequency stop. For this reason. the filter has an overall 20-dB gain. and 1-dB maximum ripple in pass-band frequencies. the tool was able to provide a good solution.” I can quickly define an initial filter implementation that best matches all my requirements. The resulting filter. PB. the filter is able to attenuate by more than 24 dB all frequencies over 20 kHz. iterating several times through the wizard and relaxing some initial requirements. Infinite impulse response (IIR) techniques are less expensive in terms of memory requirements. The simulations. The selected microphone offers a flat response up to 15 kHz. Note that the filter can provide more than 40 dB of rejection in stop band. used to remove any offset or DC residuals. so we need to develop an antialiasing filter with gain greater than 1. and then feeds into a three-way filter bank (low-pass. simulating and comparing the resulting frequency charts. Due to the good performance characterizing IIR filters. Speaking of the filter bank (just forget for a moment the filter used for the DC removal).

com .c file. if required.c file. The result is averaged with a previously calculated fractional value in order to maintain the signal history integrity. buck topology as explained in Microchip’s AN874. March 2011 – Issue 248 Photo 6—The PsyLight debugging console. generates a signal voltage. The comparison result is used to blank the PWM channel output for the required PWM cycle time. linked as assembler code to the project. to modify the external PGA gain. accumulate. it uses Microchip’s DSP libraries included in the C30 compiler. and the two areas are swapped at the end of any filter calculation.c file are the routines used to initialize the filters and to filter the input buffer for each band. The ADC produces 40. The DSP’s time is freed and available to perform calculations for filtering purposes and to generate a low-frequency (125 Hz) PWM signal useful to modulate the amplitude of each LED. The power estimation value is calculated as an average of squared sample amplitudes. It then periodically calls the proper DSP processing routines sequence at a rate specified by the interrupt routine through some shared flags. CIRCUIT CELLAR® • 42 www. The feedback voltage is fed directly to the dsPIC analog input. The current that lights the LED. A double buffer is needed to prevent overlaps between samples coming from the ADC and the already-collected samples processed by the filter banks. The main loop is responsible for initializing the micro and the related peripherals. With this solution. This makes it possible to fetch data. In the filterbank. FIRMWARE I developed the firmware in C language. the ADC result is placed in an area of RAM different from the DSP working area. reducing the required component count. multiply. An application is running. and it’s easily tolerated by the selected MOSFET and drivers. The main loop is also responsible for handling the information related to the estimated signal power and to call some routines. where it is compared by an internal analog comparator with a voltage reference provided by an internal DAC stage properly initialized by the software. The buffers containing the filtered signal have to be evaluated in order to decide if and how much the corresponding LED has to be lit or if the PGA gain has to be modified. The software initializes the PWM registers in order to generate a 150-kHz square wave with a 90% duty cycle.Photo 5—This is a hardware-generated PWM signal in channel 4 and relative feedback voltage in channel 1. when flowing in the feedback resistor. These samples are stored in a double buffer implemented by the inbuffer. To perform fast computations. This is implemented in the pwmeter. They use the filter coefficients generated by the dsPIC FD Lite tool. The adc. the DSP’s 17 × 17-bit multiplier and 40-bit accumulator supported by the compiler’s built-in functions were used. All is done without any software intervention (except for peripheral initialization). The files are posted on the Circuit Cellar FTP site. For the filtering stages. and shift the result in a single instruction. This working frequency was selected because it best matches the requirements to reduce the size of the inductors (an inductor’s dimensions are directly proportional to the current flowing through it and inversely proportional to the frequency).000 samples each second.circuitcellar. Last but not least. A new DSP computation phase is started by the main loop as soon as the ADC completes its working area. The 1-Ω resistor produces 370 mV at the LED’s rated current. it’s in charge of sending all debug information through the serial port when compiled with the proper debug option.c file implements the routines needed to initialize the ADC module and the related ISR.

business leaders and suppliers in one place. technologists.Join the industry’s leading embedded systems event (Translation: Can’t miss event) ESC brings together the largest community of designers. Take a moment to review this content. Inc. Keynote Speaker Steve Wozniak Co-Founder. Apple Computer. and electronics industry visionary delivers the opening keynote speech on Tuesday. May 3rd at ESC Silicon Valley! Categories and Tracks that address the most relevant issues facing engineers and the industry. Applications Tools and Best Practices Embedded Software Topics in Embedded-System Design Hardware for Embedded Systems . so that you can customize your educational experience.

It counted by a specific function..com by the automatic gain-control engine.microchip.circuitcellar. the in-circuit last but not least. to the simulated dsPIC registers. | www. the coefficients associated with the external gain change or 1999. I performed tests principally with a digital oscilloscope connected to the feedback resistors. the current score value calculated Momentum Data Systems. The circuit was implemented through a prototype board. running application. You can see various firmware dsPIC30F2020 DSC and MCP6S26 PGA internal parameters: the fractional values for input. Analog Filters for Data I experimentally tuned some firmware parameters—like Acquisition Systems. It presented. Currentrequired to generate the software-based PWMs that moduly implemented by a high-pass filter. Microchip Technology. I assume the real-time audio processing. increasing the overall The simulated environment enables me to apply an light generated by the system. to embed in a single inexpensive DSP signal through the external PGA. Another really interesting improvement would be to TESTING & DEBUGGING replace the transformer-based power source with a more I developed and tested the firmware mainly in a simulatefficient. 5-W resistors in series with 1N4007 To download the code. I have some improvements in mind. The number of consecutive “clipped” samples is that are able to drive a set of 1-W. Photo 5 is an example of a generated PWM square wave found at the dsPIC output pin (in the oscilloscope channel RESOURCES 4) and the resulting feedback signal in channel 1. These routines also implement the state machine The most important is related to the DC removal. 2006. and should be attenuated. And When the prototype board was assembled. mid-band. time. and high-band power estimation. high-power LEDs.it) has a degree in arated files containing test waveforms generated using Telecommunications Engineering from the Politecnico di Milano. Curtis. and the selected er gain to be applied to the input external PGA gain factor.mds. B. If this number is greater shows how the same device could be used to perform some than a quarter of the input buffer length. using the ed dsPIC30F020 environment via Microchip’s MPLAB IDE. However. cation. fourth PWM channel available in the dsPIC30F020.com/pub diodes to avoid damaging the expensive high-power LEDs. of high-power LEDs for each channel. output.r. The design process was really interesting thanks to some The value calculated by the power estimator is dynamihighly productive tools that enable you to simulate and cally compressed by the pwmdriver. spending some time to select a set of debugger was useful for debugging the hardware and tuning higher-voltage MOSFETs would enable you to drive chains some firmware parameters. the number of CIRCUIT CELLAR® • www. lowMicrochip Technology | www. /Circuit_Cellar/2011/248. the values sent by the firmware through the serial interface. mid-band.44 March 2011 – Issue 248 The power estimator is also clipped samples found in the This project demonstrates it’s possible responsible for calculating a propinput buffer. Microchip Technology.c routines through one experiment with a lot of technical solutions before writing of the experimentally defined curves. interestingly. selected at compile the C code. This was mainly done using text-based. parameters such as the number of possible to embed in a single consecutive samples with maxiinexpensive DSP device a series mum dynamics found in the input of constant-current generators buffer. Audacity) and a simple C Italy.” AN874. Baker. Photo 6 is a SOURCES live. comma-sepMarco Signorini (marco.com . which is input. After working as a researcher at STMicroelectronics and binary-to-text conversion tool written ad hoc..com band. device a series of constant-current This is accomplished by some IMPROVEMENTS TO COME generators that are able to drive a set algorithms that take care of This project demonstrates it’s of 1-W. autoranging switching power supply. Marco is an amateur radio was an invaluable aid when developing and debugging the operator and enjoys programming and developing embedded filter banks (see Photo 4). in a graphical fashion. modulating the perceived LEDs’ incoming signal has been “squared” by a high external gain light similarly to old psychedelic light display systems. it could be replaced by late the LEDs.circuitcellar.” AN699. open-source audio editors (e. the compression curve needed to have a better and more K.C. systems that can operate in network environments. I “analog signal” to the virtual ADC to provide stimulus for the test code and.signorini@libero. “Buck Configuration High-Power LED Drivfluid light display—with an ad hoc Windows console applier. a graphical representation of low-band. go to ftp://ftp. and filtered buffers in a graphical way a private system-integration company focused on open-source through the “data monitor and control interface” panel technology and VoIP deployment. Inc. Displaying Whirlpool Europe. and high-band dsPIC FD Lite compressed amplitudes. “Anti-Aliasing. he now co-owns INGEGNI Tech S. high-power LEDs. an ad hoc moving-average mean estimator that evaluates the mean offset and subtracts it from the incoming signal. The LEDs were PROJECT FILES replaced with 10-Ω.l.g.

Saturday, April 9

Connecticut Council on Developmental Disabilities presents RoboWaiter Competition

Sunday, April 10
Versa Valves, Inc. presents Firefighting Home Robot Contest

www.trincoll.edu/events/robot

Connecticut Council On Developmental Disabilities

F EATURE

ARTICLE

by Brian Millier (Canada)

CNC Router Design
A Look at Computer-Controlled Machinery
Self-sufficiency is a goal toward which many electronics engineers aspire. Reaching that goal involves more than fine-tuning your design and programming skills. It also requires you to have an accessible set of reliable tools for bringing projects to completion. Here you learn how to build one such instrument—a CNC router.

am basically a one-man shop when it comes to most of my projects. I design and build custom electronic devices, and write any firmware and application software that is required. I usually do the necessary mechanical and cabinet work. In the past, I’d have to occasionally depend on a machinist friend for assistance when a project required tools such as a milling machine or lathe. But not any more. I recently developed my own computer-controlled milling machine and router.

I

also gave me a high-quality mill bit to work with. Question: Why do companies bundle the cheapest, poorest quality bits or blades with their tools, thus ensuring that your first experience will be disappointing? However, after that disappointing start, I was soon able to produce decent-looking cutouts in panels and cabinets. While Taig calls its product a “MicroMill,” it is somewhat

“THE LOAN”
As luck would have it, back when I was working at Dalhousie University in Halifax, Canada, I knew a faculty member who had a small, unused Taig milling machine, complete with a third-party computer control (CNC) option. He let me have at it, and within a day or so, it was assembled and I had scrounged up a spare computer to run the control software. My first attempts at cutting patterns in aluminum panels were unsatisfactory. But, after talking to the machinist, I realized that I had to significantly reduce the turning speed of the mill bit, and he

March 2011 – Issue 248

Photo 1—This is the “on-loan” Taig setup I had in my shop at Dalhousie University.
CIRCUIT CELLAR®

46

www.circuitcellar.com

www.circuitcellar.com

CIRCUIT CELLAR®

47

March 2011 – Issue 248

bigger and sturdier than other small units, such as Sherline devices that are basically designed for small work, such as jewelry. The Taig is built like a miniature version of an industrial-grade vertical milling machine, such as the Bridgeport unit that we had in our machine shop. Photo 1 shows the “CNC-ready” version of the Taig MicroMill, which is the model that I had on loan. I have mounted three Keling stepper motors to drive the x, y, and z axes. The stepper motor controller is housed in the enclosure to the left. The blue motor on the left turns the cutting tool via a stepped pulley/belt arrangement. The square black spindle assembly in the center contains bearings and a holder to take one of the six collets to hold mill bits of various shank diameters up to a maximum of 0.375″. Performing cuts with a vertical mill involves mounting your work to the cross-slide table, which moves side to side (x-axis) and front to back (y-axis) under control of the x/y-axis motors. The spindle, to which the rotating cutting tool is mounted, moves up and down (z-axis) under control of a third axis drive motor. The Taig mill I have is the “extended model,” which has a cross-slide table that’s 3.5″ wide × 18.5″ long, but the standard model is a bit smaller. The table travel for this larger model is 12.5″ in the xaxis and 5.5″ for the yaxis. The tower, upon which the spindle/motor is mounted, is not that far back from the cross-slide table itself. That limits the size of your work piece in the y direction. In practice, you can’t mill a hole in your work piece more than about 5.5″ away from the top (or bottom) of the piece itself, without having the piece hit the tower itself. Anyone using a drill press has likely run into this “throat size” limitation. The Taig mill is adequate Photo 2—A for some of my projects, 0.25″ steel

10,000-RPM spindle speed range is well suited for general-purpose metal work, but it would be too slow for some tasks, such as engraving with very small bits. Generally, customers outfit the Taig MicroMill with NEMA 23 stepper motors for all three axis drives. Using the standard 200-step/turn stepper motors, and given the Taig’s 1/2″ 20-TPI lead screws, the step resolution is 0.000125″ when using only a simple half-step controller. Step resolution of five times greater than this is possible when using a 10microstep controller, such as the Geckodrive controllers, which are very popular with small CNC machines. Note that I am referring to the electrical resolution of the stepper drive alone; in practice, the overall mechanical resolution is less than this due to the tolerances of the lead screw/lead nut, and other parts. However, Taig claims an overall working accuracy of 0.0005″, which is excellent. Modern NEMA 23 hybrid stepper motors, such as those manufactured by Keling, are available with high torque ratcloseup of the linear carriage assembly, running on the ings (200 to 300 oz-in) for rails

but I often run into travel limitations when working on some of my larger cabinets/panels, such as 19″ rack panels. The exception is 1U/2U panels, which can be held down to the table using clamps on the top and bottom. An important consideration in a machine like this is how well the cross-slide table performs in terms of rigidity. If there’s flexing or “play” in either the x-axis or y-axis, the cut will be rough and inaccurate, and the tool will vibrate or “chatter” during milling. You don’t want that. The Taig mill is well designed in this respect, with hefty steel ways in which the table can travel, as well as adjustable brass gibs (to compensate for wear over time). Also, a very important criterion in a CNC mill is that the drive train for each axis must be free of backlash. On a manually controlled mill, some backlash in an axis drive can be tolerated or compensated for by the operator; but, in a CNC machine, the computer is generally unable to correct for this shortcoming. The Taig mill uses 0.5″ diameter Acme lead screws and antibacklash lead nuts for each axis drive train, so backlash is not a problem. The Taig’s spindle drive assembly is quite sturdy and accurately machined. There really isn’t run-out (“wobble”) in the cutting tool as it spins. This is important as it affects the accuracy of a cut. The 1,000-to-

Figure 1—A 1 × 2 section of the 8020 aluminum extrusion showing the slots for carriage bolt fasteners

Photo 3—A closeup of the y-axis drive train assembly around $40. Looking at some older, larger NEMA34 stepper motor “pulls” in my surplus motor drawer, it’s obvious that the new stepper motors are much more powerful—and that’s at a fraction of the price and half the size! Given the affordability of stepper motors and matching controllers, it’s unlikely that one would opt to outfit a Taig MicroMill with a much more expensive servomotor drive, although it’s possible. The big advantage of a servomotor drive is in increased travel speed. However, for a small mill like the Taig, it’s unlikely this is an important consideration. In a nutshell, I was very pleased with the Taig’s operation for my aluminum panel/cabinet work. However, I was running into travel limitations on some larger workpieces. Thus, I started thinking about buying or building a larger unit for myself.

DECISIONS, DECISIONS
I ruled out buying a larger CNC vertical milling machine mainly due to the price. It was much more expensive than the roughly $2,200 Taig CNC machine. I briefly looked at some decent-sized, manually operated vertical milling machines. They all were made in Asia and were not well suited for CNC retrofitting for several reasons, not the least of which were backlash issues. I then changed my focus to CNC routers, which are designed somewhat differently and are more commonly used for wood and plastics. Since I really only needed to mill thin aluminum panels (and also do carpentry as a hobby), the CNC router seemed to be a good compromise. On the Internet (YouTube is a good resource), I found many examples of homemade DIY routers, as well as some commercial units and kits. At the low end were commercial/DIY units, the frames of which were either particle board (MDF) or plastic. These are really only good for working with plastics and foam, so I ruled them out. There were also many examples of rather sturdy units, framed with steel or aluminum, which had table travels of 2′ × 4′ or greater. In this case, they were too heavy and expensive to ship, and larger and more costly

than what I really needed. It was at this point that I had a “Eureka” moment. I came across a website describing CNC router kits and parts based around the 8020 extrusion system. Building a CNC router using this method enables a person who does not have a lot of machining tools (such as a milling machine) to build a CNC router accurately from scratch. The best way to explain the “8020” extrusion system is to take a look at a piece of it. As you can see in Figure 1, this particular profile is made up of two “X” shaped sections. Looking closely at the open areas in the profile, you can see it is shaped to accept common carriage-head bolts, which can slide anywhere along the length of the profile. While 8020, Inc. produces many different profiles (both Imperial and Metric), the 15 Series is ideal for a CNC router. There are numerous 15-Series profiles available (1 × 1, 1 × 2, 2 × 2, etc.) and the slot-to-slot spacing is 1.5″ throughout the series. The slots accept 5/16″ × 18 carriage bolts. For places where you need a different type of fastener, 8020, Inc. makes hundreds of specialty brackets and fasteners for that purpose. Think of the 8020 system as a Lego set for industrial purposes. Just as important as the flexibility of this system is the fact that 8020 can supply any of these extrusions cut precisely to length for a few dollars per cut. This is critical because many designers don’t have a way of performing such accurate cuts themselves. The 8020 website has a number of manuals that include examples and methods of using their components. Another piece of the puzzle was finding a company that makes and sells linear carriages, bearing blocks, and NEMA 23 (or 34) stepper motor mounts, all sized to mount perfectly on the 15-Series extrusion. (Refer to the Sources section at the end of this article.) Photo 2 shows a smaller carriage running on a 0.25″ thick steel rail, which is used for my router’s x-axis. The final piece to the mechanical puzzle is the axis drive mechanism itself. Photo 3 shows the y-axis drive

March 2011 – Issue 248

Photo 4—A moving gantry router, built using an 8020 aluminum extrusion. (Source: www.glacialwanderer.com/hobbyrobotics/?p=17, Maurice Ribble)
CIRCUIT CELLAR®

48

www.circuitcellar.com

At the top of the gantry is the y-axis assembly. The blue item is part of a thrust bearing assembly. but the concept is the same. providing for x-axis travel (or y. bearing blocks.” Photo 5 shows my finished router located in my carpentry shop. I used DumpsterCNC antibacklash lead nuts recommended to me by people who had previously built 8020based routers.5″ cold-rolled steel rails. and which moves from one end of the frame to the other. or.mechanism used in my router. all of the previously mentioned parts are very accurately machined. To the right is the bearing block. It uses the same carriage assemblies. He describes such a unit. shown in my home carpentry shop CIRCUIT CELLAR® 49 March 2011 – Issue 248 . since shipping would be expensive.com • and authored a great online-illustrated “build guide” for this particular machine. motor mounts. Fastened to that is the z-axis assembly. a sacrificial wood/plastic board is fastened to the frame to form a full top. This makes it much lighter and. at the same time. Many larger router kits use “five-start” Acme screws. GANTRY VS. so the best way to couple the motor to the Acme screw is to use an antibacklash coupler designed to connect the motor’s 0. As you can see. and so forth as described in the previous section. which is about 19″ square and constructed entirely from precut 8020 extrusions. strong joints. I chose an Acme screw with 10 threads per inch and what is called “single start. which also biased my choice of designs. The workpiece is mounted to the frame using some form of mounting jig. which contains the x-axis and z-axis linear motion assemblies.’s 3278 end fasteners. but with much less linear torque. The table’s left and right extrusions fasten to the three table cross members using 8020 Inc.5″ size is well suited for a machine of this size. This is important as the table assembly must be perfectly square and tight to properly mate with the y-axis carriage assemblies and move smoothly along the steel rails. TABLE Having settled on a basic construction method. I had been immediately impressed by the 8020 extrusion system. Refer to Ribble’s blog listed in the Resources section at the end of this article. but it’s mounted on short legs to provide for clearance below. (The x-axis is similar. In this design. Just above the frame is the moving table. based on the 8020 extrusion system (see Resources). To accurately cut metal. Acme lead screws come in many sizes and specs. also designed to mount directly to the 8020 extrusion using 5/16″ × 18 bolts and T-nuts placed in the extrusion’s slots. We had a great e-mail exchange during my router “build. heavy assembly that must move smoothly and accurately on the steel rails mounted to the bottom of the frame. and preferred the increased torque provided by the singlestart Acme screws. There is a large gantry. of course. this large gantry has to be very precise and sturdy. The advantage of the moving gantry router is that it maximizes the amount of x/y travel for a given machine footprint. This particular machine is an 8020-based design. I was surprised to find that Acme lead screws were not readily available in Canada. it’s easy to make it plenty rigid. Ilya was a great resource. but the 0. While you would generally need a true flexible coupling to connect the stepper motor to the Acme lead screw.” These will move 0. the gantry. I came across a website run by Ilya Dontsov in Russia.25″ shaft to a 1/2″10 Acme screw. Fortunately. My unit differs from his in several ways. but I was somewhat concerned about shipping all that heavy extrusion into Canada from the United States.circuitcellar. The Acme lead screw and lead nut convert the rotation of the stepper motor into linear motion. I Photo 5—My moving table CNC router. With that concern in mind. These move the carriage five times as fast for a given motor speed. used to move the cutting tool (a router) up and down. There are two distinct types: moving table and moving gantry. Maurice Ribble built www.5″ per motor revolution.1″ per revolution of the motor and provide higher linear torque. the frame is fixed to the table. as well as 0. I then had to decide on the style of router I wished to build. which extends both above and below the frame. You can see that the frame rests securely on a home-built aluminum base unit. is fix-mounted to the frame. as shown in Photo 4. which make for very accurate. My only source of Acme screws was McMaster-Carr in the United States. The most common option is the moving gantry type. I’m not interested in high-speed axis motion. at least not for someone looking for a few feet of them. I instead decided to build a “moving table” router. What I have yet to mention. which move 0.) The Keling stepper motor is mounted to the motor mount plate. The thought of that was a bit daunting. was yet another “Eureka” moment. These lead nuts have to match the Acme screw threads you choose. alternatively. which comes predrilled to mount onto the end of an 8020 extrusion. The disadvantage is that the gantry is a rather large. depending on your point of reference).

this 30-VDC power supply provided the ideal voltage for the eBay controller. I purchased Keling KL23H276-30-8B stepper motors for the three axes. In the end. which had housed a now-defunct scientific instrument. using six force-sensing resistors for the jog switches CIRCUIT CELLAR® • 50 www. and not as versatile a profile as the 8020 extrusions. but provide 387 oz-inch of torque. For a beginner like me. along with some cast aluminum corner assemblies. but it was nice to be able to recycle all of this surplus aluminum (which is extremely energyintensive to manufacture). The Geckodrive G540 controller handles these motors nicely.circuitcellar. I used limit switches at each end of all three axes to provide for overtravel protection. The CD-ROM also contained a variety of allied programs. and power supplies up to 50 VDC. which matched the controller I had initially ordered.5-A (per phase) stepper motors.com . I found a Canadian supplier of the 8020 extrusion and fittings. I ordered a Geckodrive G540. it is much more common to see the dedicated controller replaced by a standard PC computer running CNC application software. although the layout can also be customized by the user. 2. I then did what I should have originally done. In the past. such as those that convert the output of various mechanical drawing programs into the “G-Code” used by Mach 3 and all other CNC controllers.5A. and I also incorporated an emergency stop switch. which is a well-respected American-made four-axis controller. so I returned it. MACH 3 SOFTWARE All CNC machines require an intelligent controller of some sort. as well as the base unit (which contains the controller and computer) completely from aluminum parts recovered from this cabinet. but since it is capable of providing 3. under computer control. but I could have gotten better performance in my system had I March 2011 – Issue 248 Photo 7—My PS/2 remote control pod. which are a bit more expensive. handling up to 3. Here again. CNC STEPPER CONTROLLER I originally tried a three-axis. with lower-cost CNC-ready tools available to smaller machine shops. My “loaner” Taig mill came bundled with a licensed copy of the Artsoft Mach 3 CNC control software. so it would be pointless for me to try and compare it to any other commercial and freeware programs that are available. early on! While the purpose of a CNC controller is to run the Photo 6—The Mach 3 CNC control software was approached by a colleague to dispose of a Germanmade rack cabinet. Examining it. the somewhat lower torque was not an issue in my case.5-A stepper controller that I found in an online auction. While all of the cabinet’s extrusions were sized in metric. and operates well without a ventilation fan in my shop. it was nevertheless possible to build the basic frame unit. The G540 has numerous inputs for such limit switches. I discovered that it was built entirely from aluminum extrusion. I powered the G540 using a surplus power transformer I had on hand.1 A per phase. but it did not work properly. These motors provide 282 oz-inch of torque and are rated at 2. Setting up and configuring a CNC machining tool is not trivial. It has an advanced 10-microstep drive algorithm with mid-band resonance compensation. I would say. it would have been better to have ordered the Keling KL23H284-35-4B. this software is much more than adequate to serve my needs. Today. driving a full-wave rectifier and a large filter capacitor. that Mach 3 comes with far and away the best setup/operator’s manual (in PDF format) that I have ever encountered. one of which I used to drive a solid-state relay module which turns the spindle router on and off. so read this manual thoroughly. though. Photo 6 shows the Mach 3 program as it appears on my screen.used a power transformer that provided closer to the 50 VDC that the G540 is capable of handling. CNC was only used in professional machine shops and was implemented using dedicated control electronics. Since I had chosen single-start Acme screws. which shuts off all the motors in case something goes wrong. in much the same way that factory machinery is run by dedicated PLC circuitry. The G540 also has several outputs.

Finally. Basically. While these are commercially available. so I stuck with them. some electronics! plugs into a PC’s keyboard port and emulates a keyboard by sending out specific key scan codes in response to the user’s actions on whatever input device the wedge uses. y motion (up and down arrow keys). but these defaults make sense. It would be advantageous if the jog speed were somehow proportional to how hard one pushed the switch—that is. The jogging “hot keys” I wished to implement in the remote pod are defined by default as follows: x motion (left and right arrow keys). but the model I chose is a circular pad. in addition to the mouse itself. After I built my own CNC router. and merges both the “real” keyboard’s data and the wedge’s own data into one stream (hence. it is mainly a matter of designing what is commonly called a “keyboard wedge. there were a few considerations which led me to favor another method. and this time I chose the PS/2 interface. making them susceptible to metal shavings. Mach 3 implements a “keyboard and screen” implementation of a remote control pod.circuitcellar. the “wedge” moniker). To accomplish this. I don’t allow the “real” keyboard to be plugged into the pod. the axis would rapidly move to a general target location. What type of keyboard did I decide to emulate? The old PS/2 style or the newer USB style? Actually. A true keyboard wedge allows for a “real” PC keyboard to be plugged into it. In the case of my remote pod design. tool under computer control. whereas a light touch could be used to “home in” on the specific target location. If you’re CIRCUIT CELLAR® 51 March 2011 – Issue 248 . These FSRs come in various shapes and sizes. I decided it would be more convenient if I had a small remote control pod to perform such manual positioning. However. touch screens. although I grant that such computers are becoming less available over time. Since there was a distinct possibility that metal shavings from the cutter could end up on the remote pod. I decided to design and build one of my own. you’ve been reading a lot about touch switches.com • SPECIAL SWITCHES I put considerable thought into the type of switches I was going to use for “jogging” the three axes. as it turns out to be much simpler and less expensive to design the pod this way.75″ EXTERNAL CONTROL Many of the control “buttons” on the Mach 3 screen can be activated by keyboard hot keys. manufactured by Interlink Electronics. When using Mach 3’s screen-based remote pod. To implement the remote pod. and the like. This feature can easily be incorporated into the remote pod. There was quite a personal temptation to incorporate such technology. This is perfectly functional. if you “leaned” on the switch. and to manually set spindle height. for “jogging” purposes. since I am very impressed with my Apple iPod Touch and iPad and their excellent capacitive touch-screen interface.Figure 2—The remote pod is almost completely made up of the FSRs and the MCU. You can redefine these (under Config. any PC that has a parallel printer port will also have a PS/2 port. pressing the Shift key prior to hitting any of the jog motion buttons switches to a “rapid” speed. and z motion (page up and page down keys). but you have to place your computer keyboard/mouse close to the tool itself. This manual control is called “jogging” in the trade.” A “wedge” is a device that www. choosing instead to merely plug a standard USB keyboard into a free USB port. The Mach 3 software is designed to use the standard PC parallel printer port for its machine-control interface. the answer is both. allowing for slow/fast axis motion. I needed another pod for it. You definitely don’t want false triggering on a CNC machine! What I settled on was a sensor known as a force-sensing resistor (FSR). there still exists the need to manually position the workpiece on the machine initially. I initially built a USB-style pod for the Taig mill. I felt that there would be a good chance of false triggering if using touch-based technologies. about 0. like me. System Hotkeys menu).

then no buttons are ly. press the +5 V and ground wires. is what you use to compare the six FSR readings with to With no force applied. output directly to one of the eleven 10-bit ADC channels contained in an Atmel ATtiny461 MCU. sure needed to activate the “low-speed” axis motion. next hold the shift key down. In small quantities.7-kΩ resistors. polled.circuitcellar. To start panel. there isn’t a ing problems. as well as a clock cal switch (which would not have and a bidirectional data line. Here it gets a bit more complicated. I CIRCUIT CELLAR® • www. the ADC will see virtually 0 V. Therefore. whenever I sense that and is easily powered from the 5-V keyboard power supan FSR has been pressed hard. Both the data and clock lines are pulled whether the last time this FSR was checked. Finalabove the pressure threshold. if it was up to VCC by 4. The Atmel ATtiny461 pressed hard. available for Bascom AVR. applicable key has been released. wired as voltage dividers to six of the are necessary to invoke high-speed motion on the proper MCU’s ADC channels. you send out a “break” scan code exceed 3. in the aforemenTHE CIRCUIT & FIRMWARE tioned loop.52 March 2011 – Issue 248 in diameter. which is connected to flex circuit. The sensor connections are made via a standard with. which is about the from a surplus PS/2 keyboard. this to be considered a valid slow-speed trigger event. In Mach 3. Both the data and clock lines sensor up as the upper resistor in a voltage divider. In this case. I first check to see plied by the PC. they the PC’s PS/2 keyboard port using a cable that I salvaged cost about $7. used an add-on PS/2 keyboard emulation library. Should resistance decreases. PS/2 keyboard. you must first release any jog key that board port using a cable that I salvaged from a surplus you may have depressed. the ADC voltage will pressed. In the case of a firmer press on any of the FSRs. which can be easily bent at right angles to the pressure threshold pot.5 V going to the ADC. Whatever value you see here the pad. I send out the scan compiler. and fed the divider are pulled up to VCC by 4. which is the threshold. I empirically determined that an ADC value of 700 correwhich is a personal preference. as well as a clock and a bidirecdesired jog key. with a sticky backing that adheres nicely to a metal The FSR sensing loop is fairly straightforward. sponds to a pressure that is considerably greater than the slow-speed threshold. its You adjust this pot to represent the minimum FSR presrespective ADC channel will return a much higher value. the value is first checked to see if it exceeds 700. when the six ADC channels are being Figure 2 is a schematic of the PS/2-based remote pod. reaching down to about 2 kΩ with a a particular FSR provide a voltage to its respective ADC firm finger press. which sends out the proper key These sensors make ideal motion-control switches for the CNC remote pod. and made to exit via a small slot in the panel. followed by the scan code value of the last key that was that switches over to high-speed axis motion. The four-wire PS/2 interface consists of and then. The four-wire PS/2 intersame as any good-quality mechaniface consists of +5 V and ground wires. there isn’t a whole lot more to axis. so no external crysfirst send out the proper scan codes to indicate that the tal/resonator is required. channel that exceeds this threshold. The remote pod uses very the touch sensitivity). When pressed with one’s finger. The preceding routine handles the slow-speed I use one of the remaining ADC channels to sample the axes’ motion. The remote pod uses very little power To mimic this in my program. the FSR. then we have to send out whatever keystrokes sensor switches. These are rugged devices. then I accurate enough for this application. these sensors have a resistance determine if any of them has been pressed hard enough greater than 1 MΩ. with the shift key still held down. as long as one sets whole lot more to the circuit. Lastly.com .7-kΩ resistors. wiper of a pot that is connected across the VCC supply. With no pressure applied to scan code to the PC (preceded by the “make” scan code). structure is executed. to the circuit. as seen in Photo 7. They are immune to contamination from metal shavings or cutting fluid. Apart from the six FSR sensor switches. The pod is connected to the PC’s PS/2 keyjog at high speed. or just gently. little power and is easily powered from the 5-V keyboard In this application.4 V. Beyond very low forces of about 20 g. you read ADC channel 6. Then I follow up with The firmware is written using the Bascom-AVR BASIC the scan code for the shift key. but it is not so firm as to make it uncomfortable to achieve. wired as voltage They don’t suffer from false triggerdividers to six of the MCU’s ADC channels. Apart from the six FSR If it does. The pod is connected to the pressure threshold sensitivity properly. with a heavy finger press. rather than trying to roll my own. which is pretty straightforward. It consists of two main sections: the FSR senscodes to indicate that the same key (shifted) has been ing loop and the PS/2 keyboard emulation routines. tional data line. I wired each power supplied by the PC. fixed in firmware. A light finger If a scan of all six ADC channels results in no readings press will result in about 0. which is time it was just pressed gently (usually the case). a SELECT-CASE the device responds in an inverse power-law relationship. sent out. If it turns out that the last MCU contains an internal 8-MHz RC clock.

.

the Circuit Cellar editorial staff recommends the following content: — Build a Three-Axis CNC Mill Machine by Gordon Dick Circuit Cellar 201. Details like thread size and component strength are essential. The top panel and the circuit board have to be “sandwiched together” due to the way the FSR flex connectors are mounted to the PC board. and an old 386 laptop.com March 2011 – Issue 248 Author’s note: Go to the Circuit Cellar FTP site to download a complete list of companies that manufacture and sell the motor controllers. 2006 John upgraded his metal lathe with a PIC-based gear control system. They are happy to sell you one or 1. as most of the metal is ordered cut to size. Servo Amp. before even ordering a single part. small-quantity electronics projects. The system includes an old medical X-ray machine. In this article. 2008. Motion Controller. August 3. facilitating assembly. I was either disappointed or just plain ripped off. a Galil DMC2133 three-axis intelligent motion controller. though.struck again. they thrive and excel. 2007 Gordon shows you how to design and build a computer-controlled wood mill machine. Lathe. Brian Millier (bmillier1@gmail.” I regularly use hand-wired Vectorboards and chip sockets. he explains how to design and write code for an electronic gearbox.com/pub/Circuit_Cellar/2011/248.8020CNC.interlinkelec. In the two cases where I struck out on my own and ignored advice on the forum. I had to ferret out numerous suppliers.com Force-sensing resistor Interlink Electronics | www. it’s imperative that you do a whole lot of planning well in advance of even ordering the necessary parts.com.glacialwanderer. working on this project was an extremely enjoyable experience. Also important are sticky details such as whether your design will enable you to place tools in the necessary spots to tighten the bolts sufficiently. mechanical parts. the method generally works out well. drawing from their 1-million-part inventory.” www. many of which were small web-based businesses that had much longer delivery times and accepted only PayPal.circuit cellar. Photo 7 shows the PS/2 remote pod mounted in a Hammond 1455N1201 extruded aluminum enclosure. RS-232. Ribble.000 of a specific component. When building custom. In the case of a precise mechanical tool such as the CNC router.com NEED-TO-KNOW INFO Knowledge is power. caveat emptor! Overall. Canada) for 29 years.cnczone. So. It was unlike any of my usual electronic projects. In the computer applications industry. than I routinely spend building an entire electronics project. I often find it practical to “design it as I build it. PROJECT FILES To download a manufacturer list.com. CNC — Go to Circuit Cellar’s webshop to find these articles and more: www.atmel. | www. He was an instrumentation engineer in 54 CIRCUIT CELLAR® • www. DIY CNC Machinist Forum. as well as practical experience regarding many of these smaller vendors. Mill. Topics: Gearbox. www. For more need-toknow information about some of the topics covered in this article. informed engineers and programmers don’t just survive. Stepper Motor. and you can expect delivery in a day or two for a very low courier fee.com ATtiny461 MCU Atmel Corp. M. THE FINISH LINE This turned out to be my most involved DIY project in recent memory.machsupport.circuitcellar. This project also made me much more aware of how pampered the modern electronics enthusiast is when it comes to parts supply. I SOURCES Mach 3 CNC Control software Artsoft | www.com/hobbyrobotics/?p=17. Threads. so it would be possible to substitute the lesser ATtiny261 MCU. go to ftp://ftp. and specialized fasteners I used for this project.com . “My CNC Engraver (Part 1). which is home to many professional machinists with expertise in techniques. And with much of the functionality embedded in the MCU firmware (which is crafted last). Cabling — Electronic Gear Control Add Electronic Gears to a Metal Lathe by John Dammeyer Circuit Cellar 196. A typical electronics project BOM can be fulfilled from one or two huge distributors.cc-webshop. These work particularly well because the top panel slides in and out.com) runs Computer Interface Consultants. In this project. Topics: CNC. I also learned to pay attention to the invaluable advice available from the CNCZone forum. I spent more time researching this endeavor. www. Undoubtedly.410 bytes of flash memory.” Hobby Robotics Blog. the Department of Chemistry at Dalhousie University (Halifax. RESOURCES “DIY 80/20 Aluminum Extrusion CNC Machine. The firmware uses just 1. Knowing exact dimensions are critical.

is the only site in the industry where engineers can quickly find. compare and buy the leading development tools. The Digi-Key Tools Xpress intuitive research engines are used by engineers worldwide to locate. Compare it to Other Tools. and Buy It from Digi-Key Tools Xpress -. BUY. and prices.www.DevtoolsXpress. engineered by Embedded Developer. Evaluate It. COMPARE. with features and performance specs. availability. Compare before you buy: tools are listed side-by-side.com Pick a Tool. so you can make an educated decision! FIND. Find the Right Development Tool. Digi-Key Tools Xpress. Any Tool. compare and evaluate hardware or software development tools.Without Leaving Our Site. .

It’s a five-story lab building at Stanford University. Project Management for Mere Mortals. I use a Linear Technology simulator. doing either manually or with project management software. I’m frequently offered books to review. they found some items that appeared in the output too soon. I often jot down and then store my thoughts on essential design-related topics until I have enough to write an entire column. while good books. They have a program that lets you select several views of the project (even sections through the building) and then it runs the schedule against the CAD drawings. more specifically. I use simulation quite often.000 and 3. STATE MACHINES I recently wrote a column on state machines. the simulation shows the gain and bandwidth for each of the system’s functional blocks. they found that these items did not have the proper linkage to predecessor tasks. SCHEDULING & SIMULATION For a long time. Well. But recently. For larger.circuitcellar. Project preparedness is one such topic. a light fixture was hung before the conduit (or even the wall) was in place. It will give you some valuable insight on how to run projects. On the messaging system I’m working on. It makes many of our problems sound trivial. Imagine running a project with hundreds of workers. it helps me to talk to the customer and work through difficult problems. As a Circuit Cellar columnist. You should also frequently review design essential topics. I now have a solution. which is about project management and. It’s a must for complicated projects.L ESSONS FROM THE TRENCHES by George Martin (USA) The Project-Ready Designer A Refresher on Project-Essential Concepts Project management should involve more than creating a bill of materials and then soldering and testing until the project deadline. The editors at Circuit Cellar marked it up and reported that I wasn’t using the term state CIRCUIT CELLAR® • 56 www. the time to focus on this subject is now. On the first run. as in free beer. It’s usually more time consuming to enter the schematic than it is to run the simple simulation and record the March 2011 – Issue 248 results. My son-in-law is a manager for a construction project.000 line items. I was given Claudia Baca’s book. But what I’d been missing was the ability to work with that schedule to absorb the real-world issues that always arise. reconsider all tool options (from hardware to languages). After a simple change on paper. and even attend conferences to stay informed on new technology and design techniques. they don’t necessarily cover things I can talk about in this column. The output is a time lapse picture (model) of the building as it’s built per the schedule. Other vendors offer similar products. It’s available for free. I’d been capably scheduling both simple and complex projects. more complicated systems. For example. and keeping bosses and customers satisfied. handling problems. The book covers project scheduling. Looking back into the schedule.com . The construction schedule contains between 2. and it even helps to document what’s going on with simple projects. project scheduling. The drawings for the building are designed and available only in CAD format (paperless). Most are very detailed and specific on a topic and. It’s a good book even if you don’t schedule projects for a living. and someone trying to hang a lamp before there was a wall to support it. it’s great to see where marginal operation might be lurking. the output looked great. But.

Seems like a useful definition. The task was to replace an obsolete micro (National Semiconductor COP8) with a more current device (Renesas M16C28). This is a technology get-together between Renesas engineers. I talked Circuit Cellar’s founder. and end users like me and you (Circuit Cellar readers). I was sure they could and asked the factory. and moving C www.” within limits (like the same version. it was never repurposed. readers! WHAT’S NEXT? That brings me to the end of this month’s article. For that same medical project. I use UML as a drawing tool. Check out their state machine tools to lessen the burden of code generation. the company drew the charts by hand. Now that us software folks have gotten our hands on the topic we’ve bent the rules (probably actually broken most of them) to suit our purposes. I use Source Publisher more because it seems I can generate code (both typing and cut and paste) faster that I can keep track of that code. So. capacitive touch. If you’ve got a large legacy system written in C. and it even helps to document what’s going on with simple projects. Another feature of Understand is it can generate flow charts directly from your C code. It’s not easily ported. which said “yes. One of the sessions was about software design. into letting me write a column on C language. Well. Previously. Since I’m using the diagramming portion of the product. code from CPU to CPU was not all that difficult. I believe it is held every two years. and if you have a chance to attend one. experts on the panel just how we were going to accomplish that one. I use Source Publisher and Understand from Scientific Tools. and RX610 evaluation board presentations. What I was doing was really a command processor. C has become the primary language for coding. as well as an enterprise version. I had quite a chuckle. you can give that to the program and you will get a dictionary of variables and procedures. It helps me think through problems and present information to others.com • DEVCON 2010 I attended DevCon hosted by Renesas last Fall. Well. I suspect that state machines were invented and implemented in hardware with rather rigid formal definitions. I use simulation quite often. in a reasonable amount of time). is quite a different product. Was it to just work longer hours? They didn’t have a ready answer. but they did suggest the use of an RTOS with all of its support and automatic code generation from UML and other sources. he trusted that I had something to offer. This feature alone saved several man-days of work right at the end of the project when everyone was pushing for results. Since we are friends who have worked together for several years. It has a basic package for a single-user personal version. companies that support Renesas devices (as in RTOS vendors). So. IAR was on the panel. They were correct. Good job. I could just press a button and I had a PDF representing the flowchart for the procedure. I use No Magic’s MagicDraw package. CODE VALIDATION What is an embedded system? A good (useful) definition I recently heard was that an embedded system is a system where the original programming never changes. the flow charts show improved organization. This fourday conference involved lectures and classes during the days. and meals and keynote speakers in the evenings. and structure and the scope of projects has grown. the nicely structured printout and highlighted nature of the output helps me keep up. Sophisticated libraries are now matter-of-factly referenced in articles. I did that. I sat in on the TCP/IP. Of course. the code needed to be validated. setting upgrades aside. for a given routine you’ll get who and where it’s called and which routines are called by that routine. he liked the article and said that was exactly how he did state machines except for a slight difference in how he implemented the timers. Some say about 25% to 30% of us are using C and the percentage is growing. after the article was published I got an e-mail from the fellow who actually did the closing ceremony for the recent Olympic Games in Canada.circuitcellar. so I changed my article to reflect their input. The other fact is that the systems are getting more complicated and time to market is shrinking. It was the assembly code that caused all the gray hairs. It’s a must for complicated projects. solely as a result of my efforts (major joke here). This became most useful on a recent medical project. the simulation shows the gain and bandwidth for each of the system’s functional blocks. UML This brings me to the Unified Modeling Language (UML). it’s well worth the time. I have talked about that before and suggested you look into getting started using UML. Well. with Understand. I asked all the C CODE Several years ago. On the messaging system I’m working on. And that meant testing the modules against a flowchart. So the system has one purpose and. USB. I think that it will just CIRCUIT CELLAR® 57 March 2011 – Issue 248 . and they offer such products. and its usage is dropping over time.machine properly. Steve Ciarcia. No sales personnel were allowed. Also. Understand. Marketing studies report C is the predominate language for designing embedded systems. why not go all the way? I’ll keep you posted. He went on to explain his work represented the largest CAN network ever implemented. In all seriousness. check out the quality of the code and flowcharts in the latest issues. That shouldn’t surprise you. Several readers have asked me if they could upgrade from the personal version later for the difference. My assignment for 2011 is to upgrade and try the automatic code generation feature. C++ comes in less popular.

elekto r.Canada Kick microcont off 32 pages ofAudio DSP lay Unilab V/I Disp yper PCB Protot router ers rocontroll for small mic l PCB A professional extensions with optiona $ 7.elektor-plus-usa.e. www.com also supplies the most extensive Elektor search engine found on the web (all issues since 1998).ollers [Microcontrges a learn +p 50 ild & bu & Embedded Analog l Audio Digita rement] Test & Measu 2010 June e suring Softwar Free Audio Mea s [Microcontrollers ge & Embedded Analog l Audio Digita rement] Test & Measu r 2010 Septembe a rn + p lea 50ild & bu it simulation focus on circu elektor.com ] Measurement hom ers & r [Microcontrollge Tless electricity Digital Radio Scanne N Unit 32-pa wire Elektor DSP ME Multi-Effects E RE LE rable 15 configu cts sound effe e-made tags Embedded 2010 December F PP SU The Elektor Antennas and Give your Extension InterScepterports) for you rs (and opens doo Cas 20 GUID epro 10 Elektor Project E jects le grace withBEDDED EM the roller projects simp PC Softwar e www.com where the three latest editions of Elektor magazine are available in PDF files (i.com rface DMX512 Inte LiPo Balancer Starry Night car no-wheels Simulator tronics elec elektor.com Board $ 7. the current issue and the two preceding ones).com! or-plus-u kt www.95 .elektor-plus-usa. With a simple click you download the complete edition (front to back!) or any single article.95 .ele .95 US $ 7.95 - The upgraded Elektor PLUS subscription! All 11 issues including the Summer Circuits edition Included in your PLUS subscription: Annual DVD 2010 50% cheaper than normal retail price Up to 40% discount on selected Elektor products Elektor is delivered to your doorstep every month Read your copy before everyone else NEW: On your personalized Elektor PLUS website. you have permanent access to the three latest editions of the magazine in PDF format. NEW: access to exclusive sa.Canada r NetWorke er serv ed web An advanc ro with a mic er LED 50-watt Pow r tem Monito Heating Sys ic PC Fan Stroboscop Canada $ 7. as well as to a fast Elektor search engine! Your Elektor PLUS subscription gives you exclusive access to the new website www.95 US $ 7.95 US $ 7.

I’ve threatened to design a spring tester because I need one. prototyping. how about a radio that functions like a VCR recording your favorite programs? As you can see. and remote control systems.com/dispatcher. | www. develop a style for your C code. with a specification and interaction with the user. he set out on his own and co-founded a design and manufacturing firm (www. I hope some of the projects will interest you.net) began his career in the aerospace industry in 1969. And then. After five years at a real job. That has potential. 2007.com • Design Works Team. and such of her crate as she travels on the airplane. Addison-Wesley Professional. and testing.be a waste of paper and ink for me to continue to focus on C code in my articles. If that didn’t make sense. George is a charter member of the Ciarcia www. Project Management for Mere Mortals.embedded-designer. make all your tasks the same priority. keep all your #defines IN_CAPS. data acquisition. stayed tuned. acceleration.php Understand software Scientific Toolworks.circuitcellar. If you’ve followed these articles closely. I have not talked about pointers to arrays of functions. I George Martin (gmm50@att.com CIRCUIT CELLAR® 59 March 2011 – Issue 248 . | www. Baca. but you have the foundation to do that on your own. He is currently working on a mobile communications system that announces highway information. I will start presenting complete projects. I’ll start simply.com). RESOURCES C. I compete in the shooting sports. but you should be well on your way.nomagic. Next. I’ll then move on to system design. SOURCES Magic Draw No Magic. Or. graphical input and output. so perhaps there’s a project hidden there. Until then. drop me a line and I’ll add it to the list. By now I’ve covered all you need know to get a project up and running in C. hardware/software design. His designs typically include servo-motion control.scitools. our plate is filling up fast. and acquire and release your shared resources in the same order across all your tasks (alphabetical order is a good one). Inc. with all the fuss about body scanners at the airport. how about a radiation monitor? I also picked up a Texas Instruments MSP430 watch development platform. pressure. But we just recently sent a show dog off to be bred and I thought about recording the temperature. If you have anything that piques your interest or curiosity. you might not have your black belt in C. Inc. He is also a nationally ranked revolver shooter.

Here you learn how to use a linear shunt regulator for low-current applications. A fixed current requirement is the easiest to design for. while the leakage current is the minimum current to sustain regulation.2 to higher than 200 V! Therefore. In this article. the series resistor is sized for the combination of the Zener current and the additional circuit’s current. It seems like a waste to use a power supply that can eat up more current while idling than your circuit requires. Once the Zener diode has sufficient reverse (leakage) current flowing. I’ll explain how Supertex has improved on the idea of using a linear shunt regulator like a Zener diode for low-current applications.com .circuitcellar. CIRCUIT CELLAR® • 60 www. As long as the Zener diode current remains within these limits. its voltage drop will remain constant until too much current destroys it. if the additional circuit current will vary. However. and you can do so without bulky transformers or having to worry about heat dissipation from those series resistors normally required to drop the voltage down to a usable level. To use this type of circuit. You can steal small amounts of current directly from the AC line. the voltage across the Zener diode will remain regulated to the manufactured specification. a circuit placed across the Zener will be held to that Zener’s voltage as long as the aforementioned rule is not broken. it doesn’t make sense to implement a power supply that might consume more current than the circuit requires. you need to know the additional circuitry’s current requirements.F ROM THE BENCH by Jeff Bachiochi (USA) Direct Line Connection When You Don’t Require Line Isolation If you’re using a low-current microcontroller and your circuit’s total power consumption is minimal. W ith today’s low-current micros able to chug out the MIPS at a handful of milliamps. total circuit consumption can often remain low. When placed in parallel with the Zener. Zener voltages are available from 1. the current through the March 2011 – Issue 248 Figure 1—Providing a Zener diode with a minimum of reverse current produces a constant voltage drop equal to its Zener voltage. The circuit in Figure 1 has been used for years to regulate small currents. Any load placed in parallel with the Zener will have the Zener voltage as its source and will share the series resistor’s current with the Zener. The Zener diode’s wattage determines the maximum current through it. The remainder of the source voltage must be dropped across its series resistor and the resistor’s value sets the current flowing through the Zener.

diode. Since the source voltage is varying (AC). When the load is not using any current. By rearranging this familiar formula for finding the capacitive reactance of a capacitor (i.05 A = approximately 2.com • Figure 3—If you add a switch. the switch shorts the rectified output. make sure there is still a minimum current flowing through the Zener or it won’t regulate properly. When the load requires no current. When the load requires current.e.3 W of heat must be dissipated (i. When connected to a 12-V supply. This is analogous to minimizing output ripple. and at a current of 50 mA. A large value resistor placed across the AC capacitor will safely a) b) Figure 2a—By substituting an appropriate (AC-rated) capacitor for the series resistor. Since the Xc is imaginary.circuitcellar. This produces a bit of overshoot to the regulated output. An internal voltage divider provides three preset taps for 6 V/12 V/24 V regulation. This discussion is about connection to the AC line voltage. www. In this case. That’s about as hot as a Christmas tree-sized incandescent night light! Using a 10-W resistor to dissipate this heat is bulky. Refer again to Figure 1. the resistor is 2.e.. and will potentially require you to handle ventilation issues. Adding a switch to the input is one way to eliminate this waste.7 W of heat that will need to be dissipated (114 V × 0. The voltage across the series resistor will be the difference between the supply and the Zener voltage. Note that we need to add a few more components to the basic circuit. Enter the Supertex SR10.200] = 2 µF). The SR10 contains an internal FET switch and the control circuitry to maintain a regulated voltage output (VOUT) to the load. When the current through the additional circuitry is minimal. The SR10 uses synchronous switching—that is. this is wasted power.200 Ω (i.200 Ω (i..AC/DC We need to rectify the AC line voltage to change the alternating voltage of the source into rectified DC.. 114 V/0. about 6 V will be dropped across the series resistor. You can minimize overshoot by sizing the output capacitor correctly. we have a trick we can use to cut down the wasted energy we drop across the series resistor. Zener must vary in a complementary way because the series resistor current remains constant. The diode prevents the output capacitor from discharging during this time. surplus input current can be eliminated by shorting out the source. Connecting one of these taps to the feedback pin provides an input to the SR10’s comparator which controls the FET’s state. Figure 2 shows the substitution of a capacitor for the series resistor in the original figure (half wave) and the addition of 1N4001 diodes for full-wave rectification. And when the additional circuit current is maximum.2 kΩ. the switch opens and allows current to flow into the load.3 W). in sync with the zero crossing). The diode prevents current stored in the circuit’s output capacitor from discharging through the shunt FET when shorted to circuit ground.2-V Zener diode.7 W). The user may substitute an external voltage divider to obtain a VOUT other than one of the available internal presets. the FET only turns on when the source voltage is low (less than VSYNC. there is no dissipation. In the aforementioned case. In Figure 3 this switch is realized using an FET and a diode.. the total design current flows through the Zener diode. 114 V will be dropped across the series resistor. Xc = 1/[2πfc]). This means that the current may not get diverted from the load for some time after the VOUT has exceeded its regulation point.05 A = 0. we found that the Zener and the load share the circuit current. All that’s necessary now is some device to control the FET so the load remains at a specified voltage. we get C = 1/(2πf × Xc).e. and we can determine what capacitor will have a capacitive reactance of 2. CIRCUIT CELLAR® 61 March 2011 – Issue 248 .05 A = 5. b—The addition of a full-wave bridge allows the Zener diode to regulate during both half cycles of the AC source. make sure the maximum Zener current isn’t exceeded or the Zener will burn up. When connected to a 120-V supply.e. 1/[2π × 60 × 2. At a current of 50 mA. 0. This situation exposes the user to a shock hazard at the plug. that’s 5. But let’s not get ahead of ourselves here.2 kΩ). the Zener current is regulated by the capacitive reactance and the Zener diode will regulate it during the positive half (wave) cycles of the AC source. Previously. and output capacitor. The current through it is the total of the Zener current and the additional circuitry’s current. The 1N4735A is a 6. 6 V × 0. taking up valuable real estate. We can replace the series resistor with a series capacitor where capacitive reactance is as follows: (Xc) = 2. Note that the series AC capacitor will remain charged when the source voltage has been removed.

1 to 0.3″. the circumference would be reduced to 4″ (16 LEDs × 0. The FLAGS register holds a direction indicator (bit) for each CIRCUIT CELLAR® • www. I started this design by deciding what the maximum size of the ring of LEDs could be. I went with the easiest to assemble. the load is not at a neutral potential. each around the perimeter of a 2″ disk. This way the same code can be used for each PWM. If you refer to the half wave rectifier in Figure 2a. a PWM value. I could almost fit 16 LEDs (i. Each LED therefore has its own set of registers. I can use LEDs with body diameters of from 3 to 10 mm (approximately 0. To keep with this modular idea. a PORT pin bit mask. I strongly suggest using an isolation transformer between the AC line and your circuitry if you are planning to probe around with a grounded scope.3″. so one shouldn’t depend on it being at ground. any exposed chassis screw creates a safety hazard. It is dangerous enough working with line voltages. and a position mask for the FLAG register. If the nonpolarized plug is plugged in so the hot wire is connected to the appliance chassis. that also means the pin pitch would be 0. adding or subtracting a few LEDs would be easy. To do this. While the SSOP-28 is almost twice as small.3″/0. For a 4′ model of a lighthouse. for an increase of around 1″ in diameter.com . Thus. While Heat dissipation is a concern for any product. this is a good attempt at preventing disorientation. These are becoming popular as are scale-model windmills.6 mm). the reason for making two wire plugs (and outlets) polarized by widening the neutral prong.25″ = 4″) or a diameter of about 1.75″). I was looking for a way to power a small circuit I designed to mimic the rotating beacon of a model lighthouse (see Photo 1). so take extra precaution and prevent damage to your test equipment by paying attention to what is and isn’t ground. If I place 10-mm-wide LEDs needed a way of assigning each PWM to a particular bit number on a particular port.. The circuit uses a ring of high-power white LEDs to simulate rotation without actually having any mechanical movement. When using a full wave rectifier as in Figure 2b. If I kept the design fairly modular.67 mm. If I wanted to use T1-3/4 LEDs (5. might be at a hot or neutral potential.Photo 1—Here is a typical scale-model lighthouse used for decorative landscaping. As you can see in Figure 4. Using these would increase the outside diameter of the assembly by two times their height. you may have to get rid of 5 to 10 W of wasted power if you don’t take some measures to eliminate it. depending on the rotation of the plug.e. 62 March 2011 – Issue 248 LED is driven by its own PWM. This is really tough to hand solder. So. To give a smooth rotational appearance. The SR10 incorporates everything you need to produce a compact line operated small current source. I made extensive use of indirect pointers. I used the familiar five-pin ICD header to allow using the debugger/programmer.circuitcellar. It is mounted on the underside of the PCB below the PIC and offers a convenient way to power the circuit from the SR10 circuitry. In the case of stealing small currents. I could always mount the 10-mm LEDs by spacing them away from the disk’s edge. Never remove or circumvent the third wire in a three-wire power cable. somewhere around 2″ is a reasonable ring size. While this AC capacitor self limits short circuit current. I picked a SOIC-28 pin Microchip Technology PIC18F2431. the input can be fused should you require catastrophic failure protection. It is a diode drop above the neutral wire (ground).4”). The circumference of a 2″ diameter circle is approximately 6. Many old nonpolarized two-wire appliances used a metal chassis connected directly to one side of the line and. PROJECT POWER bleed off this charge without adding any significant power loss. you’ll notice that the load is connected to neutral. this can actually be at some potential other than ground and presents a safety hazard. 13 mm. I HOT CHASSIS While the neutral side of a twowire AC main is supposed to be at ground potential.4″ = 15. With this smaller (diameter) disk. since I wasn’t forced into the smallest size by lack of real estate. the addition of a third prong assures a completely separate earth ground. which will interconnect through this header (more on this in a bit). 6. a PORT address.

With a resolution of 256 bits. that’s right over Linear actuators $89. FLAGSH 0 16 0 15 0 14 0 13 0 12 0 11 0 10 0 9 FLAGSL 0 8 0 7 0 6 0 5 0 4 0 3 0 2 1 1 LEDs Figure 5—Two 8-bit registers create a pattern generator. then the Ramp routine will reduce the PWMx value for LEDx by one until it reaches zero. A 0 will dim the LED. By periodically shifting all of the bits. With 16 LEDs. two byte registers are required with direction bits for LEDs 1 through 8 in the first byte and for LEDs 9 through 16 in the second byte (see Figure 5).Robot Kits Line followers Mini-sumos Robot arms Save 10% with coupon code CCLLR3PI78 3pi Robot High-performance.pololu. front panels & more! .e.$109.288 ms).com • 1-877-7-POLOLU www. every LED will have its chance to turn on. Yup.$9. ATmega328P-based robot $99.com CIRCUIT CELLAR® 63 March 2011 – Issue 248 Laser cut your own custom chassis. www. To go through this once for all 16 LEDs requires 185 µs. LEDx is turned OFF unless PWMx is greater than PHASE. then the Ramp routine will increase the PWMx value for LEDx by one until it reaches 255. in which case it will remain at zero (value of 0 = 0% PWM). Each LED will illuminate when its associated bit is a 1. The DoPWM routine compares each of the PWMx values to the present tick counter PHASE. LED.95 . in which case is will remain at 255 (value of 255 = 100% PWM).95 Electronic Parts Sensors & controllers Discrete components Cables & batteries QTR reflectance sensors $2. If a bit “x” in the pattern generator is 0. The time for each tick is based on the amount of time it takes to execute the DoPWM routine. and then LEDx is turned ON. a ramp up (or down) will require approximately 12 s (i.95 (with Arduino support) Item #975 Mechanical Components Motors & servos Wheels & ball casters Chassis & more! Pololu Wheels $6. If a FLAG bit is 1. These FLAGS are the keys to how this works.360 µs) for a single loop of the PWM PHASE cycle.98 .49 Pololu Simple Motor Controllers $31. The total operating current for this circuit is 15 mA. 48 ms × 256 = 12.95 Figure 4—The rotating LED beacon contains 16 LEDs driven off of the PORT bits of a small SMT microcontroller. C-programmable..95 Custom Laser Cutting & Solder Paste Stencils Both starting at only $25! Use our low-cost plastic solder paste stencils to quickly assemble your surface-mount designs.$59. This means it will take ~48 ms (256 × 185 µs = 47.circuitcellar.95 . Using 256 values means that PWM resolution is 8-bit or 256 ticks to be able to present all of the states between 0% (OFF) and 100% (ON).

one change) the change in circuit as previously used for the LED disk. No lighthouse I know of has a rotation often used in high-voltage AC circuits because they have cycle of minutes.circuitcellar. it’s 14% (i. humans require about an 8% change to unsuitable candidate for SMT. you might use this approach to assure preBULB HOUSING cise control of a loop. And. and understand and debug. suitable container. this will insulate all dangerous (line requires 48 ms.e. For 3 bits. the relative brightness to perceive a change has occurred. I used just plain straight-line code. 100%/7) houses built for outdoor use have a standard (Edison) and 6. To build the stacked This can easily be set to anything between 1 and 10 seccolor-coded display I shopped the grocery aisles for a onds by using larger reload values. First. Instead of used outside. I drilled a 1″ hole in of complexity to code that can make it difficult to the cover. The more than a few seconds. I decided to recode the application using neither modular code nor indirect pointers. it needs to have some protection from the using the execution of the program to determine the elements. CIRCUIT CELLAR® • www. The strated how to use an FTDI FT245R USB parallel port as minimum time here is approximately once per second. I challenged my ability creating used quickset epoxy glue to hold the base onto the cover. The want to enclose all the circuitry into a sealed unit for PWM PHASE cycle now takes 3 ms. than an equivalent incandescent? The base of this bulb If we take the preceding timings and recalculate for 4will become the base of my rotating beacon module. Film capacitors are s × 16 = 192 s). The candelabra base is to use data in a clever and flexible way. Table 1 is a comparison of the two versions of code. The straight-line code was quicker to write.. I that’s necessary to fool the human eye into squashing removed the (burnt out) guts of a compact florescent together the incremental change over time and have it bulb.” Circuit Cellar 229). I bit PWM resolution. we get some new numbers. You can avoid math if you take advantage of the CS selection 12 seconds. 100%/[states-1] = 100%). stuck the base through from the inside. increase in execution time by making use of loops and modular code.com . ultimate loop time. three changes) that would holes and a mating connector. Thankfully. except in the selection of the series AC capacitor’s value (see Figure 6). This is a perrequire using a through-hole part. we can described how to build a threat-level display (“Threatincrease the loop time and slow down the total rotationLevel Indication System. Less than once per second is too fast. It uses a brightness is 100% (i. a PC-connected output device..e.Version Indirect pointers with modular code HEX (file size) 2K DoPWM (time µs) 185 CURRENT SOURCE 64 March 2011 – Issue 248 Designing with the SR10 is simple. Ordinarily. Most components including ging. A more suitable time would be no a lower ESR. and was far easier to understand the optional fuse and bleeder resistor can be SMT parts. they add a level firmly attached to container’s cover. By increasing the timer reload value. For 2 similar diameter round PCB with alignment mounting bits of resolution (four states. Is it my imagination or do these last fewer hours perceived as continuous. I demonal cycle time to the timing we’re trying to emulate. This produces a rotational cycle of 768 level) connections from the user. the application was simple enough that it didn’t involve too many hours of cleverness. large physical size of these capacitors makes them an As it turns out. When finished. this modular code. 4 bits is all E26 candelabra base socket for an incandescent bulb. Since we want all 16 LEDs to go through this cycle. While they allow one protective case for this project. This same container made a perfect Indirect pointers can be useful.6% for 4 bits. we can insert a timer into the loop. which minimizes internal heating. since it will be ms. fect example of keeping things simple. it might component selection is common for all circuit not be the best direction to take in every application. I had to sit back and ask: Was this complication worth the trouble? To help me answer this question. While there are some decisions you need to make Straight-line code 3K 59 about which additional components you want Table 1—While these results show the typical reduction in code size and the to include to complement your application. Assuming linear changes. The large physical size of C S may than the modular code. Most scale model lightbe 33% change per bit. The ramp time now two reasons. In this case precision isn’t the You might recall my August 2009 article in which I goal. needed less debugFigure 6—The SR10 circuit requires few external components. that brings the rotation to over 3 minutes (12 chart found in the SR10’s datasheet. varieties. I used the same PCB form factor for this power supply At 1-bit resolution (two states.

com WHO KNOWS? I’d like to thank all the readers who’ve responded with suggested manufacturers for the old electrowww.e. Inc. The series parts are socketed. you may have to get rid of 5 to 10 W of wasted power if you don’t take some measures to eliminate it. At first. His background includes product design and manufacturing.bachiochi@imaginethat now. You can reach him at jeff. PROJECT FILES To download the code.supertex. It seems there are a lot of readers out there who are experts in minutiae. There are jumper selections for full/half wave as well as output voltage. as shown in Photo 1. Who knows where the “T” designation (i. “Recharging Portable Devices: A DIY Power Adapter Design” (Circuit Cellar 244). “Fog horn?” The SR10 power supply PCB connects to the AC leads coming up from the candelabra base. For the best results.com or at www. Supertex offers the SR10DB1 (demo board) for those who wish to play with a PCB of the SR10 circuitry. especially from a distance. | www. I thought I’d make this a continuing exercise for those of you who might be privy to the answers of some curiosities. or in this case 22.Photo 2—This project can replace the standard light bulb used in a scale model lighthouse.com • CIRCUIT CELLAR® 65 . In the case of stealing small currents.5°. I’ll call it: “Who knows?” Let’s start off with a question that popped up during the background work phase of this project. But in the end. SOURCES March 2011 – Issue 248 PIC18F2431 Microcontroller Microchip Technology | www. T – 1¾) came from when used to describe the size of LEDs and small incandescents? I HEAT AVOIDANCE Heat dissipation is a concern for any product. The SR10 incorporates everything you need to produce a compact line operated small current source. use an LED that has a viewing angle of at least 360°/LED count. go to ftp://ftp.circuitcellar..imaginethatnow.microchip.com. I tried a translucent cover by sanding the plastic surfaces of the container to reduce the point source nature of the LEDs. Can you say. Photo 2 is the finished project. so you can easily substitute components of various values. I determined the clear cover offered higher visibility.com SR10 CCSS Regulator Supertex. optical device I mentioned in my November 2010 article. It fits in the candelabra’s plastic shell and provides 5-V power to the LED PCB through two pins of its solder-side ICD connector. Jeff Bachiochi (pronounced BAH-key-AHkey) has been writing for Circuit Cellar since 1988. This gives these works of art a more realistic source of light for guiding lost wanderers home to port.com/pub/ Circuit_Cellar/2011/248.circuitcellar. So.

and field-programmable 8-byte ID. 128 bytes of EEPROM.768-kHz “watch crystal” or digital equivalent. but the ’794 goes beyond simple timekeeping with the addition of key features. Depending on the model (see Figure 2).S ILICON UPDATE Time Traveler by Tom Cantrell (USA) Embedded Timekeeping and More Imagine if electronic gadgets couldn’t keep track of time.5 V. there’s a clock. T March 2011 – Issue 248 he datasheet for the Microchip Technology MCP794xx real-time clock/calendar (RTCC) is just 20 pages long. Fortunately.circuitcellar.5 V. ’794 design-in is blessedly easy (see Figure 1). the ’794 RTCC integrates other handy features including 64 bytes of EEPROM. the ’794 extras include 64 bytes of SRAM. there’s more going on under the hood than the datasheet’s brevity might imply. respectively. As its name implies.com . VSS and VCC are the main supply. clock waveform. Other RTCs have some of these X1 Oscillator RTCC VDD Time stamp/alarms SRAM MFP X2 VBAT VBAT Switch I2C SCL VSS EEPROM ID SDA Figure 1—In addition to keeping track of the time and date. It’s really the features under the hood that make the ’794 unique. Nevertheless. SCL and SDA are the I2C bus connections to the host. or general-purpose output. which can be anything between 1. there’s a calendar. yes. VBAT is the battery back-up supply. that would put a crimp in our style.8 and 5. Wow. Let’s take a closer look. with a little help from a quartz crystal (or. and a factory. and a factory or field-programmed ID. Pins X1 and X2 are the connections for the ubiquitous 32. and. Yes. there are chips that can keep on ticking while they take a licking. perhaps a silicon MEMS equivalent). With just eight pins to deal with. the multi-function pin (MFP) can serve as alarm. these days. typically a 3-V coin cell. 64 bytes of RAM. Do note that the maximum speed of the I2C interface depends on the operating voltage—100 kHz or 400 kHz for VCC less than or greater than 2. Those of you who’ve worked with RTCs lately will recognize that the ’794 pinout is kind of a de facto standard that’s been adopted by a number of suppliers. CIRCUIT CELLAR® • 66 www.

with power consumption an order of magnitude higher than other memory accesses (3 mA versus 300 to 400 µA for EEPROM read and SRAM read/write). But a look at the chip pricing reveals the EEPROM costs only a nickel or so (e.. On the supply side. One other EEPROM write issue to keep in mind is the special “writebusy polling” technique used to Send EEWrite command Send stop condition to initiate EEWrite cycle Send start Send control byte with R/*W = 0 Did device acknowledge (ACK = 0)? Yes No . 5 ms) to write a single byte as it does an 8-byte page. Plug the numbers into the www. the ’794 tweaks the I2C protocol to use “ACK polling” to check if an EEPROM write operation is complete. so chances are you won’t have to worry about the EEPROM giving out before the battery does.e. Better yet.. it’s included in the 700-nA spec). but would be sorely missed if you do.g. CIRCUIT CELLAR® 67 March 2011 – Issue 248 calculator and you come up with a back-up time of some 342. there will be losses (battery self discharge) and environmental considerations (higher voltage and higher temperature equal higher current) that need to be factored in.. At the same time. the other realitycheck for an RTC is the battery’s power.. If indeed EEPROM write power consumption happens to be a concern (energy-harvesting apps come to mind). when the main supply (i.com • Next operation Figure 3—Instead of a status register or pin. The ’794 has an 8-bit calibration register you can program to add or subtract up to 127 clock cycles each minute. but otherwise idle. page writes are more I2C efficient (i. power consumption drops to a few microamps.74 for the ’79401). EEPROM writes stand out. the typical power consumption in battery back-up mode is 700 nA. ’0x instead of ’1x parts) since backing the SRAM up is essentially “free” from a power perspective (i. SRAM • EUI-48 MCP79412 • EE.g.857 hours. the CR2032. but none of the others I’m aware of have all three. less time and power) since one 8-byte transfer requires far fewer clocks than eight separate single-byte transfers.. The long-life expectations had me asking about the other shoe that might drop—namely.e. Perhaps you can just get by with the SRAM (i. the 700 nA (i. security) that would be well served by knowing when a power failure occurred and how long it lasted. Calibration is another feature you may not need. 10 years). or nearly 40 years! In a real design. SRAM • EUI-64 64 Bytes No EE 64 Bits MCP79400 • SRAM • Blank ID MCP79401 • SRAM • EUI-48 MCP79402 • SRAM • EUI-64 64 Bytes Blank EUI-48 EUI-64 Unique ID programming Figure 2—The ’794 lineup encompasses variants with and without EEPROM and with or without factory-programmed ID (“Extended Universal Identifier” in IEEE-speak). a popular 3-V lithium coin cell. it stores the time and date when VCC failed in battery-backed registers. For instance. It’s not hard to imagine applications (e.e. specs capacity as 240 mAh (to 2 V). There’s no spec in the datasheet. ’79400 is $0. VCC) fails.. that time and date is stored in a separate set of registers.e.EEPROM ID Memory and programming options SRAM 1 Kb 64 Bits MCP79410 • EE. so feel free to go ahead and splurge. SRAM • Blank ID MCP79411 • EE. the ’794 automatically switches to the battery back-up supply (VBAT).circuitcellar. Furthermore. According to the ’794 datasheet. it’s worth noting that according to the ’794 datasheet it takes the same time (i.e. But in a fully battery-powered application. ask yourself if you really need the EEPROM at all. EEPROM data retention. All the more so to the degree your application is subject to temperature extremes and requires long term accuracy. When the chip is powered by VCC. which works out to a range of ±11 seconds per day (±67 minutes per year). active power consumption could be a consideration.. And the higher current is required for a relatively longer time since it takes 5 ms (typical) to write the EEPROM versus tens to hundreds of microseconds (dictated by the speed of the I2C bus) for other memory accesses. features. Besides accuracy. but the point remains that a typical battery will probably last quite a while (e. refrigeration. There are some other less obvious embellishments that may not seem like a big deal..000 units versus $0. when VCC is restored.e..g.68 at 1. In an otherwise mains-powered application. so I sent off a query to Microchip and was informed they claim the bits will last 200 years! Write cycle endurance is a healthy 1 million cycles. VBAT) spec is the only one that matters and concern about the active power consumption is surely much ado about nothing. until you find out you need them. Similarly.

0x11–0x16). the OSC On (OSCON) bit is set and cleared by hardware to indicate whether the oscillator is running. some 68 March 2011 – Issue 248 www. minutes. the “real-time” will start getting “unreal. Patience.Do not use Year Month Date Date Month Reserved Year Seconds Minutes Hours Day 01h 01h 01h 00h 00h 00h 00h 01h 01h 01h 01h 10 Seconds 10 Minutes 12/24 10 Hours AM/PM ALM1C1 10 Hours ALM1C0 ALM1IF Seconds Minutes Hours Day Date Month Minutes Hour Day ALM1POL ALM1C2 10 Minutes 12/24 Day 10 Hours AM/PM 10 Dates 10 Months Reserved . together. Address 0x03 combines the day of the week (one to seven) with three important status and control bits. the easiest way to explain all the features and functions is to go through every single register bit by bit (see Figure 4). The next bit.12 00h 00h 00h 01h ALM0C1 ALM0C0 10 Dates 10 Months Reserved . VBAT Enable (VBATEN) determines whether or not the automatic switchover to VBAT occurs when VCC fails (i.e.” As an aside. Notice there’s no provision for keeping CIRCUIT CELLAR® • TIME HAS COME TODAY Since the ’794 is such a simple chip.59 1-12 + AM/PM 00 . month. read/write. once you start the clock running you’ll want to be very careful about stopping it intentionally or inadvertently since. some read-only. you’ll find the ST control bit. Needless to say.99 Day Date OUT LP 10 Years SQWE ALM1 10 Dates 10 Months ALM0 EXTOSC CALIBRATION Month Year RS2 RS1 RS0 UNIQUE UNLOCK ID SEQUENCE 10 Seconds 10 Hours ALM0IF Seconds Minutes Hours Day Month Year Control Reg.59 RESET STATE 00h 00h 00h 01h 01h 01h 01h 80h 00h 00h 12/24 10 Hours AM/PM OSCON 10 Hours VBAT VBATEN Seconds Minutes Hours 1-12 + AM/PM 00 . is set by hardware when a power failure and VBAT switchover occurs. data. it falls below 1. If you turn on the oscillator with ST but it remains off as far as OSCON is concerned. Next up are the day.e. but you’ll have to confirm that in your own application. this is an opportune moment to lodge my generic gripe against packing various status. At the top of register 0x00.. and seconds).Address 00h 01h 02h 03h 04h 05h 06h 07h 08h 09h 0Ah 0Bh 0Ch 0Dh 0Eh 0Fh 10h 11h 12h 13h 14h 15h 16h 17h 18h 19h 1Ah 1Bh ST BIT 7 BIT 6 BIT 5 10 Seconds 10 Minutes BIT 4 BIT 3 BIT 2 BIT 1 BIT 0 FUNCTION Seconds Minutes Hours Day Date RANGE 00 .Do not use 10 Hours Date Month Reserved 00h 00h 00h 00h 00h 00h 00h 00h ALM1POL 10 Dates 1Ch 1Dh 1Eh 1Fh 10 Minutes 12/24 Day 10 Months 10 Hours 10 Hours AM/PM Month Month Date Month Date 10 Dates 10 Months Figure 4—The RTCC registers include time. once you enable battery backup. and year registers (0x04–0x06).31 01 .com . two alarms (0x0A–0x0F.. hours. it’s likely the crystal is broken. I’m wondering if this might be a bit “too clever” for typical I2C interfaces or firmware. It may not be a problem.59 1-12 + AM/PM 00 . Along with the ST bit.59 00 .circuitcellar. and data bits.12 00 . you’ll want to be very careful it stays that way.31 01 . Calibration Unlock ID Seconds Minutes 10 Minutes 12/24 ALM0POL ALM0C2 10 Hour AM/PM Hours Day 00 . VBAT. some write-only. control.23 1-7 01 . and power-fail and power-restore timestamps (0x18–0x1B. As with the aforementioned oscillator control bit (ST). Just don’t be fooled by the fact that there’s a bit of delay after setting ST before the appearance of the clock is noted in OSCON. more on that in a moment.12 00 . The first registers (address 0x00–0x02) are where the action is as they store the current time (i. It needs to be cleared in software. absent reinitialization.59 00 .5 V). grasshopper.99 00 . Finally.59 00 .23 1-7 01 . and control registers (0x00–0x09). 0x1C–0x1F).768-kHz oscillator. As its name implies. detect write completion (see Figure 3).31 01 . which is super important as it serves to ST(art) and ST(op) the 32. it gives you a hook for self test and diagnosis.23 1-7 01 .

Note that the general-purpose and square wave output options for MFP are only in effect when the chip is powered by VCC. track of the century—so. OUT sets the level on the MFP pin if you choose to use it as a general purpose output. right where you need it Software updates . 8. MFP reverts to its role as an alarm output. yes. there will be a “Y2.096 kHz. and 4.com • CIRCUIT CELLAR® 69 March 2011 – Issue 248 .1K” problem. This latest generation of PicoScopes features a deep memory of 32 M samples.. Writing a 2-byte sequence (0x55. A few jumpers. edge with hysteresis. The PicoScope 4226 and 4227 up the sample rate (250 MS/s Max) and add arbitary waveform generator and external trigger capabilities. Register 0x09 guards write access to the 8-byte unique chip ID.192. rather than crystal. and a few minutes are all it takes. EXTOSC allows you to use a digital. falling edge. 32.The new PicoScope 4000 Series high-resolution oscilloscopes Figure 5—The Microchip RTCC evaluation board provides a recipe for your own design. The frequency of that clock (e.e. When combined with rapid trigger mode.768kHz clock source.picotech.. drop out.capture. PC-based . pulse width. When running on the battery. slows the clock) or subtracts (i. once per second) is selected with the RS0-RS2 bits. Just add a crystal and battery and season to taste with a few discretes.0 Trigger Types Rising edge.circuitcellar. or both of the two alarms available. the chip does keep track of leap years for you with the LP bit.g. www.com/pco428 1-800-591-2796 Photo 1—An ARM mbed module and Microchip evaluation board make it easy to check out the ‘794. Register 0x07 contains a variety of control bits. view and use the acquired waveform on your PC.free software updates for the life of the product USB powered and connected perfect for use in the field or the lab Programmable . neither. Register 0x08 contains the calibration factor described earlier—it’s a signed 8-bit number that adds (i. you can output a clock on MFP by setting the Square Wave Enable (SQWE) bit. However. 0xAA) to this register unlocks the unique ID PicoScope 4000 Series The PicoScope 4224 and 4424 High Resolution Oscilloscopes have true 12-bit resolution inputs with a vertical accuracy of 1%. a few lines of code. speeds the clock) the corresponding number of clock cycles once per minute. which is set and cleared by hardware.768. runt pulse..e. all read/write via software.supplied with drivers and example code Resolution 12 bits (up to 16 bits with resolution enhancement) Sample Rate PicoScope 4224: 80 MS/s Max PicoScope 4226: 125 MS/s Max PicoScope 4227: 250 MS/s Max PicoScope 4424: 80 MS/s Max Buffer Size Channels 32 M samples shared between active channels PicoScope 4224: 2 Channels PicoScope 4226: 2 Channels W/ AWG and Ext PicoScope 4227: 2 Channels W/ AWG and Ext PicoScope 4424: 4 Channels Connection USB 2. 32. with the ALM0 and ALM1 bits enabling either. There’s also no automatic adjustment for daylight savings time since that varies around the world (something Apple recently learned the hard way when iPhones used as alarm clocks woke up users in some regions an hour early and others an hour late). Alternatively. windowed www. this can capture up to 1000 trigger events at a rate of thousands of waveforms per second.

or page-write commands. Joking aside. three alarm control bits determine the exact alarm timing. so hardware automatically sets ALM2POL to equal ALM1POL. hour. the first thing your application should do after powering up is deal with them (e. The final two blocks of registers are for the power-fail (0x18–0x1B) and power-restore (0x1C–0x1F) “timestamp... minute. log the event in the SRAM) and then rearm. If you don’t need to use one or both alarms. Notice that timestamp resolution is minute-by-minute since there are no seconds fields.1K” problem. Decipher the ’794 register dump and you’ll see it’s 6:29:56 AM on November 8. you could set every bit in register 0x0A.. So. Notice that there’s no setting for years so you can’t set an alarm for 12/31/99 to warn of the imminent “Y2.g.circuitcellar. or day matching which is an easy way to generate periodic alarms. The ALMxIF bits are set by hardware to signal that an alarm has occurred until subsequently cleared by software. for example. The polarity has to be the same for both alarms. The fact the values you write to the registers aren’t limit checked by the hardware works to your advantage. Finally. Each alarm has a polarity bit that determines whether a 1 or 0 is driven on the MFP pin to signify an alarm. not between 0 and 59 using BCD coding). March 2011 – Issue 248 for writing using standard EEPROM byte. So. Options include second. even the most Rip Van Winkle of applications would be wise to wake up at least once a year to celebrate a birthday and make sure everything still works.e. 2010 and there was a 5-minute power failure from 6:22 to 6:27 AM.com . seconds to months) match. if the timestamps matter. even though the result (0x7F) is not a valid value for seconds (i. the timestamps remain latched until you rearm by clearing the VBAT bit (which was set by the power failure) in register 0x03. TIME CARD Microchip offers an RTCC evaluation board that makes it easy (and inexpensive at just $45) to see if their CIRCUIT CELLAR® • 70 www.Photo 2—You don’t need fancy software just to kick the tires. feel free to use the alarm registers as an extra bit of SRAM in a pinch.e.” which tracks the occurrence of power (VCC) outages. After a power fail and restoration. Register blocks 0x0A–0x0F and 0x11–0x16 comprise the date and time settings for the pair of alarms. Or you can specify an explicit date and time for an alarm to occur when all fields (i.

refer to my article. In the old days.. the board provides access to the key signals and includes the crystal and battery (there’s a coincell holder on the back of the PCB). etc. there’s a prototyping-friendly six-pin header on the other edge. SDA and SCL). For those who prefer to hook the RTC to something else.. I wrote register 0x00 with 0x80 to set the ST bit and start the oscillator.). a subsequent EEPROM read goes sour. It was a simple matter of plugging in some jumpers and hacking a few lines of code to get the RTCC up and running. 2009. but I wanted to be able to jump around. I just wrote an RTCC register and then read and displayed the contents of all of them.g. I edited and ran the program a few times to initialize the date and time fields.e. www.circuitcellar. the schematic shows the cast of supporting characters: capacitors for the crystal and power-supply bypass. Commenting out the register write statement and rerunning the program. Without the 5-ms wait statement after the EEPROM page write. SQWE. I was happy to see the clock ticking away. In the real world. Put in the wait statement and all goes well.” The first program was simple.com • CIRCUIT CELLAR® 71 March 2011 – Issue 248 . Hooking up a scope.” Circuit Cellar 227. make sure you accommodate the EEPROM write cycle timing. As you can see in Figure 5. after installing a battery in the coin-cell Photo 3—Whether using the Microchip I2C polling scheme or a software delay.g. “Easy (E)mbed: An Alternative Approach to Embedded Programming. Along one edge the board has connectors that are compatible with their MCU evaluation gear. a current limit resistor and blocking diode for the battery. It’s easy to just punch the key parameters (e. you’d take advantage of the ability to load the entire block of registers with a single multi-byte transfer. Finally. I might have taken more care to come up with an elaborate and full-featured test suite. The mbed C library includes routines for I2C bus access so no bit-banging required. (For more information.) The quick and easy mbed development environment encourages a casual programming style that’s great for experimenting.. I played around wiggling the MFP pin using the control bits in register 0x07 (e. But it turns out I needed nothing more than some simple code snippets to read and write the RTCC registers and memory to get answers to my questions. I happened to have one of the ARM mbed gadgets sitting on my desk and figured I’d use it to give the RTCC a test drive (see Photo 1). register address and write data) directly into the code and then “blow and go. and pull-up resistors for the open-collector I2C lines (i.chip can pass the test of time. OUT. As well. Next.

However.e. The PIC-based clock is connected to an ENC28J60 Ethernet chip.microchip. EEPROM. what about the “Y2. so in low volume.net SOURCES mbed Microcontroller ARM | www. The versions of the ’794 with a preprogrammed ID (i. it’s cheaper to buy some chips than pay IEEE a license fee. It was all pretty simple and there weren’t any real surprises. cycling the RTCC power (i. streaming MP3 music. Indeed.holder. unless you’re in a real hurry. dig under the hood of the mbed I2C routines. no harm in trying. on options).circuitcellar. board. Topics: Timekeeping.e.. In the computer applications industry..com or directly at microfuture@att. ’x1 and ’x2) are only a nickel more than the blank ID parts. Beyond the headline clock functionality. Inductance — ’Net-Enabled Alarm Clock by DJ Delorie Circuit Cellar 216. And there are some other subtle.g. The software delay worked fine.mbed. at well under a buck ($0.. I was a bit surprised there’s still seemingly a decent market for stand-alone real-time clock chips. informed engineers and programmers don’t just survive. The only real question I had left was about the special “write busy” I2C polling scheme described earlier. it’s always a good idea to verify write success in software (i. but fortunately. having Microchip personalize each chip with a unique ID simplifies your factory MCU flash programming flow. I Tom Cantrell has been working on chip.e. Remote Protocols — Go to Circuit Cellar’s webshop to find these articles and more: www.. Let’s see.000-piece quantities depending 72 CIRCUIT CELLAR® • www. I was also able to see the power-fail and power-restore timestamp feature in action (see Photo 2). Now plug in the VCC jumper and run the program again to display the SRAM data and make sure it survived the power cycle. 2008 DJ’s Internet-connected alarm clock provides three primary features: automatic time setting on power-up. and NXP) making the advanced MCUs. and while you’re waiting for the electrons to dissipate. read back and compare) just in case. pull the VCC jumper. take a moment to comment out the I2C (i. this exercise does serve as a reminder that.cantrell@circuitcellar.com NEED-TO-KNOW INFO Knowledge is power. Is the mbed I2C write routine actually waiting around for the ’794 to signal EEPROM write completion?) I was pretty sure that would not be the case. let’s just worry about it then.68 to $0. Just change the I2C addresses to point to the SRAM and the program writes a byte and then reads it back for display so you can make sure it got safely stashed away. their I2C routines played well together. Capacitance. 0xFF) or not so just go ahead and blast away. since RTC suppliers include the very same outfits (e.g. Microchip Technology. For example. so I hacked the code a bit to exercise the byte and page-write functions.... 2010 You must understanding a crystal’s properties to get oscillators working. You may reach him by e-mail at tom. accessing the EEPROM was pretty much as easy as SRAM since you don’t even have to worry whether a location is erased (i. and Conversion by Ed Nisley Circuit Cellar 241.81 in 1. unique ID) can justify the cost.1K” problem? Well. and how to convert the values into parameters for the model. and write/test/debug bit-banging code to manhandle the RTCC “write busy” protocol? Or should I just add a 5-ms delay in software after each EEPROM write command? Next question. Testing the SRAM is easy enough. I set the VBATEN bit (register 0x03) to enable automatic battery backup.com . and systems design and marketing for several years.org MCP7941x RTCC Microchip Technology | www. Real-Time Clock.com CLOCK JOCK March 2011 – Issue 248 Given that many modern MCUs include the functionality. but nevertheless real. To confirm battery backup works.e. Here you learn about a crystal’s circuit model. potential cost savings. STMicroelectronics. yanking the VCC jumper) I could see that time was maintained across power outages. Anyway. Topics: Crystals.cc-webshop. remembering to clear the VBAT bit (to rearm the timestamp) after each power cycle. Or perhaps you’re just making a few hundred gadgets that need a globally unique ID (e.. the Circuit Cellar editorial staff recommends the following content: — Crystal Properties Circuit Models. I’d feared the RTCC or mbed might get confused or hung up. SRAM. they thrive and excel. Should I hook up a logic analyzer to the I2C lines. MAC address). But wait. It must be the case though. For more need-toknow information about some of the topics covered in this article.e. Now I was wondering if the “write busy” polling might actually be working as intended out of the box (i.e. Measurement. Now.. My intuition was confirmed when I tried to write one EEPROM location and then another immediately with no intervening delay to discover bits were lost (see Photo 3).g. and remote management. how to measure a crystal’s properties. the extras (e. SRAM) write statement in the program and reload the mbed. but there have been plenty of times I’ve been surprised by stuff working when I had my doubts.

.

com . 4. 17. 10. 14.circuitcellar. 16. 6. 19.1 2 4 5 6 7 9 10 8 3 11 12 13 14 15 16 17 18 19 Down 1.com/crossword. Tcl. 5. 12. 3. 9.024 Petabytes Speaker for high-frequency sounds X Across 2.001″ Element in a “ground island” 1. Calibration. 8. Lisp. 1. 13. 7. CIRCUIT CELLAR® • 74 www. Fortran Minimum power delivered CR2032 is a standard Empty set size Schmitt 0. 18. 15.circuitcellar.000 Watt-hours [two words] Where electricity enters/exits a device Balanced/unbalanced OOK is on/off what? SiO [two words] 0 to 9. 11. used with main scale Quick fix Rust [two words] March 2011 – Issue 248 The answers will be available in the next issue and at www. Counter Measurement.

and more .7708 or peter@smmarketing. E-mail adcopy@circuitcellar.com/vendor/ is your guide to a variety of engineering products and services. and more information contact Peter Wostrel at 800... XE.TechnologicalArts.com with your file or send it to IDEA BOX. Wi-Fi. Stack. UART. Compact Flash. 512K RAM with Flash backup Plug-in I/O expansion.I DEA BOX THE DIRECTORY OF PRODUCTS AND SERVICES AD FORMAT: Advertisers must furnish digital files that meet our specifications (www. Vernon.us. Tower .com • CIRCUIT CELLAR® 75 March 2011 – Issue 248 Topologies Supported: Planar. Backplane.com www.com/advertise). XD. CT 06066.circuitcellar. Add Speed and Color to Your Instrument 1/4 VGA Color STN Display 16-bit HCS12 processor clocked at 40 MHz Touchscreen-operated GUI Dual RS232/485 ports. ALL TEXT AND OTHER ELEMENTS MUST FIT WITHIN A 2" x 3" FORMAT. For current rates. The Vendor Directory at www. D. including Ethernet.3741. XS Toll-free (USA & Canada): 1-877-963-8996 www. relays.circuitcellar. tel: 510-790-1255 fax: 510-790-0925 Evaluate * Educate * Embed Adapt9S12 Modular Prototyping System For education & development MCU Families Supported: S12A.circuitcellar.454. 978. 24-bit data acquisition. GPS. SPI and I2C ports 16 10-bit A/D inputs 512K on-chip Flash. C.281. PO Box 180. NE. E. USB. deadlines. Circuit Cellar.

com .& *" # * % # + % ' ( !)%" #!) ! "# $ % &% %&" 76 March 2011 – Issue 248 CIRCUIT CELLAR® • www.circuitcellar.

1 MaxSonar-WRC (IP67) ) Compact packaging Weather resistant Quality narrow beam $99.95 USD qty.com • CIRCUIT CELLAR® 77 March 2011 – Issue 248 .5V $29. 1 www.95 USD qty.95 USD qty.MaxSonar Perfect for OEMs & Engineers XL-MaxSonar-EZ High acoustic power Real-time calibration Tiny size $39.maxbotix.com www.95 USD qty.5V-5. 2.circuitcellar. 1 MaxSonar-WR (IP67) Industrial packaging Weather resistant Standard $99. 1 LV-MaxSonar-EZ Power-up calibration Smallest MaxSonar Low power.

UHF EPC Gen2 RFID Reader. Powerline Communication .UART-WiFi.

TRANSMITTERIDENTIFICATION— TX ID [two words] 15. P2P 14. and Programming Adapter for 8 to 40-pin DIP. SHIELD—A cover that protects users from high voltages 4. Software. with variable names that YOU create. Inc. USB Cable. PROPAGATION—Wave transmission N A 4 5 E 3 V V L A 7 S T H I E L 8 C 6 T R A N S M I L U A C O N U 15 R A D O M E T 9 10 T I O K 16 A P P E N D T T 14 B A L U N O 11 12 13 I L T T E R I O P O T R A N S M I X S D E N T I F I T F I T D E C A T I C E S O N W I T 18 Q U A R T Z 17 G R 19 L O I E S F O N L A M E N T P R O P A G A T I U N D Created with EclipseCrossword . and components at: PICBASIC PRO™ Compiler $249. RX—Receive 13. $%  . This is a true compiler that produces fast.circuitcellar. VOLATILE—Memory requiring power 7.  ('   ''('  ('  % ' +   -( &%. accessories. simply. but the engineer appreciates what’s happening under the hood. can have shapes such as planar or spherical 8.com CROSSWORD ANSWERS from Issue 247 1 2 March 2011 – Issue 248 Down 1.com PICBASIC PRO™ Compiler Bridges the gap between ease 888-316-1753 USB Programmer for PIC® MCUs of use and professional level results.11 16. LOSS—Drop in dB 12. Generate Your Code.                   ! "" # "  $% % TCPmaker for control over the Web Easy as 1-2-3: .com .linksprite. www. Includes Software for Windows 98. and Vista. APPEND—Add to end 9. TOPOLOGIES—Bus. BALUN—What you get when you combine balance and unbalance 11. The simplicity of the language allows both hobbyist and engineer to master it quickly. > Encrypted system protects your rmware from theft or from being programmed into the wrong device.com 78 CIRCUIT CELLAR® • www. and securely. > Automatically delivers upgrade by email. WIFI—IEEE 802.com 888-474-1041 microEngineering Labs. -% ' 0   ''('  $% % !  From the makers of HIDmaker FS: www. for all Microchip C compilers.95 (as shown) RoHS Compliant Programs PIC MCUs including low-voltage (3.melabs. RADOME—Radar dome. 1. RS-232 and More Source Level Debugging in MPLAB $89.com www.95 www. See our full range of products.” NO PC PROGRAMMING AT ALL – just point your web browser at your device! Simple Upgrade Management System Low cost integrated system manages upgrades across di erent processors & connectivity types: > Lets your end users upgrade your PIC rmware safely.3V) devices. QUARTZ—Timing XTAL 19. With Accessories for $119. CONDUIT—Piping for wires 8. ATTITUDE—Orientation with respect to motion 10.tracesystemsinc.eclipsecrossword.melabs. % (/  #  %. NT. GROUND—Earth wire 18. Ring. optimized machine code that's stable and dependable. De ne Your Data.95: Includes Programmer. Lay Out Your Content (with gorgeous web-ready screen controls that you can grab on to) using TCPmaker’s drag & drop Visual Page Designer. 1 !  % '   # " & '%  ( %) % * ('  +'(  . > Simple for non-technical end users. FILAMENT—Tungsten wire through which electricity passes Across 5. ACRES—1 square mile = 640 ____ 17. 3. EVALUATIONKIT—EVKIT [two words] 3.www. TRANSMIT—Tx 6. NACA—Before NASA 2. 2. including books. > Grows with your product line: for a new product w/ di erent processor or connectivity type. to “wire it all together. just add another SUMS bootloader. I2C. Me. Supports: More than 300 PIC® Microcontrollers Direct Access to Internal Registers In-Line Assembly Language Interrupts in PICBASIC and Assembly Built-In USB. XP. Star.

Inc. Inc. and SMP Reprogrammable UAV Autopilot System (Part 1): System Hardware and Software DSP-Based Color Organ: Use the Convolution Technique to Create High-Performance Filters Testing Platform: Construct a Custom Scope and Analyzer THE CONSUMMATE ENGINEER Reliable Programming: Work Toward Fault-Free Software THE DARKER SIDE Noise Figures 101 ABOVE THE GROUND PLANE Thermal Performance FROM THE BENCH Boot Up: Bootloading Essentials www. LLC 15 EMAC. 11 Material Close: Mar. BusBoard Prototype Systems Ltd. Inc. All Electronics Corp. Inc.circuitcellar.I Page 76 75 13 17 77 77 NDEX OF ADVERTISERS Page AAG Electronica. Inc. Inc. 75 FlexiPanel Ltd. 75 Decade Engineering 36. 63 Pololu Corp. 9 Lemos International Co. Inc. 45 Trinity College Robotics Contest 26. 27 Elektor 78 Ironwood Electronics C2 NetBurner 11 WIZnet Co. Inc. 37 IC Bank 75 Mosaic Industries. 78 microEngineering Labs. Inc... Inc. 32 Grid Connect. Inc. AP Circuits 55 Embedded Developer 75. Inc. 77 MCC. 33 CWAV 71 Humandata Ltd. Inc. Micro Computer Control 77 Tern. 76 Triangle Research Int’l 70 DesignNotes 1 Imagineering. 3 Technologic Systems 19 Comfile Technology. 18 Microprogramming a CPU (Part 1): The Architecture. 69 Pico Technology Ltd. 78 Trace Systems. 5 Mouser Electronics. 75 Technological Arts 76 Custom Computer Services.3741 or 978. Programmer Model. 59 Elektor C3 Jameco 7 NXP Semiconductors P REVIEW A TTENTION A DVERTISERS of April Issue 249 Theme: Embedded Programming May Issue 250 Deadlines Space Close: Mar. Inc. 15 Futurlec 77 Maxbotix. 43 ESC Silicon Valley 9. 76 JK microsystems.7708 e-mail: peter@smmarketing.us ESC Chicago. Inc.454. ARM 59 ExpressPCB 70 Lakeview Reasearch 77 Robot Power Bitwise Systems 13 ezPCB/V-Module 77 Lawicel AB 65 Saelig Co. SID Int'l Symposium CIRCUIT CELLAR® 79 March 2011 – Issue 248 . LLC Page C4 Parallax. Inc.281. Page 70 Jeffrey Kerr.com • Theme Measurement & Sensors Bonus Distribution Call Peter Wostrel now to reserve your space! 800. 32 JK microsystems. 77 Tag-Connect 53 CC Gold 35 Front Panel Express LLC 78 LinkSprite 2. Inc. Sensors Expo.

Unfortunately. bitter and warped opinion aside.circuitcellar.” The conversation this particular afternoon was more serious than usual. With a little knowledge and a bit of information you’ll earn the confidence of the entire team.com 80 CIRCUIT CELLAR® • www. Seek other assignments and out-of-the box responsibilities. The demands of being an electrical engineer are evolutionary. Believe me. It’s a lot easier for you to learn the basics of finance. network. network. publish. especially when all of my advice is usually about starting your own business so you lessen the occasions and consequences of bureaucratic nonsense controlling your destiny.Corporate project teams consist of a bunch of people with a variety of talents. You’ll have to deal with bean counters. I do understand that most engineers have to deal with the establishment. You will have the ability to speak to the engineers as peers and gain their respect. He wasn’t keeping up and he was replaced by a younger engineer with an up-to-date skill set. the conversation ended up discussing the economy and he confided (as much as you can at a bar anyway) that he had been laid off from his engineering job downstate and was searching for prospects elsewhere. Unless your engineering performance contributes value to the business.ciarcia@circuitcellar. I wanted him to say that it was indeed an economic issue and the layoff was temporary. Be it design or management. Sitting next to me was a 50-ish gentleman who. you need to network. he wasn’t in the bar looking for a job. the secret to longevity is about understanding what skill set is required at the different stages in your career. manufacturing guys. knowing that thousands of smart people may read something you write keeps you on your toes. Second. N March 2011 – Issue 248 steve. too. You can learn what they know. but the primary local pastime down here at the cottage is “happy hour. Third. and manufacturing techniques than it is for these people to become EEs. because you aren’t going back (not easily anyway). The secret to success here is your engineering training along with expertly applied BS (seriously).PINTERRUPT by Steve Ciarcia. Virtually all of us start as design engineers. you better be good at it. publish. while quite personable. use the Internet because it is the greatest knowledge repository there is. but then again. you will be replaced. that was not the case. I applaud those with the stamina to do it forever because maintaining an up-to-date skill set as a designer is not inconsequential. I hesitated to tell him that upstate here at the cottage. He was an engineer of a different age who had become too complacent. Your management role benefits from the comprehension and ingenuity you have being an engineer but leaves the nitty gritty of implementing it to the team. and many choose to stay there for their whole careers. Download and try new software and tools. Founder and Editorial Director RIORITY Forks in the Road ot that it is relevant for any other reason than to let you in on how the conversation started. lawyers. Engage other engineers and share ideas. seemed troubled. Take the time to write an article about something you know. The processors and development packages he felt comfortable using were becoming obsolete. But. The other big career fork for engineers is whether to move into project management. Don’t wait until a technical deficit appears before expanding your skill set (albeit learning a new compiler or becoming a junior bean counter for the next finance meeting). Finally. Invariably. and surviving it takes both wit and wisdom. Go to trade shows. First. Engineering jobs in the private sector do not offer career-long job security and you can’t expect to just drift into retirement collecting a salary. I guess if there is a lesson here it is don’t become complacent.” There are a bunch of home town bars and eateries along the beach where all the “regulars” meet and greet each other as well as mingle with the “touristas. or take a class and learn from others. I might be the last person you want to listen to for career advice. and design engineers. contracts. Your skill set needs to follow that evolution or you could be sitting at the bar telling a stranger that you are looking for a job. Of course. but they can’t easily learn what you know. conferences. Apparently the changing needs of the company required a new skill set. especially ones with high visibility and exposure. publish. most people still think “engineer” has something to do with trains. as well as the design techniques he employed. Here’s my take on it.com . and he was no longer part of the solution. Keep familiar with the latest processors and development techniques. don’t get trapped by narrow job descriptions. unless you do all the above to maintain your design skills.

com/teaser9 to see if you are correct.What is the missing component? F REE! A fictional engineer we'll call John Archer spent a decade designing hardware and writing code for microprocessor-controlled games manufactured by a toy company. The puzzle was created by Forrest M.Jameco. www. Mims III Sign up for our e-newsletter and get a FREE comic book.The catch: The game should not use a battery or external source of power. How did Archer solve this very different assignment? Go to www.com .Jameco.com/adventure1 1-800-831-4242 | www. rubber ball. the company president said he wanted to introduce a new line of simple games that would flash a red LED when a target was struck by a rubber band. or other reasonablysafe projectile.Jameco. Citing a market for "back to basics" toys.

Sign up to vote on this title
UsefulNot useful