Cover.qxp 1/4/2008 2:43 PM Page 1

TRANSFORMER BASICS P. 70 • MCU-BASED POLL SERVER RESULTS P. 74 • HOT CHIPS REVIEW P. 78 w w w . c i r c u i t c e l l a r . c o m CIRCUITTHE MAGAZINE FOR COMPUTER CELLAR APPLICATIONS #211 February 2008 WIRELESS COMMUNICATIONS A Platform for Wireless Sensor Networks

Build an RFID Payment System

Ciarcia’s PV System (Part 3)

Antenna Technology 101

TCP/IP Socket Communication

Firmware Protection & Publishing

02>

7925274 75349 $4.95 U.S. ($5.95 Canada) C2.qxp 10/1/2007 10:27 AM Page 1 5

C 5 25 50 75 95M 5 25507595 Y 5 25 50 75 95 K 5 25 50 75 95 MY CY CM 1.qxp 10 $29.95 Buy Now / 1 / 2007 3:50PMPage1 All other trademarks are properties of their respective owners. ©2007 Cypress Semiconductor Corporation. All rights reserved. * oftheir respectiveowners.©2007 CypressSemiconductorCorporation. Allrightsreserved. All othertrademarks areproperties It’s showtime. embedded designsyoucanevaluaterightoutofthebox.Getyoursandstepintospotlighttoday. embedded applicationdevelopment.GetaCypressPSoC Fixed-function microcontrollershadtheirshareofthespotlight.It’s simplified—approachto timeforarevolutionary—and Get Your Kit. TickettotheUltimateEmbeddedDesignStarter your time-to-market.Thiskitincludestheeasy-to-usePSoCExpress andafastMCU—shorten programmableanalog anddigitalblocks,embeddedmemory mixed-signal arrays—powerful, * Cypress, theCypresslogoand PSoCareregisteredtrademarks,andProgrammable System-on-Chip, PSoCExpress,andFirstTouch are

www.cypress.com/go/FirstTouch Buy yourPSoCFirstTouch Kitnowat: UltimateStarter CAPSENSE TOUCH SENSING TEMPERATURE SENSING

® LIGHT SENSING FirstTouch ™ visualembeddedsystemdesigntool,andgivesyou Does notinclude anyapplicablesalestax, shippingandhandlingcosts. CPFAP001E PROXIMITY CAPSENSE ™ SENSING Starter KitnowanddiscoverhowmuchPSoC Starter applications onasingleplatform. Includes fourready-to-usemixed-signal trademarksofCypressSemiconductor Corporation. 5 56-57.qxp 7/2/2007 10:52 AM Page 1 56-57.qxp 7/2/2007 10:52 AM Page 2 211_Task_Masthead.qxp 1/7/2008 4:50 PM Page 4

TASK MANAGER

Real-World Apps FOUNDER/EDITORIAL DIRECTOR CHIEF FINANCIAL OFFICER Steve Ciarcia Jeannette Ciarcia MANAGING EDITOR MEDIA CONSULTANT Last year, we challenged the embedded design community to get C. J. Abate Dan Rodrigues creative and make a concerted effort to design real-world applications WEST COAST EDITOR CUSTOMER SERVICE that would make waves in 2008. This issue proves that the community Tom Cantrell Debbie Lavoie has stepped up to the challenge and has begun to address the major CONTRIBUTING EDITORS CONTROLLER technological topics of the twenty-first century: user-friendly wireless Jeff Bachiochi Jeff Yanco Ingo Cyliax applications, cost-effective embedded applications, code efficiency, Robert Lacoste ART DIRECTOR KC Prescott and renewable energy solutions. George Martin This month, we start with wireless network design. On page 12, Ed Nisley GRAPHIC DESIGNER Carey Penney Diego Mendez Chaves and his team from Los Andes University intro- NEW PRODUCTS EDITOR John Gorsky duce you to a flexible platform for wireless sensor networks. This article STAFF ENGINEER John Gorsky will help you get a wireless network up and running. PROJECT EDITORS Gary Bodley In keeping with the wireless communications theme, we include Ken Davidson two articles that will help you develop wireless designs that feature David Tweed simple master-to-slave interaction. Carlos Cossio describes his RFID ASSOCIATE EDITOR payment terminal design on page 34. The well-designed, handheld Jesse Smolin terminal can be used for contactless payments in a variety of settings, ranging from a convenience store to a subway station. On page 60, ADVERTISING Robert Lacoste covers antenna technology and familiarizes you with 860.875.2199 • Fax: 860.871.0411 • www.circuitcellar.com/advertise impedance matching and antenna simulation. After reading this col- PUBLISHER umn, you shouldn’t be wary of incorporating antenna technologies in Sean Donnelly your projects. Direct: 860.872.3064, Cell: 860.930.4326, E-mail: [email protected] On the topic of intelligent energy solutions, Steve Ciarcia wraps up ADVERTISING REPRESENTATIVE Shannon Barraclough his series about the installation of his home photovoltaic (PV) system Direct: 860.872.3064, E-mail: [email protected] (p. 22). The system is now installed and racking up kilowatt-hour cred- ADVERTISING COORDINATOR its on the meter. This month, he describes the wiring and electronics Valerie Luster behind this complex renewable energy project. E-mail: [email protected] In the second part of his series on cashing in on code, Richard Hoptroff explains how to publish firmware and create an opportunity to Cover photography by Chris Rakoczy—Rakoczy Photography make some big bucks (p. 44). To do so, he draws on his firmware www.rakoczyphoto.com development experience. He covers the topics of firmware copyright PRINTED IN THE UNITED STATES protection, pricing, and publishing. CONTACTS On page 52, Cass Tyler explains how to implement a TCP/IP sock- SUBSCRIPTIONS Information: www.circuitcellar.com/subscribe, E-mail: [email protected] et server on a Rabbit RCM2200. As you’ll see, TCP/IP communication Subscribe: 800.269.6301, www.circuitcellar.com/subscribe, Circuit Cellar Subscriptions, P.O. Box 5650, with embedded processors is quick and easy when using text com- Hanover, NH 03755-5650 Address Changes/Problems: E-mail: [email protected] mands. GENERAL INFORMATION 860.875.2199, Fax: 860.871.0411, E-mail: [email protected] Ever wonder how transformers really work? Ed Nisley’s column on Editorial Office: Editor, Circuit Cellar, 4 Park St., Vernon, CT 06066, E-mail: [email protected] transformer basics is a great primer for young and old engineers alike New Products: New Products, Circuit Cellar, 4 Park St., Vernon, CT 06066, E-mail: [email protected] AUTHORIZED REPRINTS INFORMATION (p. 70). He covers several essential transformer equations and more. 860.875.2199, E-mail: [email protected] On page 74, Jeff Bachiochi delivers the second part of his series AUTHORS Authors’ e-mail addresses (when available) are included at the end of each article. on his portable poll server. The MCU-based design maximizes the power of SitePlayer to ask questions, gather responses, and compile CIRCUIT CELLAR®, THE MAGAZINE FOR COMPUTER APPLICATIONS (ISSN 1528-0608) is published monthly by Circuit Cellar results. 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 $23.95, Canada/Mexico $34.95, all other countries $49.95.Two-year (24 issues) sub- In the last column of the issue, Tom Cantrell brings you up to speed scription rate USA and possessions $43.95, Canada/Mexico $59.95, all other countries $85. 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 on all of the exciting new chip technologies that he discovered at the and subscription-related questions to Circuit Cellar Subscriptions, P.O. Box 5650, Hanover, NH 03755-5650 or call most recent Hot Chips and Embedded Systems conferences (p. 78). 800.269.6301. With chips like these, you’re sure to be able to take your 2008 designs Postmaster: Send address changes to Circuit Cellar, Circulation Dept., P.O. Box 5650, Hanover, NH 03755-5650. to the next level. 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 Good luck! I look forward to learning about all of your 2008 design from plans, descriptions, or information published by Circuit Cellar®. projects. 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 © 2008 by Circuit Cellar, Incorporated. All rights reserved. Circuit Cellar is a registered trademark of Circuit Cellar, Inc. [email protected] Reproduction of this publication in whole or in part without written consent from Circuit Cellar Inc. is prohibited.

4 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 79.qxp 12/4/2007 10:41 AM Page 1 211_toc.qxp 1/7/2008 4:49 PM Page 6

February 2008: Wireless Communications FEATURES

12 Wireless Sensor Network Design 34 RFID Payment Terminal A Flexible Platform for WSNs Carlos Cossio Diego Méndez Chaves, Mauricio Guerrero Hurtado, 44 Cash for Code & Néstor Peña Traslaviña Part 2: Publish Your Firmware 22 INTELLIGENT ENERGY SOLUTIONS Richard Hoptroff Solar-Powering the Circuit Cellar 52 System Control Part 3: Wiring & Electronics TCP/IP Communication with Embedded Processors Steve Ciarcia Cass Tyler

PV Power: Wired & Working (p. 22) Payment Terminal Design (p. 34)

COLUMNS

60 THE DARKER SIDE 74 FROM THE BENCH Antenna Basics Portable Poll Server Robert Lacoste Part 2: Data Acquisition & Results Jeff Bachiochi 70 ABOVE THE GROUND PLANE Transformers 78 SILICON UPDATE Ed Nisley Got Chips? Tom Cantrell

Understanding Antennas 101 (p. 60) Transformers (p. 70)

DEPARTMENTS

4 TASK MANAGER 94 INDEX OF ADVERTISERS Real-World Apps March Preview C. J. Abate 96 PRIORITY INTERRUPT 8 NEW PRODUCT NEWS Avoiding Stereotypes edited by John Gorsky Steve Ciarcia 93 CROSSWORD

6 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 7.qxp 12/10/2007 12:18 PM Page 1 npn211.qxp 1/10/2008 1:22 PM Page 8

Edited by John Gorsky Visit www.circuitcellar.com/npn NEW PRODUCT NEWS for more New Product News. LOW-POWER CPLD The new zero-power MAX IIZ CPLD is designed specifi- MAX IIZ devices break through the power, space, and cally to address the power, package, and price constraints cost limitations of traditional macrocell-based CPLDs of the portable applications market. Offering a resource by combining non-volatility and instant-on performance advantage of up to six times the density and three times with an innovative look-up table logic structure. The the I/Os compared to competing traditional macrocell- devices use a 0.18-micron process, 1.8-V core voltage, based CPLDs, MAX IIZ devices enable designers to meet and six-metal-layer flash to provide both high function- changing functional ality and zero-power con- requirements at the same sumption in a single or lower power while sav- device. The advanced sys- ing board space. tem features MAX IIZ MAX IIZ devices are CPLDs, such as user flash available in densities of 240 memory, an internal oscil- and 570 logic elements. lator, cost optimization, They are available in ultra- greater density, smaller small MBGA packages packages, and lower with up to 160 I/Os. This power consumption far increased logic density and surpass those of all tradi- greater I/O count enables tional macrocell-based greater integration of exist- CPLDs. ing functions from other The MAX IIZ series devices, substantially starts at $1.25 in high vol- reducing board space and umes. power consumption while lowering overall system Altera Corp. costs. www.altera.com

8 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com npn211.qxp 1/10/2008 12:54 PM Page 9

NEW PRODUCT NEWS LOW-COST ANYTHING I/O FPGA CARD The 7I43 is a low-cost, general-purpose programmable I/O card that connects to a host computer via a USB or PC’s parallel port. The 7I43 uses a 200,000- or 400,000-gate Spartan3 FPGA for all logic, so it is truly an anything I/O card. The FPGA is downloadable from the USB or parallel port bus side and has local configuration storage via an on-card EEPROM. Efficient switching regulators are used for the FPGA core and 3.3-V power, enabling the 7I43 to be USB bus powered. The card can also be powered by an external 5-V source. The 7I43 has 48 I/O bits available on two 50-pin connec- tors. Both connectors use I/O module rack-compatible pinouts and all I/O bits are 5-V tolerant. The I/O connectors are compatible with 7-series daughter cards for isolated I/O, motion control, an RS-422 interface, and other applica- tions. Configurations are provided for simple GPIO, smart motion control (SoftDMC), host- based motion control (HostMot2), buffered step and direction generation, and a waveform generator. The 7I43, which comes in quantities of 100, costs $59 (200,000-gate version) or $67 (400,000-gate version).

Mesa Electronics www.mesanet.com

LINUX COMPUTER FITS IN A 40-PIN CHIP SOCKET The Hammer is a tiny, low-cost SBC with an open-hardware design and -based software. Instead of bringing I/O out to high-density surface-mount connectors, the Hammer has 40 solder-friendly 0.1″ pins for easy prototyping of complex designs. The Hammer is designed to fit into a DIP socket and is avail- able in kit form. It offers a low-cost USB-based JTAG board, a development “car- rier” breadboard, and software. The Hammer is based on the S3C2410A SoC. The SoC integrates a 200-MHz ARM920T core with an MMU and 16 KB each of instruction and data cache. The tiny SBC measures just 0.75″ × 2.25″. It has 16 MB of NOR flash soldered onboard, along with 32 MB of 100-MHz SDRAM. Other features include two UARTs with IrDA support, an I2C interface, two SPI ports, two 16-bit timers/PWMs, and an 8-bit LCD interface. The SBC also has USB host and device ports, two 10-bit ADCs, four external interrupt pins, and up to 30 pins of GPIO. The GPIO and peripherals share the same pins. On the software side, the Hammer comes with an open-source bootloader, a Linux 2.6 kernel, and a root filesystem based on uClibc and Busybox. A carrier board for development use and a JTAG board called the Flyswatter for code transfer and debugging are also avail- able. The Hammer SBC is available now. It costs $160 or $250 for a kit that includes the carrier and Flyswatter boards.

Tin Can Tools www.tincantools.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 9 npn211.qxp 1/10/2008 12:55 PM Page 10

NEW PRODUCT NEWS LOW-COST, HIGH-PERFORMANCE DSP DEVELOPMENT PLATFORM The XtremeDSP Solutions Starter Platform—Spartan-3A DSP 1800A FPGA The XtremeDSP Solutions Starter Edition is a low-cost development platform for implementing DSP designs Platform—Spartan-3A DSP 1800A using the Spartan-3A DSP family of low-cost FPGAs. The platform is ideal for FPGA Edition costs $295. engineers developing DSP applications that require the performance and price delivered by Spartan-3A DSP devices. Xilinx, Inc. The new development platform delivers instant access to the Spartan-3A www.xilinx.com DSP family’s capabilities and supports industry-stan- dard peripherals, connectors, and interfaces. It is designed for use with the Xilinx system generator for DSP and ISE software and provides the necessary hard- ware to not only evaluate the advanced features of the family, but also to implement complete applications characterized by the need for very high DSP computa- tional requirements while delivering optimum power efficiency. The XtremeDSP Solutions Starter Platform—Spartan- 3A DSP 1800A FPGA Edition includes a VGA port for developing video processing algorithms, an Ethernet 10/100/1000 PHY, as well as an RS-232 port for simple communications with a remote console. The starter platform also comes equipped with 128 Mb × 32 bits of DDR2 SDRAM, 16 Mb Parallel/BPI configuration flash, and 64 Mb of SPI configuration/storage flash. Also sup- ported is a full JTAG interface for configuration and debugging, as well as a System ACE module connector.

10 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 11.qxp 12

&OWJSP.PO $VSSFOU .POJUPSJOH ,JU   4&3*&4 www.picotech.com/pco410 4MGS7GSTI7IVMIW NFUFSXJUIPVUUIFOFFEGPSBEEJUJPOBMQSPCFTPSQPXFSTVQQMJFT 1JDP4DPQFIBOEIFMEPTDJMMPTDPQFTDP ocekotorfl ieo cbsdisrmnso call or instruments based pc of line full our out check to / 5IF&-LJUDPOUBJOTBMMUIFEFWJDFTOFFEFEUPTUBSUNPOJUPSJ DVSSFOU*UJODMVEFTUIF&-DPOWFSUFS XIJDIFOBCMFTBO&OWJ OFUXPSLUPNPOJUPSUISFF"$DVSSFOUTJHOBMT5IJTDBOCFVTFEU PVUFYBDUMZXIFSFUIFIJHIFTUQPXFSDPOTVNQUJPOJTJOZPVSTZTU FOBCMJOHZPVUPJNQSPWFFOFSHZFGGJDJFODZBOETBWFNPOFZ 31 PL JI&WS.OU NPOJUPS UP &OWJSP.PO XJUI 8PSLT $DSFUTJHOBMT DVSSFOU "$ IX P IS O XIFO BOE XIFSF ZPV 4IPXT VSO GMPXT DVSSFOU B YFTW MS GVODUJPOT BMBSN FYUFOTJWF )BT IUTHB IODVSSFOU XIFO TJHOBM UIBU YFE STUMJNJUT QSFTFU FYDFFET B FFQOF PNFBTVSF UP FYQBOEFE CF $BO PFDIBOOFMT NPSF TJFMGSFGGJDJFODZ GPS JEFBM *T JOWFTUJHBUJPOT TJFMGSUSFQBFNBJOT UISFFQIBTF GPS JEFBM *T NFBTVSFNFOU B PJP IF VSO SOGSFTPS USBOTGPSNFST DVSSFOU UISFF NPOJUPS $BO VSO MNTB I BFUJNF TBNF UIF BU DMBNQT DVSSFOU / 2007 12:32PMPage1 OWFSUZPVSMBQUPQPSEFTLUPQ COscilloscopes PC R TGVQ%REP]^IV 7TIGXVYQ ERH SP.PO OH PGJOE FN  1.800.591.2796 1$JOUPBQPXFSGVMPTDJMMPTDPQF 5IF1JDP4DPQF BSFMJHIUXFJHIUBOEDPNGPSUBCMFUPVTF SJHIUIBOEFE IBWFCJHPSTNBMMIBOET 1JDP4DPQFIBOEIFMETDPQF EFTJHOFEUPGJUQFSGFDUMZJOZPVSIBOE8IFUIFSZPVSFMFGUIBO )BOEIFMEPTDJMMPTDPQFTGSPN1JDPIBWFCFFOFSHPOPNJDBMMZ JTBMTPBWBJMBCMFGPSVTFJOMFTTEFNBOEJOHBQQMJDBUJPOT POCPUIBOBMPHVFBOEEJHJUBMDJSDVJUT5IFFOUSZMFWFM1JDP4DPQ 1JDP4DPQFTVJUBCMFGPSBXJEFSBOHFPGUSPVCMFTIPPUJOHUB TBNQMFCVGGFSNFNPSZBOE.)[BOBMPHVFCBOEXJEUINBLFUIF UJNFTBNQMJOH5IFTFIJHITBNQMJOHSBUFTDPNCJOFEXJUIB  CFJODSFBTFEUPHJHBTBNQMFTQFSTFDPOEVTJOHEJHJUBMFRVJWBMF SFBMUJNFTBNQMJOHSBUF'PSSFQFUJUJWFTJHOBMTUIFTBNQMJOHSB 1JDP4DPQF 1PXFSBOE1FSGPSNBODFJOZPVSIBOE 6QUP TBNQMFCVGGFSNFNPSZ 6QUP.)[CBOEXJEUI 6QUP(4TSFQFUJUJWFTJHOBMTBNQMFSBUF 6QUP.4TSFBMUJNFTBNQMFSBUF &SHPOPNJDBMMZE ihSpeed High FTJHOFEUPGJUJOUIFIBOE  IBTBNFHBTBNQMFQFSTFDPOE o information for 7 'SRRIGXIH 97& TQFDUSVNBOBMZ[FSBOE 1JDP4DPQF  UFDBO F OU EFE  TLT T  2802016mendez.qxp 1/8/2008 9:40 AM Page 12

FEATURE ARTICLE by Diego Méndez Chaves, Mauricio Guerrero Hurtado, & Néstor Peña Traslaviña Wireless Sensor Network Design A Flexible Platform for WSNs

A group of designers from Los Andes University presents a wireless sensor network (WSN) platform. It is a testbed for the evaluation of different algorithms related to the communications stack of a network (e.g., routing policies, transport protocols, topology control, and medium access control).

In this article, we will present the nodes (sensors), router nodes, and coordi- Berkeley Ph.D. dissertation, “System wireless sensor network (WSN) platform nator nodes. A web server or a remote Architecture for Wireless Sensor Net- developed by the WSN Research Group console application (e.g., SSH) enable you works,” for an interesting classification at Los Andes University in Bogotá, to remotely query the network. The gate- of WSN applications.”[2] The first class of Colombia. The principal objective was way is the principal device for managing networks is Environmental Data Collec- to develop an entire platform (hardware the network. That is why there must be tion. These applications have a high peri- and software) that would work as a test- a way to remotely query and manage its odic collection time with low transmis- bed for the evaluation of different algo- resources. Although the traffic generated sion rates. Power consumption is one of rithms related to the communications by a single node is very low, the entire the most important requirements to ful- stack of the network, such as routing network can generate great traffic, fill. Security Monitoring is another class policies, transport protocols, topology increasing the demand for remote stor- of WSN where nodes constantly monitor control, and medium access control. age. All of this functionality is easily pro- their sensors, but data is transmitted to vided outside the LAN through a base the sink only in special moments. The WIRELESS SENSOR NETWORKS station that enables Internet access. reliability of a transmission is more The great power of the WSN is its abil- The requirements of a WSN are estab- important than power consumption. ity to deploy many small nodes (motes) lished according to the application that Node tracking scenarios are another type. that are self-assembled and self-config- is developed. Refer to Jason Hill’s UC The networks are oriented to efficient ured. Nodes must consume little power topology control. The idea is to know the to be able to operate for a long time on actual position of a mobile node with the Node network Node network a pair of batteries without human assis- help of some reference nodes. Neverthe- tance. To have a dense network of sen- less, most of the real applications are a sors, the cost of a single node must be fusion of any of the three classifications. low enough to enable you to build a lot The principal element of a WSN is of them. The network must organize Gateway Gateway the node, which can be divided into itself, and it must be resistant to attacks four principal blocks: a sensors block Server or failures. The WSN has the flexibility SSH, NFS with transducers that collect signals Transit to adapt to new topologies and the network from the environment and transform communications are neighborhood-ori- them into electrical signals; a process- ented. Unlike other networks, the WSN ing block that carries out all the digital becomes stronger as it grows. Base station signal processing and storage of the sig- The architecture required for WSN nals coming from the sensors block; a Server SSH, NFS applications includes a hardware platform Internet communications block that usually (motes) and an operating system (OS) to consists of a transceiver that processes manage all of the hardware resources of the signals to transmit or receive (the Figure 1—This is a typical wireless sensor network. the mote and provide high-level servic- Node networks are connected to a transit network antenna is the way the node sends or es. A typical WSN is shown in Figure 1. through a gateway device. The gateway manages the receives these signals); and finally, a The node network may have terminal network and provides remote access.[1] power supply block, which distributes

12 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802016mendez.qxp 1/8/2008 9:40 AM Page 13

Figure 2—The two principal devices are an Atmel ATmega128 (top) and a Texas Instruments CC2420 transceiver (bottom). The Atmel AT45DB041B SPI flash memory and the F-inverted microstrip antenna are also shown.

the energy to the rest of the blocks. from the resources of the mote. The ker- on a single pair of batteries. They also Another important issue is the OS that nel gives most of the services of the OS, must be robust and flexible. The com- will manage the hardware resources to such as message passing, scheduling putation capabilities are reduced, but ease the development of applications. In policies, memory management, access the mote must be able to at least a typical OS layers model, the hardware to hardware resources, and more. include the kernel image of the OS, the abstraction layer (HAL) enables you to Finally, on top of the layers is the user application, and enough room for stor- port the OS to new motes with just the space where applications are mounted. age purposes.[2] Wireless communication definition of the functions to access the must be provided to send and receive hardware. Hardware drivers define the WSN NODES “MOTES” information to and from the nearby typical actions to send and receive data Motes have to operate for months motes. WSNs are oriented to local com-

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 13 2802016mendez.qxp 1/8/2008 9:40 AM Page 14

Mica2 MicaZ TelosB CC2431 AMB2130 Designer UC Berkeley Crossbow UC Berkeley Chipcon Amber wireless Processor Atmel ATmega128 Atmel ATmega128 TI MSP430 8051 CPU CORE Atmel ATmega128 Program memory 128 KB 128 KB 48 KB 128 KB 128 KB RAM Memory 4 KB 4 KB 10 KB 8 KB 4 KB Nonvolatile storage 512 KB AT45DB041B 512 KB AT45DB041B 128 KB ST M24M01S — — Transceiver CC1000 IEEE 802.15.4-compliant IEEE 802.15.4-compliant IEEE 802.15.4-compliant IEEE 802.15.4-compliant CC2420 CC2420 CC2420 CORE CC2420 CORE Data rate 38.4 kbps 250 kbps 250 kbps 250 kbps 250 kbps Frequency 300 to 1,000 MHz 2,400 to 2,483.5 MHz 2,400 to 2,483.5 MHz 2,400 to 2,483.5 MHz 2,400 to 2,483.5 MHz Peripherals SPI, I2C, ADC, UART, SPI, I2C, ADC, UART, UART, ADC, DAC, SPI, I2C, ADC, internal oscillator, loca- ADC, UART RTC, PWM, watchdog, RTC, PWM, watchdog, watchdog, and DMA con- tion engine, sleep timer, DMA and internal oscillator and internal oscillator troller controller, and UART Antenna External connector External connector Microstrip antenna External connector External connector

Table 1—Typical motes include Mica2, MicaZ, TelosB, CC2431, and AMB2130. The University of California, Berkeley, is one institution that has been stimulating WSN development with the motes and with the TinyOS.

munication and self-organizing policies. have the same connections between the applications. To achieve this, an OS A typical application has around 100 microcontroller and the transceiver. must be used to make the development motes, so each mote must be inexpen- With the same HAL, use of the DA- of new applications a transparent task. sive and small. To comply with the MOTE in any OS is the same as having However, you can’t use an ordinary OS restrictions given above, the platform a MicaZ mote. The ATmega128L is pro- because traditional OS images are larger components must be carefully selected grammed via an ISP interface using a than what can be included on these and the OS characteristics must be parallel port and four resistors. A pro- motes. We will cover this topic so you taken into account. Table 1 summa- gramming ISP port was included in the can choose the best OS. rizes the typical motes that are used DA-MOTE for this purpose. To interface for WSN applications. with the UART, an RS3223 chip was OPERATING SYSTEM It is important to note the pertinence used to convert voltage levels. When it comes to choosing an OS, of using an IEEE 802.15.4-compliant RF The DA-MOTE includes an integrated you must consider the following: the radio, such as Texas Instruments’s microstrip antenna. Texas Instruments scheduler, the services provided, the CC2420. It will give you the compatibili- has a reference design that includes an communications stack, flexibility, and ty to interact with other commercial F-inverted microstrip antenna.[5] By fol- the footprint. platforms and it is one of the transceivers lowing the designs carefully, it was pos- The scheduler should be flexible with the lowest current consumption sible to include the F-inverted antenna enough to implement threads and (RX: 18.8 mA, TX: 17.4 mA).[3] The Atmel in the DA-MOTE. An RP-SMA connec- change the priorities of every process in ATmega128L microcontroller exhibits tor is also included for an optional exter- the system. They are services that an great characteristics such as a good quan- nal antenna. One interesting fact about OS must have, including message pass- tity of peripherals and 128 KB of program the DA-MOTE is its two-layer design, ing controlled by the kernel, the ability memory. One advantage is that a lot of which enables a significant reduction in to control the execution, a subscription current platforms use it, so a lot of docu- the cost of PCB manufacturing. of new functions provided by modules mentation and information is available. A 512-KB SPI DataFlash memory mounted in user space, synchronism The principal operating systems used for provides storage. Two expansion con- mechanisms (such as mutex and sema- WSNs are ported to the ATmega128L. nectors make it possible to access phores), a HAL, high-level runtime pro- Texas Instruments’s MSP430F1611 peripherals, including an I2C interface, gramming (application and communica- microcontroller is also a good option an eight-channel ADC, a USART tion stack), and primitives to make because it was specifically designed for interface, an analog comparator, three communication between neighbor low power consumption and battery-pow- PWMs, three LEDs, a SPI, and com- nodes easier (and energy-efficient). A ered devices.[4] Nevertheless, because of plete access to Port C (8 I/O). Table 2 good option would be to include a soft- its low memory program capacity (just shows the principal characteristics of ware platform for the simulation and 48 KB) and the poor software support for the designed mote. Refer to Photo 1, debugging of virtual and real nodes. this microcontroller, we decided not to which shows the DA-MOTE with the The OS should provide a communi- use this device in our platform. F-inverted microstrip antenna. cations stack with the ability to easily implement algorithms for topology DA-MOTE SOFTWARE ARCHITECTURE discovery and the automatic identifi- The “DA-MOTE” is the mote that we Software for the WSN must be effi- cation of a new node on the network. designed and implemented (see Figure 2). cient in terms of memory, processor The communication services should To avoid any porting task, the HAL use, and power consumption. It also be mounted and unmounted at run- definitions of the MicaZ were followed must be flexible enough to share the time, at least at the highest layers to ensure that the DA-MOTE would system resources between multiple (routing, transport, and application).

14 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 15.qxp 1/10/2008 11:52 AM Page 1 2802016mendez.qxp 1/8/2008 9:40 AM Page 16

DA-MOTE Specifications Contiki is an open- and the ability to port to an ARM7- Processor ATmega128 source OS that is highly based platform that could be used as a Program memory 128 KB portable with multitask gateway in the future. RAM Memory 4 KB options. It was written by Contiki has two ways of communica- EEPROM Memory 4 KB Adam Dunkels at the Net- tion through two stacks: μIP and Rime. Programming Parallel UISP worked Embedded Systems When the project was developed, Contiki Nonvolatile storage 512 KB AT45DB041B group at the Swedish Insti- supported only μIP. This was inconven- Transceiver CC2420 tute of Computer Science. ient because any application would have Data rate 250 kbps Mantis was designed at to use this stack, leaving no space to Frequency 2,400 to 2,483.5 MHz the University of Colorado experiment with new algorithms. Rime Outdoor range 82 m (microstrip antenna) at Boulder by the Mantis is a lightweight communication stack Indoor range 15 m (microstrip antenna) Group. It is an open-source designed for low-power radios. It pro- Power consumption 85 mW Tx multithreaded OS written vides kernel primitives oriented to local 92.4 mW Rx in C language for WSN communication and reliable multi-hop Supply voltage 3.3 V or two alkaline batteries platforms. message transmission. Contiki has fea- Antenna Microstrip integrated and external connector SOS is an open-source tures similar to SOS, and the new Rime Dimensions OS developed by the Net- communications stack makes it a Length 68.4 mm Width 41.3 mm worked and Embedded good OS to evaluate in the near future. Systems Lab (NESL) at the Table 2—The most important devices in the DA-MOTE are the Atmel University of California, SOS ATmega128 microcontroller and the Texas Instruments CC2420 transceiver. One of the mote’s advantages is that it uses an integrated microstrip antenna. Los Angeles. It uses a com- We selected SOS for our platform (see mon kernel that imple- Figure 3). SOS enables you to insert bina- ments messaging, dynamic ry modules on the mote at runtime and The code of the communication stack memory, loading and unloading of reconfigure the system without com- at the lowest levels (MAC) should be modules, and other services. pletely stopping the processor. Thus, legible, so it can be easily modified. To better compare the operating sys- we can achieve better performance than The mote should be deployed with tems, a comparison table was generated we could with a virtual machine. The minimal code (static kernel). After and a qualitative score to each OS was kernel is static and it includes hardware deployment, the mote should receive assigned in Table 3. After looking at the abstractions and common services, but it the application code at runtime. System comparison table, there is almost a tie is hard to modify after deployment. reconfiguration should just cause a between Contiki and SOS. The main dif- The loadable modules can be drivers, pause without losing the execution ference is that SOS does not have an network protocols, and applications. The context. Due to the few resources of the explicit synchronism mechanism. We modules are easy to modify after deploy- mote, the binary image should be small. selected SOS for the ability to dynami- ment because the code is position-inde- Looking at the most representative OS, cally load modules (also possible in Con- pendent. Modules and kernels are writ- the size of the binary image should be tiki), the ability to include different rout- ten in C language. There is an efficient at least 32 KB without including the ing algorithms (μIP is used in Contiki), interface for messages and function pass- application code. Finally, the OS should ing that’s managed by the kernel. be an open-source distribution for possi- When the modules are inserted in the ble modifications to any level. system, they get registered and the functions they provide are announced. OS DESIGNS FOR THE WSN Other modules can use these functions Let’s compare five of the most rep- when they subscribe to the services. resentative operating systems SOS implements a non-preemptive designed specifically for the WSN. scheduler using priority queues. TinyOS is an open-source OS devel- The typical application (sensor module oped at the University of California, and routing protocol) takes about 32 KB Berkeley. It is implemented with a in ROM memory and 1.1 KB in RAM. component-based architecture and it SOS has been ported to the most com- is coded in the nesC language. mon platforms: Mica2, MicaZ, TelosB, Bertha was developed in MIT’s media iMote2, and XYZ (Yale’s platform). XYZ lab by the Responsive Environments and iMote2 use a 32-bit ARM7 processor. Group. Although the pushpin platform was not designed for a WSN, it is a VALIDATION good reference because the algorithms To configure a network with SOS, it implements are oriented toward dis- you must use a “gateway mote.” The Photo 1—Take a look at the DA-MOTE’s top layer and the tributed sensor networks without the principal blocks. The F-inverted antenna is connected to computer runs the sos_server applica- power management restriction. the transceiver as well as the optional RP-SMA connector. tion, which enables it to send and

16 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 63.qxp 12/4/2007 10:30 AM Page 1

PC Oscilloscopes & Analyzers

DSO Test Instrument Software for BitScope Mixed Signal Oscilloscopes

4 Channel BitScope 2 Channel BitScope Pocket Analyzer

Digital Storage Oscilloscope BitScope DSO Software for Windows and Linux Up to 4 analog channels using industry standard  probes or POD connected analog inputs. BitScope DSO is fast and intuitive multi-channel test and measurement software for your PC or notebook. Whether it's a digital scope, spectrum analyzer, mixed signal scope, Mixed Signal Oscilloscope logic analyzer, waveform generator or data recorder, BitScope DSO supports them all. Capture and display up to 4 analog and 8 logic Capture deep buffer one-shots or display waveforms live just like an analog scope.  channels with sophisticated cross-triggers. Comprehensive test instrument integration means you can view the same data in different ways simultaneously at the click of a button. Spectrum Analyzer DSO may even be used stand-alone to share data with colleagues, students or Integrated real-time spectrum analyzer for each customers. Waveforms may be exported as portable image files or live captures replayed  analog channel with concurrent waveform display. on other PCs as if a BitScope was locally connected. BitScope DSO supports all current BitScope models, auto-configures when it connects Logic Analyzer and can manage multiple BitScopes concurrently. No manual setup is normally required. 8 logic, External Trigger and special purpose Data export is available for use with third party software tools and BitScope's networked  inputs to capture digital signals down to 25nS. data acquisition capabilities are fully supported.

Data Recorder Record anything DSO can capture. Supports  live data replay and display export.

Networking Flexible network connectivity supporting  multi-scope operation, remote monitoring and data acquisition. Data Export Export data with DSO using portable CSV files or www.bitscope.com  use libraries to build custom BitScope solutions. 2802016mendez.qxp 1/8/2008 9:40 AM Page 18

BerthaOS Contiki Mantis TinyOS SOS continuously broadcasting dummy Scheduler packets. Reading the RSSI value for Hybrid model N Y Y N Y both motes always resulted in a simi- Priorities N Y Y N Y lar power received for MicaZ and DA- Services MOTE packets. Messages passing Y Y Y Y Y The results for indoor and outdoor Execution control Y Y Y Y Y experiments are shown in Figure 4. A Function subscription Partial Y Y N Y valid RSSI value for the MicaZ’s packets Synchronism mechanisms N Y Y N Partial was received up to a maximum distance HAL N Y Y Y Y of 54 m. The DA-MOTE radio range Runtime programming Y Y N Partial Y works up to a distance of 82 m. Perfor- Neighbors communication Y N N N N mance was better with our microstrip Energy saving N N N N N antenna than with the MicaZ antenna. Virtual nodes N N Y N N Comm stack APPLICATION Topology discovery Y Partial Partial Partial Partial We built an environmental variable Nodes ID Partial N N N N Mount services Y Y N N Y monitoring system to test the applica- Legible code (MAC) Y Y Partial Y Y tion. The first stage was the design of a Reconfiguration sensor acquisition board. The sensor Drivers mounted Y Y N Partial Y board measures temperature, relative Minimal code deployed Y Y N Partial Y humidity (RH), and light intensity. No restart of the system Y Y N N Y After looking at earlier implementations, Dynamic memory N Y N N Y we selected a Sensirion SHT11 sensor for Footprint temperature (14-bit resolution) and RH Small binary image Y Y Y Y Y (12-bit resolution) readings.[6] The SHT11 Open-source code Y Y Y Y Y has an accuracy of ±3% RH and ±0.4°C. It also has a two-wire digital interface Table 3—These are the various operating systems designed for the WSN. Both Contiki and SOS work well. (data and clock), but it is not I2C compat- ible. For light intensity, we used Intersil’s receive information to the gateway modules of the application, all the net- EL7900 light sensor.[7] The EL7900 is a mote. Using sos_tool and through a work’s motes will get infected. The light-to-current optical sensor, so a cur- socket to the sos_server, it is possible tests were made using the DA-MOTE rent-to-voltage circuit was used. A shut- to insert modules through the gateway. and MicaZ motes in the same network. down circuit was implemented to switch Once the module has been received, A consumption test was made with the power supply for all components of the code is distributed throughout the three operation modes of the mote in the sensor board. Photo 2 shows the DA- network in an infective way. If a new mind: transmit, receive, and sleep. In MOTE with the sensor board attached. mote is inserted in the network, it will all cases, the CC2420 transceiver was Four SOS modules were used for the receive the application codes from its configured with the maximum output monitoring application. The first module neighbors. If at least one mote has the power (0 dBm). The current consump- was the tree routing module. It generates tion modes are shown in Table 4. the tree topology for the network and Two experiments were run to tunnels all of the messages through the Dynamically Sensor Routing loaded Surge determine the range of the radio tree topology from the nodes to the sink. modules modules protocols link using the microstrip antenna. The module also maintains the topology. The first consisted of one DA- When a node dies, the tree routing mod- Kernel components MOTE working as a gateway and ule generates another path for all the sons Dynamic Message Dynamic memory scheduler linker transmitting a blink module. of this dead node to send data to the sink. Another DA-MOTE was continu- The second module used was the

Services ously moved away from the gate- SHT11 and the EL7900 control module.

Static Sensors way mote to check the maximum When the module receives a request to kernel Messaging Timers management distance at which the mote would acquire data, it turns the sensor board receive the module. In outdoor on and reads the requested sensor. The Device drivers scenarios, the DA-MOTE has an module was based on a previous imple-

Radio ADC I2C average range of 82 m. For indoor mentation of a module for the SHT15 scenarios, the average is 15 m. sensor for the SOS 1.x version. It was We also performed a compari- necessary to port the module to the SOS Figure 3—This was adapted from the SOS layers model. The static x kernel of SOS includes low-level drivers and common services. The son test. The DA-MOTE and 2. release and then integrate the code user modules can be mounted dynamically on top of the layers. They MicaZ motes were configured for acquiring the ADC readings. can implement drivers, communication protocols, and applications. with an application that was In SOS there are no primitives to

18 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 19.qxp 12/31/2007 12:23 PM Page 1

Embedded Ethernet Any Application, Any Location ies. All other served.

Monitor, control or re-program your application remotely with ease using the integrated Ethernet PIC18F97J60 family and FREE TCP/IP software. GET STARTED IN 3 EASY STEPS at www.microchip.com/ethernet. Purchase and program your microchip Ethernet PIC® DIRECT

n the USA and in other countries. PICDEM.net is a trademark of Microchip Technology Incorporated in the U.S.A. and other countr n the USA and in other countries. PICDEM.net is a trademark of Microchip Technology 1. Learn about our Ethernet devices in and related development tools at.... www.microchipdirect.com 20 minutes Take advantage of our Ethernet web seminars. Flash Device Pins (KB) Features 2. Download our FREE TCP/IP software Our TCP/IP stack is available in source code PIC18F97J60 100 128 10-BaseT Ethernet for flexible and optimized code size. PIC18F87J60 80 128 12 KB RAM (8 KB dedicated 3. Check out our low-cost PIC18F67J60 64 128 Ethernet) Ethernet tools PIC18F96J65 100 96 5x 16-bit timers Evaluate the PIC18F97J60 PIC18F86J65 80 96 10-bit ADC, 16 channels family with the PIC18F66J65 64 96 2 analog comparators PICDEM.net™ 2 Demo Board. 2 UART with LIN protocol PIC18F96J60 100 64 2 SPI, 2 I²C™ PIC18F86J60 80 64 Industrial Temperature

trademarks mentioned herein are property of their respective companies. © 2008 Microchip Technology Incorporated.trademarks All rights re mentioned herein are property of their respective companies. © 2008 Microchip Technology PIC18F66J60 64 64 -40° to +85°C ENC28J60 28 8K RAM MAC, PHY, SPI Interface Visit www.microchip.com/ethernet for additional devices supporting connectivity solutions and related development tools, Or you may consider... application notes, reference designs, web seminars and more!

Adding Ethernet to any ® application with Microchip’s PIC ENC28J60 stand-alone Ethernet controller with MCU full software support for PIC18, PIC24 and dsPIC® DSCs. www.microchip.com/Ethernet The Microchip name and logo, the Microchip logo, dsPIC and PIC are registered trademarks of Microchip Technology Incorporated i dsPIC and PIC are registered trademarks of Microchip Technology the Microchip logo, The Microchip name and logo, Microcontrollers • Digital Signal Controllers • Analog • Serial EEPROMs

Ethernet ad for Circuit Cellar.i1 1 12/3/2007 12:56:34 PM 2802016mendez.qxp 1/8/2008 9:40 AM Page 20

DA-MOTE Current consumption for the final user. For this purpose, we mounting and unmounting modules AVR MCU CC2420 Total used PySOS, which is a Python mod- and uses a code distribution protocol Transmit 6.8 mA 21.4 mA 28.2 mA ule that communicates with the that makes the network flexible and Receive 7.2 mA 23.6 mA 30.8 mA sos_server through a socket to provide robust. Plus, its small footprint was Sleep 2.6 mA 2.48 mA 5.08 mA low-level access to messaging. PySOS perfect for our resource-reduced plat- Measurement at 3 V was designed by the ENALAB at Yale. form. Table 4—Here are the DA-MOTE current consumption Because PySOS is a Python module, it The next step is to massively repro- modes. In Transmit mode, the mote was continuously send- enables a simple integration within a duce the mote so we can deploy a ing dummy packets. In Receive mode, the mote received web browser. The mod_python mod- dense network for complex applica- only dummy bytes and never sent messages. In Sleep ule (an Apache 2 module that embeds tions. A network with several nodes is mode, the modules inside the transceiver were disabled. the Python interpreter within the necessary to test algorithms for the server) was used. With this module, it communications stack. The develop- automatically transport messages was easy to send messages to the net- ment of a gateway for the WSN is an through the network to nodes that are work through a user request and then actual product of the Wireless Sensor more than one hop away from the wait for the mote response. Networks Research Group at Los source. An SOS module was imple- For a better performance of the web Andes University. An ARM9 proces- mented to enable us to send messages page, Ajax (asynchronous JavaScript sor-based platform is being used for to any node of the network. and XML) was used. Ajax is a develop- this purpose. I Finally, a hierarchical superior module ment technique for creating interac- joins all of the modules. The surge mod- tive web applications. This enables Diego Méndez Chaves (diego.org@gmail. ule was used as the basis and had to the page to exchange small amounts of com) is an electronics engineer from de be modified to receive the data from data with the server. When you make Universidad Nacional de Colombia in Bogotá, Columbia, and a graduate stu- the sensing module and then tunnel it a request, mod_python enables you to dent in Electronics Engineering at the through the tree routing module. Figure 5 use PySOS definitions. Therefore, Universidad de Los Andes. He has shows how the four modules interact. being able to send a message to the worked for the microelectronics center After inserting the four modules and network. PySOS waits for the incom- in the Electrical and Electronics Depart- after some time (waiting for the dis- ing data from the network and then ment since 2005. Diego’s research inter- covery of the topology), the network is responds to the web server with the ests include digital systems, operating ready to be queried by the computer. reading. systems (RTOS, embedded Linux, etc.), SOS has the sos_server (a console appli- high-level systems design, wireless sen- cation) as the principal way to interact FINISHED MOTE sor networks, and co-design techniques. with the network through the gateway A WSN mote was successfully Mauricio Guerrero Hurtado (maguerre mote, but this is not a good interface designed and implemented. The DA- @uniandes.edu.co), an electronics engi- MOTE features an neer from de Universidad del Cauca in ATmega128L microcon- Popayán, Colombia, has worked for the Received power levels (indoor) troller and the CC2420 0 microelectronics center in the Electrical 01 23 45678 -10 IEEE 802.15.4-compliant and Electronics Department at the Uni- -20 transceiver. By using the versidad de Los Andes since 1993. He has -30 same HAL definitions, the a Master’s degree in Electrical Engineer- -40 Power [dBm] -50 DA-MOTE is completely ing with an emphasis in Microelectronics -60 compatible with MicaZ from Universidad de los Andes. Mauri- -70 motes, so any application cio’s principal areas of interest are digital -80 designed for MicaZ will electronics, high-level systems design, -90 and ASIC design. Distance [m] MicaZ properly work with it. DA-MOTE However, the use of a

Received power levels (outdoor) microstrip-integrated 0 antenna and the two- 0 6 12 18 24 30 36 42 48 54 60 66 72 -20 layer design make it an -40 affordable alternative to

Power [dBm] -60 MicaZ. After some test- -80 ing, we learned that the microstrip integrated -100 antenna has a better per- -120 Distance [m] MicaZ formance than the Photo 2—This is the DA-MOTE with the sensor board DA-MOTE MicaZ’s external antenna. powered with a pair of AA batteries. In the sensor We chose SOS for its board, an Intersil EL7900 light sensor is on the left. A Figure 4—This is the received power level of the packets sent by the DA- Sensirion SHT11 temperature and relative humidity MOTE and the MicaZ. Indoor tests (top) were made in offices at Los Andes great characteristics. It sensor is in the sensor board. In this case, the mote University and outdoor tests (bottom) were made at a football field. allows dynamically uses the integrated microstrip antenna.

20 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802016mendez.qxp 1/8/2008 9:40 AM Page 21

Surge [4] Texas Instruments, Inc., “MSP430x15x, MSP430x16x, Reading to sink MSP430x161x Mixed Signal Micro- Tunnel data controller,” SLAS368E, 2006, Sense _mod tree routing http://focus.ti.com/lit/ds/symlink/ Acquire sensor msp430f1611.pdf. tree_routing

passing_msg [5] A. Andersen, “Design Note DN007: 2.4 GHz Inverted F Anten- Reading Request source node na,” SWRU120, Texas Instruments, destination node Server Inc., 2007, http://focus.ti.com/ lit/an/swru120/swru120.pdf.

Figure 5—Messages flow between the implemented [6] Sensirion, Inc., “SHT1x/SHT7x modules for the application. The message coming Humidity and Temperature Sensor,” from the computer is received by the passing_msg module, which delivers the message to the destination 2007, www.sensirion.com/en/pdf mote. Inside the destination mote, the sensor is read /product_information/Data_Sheet_ and the data is sent to the sink mote through the humidity_sensor_SHT1x_SHT7x_E. tree_routing module. pdf. [7] Intersil Corp., “EL7900: Ambient Néstor Peña Traslaviña (npena@uniandes Light Photo Detect IC,” FN7377.6, .edu.co) holds a PhD and a DEA in 2007, www.intersil.com/data/fn/fn Telecommunications from the Univer- 7377.pdf. sité de Rennes in France, a Bachelor’s degree in Mathematics, an MSc in Electrical Engineering, and an Electri- RESOURCES cal Engineering degree from the Uni- Apache Software Foundation, versidad de los Andes. He is an associ- “Mod_python,” www.modpython.org. ate professor in the Electrical and Electronics Department at the Univer- Embedded Networks and Applications sidad de los Andes. Néstor is also the Lab, “XYZ Sensor node,” Yale Univer- director of the group of electronics and sity, www.eng.yale.edu/enalab/XYZ. telecommunications systems (GEST) Swedish Institute of Computer Sci- at the Universidad de los Andes. His ence, “Contiki: A Dynamic Operating research interests include traffic engi- System for Memory-Constrained Net- neering and the design of WSNs. worked Embedded Systems,” www.sics.se/contiki. PROJECT FILES University of California, Berkeley, To download code, go to ftp://ftp.circuit “TinyOS,” 2004, www.tinyos.net. cellar.com/pub/Circuit_Cellar/2008/211. SOURCES REFERENCES ATmega128 Microcontroller and [1] A. Mainwaring, J. Polastre, R. AT45DB041B SPI flash memory Szewczyk, D. Culler, and J. Ander- Atmel Corp. son, “Wireless Sensor Networks www.atmel.com for Habitat Monitoring,” IRB-TR- 02-006, Intel Corp., 2002, www. UISP AVR In-system programmer intel-research.net/Publications/ Free Software Foundation, Inc. Berkeley/120520021024_43.pdf. www.nongnu.org/uisp [2] J. Hill, “System Architecture for EL7900 Light sensor Wireless Sensor Networks,” Doc- tor of Philosophy Thesis, Universi- Intersil Corp. ty of California, Berkeley, 2003, www.intersil.com www.jlhlabs.com/jhill_cs/jhill_ SHT11 Sensor thesis.pdf. Sensirion, Inc. [3] Texas Instruments, Inc., “CC2420: www.sensirion.com 2.4 GHz IEEE 802.15.4 / ZigBee- ready RF Transceiver,” SWRS041B, CC2420 Transceiver http://focus.ti.com/lit/ds/symlink/ Texas Instruments, Inc. cc2420.pdf. www.ti.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 21 2802014-ciarcia.qxp 1/10/2008 1:31 PM Page 22

INTELLIGENT ENERGY SOLUTIONS Solar-Powering the Circuit Cellar Part 3: Wiring & Electronics

Installing a major renewable energy source like Steve’s home photovoltaic system is no small by Steve Ciarcia feat. It requires intelli- gent planning, techni- cal know-how, and the ability to think out- side the box. This month, he describes For the past and approvals were concluded. That’s why this series pres- the last leg of this long technical adven- 2.5 months, I’ve ents subjects primarily in the order in which you have to ture: wiring and electronics. been installing a configure and install a PV system. First, you think about 10.76-kW net- how much power you need and where to put the panels. metered photo- Then you do the site preparation and install everything. voltaic (PV) electric power system at my house in Connecti- Aside from a bit of paranoia and calculations about wind cut. Way back in the beginning of this series, I predicted that loading on the two pole-mounted arrays that resulted in a building this system would be an adventure. Because of the Rock of Gibraltar support base, there haven’t been a lot of lead time associated with presenting all of this in print, I engineering issues. It isn’t until you have panels installed decided to describe it as a work in progress rather than wait and you start wiring and configuring the inverters that you until the entire system was finished and all of the inspections have to think about the engineering aspects of the system

Photo 1—This is my finished PV installation.

22 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com IE 2802014-ciarcia.qxp 1/8/2008 9:36 AM Page 23

again. Before I jump into that, however, let me continue expensive to install, you are typically stuck with whatever where I left off last month. direction and angle the roof happens to be. In Connecticut At the end of last month, I had 20 solar panels on the at least, if it is due south and pitched at about 35° then you solarium roof, two 11′8″ diameter schedule 80 poles stick- pretty much have an optimum fixed-angle system. Of ing out of the ground, and a backyard completely destroyed course, the best solar generation comes from two-axis by cement trucks and heavy equipment. Just so I don’t tracking systems that have pole-mounted motorized arrays keep you in suspense any longer, Photo 1 shows what the that keep the sun perpendicular to the panels all day. While completed arrays looked like when mounted on the poles such systems do exist, I concluded that I didn’t have and their location compared to the roof array. Because the enough available ground area for the poles and that they picture was taken from about 100′ away and the pole- would have been prohibitively expensive for an 11-kW sys- mounted arrays are angled at 35°, dimensions can appear tem. The next best solution was a pole-mounted single-axis deceptive. The total area of the three solar arrays is almost adjustable system like mine. Using the arrangement I’ve 700 square feet, and those “little” pole mounts in the back- described, I can adjust my 6.5-kW pole-mounted arrays ground are 20′ high and over 200 square feet each. within a range of 15° to 65°. All it takes is a quick visit to While fixed-angle roof-mounted solar arrays are the least the PVWATTS energy calculator to determine the optimum

a) b)

c) d)

Photo 2a—Bob and Floyd help the Sunlight Solar Energy crew hoist and bolt the 300-lb strongback to the top of the 11′8″ schedule 80 mounting pole. b—Tom Smith and Jason Ross bolt the module rails and rail brackets to the strongback. c—Tom and Jason start attaching the SunPower SPR-205 solar panels. d—Tom, Jason, and Ian Applegate add #6 braided copper cable to each panel to properly ground the entire array.

IE www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 23 2802014-ciarcia.qxp 1/8/2008 9:36 AM Page 24

tolerance as one that is significantly more expensive, and, “electrically speaking,” bulletproof. I’d like to think my system is the latter. In order to illustrate what I mean, I have to go back and talk about the effects of shading and temperature on solar panels, how much power we lose in all that wire, the conver- sion efficiencies and input toler- ances of the inverter, and maximum power point tracking (MPPT). Figure 1 is the 25°C I-V curve of the SPR-210 solar panel used in my system. (The SPR-205 is essentially the same but 5 W less.) There are four factors that determine solar panel output: photovoltaic cell effi- ciency, load resistance, intensity of the sun, and cell temperature. The first two are very straightfor- Photo 3—The finished pole-mounted arrays are set at 35° for a final test. ward. Solar cell efficiency is deter- mined by the manufacturing monthly solar angle for any location (http://rredc.nrel.gov/ process, and for the SPR-210, it is quoted as 16.9%. The solar/codes_algs/PVWATTS/). load resistance sets the operating point on the current and Assembling the pole mounts was not an insignificant voltage (I-V) curve and is controlled by the inverter MPPT task. This is one of those places where having a profession- algorithm (discussed later). al installer like Sunlight Solar Energy comes in handy. The Solar intensity is a bit more nebulous. The current gener- first task in completing the pole mount was to hoist the ated by the solar panel is directly proportional to the inten- strongback to the top of the 11′ schedule 80 pipe and attach sity of the sun and is pretty much independent of tempera- it to the mounting sleeve pivot bolt. Estimated as about ture. After a five-minute Internet search, you’ll have more 300 lb, it took the whole Sunlight Solar Energy team plus charts, maps, and diagrams of local area sun intensity than Bob Kuca and Floyd Palmer to get it up there (see Photo 2a). you’ll know what to do with. The one unquantifiable Once the strongback is attached, module rails and rail anomaly affecting irradiance is edge-of-cloud effect and brackets are bolted to the strongback (see Photo 2b) and reflection (typically snow). When the sun enters or exits a then solar panels are attached (see Photo 2c). A bunch of cloud, there is at times an increase in solar intensity panels later, the structure starts looking recognizable (see caused by reflection from nearby clouds that causes a sud- Photo 2d). The finished arrays were angled at 35° for the den increase in current output. In the short time my sys- particular time in Connecticut (see Photo 3). Take a look at tem has been running, I have personally seen 2,000-W the different colors in these photos and perhaps you’ll understand why I chose SunPower SPR- 205s for the pole mounts that I can see from the 6.0 house and the deck. They are much more pleas- Maximum power point 5.5 Short circuit current ing to the eye than the SunPower SPR-210s on 5.0 the roof. Maximum power current 4.5 4.0 BACK TO THE SOLAR PANELS 3.5 I’ve been beating around the bush for two arti- Amps 3.0 cles, but now we have the ingredients in place to 2.5

connect the arrays to the inverters and generate 2.0 some power. While some thought had to be 1.5 Open circuit voltage given to sizing all the system components before 1.0 Maximum power voltage starting the project, this is where the interrela- 0.5 tionship among solar radiance, solar panel I-V, 0.0 wiring losses, and inverter dynamics all come 0 5 1015 20 25 30 35 40 45 50 into play to greatly affect system costs and per- Volts formance. The same wattage solar system can be Figure 1—This is an I-V curve for the SunPower SPR-210 solar panel showing the maximum power cheaply configured on the hairy edge of acceptable point.

24 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com IE 2802014-ciarcia.qxp 1/8/2008 9:36 AM Page 25

temperature will be 65°C (149°F). That’s 40°C above the 25°C spec, and the effect could be 40°C × –0.38%/°C = –15.2% loss in power. Of course, the opposite should be true as well, especially in New England. It’s quite possible that we can have days when the panels are operating at –18°C (about 0°F) and we should see 43°C × 0.38%/°C = 16.3% power increase. In general, there isn’t a lot to be concerned about low temperature increases as long as it doesn’t exceed the inverter’s volt- age input range (it doesn’t). Basically, Photo 4—The three SunPower/Xantrex inverters are mounted on a garage wall where it is cool and offers easy take the benefits and run. access to the inverter data ports. For typical operation, solar arrays should be mounted in the sunniest place power spikes as clouds pass (i.e., a jump from 7,500 to and kept as cool as possible. (This is specifically why my 9,500 W). roof panels are mounted on high standoffs to allow air cir- The final solar cell issue is temperature. As the sun’s culation under them.) No part of a PV array can be shaded. brightness increases, the output voltage and power decrease Large solar panels consist of many PV cells in series, and as the temperature of the cell increases. The STC power therefore, all of the cells in the same string are conducting spec is based on a PV cell temperature of 25°C and the Sun- the same current. If any of the PV cells are shaded, they Power A-300 cells used in the SPR-210 will decrease 0.38% cannot produce current and will become reverse biased. per degree centigrade. Especially in the summer, cell temper- This means the shaded cells will dissipate power as heat, atures can typically run anywhere from 30° to 35°C above and over a period of time, failure can occur. Because it is ambient when the module is exposed to “full” sunlight. So, impossible to prevent occasional shading, solar panels if the cell temp is 35°C above a 30°C (86°F) ambient, cell incorporate bypass diodes to conduct current around shaded

IE www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 25 2802014-ciarcia.qxp 1/8/2008 9:36 AM Page 26

service entry panel. The wiring losses for the total

5,000 system were less than 1%. The inverters were chosen with the same accom- 4,000 modation to safety margins. One SPR-3300x was used for each pole-mounted array and one SPR- 3,000 Output 5000x was connected to the roof array. The invert- power (W) 2,000 ers are manufactured by Xantrex Technology and are functionally equivalent to their GT3.3 and 1,000 GT5.0 inverters. Photo 4 shows how Sunlight Solar

0 Energy mounted them to an inside garage wall 25 30 35 40 45 50 55 60 65 70 (with room for accessories). ;-) Temperature (C) When selecting inverters, it’s important to keep in mind that when we are talking about solar pan- Figure 2—GT5.0 power output derating as a function of temperature. els, we are discussing DC watts of input power to an inverter, and when we are talking about the strings. (I read someplace that while the A-300 cells don’t inverters, we are discussing AC power output after all the necessarily need diodes for cell protection, diodes were wiring and conversion losses. Applying 3,200 W from a included in the panels to provide comfort to customers pole array to a GT3.3 rated for 3,300 AC watts output is used to diodes being present in virtually every other brand not running the inverter at maximum level. In fact, of panels.) ;-) Xantrex suggests that arrays up to 3,600 W STC can be safely connected to the GT3.3. Similarly, the 4,200 W from WIRING AND INVERTERS the roof array applied to the GT5.0 is well inside its range. With all that information about the panels, what values It is more expensive to use an overrated inverter, but as are important when we select wire and inverters? Basically, long as the array output voltages stay within the inverter’s think big. maximum power point tracking (MPPT) range, you get the Seriously, solar system configuration is an exercise in added benefit of less output power derating caused by high accommodating worst-case conditions. While we might heatsink temperatures when the solar system is really discuss array output power at nominal conditions, the cranking. As Figure 2 shows, the advantage of running a wiring from the arrays and the inverter input range must GT5.0 inverter at 80% of rated output is that it can take be sized for the highest short-circuit currents and open- more heat before derating its output. I will probably add a circuit voltages. thermostatically controlled fan to each inverter but it may The roof array is configured as two series strings of 10 not be necessary. While I haven’t used the system during panels connected in parallel. The nominal current and volt- the summer yet, the heatsinks seem barely warm running age of this configuration is 400 VDC at 10.5 A. The open- at 9 to 10 kW with 80°F ambient. Because I have the circuit voltage and short-circuit current rating of the panels inverters located in a cool garage, the fans could be just increases these values to 477 V and 11.5 A. Similarly, the more overkill. pole-mounted SPR-205 arrays are configured with two series strings of eight panels connected in parallel and IT’S ALL ABOUT ARCHITECTURE would be 320 VDC at 10.26 A, 383 VDC, and 11.06 A, The Xantrex GT inverter architecture is specifically respectively. That basically says that the inverter inputs designed for grid-tied PV systems (see Figure 3). It uses a and the wiring insulation have to handle 500 VDC. Howev- two-stage power conversion topology to convert DC cur- er, the national electric code requires a 125% safety margin rent from the PV array into AC current directly consumed applied to the worst-case voltage and current values when by the house or net-metered back into the utility grid. A configuring the wiring and circuit breakers. For the pole- transformer isolated DC-to-DC converter stage converts mounted arrays, the requirement is 478 VDC and 13.83 A. For the roof array, it is 596 VDC and 14.4 A.

Because Sunlight Solar Energy fully understood that Isolated buck converter Inverter H-bridge “bulletproof” was the primary decision factor on this PV array VBUS AC grid installation, they decided that the neatest and cleanest way DC DC iarray DC to deal with three separate arrays of this size was to use DC VAC three separate conduits connected to three separate invert- PWM (duty cycle) IAC Inverter Buck bridge ers. The wire connecting the arrays to the inverters was converter controller about 100′. Like I said in the first article, using the higher controller voltage in a grid-tied system eliminates many of the IR varray Output current magnitude losses associated with low-voltage battery backed off-grid MPPT systems. In my case, we used #6 copper wire (rated for 37 A) control from each array to the inverters and #4 copper wire (rated for 60 A) from the combined inverter AC outputs to the Figure 3—Xantrex GT inverter architecture.

26 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com IE 73.qxp 12/4/2007 11:49 AM Page 1

CC_RCM4300_Jan_FP_08019.indd 1 11/29/07 4:04:43 PM 2802014-ciarcia.qxp 1/10/2008 1:36 PM Page 28

power point). P Because the PV array voltage and current are interrelated

PMPP by the I-V characteristic of the PV cells (governed by the semiconductor physics of the cells), an MPPT algorithm controls either array voltage or current to maximize power output. The general relationship between PV array voltage or current and output power (under uniform irradiance) is shown in Figure 4. V or I V or I MPP MPP Maximum power point systems typically control array voltage (by adjusting the power converter input voltage) Figure 4—Characteristic PV array power curve. and the task of the MPPT algorithm becomes one of find-

the PV array voltage (anywhere within 235 to 550 VDC for ing the voltage at the array’s maximum power point (VMPP).

the GT5.0 or 200 to 550 VDC for the GT3.3) and converts The VMPP stays relatively constant with changes in irradi- it to a fixed internal bus voltage of around 400 VDC. The ance, except at low levels, but changes substantially with DC-to-DC converter runs at 15 kHz and uses a high-fre- cell temperature. Therefore, it is not possible to just find

quency switched-mode power conversion technique similar and set VMPP for a particular PV array. It must be tracked.

to electronic power supplies. It also exploits the use of a Fortunately, because VMPP changes mainly with array tem- relatively small, high-frequency isolation transformer and perature (i.e., relatively slowly), the tracking algorithm efficient PWM voltage regulation. does not have to be fast to achieve acceptable accuracy. The internal DC bus has a substantial amount of energy There are several basic MPPT techniques and a multi- stored in electrolytic capacitors. This is needed to decouple tude of variations on the theme. The algorithm used in the the power flow between the two power converter stages. GT inverters is somewhat nonconventional, but it uses the The output stage delivers power in a “lumpy” fashion characteristics of the entire PV array/inverter system to because the power in a single-phase AC circuit varies as determine the maximum power point. sin2 (ωt) (i.e., from zero to maximum at 120 Hz in a 60-Hz The system starts at the extreme right side of the array circuit). However, the power drawn from the PV array power-voltage (P-V) curve (zero power, PV array open-cir- must be continuous to maximize the energy harvested cuit voltage). The MPPT controller increases output power from the array (i.e., no 120-Hz ripple). The DC bus capaci- by increasing the output current magnitude command. As tors provide the necessary filtering (or energy storage) to power is increased, the system operates along the array P-V ensure that the input DC-to-DC converter can operate curve, approaching the maximum power point (see Figure 5). with minimal ripple. The maximum power point is a boundary between stable The output DC-to-AC inverter stage is an H-bridge and unstable regions of operation. To the right of the max configuration using IGBTs, similar to the bridge circuits power point, the system is stable. To the left of the max used in DC servo motor controllers. It operates as a pulse- power point, the system is unstable and the array voltage width-modulated switched-mode power converter with a will tend to “crash” to zero if output power is increased. 20-kHz switching frequency. The pulse-width modulator is The system is at the margin of stability at the maximum controlled by an inner feedback loop that operates the con- power point and the array voltage oscillates at this point verter as a controlled AC current source. The inverter con- (the magnitude of oscillation is quite small, about 1% of troller establishes a sinusoidal current reference that is in the array DC voltage). The MPPT controller detects this

phase with the utility voltage and the feedback loop con- oscillation and uses it to find VMPP.

trols the inverter output current to be a low-distortion (less Once VMPP is found, the MPPT controller holds the sys- than 5% THD) sinusoid in phase with the utility voltage. tem at this voltage by adjusting the output current magni- An output LC filter (low pass) removes the harmonics pres- tude. The controller monitors the magnitude of the array ent in the 20-kHz switching. As you might expect, the net voltage oscillations. If the magnitude exceeds a limit, indi-

result is an output current that complies with utility stan- cating that the operating point is moving to the left of VMPP

dards (derived from IEEE standard 1547) for power quality towards instability (i.e., the actual VMPP has moved right), (harmonic distortion and DC offset) and FCC Class B EMI limits for conducted emissions.

MAXIMUM POWER POINT TRACKING P Oscillation The magnitude of the inverter output current is set by PMPP the MPPT control. If the PV array output power is greater Unstable Stable than the inverter rating (which may be reduced at elevat- ed ambient temperature), the MPPT control sets the out- Increasing power put current to match the inverter power rating. If the PV array output power is less than the inverter power rating, Start (open circuit) VMPP V the MPPT sets the inverter output current to maximize the PV array power (i.e., it tracks the array’s maximum Figure 5—Tracking P-V to determine the maximum power point.

28 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com IE 2802014-ciarcia.qxp 1/10/2008 1:36 PM Page 29

the array voltage is increased to bring the system back to

VMPP. Every 0.7 s, the MPPT controller adjusts the VMPP set- point to see if the actual maximum power point has moved to the left. If power can be increased without the magni- tude of oscillations exceeding the limit, the setpoint is changed to the improved value. The Xantrex GT series MPPT controller is implemented in a Freescale Semiconductor HC12 microcontroller. The microcontroller is also responsible for the user interface and data network functions. A separate Microchip Technol- ogy PIC18F series microcontroller is used for the grid inter- connect protection functions specified by the IEEE Stan- dard for Interconnecting Distributed Resources with the Electric Power Systems. These require the inverter to rap- idly shut off the output connected to the grid if the grid voltage or frequency goes outside specified limits. The pulse width modulators and inner-control loops are imple- mented with discrete analog and digital circuits. Finally, like most of the electronics I buy, I always like Photo 5—This is an inside look at the GT5 inverter. The toroid isolation transformer is to look under the hood. Before taking apart the inverters on at the upper right and the DC bus electrolytic capacitors are to the left of the trans- my wall, however, I spent some time e-mailing the kind former. There are a lot of inductors and capacitors—used both as parts of the power conversion circuits and as filters to remove ripple and EMI. The power semiconduc- folks at Xantrex and they were happy to answer my ques- tors are not visible because they are attached to the heatsink on the other side of the tions and provide me with a picture of the inside of the main PCB. GT5 so I didn’t have to disassemble mine (see Photo 5). ;-) primarily because the roof array pitch is maximized for the SO, DOES IT WORK? middle of the summer and not mid-fall. Ignoring edge-of- As I write this, the PV system has been operational for cloud effects, I did see 10,000 W being produced one after- three weeks. I haven’t seen any 10,760-W output, but that’s noon, but it has typically been about 8,000 to 9,000 W and

IE www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 29 2802014-ciarcia.qxp 1/10/2008 1:38 PM Page 30

resort to these methods because I want- ed immediate display solutions, but fortunately, Xantrex has a better answer for the long run. In the first quarter of 2008, Xantrex will have a TCP/IP Ethernet/wireless “Gateway” that connects to the CAN bus and dis- plays both real-time and archive record- ings directly. The next time I present an article about my system, I should be showing this new device installed. Still, seeing what the solar system is producing in real time is only half the story. How do I know whether I am producing more power than I am using or just how bad is it when I turn on the 5-ton air conditioner in the solarium? Obviously, I can wait and rely on the power company to tell me there’s a kilowatt-hour surplus or deficit on my monthly electric bill (nah!), or I can close the loop myself. The only way to Photo 6—This screenshot illustrates a recent daily recording of two data points. The power difference in magni- know whether I have a surplus is to tude between the blue and red traces represents the power being redirected to the grid (red higher than blue) or monitor the power consumed by the consumed from the grid (red less than blue). entire house in real time and compare it to the amount being generated at the I have been racking up a bunch of kWh credits on the same time by the solar system. meter. (I was intrigued to see the system even generating The classical method for monitoring AC power is to put 1,500 W during a moderate rainstorm last week. I guess a current transformers around the AC wires in question, con- lot more light filters through the clouds than I realized.) nect the core secondary to a true RMS converter, and then Because I haven’t been using a lot of air conditioning this write a bunch of software to display and plot the results. late in the fall, I expect that my net-metered electric bill Great idea, but I was a bit limited on time for building all my for October could be $0, with perhaps even some additional own circuitry. Instead I found an almost perfect off-the-shelf solar credit toward next month. Of course, next July might solution from PICO Technology. Using an EL040 current be a whole different story. ;-) Unfortunately, because this has been a work in progress, I haven’t had the usual six months to a year to design and implement elaborate solar monitoring software that seems part of everyone else’s solar system article these days. The Xantrex inverters have an RS-232 data port that enables connection to a computer for analysis and a CAN bus that connects to an LCD for local moni- toring. The only display software I’ve seen thus far is user-supplied and not very user-friendly. While I was able to configure two GridConnect NETDIO serial-to-Ethernet converters into a “tunneling RS-232” arrangement that at least allowed this software to run on a computer located farther away than a 50′ RS-232 cable, I discarded it for a more innovative kludge. I simply mounted a web cam in front of the Xantrex LCD monitor and called the Photo 7—LED bulbs are typically designed as either series/parallel strings of discrete LEDs with simple power power display up as a web page. I had to regulators or a small number of very high-power LEDs with sophisticated AC-powered switchmode converters.

30 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com IE 2802014-ciarcia.qxp 1/8/2008 9:37 AM Page 31

monitor with three split-core current clamps (rated at 0.1 to is lighting, and there’s a lot of it. There has to be 100 incan- 300 A AC) and an EL005 RS-232 output data logger, I am descent light bulbs on this property along with enough able to record the current on each side of the 240-VAC line floodlights to illuminate a Wal-Mart parking lot. Seriously, feeding the main AC distribution panel plus the 240 VAC there is a bunch. output from the inverters. The PICO data logger comes A number of years ago, I converted most of the outside with PC software called EnviroMon that graphs and displays flood lights to efficient high-pressure sodium vapor. When I the three readings. The data logger can hold about 60 days of started converting the inside incandescent lights to com- recorded readings when taken once per minute. Photo 6 pact fluorescent (CFL), I ran into a problem. The vast illustrates a recent daily recording of two data points. The majority of lights in my house are either connected to man- blue trace shows the AC current feeding the main distribu- ual dimmer switches, motion sensing on/off switches, or tion panel (the total house load) and the red trace is the home-control-system-managed X-10 modules. The com- solar system output (the current contribution from the mon ingredient in all these devices is that they incorporate solar system). The power difference in magnitude between TRIAC outputs. the blue and red traces represents the power being redirect- TRIACs and CFLs don’t get along well and early genera- ed to the grid (red higher than blue) or consumed from the tion CFLs buzzed, flashed, or just plain didn’t work with grid (red less than blue). most of these TRIAC-based controls. Current generation CFLs have vastly improved electronics, so I went on a CONSERVATION quest to replace all the incandescents that I had originally OK, this might seem gratuitous coming from a guy with targeted with the hope that I could succeed this time 12 tons of air conditioning, but I’ve been trying to clean up around. The success was better, but not complete. Let me my act. While my previous existence did involve simply explain. turning on all the air conditioning from April to November If you have a simple mechanical wall switch controlling and running temperatures closely resembling a meat lock- a desk lamp, then by all means put a CFL in it. However, if er, I haven’t done that since embarking on this project. that desk lamp is controlled by an X-10 module or motion- These days, I actually check the outside temperature and sensing wall switch, prepare to do some experimenting. open windows or use fans before resorting to more energy- Low-cost CFLs are not created equal and, in my experience, intensive cooling solutions. I won’t say that not having any different brands may operate quite differently when con- more $500/month electric bills isn’t a righteous incentive, nected to “non-standard” light switches. Some will work but going through all the effort and justification for with TRIACs while others won’t without occasionally installing solar power tends to add a little “religion” to flashing at inopportune times. Replacing lamp modules one’s lifestyle. with appliance modules offers some remedy but can also I might have said this before, but the size of my solar introduce a new set of problems. The new CFLs have much system was intended to offset 82% of my electric use based more efficient electronic ballasts. The manual turn on on past bills. As long as the summer heat isn’t too oppres- sensing current used in the standard X-10 module is sive, saving energy by reducing some of the air condition- enough power to cause some low-cost brands to flash even ing is a no-brainer. But the next conservation iteration was- when the module is turned off. n’t quite as easy. Other than an electric stove and an elec- Fortunately, recently developed “dimmable” CFLs seem tric clothes dryer (domestic hot water and home heating to be much more TRIAC and “X-10 sensing current” toler- are both oil), my next major source of energy consumption ant, and I was finally able to install a couple dozen of those

a ) b )

Photo 8a—The manual turn on “sensing” current of standard X-10 appliance modules is enough to keep LED lights from ever totally shutting off. b—INSTEON appliance modules, which are also X-10-compatible, have a lower sensing current, which does not trigger the LEDs.

IE www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 31 2802014-ciarcia.qxp 1/8/2008 9:37 AM Page 32

with success. The only downside is that the $0.60 incandes- even false-triggering the switching regulators and making cent that was being replaced by a $2 CFL is now being them flash. In my case, the only solution was to still use replaced by a $14 “better” CFL. That’s where “faith” X-10 communication but eliminate traditional X-10 mod- becomes part of the renewable energy exercise in order to ules—basically, find a better mousetrap. offset the obvious financial disconnect. But, it gets worse. ;-) The answer for me turned out to be INSTEON control The bad news is that CFLs just don’t hack it, period, in modules from Smarthome. Photos 8a and 8b demonstrate some of my lighting applications. As you may already the results. When the LED bulb is plugged into the stan- know, I have had a home control system for many years. dard X-10 appliance module (forget using lamp modules One of its functions is to control the lighting on the cellar with these bulbs), the manual turn on current is enough to staircase, in the hallways, and in some of the rooms based keep the bulb partially lit. When it is plugged into the on occupancy. Step onto the stairway and the lights go on. INSTEON appliance module, the sensing current is low Two minutes after sensing no motion, the lights go off. enough that the bulb is off. (Of course, every solution has a One of the bad traits about CFLs is that they can have a price, and if we go back and look at the decision trail, it very long turn on time to get to full brightness—ranging gives a whole new meaning to the “insanity factor” of the from a couple of seconds to almost a minute. And, cycling people with PV systems. Realize, that we have just gone them on and off a hundred times a day puts them in an from replacing a $0.60 incandescent bulb first with a $2 early grave. cheap CFL and then to a $14 expensive CFL, only to finally The CFLs with the fastest turn on time necessary for a end up with a $97 LED light that needs a $35 control mod- quick traverse through a hallway or a staircase seem to ule—but heh, it works.) ;-) exhibit the shortest cycle life. (I heard a number like 8,000 INSTEON modules use a combination of power line and times as being the average duty cycle life for many of these wireless control transmission to facilitate a more reliable bulbs despite a 20,000-hour operating life.) Similarly, the modular control system than plain X-10. And, while my dimmable fluorescent bulbs that appear not to have auto- home control system is not currently INSTEON compati- matic control sensitivities seem to take forever to turn on. ble, INSTEON modules can emulate X-10 communication After experiencing a half dozen CFL failures due to exces- and function as X-10 replacements. The good news is that sive cycling, I almost had to resort to using incandescents they are a better mousetrap and don’t need anywhere near again. as much sensing current for the manual turn on capability I said almost. It turns out that years of technical evolu- (which apparently can be disabled when not emulating X-10 tion have benefited another lighting scheme—LEDs. While only). Another thing I noticed was that INSTEON modules still first-generation and not even close to the cost-benefit appear to be more sensitive than the standard X-10 mod- ratio of CFLs, they are low power, low heat, and long life. ules. Some of the occasional flaky responses I had been The greater benefit for me is that they are truly instant-on experiencing with standard X-10 went away after I replaced and have no duty cycle limitations that I know of. The bad about 30 modules with INSTEON devices. I can’t wait news is that making them work in a computer-controlled until my HCS can use INSTEON’s full benefits. house is almost as aggravating as CFLs. Current LED lights seem to be designed either as dozens SOAKING UP SOME PHOTONS or more of discrete LEDs connected in series/parallel com- Building this PV system has been a big undertaking in a cou- binations using a simple RC and diode connection to the ple of ways. Besides the physical installation of all the hard- AC line, or a limited number of special high-power LEDs ware, it’s the first time I’ve written a series of articles in a controlled by sophisticated built-in wide-input-range number of years. I’d like to say it was easy getting back into switching regulators straight on the AC line (see Photo 7). the saddle, but it took a while after such a long vacation. Of In fact, there are so many variations on a theme among course, now that I’m enjoying my new project, it’s hard to stop brands and bulb types that except for a simple contact clo- re-engineering everything around it. My first priority is to add sure, there is no guarantee that a control module or motion a lot more instrumentation and remote data monitoring. I will switch that works on one LED bulb type will work on the be back in a few months to describe some of that. Until then, next, even within the same brand. Depending on the cur- as soon as it gets a bit warmer around here, you can expect to rent regulation employed, many also seem to exhibit sensi- find me sitting out on the deck with a cool drink watching my tivity to TRIAC-controlled switches and X-10 module man- solar panels soak up photons and thinking about my next ual trigger sensing currents. renewable energy project. I X-10 modules facilitate manual turn on by sensing that a small leakage current around the TRIAC in a lamp module Author’s Note: Special thanks to Konrad Mauch of Xantrex or the relay in an appliance module is interrupted. Because X- Technology for his help explaining GT5.0 technology. 10 technology and the basic module design is about 30 years old and traditionally applied to incandescent bulbs that Steve Ciarcia is an electronics engineer and computer don’t “glow” with the relatively low sensing current, it consultant with experience in process control, digital design, wasn’t a big issue how “low” this current is by today’s and product development. He founded Circuit Cellar in 1988 standards. The supposedly “low” sensing current is actual- and currently serves as the magazine’s editorial director. You ly enough to keep some LED bulbs from fully turning off or may contact him at [email protected].

32 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com IE 2802014-ciarcia.qxp 1/8/2008 9:37 AM Page 33

RESOURCES SOURCES Connecticut Clean Energy Fund (CCEF), www.ctinnovations. LED Bulbs com/funding/ccef/about.php. BestHomeLEDLighting www.besthomeledlighting.com P. Davidson, “Shocking Electricity Prices Follow Deregula- tions,” USA Today, August 10, 2007. EL005 RS-232 Output data logger, EL040 current monitor, and EnviroMon data logging system J. Dunlop, Photovoltaic Systems, American Technical Pub- PICO Technology lications, Inc., Homewood, IL, 2007. www.picotech.com National Renewable Energy Laboratory, “IEEE1547 Stan- Series 225-8/80 Top-of-pole mount dard for Interconnecting Distributed Resources With the POWER-FAB Electric Power Systems,” 2003. www.power-fab.com POWER-FAB, “Series 225-8/80 Top-Of-Pole Mount Installa- INSTEON PowerLinc controller tion Instructions,” 2005. Smarthome, Inc. Renewable Resource Data Center, “PVWATTS Energy cal- www.smarthome.com culator,” National Renewable Energy Laboratory, http://rredc. SPR-205-BLK and SPR-210 PV Modules nrel.gov/solar/codes_algs/PVWATTS. SunPower Corp. Sunlight Solar Energy, Inc., www.sunlightsolar.com. www.sunpowercorp.com

SunPower Corp., “SPR-205-BLK Residential PV Module,” PV Module racks 001-12153, 2006. UniRac, Inc. www.unirac.com ———, “SPR-210 High Efficiency PV Module,” 001-03296, 2006. GT Series grid tie solar inverters Xantrex Technology, Inc. ———, “SPRx High Efficiency Inverters,” 001 08227, 2006. www.xantrex.com

IE www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 33 2802018cossio.qxp 1/8/2008 9:35 AM Page 34

FEATURE ARTICLE by Carlos Cossio RFID Payment Terminal

Carlos’s LM3S811-based handheld terminal makes contactless payments a reality. The terminal’s LCD—which shows the date and time—prompts you to enter payment amounts on the keypad. After transactions are complete, the log file stored on the device’s flash memory can be sent to a host system through an RS-232 interface.

When I first saw a contactless card In order to support such applications, demonstrate the use of RFID technol- in action, it seemed like magic. A sin- financial institutions and transit oper- ogy for contactless payment. The gle piece of plastic with no battery ators are issuing millions of contact- design (I call it “MoneyPenny”), inside was able to exchange informa- less cards and key fobs. Some govern- which is built around a Luminary tion back and forth in a nearby termi- ments are planning to distribute mil- Micro Stellaris LM3S811 microcon- nal with the help of just a coil anten- lions of ePassports and national ID troller, implements an electronic na. It was amazing! cards equipped with contactless chips purse (e-purse) application for an NXP I later discovered that the contactless and antennas, and many corporations Semiconductors MIFARE contactless card was part of a technology called are already issuing contactless cards card with an operating distance of up RFID. You may know that RFID technol- and badges to employees to control to 10 cm (see Photo 1). ogy, which is changing the world of building access. tracking and logistics, will soon replace My project showcases the design of SYSTEM OVERVIEW the old-fashioned barcode technology that a contactless handheld terminal to My RFID payment terminal has an has been in use for more than 30 years. However, the RFID contactless card is one step ahead when compared with RFID memory tags. It has all of the functionality and security offered by the smart card but without the contact interface. That’s why it is called a con- tactless card. Even though RFID technology was originally intended for the tracking and logistics markets, they are not the only places where this promising tech- nology can be used. Thousands of con- tactless readers are quickly appearing in stores, restaurants, and other mer- chant locations throughout the world to enable contactless payment, replac- ing the old magnetic stripe cards (e.g., the successful PayPass card from Mas- terCard). This technology is also used in transit systems to enable fast and convenient travel for commuters. It is also used as a ticket for transport applications issued by public transit operators in major cities around the Photo 1—This is the RFID payment terminal at work. Just enter the desired amount and pass a MIFARE card in world (e.g., the Oyster card in London). the vicinity of the terminal to start the contactless transaction.

34 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802018cossio.qxp 1/8/2008 9:35 AM Page 35

LCD to show the current date RWD RWD Card coil the contactless card uses opti- antenna and time and prompt you to enter antenna Card coil mized coding to provide a con- your desired payment amount. It I k stant level of energy independent- L L also has a numeric keypad for 1 2 ly from the data transmitted to entering data, such as the pay- the card. This is the modified ment amount, and setting up sev- Miller code, which is used to Energy eral parameters of the terminal. - transmit data from the reader to Additionally, thanks to the built- Data the card. Figure 2 shows Miller in real-time clock (RTC) and flash coding in detail. memory, you can keep a log file The data rate of the contactless Figure 1—The transformer model is used to transfer energy and data of all the transactions performed wirelessly between a reader and a contactless card using inductive card is 106 kHz, so the length of a by the terminal with a time and coupling. bit frame is 9.44 μs. A pulse in date stamp for all approved trans- the Miller coding has a length of actions. Upon request, the log file can principle and the equivalent electronic 3 μs. A logical “1” is expressed with a be sent to a host system through an circuitry. The antennas and energy pulse in the middle of the bit frame. RS-232 interface for further storage and transmission are depicted on the left- Two possibilities are given to code a analysis. hand side of Figure 1. logical “0.” This coding depends on I implemented the contactless inter- The current “I” in the reader anten- the previous bit. On one hand, if the face with the help of an NXP Semicon- na coil generates a magnetic flux. Parts previous bit was a “0,” the following ductors MF RC531 ISO 14443 reader IC of this flux flow through the card coil “0” would be expressed with a 3-μs for the modulation and demodulation and induce a voltage in the card coil. pulse in the first half of the next bit of the contactless signals at 13.56 The voltage is rectified and the card IC frame. On the other hand, if the previ- MHz. Additionally, the contactless ter- is activated when the operating voltage ous bit was a “1,” the following “0” minal has an innovative built-in anten- is reached. The induced voltage varies would be expressed without a pulse in na under the keypad to enable portable within the distance between the reader the next bit frame. operation right out of the box without antenna and the contactless card. Due plugging in an external antenna. to that voltage variation, the achiev- LOAD MODULATION The following is a brief introduction able operating distance is limited by Data transmission from the card back to the principles of contactless tech- the transferred power. The right-hand to the reader is completed using the prin- nology, which will help you under- side of Figure 1 shows the equivalent ciple of load modulation (see Figure 3). stand how the device works. electrical circuitry, the transformer The card is designed as a resonance cir- model. cuit and consumes energy generated by ENERGY TRANSMISSION the reader. The energy consumption Energy transmission between the 100% AMPLITUDE MODULATION has the same reactive effect as a voltage reader antenna and the passive con- To transfer data from the reader to drop on the reader side. This effect can tactless card is based on the trans- the card, the contactless card uses a be used to transfer data from the card former principle. On the reader side, half-duplex communication structure. back to the reader by changing a load or an antenna coil and a card coil imple- The reader talks first and starts the a resistance in the card IC. mented in the contactless card are communication. The data transmission The reader antenna should be tuned to

required. Figure 1 shows the basic from the reader to the card is done a resonance frequency fR of 13.56 MHz. using a 100% ASK pulse-pause In fact, the resonance circuit generates modulation according to ISO voltages in the reader antenna several Modulated carrier 14443 Type A. times higher than the supply voltage. 9.44 µs Data bit “1” Due to the quality factor Q of Due to the small coupling factor the antenna, the transmitted between the reader and the card antenna, 3 µs signal deforms. This shape can the card response is about 60 dB weaker be used to measure the tuning than the voltage generated by the reader. Data bit “0” 9.44 µs of the antenna. Later, I will The detection of such a signal requires a describe the theoretical back- well-designed receiving circuit. Instead of Previous bit “0” ground of calculating the anten- using a direct-load modulation, the con- 3 µs na quality factor Q and explain tactless card uses a sub-carrier frequency 9.44 µs how to calculate the compo- fSUB to modulate the data. The result of nents of the matching circuitry. the sub-carrier modulation is the genera- Previous bit “1” ± The contactless card is usual- tion of sidebands at fSUB around the car- ly passive. To enable communi- rier frequency of 13.56 MHz. The sub- cation between the reader and carrier load modulation enables easy and Figure 2—The modified Miller coding provides a constant level of energy independently from the data transmitted to the card. It is the card, energy has to be trans- robust detection of the received signal. used to transmit data from the reader to the card. mitted to the card. Therefore, The contactless RF interface uses

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 35 2802018cossio.qxp 1/8/2008 9:35 AM Page 36

RWD MIFARE Card terminal antenna, the high- In the anti-collision loop, the serial speed RF communication number of a card is read. If there are k interface enables you to trans- several cards in the operating range of mit data at 106 kbps. the RFID payment terminal, they can be An intelligent anti-collision distinguished by their unique serial data + fSUB function enables you to oper- numbers. One can be selected (select ate more than one card in the card) for further transactions. The unse- field simultaneously. The lected cards return to the standby mode anti-collision algorithm and wait for a new request command. Figure 3—The principle of load modulation enables data transmission selects each card individually With the Select Card command, the from the card back to the reader by changing a resistance in the card IC. and ensures that the execu- RFID payment terminal selects one tion of a transaction with a card for authentication and memory- selected card is performed related operations. The card returns Manchester coding for the data in the correctly without data corruption the answer to select (ATS), which baseband before the sub-carrier modu- resulting from other cards in the field. determines the type of selected card. lation is done. Figure 4 shows the typ- Special emphasis has been placed on After a card is selected, the RFID ical data coding and the sub-carrier security against fraud. Mutual challenge payment terminal specifies the memo- load modulation in the time domain. and response authentication, data ry location of the following memory First, data are internally coded to the ciphering, and message authentication access and uses the corresponding key Manchester coding. The data rate of the checks protect the card from any kind for the three-pass authentication proce- contactless card for the communication of tampering, thus making it attractive dure. After a successful authentication, from the card to the reader is 106 kHz. for ticketing applications. Serial num- all memory operations are encrypted. The same goes for the communication bers, which cannot be altered, guarantee After authentication, any of the fol- between the reader and the card. So, the the uniqueness of each card. lowing operations may be performed: length of a bit frame is 9.44 μs. The The standard MIFARE card has a read a block, write a block, decrement Manchester code uses rising and falling memory capacity of 1,024 bytes of EEP- the contents of a block into a temporary edges to code the data. ROM and is organized in 16 sectors with register, increment the contents of a A logical “1” is expressed with a four blocks of 16 bytes each. The last block into a temporary register, transfer falling edge in the middle of the bit block of each sector contains two secret the contents of the temporary register frame. A logical “0” is expressed with keys and programmable access condi- into a block, and restore the contents of a rising edge in the middle of the bit tions for each block in the sector. Each a block into a temporary register. The frame. sector can be seen as an application, so it commands are the basis for the elec- The contactless card generates the sub- is possible to support multiple applica- tronic purse application I implemented

carrier frequency fSUB = fR/16 = 847.5 kHz. tions with key hierarchy. Other members in the RFID payment terminal.

The time T0 expresses the pulse length of of the MIFARE family support memories

the operating frequency, T0 = 1/fR = 74 ns. ranging from 512 bytes to 4 KB. MIFARE AND ISO 14443 The Manchester coded data is modulat- After the power-on reset (PoR) of a MIFARE is reputedly the most wide- ed at the sub-carrier frequency. Finally, MIFARE card, it can answer to a request ly installed contactless smart card the sub-carrier load modulation is com- command—sent by the RFID payment technology in the world with approxi- pleted. Thus, the sub-carrier load modu- terminal to all cards in the antenna mately 500 million smart card chips lation generates two sidebands in the field—by sending the answer to request and 5 million reader modules in use to frequency domain, an upper sideband at code (ATQA according to ISO 14443A). date. The technology is patented by 14.41 MHz and a lower one at NXP Semiconductors and 12.71 MHz. licensed to many semiconduc- “1” tor manufacturers, such as µ “0” MIFARE CARD 128 T0 = 9.44 s Baseband data Infineon Technologies, Manchester MIFARE technology describes coding Hitachi, and Atmel. MIFARE an ISO 14443 Type-A-compliant proprietary technology is RF interface for communication Subcarrier based on the ISO 14443 µ between a reader and a contact- 16 T0 = 1.18 s (RFID) Type A 13.56-MHz less card at 13.56 MHz. The contactless smart card stan- Subcarrier MIFARE card is connected to a coding dard. The technology is coil with a few turns and then embodied in both cards and Subcarrier embedded in plastic to form load readers (also referred to as a the passive contactless smart modulation proximity coupling device). card. No battery is needed. The MIFARE name covers When the card is in the prox- Figure 4—Manchester data coding is used in the RF interface to transmit data two different kinds of con- imity of the RFID payment back to the reader. tactless cards. On one hand,

36 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802018cossio.qxp 1/8/2008 9:35 AM Page 37

MIFARE standard or classic cards If the transaction succeeds, MoneyPenny HW employ a high-level proprietary proto- the RFID payment terminal initialization col instead of ISO 14443-4 with an sounds one beep and displays MoneyPenny NXP Semiconductors proprietary secu- a Thank You message. In the 2007 MoneyPenny rity protocol for authentication and case of a failed transaction, prompt menu Update ciphering. On the other hand, MIFARE the RFID payment terminal time & date ProX and SmartMX are NXP brand sounds a beep twice. In both names for smart cards that comply cases, at the end of the trans- Enter amount ... 01/01/2007 00:00 with ISO 14443-4 (T = CL). action, the RF field is turned MIFARE technology has been under off to save power. When the Numeric Y MoneyPenny the ISO rules for licensing since the RFID payment terminal is in key (0..9) ? pass development of the ISO 14443 standard, an idle state, it is possible to N so there are no licensing issues for com- configure some parameters Function Y MoneyPenny mercial applications or any additional and perform some housekeep- key A ? on/off

fees that are not covered in the purchase ing tasks, such as getting the N price of the cards and reader chips. activity log to a host comput- Function Y Setup MoneyPenny er and so on. key B ? time & date

PAY AS YOU GO After pressing the B func- N Once the RFID payment terminal is tion key, the LCD shows a Function Y Setup MoneyPenny powered up, a Welcome message is dis- message requesting that you key C ? password played on the LCD for several seconds. enter the new time. The time N Following this, the display shows the should be entered in 24-hour N Function Y Send MoneyPenny current date and time and prompts you format. The system checks key D ? log to enter the required amount using the that the new time is meaning- keypad (see Figure 5). ful; otherwise, it requests the The function keys on the keypad are time again. After the time is Figure 5—Here is a flowchart of the main menu. Different options are available when a MIFARE card is in the vicinity of the RFID payment available for maintenance purposes, such accepted by the system, the terminal. as powering the device on and off, setting payment terminal requests the the date and time, updating the system desired date, which is entered password, or sending the activity log to a using the format: DDMMYYYY. Once the prompt and the updated date and host PC through the serial channel. As again, the system ensures that the new time. soon as you enter a valid amount, the date is meaningful to avoid any mis- Pressing the C key enables the super- RFID payment terminal starts the trans- configuration. At last, the system visor password to be changed once the action process by turning on the RF field comes back to the main screen showing old one has been successfully verified. and waiting for a contactless Pressing the D function key MIFARE card in the termi- enables the activity log stored nal range, which is about in the flash memory of the 10 cm. When a valid card payment terminal to be sent is shown, and after the anti- to a host PC through the seri- collision procedure and al interface. HyperTerminal mutual authentication are could be used to retrieve the successfully resolved, the log file and should be config- RFID payment terminal asks ured at 115,200 bps, 8 bits of the contactless MIFARE data, 1 stop bit, and no pari- card for the current balance. ty bits. Each record of the If the balance is greater than log file contains the transac- the requested amount, the tion amount, the date, the transaction can proceed, time, and the card’s serial updating the new balance on number. the contactless MIFARE card and saving a log record HARDWARE DESIGN with a time and date stamp I built the hardware in the payment terminal’s design around the Luminary flash memory. Otherwise, Micro LM3S811. It has the the payment terminal small footprint required for informs you that the bal- this application with a large Photo 2—This is a close-up view of the RFID payment terminal’s internal circuitry. The ance is too small and stops hardware is so simple because all of the complexity dealing with the contactless interface flash memory (see Photo 2). the transaction. is performed by a dedicated IC designed by NXP Semiconductors. Because the hardware

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 37 2802018cossio.qxp 1/8/2008 9:35 AM Page 38

Figure 6—The main board is built around a Luminary Micro LM3S811 microcontroller. The schematic for the coil antenna is at the bottom.

design is intended to work as a portable The LCD module is a standard 2 × 16 proportionally distributed among all handheld payment terminal, it is pow- display, compatible with the industry- keys in increments of 500 Ω. To ensure ered through a 9-V alkaline battery (see standard Hitachi LCD controller. It is good keypad reliability, it is a good idea Figure 6). The battery voltage is connected to the LM3S811 using a 4-bit to choose all the resistors as precision stepped down to 5 V with the help of a bus configuration to save I/O lines. resistors of 1% tolerance. 5-V fixed-voltage regulator to power all The keypad is a 16-key multiplexed Communications with the outside of the circuitry inside. The EK-LM3S811 keypad to enter numerical and world are accomplished with the help board has its own voltage regulator to alphanumerical data when requested of a MAX232 level shifter to enable an achieve 3.3 V, which is the voltage by the device. To save I/O lines, the RS-232 interface. There is a buzzer of required by the LM3S811. Additional- keypad is connected to the LM3S811 programmable frequency used to sig- ly, for longer periods of activity, it is analog input ADC through a resistor nal specific events such as transaction possible to use an external 9-V power ladder. The resistor network values completed successfully, transaction supply. are chosen so the impedance drop is failed, or keypad beep.

38 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 39.qxp 12/31/2007 12:55 PM Page 1 40.qxp 12/31/2007 12:38 PM Page 1 2802018cossio.qxp 1/8/2008 9:35 AM Page 41

The real-time clock achievable energy for the support of the RFID main. c card IC varies depending payment terminal is on the distance between accomplished with a the reader antenna and MoneyPenny.c 32.768-kHz crystal the card. As I mentioned oscillator using a Pierce before, the contactless oscillator design. MIFARE card is based on The contactless inter- Keypad.c MfRc500uC.c the transformer principle. face is implemented One important parameter with the help of the MF Clock.c RS232.c Flash.c Buzzer.c RTC.c LCD.c ADC.c SPI.c describing a transformer RC531 ISO 14443 reader is the coupling coeffi- IC for the modulation cient K. It can be defined Stellaris driver library and demodulation of the as a geometrical parame- contactless signals at ter depending on the dis- 13.56 MHz. Additionally, Luminary Micro Stellaris LM3S811 tance between the reader the RFID payment ter- antenna and the card coil minal has an innovative Figure 7—The module hierarchy for the firmware is fairly simple. There are different layers of and both the size of the built-in antenna under complexity. Each microcontroller peripheral has its own driver in a separate source file. There is reader antenna and the the keypad to enable no need for an RTOS. one on the card coil portable operation right itself. Assuming that for out of the box without a standard application the plugging in an external antenna. for a contactless card system depends contactless MIFARE card has chip card Finally, note that debugging and on several factors, such as the reader dimensions, the card coil dimensions firmware downloading is easy. There antenna size, the quality of the match- are fixed. is a USB port connection for debug- ing circuit for the given antenna, and As a rule of thumb, the maximum ging and updating the flash if further other environmental influences. The coupling coefficient K for a fixed dis- updates or enhancements are planned contactless MIFARE card is powered by tance between a reader antenna and a in the future. a flux generated by the reader. The card coil is achieved when the radius

ANTENNA DESIGN RULES The MF RC531 is a single-reader IC. It is designed to achieve operating dis- tances of up to 100 mm without external amplifiers. The design of the remaining passive RF part is straightforward. First, you have to decide which of the possi- ble basic concepts meets the applica- tion requirements best. Two different concepts are possible when designing an antenna and a matching circuit. On one hand, directly matched antennas can be used to build small, complete terminals with a minimum distance between a reader and an antenna. Possible applications could be an access control reader in a small housing or a handheld reader. On the other hand, 50-Ω matched antennas can be used for an easy solu- tion to achieve long distances between the reader and the antenna using a coaxial cable. With a coaxial cable between the reader matching circuit and the antenna itself, distances up to 10 m between these parts are possible.

ANTENNA SIZE The achievable operating distance

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 41 2802018cossio.qxp 1/8/2008 9:35 AM Page 42

the correct values for the antenna’s matching cir- cuit. The following is a brief description of the necessary components, the EMC filter, the receiv- ing circuit, and the anten- na matching itself for the proper functionality of the contactless system (see Photo 3). The EMC circuit is a fil- tering and impedance transformation circuit that suppresses higher har- monics and optimizes power transmission to the reader antenna. The con- Photo 3—To test the terminal’s hand-made coil antenna, I used a simple tactless circuit is based on one-turn coil made with a wire attached to an LED. The energy transferred to the test coil is enough to light up an LED to several centimeters. an operating frequency of 13.56 MHz. The frequency has to be generated by a of the reader antenna is equal to the quartz oscillator, which also generates distance. The calculation is made for a higher harmonics. To conform with inter- circular antenna. If a rectangular or national EMC regulations, the third, fifth, square antenna is used in practice, a and higher harmonics of the 13.56 MHz circular one with an equivalent area have to be adequately suppressed. In can be used for the estimation. addition to a multilayer layout, it is However, there are some important strongly recommended to implement a notes to take into account. First, the low-pass filter circuit for the Tx1 and estimation that the radius of the read- Tx2 pins of the MF RC531. The low-pass er antenna should be equal to the filter is designed with an inductance of achievable operating distance is only 1 μH and a capacitance of 68 pF. the first step for a successful antenna A receiving circuit has to be designed design. For a complete design, the to receive data sent by the card. The environmental influences, as well as internal receiving part of the MF RC531 antenna size limitations due to appli- uses a new receiving concept to enable cation-related restrictions have to be easy and robust detection of the weak taken into consideration. received signal. Because the MIFARE

Second, the estimation shows that card uses a sub-carrier frequency fSUB to increasing the antenna radius will not modulate the data sent, instead of using automatically increase the operating a direct-load modulation of the carrier distance. Energy transmission from the frequency, it results in the generation of ± reader to the card is a limiting factor, sidebands at fSUB around the carrier fre- which can be expressed with a mini- quency of 13.56 MHz. Because of the mum coupling coefficient of 0.3. And small coupling factor between the read- finally, note that the formula for the er and the card antenna, the card calculation of the coupling coefficient is response is much weaker than the volt- not dependent on the number of turns age generated by the reader. The detec- of the reader antenna. tion of that signal requires a well- designed receiving circuit. So, instead of DIRECTLY MATCHED ANTENNA using a direct load modulation, the con- I decided to implement a directly tactless card uses a sub-carrier frequen-

matched antenna circuit design in the cy fSUB = 847.5 kHz to modulate the data. RFID payment terminal, which enables The sub-carrier load modulation gener- operating distances of up to 100 mm. ates two sidebands in the frequency The operating distance primarily domain: an upper sideband at 14.41 MHz depends on the size of the antenna and and a lower one at 12.71 MHz around the

42 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802018cossio.qxp 1/8/2008 9:35 AM Page 43

carrier frequency, which is 13.56 MHz. distance between the turns, the Carlos Cossio ([email protected]) The sub-carrier load modulation shielding layer, and metal or ferrite earned a B.S. in Physics (majoring in enables easy and robust detection of the in the vicinity. So, it may be necessary electronics) at the University of received signal. For the design of the to tune the antenna properly in the Cantabria in Spain. He is a senior receiving circuit, use the internally complete design. embedded systems engineer with

generated VMID potential as an input more than 10 years of experience potential of the Rx pin. To reduce distur- FIRMWARE DESIGN designing trusted security platforms. bances, a capacitance to ground of 100 nF I developed all of the firmware with In his spare time, Carlos enjoys μ has to be connected to VMID. The receiv- the help of an ARM Keil Vision 3 repairing and bringing old electronics ing part of the reader needs a voltage IDE with a RealView compiler equipment to life. divider connected between the Rx and toolset. You may download a trial ver- the V pin. This is accomplished with sion limited to 16 KB of code genera- MID PROJECT FILES two resistors of values 820 and 560 Ω, tion (www.keil.com/arm). The firmware To download code, go to ftp://ftp.circuit respectively. Additionally, use a serial for the RFID payment terminal requires cellar.com/pub/Circuit_Cellar/2008/211. capacitance of 1 nF between the the installation of the Stellaris driver antenna coil and the voltage divider. library (a set of drivers for accessing the Because the matching of the antenna peripherals found on the Stellaris family RESOURCES provides a maximum of power coupled of ARM Cortex M3 microprocessors) in K. Finkenzeller, RFID Handbook: into the antenna depending on its imped- the Keil distribution package. Radio-Frequency Identification Fun- ance, the voltage at the antenna nodes is All of the software has been devel- damentals and Applications, John slightly different from antenna coil to oped in a modular and hierarchical Wiley & Sons, West Sussex, England, antenna coil. The Rx input pin of the MF way and in C language, so mainte- 1999. RC531 is high impedance, so a voltage is nance and improvements are fairly Luminary Micro, Inc. “LM3S811 coupled back into the Rx input of the simple to perform (see Figure 7). Microcontroller Data Sheet,” DS- MF RC531. So, two rules have to be A description of the modules and LM3S811-00, 2006. fulfilled. The DC voltage level at the RX the functions included in every mod-

input pin has to be kept at VMID (that’s ule is posted in the Software Modules ———, “Stellaris Driver Library the need of the 820-Ω resistor and the pdf on the Circuit Cellar FTP site. User’s Guide,” PDL-LM3S-UG-1716, 100-nF capacitor). In addition, the AC 2006. voltage level at the Rx input has to be CATCH THE WAVE! ———, “Stellaris LM3S811 Evaluation kept within limits: 1.5 V < V < 3 V . RFID contactless cards are becoming PP RX PP Board User’s Manual,” EK-LM3S811- To avoid exceeding the limit of VRX = increasingly popular in many fields ± 01, 2006. 1.5 VPP AC at the Rx input pin, a where barcodes and smart cards were 3.9-kΩ resistor is used. A higher input used. They open up many new possi- NXP Semiconductors, “MF1 IC S50 voltage may not destroy the chip, but it bilities, such as applications in pay- Functional Specification,” 001052, 2007. results in a receiving failure. ment cards, passports, or even ID ———, “Micore Reader IC Family: A matching circuit for the antenna cards. You may see RFID contactless Directly Matched Antenna Design,” coil is necessary in order to achieve the cards as the next evolution of the con- MC077925, Rev. 2.05, 2006. best performance and the antenna coil tact smart card, which has many has to be designed. A connection direct- advantages over the contact cards. ———, “Mifare MF RC531 ISO 14443 ly between the antenna and the reader You have learned how to exchange Reader IC Short Form Specification,” itself is also needed. It is recommended information wirelessly with the 2005. to design the directly matched antenna MIFARE contactless card using a dedi- ———, “Mifare (14443A) 13.56 MHz step by step. First, the antenna coil has cated chip, MF RC531, for modula- RFID Proximity Antennas,” to be designed. The antenna itself is a tion and demodulation of a radio MC078010, Rev., 2002. low-ohm device. In order to connect wave signal as well as the coding and this antenna coil to the MF RC531, a decoding of the data. In addition, matching circuit is required. Starting thanks to the versatility of the MF SOURCES with the estimation of the antenna’s RC531, it is possible to upgrade the Keil μVision 3 IDE equivalent circuit and the calculation firmware to deal with any ISO 14443 ARM of the quality factor, the recommended contactless card without any hard- www.keil.com values for the capacitors of the match- ware modifications. LM3S811 Microcontroller ing circuit will be reached. Finally, it You have also learned how to design a Luminary Micro, Inc. is worth remembering that the anten- coil antenna with a range of up to 10 cm. www.luminarymicro.com na coil inductance and capacitance It is built with off-the-shelf components, depend on various parameters, such as using a direct matching antenna tech- MF RC531 ISO 14443 reader IC antenna construction (type of PCB), nique when the reader and the anten- NXP Semiconductors the thickness of the conductor, the na are close together. I www.nxp.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 43 2802015Hoptroff.qxp 1/8/2008 9:30 AM Page 44

FEATURE ARTICLE by Richard Hoptroff Cash for Code Part 2: Publish Your Firmware

Richard concludes his series about firmware. In this article, he examines issues such as copy protection, pricing, and firmware publishing. Firmware-related business opportunities are out there. It’s time to cash in.

Last month, I looked at the poten- circumvent it deters all but the most we put in place to deter copyright tial for firmware to become an indus- determined personal infringers. And of infringement? The most widely used try in its own right. I also examined that small group, some do it because in other media are licensing, serial what a firmware product offering they can’t afford the product while numbers, and Steinlaus tags. would have to look like if it was going others do it for pure sport. Either way, A license agreement is a clear state- to succeed in the marketplace. This they are unlikely to pay up anyway. In ment of the terms under which you month, I’ll turn towards the business other words, even if encryption is not have agreed to let a customer use your side and examine issues such as copy 100% bulletproof, it’s good enough for firmware. It asserts your claim of a protection, pricing, and firmware business purposes against personal copyright and confers authority to a publishing. infringers. customer to make copies. It benefits The second category is pirates. the customer because it provides proof SECURITY AND COPY PROTECTION Pirates resell other people’s intellectu- that the firmware was legitimately All vendors of intellectual proper- al property for their own profit instead obtained. This is important, for exam- ty—be it the written word, music, of the authors’. Because they have a ple, if it is easier for you to put pres- software, or firmware—face issues of high economic incentive, they are sure on a U.S. distributor of an copy protection. They want to get paid likely to outwit even the strongest infringing product than, say, its for- for their hard work, after all. Copiers attempts at encryption because the eign producer. You would have the fall into two broad categories and dif- programming process is ultimately right to demand that the distributor ferent tactics are used to protect susceptible to reverse engineering. A obtain proof of license from the manu- against each of them. tougher approach is required: the law. facturer, and if he is unable to do so, The first category is personal-use The main legal protection is a copy- use this as the basis of a legal case infringers. All of us are inclined to right. A copyright is a general principle that he should cease to distribute the infringe a copyright if it is less effort in law that if you create “intellectual product. The fact that a license agree- than playing fair, even if we agree property,” which includes firmware, ment asserts claim of a copyright fur- with the principle of paying for intel- you own it. You can dictate whatever ther protects you because anybody lectual property. Napster showed us terms you like as to how other people who falsely claims copyright may be that customers don’t care if a creator’s may use it. It is the basis of all legal liable for fraud as well as copyright rights are not enforced. But Apple’s protection for ensuring that you are infringement. iTunes proves customers are willing to paid for the creative work you do. You Serial numbers take the license pay up if it is the easiest way to get might end up needing to sue for copy- agreement concept further. By assign- the product. So, we need a secure, right infringement, but that’s unlikely. ing serial numbers to individual copies effortless delivery method. The technical mechanisms you can of firmware, it becomes difficult for a TEAclipper programming clips, put in place, plus an attestation that legitimate license holder to make which were introduced last month, you intend to protect your rights to more copies than he is entitled to. Any provide this through encrypted deliv- the fullest, should be sufficient deter- duplication or invention of serial num- ery. The level of protection that can rents. Licensing firmware is largely a bers is relatively easy to spot. be provided depends on the features of business-to-business trade and busi- It is a two-step process to imple- the microcontroller. In general, nessmen don’t like to get caught cheat- ment serial numbers in firmware. encryption can be good enough that ing—the stakes are too high. First, a unique serial number has to be the reverse engineering required to So what technical mechanisms can added to the firmware when the target

44 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802015Hoptroff.qxp 1/8/2008 9:30 AM Page 45

is programmed. (TEAclip- 200 “…and it’s patented!” in pers provide this.) Second, ε = 2 the marketing materials, ε = 5 you need to be able to 150 technically this is no proof inspect the serial number of quality. in the final product. You Patent law varies a bit Sales (S) 100 may be able to use a con- from country to country. figuration/debug port, or, Generally, you should file 50 if your product drives a in your own country first. display, you could display You can make retrospec- it during initialization. 0 tive claims in other coun- 0 5 10 15 20 25 30 It’s best to display it in Price (P) tries for up to a year after- an encrypted form, so it’s Figure 1—These are classic price elasticity curves. The ε = 5 curve is steep, and it applies wards. If you employ an not obvious from the to a commodity product. The ε = 2 curve is more typical of differentiated products. attorney, expect the cost of machine code where the filing to be a few thousand serial number is. The license agree- patent. A patent doesn’t protect your cre- dollars. If you’re confident enough, go ment can dictate that the licensee ative work, as a copyright does. Instead, ahead and write your own to get the must permit the serial number to be it protects the original idea behind it. So, cost down to a few hundred dollars. read, and possibly that the licensee even if someone wants to legitimately Patents are very structured documents even keep track of where serial num- create a competing product, the law and there is a definite writing style you bers were used. says they can’t. You have a monopoly. must adopt. Refer to the Resources sec- Steinlaus tags are an idea borrowed Why do respectable governments sup- tion for details. from the book publishing industry. port such uncompetitive practices? Sim- After filing a patent, you typically They protect you from the possibility of ple, it fosters innovation. Ground-break- have to wait a year or two to see if it is someone copying your product and ing, paradigm-shifting invention takes a rejected, accepted, or partially accepted. then claiming that they legitimately lot of sweat, and there’s not much incen- During this period, you may not have produced, from scratch, a product that tive to invest in it if you’re going to be any explicit protection, but the fact that does exactly the same thing as yours. screwed into a nickel-and-dime corner by you can write the words “patent pend- “Steinlaus” is German for an insect freeloading copycats. You may dislike ing” on the datasheet will make poten- called the stone-louse, which has a the way drug prices are initially high tial competitors think twice before com- peculiar talent for breaking down kid- because patents enable this to happen, ing out with a copycat product. ney stones. Or rather it isn’t. It’s a ficti- but face it, the drugs wouldn’t exist at One final word about patents. You tious entry in the German medical dic- all without them. Here’s the twist: must keep the idea confidential before tionary Pschyrembel whose sole pur- patents expire after a decade or two, after filing the application. So hold off on the pose is to trap attempts to copy the which the idea becomes a competitive marketing until the application is in. dictionary. If someone else publishes a free-for-all and the customers are the real dictionary listing the Steinlaus, it’s a winners. So maybe governments have PERFECTING THE BUSINESS SIDE smoking gun. (Ahem, at the time I the right interests at heart after all. So much for delivering products that wrote this article, Wikipedia’s English- Not everything is patentable. Your customers want. How do you make language entry still appeared to believe idea needs to be your own and it needs to sure it’s profitable for you? Some the creature exists.) be new. It must involve an inventive (i.e., things to think about are: setting a So how do you incorporate Steinlaus non-obvious) step and it must be capable sensible price, ensuring positive cash tags in firmware? Simple. Include some of industrial application. It should be a flow throughout the product life cycle, undocumented behavior, such as flash- process, a method, or a product. (A and outsourcing non-core activities. ing an LED five times in response to a product includes electrical circuits.) sequence of buttons that were pressed. Some specific exceptions include: GETTING THE PRICE RIGHT Make sure it doesn’t interfere with the discoveries, theories, mathematical I’m going to get a bit mathematical normal operation of the product. Because methods, aesthetic works, a way of here, but hang in there. The units I’ll they’re virtually impossible to trigger thinking, and a game or method of be working in are dollars, after all. without inside knowledge, you don’t doing business. So you can’t patent a Setting a sensible price is a high- need to keep their presence a secret like poem, for example. Software is a dodgy stakes decision, and you don’t have the dictionary makers needed to. You are area and patenting it is not permitted in much data to go on. Marketing theory free to caution potential infringers that, many countries. Firmware is on safer says that if you set a price P and your “this product contains Steinlaus tags.” ground because you can patent a product has a price elasticity ε, your That’s a strong deterrent against microcontroller’s actions as a device or sales will be S: infringements of this nature. a process. Surprisingly, there is no S =× S P−ε 0 [1] requirement that the idea be a good

PATENTING one—or that it work at all. So though S0 is a constant related to the overall Another form of legal protection is the you’ll quite justifiably and proudly put, market size. Refer to Figure 1 to see

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 45 2802015Hoptroff.qxp 1/8/2008 9:31 AM Page 46

this equation as a chart. In a SM = 100 customer is making? How ε = 2 really competitive commod- ε = 5 big a part does your product ity market, say gasoline, a play in it? Your price should customer’s price elasticity ε be more or less proportion- might be as much as 5 and a Sales (S) 50 ate. In particular, it is gener- 1% decrease in price will ally accepted that the value lead to a 5% increase in of firmware will be at least sales. In a more value-added equal, if not many times as 0 market, such as firmware, 0 5 10 15 20 25 30 much, as the microcontroller the price elasticity will be Price (P) it runs on. Compare this closer to 2, so you can with the PC world, where a Figure 2—These curves represent price elasticity in intellectual property industries. expect your sales to grow by The difference here is that you have to account for the fact that sales cannot be infinite, PC retails for around 2% for every 1% decrease in even if you give it away. $1,000, but a typical profes- price. sional software package for In an Internet-age intellectual proper- uct for free are actually willing to pay it will be as much as or several times ty market, this model isn’t quite right. for it (see Figures 2 and 3). Conclusion that figure. You can supply an unlimited number of #1: No matter how tempting, don’t How much does the customer benefit copies at virtually no incremental cost give in to potential customers who say from your product? A customer would over the first copy. But you can’t have they would buy your product if it was normally be prepared to part with an unlimited number of customers. less expensive. That argument extends somewhere between 5% and 50% of Even if you made it free, only a limited right down to a price of $0, so you have the value they derive, depending on

number of customers SM would want it. to draw the line somewhere. Conclu- how easy it is for them to derive it. This amounts to shifting the price elas- sion #2: If you can get a handle on how How much would it cost for the cus-

ticity curve to the left by an amount P0: many units would be in demand if you tomer to write the firmware themselves? −ε gave it away for free, the profit-maxi- They’re unlikely to be willing to pay S =×+ S00 () P P [2] mizing price will be when you’re selling more than that unless you have patent where: 25% of that. protection. This issue is related to the ε ε S =× S P−ε Compare the curves for = 2 and = number of copies that a customer wants, M00 [3] 5. Note how much less profit there is so it’s really a question of volume dis- This equation is illustrated in Figure 2. for ε = 5. If two vendors create a com- counting. Let’s examine that in detail. The marginal cost of every extra modity market by producing identical firmware sale to an existing customer products and compete solely on price, VOLUME DISCOUNTING is pretty much zero. So our net profit both lose. The only way to win in a If you have no patent protection, a π is simply sales times price minus competitive market is to have a highly good rule of thumb is to come down in π the fixed cost 0 of creating the prod- differentiated product that a proportion price by approximately 50% for every uct in the first place: of the customer base will pay a premi- factor of 10 above 100 units in sales. (If um for. technically possible, make that cumula- ππ =× P S × P + P−ε − 000() [4] Common sense gives a few more tive sales to an individual customer. pointers on price. Once you’ve set a Then it’s easier for them to see their ini- This equation is illustrated in Figure 3. price, there’s not much chance of tial purchase as an investment, and it So what does this tell us, even with- increasing it. Customers who have front-loads your revenue cycle.) Refer to out product-specific numbers? already designed you in will cry foul Table 1 for an example. π The fixed cost 0 of producing the and soon everybody will be wary of Even with patent protection, if you firmware only moves the curve up or designing you in. Gently lowering a give customers a cumulative volume down, not sideways. So it has no bearing product price during its life cycle on the discount as an incentive to buy more, on the profit-maximizing price. However, other hand is perfectly acceptable, by they will have a strong incentive to try π π if 0 is so big never goes above zero, even as much as a factor we’ve got a loss-maker at any price. of two or three.

The curve is pretty flat at the top, so If someone asked you 250 once you’re near the pricing sweet spot, to write the firmware for 200 10% either way won’t make much dif- them, how much would 150 Profit (π) ε = 2 ε ference. The slope on the left is much you charge? The price 100 = 5

steeper than the slope on the right. So you’d need to set to 50 underpricing will hurt you far more make that much rev- 0 than overpricing. More subtly, whether enue is your lowest 0 5 10 15 20 25 30 Price (P) ε is 2 or 5, the profit-maximizing price acceptable price. P+ is roughly when 25% of the cus- What is the overall Figure 3—This is the price/profit curve in e-publishing. If you learn anything tomers who would have taken the prod- cost of the product the from this, it should be that differentiated products are more profitable.

46 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802015Hoptroff.qxp 1/8/2008 9:31 AM Page 47

Number of units Price per Value of a customer cash mountain, you can even sub- cally competent parties and allowing (cumulative) unit in this price bracket contract out the nitty-gritty of new them to focus on making great products. 1+ $10.00 ~$1,000 product development and just sit Component distributors such as Digi-Key 100+ $5.00 ~$5,000 high and come up with new ideas. (www.digikey.com) and Mouser Electron- 1,000+ $2.50 ~$25,000 The one thing you can never let go ics (www.mouser.com) provide these 10,000+ $1.25 ~$125,000 of entirely is technical support. Lose services for electronics hardware. Soft- 100,000+ $0.63 ~$630,000 contact with your customer base and ware publishing houses, such as Compo- Table 1—This is an example of typical volume discounting you’ll be a ship without a rudder. nentSource (www.componentsource.com) for a non-patented product. You can afford to discount because and Programmer’s Paradise (www.pro the tech-support burden for large customers is lower. FIRMWARE PUBLISHERS grammersparadise.com) promote and Niche marketing exists in many sell software on behalf of creators. Typi- to find new markets for your product. industries, aimed at enabling creators to cally, 35% of the price the customer Because they’re already up the learning outsource marketing and sales to techni- pays goes to the distributor/publisher. curve, the extra sales will cost you rel- atively little in technical support, so there is some cost-based logic to this too. With patent protection, a better bal- ance is to come down by approximate- ly 30% per factor of 10 (see Table 2).

STAYING CASH-FLOW POSITIVE Many tech businesses have high start-up costs and they would never happen without a hefty dose of financ- ing. That’s what venture capital is for. But the firmware industry doesn’t have much place for it. Just about any- thing you could be spending the capi- tal on would be a waste of money and it just encourages sloppy attitudes towards the finances. Sure, when you first create a product, and for the first few years in the market, the numbers are pretty small, but they don’t go steeply negative because you don’t have great costs. The only stock you have to finance is evaluation kits, and they don’t need to be stocked high. Just make sure you always have eight weeks worth, so you can cover lead times while you get a new batch made. There will be some outlay if you want to go for patents, but if cash is really tight, ditch the attorney and read up on how to do it yourself.

OUTSOURCE NON-CORE ACTIVITIES If you’re reading Circuit Cellar, chances are you’re a techie first and a businessman second. You are most eco- nomically effective if you stick to what you do best: creating great products. A creator should be limited only by his imagination, after all. Just about every- thing else can be outsourced, from mak- ing evaluation boards, to bookkeeping, marketing, and sales. One day, when you start to build a

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 47 48.qxp 12/31/2007 12:35 PM Page 1

BEST SCOPE & LOGGER SELECTION!

20/40MHz AWG 100MHz DSO 100/200/300MHz DSO Scope + Analyzer 15/20MHz Wfm Gen Announcing ...a new name in high-end, NEW! NEW! NEW! NEW! NEW! RIGOL RIGOL RIGOL RIGOL RIGOL high reliability, value- priced test gear: RIGOL. (pronounced ‘regal’) 25/40MHz USB 14-bit ARB w. USB 100MHz 2-ch 400MS/s DSO 100/200/300MHz 2 ch, 2GS/s DSO 100MHz 2-ch /16 logic scope 15/20MHz USB 14-bit Function/ Formerly the partner of RS-232, LAN/GPIB. 10 built-in 2000 wfm/s refresh rate. 2000 wfm/s refresh rate. Ultra and logic analyzer. 2000 wfm/s Arbitrary wfm Generators. 10 built-in a large scope company we can't name, Rigol wfms; FM, AM, PM, FSK, SWEEP Ultra Compact Design with Compact Design with small footprint refresh rate. See waveforms and wfms; FM, AM, PM, FSK, SWEEP produces the best and BURST; 6 digit 200MHz small footprint saves bench saves bench space. DS1102A $1295 logic data simultaneously. Trigger and BURST; 6 digit 200MHz quality/value LCD scopes frequency counter. space. DS1202A $1595 on data or signal edge. frequency counter. available on the market today. DG2021A/DG2041A $995/$1495 DS1102C $999 DS1302A $1995 DS1102CD $1499 DG1011 / DG1021 $650 / $795 Color LCD Scope Low-Cost Scope PicoScope 3206 2/4ch 12-bit USB Scope World’s Fastest 60/100/120MHz AWG

Best NEW! RIGOL Seller

Owon - 25MHz 2-ch + 2-Ch 20 MS/s 2 MHz 8-bit PS3206 - Is an impressive 2-ch Pico - New 2/4-ch 12-bit 20MS/s PS5204 - 2-ch 250MHz Scope with 60/100/120MHz USB 14-bit ARB trigger standalone USB bench scope adapter with 32 kB 200MS/s 8-bit PC scope adapter USB2.0-connected/powered 128 MS/s and real-time sampling of w. USB RS-232, LAN/GPIB. 10 scope with 7.8” color LCD. buffer and USB 2.0 (fast - 10GS/s for repetitive signals! scope adapters. Scope, FFT, 1GS/s. Adv triggering. 250MHz spec. built-in wfms; 6 digit 200MHz Battery powered optional. screen updates) with case & No power supply needed, simple and meter displayed at once analyzer and 125MS/s waveform gen. frequency counter; opt. 16-ch PDS5022S $325 probes. USB 2.0 connection with included software. PS5203 32MS buffer $2237 gen. DG3061A $1895 PDS6062T $599 PS2202 Bundle $387 PS3206 Bundle $1574 PS3424 / PS3224 $1398 / $793 PS5204 128MS buffer $3360 DG3101A/DG3121A $2795/$3995 6 in 1 Scope Automotive Testing Mixed -Signal PC Oscilloscope Handheld Scope Pen Scope

100 MHz Scope and Logic Analyzer lets you do complex triggering to find hard-to-get-at glitches, spikes, etc. Huge 4 or 8 MS buffer for deep data Scopes & WFM Gens drilling and zooming. Optional built-in 6-in-1 USB scope adapter! 200kHz 2-ch Automotive Diagnostics - Award- swept signal generator. 2 Analog 20MHz or 60MHz rugged PS2105 - 25MHz USB powered 10-bit scope, 2-ch spectrum analyzer, winning Pico kits turn your PC channels x 10, 12, 14 bit with more handheld USB scope with 3.8” scope-in-a-probe! Up to than 60 dB dynamic range. 8 digital 2-ch chart recorder, 16-ch 8MHz logic into a powerful vehicle-electrics color LCD. Built-in meter - 100MS/s, 24kS buffer C/VB/ inputs for mixed signal display/trigger. analyzer, 5-ch signal gen, 8-ch pattern diagnostic tool. 2 & 4 ch. versions for CS328A-4 (4MS Buffer) $1149 great for your tool kit. Delphi/LabView/VEE drivers. gen. SPI/I2C/1-w/UART decoding. components & circuits. CS328A-8 (8MS Buffer) $1642 HDS1022M (20MHz) $499 PS2105 (25MHz, 100MS/s) $372 PoScope with probes $199 PS3423 automotive kit $2293 CS700A (signal generator) $249 HDS2062M (60MHz) $699 PS2104 (10MHz, 50MS/s) $234 Wireless Data Loggers EMC Spectrum Analyzer Comments Ethernet Temp/Hum Line Tester USB Bus Analyzers

"Thanks for your excellent customer NEW! service and dedication Log and display temperature, Handheld PalmPC-based 2.7GHz T&D - Networked logger for TTI - high speed/accuracy AC USB1.1/2.0/WiMedia analyzers to finding and humidity, voltage, event-time or Spectrum Analyzer. Continuous/ remote ambient measurement. power analyzer to 16A for easy and now - EX260 can test pulse-counting data up to 100 single/peak-hold/avg sweeps - representing unique Send email or phone warnings if product power-compliance USB3.0 5Gbps too! Emulate meters away from base station. unlimited storage for wfms, set-ups, manufacturers ... " thresholds exceeded. Optional measurements. Measures/displays host/device, verify compliance. RTR-50 modules from $170 etc. Built-in Wi-Fi/Bluetooth/IR. WiFi for remote installation. 1st - 40th harmonics in real time. TR110 / EX200 / EX260 RTR-57U base $401 PSA2701T $1990 K.R. TR-72W $489 HA1600A from $2899 $999 / $2999 / CALL Ultimate Temp Logger 8/16ch Voltage Logger Voltage Data Logger USB Temp Logging Thermocouple Logger DMM

NEW! RIGOL

PT104 - 4-ch temperature 20-bit 8-ch / 24-bit 16-ch USB Pico USB ADC-11 - USB DLP - Low cost, USB-powered Pico USB TC-08 - USB connected 6 1/2 digit 50KS/s, 2MS mem. Opt. logger with 0.001°C resolution, voltage logger w. control output. powered 11-ch voltage data digital sensor. Easily monitor and powered 8-ch thermocouple 16-ch mux. Automeasure DC/AC, 0.01°C accuracy using platinum Galvanic isolation from the PC logger - 10kHz sampling temperature/humidity/dew data logger. Samples at up to 2/4-wire R, C, Continuity, Diode, PT100 sensors. Also measure eliminates noise. rates with digital outputs for point from USB port. 10 readings/s with built-in Frequency, Period, Ratio, Temp, resistance and voltage. ADC-20 (20 bit) $321 control or alarm. CJC for -270oC to +1820oC. Sensor, High/Low Limit Math. PT104 $747 ADC-24 (24 bit) $747 USB ADC-11/10 $178 DLP-TH1 $99 USB TC-08 $466 DM3061 $795 Customers EMC Spectrum Analyzer Logic Analyzer USB Logger Temp/Humidity Logger FREE COFFEE Join our huge list of satisfied customers:

Intel, Philips, Maxim, GM, Call 1-888-7SAELIG GE, NEC, Kodak, Xerox, EMC RF & EMF Spectrum - ZeroPlus - Intuitive full-featured EL-USB-1 - Standalone USB temp HumidiProbe - PC-based Mention Offer# SBW Analyzer 1Hz to 7GHz for measuring 16-channel with 4mb memory. o o Nokia, TI, Harris, Sony, data logger (-25 C to +80 C). $49 temperature and humidity to get a free transmissions from radar, radio/tv 2 Data Loggers & Analyzers Sophistcated triggering. I C, SPI, Pelagic, Sandisk, HP, El-USB-2 (+ humidity) $79 measurements are quick and Starbucks Card towers, WLAN, WiFi, WiMAX, and UART monitoring. Includes EL-USB-3 (voltage) $69 General Dynamics, easy with RH-02 data logger. with your order! Bluetooth, microwave ovens, etc. clipleads, USB cable and software. EL-USB-4 (current loop) $69 USB2.0 connected and powered. US Military, etc. While supplies last - from $299 / $1999 LAP-16128U $299 EL-USB-CO (Carbon Monoxide) $89 PP299 $279 not available with any other offers

Also LOTS of other products such as: Antennae, Barcode Readers, Cables, CANbus/LINbus products, Data Loggers, Digital Audio / DSP Filters, Embedded PC's / Controllers, EMC shielding, enclosures and tents, Ethernet boards and serial cable converters, FATfile Chips / Boards, GPS loggers, engineering Software, I/O Boards & Modules, I2C boards and controllers, ICs (USB, Ethernet, RFID), Industrial PC's, OLED / LCD Displays kits, Logic Analyzers, Motor Control, MP3 boards, Panel Meters, Polystyrene Capacitors, Power Supplies, Radio/Wireless modules, Robots, RS232/422/485 Adapters, SMD Adapters, Surge Protection / Isolation, USB-serial and I/O boards, Video, VMEbus boards, Web Servers, etc. Check www.saelig.com often for special offers, bargains, business hints, blog, etc. 49.qxp 12/31/2007 12:36 PM Page 1

UNIQUE PRODUCTS + SUPPORT!

Serial-Ethernet Cable Ethernet to Serial Ethernet-IO Ethernet-IO Serial Server Mini Web Server

Network your serial product easily WIZnet - Ready-to-go serial-to- Ether-IO - UDP/IP-controlled 24 Fiveco - TCP/IP server with I2C, RS232/422/485 device server for PicoServTM Miniature Web Server without a PC using this 28” cable. Ethernet Gateway. Simple set-up digital I/O board 3 x 8-bit TTL 19 x digital I/O, 5 x 10-bit A/D network-enabling legacy serial allows remote I/O and servicing. Provides an instant IP address. for 10/100Mbps Ethernet - ports each independently inputs, and UART serial interface. devices. 1/2/4/8/16/32 ports Collect analog & digital data over RS-232 port compatible with most 230kbps serial. Ethernet/ programmable. Connects to any Connect I2C devices/sensors 10/100Mbps-230kbps. Static a web connection. Remote sensing/ 10/100mpbs Ethernet hubs. Internet-enable any serial part. TCP/IP Ethernet network. to an Ethernet network! IP/DHCP/PPPoE. control, SCADA, building control. Ethernet eCOV-110-P $89 EG-SR-7150MJ $34 Ether-IO 24 $119 FMod-TCP from $250 Portbase-3010/RS232 from $149 PP1001-V00 $205 USB to I2C Ethernet to I2C Ethernet to I2C I2C for PCs Blue & White LCD Saelig Alan Lowne says: "I started Saelig as an engineer - for PCI93LV: industry-standard I2C card engineers! Saelig - an Devasys - Provides a simple NM7010A-LF REV 2 - Complete, Fiveco - TCP/IP server with I2C, for PCs. WINI2C/PCI software Comfile - LED backlit 4 x 20 Olde English “drop-in” solution for connecting hardwired TCP/IP-I2C module. Offloads 19 x digital I/O, 5 x 10-bit A/D gives windows-interface to develop character display. CuNET, word meaning 'happy, prosperous,

I2C blessed' - which is what I want for your PC to 90kHz I2C + 20 I/O stack for hi-speed Internet-enabling inputs, and UART serial interface. and debug I2C bus systems. RS232 or I2C communication my customers, my staff, and 2 lines. Free software. Use multiple microprocessor systems. Drop-in Connect I C devices/sensors UCA93LV is USB version. to 115Kbps. BASIC programmed. myself! See my blog for behind- boards for more I2C/IO. W3100A-based board for instant to an Ethernet network! Transparently monitor at 2.36” x 3.86” the-scenes company details, business hints, kudos, etc. " USB I2C/IO $79 network speeds to 8Mbps. $22 FMod-TCP from $250 400kHz! $499 CLCD420-B $49 Quantum WIZnet TCP/IP IC Servo IC USB On-The Go FATfile Storage USB - Serial

Quantum ICs - World’s best capacitive 10/100 Ethernet controller on a PIC-SERVO - complete PID servo Chesen - Sophisticated application Micro ALFAT-SD - Easily add FT232RL - FTDI USB1.1-serial IC with sensor ICs for switching & control. chip! Fully hardwired TCP/IP core. motion control system based interface. Quickly develops SD storage to your product. new "security-dongle" feature. Each ICs Patented Adj. Key Suppression, No OS required. TCP offload on PIC18F2331. PID servo filter, USB OTG memory- memory Serial data in - FATfile data unique ID and Internal EEPROM, Spread-spectrum. In use worldwide improves system performance. motion profiling, commutation, error devices without PC connection. out. FT232RL $2.36 (1K) by the world’s largest consumer/ W5100 (integrated PHY) $6.95 monitoring, communications, etc CSC3800 NEW! uALFAT-SD $40 FT232BL $2.98 (1K) appliance mfrs from $1 NM7010B+ Eval $22 PIC-Servo $30 OXDK-3800 CALL uALFAT IC $14 Check out the whole FTDI line! Isol USB485 USBwiz Security Tiny USB Serial 1/2/4/8/16 x RS232 Wireless USB2.0

KK Systems - Isolated USB- USBwiz - Easily add USB DLP - Programmable USB Security World's smallest USB Add COMports via your PC’s Wirelessly connect to your USB 2.0 RS422/RS485 converter. FTDI peripherals to your system. Includes Dongle based on FT232RL - log adapters. Ready-made USB Port. USB-COM-S $20 devices with our USB-IF Certified

USB chipset. Virtual COM port for all FATfile system for USB thumb & use/user/expiry, etc. Optional CP2101 miniboard USB USB-2COM $48 Wireless USB Hub at up to win32 applications. USB-DB9F. external USB hard drives. No sophisticated software allows interface to 1 Mbps. USB-4COM $105 480Mbps. For printers, scanners, USB knowledge needed. Plug-n-play! customizability. uUSB-MB $27 USB-8COM $195 memory, cameras, MP3s, (not webcams USB-485-K $99 IC $20 Demoboard $59 DLP-D $13 HR-USBUART $29 USB-16COM-RM (rackmount) $459 or Bluetooth). Wireless Modules Transceiver Modules Antennae Bluetooth RF Modules Ethernet Temp/Hum

Easily create mesh networks at LPRS easyRADIOTM makes Antennae - Innovative internal Emxys microIceBlue - PIC16F877 RF TX/RX Modules - simultaneously T&D - Networked logger for remote 910MHz - like Zigbee only better! wireless d a t a transmission and external specialized based emb. dev. system for shortest transmit composite video and ambient measurement. Send email Complete RF solution for fast & simple for the US and Europe! miniature multiband antennas Bluetooth development. $139 stereo audio signals. 2.4 GHz or phone warnings if thresholds reliable data transmission. Add wireless capability to your including Yagi for multiple PearlBlue - 100m-Bluetooth module ISM band. 4-ch RF, 5V operation exceeded. Optional WiFi for B915FHtiny-plus/40-SMD-WA $64 project today! uses - 900/1800/2400MHz/GPS. (UART master/slave bridge). Connect AWM630TX $16

Wireless remote installation. B915FHtiny-plus/40-DIP-EA $804 ER900TRS from $38 (100) from $4 micro's to PCs, PDAs, phones, etc. $99 AWM634RX $27 TR-72W $489 CANbus RF Testing Easy OLED Display Custom Switches SM PCB Adapters GPS Logger

Janz - Intelligent CAN connection Economical, portable RF test 4D Systems - Compact, economical Lorlin - Fantastic array of OM-Adapt SM miniboards have TrackStick II - Pocket-sized logger from PC’s USB port. Provides enclosures, for initial compliance smart OLED with graphics for stock and custom switching two footprints on each side. Now tracks position data for vehicles, plug’n’play opto-isolation. Other testing. from $1295 ‘stand-alone’ functionality to your devices choose from rotary use your ultra fine pitch SMD personnel, etc. Records date, time, Misc CANbus boards and systems Shielding Tents with external project - drive from USB or RS232. encoders, push, key, slide and components with more useful 0.1" location, route and speed. Shows available from Janz AG. frame, instant up/down for uOLED-96-G1 $101 rotary switches. Voltages up to inline spaced holes. data on Google maps! $175 CAN-USB from $299 emissions-free room. from $3500 uOLED-128-GMD1 $84 250V. CALL One-to-one pinouts. from $9.52 TrackStick PRO $189

We search the world for unique, time-saving products - see our website for 100s more: volt/temp data loggers, wireless boards, LCD display kits, Ethernet/IO, USB/RS232/485, USB-OTG, instant Ethernet-serial, CAN/LINbus, USB cables/extenders, line testers, logic analyzers, color sensors, motion controllers, eng. software, wireless boards, SMD adapters, I2C adapters, FPGA kits, GPS loggers, automotive testing, security dongles, video motion detectors, crystals/oscillators, custom switches, barcode scanners, robots, DSP filters, PLCs, Remote MP3 players. etc. Don't forget to ask for your FREE Starbucks card with order! Check www.saelig.com often for special offers and bargains. 2802015Hoptroff.qxp 1/8/2008 9:31 AM Page 50

In return, the customer decisions about your prod- sees far greater sales than uct, it will be tempting to he would typically recog- think about it from a tech- nize on his own. nical perspective, when in When we started mak- fact you have to consider ing TEAclippers, there was what customers really nothing like this for want. firmware. So we decided to Techies fall into some do something about it. We common traps. “Feature are complementing the creep” is the weird belief TEAclipper technology that more complicated is with a firmware publishing better. “Coding addiction” service called HexWax is the problem that creat- (www.hexwax.com). It ing products gets addic- comes with a special brows- tive. It’s tempting to avoid er that enables you to down- Photo 1—This is the HexWax browser. It enables customers to buy firmware online and other vital tasks such as load packages of encrypted download it onto a TEAclipper. technical support. But face firmware, datasheets, and it, if you spend 20% of more (see Photo 1). At the your time in creative time we wrote this article, it was for free problems, when in fact the real solution mode, you’re lucky. “Pricing to downloads only, but by the time you is elsewhere. If his house had a leaky please” is the temptation to drop read this it should be providing a com- roof, a painter would hide the damage, a prices in response to customer pres- plete sales service, offering significant real estate agent would sell the house, sure. You wouldn’t give them $100 market reach at minimal up-front cost. and a lawyer would sue the builder. bills just because they asked for them, None would actually fix the roof! so why offer a special discount just BREAKING THE TECHIE MOLD Likewise, it can be hard to stop think- because they ask? You might have to People tend to make the mistake of ing like a techie. But sometimes you turn a few customers away, but then turning to their strengths to fix their need to. When it comes to strategic again, so does Ferrari. “Clinging to the

Connecting the World of Electronic Design

February 4–7, 2008 Conference February 5–6, 2008 Exhibition Santa Clara Convention Center | Santa Clara, California

Don’t Miss Out on All DesignCon Has to Offer!

• 130 exhibiting companies • Nearly 100 technical papers • 10 half-day tutorials • 8 technical panels • Keynotes • Plenary panel • Business Forum

International Engineering Consortium www.iec.org

For more information visit www.designcon.com/2008

50 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802015Hoptroff.qxp 1/8/2008 9:31 AM Page 51

Number of units Price per Value of a customer to customers? (cumulative) unit in this price bracket Next, narrow the shortlist from a PRESTO 1+ $10.00 ~$1,000 business perspective. Do you have 100+ $7.00 ~$7,000 an estimate of the market size and The First USB In-Circuit 1,000+ $5.00 ~$50,000 the price you could charge? Is the Multipurpose Programmer

10,000+ $3.50 ~$350,000 product easy to understand and 100,000+ $2.50 ~$2.5 million explain? Can you keep the Table 2—This is an example of typical volume discounting datasheet to 20 pages or less? for a patented product. Even with patent protection, dis- What’s it going to be like to provide counting is worthwhile because it encourages customers to technical support for it? Do you find new applications for your product. have potential customers who say Very fast and flexible in-system programmer for many devices: they would buy it? Real people who x Atmel AVR, 8051 architecture original concept” is another trap. you can name? x Microchip PIC, dsPIC, rfPIC, ... Chances are your original vision isn’t Create the product. Write the first x Texas Instruments MSP430 exactly what your customers want. draft of the datasheet before writing a x ARM MCUs by Atmel, NXP Listen to them and let the product line of code so you can use it as a (Philips) - including debugging become what they need. If you’re work plan. Avoid, at all costs, coding x FPGAs, CPLDs & SCPs doing your job right, it will end up before documenting; it makes for by Xilinx, Altera, Lattice, ... looking nothing like you originally messy products. Expect to spend 25% x Serial Flash, EEPROMs, ... intended, but sales will rocket. of your creative time fresh-coding, “There’s no point in trying. People 25% testing, and 50% fixing and refin- SIGMA will steal my idea.” That is another ing. Unique Logic Analyzer trap. If it was really rewarding to steal Next, create presales support collat- With Extremely Large Memory ideas, people would. But the fact is, it eral. Refer to Table 2 in Part 1 of this for more than 14,000,000 events, just creates a commodity market, so series for a list of the likely materials up to 16 inputs, up to 200 MHz there’s not a lot in it for potential you will need to prepare (Circuit Cel- sampling, flexible triggering, ... competitors. lar 210, 2008). ...and more The last trap is: “You stole my Consider patenting. Are any ele- idea!” On occasion, people have simi- ments of your creation new, inventive MU Beta - unique PIC emulator lar ideas at the same time. That’s not steps? If so, consider patenting them USB modules - parallel & serial a disaster. What you each have to do is before moving on to the next step. SPINET - Ethernet-SPI interface Development boards and kits, ... focus on ensuring that your product is Take little piggy to market. Target differentiated enough to succeed in easy-to-reach customers first. Consid- For developers by developers. the marketplace. Don’t get distracted er www.hexwax.com as a firmware [email protected] by arguing with each other. publisher. [email protected] Be sure to support your customers. FINAL CHECKLIST Your job’s not done until they’ve suc- tools.asix.net Towards the end of the last century, cessfully designed in your product. a few techies realized that they were When they have, ask if you may use presented with a rare opportunity to them as a reference. generate stunning revenue streams Finally, don’t give up your day job from the value they could deliver to a yet. Plan on a one to three year ramp- broad customer base. Similar opportu- up phase before sales really start kick- nities in the firmware world are open- ing in. I ing up right now. In 1991, Richard Hoptroff started Let’s finish off with a checklist from Right Information Systems, a fore- idea to pay dirt, and you can ask your- casting software company that was self whether you’re ready to roll up acquired by Cognos in 1997. In 2003, your sleeves and get started. he founded FlexiPanel, an electronics Shortlist potential applications. Do design and licensing company. you have any code sitting around in Richard holds a Ph.D. in Physics from your directories that could be turned London University. You may contact into a marketable product? Have peo- him at [email protected]. ple asked you to write firmware that might have broader appeal? What skills and experiences do you have RESOURCE outside of electronics? Where are you D. Pressman, Patent It Yourself, Nolo, uniquely positioned to bring solutions Berkeley, CA, 2006.

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 51 2801017Tyler.qxp 1/8/2008 9:28 AM Page 52

FEATURE ARTICLE by Cass Tyler System Control TCP/IP Communication with Embedded Processors

TCP/IP communication with embedded processors, using text commands, is fast and reliable. Best of all, it doesn’t strain a host PC’s resources. Cass describes how to implement a TCP/IP socket server on a Rabbit Semiconductor RCM2200 microprocessor.

I have been writing control systems “complete” system is not feasible. It like the Microsoft Windows family or for a living for a while now. There is makes more sense to break them into Linux, UNIX, and other systems—can- something exciting about flipping a multiple subsystems that each concen- not provide the dedicated control neces- switch on a computer screen and see- trate on doing a single job well. Many of sary to successfully implement the ing a valve open or a light go on. It the subsystems will be used to turn process. However, many of the process- gives me a sense of accomplishment. I things on or off or to maintain tempera- es can be implemented inexpensively automate a lot of processes to make tures, pressures, or other environmental and effectively on small, embedded them safer and easier to use. A lot of values. They are set-and-forget jobs processors that are configured and com- distributed embedded controllers are that don’t require continuous monitor- manded via a network. Embedded real- used to accomplish this because I’ve ing and they can clog up a control algo- time kernels, such as Rabbit Semicon- found them to be the fastest and easi- rithm when it needs to be doing other ductor’s implementation module of est way to solve certain problems. The things that are much more important. Micrium’s μC/OS-II, provide hard, real- key to doing this is having the ability Often, channels merely monitor diag- time control along with unencumbered to communicate with the controllers. nostic points that don’t participate in access to the raw hardware. In this article, I’ll describe a simple system control at all. and easy communication scheme that Some systems are so geographically TCP/IP SOCKETS COMMUNICATION uses a text-based command structure. dispersed that running wires from Critical to the systems is the ability to I’ll explain how to implement a TCP/IP each transducer back to a central loca- rapidly and accurately communicate socket server on a Rabbit Semiconduc- tion would be difficult or impossible. with them. I will use standard Ethernet tor RCM2200 RabbitCore microproces- Distributing the control to multiple protocols to achieve an effective round sor, which is small, inexpensive, and subsystems puts the controllers near trip time (RTT), the time it takes the PC can be readily embedded into your proj- the processes being controlled. This to make a request and receive a response, ects. I’ll describe two TCP/IP socket way, you can wire the subsystem con- of as little as 3 ms. This method will clients that run on a PC and communi- trol points with shorter wiring runs support both the command-line client cate with the embedded server. The and you have to connect only the con- and the C++ client API communicating first is a command-line process that trollers to the network. with the single embedded server. exposes all of the commands to the Subsystems that can be implement- Using TCP/IP sockets requires the user. It is useful for debugging projects ed on programmable logic controllers embedded server and the PC client to and manually exercising the RCM2200. (PLCs) are ideal candidates for embed- be on the same subnet. The server The second is a C++ application pro- ded controllers. You can program uses a fixed port number for commu- gramming interface (API) that provides them in C or C++ to implement more nication and, in this example, can programmatic access to the embedded sophisticated control algorithms. The communicate with a single client at a processor. controllers can provide continuous time. It implements commands as control of pressures and temperatures request/response pairs. Every request DISTRIBUTED CONTROL CANDIDATES as well as other types of environmen- receives a response, effectively hand- Let’s take a moment to talk about tal monitoring and control, even with shaking each command and ensuring where and why you should distribute the operator interface turned off. that it was received and acted upon by the control. Some subsystems require hard, real- the server. The response also passes Some processes are so complicated time control. Many of the sophisticated back status and diagnostic informa- that implementing them as a single operating systems that I prefer to use— tion to the client.

52 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2801017Tyler.qxp 1/8/2008 9:28 AM Page 53

Sockets can transmit raw binary resides in the do loop immediately fol- and can safely ignore this. The server information as well as ASCII text. The lowing the “process request/response does not recognize a communications advantage of using text buffers is that pairs” comment at line 124. failure, so if you lose Ethernet com- a human can understand the conversa- Client.c runs on a Widows PC. It munication, you have to reset the tion. There may be times when you implements the TCP/IP client that will server by powering it off and then want to pass raw binary, especially in access the server that resides on the back on. You can fix this by imple- the later stages of development, but embedded processor. The pertinent code menting a timeout and closing and the use of text adds little additional resides in the while loop immediately then reopening the socket if it does overhead and makes it much easier to following the “process request/response not see the client regularly after it is debug your code because you can read- pairs” comment at line 108. connected. The server will usually rec- ily see what is going on. Client.cpp also runs on a Windows ognize when a client aborts and know I hate looking at a piece of sample PC. It implements the TCP/IP client as a that the connection has closed. code that tries to impress me with its reusable C++ object that accesses the Once the server is connected, it sophistication. Generally, it winds up server on the embedded processor. zeroes out the receive buffer and reads obscuring what it is trying to illustrate in the command string. Because it in the razzle dazzle. Instead, you will SERVER.C reads only the number of bytes in the take the “Occam’s Razor” approach Server.c uses a fixed TCP/IP buffer, minus one, it is guaranteed to where you strip off everything that is address of 192.168.100.100, assigned at receive a NULL terminated string. not necessary for the code to work. This line nine, and a socket port number of You will implement three com- will give you a much clearer under- 54,321, assigned at line 12. (I will talk mands to illustrate the command pro- standing of how the process actually more about these choices when I dis- cessing: Rev, Man, and Val. Rev is a works. Therefore, the code you will use cuss Client.c.) It loops, waiting for a read-only command that returns the here will be minimalist, but it will pres- connection from the PC, and sets the software revision level. Man sets a sin- ent a better model for future projects. Boolean variable fTheHostIsCon- gle Boolean value. Val illustrates Server.c is written to run on an nected to TRUE whenever a connec- working with an integer array. In each RCM2200 processor, although it tion has been established by the PC. case, invoking the command without should run equally well on any other This informs the embedded control passing a value causes the server to Rabbit processor that supports Ether- program of whether or not it is operat- return the current value of the vari- net. (I have run it unchanged on a ing under operator control. (Some con- able. Invoking the command with a Rabbit BL2100 Smartcat.) It imple- trol programs need to go immediately writable value causes the server to set ments the TCP/IP server that the into a “safe” state whenever the oper- the variable to that value and echo client will access and represents the ator interface is not running.) Other back its new current value. This is embedded processor. The pertinent code control programs run autonomously important because some values are limited by minimum and maximum values and the new current value may not be the one you requested. Photo 1 shows a session using the command- line client. The Man command illus- trates putting the processor into Man- ual mode (see Listing 1). When you are not in Manual mode, you cannot change the values of the integer array. Passing an illegal index returns an error message, but passing a parameter that has a value that is too high or too low sets the variable to the maximum or minimum legal value. Choosing to return an error on a parameter that is out of range or to limit the parameter to a legal value is a matter of personal choice. I prefer to limit the parameters because it more closely resembles passing values with dials and switches where the physical hardware limits them to legal values. All kinds of equipment are pro- Photo 1—This is a typical session using the command-line client. You can see the Rabbit compiler debug window grammed with ASCII commands, in the background echoing what is happening in the command window. including oscilloscopes, power supplies,

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 53 2801017Tyler.qxp 1/8/2008 9:28 AM Page 54

bench equipment, and a whole range of Listing 1—This code snippet shows the code used on the embedded server to process the Rev and Man other devices. Some use RS-232 as the commands. The trailing else handles unrecognized commands. communications media, while others use RS-485, GPIB, or Ethernet. Provid- auto byte ucBuffer [ 128 ]; /* Buffer for Message */ ing a text-based user interface provides a auto char * pszCommand; /* Pointer to Command */ very familiar paradigm for talking to auto char * pszValue; /* Pointer to Value */ your device. Because you are writing the ... code, you can provide any command /* that you want. Your embedded con- * Get the Command troller interfaces just like any of the */ pszCommand = strtok ( ucBuffer, " " ); other devices and becomes just another /* black box in your control system. * Process a "Rev" Command Even if your does- */ n’t require a user interface, it is still If ( strcmpi ( pszCommand, "Rev" ) == 0 ) { advantageous to provide a window into RespondText ( &stSocket, "Rev 0.1" ); the process so you have a way to see } what is happening inside your system. /* * Process a "Man" Command */ CLIENT.C else if ( strcmpi ( pszCommand, "Man" ) == 0 ) Client.c provides the command- { line interface to the embedded con- if ( pszValue = strtok ( NULL, " " ) ) troller. It opens a TCP/IP socket con- { g_fMan = RANGE ( atoi ( pszValue ), 0, 1 ); nection to the embedded controller, } sends commands to the controller, and sprintf ( ucBuffer, "Man %d", g_fMan ); displays their responses to the user. RespondText ( &stSocket, ucBuffer ); CTRL + C exits the program. } Command-line programs can hang sys- ... tem logoffs and shutdowns if they don’t /* implement a console control handler to * The Command is Invalid */ respond to shutdown events. The Con- else trolHandler() function, at line 18, sig- { nals the client to exit when shutdown RespondText ( &stSocket, "Unrecognized Command" ); } messages, such as when a “CTRL + C” has been detected. This enables you to per- form all of the necessary cleanup func- randomly picked subnet 100 because it aside for private use. You should keep tions and gracefully exit the program. is easy to remember and less likely to track of the port numbers that you use Look at the TCP/IP address and port conflict with existing systems. and avoid reusing them because multiple number choices. I implement control Port numbers are assigned by the applications using the same port number networks on dual-homed systems (i.e., Internet Assigned Numbers Authority would cause a conflict that could be very systems with more than one Ethernet (IANA), and, in order to prevent conflicts difficult to track down. connection). This keeps all of the con- with existing applications, I chose 54,321 trol communications on a separate net- because it is listed as a “dynamic and/or CLIENT.CPP work segment so that they don’t disturb private port.”[3] These range from 49,152 Although a command line environ- the user network and the user network through 65,535 and are restricted from ment is convenient for manual interac- doesn’t disturb the control network. permanent assignment. They are set tion, programmatic control requires a bit The Internet Engineering Task Force (IETF), the Internet standards organiza- tion, has set aside a range of addresses Listing 2—These are the exposed “public” methods in the C++ client API. They provide the programmatic for private Internets (RFC 1597), includ- client access to the embedded server. Refer to Try.cpp on the Circuit Cellar FTP site for an example of how this ing the 192.168.. block.[1] API is used. This enables you to define up to 256 Bool IsValid (void); subnets (subnets 0 to 255) that allow up Bool GetRev ( unsigned int * puMajor, unsigned int * puMinor ); to 256 addresses each (address 1 to 254). Bool PutMan ( bool fManual ); Addresses 0 and 255 are reserved, so you Bool GetMan ( bool * pfManual ); can connect up to 254 devices, one of Bool PutVal ( unsigned int uIndex, int nValue ); which is your host, using this address Bool GetVal ( unsigned int uIndex, int * pnValue ); scheme.[2] You will find a lot of Bool GetVals ( short int anVal [ 10 ] ); 192.168.0.x subnets already in use, so I

54 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 55.qxp 12/31/2007 12:21 PM Page 1

Microcontroller 100

95 Development

75 Tools

25 ARM Microcontroller Solution 5 5

® 0 ARM Powered Microcontrollers – available from many silicon Cx51 0 vendors; offer high computing performance along with rich peripherals. TurnARM Microcontrollers into your solution for cost-sensitive Keil Cx51 is the de-facto industry standard for all classic and extended 8051 device variants. powerful applications– with Keil DevelopmentTools . C51Version 8.5 includes the latest devices such as XC800,ADE7169, and C8051F4xx - F6xx. More information: www.keil.com/c51 C/C++ Development Kit JTAG Debugger The RealView Microcontroller Development ULINK2® connects to Kit (MDK) is the complete software development the JTAG or 2-wire debug environment for ARM7/9 and Cortex-M1/M3. interface and supports MDK is easy to learn and use, yet powerful on-the-fly debugging and enough for the most demanding embedded ARM Flash programming. C166 application.The integrated Device Database® simplifies tool configuration and includes more Keil C166 is the complete software development environment for Infineon C166, XC166, XC2000 than 250 ARM Powered Microcontroller and ST Microelectronics ST10 with debug and variants for your embedded project. programming support via ULINK2. More information: www.keil.com/c166 RealView® Microcontroller Development Kit

RealView C/C++ Compiler

RTX RTOS Kernel Library A/D Converter I/O Ports Debug Run-Control ARM μVision Debug Timer/Counter Interrupt System Device Database & IDE Channel RealView MDK combines the best-in-class ARM C/C++ Compiler, the genuine Keil μVision μVision PWM Flash ROM Debugger & AnalysisTools IDE/Debugger/Simulator, and the royalty-free

Examples andTemplates RTX RTOS Kernel.

Complete Device Simulation UART CPU RAM More information: www.keil.com/arm

2 Real-Time I C/SPI Clock DMA

SD/MMC ® Ethernet USB CAN RealView Interface Real-Time Library

RTX RTOS Source Code RTOS and Middleware TCPnet Networking Suite 100 The RealViewReal-Time Library (RL-ARM) 95 Flash File System solves the real-time and communication challenges of your ARM project and expands 75 USB Device Interface MDK with essential components for

Examples andTemplates sophisticated communication and interface Keil MCB evaluation boards come with code CAN Interface peripherals. size limited tools and extensive example projects that help you get up and running 25 quickly with your own embedded application.

5 More information: www.keil.com/boards Learn more about RealViewMDK , RL-ARM , and ULINK2 . Download a free 0 evaluation version fromwww.keil.com/demo or call1-800-348-8051 . www.keil.com 2801017Tyler.qxp 1/8/2008 9:28 AM Page 56

more. I prefer to use C++ objects to inter- the destructor, IsValid, GetRev, Put- ods that start with Put set new values. face with the embedded controllers. They Man, GetMan, PutVal, GetVal, and The private methods handle the are easy to use, easy to program, and GetVals (see Listing 2). The constructor TCP/IP communications: OpenSocket, can be used as base objects for derived requires you to pass the embedded CloseSocket, PutRequest, GetRe- objects. The code reusability is great, processor’s TCP/IP address as a parame- sponse, and Query. They basically pass especially when you have a base of well- ter. Constructing the object connects the an ASCII request string to the embedded trusted interfaces to inherit from. The socket, retrieves the revision number, processor and receive an ASCII string techniques that you are using here are for and prepares you to start a conversation. back in response. This request/response TCP/IP sockets, but they work equally If the object fails to connect the socket or sequence handshakes the function. The well for RS-232, RS-485, GPIB, or any get the revision number, it is marked as functions don’t return a “true” unless other ASCII string command structure. invalid. The methods with names that the handshake is successful. The CRCM2200Client class public start with Get retrieve the current values Look at the PutMan method to see methods implemented are the constructor, from the embedded processor. The meth- how to process the ASCII commands (see Listing 3). Create the appropriate command string in szSndBuf by using the sprintf function. Send it to the embedded processor and read back the response. Both szSndBuf and szR- cvBuf are initialized to all zeros when they are declared, so you don’t have to worry that the strings won’t be null ter- minated. Both are valid ASCII strings. The returned string is decoded using the sscanf function. The embedded processor returns the string “Man ” if the command was success- ful. Otherwise, it returns a string that doesn’t begin with “Man.” The sscanf function requires that the characters outside the format specification match, so anything other than a leading “Man,” followed by a single integer value, will fail to return one field successfully scanned, and the function will return “false.” You can also verify that the specified value was set correctly. All of the functions return a bool value and return values using reference parameters. If the function returns false, the returned value is unspecified. Because you use the reference parameters in the sscanf function, one or more can be changed during processing, so you won’t really know what the final values will be if the processing fails. If the function suc- ceeds, you will know that all is well. This scheme doesn’t use complicat- ed error processing, such as complicat- ed CRC checksums. You know that communications on the local area network (LAN) are highly reliable due to the error processing in the TCP/IP itself. The timing section that follows runs 6,000 passes at a time, halting on errors. I have yet to see a failure.

TIMING You might assume that because the

56 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 57.qxp 12/31/2007 12:26 PM Page 1

Products Technologies NEW Suppliers

The Newest Products and Technologies Are At mouser.com

The ONLY New Catalog Every 90 Days

Experience Mouser’s time-to-market advantage with no minimums and same-day shipping of the newest products from more than 335 leading suppliers.

2,112 Pages

The Newest Products For Your Newest Designs

www.mouser.com (800) 346-6873 Over 900,000 Products Online

Mouser_CircuitCellar_2-1.indd 1 12/19/07 4:13:36 PM 2801017Tyler.qxp 1/8/2008 9:28 AM Page 58

Function Average round trip time The CHiResTimer class, used to disturbances, run the timing code GetRev() 2.958 ms time the command round trip times with nothing else running. You will PutMan() 3.643 ms (RTTs), is based on the performance also jack the process and thread priori- GetMan() 3.369 ms counter, which is hardware-depend- ties up to the maximum priorities, PutVal() 4.031 ms ent. On my laptop, it has a frequency which will give you the best possible GetVal() 3.731 ms of 3,579,545 Hz, which is accurate performance under Windows XP. (I GetVals() 6.331 ms enough to time to less than a also use a crossover cable to connect Table 1—These are typical round trip times for the function microsecond. We are going to time the directly to the RCM2200.) Thus, the calls. You can easily communicate with the embedded number of seconds that it takes to run numbers you see will be the best-case processor at better than 100 Hz. (Shorter times are better.) 1,000 passes. The resulting time will value. Your actual results may vary be the average time to process a single depending on your situation (see Table 1). commands are ASCII rather than binary, call in milliseconds. Multiple runs confirm that the val- they would be slow. Let’s find out. In order to remove the effects of ues are accurate to the nearest one- tenth of 1 ms. Any combination of commands can easily run at a 100-Hz processing rate. Running heel to toe, the timing code jumps the CPU utilization from about 1% to about 4%. The calls run in Blocking mode, so it doesn’t satu- rate and starve the rest of the system, even though the program runs at max- imum priority. The task manager shows that network utilization during execution varies between 2% and 3% on the 10-Mbps network. This indicates that the bot- tleneck is the processing speed of the embedded processor. As far as the PC is concerned, the resource requirements are light, even running at full speed. Updates can occur faster than you can perceive them.

GO PROGRAM Using text commands to achieve TCP/IP communication with embed- ded processors is fast, easy, reliable, and does not strain the host PC’s resources. It is easily implemented on small, inex- pensive embedded processors without undue complication. The same embed- ded server can interact with both a command-line processor, making it easy to talk to, and a simple-to-use application programming interface (API), making it easy to program. I

Cass Tyler ([email protected]) has a Bachelor of General Studies from the New Mexico Institute of Mining and Technology. He works for Ktech in Albuquerque, NM, as a senior control system software engi- neer. Cass’s interests include fully autonomous systems, as well as fully integrated web-based automation and control systems.

58 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2801017Tyler.qxp 1/8/2008 9:28 AM Page 59

Listing 3—These are the PutMan() and GetMan() functions implemented in the C++ client API. They are examples of functions that convert text-based processing to standard function calls.

bool CRCM2200Client::PutMan ( bool fManual ) { char szSndBuf [ 64 ] = { 0 }; char szRcvBuf [ 64 ] = { 0 }; int nMan = 0; bool fMan = false; // Invoke the "Man " Command sprintf ( szSndBuf, "Man %d", fManual ? 1 : 0 ); if ( ! Query ( szSndBuf, szRcvBuf, sizeof szRcvBuf ) ) return false; // Successful Return is "Man " if ( sscanf ( szRcvBuf, "Man %d", &nMan ) != 1 ) return false; // Convert from "int" to "bool" fMan = nMan == 1 ? true : false; // Success if the Value Returned Matches the Value Sent return fMan == fManual; } // bool CRCM2200Client::PutMan ( bool fManual ) bool CRCM2200Client::GetMan ( bool * pfManual ) { char szRcvBuf [ 64 ] = { 0 }; int nMan = 0; bool fMan = false; // Invoke the "Man" Command if ( ! Query ( "Man", szRcvBuf, sizeof szRcvBuf ) ) return false; // Successful Return is "Man " if ( sscanf ( szRcvBuf, "Man %d", &nMan ) != 1 ) return false; // Convert from "int" to "bool" fMan = nMan == 1 ? true : false; // Store the Current Value * pfManual = fMan; return true; } // bool CRCM2200Client::GetMan ( bool * fManual )

PROJECT FILES RESOURCES To download code, go to ftp://ftp.circuit The Internet Engineering Task Force cellar.com/pub/Circuit_Cellar/2008/211. (IETF), www.ietf.org. Microsoft TechNet, “TCP/IP Funda- REFERENCES mentals for Microsoft Windows,” 2007, http://technet.microsoft.com/en [1] Y. Rekhter, R. Moskowitz, D. Kar- -us/library/bb726983.aspx. renberg, and G. de Groot, “Address Allocation for Private Internets,” Rabbit Semiconductor, Inc., “Dynamic IETF RFC 1597, 1994, http://tools. C: An Introduction to TCP/IP For ietf.org/html/rfc1597. Embedded System Designers,” 019- [2] Microsoft Corp., “Understanding 0074 070720-J, 2006. TCP/IP Addressing and Subnetting Basics,” 164015, 2007, http://support .microsoft.com/kb/164015. SOURCE [3] Internet Assigned Numbers RCM2200 RabbitCore microprocessor Authority, “Port Numbers”, www. Rabbit Semiconductor, Inc. iana.org/assignments/port-numbers. www.rabbitsemiconductor.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 59 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 60

THE DARKER SIDE by Robert Lacoste

Antenna Basics Robert recently moved out of his comfort zone and stepped into the world of antenna technology. In this article, he describes the experience and covers the topics of impedance matching, antenna simulation, and more.

Welcome back to the Darker Side. again for your support. recently: antennas. I have two good rea- Circuit Cellar is now 20 years old, and Now, which dark subject am I going sons to do so. First, this is a really my first article in this magazine is to cover this month? Until now, I’ve important subject for any wireless proj- about 10 years old. (Remember stayed in my comfort zone by covering ect, and second, it’s a fun one! “PIC’Spectrum: Audio Spectrum Ana- subjects I am comfortable with (i.e., lyzer,” Circuit Cellar 98, 1998?) As EMC, FIR, and PLLs). Well, this month, IMPEDANCE MATCHING you know, I started this new column I am going to take a more risky route As you will see later, the most fun- several months ago. Time is passing and explain a topic that I dug into only damental issue with antennas is quickly, which means it impedance matching, so I may be time for a review. will start with a short First, I would like to thank refresher on matching. you, dear readers, because I Let’s take the most basic have received more than example first: a DC-pow- 100 e-mails from you since ered heater. Suppose that 1998. All of them were you have a battery pack really friendly and encour- with an internal resistance aging. More importantly, of 1 Ω and you want to they often triggered deep use it to heat your coffee and interesting technical during a cold winter night. exchanges between us and You could connect a heat- even led to ideas for my ing resistor between its projects and articles. I love two terminals, but what this interaction, and I would the optimal value believe it is an excellent for this resistor have to be way to keep Circuit Cellar, to enable you to use your and particularly The Dark- battery’s energy in the er Side column, focused on most effective way? If you the content that you need. use a high-value resistor, So don’t hesitate to drop the current going through me an e-mail if you have a it will be small, so dissi- criticism, a comment, or pated power will be low. an idea. Conversely, if you use a Lastly, you seem to like very low-value resistor the way I have tried to (close to a short circuit), “make the bridge between then the current will be complex subjects of even Photo 1—This QUCS simulation shows an RLC resonant network. The Uload and Iload very high; but the power mathematical concepts meters measure the voltage and current across the load, respectively. The equation calcu- dissipated in your resistor, and real world designs” (to lates the product, which is the power dissipated in the load. The graph shows that the dissi- which is the current times pated power is maximum (1 W) at the resonant frequency. There is no way to extract more quote a reader). So, I will Ω the voltage, will be very than 1 W from a 14.14-VRMS generator, which has an internal resistance of 50 . When the continue to do so. Thanks maximum is achieved, the same power (1 W) is also dissipated inside the generator. low because the voltage

60 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 61

across a short circuit will be nearly you need to con- zero. In fact, in this last case, a lot of nect it to a Wi-Fi power will be dissipated, but it will transmitter (2.4 happen in the battery’s internal resist- GHz), which has ance and not in your heating resistor. a 50-Ω output So, there is an intermediate optimal impedance like resistor value for maximum power our generator. transfer from the battery to your resis- Because you are tor. This value is 1 Ω, the same as the far from the res- source resistance. It’s easy to calculate: onant frequen- cy, if you con- 2 2 ⎡ U ⎤ nect them P == RI R ⎢ ⎥ ⎣RSOURCE + R ⎦ [1] directly, you will have losses.

It is maximum for R = RSOURCE. More exactly, If we move from DC to AC, the sit- the graph in uation is exactly the same, replacing Photo 1 shows resistance with impedance. If you you that you will have a source with a given impedance get only around

Zs and connect it to a load with a 50% of the avail-

given impedance Zl, then the energy able power. What transfer will be maximum if both are could you do? matched at the working frequency. The answer is in Photo 2—Adding a matching network (here a serial L and a parallel C) enables you to match the RLC load at any given frequency (2.4 GHz). Note that the RLC values are There is just one difference in AC. An Photo 2. You still the same as those in Photo 1. impedance is a complex value, the could add a sum of a real resistance and an imagi- matching net- nary reactance. The reactance is posi- work, for example, with another coil and frequency. Using QUCS, just add a tive if the circuit is inductive at the capacitor, and voila, you’ll get a 100% voltmeter and an amp meter to meas- current frequency and negative if it is power transfer at 2.4 GHz without ure the current and voltage delivered

capacitive. It could be written as Zs = changing the load. (I mean the anten- by the source, divide them (R = U/I),

Rs + j Xs and Zl = Rl + j Xl. na.) This magical matching network and simulate the network at 2.4 GHz. Matching is achieved when the must be calculated in order to get a You get the impedance, which is 50 + j × Ω source impedance Zs is the complex matching condition (to ensure that the 84.5 . The reactance is positive, so the

conjugate of the load impedance Zl, overall impedance of the source plus circuit behaves like an inductor at this meaning that both resistances are the matching network is the complex frequency, which is usually the case for

equal (Rs = Rl), but both reactances are conjugate of the impedance of the frequencies above the resonant frequency. equal in value but with an opposite load). You then have to calculate a network Ω Ω sign (Xs = –Xl). But how can you calculate these com- that can match 50 and 50 + j × 84.5 Let’s look at an example (see Photo 1). ponents? Because you already know the at 2.4 GHz. You can use the good old This is a simulation of a serial RLC impedance of the source (50 Ω), the methods that you will find in your network done with the open-source first step is to calculate or simulate the nearest library. Or, if you are like me, Quite Universal Circuit Simulator impedance of the load at the working you can simply use an online matching (QUCS), a broad target simulator soft- ware. That RLC network has a zero reactance at its resonant frequency. Frequency: 2.4e + 09 So, at that frequency, its impedance is S[1,1]:0.0034-j0.0022 equal to the serial resistance, R. In 1 this example, R is 50 Ω, the same as the generator’s internal resistance. We S[1.1] 0.5 S[1.1] expect to have a maximum power

transfer at this resonant frequency. In 0 this simple example, the resonance 1e09 2e09 3e09 4e09 frequency can be calculated as the Frequency Frequency inverse of the √L × C/2π, which equals 1.59 GHz. This is exactly what is shown in the simulation. Figure 1—These plots show the reflection coefficient (S11) of the matched network illustrated in Photo 2 in a polar form (Smith diagram) and on an XY plot. Matching is achieved when S11 is null (at the center of the plot in a polar Suppose that you have such a 1.59-GHz form). A Smith chart shows when the network is inductive (top half) or capacitive (bottom half), and it can be used resonant circuit that you can’t change, but to calculate matching networks manually.

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 61 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 62

calculator. Refer to the Circuit Half-wave dipole Quarter-wave antenna Ground plane antenna its power in the direction(s) Cellar FTP site for the you want. That’s the radiation

“Matcher2.htm” tool from Lambda/4 Lambda/4 Lambda/4 pattern of the antenna. John Wetherell that I used to Let’s first cover matching and calculate the network used in assume that the transmitter or this example. Lambda/4 receiver has a standard 50-Ω A last word before I move on Lambda/4 impedance. An antenna is funda- to antennas. Another way to mentally a resonant system, and understand unmatching, espe- its equivalent circuit could be cially at high frequencies, is to approximated by a serial RLC Figure 2—The simplest antenna is the half-wave dipole (left), which is made consider that some part of the by two lambda/4 wires driven by a bipolar source. Take half of it and add a ref- network, such as the one in power sent by the generator to erence ground plane and you have a quarter-wave antenna (middle). Finally, if Photo 1, at least around reso- the load is “reflected back” to you don’t have a good ground, you can add one or several artificial ground nance. Because you have read the source if the matching con- wires for the so-called ground plane antenna (right). the first part of this article, you dition is not achieved. The understand that there are two amplitude and phase of the reflected incident and the reflected wave is noted ways to match the 50-Ω impedance of signal add or subtract to the incident as S11. The coefficient is 0 if the net- the source and the antenna system. You wave, cancelling part of the energy work is matched. It is 1 if it is com- can use an antenna, with a resonant fre- transfer. And this is actually the case pletely unmatched. This is also a com- quency as close as possible to the work- even if it seems strange. Just imagine plex value (amplitude and phase), and it ing frequency, which means that its that you switch on the source. Because can be plotted either on an XY scale or impedance will be 50 Ω at that frequen- electricity moves only at the speed of on a polar form (the Smith graph). Of cy (“radiation resistance”) and no reac- light, it can’t instantly “know” if the course, QUCS can calculate S11 coeffi- tance. Or you can measure the actual load is matched or not. Power is going cients. Refer to Figure 1 for the S11 of antenna impedance at the desired work- through the cable to the load and then the matched network. ing frequency and add a matching net- a reflected wave goes back to the work. There is one important point to source. This is a very simplified expla- ANTENNAS 101 understand here: both solutions are nation, but it’s enough to prove that What is an antenna? It is simply a equally effective. Even a trumpet is a matching is important. These reflected device that transforms an electric wave, perfect antenna at any frequency with waves can have other nasty impacts on coming from a generator with a given the proper matching network (assuming RF designs (standing waves on the impedance, into a radiated electromag- it is a metallic trumpet)! Essentially, if cables, nonlinear distortion in the netic wave that will propagate in the it is matched, then the reflected power amplifiers, and so on), but that is for free space or that will reciprocally trans- will be null. And because there aren’t another article. form an electromagnetic wave into an any dissipating resistors in a trumpet, all I just want to introduce an important electric wave to a receiver. Because it is the applied power will need to go some- concept. The voltage ratio between the difficult to transmit power over the air, where, which means it will be radiated an antenna designer in the air without any loss. There are wants a reasonable only two issues: the first is that its radi- power efficiency in the ation pattern will probably be a little transmission. To do strange. The second issue is a little this, you need to take more insidious. Suppose that the care of two things: elec- impedance of the antenna is very far tric and electromagnet- from 50 Ω and very reactive, say 1 – j × ic. On the electric side, 1,000 Ω, which is not uncommon for you need good match- non-optimal antennas. To match it and ing between the trans- cancel the 1,000-Ω capacitive reactance, mitter (or receiver) and you will need to add a serial inductor the antenna—or more with a reactance of 1,000 Ω. Unfortu- exactly, between the nately, you can’t buy an ideal inductor. transmitter and the Good ones may have a quality factor Q combination of the of, say, 200, which means that their para- antenna and free sitic resistance will be 200 times less than space. On the electro- their reactance (here 1,000/200 = 5 Ω). If magnetic side, because you compare this value to the 1-Ω the antenna will trans- resistance of this antenna at resonance, form the electric ener- you can see that five times more energy Photo 3—This is a quarter-wave 868-MHz antenna on a small ground plane designed with 4NEC2. The generator is the little circle at the bottom of the gy into a radiated field, will be dissipated in the matching antenna. The ground plane is 30 cm (approximately 1′) above ground. you need it to radiate inductor than radiated by the antenna.

62 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 63

Photo 4—Running NEC2 on the design shown in Photo 3 gives this reflection coefficient. It shows the antenna is resonating around 845 MHz. At 868 MHz, the S11 coefficient is –8 dB. For 1 W of applied power, you will have 10–8/10 = 0.15 W reflected back to the source. That’s 0.85 W transmitted. Not too bad.

This is not optimal. This is only an example, but it is significant. If you have an antenna with an impedance far from the source impedance, then build- ing a matching network will often be impossible, even if it theoretically is always possible. The easiest way is to try to use an antenna that provides an impedance around 50 Ω and no reactance at the desired frequency without any need for a matching network. Two basic antenna designs have this characteristic and are then often used. The first one is the half- wave dipole, which has an impedance of 68 Ω, not far from 50 Ω (see Figure 2). It is built with two colinear wires, each l/4 long, with lambda the wavelength in free space of an electromagnetic wave at the desired frequency. As a reminder, lambda is calculated as lambda = C/F, with lambda in meters, F in hertz, and C is the speed of light (300,000,000 m/s). The examples in this article are based on Exceptional 868-MHz antenna designs. (868 MHz is Professional Featu res – Price a free ISM band in Europe that’s equiv- alent to the 915-MHz band in the U.S.) 34 Channels sampled at 500 MHz Let’s calculate the wavelength in free space at 868 MHz: Sophisticated Multi-levelTMulti-level Triggering 300,, 000 000 = 34.56 cm (or 13.6") 868,, 000 000 [2] Transitional Sampling /Timi/ Timing and State

A dipole at 868 MHz will need two Connect this indispensable tool to your PC’s 8.65-cm wires (i.e., 34.56/4). Both USB 1.1 or 2.0 port and watch it pay for itself within hours! wires need to be driven by a bipolar

electrical signal. A common variant of 500 MHz Sampling / Timing Mode (Internal clock) Interpreters for I2C, SPI and RS232 the dipole is the quarter-wave antenna 200 MHz Sampling / State Mode (External clock) Integrated 300 MHz Frequency Counter (see Figure 2). It is derived from the Multi-level Triggering on Edge, Pattern, Event +6V to -6V Adjustable Logic Threshold half-wave dipole. The median plane of Count, Group Magnitude/Range, Duration etc. supports virtually all logic families a dipole is always at a null potential, Real-Time Hardware Sample Compression Full version of software free to download Qualified (Gated) State Mode Sampling Mictor adapter available so it can be replaced by a ground plane. So an 868-MHz quarter-wave www.pcTestInstruments.com antenna is an 8.65-cm vertical wire Visit our website for screenshots, above a large ground plane. In this specifications and to download the instance, “large” means at least as large easy-to-use software. as lambda/4, for example, 10 × 10 cm. Intronix Test Instruments, Inc. Tel:(602) 493-0674 Fax:(602) 493-2258 Such a quarter-wave antenna has an www.pcTestInstruments.com impedance half of the impedance of a

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 63 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 64

dipole, so 68/2 = 34 Ω, which is still quite close to 50 Ω. The advantages of the quarter-wave antenna over the dipole are that it can be driven by a unipolar signal (e.g., from a coaxial cable) and it is physically smaller. Its big disadvantage, often forgotten, is that such an antenna works only with a good ground plane, which is not an easy thing to get in a portable device. One way to replace a defective ground is to use an artificial ground made with a couple of lambda/4 ground wires, giving the so-called ground plane antenna (see Figure 2). What about radiation patterns? An antenna that would radiate the same power in every direction is called an Photo 5—The 4NEC2 also enables you to plot the radiation pattern of the antenna, either on a graph or on a 3-D isotropic antenna. It is used as a refer- plot. Here, the classic donut pattern of a quarter-wave antenna is perturbated by the proximity of the ground. The ence to compare real antennas. By com- gain in the privileged direction is around 3 dBi. Colors on the antenna wires are an image of the RF current circulat- parison, the radiation pattern of a half- ing in them. wave dipole or quarter-wave antenna is like a donut, with a null field in the axis dipole antenna is said to have 2.15 dBi simulator, the NEC2, which began as a of the antenna and a maximum field gain, meaning 2.15 dB more than an U.S. military research project and is perpendicular to it. In this perpendicular isotropic antenna. In real life, things now in the public domain, at least in direction, the radiated field is 2.15 dB are a little more complex, but that’s its second version. Arie Voors devel- higher for a dipole than an isotropic the idea. Why not simulate it? oped a nice user interface for it with 3-D antenna. Because the dipole is concen- Antenna simulation doesn’t have to features. It’s called 4NEC2. The simula- trating the power in this direction, a be expensive. Let’s start with a free tor needs you to model your antenna

64 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 65.qxp 12/4/2006 11:56 AM Page 1 95.qxp 1/9/2008 11:14 AM Page 1 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 67

and all its surroundings using The bad news is that free a mesh of round wires. This simulators, such as NEC can be tedious, but it can be can’t help for such anten- automated with scripting nas. A real electromagnetic routines. Photo 3 shows the simulator is needed. Son- design of a quarter-wave net has a key advantage. 868-MHz antenna placed on There is a free version, a ground plane. I simulated Sonnet Lite, which you the ground plane with four can download at the web horizontal wires intercon- site. Some features aren’t nected together by a “square” included in the free ver- of wires, itself 30 cm (around sion: Radiation pattern cal- 1′) above ground level. Some culation is not supported more clicks and NEC2 shows and design complexity is you the reflection coefficient limited, but this is a great of your antenna, which starting tool. I was fortunate enables you to ensure it is to use the full version (cour- well matched at 868 MHz tesy of Sonnet) for this arti- (see Photo 4). More impres- cle. Photo 6 shows a Photo 6—This is a 3-cm microstrip antenna designed under Sonnet. The height of the sively, 4NEC2 can also show PCB is 1.6 mm, but it is enlarged on the display. Its bottom side holds a ground plane straight, 3-cm antenna built you the radiation pattern of up to the start of the antenna section. On the top side, the track width is calculated for on FR4 epoxy. Unfortunate- your antenna in a 3-D view a 50-Ω impedance. This antenna is far too short for 868 MHz. ly, the electromagnetic sim- (see Photo 5). Designing and ulation shows that its reso- executing this simulation took me about for your 868-MHz antenna, which is nant frequency is still far too high, two hours without any prior experience significantly lower than the required around 1,520 MHz. Three centimeters is with NEC, so don’t be afraid to try it. 8.64 cm. One way to have a smaller definitively too small for a single anten- Are you going to present an antenna antenna is to build it on a material na, even on FR4. design to a customer? Even if your pro- other than air. The length of a resonant One possibility is to extend the posal is perfectly matched, I bet you antenna is always lambda/4, but the length of the antenna up to a total will always get the same answer: “Can wavelength lambda of a wave is smaller length long enough to get a resonance at we have a smaller one, please?” What on a substrate (e.g., a ceramic or even a 868 MHz. This is what I did in the happens if you start with a quarter-wave classic FR4 PCB). The antenna and reduce its length without ratio is the inverse of changing the operating frequency? Its the square root of the radiation resistance will decrease more dielectric constant of and more, and its reactance will become the material (which is more and more capacitive (meaning neg- 4.3 for FR4), at least ative). Reciprocally, an antenna longer if the antenna is than lambda/4 will have a higher radia- buried inside the tion resistance and an inductive reac- material. So, if your tance (like a long wire), so in both cases, 868-MHz antenna is a it is no longer matched. You can add a copper track on a PCB matching network to correct it. If the (a microstrip antenna), antenna is just slightly shorter than its length will be sig- lambda/4, you can use the simplest nificantly smaller matching network, a serial inductor. The than the 8.65 cm cal- inductor will cancel out the capacitive culated above. The reactance, but it won’t increase the radi- actual length is diffi- ation resistance, so the match won’t be cult to calculate perfect. The matching inductor is often because the antenna made with a small helical section in the is at the interface middle of a vertical antenna. If you want between epoxy and to have short antennas or avoid a match- air, but this is a way ing network, the other solution is to use to reduce its size. more sophisticated antenna designs. That’s why antennas for mobile phones are MICROSTRIP ANTENNAS often built on exotic Photo 7—This is a first attempt to have a resonance at 868 MHz with an antenna Let’s assume that you have only 3 cm ceramics. still 3 cm long. The length of the S is tuned to get resonance (see Photo 8).

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 67 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 68

wire, which acts as an inductor but with a large contact). Lastly, keep it far enough from any materials. It should work reasonably well. These rules are not fun, and unfortunately they are often inapplicable due to space or design constraints. Another option is to design your cus- tom, properly matched antenna on a simulation tool, either wired or on a PCB, and optimize it until you have good simulated results. There is another mandatory step, but you may need deeper pockets. You will then have to measure if your antenna is behaving as planned, especially if it is in a package. The instrument needed to do that is a vectorial network analyzer (VNA), which will plot the actual amplitude and phase of the reflected signal for each frequency and enable you to easily tune it or measure its impedance to calculate Photo 8—I used Sonnet to calculate the reflection coefficient of the antenna in Photo 7. There is a resonance at 868 MHz. There are also resonant frequencies around 1,600 MHz, which is probably due to the shorter elements of a matching network. Some years ago, I the S. However, the radiation pattern of such an antenna (not shown) is disappointing. wrote an article about the design of a low-cost vectorial analyzer, which unfortunately lacks the directional example shown in Photo 7. The simula- change, so it can be detuned. “Close” bridge needed for antenna measure- tion result is shown in Photo 8. The here means closer than around lamb- ments (“Vector-SoC,” Circuit Cellar antenna resonates at 868 MHz, even if da/10, with lambda the wavelength 149, 2002). Some old VNAs are available it has other resonant frequencies. The in free space as usual. That’s why on the surplus market for a reasonable only issue is that its calculated radia- you can design a tion pattern is a little chaotic as its decent antenna and shape might imply. The beauty of elec- get poor results when tromagnetic simulators is that it takes you put the device in only a matter of minutes (at least on a a box. fast PC) to try different solutions. Anyway, how are Another solution to match a short you going to manage antenna is to add a parallel capacitor the antenna in your at the end of the antenna. This can be next wireless project? done by adding a large surface of cop- If you are in a hurry, per (see Photo 9). This time the simu- then take the easy lated response was nearly perfect and route. First, limit its radiation pattern was more accept- yourself. Design sim- able (see Photo 10). ple and predictable The last solution would be to add a antennas like quarter- discrete matching network, which can waves or use prebuilt be calculated with a first simulation of antennas. Next, add a the unmatched 3-cm antenna like I did large ground plane or in the first part of this article. But I use artificial grounds used Sonnet in place of QUCS. (except if you have a dipole antenna driven ANTENNAS IN REAL LIFE by a pair of differential Simulations are great tools, but I must signals, which doesn’t be honest: real life is often more difficult need a ground) and than simulations, in particular with connect the ground Photo 9—Another way to bring the resonant frequency down is to add loading antennas. One of the trickiest points is plane to the electrical capacitors to the end of the antenna. A capacitor is nothing more than some that each time you move an object close ground in a proper RF more copper. I tweaked the size of both squares until I got a good resonance to an antenna, its characteristic could way (not by a long frequency (see Photo 10).

68 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802005Lacoste.qxp 1/7/2008 4:55 PM Page 69

Robert Lacoste lives near Paris, France. He has 18 years of experience working on embedded systems, ana- log designs, and wireless telecommu- nications. He has won prizes in more than 15 international design contests. In 2003, Robert started a consulting company, ALCIOM, to share his pas- sion for innovative mixed-signal designs. You can reach him at [email protected]. Don’t forget to write “Darker Side” in the subject line to bypass his spam filters.

PROJECT FILES To download code, go to ftp://ftp.circuit cellar.com/pub/Circuit_Cellar/2008/211.

RESOURCES L. B. Cebik, D. Hallidy, D. Jansson, and R. Lewallen, The ARRL Antenna Photo 10—This is the simulated reflection coefficient of the antenna in Photo 9. It shows a good match at 868 MHz Book: The Ultimate Reference for and no spurious resonances up to 2 GHz. Moreover, the antenna’s radiation pattern is acceptable. Amateur Radio Antennas, Transmis- cost. Refer to Photo 11 to see how an path loss), I hope you are now a little sion Lines And Propagation, 21st edi- old VNA can make your life easier. less afraid of impedance matching and tion, American Radio Relay League, Here we are, out of space. I have antennas. Don’t hesitate to play with Newington, CT, 2007. touched on only 5% of the subject. QUCS, NEC2, Sonnet Lite, and real M. Loy and I. Sylla, “ISM-Band and Although I didn’t cover several impor- antennas. This is the only way to real- Short Range Device Antennas,” Texas tant topics (e.g., broadband antennas, ly understand what’s going on. Anten- Instruments, Inc., SWRA046, 2005. polarization issues, loop, helical or nas are not black magic, even if they directional antennas, standing waves, are sometimes on the darker side. I T. Marshall, “Numerical Electromag- nics Code,” 2002, www.nec2.org. D. Miron, Small Antenna Design, Newnes, Burlington, MA, 2006.

M. Reppel and Dr. Mühlhaus Consulting & Software, “Analysis of an 868-MHz Loop Antenna,” D-58452, 2005. J. Wetherell, “Online Impedance Matching Network Designer,” 1997, http://home.sandiego.edu/~ekim/e194 rfs01/jwmatcher/matcher2.html.

SOURCES 4NEC2 Simulator Arie Voors http://home.ict.nl/~arivoors Suit professional and Lite electromag- netic field solvers Sonnet Software, Inc. www.sonnetsoftware.com Quite universal circuit simulator Photo 11—I hooked a hand-made 868-MHz dipolar antenna to my old HP8754 vectorial network analyzer (VNA). (QUCS) The equipment is invaluable for antenna work because it gives me a real-time measurement of the antenna imped- ance matching. The horizontal scale is 0 to 1,300 MHz. The vertical scale is 2.5 dB/div. If you buy an old VNA, don’t SourceForge forget to buy the mandatory reflection bridge, which is an HP8502A for the HP8754. http://qucs.sourceforge.net

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 69 2802004Nisley.qxp 1/9/2008 11:02 AM Page 70

ABOVE THE GROUND PLANE by Ed Nisley

Transformers Are you looking to try spot welding or resistance soldering? Ed has you covered with a look at transformer basics. He examines some of the fundamental equations governing transformers and measures the properties of a real transformer.

Back in the Bad Old Days, you sol- at some of the fundamental equations taneous voltage due to changes in the dered metal by heating a chisel-pointed governing transformers and measure field. Obviously the induced voltage is copper-tipped iron rod in an open- the properties of a real transformer. zero in an unchanging magnetic field. flame furnace and applying tin-lead Next time, I’ll explore how to control The flux φ represents the magnetic solder. No project was too large for a the power it delivers to the workpieces. field linking the conductor, which is massive red-hot iron! always less than the total flux. The These days, a needle-pointed 60-W FUNDAMENTALS CGS unit is the maxwell, in honor of temperature-controlled iron and lead- In the mid-1820s, Hans Christian James Clerk Maxwell, who combined free silver solder suffice for my elec- Øersted (usually anglicized from the all of the various electrical and mag- tronic soldering needs. I sometimes Danish as Oersted) put a husky direct netic equations into a unified electro- drag out my hulking 150/230 W sol- current through a wire, observed that it magnetic system that explained dering gun, although even that’s inad- moved a nearby magnetic compass nee- everything up to that point in histo- equate for large RF shields, big con- dle, and concluded that electricity ry. Einstein changed all that, but rela- nectors, and structural elements. could produce magnetism. André-Marie tivity is far beyond the scope of this Rather than getting a larger iron or a Ampère soon demonstrated that the column. bigger fire, I decided to try resistance sol- needle’s deflection was proportional to Note that Mw, the abbreviation for dering. This process directly heats metal- both the current and the number of maxwell, is confusingly similar to MW, lic workpieces by passing a high current conductor loops near the compass. the prefix mega applied to the unit watt. through them, so only the section The natural unit of what became Worse, the font flourish that produces Ω, between the electrodes gets hot enough known as magnetomotive force is the the capital Greek omega, often vanish- to melt solder. Direct heating is far ampere·turn. The CGS system of units es in printed or Web-based text, con- more effective than indirect heating by uses the gilbert, abbreviated Gi, paying verting a resistance in MΩ (megohm) conduction from a soldering iron’s tip. homage to William Gilbert, the guy who into power in MW (megawatt) or flux Taken to an extreme, resistance first named “electricity.” It’s defined as: in Mw (maxwell). You must pay close heating can fuse workpieces without 4π attention to the context surrounding mmf == N I 0.4π N I solder in a process called spot weld- 10 [1] the equation to avoid being tripped up ing. For example, NiMH cells and by typography. nickel-metal interconnects in battery Those early experimenters found that As EE professors are wont to say, packs are spot-welded together. the converse of Oersted’s effect did not the derivation of transformer action The basic schematic of a resistance occur: an unchanging magnetic field did from Maxwell’s equations should be soldering or welding unit has three com- not produce a corresponding direct cur- obvious to the casual observer. Fortu- ponents: a voltage source, a switch, and rent. In 1831, Michael Faraday discov- nately for the rest of us, a host of sim- a resistive load. The load, simply the ered that moving the wire in relation plifications come into play in practical joint between the workpieces, would to the magnetic field induced a current power-transformer applications. look like a short circuit in any other that depended on both the wire’s speed Passing a current I through an N- application, so this certainly isn’t a and number of turns. The equation for turn coil wrapped around an iron fussy high-impedance analog circuit. that effect is: (steel, ferrite, whatever) core produces The power source, typically a massive the mmf defined by the first equation. dφ e =− N × 10−8 transformer like the one shown in dt [2] That subsequently creates a magnetiz- Photo 1, is a truly unfamiliar electron- ing force H that depends on the mag- ic component. In this column, I’ll look The voltage e represents the instan- netic path length through the core,

70 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802004Nisley.qxp 1/9/2008 11:02 AM Page 71

abbreviated MPL: tables often list the prod- uct µ ·µ in some truly odd mmf R 0 H = units. Be careful, because MPL [3] the choice of units really You can easily find the MPL for matters! simple (i.e., ordinary) transformers by The reason transform- measuring along the core’s centerline ers have iron cores is to perpendicular to the flux path. For a get the highest possible B rectangular hole with height H and for a given H, thus pro- width W in a rectangular core of ducing the maximum sec- width C, the mean path length is: ondary voltage for a given primary current. If the µ MPL =+ 2H 2W + 2C [4] of each iron-like material was a constant, that An MPL measured in cm produces would be pretty much the H in oersted, abbreviated Oe, bringing end of the story. Alas, not Photo 1—Measuring the B-H curve for a transformer requires only a few Hans Christian into the team. only is µ strongly nonlin- components. The 40-pin DIP atop this salvaged 1-kW microwave trans- Assuming all of the magnetic flux φ ear, it also depends on former shows why circuit designers generally avoid magnetic elements! stays within the transformer’s core, a past values of H: magnetic reasonable approximation for iron-like materials display hysteresis. value of μ decreases as B increases; even- core materials, the flux density (also tually the core saturates as μ = 1 and the known as magnetic induction) is the TRANSFORMER ACTION core behaves as though it’s made of air

ratio of the flux to the core area AC: Combining those equations with a for incrementally higher H and B. The φ few assumptions, then stirring the weirdness of μ is just one reason why B = [5] mix gives you the fundamental trans- transformer design isn’t a simple matter AC former equation: of plug-and-chug equation manipulation.

A includes only the magnetic − Indeed, transformer design balances C E =× 4 F f N A B 10 8 [7] material in the core, so it’s smaller C core material, overall size, wire proper- than the value you compute by multi- The value of F, the form factor, is ties, insulating material, and a host of plying the core’s thickness and side the ratio of the voltage waveform’s other factors. This isn’t the place for all width. The stacking factor S, typically RMS and average values: that, simply because most of us won’t near 0.9, accounts for insulation ever design a power transformer and, for rms between core laminations, gaps F = [8] those who do, there are fat books cover- average between ferrite grains, and any other ing the subject far better than I can. non-magnetic constituents. In this context you must compute a 2 H in Mw and AC in cm produces B waveform’s average value from its MEASUREMENTS in gauss, abbreviated G (not to be con- absolute value, because the true average However, measuring a transformer’s fused with the more familiar Gravita- value of a sine wave works out to zero. properties is reasonably straightfor- tional Constant, nor with the gilbert), Under that rule F = 1.11 for sinusoidal ward in comparison with designing it. after Carl Friedrich Gauss. Measuring waves, F = 1.00 for bipolar square The real trick is to not kill yourself in

AC in square inches delivers B in the waves, and F = 1.41 for unipolar square the process. quaint unit of lines per square inch. waves. The value of E is always in RMS I recycled the high-voltage trans- A property called permeability relates volts, with F handling the conversion former from a kilowatt-class consumer the applied magnetizing force H to the from the flux waveform. microwave oven by chopping out its resulting flux density B in the core: Pop Quiz: verify those values. 2.3-kV secondary winding with a wood B represents the peak value of the chisel. After wrapping cardboard shields B = μH [6] magnetic flux density within the core, around the core’s sharp corners, I In CGS units, vacuum has µ = 1 which depends on the core material rewound the secondary with five turns

G/Oe (defined as µ0), air is very close and the transformer’s design. The low- of four AWG 10 wires in parallel to get to 1, and most non-magnetic materi- ercase f represents the voltage or flux the same conductor area as a single dif- als are in the same ballpark. Ordinary waveform frequency in hertz. The ficult-to-bend AWG 4 wire. Photo 1 iron is around 5 × 103 and specialized number of turns N and the core area shows the results of that surgery. 3 alloys range upward to about 300 × 10 . AC are as defined earlier. Although The current in the primary winding

Ferrite cores used in high-frequency both AC and B must use the same unit sets the magnetizing force H and the applications hover around 10 × 103. of area, it doesn’t matter which. core flux density B (depending on the It’s convenient to define the relative For a given core, higher B corresponds value of μ). Knowing B, the fundamental

permeability µR of other materials as a to higher voltage, but the core material transformer equation relates a pair of

dimensionless multiplier of µ0, but core must support that flux density. The variables for each winding: its voltage

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 71 2802004Nisley.qxp 1/9/2008 11:02 AM Page 72

and number of turns. Their ratio gives Powerite variable isolation transformer. the transformer’s volts per turn value: If you don’t use an isolation transformer, E make absolutely certain to connect the =× 4 F f A B 10−8 N C [9] resistor on the neutral side of the AC line and measure the differential volt- Every winding on a given trans- age across it. Do not connect your former has the same E/N ratio, because ’scope ground lead to the AC line! each sees the same core flux. The The core’s MPL works out to 26.7 cm, Figure 1—A transformer’s magnetizing force depends rewound five-turn secondary produces so the magnetizing force H is: on the primary current and the resulting changes in core flux determine the secondary voltage. This circuit 5.3 V with the rated 120 V on the pri- 0.4 π N I produces voltages proportional to both quantities, but H == 5.2 I mary, making E/N = 1.1. The primary 26.7 PRI [14] requires isolation from the power line to prevent electrical should therefore have 110 turns, close or organic damage. to my estimated count of 120 turns. The 100-mΩ resistor scales the dis- The core laminations are a rather play by 10 A/V, making the voltage-to- power output, because even large changes thick 0.020 in, so I estimated the H factor: in H caused by line-voltage variations stacking factor S = 0.95. Multiplying won’t affect the peak value of B by very H = 52 VRES [15] the central leg area by S gives AC as: much and, thus, won’t change the output The RC integrator’s –3-dB point voltage driving the oven’s magnetron A =××= 0.95 4.45 4.85 20.5 cm2 [10] C should be much lower than 60 Hz, so I tube. Imagine this: no complex electron- The core flux will be sinusoidal, so picked R = 220 kΩ and C = 1 μF for a ics, no delicate semiconductors, no feed- the form factor F = 1.11. Solving for 4.5-Hz cutoff. The output voltage back loops; just a saturated iron core! the core flux density gives: across the capacitor is then: The BH plot shows the hysteresis 1 during each power-line cycle, where V = Vdt CAPR C ∫ SEC [16] each value of H has two corresponding [11] values of B that depend on whether H Recall that the integral of a sine is the is increasing or decreasing. The value Plugging in the numbers produces negative cosine, scale up the result by of B also depends on the maximum its peak value: RC, pop all that into the second equa- value of H. Obviously, B is not a sin- 1.1 tion, and turn the crank to get the gle-valued linear function of H! B = = 20 kG 4 ×××× 1.11 60 20.5 10−8 [12] voltage-to-flux-density scale factor: The size of the BH loop increases as the applied primary voltage goes up. It B R C × 108 That’s very high for a laminated = =× 215 103 turns out that the area within the loop V N × A [17] iron core, which means the core oper- CAP C is proportional to the power dissipa- ates near saturation. The smooth lower trace in Figure 2 tion in the core caused by rearranging The secondary winding voltage is shows the integrated secondary volt- all those magnetic domains during proportional to the change in core age has a peak value of 90 mV. That each power-line cycle. flux, so the time integral of that volt- corresponds to a peak core flux densi- Pop Quiz: verify that: age is directly proportional to the flux. ty of 19 kG, comfortably close to the =×× × × Power B H AC MPL f [18] Integrating a sine wave signal is triv- 20 kG derived from the turns ratio. ially easy: an RC circuit will suffice. Although the secondary voltage Hint: dimensional analysis is your Figure 1 shows the circuitry required (think “core flux”) is nearly sinu- friend. to measure the primary current and inte- soidal, the primary current (“magnet- My Kill A Watt meter reports that grate the secondary voltage: a 0.1-Ω izing force”) sports nasty 14-A peaks. the transformer draws 76 W with an power resistor and an RC low-pass filter, With B nearly sinusoidal and H bear- respectively. You’ll also need an oscillo- ing spikes, their ratio μ (“permeabili- scope and an isolation transformer. ty”) obviously isn’t constant! The current-sensing resistance should be much less than the primary BH PLOTS Power =×× B H A × MPL × f winding’s inductive reactance. I meas- Figure 3 plots B against H for three C ured the inductance LP = 20 mH, values of primary voltage to show how making its reactance: the transformer operates at three levels X == 2 π f L 7.4 Ω of maximum magnetizing force. Even LP [13] though the peak H values at 120 VAC lie I taped a 100-mΩ sandbox resistor, the well off-screen, it’s obvious that this coax cable to the ’scope, and the AC line transformer runs very close to com- Figure 2—The upper trace shows the primary voltage applied to the transformer. The peaked trace is the pri- cord to a wood stick acting as an plete saturation. mary current, proportional to the magnetizing force H. anchor and strain relief, then connected It turns out that’s a brutally effective The sine-wave lower trace is proportional to the core the input to an antique Sencore PR57 way to regulate the microwave oven’s flux density B.

72 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802004Nisley.qxp 1/9/2008 11:03 AM Page 73

it, but most of the equations you find on the web don’t include the appropri- ate conversion factors. Check your work! Resistance heating forces a high cur- rent through the workpieces, making it unsuitable for electronic devices. Use it with metallic objects, not electronics. Although I cited Wikipedia in the Figure 3—The Y axis is proportional to the core flux references, treat those articles as a density B. The X axis is proportional to the magnetizing starting point and always cross-check force H. The three curves show various primary volt- the equations with other sources. ages: 120 VAC drives the core nearly to saturation. Their tech articles tend to be stable, but errors do creep in and may remain open secondary. That seems high, but undiscovered for some time. I’m very recall it’s less than 10% of the original disturbed that some professors have oven’s rated power level. Because the deliberately introduced errors to see transformer also provided output whether their students are paying power regulation, this seems like a attention. I reasonable trade-off. The meter reports 6.6 A of primary Ed Nisley is an EE and author in Pough- current, not the 14-A peaks shown in keepsie, NY. Contact him at ed.nisley@ Figure 2, which is the difference ieee.org with “Circuit Cellar” in the between the waveform’s RMS and peak subject to avoid spam filters. values. My oscilloscope’s calculated RMS value matches the meter’s display RESOURCES to 10%. I’m mildly surprised that the meter calculates accurate RMS values. Transformer rewinding and spot welding: Figure 2 shows that the current peaks www.users.on.net/~endsodds/psrewind. lag the primary voltage by 90 degrees, htm so nearly all the current goes into reactive power. Indeed, the meter www.5bears.com/welder.htm reports 780 VA of reactive power and a http://users.frii.com/katana/spotweld. power factor of just 0.09, so this hulk html is a mildly lossy inductor. www.rhunt.f9.co.uk/Electronics/Spot_ CONTACT RELEASE Welder/Spot_Welder_Page1.htm Those waveforms will change when Units conversion, http://converter.eu. this transformer sees a load, but exploring that topic requires some Wikipedia, “Dimensional Analysis,” electronics. Meanwhile, make some http://en.wikipedia.org/wiki/Dimensional measurements and see how transform- _analysis. ers really work. ———, “Transformer Design,” http://en. CAUTION! The familiar Variac-style wikipedia.org/wiki/Transformer_design. variable transformer is an autotrans- former, not an isolation transformer: its primary and secondary terminals share a SOURCES single winding. If you must use an auto- Calchemy live dimensional calculator transformer, make absolutely certain Calchemy Software, Inc. that both the power-line neutral and the www.calchemy.com/uclive.htm measurement resistor connect to the Kill A Watt meter winding’s common terminal. A trivial P3 International Corp. oversight can destroy your test equip- www.p3international.com ment or kill you. I attempted to use SI units for this col- PR570 Powerite II Transformer and umn and failed completely; the classic safety analyzer references use CGS units, as do many of Sencore, Inc. the datasheets. SI has a lot to recommend www.sencore.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 73 27802002-Bachiochi.qxp 1/7/2008 4:56 PM Page 74

FROM THE BENCH by Jeff Bachiochi Portable Poll Server Part 2: Data Acquisition & Results

Jeff finishes describing the design of a portable poll server. SitePlayer and a small micro provide Internet access to a poll’s questions and the results.

The main mode of transportation hands of almost every major company used in the colonies was horseback. that wishes to get into John Q. Public’s Because information (i.e., the mail) head. Success is often achieved by satis- was transmitted by pony, it’s not sur- fying of the masses. Polling provides the prising that the tabulation of an elec- data that indicates the path to take for tion was a tedious process. Ballot maximum results (based on what the security was more a local issue than a poll says people want). national one. Today, stolen identity While the projects in this column concerns have heightened our intoler- aren’t politically (or monetarily) moti- ance to election fraud and electronic vated, during an election year, our voting issues. Recently, we saw net- awareness of polling increases, and it Photo 1—This project’s prototype fits in a plastic enclosure slightly larger than 3″ × 4″. The SP module work news teams begin predicting seems fitting to include a project with plugs into a pair of 1 × 7 SIP connector strips, which election outcomes as soon as the polls a polling theme. All those in favor, connect the microcontroller’s UART1 port and the closed on the East Coast. Although keep reading. In this column, I will external circuitry in support of a LAN connection. A most voters in the west had already finish the project I started last month. MAX232 converts the microcontroller’s UART2 TTL serial output to RS-232. voted or at least determined how they The hardware discussed last time con- would vote, I can not help but feel sisted of a small module that includes that some may have been swayed a web server. A small amount of questions and a number of possible either to change their votes or not external circuitry supports the responses. All of the SitePlayer’s code, bother voting at all. SitePlayer module (see Photo 1). Addi- including the necessary web pages, is Unfortunately for us, election cam- tional circuitry enables a microcon- automatically produced using an appli- paigns are beginning earlier in the elec- troller to assist in data collection in cation program written to support the tion cycle. The amount of money spent support of the web pages served. project. The poll is created from a text campaigning is spiraling out of control. These pages provide you with poll file of questions and multiple-choice To win a presidential bid answers. You will need to for election today, candi- SitePlayer serial commands refer to that column as the dates may have to spend up Command Command byte Description basis of how this second part to $1 billion. Let’s put that NOP 00h Do nothing, recommended initializing command supports and makes use of into perspective. That’s Status 10h Return status of SitePlayer the SitePlayer. roughly the total budget for Reset 20h Perform a watchdog reset the U.S. Department of ComParams 33h Set data rate and UART delay SERIAL CONNECTIONS Energy. What kind of tech- UDPsend 50h Send a UDP packet Communication with the nology breakthroughs Read 0C0h Read object from SitePlayer SitePlayer (SP) is handled could be made if we invest- Write 80h Write object to SitePlayer through a serial connection. ed that kind of money into ReadX 0D0h Read using extended 2-byte addressing The default data rate is energy research? WriteX 90h Write using extended 2-byte addressing 9,600 bps, but it may be During the campaign ReadBit 0E0h Read a bit variable, one byte address changed through the process, we are exposed to WriteBit 0A0h Write a bit variable, one byte address SitePlayer definition (.SPD) a lot of polling. While this ToggleBit 0B0h Toggle a bit variable, one byte address file. The SP understands a tool may be used in the few basic commands that Table 1—This table contains the serial commands recognized by the SitePlayer. Most political process, it has of these are used to receive data from or send data to SitePlayer’s internal registers. enable the retrieval and found its way into the The registers were defined in the “Object” section of the .SPD file. updating of its internal

74 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 27802002-Bachiochi.qxp 1/7/2008 4:56 PM Page 75

file (based on the poll entered last Listing 1—This is the beginning of the .INC file produced by SiteLinker when the .SPD file was compiled. It lists the present location of each variable, along with the value each variable is initialized to. month). The byte variable maxquestions maxquestions equ 0000h ; Byte output 7 (located at address 0) indicates that presentquestion equ 0001h ; Byte bidirectional 0 the poll has seven questions. The byte response equ 0002h ; Byte bidirectional 0 maxanswersbase equ 0003h ; Integer output 13 variable presentquestion (located answervaluesbase equ 0005h ; Integer output 20 at address 1) is used by a served page questionoffsetbase equ 0007h ; Integer output 64 to determine which variable to display answeroffsetbase equ 0009h ; Integer output 85 within a web page. The byte variable stringoffsetbase equ 000Bh ; Integer output 151 response (located at address 2) is updated by your answer. The follow- registers (see Table 1). This is the most important function ing word variables are pointers to par- I used a Microchip Technology because it directly supports the boss ticular lists. For instance, the word PIC30F3013 for this project because it (SitePlayer). variable maxanswersbase (located at has dual hardware serial ports in a 28-pin Once the microcontroller has com- address 3) is a pointer to the list of the (DIP) package. The purpose of the pleted setting up housekeeping, it can number of answers for each question microcontroller is to tally poll answers begin communication with the (1–7). These pointers enable the and keep the SP updated with the SitePlayer. The microcontroller uses microcontroller to determine the results. It is also responsible for the internal EEPROM to save poll results makeup of a poll, even though the background task of outputting poll (in case the power fails). One of the lists defining a poll may change (i.e., a results to a local display. configuration jumpers enables/dis- different number of questions in the ables the reloading of this data during poll). The remaining lists contain the POWER UP power-up. This is the only function accumulated tallies (a count) for each SitePlayer gives you 0x300 bytes of that can alter poll data during power- answer (answervaluesbase word variable space. This will most likely up (normally the data is initialized to variable), the list of question offsets be the limiting factor in the size of zero). The first communications and string lengths (questionoffset- your poll because it includes the text between the SitePlayer and the micro- base), and a list of answers offsets and of every question and answer! (It helps controller are conducted by the micro- string lengths (answeroffsetbase). to keep the question and answers brief.) controller to discover all it can about The offset and length values in the This is not a problem for most micro- the last poll uploaded to the SitePlay- questionoffsetbase and controllers. There is a requirement of er. It does this by reading the first few answeroffsetbase lists refer to the some space for a few extra variables and pieces of data that will always remain stringoffsetbase, which points to a bit of buffer space for the communica- constant no mater what poll is the beginning of the string data. tion strings, but this is not significant uploaded to the SitePlayer. These are There isn’t a reason to duplicate all compared to the 8 KB of space available defined in the SitePlayer’s .SPD file of the data held in the SitePlayer in in the microcontroller. and output by SiteLinker to an .INC the microcontroller except that the I am using the PIC30F3013 internal file. Listing 1 is a partial list of this microcontroller will be outputting RC oscillator. The microcontroller also has a PLL option for 4/8/16 times clock boost. Based on this system clock, both data rate generators are set up for 9,600 bps and Timer1 to over- flow approximately every second. Interrupts have their own vectors and are pre-prioritized by their position in the vector table. In addition to this “natural” prioritization, there are eight levels of user priority. With this scheme, even the lowest priority inter- rupts can take precedence. Only two interrupts are enabled at this time, timer1 and external1. Timer1 handles the background activities. (This could be moved to the main execution loop because there are no real timing issues.) The external interrupt from the SitePlayer indicates that you have responded with an answer selection. Photo 2—Using a common serial terminal application (HyperTerminal), you can view the resultant output data.

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 75 27802002-Bachiochi.qxp 1/7/2008 4:56 PM Page 76

updated to the next There is nothing special about the INT0 Timer1 question number.) routine’s 1-s overflow time. This rou- Get the PresentQuestion and Next, the response tine’s function is to periodically out- response values from the SitePlayer UART2 busy? is retrieved. (This is put the poll’s results. The results data Calculate the pointer into the your choice to the format is a single question’s text and AnswerValuesBase Add “Q” and the ASC of Qcount to the Get that present value in the micro, XMIT2 buffer. last question.) Using each answer’s text (followed by an add 1, and return it Use Qcount to calculate the pointer into the QuestionOffsetBase. the list maxanswers, ASCII representation of the answer’s Use the data at the pointer to retrieve Update this value to the SitePlayer the question text and move it to the XMIT2 buffer. you can determine total hits). The idea here is to have Add to the XMIT2 buffer. Save the value to the EEPROM Acount = 0 the position in the some kind of serial device capable of answervalue list of displaying the text results sent out by RETl Acount = Acount + 1 the answer value the microcontroller. This might be Add “A” and the ASC of Acount to the XMIT2 buffer. Qcount = Qcount+1 Use Qcount and Acount to calculate that must be incre- simply a PC running HyperTerminal the pointer into the AnswerOffsetBase and AnswerValueBase. mented. This will be (see Photo 2). If so, you may want to Use the data at the pointer to retrieve the answer text and move it to the the total of all of the slow down the output rate (e.g., every Qcount > XMIT2 buffer. MaxQuestions? Add “:” to the XMIT2 buffer. maxanswers from 10 s) to give the user a chance to com- Use the data at the pointer to retrieve the AnswersValue and move it into the previous questions prehend each burst of information. the XMIT2 buffer. Qcount = 1 Add to the XMIT2 buffer. plus the response. To make this data more friendly, I The word variable is wanted to do a bit more with its out- Enable TX2 Acount = incremented (in the put. A second PC application reads MaxAnswers for Qcount? Clear Timer1 microcontroller) and the result data and displays it in a the new value is sent graphical format. RETl to SitePlayer to The microcontroller updates its update the appropriate own volatile variable, its nonvolatile Figure 1—This flowchart shows the two main interrupt routines running in the variable in its (EEPROM) variable, and the SP as microcontroller. The high-priority INT0 routine handles communication between the microcontroller and the SitePlayer module via UART1. The low-priority answervalue list. well. Figure 1 shows this interrupt Timer1 routine exports result data through UART2. The new value is also routine (INT0) and the background sent to the EEPROM (Timer1) task. to preserve the change The background task can be written this data in the background. You want (in case of a power failure). (Typical byte to support a number of display to keep communications with the EEPROM endurance is 1 million writes. options. For this presentation, I chose SitePlayer down to a minimum so it If you are worried about approaching to use Liberty BASIC (LB) to take in doesn’t interfere with its web serving this, you might choose to use another serial data from the microcontroller responsibility. Therefore, all of the method of determining when an EEP- and present it with bar graphs to visu- data is initially read from the SitePlay- ROM save is necessary.) alize the poll results (see Photo 3). er during the initializing process. After That’s it for SitePlayer support! The that point, only presentquestion Timer1 overflow determines the back- RESULTS and response need to be read from ground function for the microcontroller. While the serial output from the the SitePlayer. A single incremented answer value total needs to be updated for each answered poll question. Most polls don’t display the present totals to the viewer, but I thought this would make the project more interest- ing. You might choose to disable this.

MAIN Now that the microcontroller has “discovered” the poll and updated the SitePlayer’s answer values with either zeros or EEPROM values, it happily awaits an interrupt. After you are served a web page poll question and you respond with an answer, SitePlay- er interrupts the microcontroller and execution is passed to the external interrupt 1 vector. This routine then uses UART1 to retrieve the presen- Photo 3—This PC application written in Liberty BASIC monitors and displays the most recent poll results. The tquestion. (This value has just been results are continuously output via the microcontroller’s UART2.

76 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 27802002-Bachiochi.qxp 1/7/2008 4:56 PM Page 77

microcontroller includes actual poll a particular question is a matter of thumbdrive datalogger (“Embedded numbers (the number of times each changing the questionnumber vari- USB Breakthrough,” Circuit Cellar answer was chosen), a display showing able. In the dropdown menu, you can 200, 2007). how answers rank in the poll makes see three types of display modes: Sin- While the SitePlayer module used more sense than a bunch of numbers. gle Question, Sequential Questions, here simplified the end product, size This can also add a bit of color to the and Random Questions. There is also restrictions limit the size of the poll. display. LB is perfect for such an appli- a Time Delay menu selection used for While the file size is limited, the way cation. Once initial data has been col- all modes. This enables you to set the in which I designed this project (to be lected, I can use some simple tech- number of seconds (up to 1 min.) that changeable through the web interface) niques to display the data in a number a display remains before updating. meant that all of the text had to be of ways. I start by collecting data into This is also used in Single Question part of the SP’s file. The poll pages variables. By keeping track of question mode because any new data coming in could be designed to use a single mas- and answer numbers, I can tell when will need to be updated on the display. ter page for all of the questions. That the data begins to repeat. This way, I would enable the microcontroller to can prevent uninitialized data from POLL DATA pump the necessary text into the being displayed. As I worked on this project, I SitePlayer where it would be served as A display page consists of a ques- thought about how polling is used. In a dynamic page. While that reduces tion, its answers, and a bar graph of this project, each question is really a the file size necessary for the SP, each answer’s percentage. In addition separate poll unto itself. There is no updating with a new poll through the to each answer’s bar graph percentage, correlation between the answers of web would become much more com- the total responses along with the any two questions. For example, if the plicated. This could be done on the number of responses for each answer first question asking the sex of the microcontroller side by updating or are also displayed in text form (see poll taker resulted in 75% answering exchanging the poll text (i.e., in an Photo 3). For consistency, I designed “male” and 25% answering “female,” external EEPROM), but it requires the display using graphic boxes. The and if the second question inquiring local access. graphic box is powerful because it can about marital status was answered by I hope some part of this project contain any of the drawing/coloring 25% as “married” and 75% as single, induced an “Aha” while you read. In commands as well as text. Many of then you know that three times as either case, you should be able to the graphic boxes are used to display many males than females took the answer this question. only text. Here font and size com- poll and most of the polltakers were Was this article series helpful? mands operate independently on each single, but you have no idea what per- graphic box. To create a bar graph, the centage of the females are married. It ____Yes ____No graphic box is first filled using the back- is extremely important that you ask ground color “lightgray.” These graphic the right questions. Perhaps you Your vote counts! I boxes were initialized to 600 pixels should ask a question with four possi- wide by 30 pixels high. You can fill ble answers: male (single), female (sin- any color to any width by using the gle), male (married), and female (mar- Jeff Bachiochi (pronounced BAH-key- “color” and “boxfilled x,y” graphic ried). The usefulness of a poll starts AH-key) has been writing for Circuit box commands. To mix things up a with asking the right questions. Cellar since 1988. His background bit, each screen randomly selects four While totals offer specific informa- includes product design and manufac- colors from a given palette and each tion, to be able to correlate an answer turing. He may be reached through the answer’s bar is drawn using a different based on another question, a database magazine (jeff.bachiochi@circuitcellar. color. A percentage is calculated for must be used. If all of the answers of com) or his web site(www.imaginethat each answer’s response based on the each polltaker are recorded as a data now.com). total responses for each question’s record, correlations can be made by answers. The bar drawn for each filtering the records in different ways. PROJECT FILES answer uses the “boxfilled x,y,” where This way, one might toss aside all of To download code, go to ftp://ftp.circuit the value for x is 600 × percentage the records that include the answer cellar.com/pub/Circuit_Cellar/2008/211. (width) and y is 40 (height). The “box- “female” to specifically see how the filled x,y” command can be used to males answered another question. draw (a filled rectangle) anywhere Unfortunately, this can require huge SOURCES within the graphic box. I chose to left amounts of memory if you need the dsPIC30F3013 Digital signal controller justify all of the bars. All variables results available in real time. There is Microchip Technology, Inc. used to display information on the no reason the serial data used here (for www.microchip.com page are arrays where the first dimen- an external display) couldn’t be sion is the question number and a sec- rewritten to output database records. SitePlayer Webserver module ond dimension is the answer number. Refer to my column about using Vin- NetMedia, Inc. With a display page defined, displaying culum’s VNC1L as a serial-to-USB www.siteplayer.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 77 2802003-Cantrell.qxp 1/7/2008 4:56 PM Page 78

SILICON UPDATE by Tom Cantrell

Got Chips? Tom’s been on the road again, this time heading coast-to-coast from Hot Chips 19 at Stanford University to the Embedded Systems Conference in Boston. See where silicon is and where it’s headed as he takes a whirlwind tour of today’s and tomorrow’s chips.

With 19 years of Hot Chips confer- tomorrow’s predictions. phone you got for free. On the other ences under my belt, I’ve covered hun- Oh, before I forget, here’s a Hot hand, like The CW Television dreds of “Hot Chips.” The irony is Chips heads-up from Silicon Valley’s Network’s Beauty and the Geek TV that few real-world embedded applica- Computer History Museum. Through show, ASICs are supermodel chips that tions have found occasion to actually September 2008 they’ve got one of the regular Joe designers can only dream of. use any of them. But make no mis- original (only two exist) Charles The tutorial that kicked off the Hot take; every designer ultimately bene- Babbage difference engines on display Chips 19 conference, “Approaches to fits from the worthier ideas as they (see Photo 1). If you’re headed to System Design for the Working migrate from research labs into the Silicon Valley, consider making a pil- Engineer,” took on the ASIC love/hate mainstream chips everybody uses. grimage to the museum to see where issue head-on. First, David Witt of “Hot Chips” are like bleeding edge it all began. Texas Instruments described what’s concept cars that show us the shapes involved in crafting a state-of-the-art of things to come. That fact, along ARC OF ENLIGHTENMENT ASIC, the 65-nm OMAP 3430 chip that with the excellent conference execu- I’ve got to admit to a bit of a may well be inside that shiny new cell tion by the venerable organizers, love/hate relationship with ASICs. To phone Santa gave you.[1] Then Peter makes Hot Chips one of my favorite be sure, a big-iron ASIC is a wondrous Alfke of Xilinx countered with his com- events. What better way to get a thing to behold, the silicon wizard pany’s FPGA-uber-alles battle cry.[2] glimpse of tomorrow’s answers to behind the scenes that touches every- Judging by the advances in cell today’s questions? body’s life, for example in that cell phones, it won’t be long before E. T. A few weeks after Hot can actually call home. But Chips 19 at Stanford the blistering pace of change University, I was in Boston for makes designing the chips a the Embedded Systems scary proposition, not some- Conference (ESC). Compared thing for the faint of heart. to Hot Chips, ESC is more The bottom line is that like a trip to the auto mall you’ve got about a year and a where you’ll find real-world half from the time you brain- vehicles you can actually buy storm the next-generation today. No highfalutin concept cell phone features until you cars here. But ESC is where complete the chip design. In you go to find a pickup truck Witt’s words, “We must on the lot, one with a trailer understand and close in this hitch to haul some blue-collar time or die.” embedded software. Along the way, watch out Having visited Hot Chips for booby-traps like verifica- and ESC back-to-back, I tion because proving the chip couldn’t help juxtaposing the works now consumes 40% of two. Read on and I think the effort. With maybe 100K you’ll agree that there are signals on-chip, hook-up some interesting parallels Photo 1—It may not be a chip, but the Babbage difference engine now on display errors are practically a given. between today’s news and at the Computer History Museum was certainly hot in its time. Power supply (multi-voltages

78 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802003-Cantrell.qxp 1/7/2008 4:57 PM Page 79

and multi-domains) and interface ana- are good arguments that it’s the num- seem to have all the bases covered. log gremlins can be real headscratch- ber of different interfaces (i.e., rather But actually there are still gaps to ers. (Witt calls them “bug farms.”) Oh than the complexity or number of fill. For instance, even Xilinx evangel- yeah, don’t forget good old-fashioned things they are interfacing) that is the ist Alfke was man enough to admit spec changes (i.e., “What I really proper measure of design difficulty. that FPGAs still have some catching meant was…”). Thus, it’s worth some effort to stan- up to do when it comes to price (i.e., Two hundred engineers, two years, dardize and minimize the number of unit chip price presuming high vol- and a $2 million mask-charge later, the different interfaces in your design. In ume), performance (density and fre- suspense mounts as you wait to see if return, you’ll derive benefits like quency), and power consumption. the chip that comes out of fab works “replace-ability” (the ability to easily With that in mind, let’s teleport the first time (as did the OMAP 3430). migrate to new silicon), “arbitrary over to ESC and check out some real- Otherwise, it’s time for the dreaded, and composability” (the ability to mix and world gap fillers. no doubt career-limiting, “re-spin.” match functions without adding bugs), Atmel has come up with the Don’t have the means, will, or, for and “linear effort” (design effort relat- Customizable Atmel Processor (CAP), that matter, cojones to ante up for an ed to the number of different func- which combines aspects of all three ASIC? Never fear, the FPGA folks are tions, not their individual complexity). solutions (i.e., ASIC, FPGA, and stan- here. You’ve probably heard the old dard chip) in a unique way. The chip saw about WD-40 and duct tape being MIND THE GAP starts with a hard ARM9 core that is a contractor’s best friend. You know, if With ASICs, FPGAs, and standard exactly the same as the one used in it moves and it shouldn’t, use duct chips to choose from, designers would Atmel’s popular SAM9 MCUs, including tape. If it doesn’t move and it should, use WD-40. Some say that FPGAs a) BDTI-Certified high-capacity optimized results deserve to be added to the list of such 1000 432 “universal remedies.”[3] Peter Alfke related the history of these volkschips at Xilinx. It starts 100 way back in 1985 with founder Ross Maximum BDTI channels Freeman’s revolutionary assertion: (Higher is better) 14 “Transistors are cheap, and getting 10 ever cheaper. Six transistors to emu- 3.5 late a short circuit is reasonable.” 1.8 1.09 The original Xilinx FPGAs had 64 logic 1 Xilinx Freescale picoChip TI TI blocks and might hit 50 MHz with a Virtex-4 FX140 MSC8144 PC102 TMS3206455 TMS3206455 1 2 3 tailwind. But now FPGAs are at the (–11 speed grade) (1 GHz) (160 MHz) (1GHz) (1 GHz) 1. Estimated performance based on related benchmark implementations head of the line-up when it comes to 2. Without using Viterbi coprocessor riding the silicon wave. Not only are 3. Using Viterbi coprocessor they well capable of “ASIC replace- b) BDTI-Certified low-cost optimized results ment,” but the time is coming when 70.0 66.57 they can challenge standard chips as well. For instance, there’s an argu- 60.0

ment to be made that these days the 50.0 48.23 fastest DSP isn’t a DSP at all, it’s an 40.0 FPGA (see Figure 1). $/BDTI Channel (Lower is better) The session finished with Shepard 30.0 Siegel of Mercury Computer Systems giving a designer’s perspective.[4] He 20.0 passed on lessons he’s learned, often 10.0 the hard way, in a long and distin- 6.79 2.75 1.39 guished career. (How many engineers 0.0 Altera Xilinx Freescale picoChip TI do you know with an Oscar on their Stratix II 2S15 Virtex-4 SX25 MSC8144 PC102 TMS320C6410 (–5 speed grade)1 (–10 speed grade)1 (1 GHz)2 (160 MHz) (400 MHz) mantle?) Or as he describes his experi- 1. The definitions of speed grades vary among vendors. Therefore, a –5 speed ence, “One Engineer’s Arc of grade for a Xilinx chip is not necessarily equivalent to a –5 speed grade for an Altera chip. For more information on speed grades, visit the respective vendor web sites. Enlightenment.” 2. Estimated performance based on related benchmark implementations. A particularly useful reminder is to keep things simple when it comes to Figure 1—Independent benchmark analysis (www.bdti.com/products/reports_fpga2006.html) by the DSP experts at Berkeley Design Technology (BDTI) proves that FPGAs can be very effective for signal-processing applications. interfaces. Although Siegel’s talk was The results of this particular benchmark show that FPGAs are (a) much faster (i.e., handle more channels) and (b) mainly about hardware, this is good more cost effective (cost/channel is less) than DSPs. What’s the downside? BDTI notes that there’s significantly advice for software too. In short, there more development effort required to implement the FPGA solution.

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 79 2802003-Cantrell.qxp 1/7/2008 4:57 PM Page 80

CAP ASIC a hit, you can push the metal-mask NRE $150,000 $500,000 button to shrink the two-chip combo Minimum order volume 25,000 Units 500,000 Units into a single CAP with less time and Lead time 12 Weeks 40 Weeks money (not to mention nail-biting) EDA Tool cost Free/low-cost FPGA tools Expensive ASIC toolchain than going the full ASIC route (see Table 1). Table 1—The costs and complexity for ASICs have escalated beyond the reach of most designers. Atmel’s CAP metal-mask programmable SoC is an “ASIC Lite” alternative. A big advantage for CAP is the use of low-cost FPGA As for power consumption, there’s design tools to customize the design. no doubt that the performance-at-any- price-and-power FPGAs are at a disad- flash memory and peripherals. On the special “emulation” versions of the vantage. Six transistors may be cheap ASIC side of the equation, CAPs CAP chips work with an external FPGA. enough to duplicate a wire (i.e., include a complement of metal-mask There’s still a bit of black magic Freeman’s “short-circuit”), but they programmable logic. Although still involved in mapping the Xilinx logic use a heck of a lot more power. Worse, “custom” (i.e., factory programmed), design onto the CAP metal-mask the state-of-the-art processes (65 nm metal-mask programmability cuts the programmable logic. But with hand- headed to 45 nm) that high-end NRE (less masks than an ASIC) and holding from Atmel and their distrib- FPGAs rely on are at the bleeding edge reduces lead time (wafers up to metal- utors (such as Arrow Electronics), of the leakage power crisis. mask can be stockpiled). there is clearly intent to make the Enter with their new Igloo FPGAs enter the CAP equation in transition as painless and as turnkey family, a low-power variation of their an interesting way that recognizes the as possible. flash-based ProASIC parts. Igloo cuts popular design tactic of pairing a stan- CAP is a unique technology, but power consumption thanks to a dard processor chip and an FPGA. A it’s also practical in the bigger lower operating voltage (1.2 V) and true ASIC design requires a very com- scheme of things. You can start with the addition of optimized sleep plicated and expensive suite of “chip a standard SAM9 MCU. When it’s modes. Also, the fab process used is design” tools. By contrast, CAP’s pro- time to upgrade, you can easily proto- less aggressive, and thus less prone to grammable logic is defined using the type (and even go into tentative pro- leakage. Put it all together and Igloo popular, and at this point virtually free, duction) by pairing a CAP emulation is arguably the first truly “low- Xilinx FPGA tools. For prototyping, chip with an FPGA. If the product is power” FPGA (see Figure 2).

80 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 81.qxp 1/4/2008 3:04 PM Page 1

What’s the difference?

Price!

You’re correct, the one on the right costs less because should find a lower print-advertised price for it’s from Jameco! When you’re looking to purchase a product Jameco offers, just let them know and major name brand passives or semiconductors, be they’ll offer that product for 10% less than the other sure to check out Jameco first. They also offer company’s price, right down to Jameco’s cost! money-saving generic equivalents at about Wouldn’t it be worth your time to check out Jameco 20% less, so you’ll save even more! And if you today at www.Jameco.com? • Both Major Name Brands and Generic Products for Additional Savings • Over 99% of Catalog Products are in Stock for Immediate Delivery • Only Jameco Guarantees the Lowest Prices

Click or call today for a FREE Jameco Catalog Visit www.Jameco.com/CCX and start benefiting from Jameco’s Awesome Prices! Call 1-800-831-4242 82.qxp 12/31/2007 12:33 PM Page 1

www.robobusiness.com

Register Early for the Best Savings on a Full Conference Pass

Founding Sponsor The International Business Development Event for the Personal, Service and Mobile Robotics Industry Premier Sponsor April 8-10, 2008 Pittsburgh, PA Gold Sponsors David L. Lawrence Convention Center

Corporate Sponsors Now in its fifth year, RoboBusiness Conference & Exposition is the must-attend event for those interested in the business and technical issues related to the development of the personal, service and mobile robotics industry.The conference brings emerging robotics technology out of the lab and into the open market, focusing on the business of mobile robotics.

RoboBusiness 2008 spotlights industry trends you need to know, like ‘Achieving Autonomy’ and ‘RoboMedicus’, which includes dedicated sessions and exhibition space focused on Healthcare Robotics.

RoboBusiness Conference and Exposition promotes business development and a wide-array of networking opportunities.

Q 30 Conference sessions to build your robotics business Analysts,Associates & Academic Co-Sponsors Q Over 75 exhibiting companies Q Keynotes led by world-renowned industry experts Q Opening night networking reception Q Robot Hall of Fame cocktail reception and induction ceremony Q Robotics tour of Pittsburgh Q And much more!

Media Co-Sponsors

For more information or to register, visit www.robobusiness.com or call 800-305-0634. For sponsorship opportunities, contact Produced by Ellen Cotton at 508-663-1500 x240.

CCadRoboBiz08.indd 1 12/19/07 11:16:42 AM 2802003-Cantrell.qxp 1/7/2008 4:57 PM Page 83

POWER TRIPPING (e.g., data center server farms), it When it comes to the three Ps Flash FPGA now requires just as much power

(price, performance, and power), SRAM FPGA for cooling as it does for the sys-

power has historically been a sec- SRAM Hybrid tems themselves (i.e., each watt of ondary consideration. But today FPGA application power requires an power has become the show-stop- Competitor Calculated with 50% idle additional watt of cooling Antifuse FPGA and 50% at 100-MHz [5] per that’s driving fundamental Low-power operation power). Ouch! change in system design across CPLD Over at ESC, I came across a 0 50 100150 200 250 300 350 400 450 500 the board, from, as one presenta- Battery life (hours) blue-collar answer to the power tion put it, “chip to data center.”[5] crisis that you can buy today. It’s Figure 2—Actel claims their new Igloo family of flash FPGAs is the Indeed, the problem with “Hot first to allow using the words “low power” and “FPGA” in the same the aptly named “LDO Killer” Chips” these days is just that; sentence. from Enpirion (see Photo 2). As they’re too hot, literally. Together the name implies, these parts are with the declining ROI for evermore It’s a fact that GPUs have already virtual drop-in replacements for the baroque architectural trinkets, it passed CPUs in this core count (i.e., typical LDO, but they feature the means the era of the “mainframe-on-a- GPUs contain tens to hundreds of much higher efficiency (up to 95%) of chip” is over. processors) and generic metrics such a switching power supply. Er, not quite yet, according to the as GGLOPS/$ and GFLOP/W. But Integration of the key switcher com- folks at IBM.[6] Their new z6 micro- that’s largely due to the fact that it’s ponents (inductor, MOSFETs, PWM, controller carries forward the “rich easy to find and exploit parallelism in etc.) is the secret because it enables a CISC ISA” of IBM mainframes of yore, graphics (and other media and net- very high operating frequency (4 MHz) legacy code going all the way back to working) applications. that increases efficiency. Putting 1964. This thing could still run that Can we all get along? CPUs won’t everything inside the chip also bubble sort I wrote back in college if I kill GPUs and GPUs won’t kill CPUs. reduces EMI, the traditional downside could just find that old card deck. Rather, according to Hester, the future of switching supplies. Furthermore, But even this true “mainframe-on-a- will find combinations of homoge- design-in is as easy as an LDO because chip” has seen the multi-core light. neous and heterogeneous cores and the only external components required Each billion-transistor z6 actually specialized accelerators blended to are a couple of ceramic caps. comprises four “mainframe(s)-on-a- best serve a particular application. chip.” Multi-core may save the day power- NO STINKIN’ WIRES In “Multi-Core and Beyond: Evolving wise at the high end, but how about a Wireless is a perennial Hot Chips the x86 Architecture,” Phil Hester, for- practical power-saving option for the hot button. This year it was well rep- merly of IBM and now with Advanced little guy? Think about all those lin- resented by the OmniLink60 technol- Micro Devices (AMD), put forth the ear voltage regulators (aka low- ogy from SiBeam. The name of their premise that there will be “no core dropout “LDO” regulators) that popu- presentation pretty much said it all, wars.”[7] What he means is that the cur- late nearly every design. As I write “A 4 Gbps Wireless Uncompressed rent “duo” and “quad” core craze (i.e., this, and as you read it, zillions of 1080p-Capable HD A/V Transceiver symmetric multiprocessing on homo- these little puppies are hard at work Using 60 GHz.”[8] geneous cores) is limited. wasting energy. Blessed by a who’s who of TV Rather, much like the FPGA and For instance, consider the typical heavyweights (e.g., LG, NEC, Panasonic, DSP story, the “best” CPU may turn situation of a 3.3-V regulator powered Samsung, Sony, and Toshiba), the out to be a graphics processing unit by a 6-V wall wart. The efficiency of SiBeam scheme theoretically has the (GPU). After all, the argument goes, such a setup is dismal, barely more wherewithal to challenge other pre- there came a time back in the 1990s than 50% (i.e., 3.3/6 = 55%). Worse, tenders to the living room wireless when “killer micros” did in the “super- the wasted energy is dissipated in the TV throne (see Table 2). TVs using computers,” and now maybe “killer form of heat, just causing more prob- the OmniLink60 scheme would no GPUs” are poised to hoist the micro- lems, notably the need for even more longer need the fancy prone-to-pixe- controllers on their own parallelism power to provide cooling. Indeed, in late MPEG decoder/decompression petard. the most power-dense applications hardware currently required.

Total spectral availability Max permitted transmit power (EIRP) Max data rate bps/Hz Required to get to 4 Gbps Worldwide (11 a/g = 2.7) availability Wireless HD 7 GHz 8,000 mW (39 dBm) 4,000 Mbps (approximate) 1.6 bps/Hz with 2.5-GHz channel Ye s 802.11 n 0.67 GHz 160 – 3,200 mW (22 – 35 dBm) 600 Mbps 100 bps/Hz with 40-MHz channel Ye s UWB 1.5 – 7.5 GHz* 0.1 mW (–10 dBm) 480 Mbps 8 bps/Hz with 520-MHz channel No *Depending on geography

Table 2—Wireless TV hasn’t made it to the showroom yet, but competing alternatives are positioning themselves for when it does.

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 83 2802003-Cantrell.qxp 1/7/2008 4:57 PM Page 84

Needless to say, there is on top of it. Examples of plenty of black magic this approach that I’ve cov- involved to get this work- ered before include the ing, all the more so consid- Microchip Technology ering SiBeam manages to MiWi (“Be All You Can do it with regular CMOS. Bee,” Circuit Cellar 202, In particular, they have fig- 2007) and IETF 6LowPAN ured out a way to integrate (“I Sense, Therefore I Am,” a “real-time beam-steer- Circuit Cellar 207, 2007) ing” array of millimeter- protocols. scale antennas that A similar phenomenon is achieves the high band- taking place with Bluetooth, width required, even in Photo 2—Honey, I shrunk the switcher. By integrating all the key components on-chip, where a new Wibree proto- this Enpirion “LDO Killer” aspires to deliver the high efficiency of a switching power non-line-of-sight situa- supply with the low cost, small size, and ease of use of a linear regulator. col is being proposed. The tions. idea behind Wibree is to Over at the other end of take advantage of compati- the spectrum, literally, the embedded reflecting an understandable migra- bility with Bluetooth radios for simple wireless craze continues apace. ZigBee tion of application aspirations to big- sensor applications by trimming the fat gets the most headlines with the long- ger and better things (i.e., large-scale (i.e., protocol complexity) and the awaited release of the “final” ZigBee wireless sensor networks with hun- power consumption. PRO spec (see Table 3). If you’ll allow dreds or thousands of nodes). On the Over at ESC, Texas Instruments me to massacre some metaphors, other hand, with wireless, it’s always was showing off their latest MSP430- ZigBee may be the elephant in the the more the merrier, and ZigBee fea- based USB development and demo tent, but sometimes I think it’s more ture creep leaves the door open for gadget. The eZ430-RF2500 includes a like a clowder of cats. new low-end alternatives. 2.4-GHz radio running a TI proprietary ZigBee has feature-creeped far One popular approach is to use the wireless network protocol they call beyond its humble “home RF” begin- same IEEE 802.15.4 radio as ZigBee, SimpliciTI (see Photo 3). The press nings. That’s not necessarily bad, but running a different protocol stack materials say SimpliciTI targets small

84 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 2802003-Cantrell.qxp 1/7/2008 4:57 PM Page 85

(i.e., tens of nodes) and simple the conference proceedings, (i.e., non-mesh) networks. PR and the few notes I took are, claims are one thing, but I er, shall we say cryptic (…good always say the proof is in the wine). But here’s the gist of it. program. SimpliciTI lives up to As CMOS gets harder, alter- its name by fitting in just 8 KB natives like optical automati- of flash memory and 1 KB of cally become more viable. I SRAM. imagine a “screen” of the future powered by a flat panel ONE STEP BEYOND of semiconductor lasers at the The Monday evening panel back. The light goes in, rattles sessions are always a highlight around, and out the front of the Hot Chips conference. comes our visual eye candy. You might think that after sit- It’s light-in and light-out with ting through two full days of nary a transistor or electron in intensive briefings with a third between. ahead, folks would want to Sounds good, but what about give it a rest. But good food the disk drive, network con- (and good wine…) hath charms nection, and so on. As was Photo 3—The TI eZ430-RF2500 development tool represents a new low in to soothe the savage engi- wireless sensor design: low cost, low power, and low complexity. pointed out, a nice thing about neer—and encourage him to photons is that they don’t stick around. interact—which is also the This time the subject was “What’s The panel had a line-up of luminar- problem (i.e., a big challenge for opti- Next Beyond CMOS?” We’re talking ies from HP, IBM, Intel, the University cal will be connecting it to the elec- about that doomsday scenario known of California, Berkeley, and Stanford. tronic ones-and-zeros world). as “The Wall” (i.e., the end of Moore’s Unfortunately, I can’t recall exactly The quantum computing idea of Law as we know it, due to the physi- who said exactly what. The slides for using single electrons as processing cal limits of scaling). the panel session didn’t make it into elements seems like science fiction.

Save Up To 60% On Electronic Components

Exciting New Mini-Boards Wide Range Including, • Real Time Clocks (DS1307) • Memory Cards ONLY • Power Supplies $6.90 • DC Motor, Stepper Motor and More

Powerful New ATMega Controller • Includes ATMega128 Microcontroller • High-Speed Operation • Heaps of I/O • In-Circuit Programming ONLY $28.90 • Ideal Embedded Controller

Save Heaps on Components We carry a wide range of Integrated Circuits, Microcon- ONLY trollers, Capacitors, LED's $4.90 and LCD's. All at very competitive prices. We are your one-stop shop for Microcontroller Boards, PCB Manufacture and Electronic Components. www.futurlec.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 85 2802003-Cantrell.qxp 1/7/2008 4:57 PM Page 86

Feature ZigBee feature set ZigBee PRO feature set [4] S. Siegel, “Exploiting Processor Network scalability Hundreds of devices Thousands of devices Heterogeneity Through Fragmentation Optional Standard Reconfigurable Interactions,” Hot Frequency agility Optional Standard Chips 19, 2007. Channel selection Standard Standard [5] C. Patel and P. Raganathan, Automated device address mgmt. Standard Optimized “Enterprise Power and Cooling: A Group addressing Standard Optimized Chip-to-Data Center Perspective,” Wireless commissioning Standard Optimized Hot Chips 19, 2007. Centralized data collection Standard Optimized [6] C. Webb, “The Next Generation Device maintenance & network recovery Standard Standard Mainframe Microprocessor,” Hot Group broadcasts Standard Standard Chips 19, 2007. Compatibility ZigBee and ZigBee PRO ZigBee and ZigBee PRO AES128 encryption and authentication Standard Standard [7] P. Hester, “Multicore and Beyond: IEEE 802.15.4 physical radio Standard Standard Evolving the x86 Architecture,” Global 2.4 GHz, 915 MHz, 868 MHz Standard Standard Hot Chips 19, 2007. Single-hop extended range (100s M) Standard Standard [8] J. Gilbert, “A 4 Gbps Wireless Reliable self-healing mesh network Standard Standard Uncompressed 1080p-Capable HD Ultra low-power, long battery life Standard Standard A/V Transciever Using 60 GHz,” Low cost Standard Standard Hot Chips 19, 2007. Network traffic load Average Increased [9] L. Vandersypen “Dot-to-Dot Table 3—The release of the latest ZigBee spec has implications across the wireless spectrum. ZigBee now sup- Design,” IEEE Spectrum, Sept. 2007. ports very large and sophisticated wireless networks, which leaves the door open for low-end wireless alternatives. RESOURCES Hey, even Einstein said this stuff is breakthrough that sparked revolu- “spooky,” and that’s good enough for tionary new ways of building things. Berkeley Design Technology, Inc., me. But in reality, it is science fiction Sound familiar? Steel was very hot www.bdti.com. that is science fact and actually work- then, as hot as silicon is now, but I Computer History Museum, ing in research labs.[9] The good news imagine today that a “Hot Steel” Mountain View, CA, www.computer is that quantum computing offers the conference is a rather staid affair. history.org. promise of performing certain tasks Maybe in 20 (or 50, or 100) years way faster than electronics. The bad “Hot Chips” will be too. I’m person- Hot Chips 19, Memorial Auditorium, news, at least so far, is that the “cer- ally not too worried because I figure Stanford University, Aug. 19 to 21, tain tasks” are limited to niche, albeit silicon will be around long after I’m 2007, www.hotchips.org. some notable, applications. For exam- gone. Today, all that matters is that Wibree embedded wireless standard, ple, quantum computers are really the Hot Chips are as hot as ever, and www.wibree.com. good at factoring prime numbers, a that’s good enough for me. I fact that gets the attention of the secu- ZigBee embedded wireless standard, www.zigbee.org. rity/encryption crowd. Tom Cantrell has been working on I do recall it was the Intel panelist chip, board, and systems design and who took the position that what’s marketing for several years. You may SOURCES beyond CMOS is—ta-da—more reach him by e-mail at Igloo Low-power flash FPGAs CMOS. The “What, me worry?” argu- [email protected]. Actel Corp. ment is bolstered by the fact that, as www.actel.com Mark Twain might have put it, “Reports of the demise of silicon have REFERENCES AT91CAP Programmable SoC micro- been greatly exaggerated—many [1] D. Witt, “ASICs to ASSPs For controller times.” Even Gordon Moore has said Working Engineers (Building the Atmel Corp. he no longer tries to predict a “wall,” OMAP 3430),” Hot Chips 19, 2007. www.atmel.com because every time he does, engineer- [2] P. Alfke, “20 Years of FPGA EN5322QI Integrated switching power ing creativity and entrepreneurial spir- Evolution: From Glue Logic To supply it knock it down. Systems Components,” Hot Chips Enpirion, Inc. As the final panelist noted, it was 19, 2007. www.enpirion.com only 100 years ago that buildings, tunnels, bridges, and more were all [3] K. Morris “Duct Tape, WD-40, eZ430-RF2500 Wireless development built out of wood or stacked FPGAs: The Universal Survival tool and SimpliciTI network protocol bricks/rocks. Then came the use of Kit,” FPGA and Structured ASIC Texas Instruments, Inc. structural steel for construction, a Journal, July 3, 2007. www.ti.com

86 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com ib-211.qxp 1/7/2008 4:51 PM Page 87 IDEA BOX THE DIRECTORY OF PRODUCTS AND SERVICES

AD FORMAT: Advertisers must furnish digital submission sheet and digital files that meet the specifications on the digital submission sheet. ALL TEXT AND OTHER ELEMENTS MUST FIT WITHIN A 2" x 3" FORMAT. Call for current rate and deadline information. Send your disk and digital submission sheet to: IDEA BOX, Circuit Cellar, 4 Park Street, Vernon, CT 06066 or e-mail [email protected]. For more information call Shannon Barraclough at (860) 875-2199.

The Suppliers Directory at www.circuitcellar.com/suppliers_dir/ is your guide to a variety of engineering products and services.

UUSSBB phyCORE® OEMable Single Board Computers Add USB to your next XScale: PXA270, PXA255

project—it’s easier than you ARM: LPC3180 (ARM9); LPC22xx, LPC229x, AT91 (ARM7)

might think! PowerPC: MPC5554, MPC5200B, MPC565, MPC555 v USB-FIFO up to 8 mbps ColdFire: MCF5485 x86: Elan SC520 CAN v USB-UART up to 3 mbps C166/XC16x/ST10/8051 v USB/Microcontroller boards Blackfin: BF537 Faster-to-Market: Save time by pre-programmed with firmware integrating a PHYTEC Single Board Computer Module into v 2.4GHz ZigBee™ & 802.15.4 your target circuitry. Make -or - Buy: Why make v RFID Reader/Writer your own when you can buy PHYTEC off-shelf solutions, Absolutely NO driver software cost-effective to 1000s units/year? Integrated Support Services: Let PHYTEC assist you in the design of your end product: from tools and RTOSes to production. Our hardware is development required! bundled with leading compilers (Keil, IAR, CodeWarrior), RTOSes (WinCE, Linux) and debuggers. Immediate Support: Talk to PHYTEC technical staff with every call. No www.dlpdesign.com waiting for answers. Your OEM solution: With 20 years design, production, and integration experience, PHYTEC is your OEM partner.

PHYTEC America, LLC I 203 Parfitt Way SW, G100 I Bainbridge Island, WA 98110 USA www.phytec.com I (800) 278-9913 I www.phycore.com

® ARM® 8051 COLDFIRE®

ARE Three quality tool suites q C/C++* q Code Wizards q Debugging q Simulation q Support * Embedded C++ for ARM and ColdFire only Advanced software tools since 1984 www.crossware.com Tools for Embedded Development Tools CROSSW 360-812-2397

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 87 ib-211.qxp 1/7/2008 4:51 PM Page 88

MEASUREMENT SCIENCE 2008 CONFERENCE MEASURE for SUCCESS March 10-14, 2008 Disneyland Hotel Anaheim, California

EXCELLENT training opportunities MORE than 100 Exhibit Booths (Wed-Fri) NETWORK with experts from government, industry, academia Register today! (866) 672-6327 www.msc-conf.com

88 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com ib-211.qxp 1/7/2008 4:51 PM Page 89

Outsource Your Next Design To Ohio! Product Line Strategy Consulting Circuit Design and PCB Layout Electromechanical Algorithm Development Analog Design Wireless Simulation Embedded Software Rapid Prototype We specialize in designing with Microchip products

O’Keefe Electronics Inc. www.okeefe-electronics.com O’Keefe Electronics Inc. 440 647 5193

Introduces Capacitive Load Sensors with True USB connectivity

Integrated signal conditioning Digital USB or Analog 0-5 V output Accuracies - 0.25% to 0.025% of FS Rugged stainless steel construction Temperature compensated Easy mounting features built in

www.loadstarsensors.com 650.938.4282 | [email protected]

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 89 ib-211.qxp 1/8/2008 10:00 AM Page 90

High-speed USB 2.0 + Xilinx FPGA Complete Software API

75mm x 50mm 3.5“ x 2.0” $399.95 $199.95 XEM3010-1500P: XEM3001: Š 1,500,000-gate FPGA Š 400,000-gate FPGA Š Programmable PLL Š Programmable PLL Š Over 110 I/Os Š Over 80 I/Os Š 32 MB SDRAM Š 0.1” expansion headers Š Configuration PROM Š Business-card size Š 0.8-mm expansion Š $199.95 / Qty 1 Š $399.95 / Qty 1 Š $174.95 / Qty 10 Š $349.95 / Qty 10 FrontPanel Software API: Š Windows XP, Mac OS X, Linux Š C/C++, Python, Java Š Configure FPGA and communicate with your design Š The easiest way to integrate USB into your product Š Use for image capture, control, test equipment, etc. Š Up to 38 MB/s transfer rate! 5% off with Coupon Code: CKTCLR73*

* Valid for first order only. Void 30-days after issue publication.

Visit us online at: Opal Kelly www.opalkelly.com

90 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com ib-211.qxp 1/7/2008 4:52 PM Page 91

Low Cost CAN USB Adapter

Simple configuration & use

$99.95 Qty 1 ANYONE Can Now Easily Hand Solder Surface- Mount Components! +1 630-245-1445 Even A 10 Naperville, Illinois USA www.c-a-n.com Year Old! www.schmartboard.com

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 91 ib-211.qxp 1/11/2008 9:59 AM Page 92

Order online at: Phone: (719) 520-5323 microEngineering Labs, Inc. Fax: (719) 520-1867 www.melabs.com ® Box 60039 Development Tools for PIC Microcontrollers Colorado Springs, CO 80960

® USB Programmer $89.95 LAB-X Experimenter Boards BASIC Compilers for PICmicro for PIC® MCUs (as shown) Pre-Assembled Boards Easy-To-Use BASIC Commands Available for 8, 14, 18, 28, Windows 9x/Me/2K/XP Interface RoHS and 40-pin PIC® MCUs PICBASIC™ Compiler $99.95 Compliant 2-line, 20-char LCD Module BASIC Stamp 1 Compatible Programs 9-pin Serial Port Supports most 14-bit Core PICs PIC MCUs Sample Programs Built-In Serial Comm Commands including Full Schematic Diagram low-voltage PICBASIC PRO™ Compiler $249.95 (3.3V) devices Pricing from $79.95 to $349.95 Supports Microchip PIC10, PIC12, PIC14, PIC16, PIC17, and PIC18 microcontrollers Includes ™ Direct Access to Internal Registers Windows PICPROTO Prototyping Boards Supports In-Line Assembly Language 98, Me, NT, With Accessories for $119.95: Interrupts in PICBASIC and Assembly 2K, and XP Includes Programmer, Software, USB Cable, Double-Sided with Plate-Thru Holes Built-In USB, I2C, RS-232 and More Software and Programming Adapter for 8 to 40-pin DIP. Circuitry for Power Supply and Clock Source Level Debugging Large Prototype Area Parallel Port Programmer Boards Available for Most PIC® MCUs See our full range of products, including starting at $59.95 Documentation and Schematic books, accessories, and components at: Serial Port Programmer Pricing from $8.95 to $19.95 www.melabs.com EPIC™ starting at $79.95

92 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com crossword2.qxp 1/7/2008 4:47 PM Page 93

CROSSWORD

1

23 4

5 6

7

8

9 10

11

12

13 14 15

16 17

18

Down 1. The practice of limiting the number of digits to the Across right of a decimal point 4. A Windows program that gives users simple options for 2. The British mathematician (1786–1837) who described what would be a complex task and performs them auto- an algorithm for evaluating polynomials in a monomial matically way 5. What the Pythagorean theorem is called in China 3. A space telescope orbiting the Earth 7. The process of using a straightforward system to start a 6. The act of playing video or audio on your computer more complicated system that does the same thing while you are downloading it 11. A standard for high-speed data transfer 8. A type of communication, often over radio waves, that 12. A computer dedicated to gaming is not hard-wired 14. The global navigation system that determines locations 9. A deterrent designed to protect your design from illegal with satellites copying. It is an undocumented response to a pro- 15. A receiver/transmitter that translates data between grammed sequence of events to test if the design is an serial and parallel authorized copy. 16. A program used to perform calculations and display 10. A “spot” in a wireless network with effective Internet information in rows and columns connectivity 18. A device that combines two transistors to give a high 12. The shape a chain forms when it is hanging from two current gain supports under its own weight 13. An Internet address 17. Do it yourself The answers are available at www.circuitcellar.com/crossword.

www.circuitcellar.com CIRCUIT CELLAR® Issue 211 February 2008 93 94-advertiser's index.qxp 1/9/2008 11:16 AM Page 94

INDEX OF ADVERTISERS The Index of Advertisers with links to their web sites is located at www.circuitcellar.com under the current issue.

Page Page Page Page 91 AAG Electronica, LLC 10 ezPCB 29 Linx Technologies 27, 50 Rabbit, A Digi International Brand

29 AP Circuits 87 FDI-Future Designs, Inc. 89 Loadstar Sensors, Inc. 88 Rabbit, A Digi International Brand

51 ASIX 90 FlexiPanel Ltd. 15 Luminary Micro 89 Reach Technology, Inc.

56 Ad Hoc Electronics 87 FlyPCB China Co., Ltd. 89 MCC (Micro Computer Control) 39 Renesas Technology

91 All Electronics Corp. 85 Futurlec 88 MSC 82 RoboBusiness 2008

88 Apex Embedded Systems 8 Geist Technology 90, 91 Micro Digital, Inc. 48, 49 Saelig Co.

7 Atmel 85, 91 Grid Connect 92 Micro Digital, Inc. 64 Saelig Co.

17 Bitscope Designs 89 Hagstrom Electronics 19 Microchip 91 Schmartboard

95 CTIA Wireless 89 HI-TECH Software LLC 92 microEngineering Labs, Inc. 9 SEGGER Microcontroller Systems LLC

65 CWAV 42 HobbyLab LLC 57 Mouser Electronics 90 Systronix

58 CadSoft Computer, Inc. 88 IMET 88 Mylydia, Inc. C3 Tech Tools

41 Comfile Technology, Inc. 80 IPC (Printed Circuit Expo) C2 NetBurner 92 Technical Solutions Inc.

87 Crossware Products, Inc. 88 IMAGEcraft 5 NetMedia, Inc. 2, 3 Technologic Systems

92 Custom Computer Services, Inc. 63 Intronix Test Instruments, Inc. 59 Nurve Networks LLC 90 Technological Arts

1 Cypress MicroSystems, Inc. 91 Intec Automation, Inc. 89 O’Keefe Electronics Inc. 89 Tern, Inc.

87 DLP Design 90 Ironwood Electronics 90 Opal Kelly Inc. 25 Tibbo Technology, Inc.

51 DMM Technology Corp. 64, 91 JKmicrosystems, Inc. 33 PCB-Pool 92 Trace Systems, Inc.

42 Decade Engineering 81 Jameco C4 Parallax, Inc. 90 Triangle Research Int’l, Inc.

50 DesignCon 59 Jeffrey Kerr, LLC 87 Phytec America LLC 73 Trinity College Robot Contest

88 Designnotes 55 Keil Software 11 Pico Technology Ltd USA 8 WCSC (Willies Computer Software Co.)

84 EMAC, Inc. 59 Lakeview Research 90 Pioneer Hill Software 40 Wiznet

89 Earth Computer Technologies 88 Lawicel AB 21 Pololu Corp. 90 Zanthic Technologies, Inc.

47 ExpressPCB 10 Lemos International 91 Pulsar, Inc.

Preview of March Issue 212 ATTENTION ADVERTISERS Theme: Robotics April Issue 213 Robotics Made Easy: A Peripheral Chip for Low-Level Functions Deadlines Robotics with Ada95 Space Close: Feb. 12 Motor-Controlled Vertical Plotter System Material Close: Feb. 20 Do-It-Yourself Motion Controller (Part 1): Get Started with a Simple App Theme: Video Stamp: A Video Display for Debugging Programs Embedded Programming Embedded Linux Development (Part 1): A Virtual Linux Environment on a Windows System BONUS DISTRIBUTION: Multiplication and Division Techniques for MCUs ESC West, RoboBusiness

Call Shannon Barraclough LESSONS FROM THE TRENCHES Do You Want to Do a Design?: Linked Lists now to reserve your space! FROM THE BENCH Navigating the Heavens 860.875.2199 SILICON UPDATE More Bits, Less Filling e-mail: [email protected]

94 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com 95.qxp 1/2/2008 1:51 PM Page 1

The most important global technology event of the year!

Unorthodox.

CTIA WIRELESS 2008 The convergence of more than 1,100 exhibiting companies, dozens of industries and over 40,000 professionals from 125 countries all working toward the common goal of revolutionizing wireless. Whether in broadband convergence, enterprise, advertising, social networking or entertainment– CTIA WIRELESS 2008 is the global marketplace connecting wireless and you.

April 1-3, 2008 Las Vegas Convention Center Las Vegas, NV, USA www.ctia.org/ctiawireless 211_steve_edit.qxp 1/7/2008 4:32 PM Page 96

PRIORITY INTERRUPT

by Steve Ciarcia, Founder and Editorial Director Avoiding Stereotypes

I really hate being stereotyped, but I guess it goes with the territory. Last week, I was having coffee at Barnes & Noble when I noticed the guy at the table next to me was reading Circuit Cellar. Perhaps he was reading my editorial and saw my picture, but he recognized me and we struck up a conver- sation about technology and gadgets. It wasn’t long before he felt it was time to take my picture and started emptying his pockets looking for the right device. The first thing he pulled out was a BlackBerry, then came an iPod, and finally came an iPhone and their associated earpieces and wires. As he snapped my picture, he explained how he couldn’t live without his mobile media and that multitasking was his life—like text-messaging on the BlackBerry while listening to music on the iPod and watching a video or talking on the iPhone at the same time. Certainly, being the high-tech guy that I am, I must be doing all that and more. The problem with being the Editorial Director of a high-tech magazine is that it gives people the impression that I live and breathe high tech. Well, yes and no.Yes, I own lots of the latest gadgets, and Gizmodo and Engadget are among my favorite Internet stops, but I guess I’ve passed the part of my life where I want intravenous communications along with all these doohickeys. I silently chuckled as this guy described how he constantly e-mails, phones, and texts friends and associates all day long. I didn’t have the heart to tell him that I dislike “instant communication” so much that I turned off my voicemail. Don’t get me wrong. I’m still a confirmed gadget junkie.You already know I like fast cars with lots of features. I couldn’t live without my ultrasonic back- up “radar” screen (’cause I tend to back into things), GPS, and my 13-speaker sound system and satellite radio, but there is a limit to how many features I’m willing to take the trouble to use. I suppose it confirms my eccentricity, but I pay $200 a year for an integrated-cellular GPS-based roadside-assis- tance call system (like OnStar), but have never mated my cell phone to the car’s hands-free Bluetooth because I can’t be bothered. I’m always among the first to experience new technology (like home control, web cams, LED lighting, HDTV, etc.), but it has its downside. I bought a Motorola RAZR phone the day it was introduced by Verizon (about $600 back when) and it drove me nuts.There was no way I could extract the phone from my pocket or belt holder without accidentally pushing buttons and reprogramming the phone settings. More than a few times I felt like driving the car over it. Today, I have the latest-generation RAZR with a camera I’ve never used, a built-in MP3 player with nothing in it, and an empty contact list. If I could find a truly dumb phone that only made telephone calls and wasn’t trying to be a palm-sized Cray computer with a built-in multi-media entertain- ment center, that’s the one I’d want. OK, I’m a curmudgeon, but whatever happened to “keep it simple, stupid” in the use of all this technology. It seems like the longer a device is in exis- tence the more complicated each iterative enhancement becomes—kind of like Microsoft bloatware. Turning a cell phone into a handheld multi-media center makes sense only if you can remember the directions for using it. It’s fine if you eat, sleep, and shower with your iPhone, iPod, and BlackBerry. Odds are if you use them that much you’ll remember all their programs and features. However, if you have 30 or 40 of these high-tech gadgets like I do, it is almost impossible to remember 100% of their embedded functions without having the instructions etched on the back of every one. Remote controls are a perfect example. Ed Nisley and I are credited with inventing the universal programmable remote control, but I don’t use one. Every commercial programmable remote control these days has 500 buttons and a million permutations to accommodate all the conceivable electron- ic appliances. Of course, none of them have everything you need. When I had to start remembering that the XM radio was now DVD2 because the DirecTV was already programmed as “Satellite” and “Jump” really meant “Exit” because there wasn’t any real button for it, that’s when I tossed it. Arrgh! Yeah, I know I could get a new controller with an LCD and programmable button logos, but at some point, the pile of just plain dumb remotes next to the easy chair makes more sense to me than spending a week programming the latest and greatest (and I better never lose the manual). Besides, misplace that remote and you are dead in the water. I guess at this point in my life I don’t like dealing with complicated directions. My idea of useful technology is something that is intuitive.You pick it up and making it work is obvious or requires nothing more than a bit of non-catastrophic trial and error.Yes, I realize it means that I am probably using only 25% of the embedded features of most devices I own, but at least if I put it down, I can pick it up again and use it without a whole reeducation program. And, yes, many of you use a single device while I need to buy four or five times as many thingamabobs to enjoy the same activities. I guess owning five times as many gadgets as we need is a cross many of us gadget junkies just have to bear.

[email protected]

96 Issue 211 February 2008 CIRCUIT CELLAR® www.circuitcellar.com C3.qxp 3/30/2007 1:38 PM Page 1 C4.qxp 12/31/2007 12:15 PM Page 1 DC08_CircuitCell.qxd 1/18/08 11:10 AM Page 1

Connecting the World of Electronic Design

Conference Exhibition February 4–7, 2008 February 5–6, 2008 Santa Clara Convention Center | Santa Clara, California

DesignCon is the premier educational forum and technology exhibition for engineers and allied professionals from all levels and disciplines. If you desire to stay abreast of the most current information regarding design engineering theories, techniques, and practical strategies, this event is for you.

• 130 exhibiting companies • 10 half-day tutorials • Keynotes and plenary panel • Nearly 100 technical papers • 8 technical panels • Business Forum

CHAIRPERSON Terry Morris Fellow, High Performance Systems Division Hewlett-Packard

OFFICIAL HOST SPONSOR

International Engineering Consortium www.iec.org designcon.com

Gain unlimited access to the DesignCon technology Free Exhibits PLUS Pass! exhibition and other complimentary educational programming when registering at designcon.com/2008/register/vip_exhibits_reg.html