SIGNALsolutions - simpson.net.au
Transcription
SIGNALsolutions - simpson.net.au
CIRCUIT CELLAR | ISSUE 291 | OCTOBER 2014 SIGNAL PROCESSING OCTOBER 2014 ISSUE 291 circuitcellar.com SIGNAL solutions ..... ..... plan & construct a real-time wireless laser tag system ..... long-distance wireless radio control ..... tips for selecting & caring for RF connectors ..... embedded audio & signal recognition ..... Solar Power Revisited | Q&A: Design & EE Outreach BlasterWorks Project circuitcellar.com | LMR Wireless Control | AC Monitor | ComputerScope Test Instrument Capacitors 101 | Build a Linux System | Tips for Working with RF Connectors | Embedded Voice Recognition The Future for TXCOs MIXED SIGNAL OSCILLOSCOPES 4 ANALOG + 16 DIGITAL CHANNELS RAPIDLY DEBUG COMPLEX MIXED SIGNAL DESIGNS • USB 3.0 • ULTRA DEEP MEMORY • SEGMENTED MEMORY RAPID • RA R PID TRIGGERS INCLUDES AUTOMATIC MEASUREMENTS, SPECTRUM ANALYZER, SDK, ADVANCED TRIGGERS, COLOR PERSISTENCE, SERIAL DECODING (CAN, LIN, RS232, I²C, I²S, FLEXRAY, SPI), MASKS, MATH CHANNELS, ALL AS STANDARD, WITH FREE UPDATES . 5 YEAR WARRANTY 3204D MSO Channels 3205D MSO 3206D MSO 3404D MSO 2 analog, 16 digital 3405D MSO 3406D MSO 4 analog, 16 digital Bandwidth 60 MHz 100 MHz 200 MHz 60 MHz 100 MHz 200 MHz Buffer memory 128 MS 256 MS 512 MS 128 MS 256 MS 512 MS Max. sampling rate Signal generator Digital inputs 1 GS/s Function generator + Arbitrary waveform generator 100 MHz max. frequency, 500 MS/s max. sampling rate www.picotech.com/pco527 2 CIRCUIT CELLAR • OCTOBER 2014 #291 EDITOR’S LETTER Issue 291 October 2014 | ISSN 1528-0608 CIRCUIT CELLAR® (ISSN 1528-0608) is published monthly by: Circuit Cellar, Inc. 111 Founders Plaza, Suite 300 East Hartford, CT 06108 Periodical rates paid at East Hartford, CT, and additional offices. One-year (12 issues) subscription rate US and possessions $50, Canada $65, Foreign/ ROW $75. All subscription orders payable in US funds only via Visa, MasterCard, international postal money order, or check drawn on US bank. SUBSCRIPTIONS Circuit Cellar, P.O. Box 462256, Escondido, CA 92046 E-mail: [email protected] Phone: 800.269.6301 Internet: circuitcellar.com Address Changes/Problems: [email protected] Postmaster: Send address changes to Circuit Cellar, P.O. Box 462256, Escondido, CA 92046 ADVERTISING Strategic Media Marketing, Inc. 2 Main Street, Gloucester, MA 01930 USA Phone: 978.281.7708 Fax: 978.281.7706 E-mail: [email protected] Advertising rates and terms available on request. New Products: New Products, Circuit Cellar, 111 Founders Plaza, Suite 300 East Hartford, CT 06108, E-mail: [email protected] HEAD OFFICE Circuit Cellar, Inc. 111 Founders Plaza, Suite 300 East Hartford, CT 06108 Phone: 860.289.0800 COVER PHOTOGRAPHY Chris Rakoczy, www.rakoczyphoto.com COPYRIGHT NOTICE Entire contents copyright © 2014 by Circuit Cellar, Inc. All rights reserved. Circuit Cellar is a registered trademark of Circuit Cellar, Inc. Reproduction of this publication in whole or in part without written consent from Circuit Cellar, Inc. is prohibited. ELECTRICAL ENGINEERING MASH-UP This issue is an electrical engineering content mash-up comprising new technologies, revisited technologies, and even recent spins on old engineering concepts and projects. We revisit a classic solar power installation. We present a modern take on laser gun gaming, which first became popular in the 1980s. We highlight new uses for wireless mobile radio, which has been used for years by public service providers such as police departments and emergency medical teams. And much more. Let’s go over the specifics. I’m excited to announce that we’re re-releasing Circuit Cellar founder Steve Ciaria’s three-part series, “Solar-Powering the Circuit Cellar.” Turn to page 6 for an excerpt from the first article in the series. You can download the entire series for free for a limited time at http://bit.ly/1tHMOQW. Starting on page 8 is an interview with Bill Porter, a Navy engineer who runs a technical outreach program in his spare time. We’re sure you’ll be amazed by the ways in which he incorporated engineering in his wedding ceremony. If you’re interested in laser technology, check out Max Rothstein and Richard Speranza’s article about their BlasterWorks project (p. 18). They designed a laser tag system that uses real lasers. Working on a wireless control application? If so, check out long-time Circuit Cellar author Ken Merk’s article on Land Mobile Radio (LMR, p. 30). He explains how to build a wireless interface with eight output arrays and eight digital inputs. If you need a simple way to determine voltage values, check out the circuit Larry Cicchinelli presents on page 40. With the circuit and a 10-segment LED display, he can quickly tell if voltage is high, nominal, or low. On page 44 George Novacek presents another handy review of an essential electrical engineering topic: capacitance. He presents common capacitor types and explains basic capacitance-related equations. Like Novacek, Bob Japenga presents a short review of an essential topic: embedded Linux (p. 48). This month he offers tips for building your Linux system. Turn to page 52 for a special feature from our friend and colleague, Jan Buiting. In this “retronics” article, he reviews how a young engineer built an oscilloscope add-on for a PC. How do you select the right RF connectors for a project? How do you keep your delicate connectors in proper working order? On page 58 Robert Lacoste explains how to properly select and care for your RF connectors. On page 64 Jeff Bachiochi begins a series on embedded voice recognition. This month he introduces the topic and covers the basics. Engineer John Esterline wraps up the issue with his thoughts on the future of temperature-compensated crystal oscillators. Visit our social pages to share your thoughts on TCXOs. C. J. Abate [email protected] DISCLAIMER 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 reader-assembled projects, Circuit Cellar® disclaims any responsibility for the safe and proper function of readerassembled projects based upon or from plans, descriptions, or information published by Circuit Cellar®. The information provided by Circuit Cellar® is for educational purposes. Circuit Cellar® makes no claims or warrants that readers have a right to build things based upon these ideas under patent or other relevant intellectual property law in their jurisdiction, or that readers have a right to construct or operate any of the devices described herein under the relevant patent or other intellectual property law of the reader’s jurisdiction. The reader assumes any risk of infringement liability for constructing or operating such devices. © Circuit Cellar 2014 Printed in the United States THE TEAM EDITOR-IN-CHIEF C. J. Abate ART DIRECTOR KC Prescott ADVERTISING COORDINATOR Kim Hopkins PRESIDENT Hugo Van haecke COLUMNISTS Jeff Bachiochi (From the Bench), Ayse K. Coskun (Green Computing), Bob FOUNDER Japenga (Embedded Steve Ciarcia in Thin Slices), Robert PROJECT EDITORS Lacoste (The Darker Chris Coulston, Ken Davidson, and David Tweed Side), Ed Nisley (Above the Ground Plance), George Novacek (The Consummate Engineer), and Colin O’Flynn (Programmable Logic in Practice) CUSTOMER SERVICE Debbie Lavoie circuitcellar.com US/UK Don Akkermans +31 46 4389444 [email protected] OUR NETWORK ELEKTOR LABS Wisse Hettinga +31 46 4389428 [email protected] GERMANY Ferdinand te Walvaart +49 241 88 909-17 [email protected] FRANCE Denis Meyer +31 46 4389435 [email protected] NETHERLANDS SUPPORTING COMPANIES 2015 International CES 33 Ironwood Electronics 78 Harry Baggen +31 46 4389429 [email protected] Accutrace7 Lauterbach55 SPAIN All Electronics Corp. 78 Lemos International Co., Inc. 79 ARM TechCon 2014 21 MaxBotix, Inc. 79 CadSoft Computer GmbH 25 microEngineering Labs 79 Custom Computer Services 78 Micro Digital, Inc. 35 Eduardo Corral +34 91 101 93 95 [email protected] ITALY Maurizio del Corso +39 2.66504755 [email protected] SWEDEN Wisse Hettinga +31 46 4389428 [email protected] Elektor 28, 29 MyRO Electronic Control Devices, Inc. 78 Elektor 56, 57 NetBurner, Inc. C2 Elektor71 Pico Technology 1 João Martins +31 46 4389444 [email protected] Elektor R.E. Smith, Inc. 43 INDIA Elprotronic, Inc. 39 Reach Technology, Inc. 78 EMAC, Inc. 39 RoboBusiness Conference 47 ExpressPCB23 Saelig Co., Inc. 43 Humandata, Ltd. 78 Technologic Systems Zeynep Köksal +90 532 277 48 26 [email protected] IAR Systems 11 Triangle Research International, Inc. SOUTH AFRICA Imagineering, Inc. C4 BRAZIL João Martins +31 46 4389444 [email protected] PORTUGAL Sunil D. Malekar +91 9833168815 [email protected] RUSSIA Nataliya Melnikova +7 965 395 33 36 [email protected] TURKEY Johan Dijk +31 6 1589 4245 [email protected] CHINA Cees Baay +86 21 6445 2811 [email protected] 76, 77 15, 37 79 NOT A SUPPORTING COMPANY YET? Contact Peter Wostrel ([email protected], Phone 978.281.7708, Fax 978.281.7706) to reserve your own space for the next edition of our members’ magazine. 3 4 CIRCUIT CELLAR • OCTOBER 2014 #291 CONTENTS OCTOBER 2014 • ISSUE 291 SIGNAL PROCESSING THE BLASTERWORKS REAL-TIME LASER TAG SYSTEM CC COMMUNITY 06 : CC WORLD 08 : QUESTIONS & ANSWERS Electronics Innovation & Outreach An Interview with Bill Porter A Florida-based Navy engineer on unmanned system design and engineering-focused educational outreach INDUSTRY & ENTERPRISE 12 : PRODUCT NEWS 17 : CLIENT PROFILE Newhaven Display International (Elgin, IL) FEATURES 18 : BlasterWorks A Real-Time Wireless Laser Tag System By Max Rothstein and Richard Speranza A DIY real-time laser tag system complete with an LCD screen and RF transceiver for scoring and configuration 30 : Land Mobile Radio Wireless Control By Ken Merk Build a Land Mobile Radio (LMR) wireless system for long-distance monitoring and control 40 : AC Monitor By Larry Cicchinelli A handy circuit if you need an easy-to-use, straightforward way to determine voltage values 52 : Elektor ComputerScope (1986) Goodbye Green-Only 'Scope CRT By Jan Buiting A look back at a young engineer’s ambitious test instrument, which was like a ‘scope with PC support COLUMNS 44 : THE CONSUMMATE ENGINEER The Not So Humble Capacitor BILL PORTER DESIGNING AT HIS WORKBENCH By George Novacek A look at common capacitors and a variety of basic capacitance-related equations circuitcellar.com CONTENTS LAND MOBILE RADIO FOR LONG-DISTANCE MONITORING & CONTROL 48 : EMBEDDED IN THIN SLICES Linux System Configuration (Part 3) Build Your Linux System By Bob Japenga Various ways to build your embedded Linux system 58 : THE DARKER SIDE RF Connectors By Robert Lacoste Tips for selecting and caring for RF connectors 64 : FROM THE BENCH Embedded Voice Recognition (Part 1) Recognition as a Peripheral CONNECTOR CARE TESTS & CHALLENGES 74 : CROSSWORD 75 : TEST YOUR EQ TECH THE FUTURE 80 : The Future of Temperature-Compensated Crystal Oscillators By John Esterline A look at TCXO technology and the artificial neural network’s potential By Jeff Bachiochi Add effective speech and voice recognition capabilities to an electronics system EMBEDDED VOICE RECOGNITION AIR TUNING CAPACITOR @editor_cc @circuitcellar circuitcellar 5 6 CIRCUIT CELLAR • OCTOBER 2014 #291 CC WORLD FREE SOLAR SERIES By CC Staff (US) COMMUNITY Various Connecticut, USA-based CC staffers have noticed new local television ads promoting home solar power systems. Many towns in our area are even promoting solar programs with incentives for homeowners to switch to solar. We aren’t quite sure why there has been a push for solar during the past several weeks (in comparison to, say, three months ago), but it’s been quite obvious. In the spirit of DIY engineering and solar power innovation, we’re re-releasing Circuit Cellar founder Steve Ciaria’s three-part series, “Solar-Powering the Circuit Cellar.” An excerpt from the first article in the series appears below. You can download the entire series for free for a limited time (http://bit.ly/1tHMOQW). Enjoy! Photo 1 shows the roof-mounted solar panels that produce approximately 40% of the total PV power. I know it sounds like a joke that the first PV system consideration is walking around the house and looking for the sun, but you can’t generate much energy if your panels are always shaded. When you live in the middle of the woods, finding the sun is often easier said than done. Array orientation determines how much energy you can produce. Solar panels are typically aimed due south at a specific tilt angle that optimizes the incidence angle of the sunlight striking the panel. Maximum energy is produced when this tilt angle is equal to the latitude of the location (reduced by a location correction factor). Typically, the optimal tilt angle during the summer is the latitude minus 15°, and the optimal angle for the winter is the latitude plus 15°. Hartford, CT, is located at 42° latitude and the optimum tilt angle (minus an 8° correction factor) ranges from 19° in the summer (34° – 15°) to 49° in the winter (34° + 15°). The Connecticut rebate program suggests that if a fixed tilt is used, it be set at 35°. Of course, these are computergenerated optimizations that don’t necessarily accommodate real-world conditions. While it Photo 2 Attaching the first SunPower SPR-210 panel to the UniRac mounting rails on the roof Photo 1 Approximately 4,200 W of PV power is generated from 20 roof-mounted SunPower SPR-210 solar panels. The other 6,560 W comes from pole-mounted arrays behind this area. requires some nontrivial computer calculations to show authenticity, it is my understanding that as long as the non-optimal differences in azimuth and tilt are less than 20°, the loss in maximum power production is typically only about 5%. It is exactly for that reason that the most cost-effective PV installation is typically a fixed-pitch roof-mounted array. My system includes both variable and fixedpitch arrays. The roof-mounted panels are located on the solarium roof and oriented at a fixed pitch of 17.5° facing SSW (see Photo 1). According to Sunlight Solar Energy’s calculations, efficiency is still about 92% of the desired maximum because the 17.5° roof angle actually allows higher efficiency during longer summer hours even though it isn’t the optimum tilt for winter. Pole-mounted arrays are more efficient than a fixed-pitch roof array by design. My configuration is single-axis adjustable. The pole-mounted arrays are oriented due south and enable seasonal adjustment in the tilt angle to optimize the incidence angle of the sun. For everyone ready to e-mail me asking why I didn’t put in a tracking solar array since this is a pole mount, let me just say that you can also send me financial contributions for doing it via the magazine.—Steve Ciarcia, “Solar-Powering the Circuit Cellar (Part 1: Preparing the Site),” Circuit Cellar 209, 2007. You can download Steve Ciarcia’s three-part article series, “Solar-Powering the Circuit Cellar,” for free (for a limited time only): http://bit.ly/1tHMOQW. 8 CIRCUIT CELLAR • OCTOBER 2014 #291 QUESTIONS & ANSWERS Electronics Innovation & Outreach An Interview with Bill Porter COMMUNITY Bill Porter is a Panama City Beach, FL-based electronics engineer working for the US Navy. When he isn’t working on unmanned systems for the Navy, he spends his time running an engineering-focused educational outreach program and working on his own projects. In this interview, Bill talks about his first designs, technical interests, and current projects. CIRCUIT CELLAR: You’re an electronics engineer for the United States Navy. Can you describe any of the projects you’re involved with? Bill Porter at his home workspace BILL: I work with unmanned systems, or robots that are teleoperated and/or autonomous. This includes systems that swim under water, on the surface, or across the land. The Navy is working hard to develop robots to do the jobs that are dirty, dangerous, or dull and help keep the sailor out of harm’s way. One such system is called MUSCL, or Modular Systems Craft Littoral. MUSCL is a small, man-portable surface vehicle that is used by Riverine Patrol for remote surveillance and reconnaissance. I was the lead electrical engineer for the project. Besides robots, I am also working on a few education outreach programs that work towards getting more students interested in STEM careers. CIRCUIT CELLAR: Tell us about The Science Brothers nonprofit outreach program. How did the program start? BILL: The Science Brothers is my main educational outreach program run out of my Navy base. For two Fridays every month, a few of my coworkers and I will visit a local elementary school to put on a show. The script of the show centers on the dynamics of two brothers, who specialize in different fields and argue over whose science is “cooler.” The result is a fun and wacky trip exploring different premises in science, such as light, sound, and energy, with examples and demonstrations from the realms of chemistry, physics, and electricity. The program restarted when a few coworkers and I sat down and decided to bring back an old program that had existed on the base in the ‘90s called “Dr. Science.” The goal of the program was to bring science-based experiments to the schools using equipment they otherwise were not able to afford. By wowing the students with the spectacularlooking demos, we get them excited about science and yearning to learn more. circuitcellar.com 9 QUESTIONS & ANSWERS CIRCUIT CELLAR: Your website (BillPorter. info) includes projects involving 3-D printing, motor controllers, and LEDs. What types of projects do you prefer working on and why? CIRCUIT CELLAR: Do you have a favorite project? BILL: Yes! My wedding of course! I married the girl of my dreams who is just as much as a geek as I am, and as a result, we had an extremely geeky wedding over a year in the making involving many projects throughout. So much so that our theme was “Circuit and Swirls” and we carried the motif throughout. We designed and made our own wedding invitations involving LEDs, a microprocessor, and a clever Easter egg. Furthermore, we 3-D-printed our centerpieces, built up our own “e-textile” wedding attire with LEDs and EL wire, and we even had a “soldering ceremony” during the event. It made our parents nervous, but in the end, everyone had a good time. Did I mention I asked her to marry me on a PCB she designed for a project? CIRCUIT CELLAR: Do you have a favorite Science Brothers project? BILL: My favorite Science Brother project has to be Tesla Hero. I took apart a Playstation2 Guitar Hero controller and modified it to send signals over a fiber optic cable to my Tesla Coil. Instead of hitting digital rifts, now I can play a few notes through my Tesla Coil. Nothing gets the kids more excited than to see the “Million Volt Electric Guitar.” CIRCUIT CELLAR: Give us a little background information. How did you become interested in technology? Where did you do to school? What did you study? BILL: I studied electrical engineering in college and build robots for fun. I spent way too much COMMUNITY BILL: I am a hardware guy. I love to fire up my favorite PCB CAD software just to get an idea out of my head and on the screen. I do not breadboard very often, as I would rather take my chances trying some new idea on a board first. Either it works, or I have an excuse to design another PCB. Thankfully, group-order PCB services have enabled my addiction tinkering at a very low cost. I wish I was stronger at mechanical CAD design to really get the full potential out of my 3-D printer, but I have done well enough without it. It really does come in handy at times, whether it is a quick project enclosure, a mount, or a part for our garden. Images from Bill Porter's EEthemed wedding 10 CIRCUIT CELLAR • OCTOBER 2014 #291 QUESTIONS & ANSWERS of my allowance on the first Lego Mindstorms kits in high school (which got me hooked on robotics) and liked to mod Xboxs for fun. If there was a way to attach an LED to something, I would find it. CIRCUIT CELLAR: Tell us about the first embedded system you designed. What did you learn from the experience? COMMUNITY BILL: I guess my first real embedded project was the robot I helped design from the ground up during the capstone project of my last year in college. In a team of four, we had to design a robot that would autonomously locate, sort, and store recyclable “trash” consisting of Coke can, plastic, and glass bottles. The project was a smashing success and lead to my career with the US Navy. The experience taught me about how much involvement is required to take a project from an idea to the final product. There are a lot of little things for which one has to contemplate, plan and design solutions. CIRCUIT CELLAR: Tell us about last electronicsdesign related product (e.g., a microcontroller, sensor, etc.) you purchased and the project you worked on with it. BILL: My wife and I just decided to start a small herb garden on our apartment balcony. Never missing an excuse to tinker, I started playing with designs for an automatic gravity-fed drip irrigation system. I just purchased a few soil conductivity sensors to sense when the plants will need to be watered. I’m hoping to automate and data log things like soil moisture vs. relative humidity, temperature, sunlight level, etc. CIRCUIT CELLAR: Are you currently working on or planning any projects? Can you tell us about them? BILL: I have one main project that is taking up all my time at work and at home. A coworker and I are the technical directors for the first-ever Maritime RobotX Challenge. The challenge, sponsored by Association for Unmanned Vehicle Systems International (AUVSI) Foundation and by the Office for Naval Research (ONR), will take place this October in Singapore. It will include 15 teams of college students from five participating nations and put them to the test by challenging them to design a robot that will complete five tasks autonomously. As one of the technical directors, I have been helping design and build the interactive course elements that the teams’ robots will be facing. Find out more at Robotx.org. CIRCUIT CELLAR: What new technologies excite you and why? Science Brothers shows BILL: I have always been infatuated by LEDs and ways to conserve energy, so I am most excited to see how efficient LEDs are starting to take over as the new source of light in the household. C-RUN is a high-performance runtime analysis add-on product, fully integrated with world-leading C/C++ compiler and debugger tool suite IAR Embedded Workbench. C-RUN performs runtime analysis by monitoring applica- tion execution directly within the development environment. The tight integration with IAR Embedded Workbench improves development workflow and provides each developer with access to runtime analysis that is easy-to-use. Join us at ARM TechCon! Booth 512 12 CIRCUIT CELLAR • OCTOBER 2014 #291 PRODUCT NEWS UPGRADES TO HIGH-ISOLATION, MULTI-THROW SWITCHES INDUSTRY & ENTERPRISE Peregrine Semiconductor Corp. recently introduced the UltraCMOS PE42442 and PE42452, which are high-isolation, multithrow switches. In comparison to its PE42451, the SP4T and SP5T switches include several additional features to meet wireless infrastructure demands: • extended temperature range to 105°C • control logic support of 1.8 and 3 V • a 1.8-V logic control was included to enable lower power consumption • a wider power supply range of 2.3V to 5.5V • loss, isolation, and ESD protection A 24-lead, 4 × 4-mm QFN package is available. For orders of 10,000 or more, the PE42442 costs $1.60 each and the PE42452 costs $1.92 each. Evaluation kits are also available. Peregrine Semiconductor www.psemi.com NEW PIC32 BLUETOOTH STARTER KIT Microchip Technology recently announced the new PIC32 Bluetooth Starter Kit, which is intended for low-cost applications such as a Bluetooth thermostat, wireless diagnostic tools, and Bluetooth GPS receivers. According to Microchip, the kit includes “a PIC32 microcontroller, HCIbased Bluetooth radio, Cree high-output multi-color LED, three standard single-color LEDs, an analog three-axis accelerometer, analog temperature sensor, and five push buttons for user-defined inputs.” PICkit On Board (PKOB) eliminates the need for an external debugger/ programmer, USB connectivity, and GPIOs for rapid development of Bluetooth Serial Port Profile (SPP), USB and general-purpose applications. The starter kit also features a plug-in interface for an audio CODEC daughter card. The kit’s PIC32MX270F256D microcontroller operates at 83 DMIPS with 256-KB flash memory and 64-KB RAM. The PIC32 Bluetooth Starter Kit is supported by Microchip’s free MPLAB X IDE and MPLAB Harmony Integrated Software Framework. Additionally, the free Quick Start Package is available with an Android application development environment. It also includes a free SDK with the application source code and binary for Microchip’s Bluetooth SPP library. Both are optimized for the on-board PIC32 MCU and are available for free at www.microchip. com/get/1AVL. The PIC32 Bluetooth Starter Kit costs $79.99. Microchip Technology www.microchip.com circuitcellar.com 13 PRODUCT NEWS DUAL STEP-DOWN REGULATOR • • • • Dual step-down outputs: 1 A per channel VIN range: 2.7 to 17 V VOUT range: 0.6 V to VIN Up to 95% efficiency • • • • • • • • • No-load IQ = 5 μA (both channels enabled) < 4 μA (one channel enabled) High efficiency, low dropout operation (100% duty cycle) Constant frequency (1 MHz/2.25 MHz) with external synchronization ±1% output voltage accuracy Current mode operation improves line and load transient response Phase shift programmable with external clock Selectable current limit Internal compensation and soft-start Compact 14-pin DFN (3 mm × 4 mm) package The regulator is available now with a per-unit cost starting at $3.75 for orders of 1,000 units. Linear Technology www.linear.com HIGH-SENSITIVITY ACCELEROMETER FAMILY Freescale recently introduced a new range of three-axis accelerometers offering high sensitivity at low power consumption. According to Freescale, the FXLN83xxQ family is capable of detecting acceleration information often missed by less accurate sensors commonly used in consumer products such as smartphones and exercise activity monitors. In conjunction with appropriate software algorithms, its improved sensitivity allows the new sensor to be used for equipment fault prognostication (for predictive maintenance), condition monitoring, and medical tamper detection applications. The 3 mm × 3 mm chip has a bandwidth of 2.7 kHz and uses analog output signals for direct connection to a microcontroller’s ADC input. Each chip has two levels of sensitivity that can be changed on the fly. The complete family covers acceleration ranges of ±2, ±4, ±8, and ±16 g, with gains of, 229.0, 114.5, 57.25, and 28.62 mV/g, respectively. Zero g is indicated by an output level of 0.75 V. The FXLN83xxQ family features: • • • • FXLN83x1Q ±2 or ±8 g range FXLN83x2Q ±4 or ±16 g FXLN836xQ 1.1 kHz x- and y-axis bandwidth (Z = 600 Hz) FXLN837xQ 2.7 kHz x- and y-axis bandwidth (Z = 600 Hz) The sensors operate from 1.71 to 3.6 V (at 180 µA typically, 30 nA shutdown). The company has also made available the DEMOFXLN83xxQ evaluation break-out board with a ready-mounted sensor to simplify device integration into a test and development environment. Freescale Semiconductor www.freescale.com INDUSTRY & ENTERPRISE Linear Technology has announced an addition to its family of power regulator solutions. The LTC3622 is a dual step-down regulator in a small 3 × 4 mm package that provides two independently configurable 1-A outputs operating from a 2.7- to 17- V input. External voltage divider networks define the two output voltages or alternatively a range of fixed output voltage versions result in a lower component count. The input voltage range makes it suitable for operation from single or multiple lithium cells or from a vehicular supply. The regulator can operate in Burst mode to give highest efficiency at light loads or PulseSkipping mode to give lower ripple noise. The system clock can be synchronized to an external source to help to reduce system noise bandwidth. Some of the many features include: 14 CIRCUIT CELLAR • OCTOBER 2014 #291 PRODUCT NEWS DE0-NANO CYCLONE FPGA DEV BOARD With a DE0-Nano Cyclone FPGA Development Board, you can create your own sophisticated hardware using programmable logic. The development board includes an Altera Cyclone IV and additional components to connect and test hardware designs. It comes a pre-wired Cyclone IV FPGA for programming and connection to internal or external devices and circuit. With the board, you can create sophisticated logic hardware fairly quickly using a hardware description language. Possible applications include dedicated digital logic processors, robotics, and DIY autonomous systems. INDUSTRY & ENTERPRISE Parallax www.parallax.com NEW DUAL-CHANNEL FUNCTION/ARBITRARY WAVEFORM GENERATORS Analog Devices has announced a software-defined radio (SDR) rapid prototyping kit with dual 2 x 2 AD9361 RF transceivers to simplify and rapidly prototype 4 × 4 MIMO wireless transceiver applications on the Xilinx Zynq-7000 allprogrammable SoC development platforms. The AD-FMCOMMS5-EBZ rapid prototyping kit provides a hardware/software ecosystem solution addressing the challenges of SDR transceiver synchronization experienced by RF and analog designers when implementing systems using MIMO architectures. A webinar is available on how to synchronize multiple RF transceivers in high-channel density applications. The AD-FMCOMMS5-EBZ rapid prototyping kit includes the following: • • • • • • An FPGA mezzanine card (FMC) featuring two of Analog AD9361 2 x 2 RF transceivers and support circuitry Reference designs Design and simulation tools for MathWorks HDL code Device drivers for Zynq-7000 All Programmable SoCs Online support at ADI’s EngineerZone for rapid prototyping to reduce development time and risk. The AD-FMCOMMS5-EBZ rapid prototyping kit is the fifth SDR rapid prototyping kit ADI has introduced in the last year to help customers address the global SDR market. SDR MIMO applications range from defense electronics and RF instrumentation to communications infrastructure and include active antennas, transmit beamforming, receive angle of arrival systems, and open-source SDR development projects. The AD9361 operates over a frequency range of 70 MHz to 6 GHz. It is a complete radio design that combines multiple functions, including an RF front end, mixed-signal baseband section, frequency synthesizers, two analog-to-digital converters and two direct conversion receivers in a single chip. The AD9361 supports channel bandwidth from less than 200 kHz to 56 MHz and is highly programmable. Analog Devices www.analog.com DESIGN YOUR SOLUTION TODAY CALL 480-837-5200 TS-8820-BOX Industrial Controller TS-7680 Single Board Computer Opto-Isolated Analog IO AC Power, Relays, WiFi, & Bluetooth Powered by: TS-SOCKET Modules TS-8820-4700 Pricing starts at $608 $659 Qty 100 Qty 1 TS-8820-4800 Pricing starts at $648 $699 Qty 100 Features: Qty 1 Pricing starts at $159 $203 Qty 100 (Shown with all options) Qty 1 Features: 800 MHz ARM CPU 2x USB Host 454 MHz ARM CPU Wireless 802.11b/g/n 256 MB RAM 8x Opto-Isolated Inputs 128 or 256 MB RAM Bluetooth 4.0+EDR 256 MB Flash Storage 6x Digital Inputs, 6x Out 2 GB Flash Storage Wireless 802.11b/g/n 1x microSD Socket 16x ADC, 4x DAC Ports 1x microSD Socket 24 VAC or 8-24 VDC Power 1x 10/100 Ethernet PWM, Counter, & H-Bridge 2x 10/100 Ethernet DIO, CAN, Modbus, Relays Benefits: Benefits: Provides a variety of electrically isolated IO Low power and low cost industrial grade SBC Metal enclosure with rugged screw connectors Rugged 24-Pin screw terminal connector Convenient Power over Ethernet (PoE) powers SBC Flexible power inputs including AC and DC Customizable with programmable 5 KLut FPGA Wireless data aquisition via WiFi and Bluetooth -40 to 85 ºC industrial temperature range L NA GI Support every step of the way with open source vision O RI Embedded systems that are built to endure N TS-7670 Low Power SBC with GPS Radio & Cell Modem O PE D GE RU G LO NG LI FE Boots Linux 2.6 in less than 3 seconds We’ve never discontinued a product in 30 years 30 V tolerant DIO, analog IO, 3 A relays, and more Also Available: Unique embedded solutions add value for our customers 16 CIRCUIT CELLAR • OCTOBER 2014 #291 PRODUCT NEWS USER-EXTENSIBLE FDA FOR REAL-TIME OSCILLOSCOPES Keysight Technologies recently announced the availability of a frequency domain analysis (FDA) option, a user-extensible spectrum frequency domain analysis application solution for real-time oscilloscopes. The FDA option extends the capabilities of Keysight Infiniium and InfiniiVision Series oscilloscopes by enabling you to acquire live signals from the oscilloscope and visualize them in the frequency domain, as well as make key frequency domain measurements. Option N8832A-001 includes the application, the application source code for user extensibility, and MATLAB software. These tools enable you to extend an application’s capabilities to meet their current and future testing needs. With the FDA application, you can address a variety of FDA challenges such as: • • INDUSTRY & ENTERPRISE • • • Power spectral density and spectrogram visualization Frequency domain measurements in an application including relevant peaks in the PSD and measurements such as occupied bandwidth, SNR, THD, SFDR, and frequency error Oscilloscope configuration through the application to allow for repeatable instrument configuration and measurements; optionally includes additional SCPI commands for more advanced instrument setup Insertion of additional custom signal processing commands prior to frequency domain visualization, as needed, for more advanced analysis insight Live or post-acquisition analysis of time-domain data in MATLAB software Keysight Technologies www.keysight.com QUARTUS II SOFTWARE ARRIA 10 EDITION V14.0 Micro Altera Corp. has released Quartus II software Arria 10 edition v14.0, which is an advanced 20-nm FPGA and SoC design environment. Quartus II software delivers fast compile times and enables high performance for 20-nm FPGA and SoC designs. You can further accelerate Arria 10 FPGA and SoC design cycles by using the range of 20-nm-optimized IP cores included in the latest software release. Altera’s 20-nm design tools feature advanced algorithms. The Quartus II software Arria 10 edition v14.0 provides on average notably fast compile times. This productivity advantage enables you to shorten design iterations and rapidly close timing on 20nm design. Included in the latest software release is a full complement of 20-nm-optimized IP cores to enable faster design cycles. The IP portfolio includes standard protocol and memory interfaces, DSP and SoC IP cores. Altera also optimized its popular IP cores for Arria 10 FPGAs and SoCs, which include 100G Ethernet, 300G Interlaken, Interlaken Look-Aside, and PCI Express Gen3 IP. When implemented in Altera’s Arria 10 FPGAs and SoCs, these IP cores deliver the high performance. The Quartus II software Arria 10 edition v14.0 is available now for download. The software is available as a subscription edition and includes a free 30-day trial. The annual software subscription is $2,995 for a node-locked PC license. Engineering samples of Arria 10 FPGAs are shipping today. Altera www.altera.com NEW 40-NM MICROCONTROLLERS FOR MOTOR CONTROL Renesas Electronics Corp. recently announced the RH850/ C1x series of 32-bit microcontrollers (MCUs), which it said are designed for motor control in hybrid electric vehicles (HEVs) and electric vehicles (EVs). Based on Renesas’s 40-nm process, the RH850/C1x series features the RH850/C1H and RH850/C1M MCUs. The new RH850/C1x devices can be used with the RAA270000KFT RH850 family power supply management IC (PMIC). The power management IC integrates into one device all the power supply systems required for MCU operation, two external sensor power supply tracks, and a full complement of monitoring and diagnostic functions. The RH850/C1H and RH850/C1M MCUs incorporate large memory capacities achieved through 40 nm MONOS process technology. The RH850/C1x series is based on Renesas’s metal oxide nitride oxide silicon embedded flash. The RH850/C1M and RH850/C1H devices offer memory capacities of 2 MB and 4 MB, respectively. In addition, 32-KB data flash memory, with similar functionality as EEPROM, is included for data storage. The microcontrollers also feature an extensive set of peripheral functions for HEV/EV motor control. The RH850/C1x MCUs can implement three types of motor control in hardware: sine wave PWM, over modulation, and square wave. Samples of the RH850/C1H and RH850/C1M MCUs are scheduled to be available from the beginning of 2015 and will cost $45 and $50 per unit, respectively. Renesas Electronics Corp. www.renesas.com circuitcellar.com 17 CLIENT PROFILE Newhaven Display International, Inc. www.newhavendisplay.com CONTACT: Melissa Campbell ([email protected]) WHY SHOULD CC READERS BE INTERESTED? Intn The Full Color OLED displays feature 262k colors with a 2001:1 contrast ratio, >160° view, and a 10-μs response time. Each of these displays is 5-mm thick. They are built as complete modules that include all necessary logic. They can withstand temperature ranges from –30°C to +70°C without affecting the response time of the display. The Full Color OLEDs also support a 256-step brightness and have a built-in sleep mode as well as additional features that you won’t find in your typical LCD. SPECIAL OFFER: For a limited time, take 10% off your first COLOR OLED online purchase at www.newhavendisplay.com. Use coupon code CCFullColor during check out. Limit one per customer; cannot be combined with any other offers. Circuit Cellar prides itself on presenting readers with information about innovative companies, organizations, products, and services relating to embedded technologies. This space is where Circuit Cellar enables clients to present readers useful information, special deals, and more. Get published. Get noticed. Get paid. Circuit Cellar feature articles are contributed by professional engineers, academics, and students from around the globe. Each month, the editorial staff reviews dozens of article proposals and submissions. Only the best make it into the pages of this internationally respected magazine. Do you have what it takes? Contact C. J. Abate, Editor-in-Chief, today to discuss the embedded design projects and programming applications you’ve been working on and your article could be featured in an upcoming issue or online at circuitcellar.com. Email: [email protected] INDUSTRY & ENTERPRISE FEATURED PRODUCTS: The Full Color OLEDs of fer any monochromatic applic ation a boos t of vibranc y and enhanced performance. The NHD-1.27-12896UGC3, NHD1.5-128128UGC3, and the NHD-1.69-160128UGC3 are perfect for any application, but are ideal for handheld or low-power applications looking to add a sharp-looking display with the ability to produce smooth motion graphics and support a wide viewing angle. To learn more about these Full Color OLEDs, visit http://bit.ly/ColorOLEDs. 18 CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES BlasterWorks A Real-Time Wireless Laser Tag System Unlike most commercial “laser tag” combat games that use infrared light-based systems, the innovative system presented in this article uses real lasers. Wireless updates work seamlessly and the sensor system can accurately detect hits from reasonable ranges. By Max Rothstein and Richard Speranza A s our final project for the course “ECE4760: Designing with Microcontrollers” at Cornell University, we built a wireless, realtime laser tag system—or, as we call it, BlasterWorks (see Photo 1). Having played standard laser tag games, we were interested in expanding the game beyond its traditional boundaries. Our ultimate goals were to create a system that mirrored combat as closely as possible and to add new features that are normally only found in video games. We also PHOTO 1 The player operates four buttons in the center. From the top left to the right, they correspond to Reload, Change Weapon, Fire Blaster, and Change Screen. felt laser tag would be cooler with real lasers, as opposed to using infrared light, which all commercially available systems implement. With this in mind, we started with the essential components—namely, the laser and detector system—and expanded the game by adding an LCD screen and RF transceiver to provide score updates and configurability. GAME OVERVIEW At the highest level, our system has three main components: a laser blaster, a base station, and a shot detection vest. Figure 1 depicts their high-level connections. Each player’s vest is instrumented with sensors to detect shots coming from other players. Each blaster has an RF transceiver, an LCD, a sensor, and a laser. The laser is used to fire at other players and only turns on when the player presses the fire button. The RF transceiver allows each player to send and receive real-time information about the game. This information, such as player health, is displayed on the blaster’s LCD. Finally, each blaster is equipped with a sensor to determine if the blaster itself has been hit by another player. The final component, the base station, serves as a relay point for the real-time updates and logs the game’s activity. It also sets the game parameters, such as starting health and ammo, and then begins the game. Each blaster has four buttons that control its actions. The first button fires the laser on the blaster. The second button reloads the blaster, replenishing the ammo count. The third button cycles through LCD views, and the fourth button switches weapon types. circuitcellar.com Base station PC PuTTY 19 DC Supply SPI RF Transceiver COM Port 5V DC/DC MAX232 FEATURES ATmega644 MCU USART Serial/RS-232 9-V Battery Player 1 Blaster SPI SPI RF Transceiver DC/DC 9-V Battery Player 2 Blaster RF Transceiver 5V 5V Wireless comm Laser ATmega644 MCU Lens Laser Blaster sensor Blaster sensor LCD LCD ATmega644 MCU Player 1 Vest PWR Outer sensor Outer sensor Inner sensor DC/DC Lens Player 2 Vest Outer sensor Outer sensor PWR Inner sensor Data Data Outer sensor Outer sensor Photo 1 the shows user interface. The LCD has three different views: selfinfo, scoreboard, and weapon type. The user has the ability to scroll between these screens by pressing the change screen button. On the self-info screen, the player can view his or her own health and ammo count. By looking at the scoreboard, the player can see the health of all of the players in the game. The weapon screen tells the player if they are in single shot or automatic mode. The objective of the game is to be the last player standing. Players can create their own custom games with their own parameters, or choose default values. Default values assign players with 100 health points, 100 rounds of ammunition for the automatic blaster, and unlimited ammunition for the pistol blaster. However, each pistol clip has only 10 shots, so a player needs to reload. When a player is hit on the vest, points are deducted from his or her total health. If hit in the inner ring of the vest, 10 points are deducted. If hit in the outer ring instead, only five points are deducted. Hitting a player on his or her blaster sensor prevents them from shooting for the next 5 s Outer sensor Outer sensor and will also deduct five health points. HARDWARE DESIGN The hardware can be split into two main categories: shot detection and microcontroller processing and peripherals. Both the blasters and base station have processing/peripheral blocks, but the base station does not have a shot detection block. The circuitry for the blaster and base station are depicted in Figure 2 and Figure 3, respectively. The shot detection block’s mission is to catch any lasers that are shot at the user and to give information to the microcontroller so it can determine where the user was hit. As you can see in Figure 4, there are a total of six LTR-301 phototransistors. Q1 through Q4 on the schematic correspond to the four outer detectors on the user’s chest plate. Q5 is the sensor for the inner detector on the chest plate. Finally, Q6 is the last sensor, which is placed on the user’s blaster. These sensors can be thought of as a normal BJT; however, instead of biasing the base manually, the laser does the work for us. Without any light shining on the base of the phototransistor, the FIGURE 1 The full system 20 CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES FIGURE 2 The Blaster’s schematic FIGURE 3 The base station’s schematic device is turned off and there is an effective open between the collector and emitter. As light hits the component, the BJT begins to turn on, allowing the 5 V from the collector to flow to the emitter. Something worth noting is that this device is not an “all-or-nothing” device. The voltage at the emitter is not always either 0 or 5 V. Depending on how hard the component is hit by light, the device may only be partially on. This behavior is the reason why comparators are needed. The purpose of the fast-switching diodes (D1–D9) in the circuit is to create a logic OR function. Regardless of which sensor is hit, we want a comparator to flip to throw an external interrupt on the microcontroller. By using an OR circuit, we can obtain this functionality. A diode OR circuit allows the highest voltage in the OR to pass through and then back-biases the remaining diodes. The LM358 operational amplifiers (opamps) in our circuits are used as comparators and Schmitt triggers to send effective “bits” to our microcontroller. The bottom op-amp is configured as a Schmitt trigger. This is essentially a comparator with hysteresis. A Oct 1-3, 2014 Santa Clara Convention Center Santa Clara, CA TECHNICAL SESSIONS | HUNDREDS OF EXHIBITORS | KEYNOTES PRIZES & GIVEAWAYS | NETWORKING EVENTS Please visit www.armtechcon.com CIRCUIT CELLAR • OCTOBER 2014 #291 trigger, similar to the shot comparator. This Schmitt trigger is attached to the sensor that is placed on the blaster. A reference voltage is set with a 10-kΩ potentiometer on the inverting input. When the user is shot on the blaster, the noninverting input goes above this threshold and causes the output of the op-amp to flip. Whenever the bottom op-amp flips and generates an external interrupt, the two bits from the top LM358 are read. FEATURES 22 PROCESSING & PERIPHERALS FIGURE 4 The shot detection schematic FIGURE 5 The laser driver schematic 10-kΩ potentiometer sets a reference level at which the Schmitt trigger flips. If a shot is detected from any of the six sensors, then the voltage at the noninverting input raises above the set threshold voltage. Due to positive feedback, the output of the Schmitt trigger is driven high, which causes an external interrupt on INT0. The LM358 package conveniently has two op-amps inside of it. On the top LM358, the first op-amp is configured as a simple comparator. It makes a comparison between the inner sensor and four outer sensors. By making this comparison, we can effectively tell if the user was hit closer to the inner sensor or closer to the outer sensors. The 1-MΩ resistors on each network pulls voltage through the first layer of diodes even if the second layer is biased off. The second op-amp in the package is configured as a Schmitt This is the final hardware stage in our design. This stage includes all of the remaining circuitry that interface with the microcontroller to give us our desired functionality. Most of the following peripherals are controlled by the user’s interaction with a set of four buttons. As we described previously, the functions are fire, reload, change screen, and change weapon. The buttons are connected to ground though a currentlimiting resistor. Since the microcontroller I/O pins are set to Pull-Up mode, when a button is pushed, the signal will switch to low. By reading these pin values through software, we can determine what the user is trying to do and respond accordingly. A special circuit is needed in order to drive the laser on each blaster. The Atmel ATmega644 I/O pins (and microcontroller I/O pins in general) have a limited amount of current that they can source. In order to drive the laser hard enough for it to be usable, a buffer is needed. For our application, a MOSFET is used to buffer the current needed to drive our laser. The source of the MOSFET is tied directly to ground and the drain is connected to VCC through a 1-kΩ resistor. The gate of the MOSFET is driven by the microcontroller’s A.7 pin. Finally, the laser is connected to VCC and the MOSFET drain. When the output on A.7 is low, the MOSFET is off, leaving the laser off. When the MOSFET gate is driven high, the device turns on, effectively connecting the negative terminal of the laser to ground. This functionality provides the laser with the current it needs, giving us maximum distance. The sensor system as described would detect laser beams directly incident on the phototransistors very well, but would not be able to detect shots pointed close by. At a distance of 5 m, the spot size is approximately 6 mm in diameter. By adding a concave lens in front of the beam, the diameter grows to a much larger size a few meters away, allowing us to only use a few phototransistors, rather than potentially hundreds, to capture a shot. We used foam core from a local crafts store to house the lens/laser system, and it worked quite effectively. They were both circuitcellar.com SOFTWARE The overall software design can be divided into the same general categories as the hardware, as it serves to coordinate concurrent operation of the wireless communication, the LCD screen, response to the shot detection, firing the blaster, and the various buttons. Two separate c files are needed, base_station.c, which controls the base station, and blaster.c, which controls both blasters. Each blaster is also provided with a unique identifier, my_number, when programmed. These activities are managed by the Tiny Real Time (TRT) kernel. The kernel allows us to easily manage the main tasks and control how often to run them, as well as to provide certain tasks with a higher priority when needed. Additionally, the LCD update is a slow process and might otherwise create a bottleneck on our system. By scheduling other tasks at the same time as the LCD update, the controller is able to continuously accomplish work. The four tasks are: task_health(), task_wireless(), task_lcd_update(), ABOUT THE AUTHORS Max Rothstein ([email protected]) is pursuing a BS in Electrical and Computer Engineering at Cornell University. His main interests are in computer architecture and embedded software. Richard Speranza ([email protected]) holds a BS in Electrical and Computer Engineering from Worcester Polytechnic Institute and is pursuing an MS in Engineering at Cornell University. His main interest is embedded systems design. and task_laser(). Additionally, external interrupts are used to handle shot detection and firing the blaster. TASK_HEALTH() & SHOT DETECTION Shot detection is performed by an interrupt service routine (ISR) by using an external interrupt on PinD.3, which is connected to the output of the shot detection comparator. When the interrupt is triggered, the ISR reads two other bits of information from the shot detection hardware. A blaster shot is detected by reading the FEATURES placed in the foam by making a small entry cut, and then firmly pressing the object down through the foam. Then, we peeled away the foam covering the glass portion of the lens. The final peripheral in our system is Nordic Semiconductor nRF24L01+, a 2.4 GHz RF transceiver. The transceiver and microcontroller communicate using SPI, an implementation that already existed in the drivers, which were borrowed from a previous project.[1] We have a wireless module on both blasters and the base station (refer to the either schematic for pin connections). This module is what gives us the ability to update each player with information about the game. The main challenges involving the wireless radio were in software, and will be discussed below. 23 24 CIRCUIT CELLAR • OCTOBER 2014 #291 PHOTO 2 Base station prototype FEATURES TASK_WIRELESS() value of PinA.5, and a shot to the outer ring of phototransistors on the detector is detected by reading the value of PinA.6. Shots to the blaster and outer ring are flagged as a weak_hit, while an inner shot is flagged as a strong_hit. In task_health(), the values of those two variables are checked and the corresponding health update is made. To limit the number of hits allowed per a given amount of time, the task sleeps for a longer period of time after detecting a hit. As in traditional laser tag, this allows a player who has been shot to retreat and reset after getting shot. Also, it prevents small hardware oscillations from affecting the software operation. PHOTO 3 Blaster prototype The wireless communication allows us to provide the players with real time information on the state of the game, providing health information for the other players. Additionally, it provides a way to configure the game from the base station terminal on startup, and send an alert when the game has finished. The wireless communications are handled by a state machine, which allows a back and forth conversation between all blasters and the base station. While the base station and blaster have slightly different behaviors, the state machine is almost identical from a high level. The main difference is during initialization state, which is called INIT_ GAME for both. In the blaster’s initialization state, it waits on a packet containing the game configurations, namely maximum health and ammo. This packet has a special identifier to indicate it is an initialization packet, rather than an update packet. In the base station’s initialization state, it first prompts the user via the PuTTy terminal to respond to a series of questions regarding game configurations. Once these questions have been answered, the base station sends packets to the awaiting blasters. To ensure delivery without acknowledgment, the base station transmits this message for a couple of seconds before transitioning to the next state. Once a blaster is initialized, it also transitions to the next state, INIT_RX. In INIT_RX, the wireless module is set to receiver mode, and then the controller transitions immediately to POLL_UPDATE. Here, the controller continuously checks to see if a new packet is available in the receive FIFO. That packet will contain the remaining hit points and ammo for all players. Essentially, this allows any player/base station to update any player/base station on the current state The new EAGLE has landed! Version 7 now available For more information, visit www.cadsoftusa.com 26 CIRCUIT CELLAR • OCTOBER 2014 #291 PHOTO 4 Sensor vest prototype FEATURES required to be in range of the base station at all times. In order to reconcile potential differences between those update packets, a value is only considered new if it is less than the local value. This preserves the proper state because health and total ammo can only decrease over time. If the base station receives an update, it transitions to INIT_TX, where the mode of the transceiver is changed to transmit. The blaster only transitions to INIT_TX when the player is shot, which is detected by an external interrupt as discussed earlier. Both transition immediately to SEND_UPDATE after the initialization is complete. Here, the update packet is formatted and broadcast out. To simplify the communication, the message is transmitted continuously for a set duration without requesting a receive packet acknowledgement. This allows the base station to reach all blasters without needing to spend time performing a hand shake with each player. For the purposes of the game, it is acceptable if any one controller misses an update. After the update is sent, both switch back to receive mode and wait on new updates. TASK_LCD_UPDATE() of the game. For example, Player 1 could send an update packet to Player 2. Player 2 could then update its local information and send its own update packet that the base station might receive. This extends the range of play for the game because players are not PROJECT FILES for the Atmel ATmega8L AVR,” ISRN LUTFD2/ TFRT7608SE, Department of Automatic Control, Lund Institute of Technology, 2004. Nordic Semiconductor, “nRF24L01+: Single Chip 2.4 GHz Transceiver,” Product Specification v1.0, 2008. circuitcellar.com/ccmaterials SOURCES REFERENCE [1] Lee, Y. H., “Design a Wireless Lab for ECE4760,” Cornell University, http://bit.ly/ USmWTb. ATmega644A Microcontroller Atmel Corp. | www.atmel.com VLM-650-03-LPA Laser and LTR-301 Phototransistors Digi-Key Corp. (distributor) | www.digikey.com RESOURCES Henriksson, D. and Cervin, A., “TinyRealTime—An EDF Kernel Transceiver nRF24L01+ Module with Chip Antenna Nordic Semiconductor | www.nordicsemi.com The LCD screen can either display personal status info (i.e., its local health and ammo values), the current blaster type, or the scoreboard containing the global health values. The state is controlled by clicking the Change Screen button. This results in incrementing the state variable to the next possible screen. In order to prevent the screen from flashing, it is only updated when new information is available. Since updating the LCD is a relatively slow process, local copies of the game info are created and displayed, which means the display may lag behind the true values. The difference will only be on the order a few milliseconds, so it will not affect the game play. This task also handles reload, which is done by polling PinA.1, which is driven low by pushing the Reload button. TASK_LASER() & FIRING SHOTS This task implements the two types of blasters available to each player: automatic and single shot. Each player starts out using their automatic blaster, and may choose to switch between weapon types by clicking the Change Weapon button. When using the automatic blaster, the player only needs to hold down the Fire Laser button and the laser will continuously fire. On alternate passes through this portion of the loop, the output pin driving the laser is turned on and off, its rate controlled by the TRT kernel function trtSleepUntil(). The circuitcellar.com CHALLENGES The main challenge was enabling wireless communication. Code for the drivers was borrowed from a previous project[1]; however, the sample code does not implement a system in which one controller takes on the role of both transmitter and receiver. The function set_ mode() provided by the driver file wireless.c is supposed to change between modes, but this function alone does not work. In order to switch between modes, we discovered it was necessary to clear out the receiver buffer by calling flush_RX_FIFO(), and then setting the new mode. The transceiver does not maintain the transmitter address while in receive mode, so we needed to call set_TX_ addr() with the new address when switching from Receiver to Transmitter mode. RESULTS We successfully created working prototypes for one base station and two blasters, each equipped with a sensor vest. Pictures of the complete product are shown in Photos 2-4. Wireless updates work seamlessly. The sensor system is fairly accurate at detecting hits from a reasonable range, and the remaining features work as intended. The main limitation on the current prototype system comes down to the range of play. The sensor vest can detect shots from a maximum range of approximately 5 m. The short range is due to both decreased intensity of the laser beam, as well as low sensitivity of the sensor system. More precise tuning of the comparator’s hysteresis as well as noise reduction from ambient light would help to improve the range of the system. Additionally, a production model with an additional focusing convex lens would have greater range, since the beam’s power density would not drop off as quickly. At a range of 3 m, our system is approximately 92% reliable in logging hits. This test was carried out by first fixing the direction of the blaster to point directly at the center of one phototransistor on the vest, and then firing repeatedly while holding the vest steady. Most importantly, no false positives were detected while playing in a well lit room. The range of the wireless transceivers in open lab space is approximately 32 m. Due to the method of sending updates, in which the transmitter sends out packets continuously for a couple of seconds, packets are reliably received while in range. As long as the players stay within 32 m of each other the game can continue, regardless of how far they are away from the base station, since the blasters can maintain communications with each other. The battery life of the blasters is sufficient for a number of games. At steady state, a blaster draws about 34 mA and jumps to about 64 mA when firing the blaster. In the worst case scenario, the blaster can fire for 50% of the time, putting the average current draw at 49 mA. This translates to a lifetime of 12.8 h based off of a 625 mAh lifetime of the 9-V battery. However, a more reasonable estimation is that the blaster is firing about 5% of the time, resulting in an average current draw of 35.5 mA and a 17.6-h lifetime. FUTURE UPDATES We achieved the main goals as originally outlined in our proposal. We now have a working prototype to play a game of laser tag. We borrowed lessons learned from all of the previous ECE 4760 labs at Cornell, learned some new ones, and successfully integrated them into a single product. Given the chance to do this project again, we would have taken into consideration the complexity of integrating many working parts and given ourselves more time for this portion, rather than assuming that they would simply “work” when they were all put together. Originally, we wanted to also have sound effects to make exciting “laser blasting” sounds, but time limitations prevented us from finishing the task. In the future, not only would we like to add sound back in, but we would also like to build more blasters to allow many more players. Also, the lasers could be fired with a payload that would allow the detector to determine the originator of the shot. Perhaps most importantly, expanded range would make the game much more interesting to play. We see plenty of opportunity to take our core system and create an exciting and unique laser tag game. FEATURES player’s ammo value is decremented on each fire. When using single shot, the trigger detection makes user of an external interrupt. The Fire Laser button is also wired to INT2 on PinB.2, which is triggered by a transition from high to low. A flag, called trigger_ interrupt, is set in the ISR for the external interrupt. The value of the flag is read within the task and a shot is fired as a result. Button clicks reliably result in only one laser fire since the allowed time between shots, which is controlled by the sleep time, is long enough for any transient signals to die out. If the blaster is disabled as a result of getting shot directly in the blaster, then the task sleeps for five seconds, rendering the blaster unusable. 27 •Spotlight 88 | October 2014 | www.elektor-magazine.com advertorial @electronica 2014 Made in Munich Come MAKE it @electronica 2014 By Wisse Hettinga (Elektor Labs) You’ve all heard of the maker revolution and seen cool things described but how cool is it to MAKE some real electronics at the world’s largest exhibition on real electronics? To have a place where you can relax, charge your phone, e-gossip, have a coffee and touch base with real-world electronics. Where you can bring along anything you’d want to unbox, (un)solder, show off, measure, check-4-specs, Arduino’d, or Raspberry Pi’d. Feel free to come work with us the Elektor way! Elektor designers and engineers are on standby to lend a helping hand and supply everything you need to get some real electronics work done right there and then. German, English, Dutch, Spanish, C++, spoken. For this special occasion Elektor Labs are putting at your disposal: desk space, tools, test & measurement equipment, a 3D printer, and free WiFi. Not forgetting mini workshops, techtalk, coffee (please donate), and plenty of power sockets to charge phones, tablets, laptops, and gizmos. Navigate to the Elektor Maker Space in Hall A6, Booth 380 Stay in touch with Elektor’s activities register for our newsletter on www.elektor.com, right hand bottom corner. IA ONAL MED I T A N WHO: R E T LEKTOR IN YOU AND E E WHAT: AKER SPAC M ’S R O T K ELE WHEN: 4 11–14, 201 NOVEMBER , WHERE: A, MUNICH C I N O R T C ELE BOOTH 380 HALL A6 / advertorial www.elektor-magazine.com | October 2014 | 89 30 CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES Land Mobile Radio Wireless Control For long-distance monitoring and control, Land Mobile Radio (LMR) is another wireless option to consider. You can build a wireless interface that has eight output relays and eight digital inputs that can be controlled by the serial port on a mobile radio. By Ken Merk T here was a time when controlling something wirelessly was magical. Let’s consider some examples. I remember the first automatic garage door opener on our street. People walking down the sidewalk would stop and watch this miraculous invention perform its duty. PHOTO 1 Kenwood’s NX-210 NXDN 5-W portable radio is capable of analog and digital transmissions. The desired function is highlighted using the Up and Down buttons on the front keypad and then sent by pressing the side Push-to-Talk button. Then there was the remote control. I remember the Christmas when my father brought home a new Zenith black-and-white television. My main interest was its remote feature. Inside the handheld remote (which we called the “clicker”) were four aluminum rods cut to specific lengths. When you pressed one of the four buttons, a spring-loaded hammer would strike the rod emitting a sound. Each rod emitted a different ultrasonic frequency that would activate a specific function on the TV. Of course, sometimes rattling a ring of keys in front of the TV would cause it to change channels or mute the volume. Primitive as it may sound, it worked—and it didn’t need batteries. Next, I saw cordless phones come on the scene. The early ones had long telescopic antennas because of the low operating frequency. Later, as technology progressed, the frequencies increased, with the antennas and the units themselves becoming smaller. Today, we have cell phones with Bluetooth earpieces and wireless routers for our Internet connections. Our computers have wireless peripherals and we can place wireless printers anywhere in the house. We can lock car doors with a keychain transmitter. And when we drive over a toll bridge, a tracking system can detect us wirelessly. Most houses circuitcellar.com LAND MOBILE RADIO The Land Mobile Radio (LMR) system I’ll cover in this article probably isn’t familiar to most of you. It’s been around for a long time. Most public safety services such as police, fire, and ambulance use it. You have probably seen a police officer with a portable radio strapped to his belt and a familiar speaker/ mic on his lapel. Forestry, railways, trucking companies, and power companies also use FEATURES now have smart power meters that send power consumption data by radio to your local power company. The list can go on into the industrial sector with remote control cranes, trains, and other machinery. With all these wireless products there must be standard data protocols in place to ensure compatibility. The most common are all the cellular protocols, wireless Ethernet 802.11, Bluetooth, and ZigBee. Radios can be narrowband or spread spectrum, hopping or direct sequence, and usually low power without the need for a license. All the wireless control technologies I’ve described thus far have one thing in common. The range of these systems is relatively low as is the RF power output of the radios, and a radio license is not needed. The ISM radio band from 902 MHz to 928 MHz usually allows 1 W maximum RF output. Most 2.4-GHz 802.11 radios are limited to 1 W (30 dBm) of RF output power. Bluetooth and ZigBee devices max out around 100 mW. Remember that the type of antenna also plays a part in the effective radiated power (ERP) output of the systems. These higher-frequency systems need a visual line of site between the transmitting and receiving antennas for maximum distance. This visual line of sight also includes radio line of site where Fresnel zones come into play. 31 PHOTO 2 Kenwood’s NX-700 NXDN 30-W mobile radio is used to receive status messages and control the relay I/O board. The text associated with the status message is displayed upon arrival. the service. The portable handheld radios are usually 5 W with the mobile radios around 30 W and the base stations could be up to 100 W. With this kind of power, radio licenses are needed and frequencies are assigned to each user by a regulatory group, such as the US Federal Communications Commission (FCC) or Industry Canada. Most LMR systems are in the VHF band 136 to 174 MHz or UHF band 400 to 470 MHz. Radio to radio distances measured in miles could be increased when working through a repeater or trunking system. With a repeater placed high on a building or mountain top, you could cover an entire city. The actual radio hardware used in this project are Kenwood’s NX-210 portable (see Photo 1) and NX-700 mobile (see Photo 2), which are capable of analog and digital PHOTO 3 The back panel of the NX-700 mobile radio has access to all the electrical connections. The DB-25 connector contains the RS-232 port which will control the I/O board. The black and red wires power the radio and the female UHF connector on the far left is the antenna input. CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES 32 PHOTO 4 The relay I/O board has eight output relays and eight digital inputs. Terminal strips on the board make it easy to wire in external devices. A test LED is connected to output relay #8 which lights when the relay is energized. modulation. For the most part all vendors manufacturing 12.5-kHz narrowband FM analog radios are compatible with each other, but the digital spec is another story. A joint effort by Icom and Kenwood developed the digital technology Next Generation Digital Narrowband (NXDN) for its line of LMR radios. Another popular digital format is P25 which PHOTO 5 This is the setup I used to build the interface. Interconnects from the radio and single board computer terminate on a common perfboard which gives access to all pin connections. The ribbon cable terminated with a DE-9 female connector plugs into a computer's serial port for diagnostic purposes. A 50-Ω dummy load simulates an antenna connection. is not compatible with NXDN. To maintain product flexibility, Icom and Kenwood also make a P25 line of radios. There are a few modes in which the radios can be programmed. Channels can be set up as narrowband analog 12.5-kHz spacing, narrowband digital, and very narrowband (VNB) digital 6.25-kHz spacing. Due to the very narrow bandwidth of 6.25 kHz, analog transmissions will not work, so digital is the only mode available. The technology of two-way radios has come a long way since their early beginnings. Embedded microcontrollers now control the radios so there is no need for crystal elements, as all frequencies are synthesized and all functions are programmed into the radio using the vendor’s software. Kenwood has given users access to the microcontroller via a serial port on the back of the radio. An ASCII-based protocol over this serial port is used to control the radio which can mimic someone controlling the radio from the front panel buttons. Access to data received by the radio can also be acquired through this port. The DB-25 connector Photo 3 on the back of the NX-700 mobile radio is where this connection is made. A word of caution, the DB-25 is not wired as a standard RS232 port so do not connect it directly to a computer via a serial cable. This connector not only contains a serial port for control and programming, but also another port for GPS connection, audio in, audio out, DC power out, multiple programmable I/O ports, and other functions. FEATURES 34 CIRCUIT CELLAR • OCTOBER 2014 #291 TABLE 1 This is the status list that was programmed into both radios. The list shows the status number and the corresponding text. You can customize the text for you own application. Instead of Relay8 ON you could use Motor ON, Pump ON and name whatever device you are controlling. Number Status Status Name 1 31 Relay1 ON 2 32 Relay2 ON 3 33 Relay3 ON 4 34 Relay4 ON 5 35 Relay5 ON 6 36 Relay6 ON 7 37 Relay7 ON 8 38 Relay8 ON 9 41 Relay1 OFF 10 42 Relay2 OFF 11 43 Relay3 OFF 12 44 Relay4 OFF 13 45 Relay5 OFF 14 46 Relay6 OFF 15 47 Relay7 OFF 16 48 Relay8 OFF 17 50 ALL OFF 18 51 ALL ON 19 61 Input Status 20 62 Output Status 21 63 Ping WIRELESS I/O INTERFACE In this article, I’ll describe how to build an interface that has eight output relays and eight digital inputs which can be controlled by the serial port on the NX-700 mobile radio. Anyone with a properly programmed NX-210 portable radio can now control the eight output relays and monitor the eight digital inputs wirelessly. This will work with narrowband analog, narrowband digital and VNB digital as well as trunking. In Analog mode, the signaling will be MSK, which Kenwood calls Fleetsync, and the Digital mode will be NXDN, which is four-Level FSK. Fleetsync over the air speed can be 1,200 or 2,400 bps, but 1,200 is usually used for better reliability. Narrowband digital NXDN can achieve 9,600 bps and VNB 6.25-kHz bandwidth 4,800 bps. For this project, I used JK Microsystems’s Flashlite embedded DOS 186 single-board computer (SBC) together with its eightchannel relay I/O board (see Photo 4). The I/O board sits on top of the SBC using standoffs and connected together with a ribbon cable (see Photo 5). It has eight normally open SPST relays with a continuous current rating of 5 A and eight optocouplers with an input voltage ranging from 3 to 24 V DC or AC. The Flashlite 186 SBC has a 33-MHz 80186-compatible processor that enables you to write code on your PC in the language of your choice and then upload it to the on-board flash drive. A debug serial port is available that was used to interact with the program during development. The on-board switching power supply accepts an input voltage from 7 to 34 VDC and supplies a 5 VDC output at 300 mA for the user to power external devices— which in this case is the relay I/O board. The software for this project was written in Forth. Using Forth enabled me to get the hardware up and running very quickly. A language called NEXX was written first (in Forth) and then used as my development and debugging environment until the program was working to my satisfaction. NEXX was used to interact with Kenwood’s PC protocol embedded in their radio. The program was then configured to run automatically on power-up. SENDING STATUS MESSAGES FIGURE 1 The schematic shows the radio, Flashlite SBC, and relay I/O board, which are the three main components. There is a minimum of wiring involved to get the interface up and running. The LED which simulates your device to be controlled is powered when relay 8 energizes. To verify power is applied to the LED, input 8 monitors this voltage for positive feedback. Kenwood radios can be configured to send out “status” messages. A status message is basically a number which is transmitted out in the data stream. This number has a text string associated with it in the transmitting and receiving radio. Only the number is sent, but the associated text will show up on the LCD screen of both radios. For analog channels, status numbers are two digits and range from 10 to 99. Status numbers 10 to 79 are general- circuitcellar.com : Match? : nxdn.buf 14 + 3 search.for.string ; purpose and free to use. Status numbers 80 to 99 are reserved for special functions, such as remote kill/stun, horn alert, and emergency man down. Kill/stun will disable the radio or inhibit from transmitting remotely. Digital channel status numbers range from 1 to 207 with 224 to 226 reserved. Some special functions are user programmable and can be mapped to any status number. A list of status numbers and their associated text (16 chars max) is programmed into both the NX-210 hand-held portable radio and the NX-700 mobile radio (see Table 1). The list in the NX-210 portable radio will create an up/down scrolling menu where the desired text can be highlighted with the front panel keypad and then transmitted by pressing the Push-to-Talk (PTT) button. It’s hard for humans to remember a series of numbers so we usually associate the status number with text, which in this case will be the function we want to activate. The status number is sent to the receiving radio in a special data packet with attributes to distinguish it as a status message. The receiving radio takes the status number and displays the corresponding text from its programmed list. If you do not enter any text in the status list, the functions will still work but only the status numbers will be displayed. BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK BREAK FEATURES DO.NXDN.STATUS .” NXDN Status “ buf.pointer 15 - 3 = IF nxdn.buf 14 + 3 type “ 031” Match? IF Relay1 >on .” Relay1 ON” drop “ 032” Match? IF Relay2 >on .” Relay2 ON” drop “ 033” Match? IF Relay3 >on .” Relay3 ON” drop “ 034” Match? IF Relay4 >on .” Relay4 ON” drop “ 035” Match? IF Relay5 >on .” Relay5 ON” drop “ 036” Match? IF Relay6 >on .” Relay6 ON” drop “ 037” Match? IF Relay7 >on .” Relay7 ON” drop “ 038” Match? IF Relay8 >on .” Relay8 ON” drop “ 041” Match? IF Relay1 >off .” Relay1 OFF” drop “ 042” Match? IF Relay2 >off .” Relay2 OFF” drop “ 043” Match? IF Relay3 >off .” Relay3 OFF” drop “ 044” Match? IF Relay4 >off .” Relay4 OFF” drop “ 045” Match? IF Relay5 >off .” Relay5 OFF” drop “ 046” Match? IF Relay6 >off .” Relay6 OFF” drop “ 047” Match? IF Relay7 >off .” Relay7 OFF” drop “ 048” Match? IF Relay8 >off .” Relay8 OFF” drop “ 050” Match? IF ALL.OFF .” All OFF” drop BREAK “ 051” Match? IF ALL.ON .” All ON” drop BREAK “ 061” Match? IF Opto.status drop BREAK “ 062” Match? IF Relay.status drop BREAK “ 063” Match? IF Ping drop BREAK THEN ; LISTING 1 This is a portion of Forth code running on the Flashlite 186 SBC. The heart of the code is a case statement that compares inbound status message numbers to an onboard function list. When a match occurs the function is executed. 35 Need a Free RTOS for Your DIY Project? Use the best. SMX® is now freely available for non-commercial projects. • Learn multitasking and develop your own applications • Free for non-commercial usage • No time limit, No sales contact Y O U R mdi_learningkits_CCI_081014.indd 1 R T O S P A R T N E R • Extensive operating examples and excellent manuals • Work with low-cost boards and free IAR tools www.smxrtos.com/lk 8/15/14 8:54 AM CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES 36 PHOTO 6 This is a constellation diagram showing a strong NXDN digital data stream. A correct symbol received with no error is indicated by a dot within the circle of its quadrant. The receiving radio also gives you access to the status message data packet through the RS-232 port on the back of the radio. This is monitored by the SBC and the program will pick out the status number and activate the desired function on the relay I/O board. For diagnostic purposes, the received data packet is also sent out over a second RS-232 port to a laptop running a terminal program, such as Procomm or Hyperterm. The packet is displayed in Hex with corresponding ASCII values in a sort of protocol analyzer style. STATUS MESSAGE FUNCTIONS Table 1 shows the status list that is programmed into both the transmitting and receiving radios. The list’s function is to display the text associated with the status number that is sent or received. The computer board’s job is to pick out the status number from the received data packet and perform the desired function. You can see from the list that status numbers 31 to 38 will turn on relays 1 to 8 and status numbers 41 to 48 will turn off relays 1 to 8. Status 50 will turn on all eight relays and 51 will turn off all eight relays. Status 61 will send back the status of the eight optocoupler inputs as an 8-bit binary number. A display showing IN->01000001 indicates inputs 1 and 7 are high. Status 62 works in a similar way by sending back the current status of the relays. A display showing OUT->00001100 indicates relays 3 and 4 are energized. The indications sent back are actually text messages that are only sent to the radio that requested it. Each radio has a unique ID number that’s pulled out of the received data packet. This ID is used to target only the requesting radio. Status 63 is the Ping function, which is used to see if the receiving radio is within radio range. A successful Ping will result in “Ping->OK” being displayed. The NXDN protocol has built-in feedback to indicate a successful data link. When a status message is sent from the portable radio, the display shows << SEND DATA >> as the data is sent. The receiving radio sends back an ACK to the requesting radio and << COMPLETE >> appears on the display. If the sending radio does not get an ACK, it tries three times and then displays << NO REPLY >>. This verifies the radio link, but is the relay contact feeding power to your device? The relay coil could be energized, but if the contacts are faulty the device will not turn on. To verify power to your remote device, the eight digital inputs on the relay board could be connected to the devices and then an input status could be requested to verify power. This would give you positive feedback on the field conditions. The schematic in Figure 1 shows an example on how this could be done. HARDWARE & FORTH CODE Photo 5 shows the setup I used to build and troubleshoot the radio interface. The Kenwood NX-700 radio’s DB-25 connector (Photo 3) is terminated on a perfboard mounted on standoffs. Header J10 on the Flashlite SBC, which contains serial port 0, is also terminated on the perfboard. This makes it easy to connect both serial ports together as indicated in the schematic (see Figure 1). Both ports use true RS-232 levels so they are simply connected together. Header J8 on the SBC is the diagnostic serial port and is terminated with a DE-9 female connector as seen in Photo 5. The small pushbutton ABOUT THE AUTHOR Ken Merk ([email protected]) is an electronics technologist with a degree from The British Columbia Institute of Technology (BCIT). He currently works for Canadian Pacific Railway, where he is involved with radio-controlled locomotives and wireless data systems. DESIGN YOUR SOLUTION TODAY CALL 480-837-5200 Touch Panel Computers TS-7250-V2 Embedded Board Panel Mount or Fully Enclosed High Performance & Industrial Grade Series start at Pricing starts at Qty 100 Qty 100 $369 $165 $409 $199 Qty 1 Qty 1 Shown w/ optional micro SD Card Features can include: 5, 7, and 10 Inch Touchscreens Fanless Operation from -20 ºC to 70 ºC Up to 1 GHz ARM CPU, 2 GB RAM, 4 GB eMMC Flash Features: Ethernet, USB, DIO, CAN, RS-232, Modbus, SPI Optional Cellular, WiFi and XBee Radios Supports Android & Linux with Fast Boot Times Modbus Peripherals Standalone Signal Processing TS-1400 Up to 1 GHz ARM CPU 2x USB Host 512 MB RAM 1x USB Device 2 GB eMMC Flash 6x Serial Ports 2x SD Card Socket 75x DIO, 1x CAN 2x 10/100 Ethernet 1x PC/104 Connector Benefits: TS-1420 Hardware Flexibility with On-board FPGA Several control I/O interfaces Launches your application in under a second Easy development w/ Debian and Linux 2.6 GI NA L RI Support every step of the way with open source vision O N -40 ºC to 85 ºC Industrial temperature range PE Embedded systems that are built to endure High Data Reliability with SLC eMMC Flash O GE D We’ve never discontinued a product in 30 years 12x 8 A Power Switches Output Power Monitor 6-Bit PWM Capable RU G LO NG LI FE 6x 24 VDC Auto Relays 2x MODBUS-TW RJ45 Rugged Connectors Unique embedded solutions add value for our customers CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES 38 PHOTO 7 This constellation diagram shows a very weak NXDN signal, which is dominated by noise. All dots not within the circles indicate errors and corrupt data. mounted on the perfboard is connected to one of the I/O pins on the radio. The pin is programmed to be an external push to talk button to key up the radio for test purposes. An external power supply of 12 VDC is used to power the SBC and the radio. Listing 1 shows the heart of the code running on the Flashlite SBC. Here we see a long case statement that matches received status numbers to the desired function. The Forth word Match? searches the serial input buffer nxdn.buf for a status number and compares it to the list in the case statement using search.for.string. If there is a match the function is executed, the name of the function and status number is sent out the diagnostic serial port and the case statement exited using BREAK. This is repeated anytime new data enters the serial input buffer. Sources Flashlite 186 SBC JK Microsystems | www.jkmicro.com NX-210 Portable radio and NX-700 mobile radio circuitcellar.com/ccmaterials Kenwood USA Copr. | www.kenwoodusa.com F-PC Forth 3.6 Tom Zimmer, Forth Interest Group | www. forth.org Normally, the radios described in this article are used for voice transmissions, but there are many other useful features that should be considered. The NX-700 mobile radio can be configured to run in Transparent mode where it basically becomes a data radio. If you need to send RS-232 data wirelessly from one point to another, this could work for you. Input your RS-232 data into the serial port of the radio (DB-25) where it is stored in a text buffer. While the buffer contains data, the radio will automatically key up and send the data to the receiving radio where it will be available on its serial port. When the buffer empties, the radio will stop transmitting and wait for more data. The DB-25 connector on the radio also contains programmable I/O pins. I explained how a pushbutton switch was connected to one of these I/O pins and programmed to be an external push to talk switch. You can configure this button to do many other functions. If you only need to control one relay remotely, you can do so with just the radios. There’s no need for any computer interface. The I/O pin can be programmed to send a status message when the pushbutton is pressed and send another when the button is released. On the receiving radio, an I/O pin can be configured to drive a relay. When the radio receives the button-pressed status message, it will energize the relay. When it receives the button-released status message, it will turn off the relay. I already explained how status messages can be used to activate functions remotely. There are only so many status numbers available to use. To have an unlimited number of controllable functions, you can use text messages in place of status messages. The Kenwood NX-210 portable radio is capable of sending text messages entered on the front keypad. A specific text string can be sent and compared at the receiving end to activate a function. If you send “Function1” as a text message, it will turn on the test LED on the Flashlite SBC. Function2 will turn off the LED. I have included these in my code just for testing and demonstrating purposes only. To really grasp the capabilities of this interface it is necessary to become familiar with the operations and programming of Kenwood’s NXDN line of radios. This is all available in their programming and user manuals available from any authorized Kenwood dealer. FOUR-LEVEL FSK NXDN is a digital over the air protocol that takes voice and implements a vocorder (AMBE+2) to digitize it into a data stream. Forward error correction is introduced and circuitcellar.com Instead of using audio tones, NXDN shifts the carrier frequency of the radio transmitter to create symbols or transitions and each symbol carries 2 bits of information. A deviation of +1,050 Hz represents binary 01, +350 Hz binary 00, –350 Hz binary 10, and –1,050 Hz binary 11. Photo 6 shows a NXDN data stream being received by a piece of test equipment and showing the results in a graphical form called a constellation pattern. You can see four quadrants which represents four of the symbols I just described. Each quadrant is labelled with the frequency deviation of each symbol. When a carrier deviation is detected, it is plotted in one of the quadrants as a dot. If the dot is within the circle seen in each quadrant, it is within spec and considered good data. Photo 6 shows a strong signal and no errors in the data stream. Photo 7 shows a weak signal where noise is introduced to create errors which show up as dots not within the circles. This is a little insight into the technology used in the NXDN protocol. You do not need to know all the details to set up the radio interface I described in this article. But it is something to think about. Wide Temp. Panel PC PPC-090T l Vortex86DX2 933MHz Fanless l Up to 1GB of Onboard Memory l Low Power Consumption l 2 RS232/422/485 serial ports l 3 USB 2.0 Host Ports l 10/100 BaseT Ethernet l PS/2 KB port, Audio Out l Compact Flash Slot / SD Slot / SATA l 9 inch 1024 x 600 WSVGA TFT LCD l Resistive Touch Screen l DC-IN +12VDC / +24VDC l IP65 Front Panel l Wi-Fi (Optional) l Giga Ethernet (Optional) l Wide Temperature (Optional) 3.xx KERNEL The PPC-090T comes ready to run with the Operating System installed on flash disk. Apply power and watch the Linux X-Windows desktop user interface appear on the vivid color LCD. Interact with the PPC-090T using the responsive integrated touchscreen. Everything works out of the box, allowing you to concentrate on your application rather than building and configuring device drivers. Just Write-It and Run-It... Pricing starts at $495 for Qty 1. http://www.emacinc.com/sales/cc9 Since 1985 OVER 29 YEARS OF SINGLE BOARD SOLUTIONS EQUIPMENT MONITOR AND CONTROL Phone: (618) 529-4525 · Fax: (618) 457-0110 · www.emacinc.com FEATURES this data stream is used to modulate the transmitter using four-level frequency shift keying (FSK). The receiver takes this data stream and converts it back to audio as voice. Early phone modems used FSK to send data over phone lines to access other computers. A certain audio frequency tone was sent to represent a binary 1 (mark) and another frequency to represent a binary 0 (space). The tones of the FSK are sometimes called symbols. The transition from one tone to the other represents one bit of data, which is 1 baud. The rate at which the transitions occur is called the baud rate. Back then the baud rates were slow, so a 2,400-baud modem produced 2400 bps. To increase the data rate, you would increase the rate of transitions, but this only worked up to a certain point. You can only transition so fast until you exceed the bandwidth of the phone line or radio. If you could send 2 bits per transition, your bits per second would increase and the baud rate would stay the same. Four-level FSK achieves this by sending 2 bits per symbol (transition). When you do this, the terms “baud rate” and “bps” are no longer interchangeable. We could have a 1,200-baud modem sending out 9,600-bps data streams. 39 40 CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES AC Monitor Want a simple, straightforward way to determine voltage values? With the circuit described in this article, you can quickly tell if voltage is low, nominal, or high. The circuit uses an LM3914 and a 10-segment LED bar to display a range of voltage values. By Larry Cicchinelli (US) H ave you ever wanted a simple visual indication of a voltage value? For instance, wouldn’t it be useful to be able to tell, with only a quick glance, if a voltage is low, nominal, or high? The circuit I’ll describe in this article may be just what you are looking for (see Figure 1)! By selecting the appropriate resistor values, you can monitor just about any voltage and voltage range and show its value with a nine- or 10-segment bar graph. The circuit shows you how to use a well-known IC, the LM3914, with a 10 segment LED bar to display a range of voltage values. DISPLAY DRIVERS The National Semiconductor (now Texas Instruments) LM3914 is one of a family of three display drivers in which the only difference among them is how the internal voltage divider is configured. Each IC has a 10-tap voltage divider with a comparator on each tap. The LM3914 is linear, the LM3915 is logarithmic with 3-dB steps, and the LM3916 is also logarithmic but scaled like a VU meter. The units can be operated in either of two modes: Dot mode, where only a single LED is on, or Bar mode, where all lower value LEDs are also on. The indicated website has complete specs as well as some application notes on the device. The drivers can be used individually or cascaded in order to create a display with a larger range. In an article titled “Calibrated Decibel Meter Design” (Circuit Cellar 236, 2010), I explained how I used two display drivers (LM3915 and LM3916) in cascade for a multirange audio level meter. The circuit I describe in this article uses a single driver to show whether or not the monitored voltage is near its nominal value. CIRCUIT OVERVIEW This specific implementation is used to monitor the line voltage coming into my home. I use a 9-V AC wall wart to step the voltage down to a more manageable level, followed by a 3:1 voltage divider. I used a Variac to characterize the wall wart and the rectifier circuit. The results are shown in Table 1. The wall wart I used is rated at 9 VAC and 300 mA. Its open circuit voltage is about 16 V (with 120-V input) and it drops off significantly with even a light load. I ensured a constant load by selecting the LM3914’s Dot mode. One of the circuit’s limitations is that voltages beyond the range limits will not be displayed. The LM3914 has a built-in 1.2-V reference that can be used to develop the comparator references. It is configured using the same method as the popular LM117 series of AN ELEKTOR INTERNATIONAL MEDIA PROMOTION Get Started with Advanced Control Robotics By C. J. Abate (Content Director, EIM) ADVANCED CONTROL ROBOTICS HANNO SANDER I met Hanno Sander in 2008 at the Embedded Systems Conference in San Jose, CA. At the time, Sander was at Parallax’s booth demonstrating a Propeller-based, two-wheeled balancing robot. When I saw his interesting balance bot design and his engaging way of explaining design to interested engineers, I knew that Sander would be an excellent resource for future Circuit Cellar content. I was right. Several months after the conference, we an article ADVANCED CONTROL published he wrote about the balancing robot project (Circuit Cellar March 2009). Today, HANNO SANDER Sander runs OneRobot with the aim of “building high-quality, affordable products by pushing offthe-shelf components to their limits.”1 ROBOTICS THE FUTURE IS NOW When it comes to robotics, the future is now. With the ever-increasing demand for robotics a p p lic a tio n s—f r o m home control sysTitle: Advanced Control Robotics tems to animatronAuthor: Hanno Sander ic toys to unmanned Publisher: Elektor/Circuit Cellar planet rovers—it’s an Year: 2014 exciting time to be a Buy: www.elektor.com/advancedroboticist, whether control-robotics you’re a weekend DIYer, a computer science student, or a professional engineer. It doesn’t matter whether you’re building a line-following robot toy or tasked with designing a mobile system for an extraterrestrial exploratory mission: the more you know about advanced robotics technologies, the more you’ll succeed at your workbench. Advanced Control Robotics is intended to help roboticists of various skill levels take their designs to the PARALLAX PROPELLER ADVERTISEMENT next level with microcontrollers and the know-how to implement them effectively. THEORY & BEST PRACTICES Advanced Control Robotics simplifies the theory and best practices of advanced robot technologies. You’re taught basic embedded design theory and presented handy code samples, essential schematics, and valuable design tips (from construction to debugging). LEARN THEN DESIGN The principles described and topics presented in Advanced Control Robotics are immediately applicable. With the book at your side, you’ll be innovating in no time. Sander covers: • Control Robotics: robot actions, servos, and stepper motors • Embedded Technology: microcontrollers and peripherals • Programming Languages: machine level (Assembly), low level (C/BASIC/Spin), and human (12Blocks) • Control Structures: functions, state machines, multiprocessors, and events • Visual Debugging: LED/speaker/ gauges, PC-based development environments, and test instruments • Output: sounds and synthesized speech • Sensors: compass, encoder, tilt, proximity, artificial markers, and audio • Control Loop Algorithms: digital control, PID, and fuzzy logic • Communication Technologies: infrared, sound, and XML-RPC over HTTP • Projects: line following with vision and pattern tracking Are you ready to start learning and innovating? Order Advanced Control Robotics today. 1OneRobot.org/about CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES 42 FIGURE 1 R3, R5, and R7 are optional. You can use them to modify the adjustment range of the potentiometers. I used the values in this schematic for my AC monitor. VIN (VRMS) VOUT(meas) VOUT(calc) % Error 100 10.33 10.25 -0.75 105 10.90 10.79 -0.97 110 11.20 11.34 1.21 115 11.80 11.88 0.65 120 12.35 12.42 0.55 125 12.94 12.96 0.15 130 13.55 13.50 -0.36 135 14.11 14.04 -0.48 TABLE 1 This table shows the characteristics of the wall wart I used to drive my monitor. The measurements were taken while it was driving the circuit. The VOUT(meas) values are the same voltages that are applied to the 9 VAC voltage on H1 in Figure 1. The 9 V is not fixed; it changes with the wall voltage. voltage regulators. However, another of the LM3914’s features is that the LED current is approximately 10 times that of the REF OUT pin current. Also, note that the resistance of the voltage divider chain in the IC can vary from 8 to 17 kΩ. These two characteristics could have made it more difficult to set up the voltages I wanted to use for my upper and lower references. Because of this, I decided to use an external voltage reference of 5 V. The voltage divider with its two pots (R4 and R6) allow for setting the upper and lower limits SOURCES DipTrace Schematic and PCB software www.DipTrace.com circuitcellar.com/ccmaterials National Instruments (now Texas Instruments) LM3914 Texas Instruments | www.ti.com/product/ lm3914#relprod quite easily. The low values of the divider resistors were chosen in order to ensure that the voltage set points are relatively unaffected by the divider chain in the LM3914. I chose to use a 5-V regulator so that the unit can be powered with a voltage as low as 6.5 V. The LM3914 will operate with a supply as low as 3 V, but the upper voltage reference must be at least 1.5 V lower than the supply. Note that Figure 1 indicates that R3, R5, and R7 are optional. Depending on your specific application, you may want to use them to modify the adjustment range of the potentiometers. The values indicated in the schematic are those that I used for my AC monitor. There is an optional resistor (R9) that can be installed on the lowest LED of the LED bar, which enables it to be used as a power on indicator. If you do install R9, then the LED will always be on, but it will get brighter if the applied voltage is within the range of the lowest comparator. There is an optional jumper (Jmp1) that enables you to change the operation from Dot mode to Bar mode. For this type of application, I believe that Dot mode is more appropriate. The 1.2-kΩ resistor (R8) on the REF_OUT pin “programs” the LED current to approximately 10 mA. Both potentiometers specified in the bill of materials are single-turn and adjustable from the top. I happened to have some small multiturn pots in my parts bin, which I used. The pin spacing of the parts I used easily fit into the pattern for the single turn pots. PRINTED CIRCUIT BOARDS I designed two PCBs for this circuit: one with all through-hole components and one with SMD resistors and capacitors. The “mostly” SMD board still uses the DIP versions of both the LM3914 and LED array. It also uses the through-hole part for the voltage regulator because the SMD part actually takes more board space. I did the SMD board mainly to see if it would yield a smaller PCB. As it turned out, both boards are exactly the same size. I had to add some ground vias on the SMD board because I could not run traces between components. I probably could have made the SMD board smaller by putting components on both sides of the board, but I wanted to have all the traces for the two DIPs on the bottom so that I could etch my own board and not have to worry about not having plated through holes. I calibrated my unit so that LED 1 turns on solid at 108 VAC and LED 10 is on at 135 VAC. This yields a span of about 3 V per LED and with LED 5 turning on at 120 VAC. You can see in Photo 1 that LED 6 is on solid and that LED 7 is starting to come on. This indicates circuitcellar.com PHOTO 1 LED 6 is on solid and that LED 7 is starting to come on, which indicates that the voltage is a little higher than 123 VAC. that the voltage is a little higher than 123 VAC, probably about 124 VAC, which is what I measured with my DVM. KEY COMPONENTS FEATURES All of the parts listed on the BOM are from DigiKey except H1. If you send a check with the order you will not have to pay shipping charges, but be sure to include whatever sales taxes are appropriate. The BOM does not list an enclosure. I used one from my stock of parts. It looks like it is a small aluminum project enclosure from Radio Shack, which I spray painted dark blue. H1 and its associated parts are from Jameco. I use these headers and associated parts, for the interconnections on most of my projects so I have quite a few on hand. For this project, it is probably not worthwhile to purchase the parts necessary for this connector. I would just solder leads from whatever voltage source you are monitoring to the pads for this header. Schematics and PCB layout files for both versions are available for download from my website, www.qsl.net/k3pto/. I use DipTrace (www.DipTrace.com) for all of my designs. There is a fully functional free version available if you want to try it. ABOUT THE AUTHOR Larry Cicchinelli holds a BSEE from the Drexel Institute of Technology and an MSES from Pennsylvania State University. He was technical support manager at ZWorld, Rabbit Semiconductor, then Digi International (Rabbit Brand) from 2000 to 2012. From 1967 to 2000, Larry worked for Ford Motor Company. He has been licensed as K3PTO since 1961. Circuit Cellar published Larry’s book, Assembly Language Essentials, in 2011 (www.cc-webshop.com). RS485/422/232/TTL ASC24T IBS485HV RS232<=>RS485 ATE Converter 5 Port Isolated RS485 Repeater $349.00 $45.00 board only Enclosur es, Cables, Power Supplies and Other Accessories INTRODUCING THE SMFCOMX! • Converters • Repeaters • Multi-Repeaters • Hubs • Fiber Optics • Isolators 43 • Extended Distance Units • Serial to Digital I/O • Large Multi-Drop Networks • Custom Units & Smart Units • Industrial, 3.0 KV Isolation Call the RS485 Wizards 513-874-4796 www.rs485.com 44 CIRCUIT CELLAR • OCTOBER 2014 #291 THE CONSUMMATE ENGINEER COLUMNS The Not So Humble Capacitor Capacitors are important passive, two-terminal devices in electrical circuits. The more you know about have these components the better you’ll do when designing electrical systems. This article details common capacitor types and covers basic capacitance-related equations. By George Novacek (Canada) G erman Ewald Georg von Kleist invented the capacitor in 1745. The Dutch engineer Pieter van Musschenbroek improved it a year later. The capacitors were called Leyden Jars after the University of Leiden. In this article I’ll reintroduce you to the capacitor by detailing common capacitor types and covering basic capacitance-related equations. CAP BASICS In most electronic circuits, capacitors are just as abundant as resistors. Capacitors are passive, two-terminal devices. Their fundamental principle of operation is the storage of energy in an electric field. In terms of their construction, they comprise two conductive plates with an insulator between them. The insulating dielectric material— which includes air—affects many parameters, such as the capacity with respect to the plates’ areas and distance, temperature characteristics, working voltage, size, and so forth. Figure 1 shows commonly used capacitor types’ schematic diagram symbols. When there is a potential difference (i.e., voltage between the capacitor plates), an electric field develops across the dielectric with positive and negative charge collected on the respective plates. No DC current flows through a fully charged, ideal capacitor. Such a capacitor is described by its capacitance: C= Q/V. The unit of capacitance is one farad (F), which is one Coulomb (the unit of electrical charge) per volt. Figure 2 shows a capacitor being charged by a DC current. The capacitor voltage V(t) increases exponentially—as is expressed in the following equation—until it reaches the battery voltage V BAT less one electron. V (t ) = Vbat (1 − e − t RC ) The product of R times C is referred to as time constant RC, which is used when calculating the charge and discharge voltage with respect to time, such as in timers or filters. In AC circuits, the capacitor behaves as a reactance, where “i” is an imaginary unit with the property of i2 = –1. Z =− i 2π fC It indicates that the AC voltage lags the AC current by 90°. In electrical engineering, “j” is often used instead of “i” to prevent confusion with the sign for immediate current. RC filters behave according to the ratios of resistive to reactive impedances. Circuits where both a capacitance and an inductance are present act as resonant (tank) circuitcellar.com circuits, resonating at a frequency where both the capacitive and the inductive impedances are equal. The resonant frequency is: f = FIGURE 1 Fixed, polarized and variable capacitor schematic symbols + 1 2π LC Unlike resistors, capacitors connected in parallel add their capacitances: Fixed Polarized Ctotal = C1 + C2 + C3 + ... + Cn Variable FIGURE 2 Charging capacitor by DC current R Ctotal = 1 1 1 1 + + + ... + C1 C2 C3 Cn To calculate the resulting capacitance for two series capacitors ( just like for two parallel resistors), you can use a simplified formula: Ctotal C1× C 2 = C1 + C 2 ESR VS. ESL Capacitors store or release energy. There is no energy dissipated in ideal capacitors. Therefore, no heat is generated. V(t) C VBAT COLUMNS In series, the inverse capacitances are added: 1 45 Unfortunately, no capacitor is perfect due to parasitic properties such as leakage of the dielectric, leads resistance, inductance, and so forth. Consequently, there is some energy dissipation as one would see with resistors. Specifications of polarized capacitors state the equivalent series resistance (ESR). This is not an actual resistance, but has the same effect, adding a real component to the capacitor’s TABLE 1 Standard capacitor values pF pF pF nF nF nF µF µF µF G G 1.0 1.1 1.2 1.3 1.5 1.6 1.8 2.0 2.2 2.4 2.7 3.0 3.3 3.6 3.9 4.3 4.7 5.1 5.6 6.2 6.8 7.5 8.2 9.1 10 11 12 13 15 16 18 20 22 24 27 30 33 36 39 43 47 51 56 62 68 75 82 91 100 110 120 130 150 160 180 200 220 240 270 300 330 360 390 430 470 510 560 620 680 750 820 910 1.0 1.1 1.2 1.3 1.5 1.6 1.8 2.0 2.2 2.4 2.7 3.0 3.3 3.6 3.9 4.3 4.7 5.1 5.6 6.2 6.8 7.5 8.2 9.1 10 100 1.0 10 100 1.0 10 15 150 1.5 15 150 1.5 15 22 220 2.2 22 220 2.2 22 33 33 3.3 33 330 3.3 33 47 470 4.7 47 470 4.7 47 68 680 6.8 68 680 6.8 68 F Capacitances from about 0.047F up to about 10,000F exist 46 CIRCUIT CELLAR • OCTOBER 2014 #291 COLUMNS PHOTO 1 Different types of capacitors impedance. In applications such as switching regulators, low ESR is critical for efficient operation. Capacitor leads add parasitic inductance to the characteristics. This is called equivalent series inductance (ESL). The ESL becomes important at high frequencies as it can cause unwanted resonances. UNITS ABOUT THE AUTHOR George Novacek is a professional engineer with a degree in Cybernetics and Closed-Loop Control. Now retired, he was most recently president of a multinational manufacturer for embedded control systems for aerospace applications. George wrote 26 feature articles for Circuit Cellar between 1999 and 2004. Contact him at gnovacek@nexicom. net with “Circuit Cellar”in the subject line. The unit of capacitance is one farad, which is an extremely large capacitance. Only in recent years have super-capacitors (also called ultracapacitors) with capacitances on the order of several farads become available at reasonable prices. The capacitance values commonly used range from 1 pF (picofarad = 10 –12 F) to several millifarads (1 mF = 10 –3 F). A millifarad is commonly designated as 1 G. Strictly speaking, this is incorrect. Historically, schematic diagrams showed capacitor values without a unit. The convention was that such values were automatically considered in microfarads (1 µF = 10 –6 F). And since 1 mF = 1,000 µF, those values were called gigafarads (G). CAP NOMENCLATURE This brings us to the nomenclature. In North America capacitor values were understood to be in microfarads, unless a unit was specified. This was generally for capacitances from 1,000 pF (0.001 µF) and larger. Below 1,000 pF, just as in Europe, a “p” or “pF” (meaning picofarad) is used. From 10 –9 to 10 –6 F, the unit nanofarad (nF, or just n or sometimes k, which means thousand picofarads) is used. Some prefer to designate RESOURCES Cardwell Condenser, http://cardwellcondenser. com/. N. Gruending, “Varactor Diodes, Weird Component #6,” Circuit Cellar 287, 2014. circuitcellar.com/ccmaterials G. Novacek, “Impedance Matching,” Circuit Cellar 281, 2013. values between 100 n and 1 µF as a fraction of a microfarad. A microfarad (µF, uF, or u or M) is 10 –6 F to 10 –3 F. Above 10 –3 F, we use G and super-capacitors are in Farads (F). It should also be noted that, similar to resistor values, European designations do not always use a decimal point. A 2.2 µF capacitor could be identified as 2.2 in an American style diagram, while in an European diagram it could also be 2M2 or 2u2. A 0.022 capacitor would be designated as 22n, while 0.0022 would be 2n2. Over the years, I’ve seen a trend away from the American MIL style designations towards the European style. Table 1 shows generally available capacitor values. CAP STYLES There are three fundamental styles of capacitors: fixed, polarized, and variable. Let’s cover each one. Fixed capacitors are found in electronic circuits in great numbers as by-pass capacitors, members of RC networks in timers and filters, and so on. Every integrated circuit (IC) should have at least one bypass capacitor. The energy they store filters out digital circuits’ switching transients, bypasses power supply noise to ground, and suppresses ground loops. Other than for bypassing, there is not much use for capacitors in digital circuits, but they are essential as storage devices in power supplies. In analog circuits capacitors are instrumental in bandwidthaltering filters, transient protection, timing circuits, decoupling and blocking DC current while allowing AC current to pass. Polarized (i.e., electrolytic) capacitors are mainly used in power supplies because of their large capacitance-versus-volume ratio. The most common are aluminum and tantalum capacitors. Storage capacitors, especially in switching power supplies, need low ESR to minimize the losses at high switching frequencies. In 60- or 50-Hz rectifiers, the ESR is generally not critical. A common task is to determine the size of a storage capacitor to maintain a system operation during a power interrupt. The allowed voltage drop during the interrupt is small compared with the full operating voltage, so the differential equation can be linearized and the needed capacitance is C = (I × t)/V. Note that I is the average current drain in amps, V is the allowed voltage drop in volts, and t is the maximum duration of the power interrupt in seconds. Variable capacitors fall into two categories. Trimmer capacitors, analogous to resistor trim potentiometers, are shown in Photo 1. The two capacitors in the center use air for the dielectric. Trimmers with solid dielectrics (the yellow stubby cylinder) are smaller, circuitcellar.com VARICAPS Varicaps are diodes that exhibit capacitance dependent on the magnitude of their negative bias. The major limitation of varicaps is that the radio frequency (RF) signal they are tuning into resonance must be small compared to the bias to minimize modulating of the set capacitance. This can be to some COLUMNS usually less expensive and have lower quality factor Q. Typically, trimmers come in the 1 to 50 pF range. Variable capacitors, such as the one shown in Photo 2, are no longer as prevalent as they once used to be. Often used in radios, these tuning capacitors comprised several separate capacitors on a single shaft. The capacitor in Photo 2 has two sections for the AM band and four for the FM band. These capacitors were bulky, heavy and costly, although cheap units made with a solid dielectric were available too. Worse, they couldn’t be electrically adjusted, short of using a complicated electromechanical subsystem. This was a fundamental requirement for scanners and synthesized digital tuners found in essentially every modern receiver. This dilemma has been solved by the arrival of varactor diodes, also known as varicaps. degree alleviated by using two varicaps backto-back, but when a large voltage is needed across the tank circuit, it is the old technology we must revert to. Variable capacitance principle is used in numerous sensors, but this is a subject for another article. I hope you found this review of capacitors useful as I have. The more you know about how they work, the better you’ll implement them in your future designs. PHOTO 2 Air tuning capacitor The Premier Business Development Event for the Global Robotics Industry October 15-17, 2014 Meet industry leaders, investors and new customers who can accelerate your business at this one-of-a-kind event. Hynes Convention Center Boston, MA Join over 1,200 industry leaders for: Register Today! robobusiness.com 800-305-0634 SAVE OVER 10% when you register by October 14 Use Code RB2003 • • • • 2 Intensive Workshops: Industrial Robotics & Startups 32 Targeted Conference Sessions 7 Visionary Keynotes from Global Industry Leaders Extensive Networking Opportunities Is your time in Boston limited? Expo Pass now available for October 16 only. Visit robobusiness.com for details. Founding Sponsor Media & Association Partners 47 Platinum Sponsors Gold Sponsor Premier Analyst Sponsor 48 CIRCUIT CELLAR • OCTOBER 2014 #291 EMBEDDED IN THIN SLICES COLUMNS Linux System Configuration (Part 3) Build Your Linux System This is the final installment in a multipart article series dealing with configuring Linux for embedded systems. In this article we will look at some of the ways available to you to build the embedded Linux system you need. By Bob Japenga (US) F all is in the air and it is the time of the year I love best—especially in New England. Contrast that with building a new version of embedded Linux for a project. As a manager, I cringe every time one of my teammates tells me that they need to build (for the first time) a new version of Linux. There were times when we designed a board from a reference design and built everything from a ready-made distribution from the chip maker. That was easy. A couple of quick cookbook-style steps here and there. Perhaps configuring a new flash memory chip or RAM chip. Compile. Build. Done. Simple. But then, at some point later, we discovered that our version of Linux didn’t have the driver we needed for some piece of hardware or it didn’t support some software functionality. This recently happened to one of our customers who delayed implementing a software function until late in the project. When we were asked to implement it, they already had special drivers that only worked with their version of Linux to interface to their proprietary hardware. But they needed a streaming video USB gadget that wasn’t in their version of Linux. We had a dilemma. We had to either bring all of the proprietary code over to a new version of Linux or back-port the code from a later version of Linux into the older version. It was time for the antacid. There was no easy answer. We knew cost overrun and schedule slips were imminent. This can happen, and it is painful. Very often, the chip manufacturers don’t mainstream their changes (i.e., put them into a stable release at kernel.org). That can be understandable in the fast-paced world of hardware development. If asked, they will say that they haven’t done it yet. If you have to bring that code into a new version of the kernel, you will need to bring all of their changes that they made to get the reference design running into the new kernel. One time we used a reference design and very late in the life cycle discovered a bug in the C library. The manufacturer not only didn’t mainstream their changes, they couldn’t find the source code they used for the C library. What a nightmare. These days we are smarter and things are a little easier. Thanks in part to OpenEmbedded, Yocto, and Ångström. This month I’ll cover each of these. We have used all three. There are other options, like Linux From Scratch, but since we are only examining it in thin slices, I am only going to cover the slices we have actually used. OPENEMBEDDED In Part 2 of this article series, we discussed the concept of a Linux distribution. These are things like Ubunto, Fedora or, in the embedded circuitcellar.com BITBAKE In the past, developers have used makefiles to build the Linux kernel and the associated applications. The kernel was configured as discussed in my June 2014 article, in which I described using script files to tie the whole process together. We used this method on many projects early in our deployment of Linux. Once in place, it worked okay. The problem came when we had to make changes to the version—of either the kernel or its associated libraries or the applications. Another problem had to do with the tool chain. The tool chain needs to be part of the build process during development. A different tool chain can result in your source code not building or building properly. Only once have we used the same build process from one Linux project to another. And that was because the hardware was identical. This is a significant problem. The OpenEmbedded organization was formed to help us with that. What OpenEmbedded brought to the table was a new tool and specified a new language to define the architecture. That tool was BitBake. Think of BitBake as make on steroids. The inputs to BitBake are called “Recipes.” BitBake takes recipes and metadata to create a complete Linux distribution. It is not necessary to have a build script (i.e., write code) to create most distributions. The language is powerful enough to do everything you need. And if it has shortcomings (they all do), it does allow you to use Python to create more complex operations. It is flexible enough to handle multiple hardware architectures and helps you to manage and create multiple releases for those targets. METADATA So what is this metadata that BitBake uses? Think about what you need to know to create the Linux kernel. You need a configuration file. You need to know where your tool chain is to compile and build the kernel. You need to know where the source files are located. Ideally, they should be available on the Internet. You need to know complier options. And you need to know a series of dependencies (i.e., if you change this file, other files need to change). Building a package has all of the same requirements. All of this gets wrapped up in what is called the metadata. RECIPES Okay, you are saying: “This is sounding a little cheesy.” Baking. Recipes. What are these recipes? If BitBake is make on steroids, recipes are makefiles on steroids. A given recipe tells BitBake exactly the who, what, where, and how for building a particular package. Who is the name of the package. What is the type of package. Where is the location. And then How to build it. The end result is a file system image and a kernel image that you can put on your target system. YOCTO Wow! That sounds great. But what’s lacking? Why did Yocto need to come along? Basically, Yocto picks up where OpenEmbedded left off. More heavily funded, it accomplishes all of the same goals that OpenEmbedded set out to attain. But Yocto relies heavily on two things from OpenEmbedded: BitBake and the metadata. OpenEmbedded remains a separate organization from Yocto and is concentrating on making BitBake better and providing metadata for a host of architectures. Yocto is concentrating more on the tools and the board support packages (BSP) for a wide variety of architectures and processor boards. For example, OpenEmbedded maintains the metadata for something like the BeagleBoard and the Raspberry Pi boards, but the Yocto project is the place to get the BSP. Another way to look at Yocto is to think of it as a place where silicon providers like Atmel, Texas Instruments, and Freescale can create a common framework for the release of Linux for their new processor or core. For us as users, that is a win-win situation. Another benefit for developers occurs when we choose to use a commercially supported release of Linux. Perhaps we need to meet the FDA requirements for Software of Unknown Provence (or Pedigree) (SOUP). Yocto helps because all of the major vendors are members of Yocto. So, if you do all of your development on a particular Yocto version and then need the kind of support that these commercial packages COLUMNS world, Ångström. A distribution is a complete set of tools, the kernel, the packages, and the build instructions to create a version of Linux. OpenEmbedded provides you the framework to enable you to create your own distribution. From the name, you will gather that it specializes in creating an embedded version of Linux, which is very different than starting with a distribution like Ubunto. The problem for us as designers is how to create a distribution for our project. Over the years, we have seen a number of attempts to help us. The OpenEmbedded project was a big step forward in this process. I won’t bore you with the history of how this evolved, but the major contribution that the OpenEmbedded organization provided to our community was the development of BitBake and the structure for metadata used to define your system. Let’s look briefly at each of these. 49 50 CIRCUIT CELLAR • OCTOBER 2014 #291 reference design or an SBC that is supported by Ångström, you will probably have the most tools and flexibility for maintaining your design throughout its lifecycle. ABOUT THE AUTHOR COLUMNS Bob Japenga has been designing embedded systems since 1973. In 1988, along with his best friend, he started MicroTools, which specializes in creating a variety of real-time embedded systems. With a combined embedded systems experience base of more than 200 years, they love to tackle impossible problems together. Bob has been awarded 11 patents in many areas of embedded systems and motion control. You can reach him at [email protected]. STICK WITH LINUX provide, you can seamlessly switch. This is not true if you use just any old distribution. We found this on one project when we evaluated going to a commercially supported version of Linux from Wind River. We were evaluating this because of the processes and documentation that they provided for FDA approval of a medical product. Going with the commercially supported release was going to save us considerable time and money for documentation. The problem was that we used a version of the kernel from Texas Instruments that came with our development kit and that version was not supported by Yocto. Creating a new distribution for the closest version supported by Wind River would probably cost more than the benefit received by having the documentation and support provided by Wind River. ÅNGSTRÖM If all of these names haven’t gotten your head spinning, let’s just talk about one more. Ångström heavily relies on OpenEmbedded and Yocto to create a distribution specifically targeted for embedded systems. It is highly scalable. It can run on a device with as little as 4 MB up or on a system with several terabytes. But of course the question is, what can it do with only 4 MB? There are a host of off-the-shelf boards that it supports including the popular BeagleBoard and Beagle Bone open source hardware platforms as well as the Raspberry Pi. So, if you are using a Where are we to begin as system designers? We are offered a plethora of choices. Let’s consider them in order of decreasing complexity resulting in decreased cost and time: we can certainly build Linux and the subsequent applications from kernel. org; we can use a tool like “Build Linux from Scratch”; we can use a board-support package provided by a hardware vendor that is not part of Open Embedded, or from one that is part of Open Embedded; we can build our design using a project already supported by Yocto; or we can start with an existing distribution (Ångström, or Ubunto, or Debian) and go on from there. Our experience is that the cost savings across the life cycle are significantly larger the later we go in that list of options. A few years back, hardware venders of x86 SBCs could tout simplicity by providing an SD card or Compact flash with Ubunto or Debian on it. Everything was there for you. You could concentrate on your killer application. Today, with Ångström, you can have that for a wide range of processors and for specifically an embedded system. If you are rolling your own hardware based on a reference design, make sure the silicon provider is using OpenEmbedded and ideally has created a Yocto project. We have come a long way in developing easier ways to create, modify, and maintain embedded Linux systems. We still have a long way to go to achieve the full potential that Linux offers. Sometimes, the very issues I covered in this article make me want to stop using Linux. But then where else would I go? Hopefully, this article series has helped you better understand how to configure the kernel, select and build the applications, and finally put together a distribution for your next embedded Linux project. Of course, only in thin slices. RESOURCES circuitcellar.com/ccmaterials Ångström, www.angstrom-distribution.org Open Embedded, www.openembedded.org BeagleBone, http://beagleboard.org/bone Ubuntu, www.ubuntu.com BeagleBoard, http://beagleboard.org Wind River Linux, www.windriver.com/products/linux.html Fedora, https://fedoraproject.org Yocto, www.yoctoproject.org Linux from Scratch, www.linuxfromscratch.org Raspberry Pi, www.raspberrypi.org CC Vault Unlock the power of embedded design. This pocket-sized vault comes fully loaded with every issue of Circuit Cellar magazine and serves as an unparalleled resource for embedded hardware and software design tips, schematics, and source code. From green energy design to ’Net-enabled devices, maximizing power to minimizing footprint, CC Vault* contains all the trade secrets you need to become a better, more educated electronics engineer. BONUS! Build your archive by downloading your latest-issue PDFs straight to the drive! Personalize your CC Vault by adding Elektor or audioXpress issue archives, available as an add-on during time of purchase, or your very own project files. *CC Vault is a 16-GB USB drive. Order yours today! cc-webshop.com 52 CIRCUIT CELLAR • OCTOBER 2014 #291 RETRONICS Elektor ComputerScope (1986) FEATURES Goodbye Green-Only ‘Scope CRT Almost 30 years ago, a trainee at Elektor Labs designed an ambitious test instrument like an oscilloscope with PC support. By Jan Buiting (Editor in Chief, Elektor, The Netherlands) B ack in 1986 at the crowded Elektor Electronics laboratory, somebody approved the idea proposed by a young Dutch BSc graduate of Electronics to make an oscilloscope add-on for personal computers. I had been appointed as an assistant editor just months before, and being able to wield an electric typewriter and an English Dictionary, I was asked to write a deft letter to ITT Semiconductors of Freiburg, Germany, asking for a few samples of their latest UVC3101 device. I was told it was a “high-speed” ADC and DAC in one chip and “difficult to get.” I got a favorable reply by telephone from Reinhard W. Preuss, the most officious and gentlemanly PR and Press Officer I have come across in the electronics scene these past 25 years. A few days later the ICs arrived, complete with engineering notes. The lot allowed Rene van Linden to start designing his ComputerScope project and hopefully complete his BSc. thesis. TIME PERSPECTIVE In those days it was hot to make computers do things other than the usual spreadsheeting, PacMan’ing, word processing and ASCII art doodling. It was the exciting era of the BBC Micro, the Acorn Electron, Philips MSX and the first IBM PC clones starting to appear in households and in electronics engineers’ workshops. It was a time also when computers were totally accessible in terms of hardware and software. As long as a computer had a port of some sort using an easy to obtain connector, engineers, British school children and Elektor trainees got into developing peripherals the computer manufacturers could not have foreseen. There was a lot of POKE(16xxx) going on at that time. In the case of the Elektor ComputerScope, the idea was to make a personal computer handle the visualization of measured data on its monitor with composite video input. Paradoxically, that monitor had a CRT just like the traditional oscilloscope, only larger and more colorful, so the crux or cost advantage of the computerized ‘scope over, say, a refurbished Tek I find hard to grasp. In good Elektor tradition for large projects from the lab, the magazine article consisted of circuitcellar.com 53 two instalments. The first in September 1986 gave the circuit diagram, the basic method of operation and some screendumps showing not too complex waveforms. In the October 1986 edition the construction, adjustments and software aspects were discussed, and the project was carried on the front cover of the magazine (see Photo 1). Note the visually implied hierarchy of two home computers pictured: the BBC Micro majestically in front and a Commodore C64, well, also visible. As a peripheral the ComputerScope requires a fast and wide highway into the computer’s memory and display systems. However, these are digital, while the ‘scope probe will pick up analog signals mostly, so ADC-ing is called for. The port traffic is not one-way either, as the ‘scope input settings including the AC-DC selector and attenuator/ amplifier need to be controlled from the computer. A couple of Clare DIP relays were used for the purpose. There are no controls or knobs on the Elektor ComputerScope to fiddle with, hence the instrument looks insipid in its grey case except perhaps for the stylized S. The crux of the circuit is found in the “fast” ADC and DAC inside the UVC3101, and a small memory section based on Inmos IMS1420 RAMs. These parts were rare and expensive at the time—fortunately some advertisers in the magazine started to supply kits of the project. The ADC and RAM section of the schematic is reproduced in Figure 1. The DAC (not visible here) was used to add an offset to the input signal if required. The datawidth from the ADC was 7 bits; bit 8 was the trigger indicator. The memory area actually used for data buffering was 512 bytes. The RAM section had its own address counter built from TTL ICs from the 74HC series (no microcontroller in sight). The board was packed with 74HC ICs for that matter, and a few straggling 74LS and CD4000 ones, since a mass of control and timing functions had to be catered for—like the complete timebase. I counted 24 logic ICs (see Photo 2), which would be labeled a component grave these days. The lot was powered by a separate supply board type EPS 9968-5. A small modification involving a slide switch on the back panel (see Photo 3) FEATURES THE DESIGN allowed the instrument to be used with IBM (clone) PCs also. Those of you yearning for the complete article from 1986 are advised that the Elektor 1980’s DVD is about to be published; watch www.elektor.com or your weekly E-Post Newsletter. THOSE LISTINGS If you ordered the ComputerScope board # 86083 through the Double Dutch named Elektuur Print Service (EPS) it came with ABOUT THE AUTHOR Jan Buiting is Editor in Chief of Elektor magazine. His “Retronics” articles have been published regularly since 2004. Contributions, suggestions, and requests are welcome. Email [email protected]. PHOTO 1 The ComputerScope project appeared on the cover of the October 1986 eidtion of Elektor magazine. 54 CIRCUIT CELLAR • OCTOBER 2014 #291 FEATURES FIGURE 1 The ComputerScope project appeared on the cover of the October 1986 eidtion of Elektor magazine. program listings on paper for the Acorn Electron, the BBC Micro, the Commodore C64, and MSX machines. I remember stacks of this paperware on the shelves in our stores, alongside the boards, and supplications on my desk from readers all over the globe to send them the listings on disk, or without the board! To help owners of “other makes of computer” to compile their own program for the ComputerScope, a pitiful flow diagram was printed at the end of the October 1986 instalment. PHOTO 2 Take a look inside LOVE STORY Now compare the names of our two editorial secretaries duly printed in the October 1986 edition with those in November 1986—look on page 13. One surname changed. Besides passing his BSc. Electronic Engineering exam with good notes for the ComputerScope project, lab trainee R (for Rene) v(an) Linden, a silent, almost invisible worker, in the course of 1985 also managed to more than befriend “our” cherished secretary W (for Wilma) Wijnen. circuitcellar.com 55 PHOTO 3 A slide switch on the back panel enabled the system to be used with IBM PCs. FEATURES DUMPSTER STORY Elektor moved offices in 2006 and in an orchestrated attempt to “shake off the dark past” the technical staff and editors got strong advice to clear their stables and make a fresh start at Elektor Castle. One Friday afternoon, CEO attending, the old lab space in Beek (Holland) was cleared out rigorously by quasi volunteers, with a ton of stuff disappearing in an x cubic feet dumpster carefully parked on the driveway right under the lab windows. There was beer and pizza to celebrate the almost vacant building, and reward the workers. Of the twenty or so lab projects and prototypes I was able to safeguard during Operation Augias, most—I admit—were of the ‘finished’ type, meaning there was a case around them. I managed to keep these out of harm’s way and was happy to see that a few colleagues did the same for sentimental reasons. Today the small booty of that boisterous Friday afternoon is incorporated in the Retronics Collection, which is an “asset to the company” under the current management, and virtualized at www.elektor-labs.com/attic. Look at the item on the shelf straight above the Mugen Hybrid Amp—that’s the final resting place of the 1986 Elektor ComputerScope. TRACE 32 ® Editor’s Note: This article first appeared in Elektor, June 2014 advertisement_arm-overview.indd 1 03.06.2014 11:48:51 BOARDS, BOOKS, DVDs AND MORE AT WWW.ELEKTOR.COM/STORE Elektor.STORE The world of electronics at your fingertips! NE ! W Theory and best practices Advanced Control Robotics It doesn’t matter if you’re building a line-following robot toy or tasked with designing a mobile system for an extraterrestrial exploratory mission: the more you know about advanced robotics technologies, the better you’ll fare at your workbench. Hanno Sander’s Advanced Control Robotics simplifies the theory and best practices of advanced robot technologies. You’re taught basic embedded design theory and presented handy code samples, essential schematics, and valuable design tips (from construction to debugging). 160 pages • ISBN 978-0-963013-33-0 • $54 ore This book and m are available at m/store www.elektor.co Books Fun to build and use projects! Create 30 PIC Microcontroller Projects with Flowcode 6 The RPi in Control Applications This book covers the use of Flowcode® version 6, a state-of-the-art, all-graphical based code Raspberry Pi Hardware Projects development tool, for the purpose of developing PIC microcontroller applications at speed and This book is about the Raspberry Pi computer with unprecedented ease. Without exception, the 30 projects in the book are fun to build and and its use in control applications. Dogan use. A secret doorbell, a youth deterrent, GPS tracking, persistence of vision (POV), and an Ibrahim explains in simple terms, with exam- Internet webserver are just a few examples of projects in the book waiting to be explored and ples, how to configure the RPi, how to install mastered. This makes the publication a perfect source of projects constantly challenging your and use the Linux operating system, how to hardware and software skills as you progress, resulting in advanced microcontroller applica- write programs using the Python program - tions you can be proud of. All sources referred in the book are available for free download, in- ming language and how to develop hardware cluding the support software. based projects. 232 pages • ISBN 978-1-907920-30-1 • $48 290 pages • ISBN 978-1-907920-29-5 • $54 Prices and item descriptions subject to change. E. & O.E Books Bestseller! Learning to Fly With Eagle Eagle V6 Getting Started Guide 110 Elektor Editions, Over 2500 Articles DVD Elektor 2000 through 2009 Android Breakout Board This DVD-ROM contains all circuits and pro- The FTDI FT311D is a flexible bridge that The book is intended for anyone who wants an jects published in Elektor magazine’s year can interface your circuit to an Android introduction to the capabilities of the CadSoft’s volumes 2000 through 2009. The 2500+ smartphone or tablet. This Elektor Android Eagle PCB design software package. The reader articles are ordered chronologically by release Breakout Board offers options for seven may be a novice at PCB design or a professional date (month/year), and arranged in alphabet- digital outputs, four PWM outputs, asynchro- wanting to learn about Eagle , with the intention ical order. A global index allows you to search nous serial and I2C and SPI interfaces. The of migrating from another CAD package. After specific content across the whole DVD. Every board is compatible with Android 3.1 (Ho- reading this book while practicing some of the article is printable using a simple print func- neycomb) or higher (Android Open Accessory examples, and completing the projects, you tion. This DVD is packed with ideas, circuits Mode should be supported). should feel confident about taking on more and projects that are ideal for any electronics challenging endeavors. This book is supplied enthusiast, student or professional, regardless with a free copy of Eagle on CD-ROM for of whether they are at home or elsewhere. MS Windows, Linux and Mac. Ready-built module Art..# 130516-91 • $41 ISBN 978-1-907920-28-8 • $121 208 pages • ISBN 978-1-907920-20-2 • $47 Elektor is more than just your favorite electronics magazine. It’s your one-stop shop for Elektor Books, CDs, DVDs, New! Kits & Modules The Ultimate Guide! The LTspice IV Simulator www.elektor.com/store IO-Warrior Expansion Board Don’t throw out your old PCs and notebooks Simulator describes the operation of the pro- or leave them gathering dust in the basement! gram, all available commands, the various They can be a useful resource: by adding this editors, dealing with SPICE models, the use of universal interface card an old PC can be pres- non-linear components and more. This book is sed into service as a measurement and control more than just a manual. It also offers a variety hub. An IO-Warrior module on the I/F board of tips, methods and examples, all carefully illustrated using almost 500 drawings, diagrams and screenshots on high-quality paper. The book is designed so that it is suitable for both beginner and veteran SPICE users. 744 pages • ISBN 978-3-89929-258-9 • $67 takes care of USB communication, and source Elektor US 111 Founders Plaza, Suite 300 East Hartford, CT 06108 USA Phone: 860.289.0800 Fax: 860.461.0450 E-mail: [email protected] code is available that works with the free version of Visual Studio. Ready-built module Art.# 130006-91 • $54 Kits & Modules In a sturdy, hard-cover format, The LTspice IV and much more! 58 CIRCUIT CELLAR • OCTOBER 2014 #291 THE DARKER SIDE COLUMNS RF Connectors Tips for Taking Care of Connections Never take RF connectors for granted. Why? An RF connector can be a delicate assembly of small mechanical parts with strict tolerances. This article details how to properly select and care for RF connectors. By Robert Lacoste W elcome back, dear reader. In the past few years, I wrote several columns dealing with radio frequency. When working on RF projects, you must connect subsystems together at a given time. You might also have to use RF test equipment, like a spectrum analyzer. Let’s assume that you have an RF transmitter— for example, a Wi-Fi gizmo—and you need to measure its output power. The first thing to check is impedance matching. You know that the output impedance of your transmitter is 50 Ω. You also know that the input impedance of your spectrum analyzer is 50 Ω, so you just have to get a test cable with a characteristic impedance of 50 Ω to interconnect them. If you have any doubt about a cable’s characteristic impedance, refer back my column on microstrip lines in which I explained the concept (“Microstrip Techniques,” Circuit Cellar 223, 2009). So it’s easy, right? But, wait. This test cable will need to have the proper mating connectors at both ends. There are a hundred types. How can you select the proper ones? Moreover, what are the mandatory precautions required when using RF connectors for any precise connection? Is a connector as transparent to the signal as it looks like? Take a seat. I’ll address these topics in this article. And you may be surprised by some of the answers. WHAT A CHOICE PHOTO 1 Here you see (from left to right) the ubiquitous BNC, SMA, and, lastly, the terrible RP-SMA. You can see their male and female variants. I will start our journey with a tour of the RF connectors you will most likely encounter (see Photo 1). Firstly, consider the ubiquitous Bayonet Neill-Concelman (BNC) connector, which is present on nearly all oscilloscopes and signal generators. It is easy to use thanks to circuitcellar.com COLUMNS its two bayonet fingers and quarter-turn lock. Although BNC connectors are affordable and easy to use, they’re barely usable above a couple of gigahertz, as I will explain later. Old timers may also recall that BNC connectors were largely used for network connections, when 10B2 Ethernet was the norm. A caution here: the BNC connector exists both in 50- and 75-Ω variants, the latter being devoted to video applications. And no clear indication enables you to differentiate them as they physically mate. The only solution is to store them apart, or maybe to check which cable type is connected to them, but that might not be easy. For more professional designs or for slightly higher frequencies, the most common RF connector is the sub-miniature A (SMA), which you can see in Photo 1. SMA is a precision 50Ω, screw-type connector developed in the 1960s by Bendix Scintilla Corp. SMA can be used up to 18 GHz thanks to their precision engineering and polytetrafluoroethylene (PTFE) insulator. Some manufacturers even offer them up to 26 GHz. Are there some variants? You bet so. For high-performance instrumentation, you may encounter the so-called 3.5- and 2.92mm connectors. These ones are physically very similar to SMA; however, they provide much higher performances, up to 46 GHz or so, thanks to their stricter tolerances and air-insulator. Theoretically, they can be freely mated with SMA connectors but with great care. More on that later. SMA is great, but then someone invented the reverse-polarity SMA, or RP-SMA (see Photo 1). It is the same connector as the SMA, but the male and female screw and pin pairs are permuted. These RP-SMA are frequent on Wi-Fi endpoints and antennas. I hate them, just because there is now a 50% probability to use the wrong variant between SMA and RP-SMA. Depending on whether or not you are lucky, mating the wrong pair will result in either an invisible open connection or a pair of damaged connectors. It seems that RP-SMA was invented to make the lives of Wi-Fi users more difficult—namely, to make the lives of Wi-Fi users more difficult. The idea was to forbid them to replace the supplied antenna with a higher gain one, thanks to the use of an exotic connector. This helped to avoid issues with the FCC regulations. But now this makes everydody’s life more difficult! What about larger connectors? Photo 2 shows you the Amphenol Precision Connectors 7-mm (APC-7) high-performance connector. This costly device is a clever sexless connector that was used on all high-end RF test equipment some years ago with up to more than 20 GHz of exceptional repeatability. Even if they provided an incredibly low VSWR, they are now replaced by higher performance and more compact precision connectors. Anyway, I love them. 59 PHOTO 2 Here I show (from left to right) the precision APC7 in male and female configurations, N male and female, and UHF male and female. Bottom row includes F and Belling-Lee TV connectors. The N connector is for lower-end applications (see Photo 2). (It was invented in the 1940s by Paul Neill. Do you remember the “N” of BNC ? That’s the same guy. Two very common connectors have his initial.) The first versions were usable up to 1 GHz, but they quickly were improved for operation up to 18 GHz or so by Hewlett-Packard. These heavy-duty connectors are able to support a significant PHOTO 3 Take a look (from left to right) at SMB, SMC, MMCX, and UFL miniature connectors (each in male and female variants) CIRCUIT CELLAR • OCTOBER 2014 #291 COLUMNS 60 PHOTO 4 A torque wrench is mandatory for ensuring the long life of a connector, especially when you’re working with an expensive high-performance connector. amount of power, up to 500 W at 2 GHz. The N connector is also available in 50- and 75-Ω versions (even though I haven’t worked with the latter). I added some 75-Ω components to Photo 2—like the so-called “UHF,” “F,” and “BellingLee” TV connectors—just so you could clearly differentiate them from 50- Ω lab connectors. What’s the trend in the RF connector’s arena? Miniaturization, of course. They are few N or BNC connectors in mobile phones (even though my first GSM phone had an SMA connector for its external rubber antenna). Have a look at Photo 3 for some more compact varieties, starting with the SMB and SMC. These two are as old as the SMA (from the 1960s), but they’re significantly smaller with a jack diameter of 3.7 mm. Both are identical except for the locking mechanism: snap-on for SMB and screw-on for SMC. As a consequence, the SMC provides better performances than SMB. They are respectively usable up to 4 and 10 GHz. The micro-miniature coaxial (MMCX) is smaller. You can find them on Wi-Fi cards, GPS receivers, and PDA antenna connectors. Developed in the 1990s, MMCX is usable up to 6 GHz, which is not bad for a snap-on, 2.4-mm connector. But engineers never stop, and one of the smallest I’m using regularly is the UFL connector (see see the rightmost component in Photo 3). Designed as far as I know by Hirose, the UFL is also a 6-GHz, snap-on connector with a diameter of 2 mm and a mated height of only 2 mm. Of course, the connecting cable must be ABOUT THE AUTHOR Rob er t L ac os te li ve s i n Fr anc e, n e a r Pa r i s. H e h a s 2 5 ye a r s o f e xp e r i e n c e i n e m b e d d e d sys t e m s, analog designs, and wireless telecommunications. A prize winner in more than 15 international design contests, in 2003 he started his consulting company, ALCIOM, to share his passion for innovative mixed-signal designs. His book (Robert Lacoste’s The Darker Side) was published by Elsevier/Newnes in 2009. You can reach him at [email protected]. Don’t forget to put “darker side” in the subject line to byp ass sp am filters. PHOTO 5 This is my HP8510C vectorial network analyzer. It’s nice piece of equipment. circuitcellar.com as small. Typically, these UFL connectors are bought clamped on a 0.8-mm coaxial cable. I have only scratched the surface of the long list of RF connectors. But I guess I have presented the key ones. If you are looking for more exotic variants, or if you have any doubt about any particular variation, I recommend reading Pasternack’s “Connector Identifier,” which is listed in the Resources section of this article. 61 a) CONNECTOR CARE COLUMNS Experience shows that you must always keep two simple rules in mind: RF connectors are fragile, and checking them with an ohmmeter definitively isn’t safe. I’ll elaborate on the latter in a minute, but let’s stay for a while on the “fragile” side. An RF connector, and especially a small one, is a delicate assembly of small mechanical parts with strict tolerances. If you aren’t careful, there’s a high probability that its performances will be quite far from what you might expect. Firstly, keep in mind that a connector has a given lifespan, and it could be short. For example, SMA connectors are rated for up to 500 mating cycles. That could be fine, but it could also be orders of magnitude lower than what you would need for benchtop test equipment. So, it must be anticipated at the design phase when selecting the connector. Another very common problem is that connectors get stuck. Many people use pliers to screw or unscrew stuck connectors. Never ever do that! Pliers can apply high torque on the delicate parts and can easily damage them. Moreover, with pliers, you can’t ensure that the torque is applied perpendicularly to their axis. Large connectors, like N, are designed to be screwed by hand. For smaller ones, like SMA, use a proper torque wrench (see Photo 4). If you don’t have one, use your fingers. If you can’t, use a properly sized wrench, but do so with great care. Another way to destroy a SMA connector is to spin the mating pin inside its female counterpart. Always mate the two connectors with a straigth movement, and then screw them without turning their assemblies—just the nut! A last word on the SMA. As I explained, low-cost SMA and precision 3.5 mm/2.92 mm connectors can be physically mated together. However, it generally isn’t a good idea. A precision connector can cost several hundred dollars, so it would be a bad idea to mate it with a low-cost connector that could be damaged (due to its long life). If you need such an adaptor, buy a high-quality SMA/SMA connector, screw it in with care on the precision connector, and leave it. Of course, the performance will b) PHOTO 6 a—The first test was with two SMA-to-SMA high-quality adapters. b—The extra losses are minimal, close to 0.2 dB in high frequencies. The return loss is better than 20 dB (horizontal: 45 MHz to 10 GHz; vertical : 1 dB/div for S21 and 5 dB/div for S11). be reduced to the performance of a standard SMA. (Refer to Microwave101.com—which is listed in the Resources section of this article— for addition information on topics such as advice on cleaning connectors.) LET’S EXPERIMENT It is great to know that connectors are sometimes problematic. Experimenting can 62 CIRCUIT CELLAR • OCTOBER 2014 #291 COLUMNS a) b) PHOTO 7 a—I tested a pair of standard BNC-to-SMA adapters. b—Significant losses are visible from 5 GHz, with no less than 3 dB losses at 10 GHz! ial Connectors—1.9 mm or 2.4 mm Mated Height,” www.hirose.co.jp/cataloge_hp/ e32119372.pdf. Microwaves101.com, “Connector Care,” www. microwaves101.com/encyclopedia/connectorcare.cfm circuitcellar.com/ccmaterials RESOURCES Amphenol RF, “Precision Connector Series,” www. amphenolrf.com/products/ precision.asp?N=0&sid=4A4D4A002301E17F&. Hirose Electric Co., “Ultra Small Surface Mount Coax- ———, “Microwave Connectors,” www.microwaves101.com/encyclopedia/connectors.cfm Pasternack, “Connector Identifier,” www.pasternack.com/images/pdf/7%20Connector%20 Identifier.pdf. SOURCES HP8510C Network analyzer (now obsolete) Hewlett-Packard | www.hp.com help you to be convinced. How can you measure the actual behavior of a connector? Apply an RF signal to it, check the signal at the other end, and determine whether or not it is modified. Or, even better, insert the connector in the middle of a 50-Ω line and check if there the connector had caused any signal reflection, which would indicate an impedance mismatch. (I’ll explain the advantage of this method in a minute.) You can make measurements with a standalone RF generator. But the good news is that there is a dedicated test setup for such measurements— the network analyzer. Basically, a network analyzer includes three subsystems: a tunable RF generator, a measurement bridge to differentiate direct and reflected signals, and a sensitive receiver. Networks analyzers come in two flavors: scalar (measuring only the changes in a signal’s amplitude) and vectorial (measuring both magnitude and phase). I wrote about such equipment some time ago in my 2010 article, “A Tour of the Lab (Part 2): Frequency Domain” (Circuit Cellar 243). Photo 5 shows the nice HP8510C vectorial network analyzer (VNA) in my company’s lab. Let’s cover how I tested an SMA connector. First, I calibrated the VNA using a high-quality SMA/SMA jumper cable. I then inserted a pair of standard SMA/SMA adapters (SMA male/male and SMA female/female, respectively). Photo 6a shows the setup. How did the two adapters impact the signal transmission ? Look at Photo 6b. The top blue line is the transmission loss from 45 MHz up to 10 GHz, with a 1-dB/division scale. The loss was very small, lower than 0.2 dB or so. The yellow curve on the bottom shows the reflection coefficient with a 5-dB/division scale. This reflection coefficient is, in decibels, the power of the reflected signal level divided by the power of the incident signal. It was lower than 20 dB, which indicated good performance. This proved that high-quality SMA connectors perform well at least up to 10 GHz. Now what about BNC? I replaced the two SMA/SMA adaptors with BNC/SMA adapters, as you can see in Photo 7a. What happened ? Look at Photo 7b for the result. Now the attenuation starts to climb at a frequency of 5 GHz and is as high as 3 dB at 10GHz. This means that only half the available power goes through such a BNC connector! The reflection curve is also interesting. Firstly, you can see that the first small degradations of the signal at 5 GHz are easier to see on the reflected measurement that on the transmission behavior. Secondly, at 10 GHz, the measured reflection coefficient is 10 dB. Remember that only 50% of the signal was transmitted. We now know that –10 dB (meaning 10%) of the signal power is reflected to the source. That implies 50% transmitted circuitcellar.com b) a) THE FINAL EXPERIMENT My last experiment was a real heartbreaker. I took a good SMA/N adapter and measured it. I then voluntarily damaged it with a screwdriver. I gently pushed aside one of the four central spring contacts by 0.5 mm or so (see Photo 9a). The damage was minimal, and the remaining three contacts were untouched. Was the connector’s performance impacted? You bet, as Photo 9b proves. No significant change in low frequencies, but no less than 2 dB extra loss at 10 GHz! The final step in the experiment? I tossed the connector in a garbage bin. The destructive test cost me about €20. But it was worth it to help me convince you that connectors are members of a very delicate species. You must respect them, take care of them, and select them with great caution. In fact, you must love them. If not, soon or later, they’ll take their revenge and show you their darker side. a) PHOTO 9 a—I tested a slighly degraded N connector. b—I got 2 dB extra losses at 10 GHz! b) COLUMNS PHOTO 8 a—I tested a 10-cm UFL jumper. b—I zoomed in on the behavior of the UFL jumper after several cycles. You can see 0.2 to 0.3 dB variations. and 10% reflected makes 60%. Where is other 40%? It’s dissipated inside the connector assembly, as heat. This is not noticeable with the couple of milliwatts generated by a VNA, but the same test with a 100-W source may be funny. In another experiment I used an ultraminiature UFL connector (see Photo 8a). Rather than measuring its insertion loss, I used it as a reference and then performed numerous insertion/removal cycles prior to a new measurement. Photo 8b shows the result. Variations of up to 0.2 dB were measured. Such a change in signal level could be negligible—or not, depending on your application. Just keep in mind that it could happen! 63 64 CIRCUIT CELLAR • OCTOBER 2014 #291 FROM THE BENCH Embedded Voice Recognition (Part 1) COLUMNS Recognition as a Peripheral With the right parts and a little knowhow, you can add effective speech and voice recognition capabilities to almost any application. This series serves as a proper introduction to the basics of embedded voice recognition. By Jeff Bachiochi (US) S martphones have put so much power in our hands that we tend to take some functions for granted. Just look at Siri, Apple’s voice command application. She requires a ton of high-level processing to interpret your requests. All this is best handled in the cloud, and thanks to the Internet, this gives the impression that your phone is truly “smart,” when in reality it’s just gathering and playing back audio. Dictation applications have been available to your PC for years. Chances are, however, that you are not using one. It seems incorrect interpretation often introduces an increased necessity for editing, which defeats 32-KHz Crystal oscillator or RC Oscillator (RC on chip) Timers (4) FIGURE 1 NLP-5x family features a 16-bit DSP with chip debug, 128-KB OTP code space, three 16-bit ADC channels, two microphone pre-amps, two 16-bit DAC channels, direct speaker drive, 24-KB RAM, five timers plus an RTC, and LCD control. Additional peripherals include motor control logic, USB1.1, an SPI, a UART, an IR interface, an analog comparator, power-on reset, brown-out reset, and 79 configurable general-purpose I/O lines. Microphone Two Pre-amps with gain control (one line input) Regulator Stereo 16-bit DAC DAC Out PWM Three channel 16-bit ADC Comparators (2) P.O.R and B.O.R Watchdog timer Clock main USB, SPI, UART and I2S Interfaces General-purpose I/O 2 × 16-bit parts 1 × 8-bit port (40 I/O) NLP-5X General-purpose 16-bit DSP Internal code space (128-KB OTP) 22-KB Data SRAM 2-KB Code SRAM LCD, motor and IR control blocks External memory interface 16-bit data, 23-bit address Speaker out circuitcellar.com 3.58-MHz Oscillator or research ADC Microphone Pre-amp and gain control Timers (3) Watchdog timer Digital filters Audio wakeup DAC DAC Out PWM RSC General-purpose microcontroller AGC Comparators (4 input) General-purpose I/O 3 × 8-bit ports (24 I/O) its purpose as a labor-saving application. These applications require a level of contextual understanding that exceeds their abilities. Because of high computational requirements, we’ve not seen this technology trickle down into microcontroller applications. However, the technology can be offloaded and exploited as a peripheral device. Sensory, Inc. designs highly accurate, low-cost voice recognition and synthesis ICs. Its audio and speech technologies are directed at four areas: speech recognition, audio, interactive and robotics, and voice recognition for Bluetooth products. The recognition-related areas are covered by two devices. The NLP-5x uses a 16-bit DSP (see Figure 1). The RSC-4x is an 8-bit general-purpose microcontroller (see Figure 2). Sensory has a complete line of development and evaluation tools that gives you control over high-performance speech I/O features, including noise-robust speaker-independent and speaker-dependent recognition of many languages, speech synthesis and sound effects using Sensory SX synthesis technology, MIDIcompatible music synthesis, voice record and playback, audio wake-up, and touch tone (DTMF) output. These audio and speech technologies can reside together with the application program creating a true singlechip application. Once written, the application will reside in the processor’s ROM and can be reproduced in a 100-pin LQFP package or in unpackaged die. The development costs can put this out of reach for many designers who just want to add some of this capability without having to design, debug, and program for low-volume quantities. Fortunately, thanks to TIGAL KG from Austria, we have an alternative that makes use of Sensory’s technology presenting it as a speech recognition and audio output module. The EasyVR 2.0 is designed to add Speaker out Internal ROM space 128K Bytes FIGURE 2 The RSC-4x family features an 8-bit microcontroller, a 16-bit ADC, a 10bit DAC, a microphone pre-amp, an independent programmable digital filter engine, 4.8-KB RAM, five timers, twin-DMA, a vector math accelerator, a multiplier, 8-bit data on-chip storage for SD, SV, Templates, Analog Comparator Unit, 24 configurable I/O, and a nested interrupt structure. 4.8K SRAM Vector accelerator with twin DMA COLUMNS Low battery detection 32-kHz Oscillator(optional) 65 External memory interface 8-bit data, 20-bit address cost-effective speech and voice recognition capabilities to almost any application. The module includes a set of built-in speaker independent (SI) commands for ready-torun basic controls. It supports up to 32 userdefined speaker dependent (SD) triggers or commands, as well as voice passwords. SD commands can support any language. This ability is supported via separate module and development boards that won’t set you back more than about $60. VEEAR (VR) MODULE The EasyVR module in Photo 1 measures less than 1″ × 2″ inches and is manufactured using mostly SMT parts. Separate pin headers on each of its four corners allow it to easily be piggybacked onto your application PCB. Two two-pin headers offer support for the included microphone and the user supplied PHOTO 1 The EasyVR module takes up little space and will piggyback snuggly onto your application PCB using 2-mm stick headers in all four corners. It has a voltage input range of 3.3 to 5.5 V and accepts simple ASC commands over its TX/RX serial port. 66 CIRCUIT CELLAR • OCTOBER 2014 #291 COLUMNS PHOTO 2 The VR Commander application aids the user in adding 32 of their own speaker dependent commands to its preprogrammed speaker independent library of 28 commands. Optional software from Sensory, Inc. can be purchased if speaker-independent commands are required for your application. Command Arguments ASCII Byte Value 1 = 115200 2 = 57600 3 = 38400 6 = 19200 12 = 9600 Hex ‘a’ 0x61 Baud ‘b’ 0x62 none ‘c’ 0x63 Index ‘d’ ‘e’ 0x64 0x65 Description Baudrate 0 = trigger 1-15 = generic 16 = password Index 0 = trigger 1-15 = generic 16 = password Index 0 = trigger 1-15 = generic 16 = password Position 0-31 none ‘h’ 0x68 Index 0-31 -1 = SI grammar count Length 4 8 IndexH 0 0-7 IndexL 0-15 0-31 DelayH 0-15 0-31 DelayL 0-15 0-31 Length 4 8 Level 0-2 TimeoutH 0-15 0-31 TimeoutL 0-15 0-31 Reply STS_SUCCESS Break STS_SUCCESS STS_INTERR Get count for SD STS_COUNT Activate SD/SV recognition STS_RESULT STS_SIMILAR STS_TIMEOUT STS_ERROR Erase training of SD/SV command STS_SUCCESS Read wave table data STS_TABLE_SX STS_OUT_OF_MEM Read custom and builtin grammar data STS_GRAMMAR STS_COUNT Send a SonicNet token Index= (ValueH*32)+ValueL Delay= ((ValueH*32)+ValueL) * 28uS STS_SUCCESS Receive a SonicNet token Timeout= ((ValueH*32)+ValueL) * 28uS STS_TOKEN STS_TIMEOUT ‘i’ 0x69 WordSet 0-3 Activate SI recognition from specified word set STS_SIMILAR STS_TIMEOUT STS_ERROR ‘k’ 0x6B Level 0-4 Set SI knob to specified level STS_SUCCESS Language 0 = English 1 = Italian 2 = Japanese 3 = German 4 = Spanish 5 = French Set SI language STS_SUCCESS ‘l’ 0x6C TABLE 1 If you use the VR Commander to add and train commands, you won’t need to use most of the Commands in this list. They are available if you want to program the module from your application. I preprogrammed my library using the Commander. Thus, my application requires only three commands. (continued on following page) 8-Ω speaker (when sound output is required). The remaining pin headers are split between a five-pin control header and a four-pin power/ communication port. The module will run on 3.3 or 5 V with TTL UART communication defaulting to 9,600 bps. This header and the microphone is all that is required to use a configured module. The EasyVR development kit PCB has a USB port that allows the module to be configured and programmed from a PC running the free EasyVR Commander configuration software. For you Arduino buffs out there, there is an alternative development board, EasyVR Shield. Photo 2 shows a list in the left-hand panel of the EasyVR Commander application that includes potential selections. These are identified under the description column as Trigger, Group, Password, SoundTable, and Wordset. Note that Wordset 1 is highlighted and the contents of this group are shown in the right panel. There are eight (0–7) predefined SI words in this group. Each Wordset contains a number of related predefined words. By segregating words into separate groups, you can have better control over which words will be active at any point in time. The Trigger group includes one predefined SI word, “robot.” Since the Trigger and Wordset groups are predefined with specific speaker-independent vocabularies, a user circuitcellar.com SI VS. SD To use the EasyVR module effectively, you need to understand the difference between speaker-independent and speaker dependent recognition. You may have noticed that people visiting from outside your area seem to have a distinct accent, drawl, brogue, or twang that makes it difficult to understand them at times even though they are speaking in your native language. Unless you train your ears to this difference, it can sometimes seem as an entirely different language. Our vocal tract is the cavity where larynx vibrations and air exhalations are filtered into unique sounds. The International Phonetic Association (IPA) has attempted to document these into a phonetic alphabet. To communicate, we string together different combinations of these sound bits to produce an audible representation of a particular word. Simply put, we can define ‘m’ ‘n’ ‘o’ ‘p’ 0x6D 0x6E 0x6F 0x70 ‘q’ 0x71 ‘r’ 0x72 ‘s’ ‘t’ ‘u’ ‘v’ ‘w’ ‘x’ ‘y’ 0x73 none 0x76 0x77 0x78 0x79 STS_MASK Label SD/SV command STS_SUCCESS Set recognition timeout STS_SUCCESS Read SD/SV command data (label and training) STS_DATA Configure, query or modify general purpose I/O pins STS_SUCCESS for Pinmode 0-1 STS_PIN for Pinmode 2-4 Index 0 = trigger 1-15 = generic 16 = password Position 0-31 Length 0-31 Text Upper Case Letters Timeout -1 = default 0 = infinite 1-31 = seconds Index 0 = trigger 1-15 = generic 16 = password Position 0-31 Pinnumber 1-3 Pinmode 0 = output low 1 = output high 2 = input 3 = input strong 4 = input weak Confirmation ‘R’ Reset all commands and groups STS_SUCCESS Mode 0 = character only 1 = whistle or character 2 = loud sound or character 3-5 double clap (with varying sensitivity) or character 6-8 = triple clap (with varying sensitivity) or character Go to the specified power-down mode STS_SUCCESS STS_AWAKEN Index 0 = trigger 1-15 = generic 16 = password Train specified SD/SV command Position 0-31 STS_SUCCESS STS_RESULT STS_SIMILAR STS_TIMEOUT STS_ERROR Index 0 = trigger 1-15 = generic 16 = password Position 0-31 Strictness 1 = easy 2 = default 5 = hard IndexH 0 -31 IndexL 0-31 Volume 0 = min 15= full 31 = 2X Constant -1 Index 0-9 = digits 10 = ‘*’ key 11 = ‘#’ 12-15 = ‘A’ to ‘D’ -1 = dial tone Duration 0-31 in 40ms units for keys and seconds for the dial tone 0x74 0x75 Request bit-mask of non-empty groups none Delay 0-10 = ms 11-19 = 20-100 ms 20-28 = 200-1000 ms Remove SD/SV command STS_SUCCESS Set SD level STS_SUCCESS Wave table entry playback Index= (ValueH*32)+ValueL 1-1023 = sound index 0 = built-in “beep” STS_SUCCESS STS_ERROR Play a DTMF key tone or dial tone STS_SUCCESS Request firmware identification STS_ID Set transmit delay STS_SUCCESS COLUMNS can’t alter them. The SoundTable selection, which I’ll describe later, is for audio out. Group 1–15 and Password 16 are for you to add and train up to 32 of your own SD words in any of up to 15 groups (similar to SI Wordsets). The Password group can be used to hold special words that require a higher level of correlation before achieving a match. You might want to implement this as a sort of biometric voiceprint for security purposes. While the EasyVR Commander handles all the communication with the EasyVR module for the initial setup, you will need to be familiar with at a few commands to make use of the module. Table 1 lists these commands. Table 2 lists responses. All data passed between the EasyVR module and the host (be it the PC or your microcontroller) is in ASCII readable form. Commands and Responses begin with a lowercase letter. All data within Arguments are also printable characters. All data values are in the range of –1 through 31. This means that you must add an offset of 0x41 to each value to make it printable (see Table 3). Not only does this enable all the communications to be seen (as printable characters) on a terminal, but you can directly enter commands via a keyboard since there are no control characters (binary data). Many applications won’t need the majority of these commands, particularly when they have to do with configuration of the module, including adding speaker-dependent word groups and training these words. Your applications might only need to select a group to listening for and to find out which word was spoken. Let’s begin by looking at the difference between SI and SD groups. 67 68 CIRCUIT CELLAR • OCTOBER 2014 #291 align correctly; otherwise, the least bit of difference will prevent a perfect match. If the rules are relaxed somewhat, we might be able to determine a match even when the two have slight differences. Further rule relaxation will make it easier to find a match, but it also COLUMNS recognition as dissecting audio into its basic phonetic components in order to identify the word it represents. With a large enough dictionary, we might be able to not only determine the word, but also the language represented. This only works when the stars TABLE 2 For every command issued, the module responds with status information (except for infinite timeout used with the trigger group). Each command list in Table 1 lists the status responses expected. This list contains all of the possible responses. Response ASCII Hex Data Name Byte Description Value ‘c’ 0x63 STS_COUNT Count 0-31 = command/grammar count -1 = 32 commands/grammars Count of commands or total number of SI grammars ‘d’ 0x64 STS_DATA Training -1=empty 1-6 = training count +8 = SD/SV conflict +16 = SI conflict Provide command data Position 0-31 (only meaningful when trained) STS_TABLE_SX Length 0-13 Text Upper Case Letters IndexH 0-31 IndexL 0-31 Length 0-31 (Length of Text) Provide sound table data Index= (ValueH*32)+ValueL Text Upper Case Letters ‘e’ 0x65 STS_ERROR Error 03h = too noisy 04h = spoke too soft 05h = spoke too loud 06h = spoke too soon 07h = too complex 11h = recognition failed 12h = recognition result doubtful 13h = recognition result maybe 14h = invalid SD/SV command 17h = bad pattern durations 4Ah = bad release number 4Eh = bad data in speech file 80h = not found Signal recognition error ‘f’ 0x66 STS_TOKEN IndexH 0 0-7 IndexL 0-15 0-31 Detected a SonicNet token Index= (ValueH*32)+ValueL ‘i’ 0x69 STS_INTERR none ‘k’ 0x6B STS_MASK Mask Interrupted recognition ‘m’ 0x6D STS_OUT_OF_MEM none ‘o’ 0x6F STS_STATUS none ‘p’ 0x70 STS_PIN State 0 = low 1=high Provide pin input status ‘r’ 0x72 STS_RESULT Position 0-31 Recognized SD/SV command or Training similar to SD/SV command ‘s’ 0x73 STS_SUCESS Wordindex 0-31 Recognized SI word or Training similar to SI word ‘t’ 0x74 STS_TIMEOUT none ‘v’ 0x76 STS_INVALID ‘w’ 0x77 STS_AWAKEN ‘x’ 0x78 STS_ID Version ‘z’ 0x7A STS_GRAMMER Flags 16 = trigger 0 = command Count 0-31 Number of commands Length 0-31 (Length of Text) Text Upper Case Letters 4-bit values that form 32-bit mask (LSB first) Mask of non-empty groups Memory error (no more room for commands or sound table not present) OK or no errors status Timeout expired Invalid command or argument none Wake-up (back from power-down mode) Provide firmware identification Length and Text repeated for all Commands Provide custom grammar data When it comes to robotics, the future is now! From home control systems to animatronic toys to unmanned rovers, it’s an exciting time to be a roboticist. Advanced Control Robotics simplifies the theory and best practices of advanced robot technologies, making it ideal reading for beginners and experts alike. You’ll gain superior knowledge of embedded design theory by way of handy code samples, essential schematics, and valuable design tips. With this book, you’ll learn about: • Communication Technologies • Control Robotics • Embedded Technology • Programming Language • Visual Debugging... and more Get it today at ccwebshop.com. COLUMNS 70 CIRCUIT CELLAR • OCTOBER 2014 #291 TABLE 3 All values between –1 and 31 have an offset of 65 (decimal) added to them so they become displayable ASCII. Values larger than 31 require two 5-bit values to be sent so the maximum value is 10 bits. ASCII @ A B ... Z ^ [ \ ] _ ` HEX 0x40 0x 41 0x 42 ... 0x5A 0x5B 0x5C 0x5D 0x5E 0x 5F 0x 60 Decimal 64 65 66 … 89 90 91 92 93 94 95 Value -1 0 1 ... 25 26 27 28 29 30 31 TABLE 4 Speaker-independent vocabularies are created by first breaking down each word into its phonetic makeup. Phonetic recordings allow each command to be more generic and more apt to match numerous speakers. Speaker-dependent vocabularies are recorded directly by a single speaker, making them less generic and therefore more difficult to match numerous speakers. Speaker Best for recognition Training Independent Any speaker No training TABLE 5 The EasyVR module is preprogrammed with a 28-word SI vocabulary. If your application can get by using just these, then you can proceed directly to integrating the module in to your application. You can purchase optional Sensory, Inc. software if your application requires SI commands. Dependent Single speaker Needs training increases the chance of making an erroneous match. We must consider the probabilities for both correct and incorrect recognition. We have the wonderful ability to tweak our interpretation of a specific word based on context of the word within a phase or sentence. At this point, this is beyond most recognition algorithms. And so we are left with some compromise. If general rules are being used, we can use the term “speaker independent,” as recognition will require some relaxation of the rules to take into account differences in pronunciation, as I mentioned earlier. However, if we were to substitute a speaker-specific set in place of the generalize set for comparison, that speaker’s pronunciation would better match without the need for such a large relaxation of the rules. This is considered speaker-dependent recognition that might have advantages for you over speaker independent recognition (see Table 4). It is important to note that using speakerdependent recognition does not necessarily mean it will not recognize the words correctly when spoken by someone other than the trainer. This is in a large part based on both the speaker and the words chosen for inclusion in any specific group. Group Offset Trigger Word set 1 Word set 2 0 Robot Word set 3 Action Left Zero 1 Move Right One 2 Turn Up Two 3 Run Down Three 4 Look Forward Four 5 Attack Backward Five 6 Stop Six 7 Hello Seven 8 Eight 9 Nine 10 Ten SELECT THE LIBRARY The key to optimum recognition is to select the library carefully. It’s pretty simple. If two words sound similar, they will most likely cause recognition issues. Besides this obvious concern, the framework lessens some potential shortcomings. By framework, I mean how the recognition engine works. Suppose you happen to be engaged in a conversation in a noisy area. The recognition engine can’t know the difference between extraneous noise and you trying to get its attention. So, it would naturally try to make sense out of what it hears. At some point, it will hear something it thinks is a command and this will initiate an action in your application. Hopefully, this isn’t a launch missile command. The framework requires that a particular trigger word be recognized before it will look for any further command input. Additional commands must follow the trigger word within a timeout period or else the system will revert back to listening for the trigger. We’ve already discussed speakerdependent and speaker-independent recognition. The EasyVR module has 28 SI words that you can add to your setup. For the best possible results, organize these into smaller unique groups of words. For instance, let’s say your application requires verbal commands to a robot. A command will consist of one or more words that may consist of some action. Depending on the action, there may be a direction involved and potentially an amount. Table 5 shows the SI dictionary contained in a default EasyVR module. Not only are they available right out of the box, but you also can select from a number of languages (e.g., English, Italian, Japanese, German, Spanish, and French). Your application would begin by looking for the trigger word “Robot” (offset 0 in group trigger). The module will respond with some status. Unless you get a response that indicates you have recognition success of offset 0 (ASCII A), you would continue to look at the trigger group. This low-level loop assures no other matching will take place until after the trigger word Robot has been recognized. This reduces the possibility of normal background noise from causing a false positive. You can then switch to Wordset 1 and look for recognition. Again, status will indicate success or failure and you can Join The Elektor Community Become a GREEN Member Now! Your GREEN Membership Comprises: • 10 Editions of Elektor magazine in digital format (pdf) • Direct access to Elektor.LABS; our virtual, online laboratory • Direct access to Elektor.MAGAZINE; our online archive for members • A minimum of 10% discount on all products in Elektor.STORE • Elektor.POST newsletter sent to your email account each week • 25 Extra Elektor projects per year (through Elektor.POST) • Exclusive GREEN Membership card containing a state-of-the-art Mifare Ultralight RFID/NFC chip usable with NFC-compatible smartphones EXCLUSIVE OFFER FREE E-BOOK on AVR/Software Defined Radio with an Elektor GREEN Membership!* Order Today at www.elektor.com/membership * Available through www.elektor-magazine.com after you have received your magazine download login details. Take Out Your GREEN Membership Now at www.elektor.com/green-membership Connect with us! www.facebook.com/elektorim www.twitter.com/elektor CIRCUIT CELLAR • OCTOBER 2014 #291 COLUMNS 72 PHOTO 3 I wanted to create a PC application that could interface directly with the module’s serial interface. I added a serial-to-USB interface to translate the module’s TTL serial-to-USB for my input to my PC. This simple shape-drawing application enables me to change shapes, colors, sizes, and positions from voice commands. decide what to do next. Perhaps recognition will indicate recognition of offset 6. You might want to instruct your robot to halt all movement upon recognition of the Stop command. Note that Robot and Stop are not the same as Robot Stop. The two single commands are treated as separate entities. The system must recognize the word Robot before the wordset can be changed to look for the word Stop. However, you may use RobotStop as an SD word. Let’s take a closer look at SD word groups. MY OWN THING You’re likely thinking, “This is pretty cool, but this vocabulary doesn’t quite cover my application.” This is where things begin to get interesting. As I noted earlier, there is a 32word (or phrase) limit on what you can add. Liberty Basic Shoptalk Systems | www.libertybasic.com circuitcellar.com/ccmaterials SOURCES EasyVR Module and EasyVR development kit TIGAL KG | www.veear.eu RSC-4x Speech recognition and synthesis microcontrollers Sensory, Inc. | www.sensory.com But that’s sufficient for many applications. I just covered how SI word groups are set up to give a flow to what is being recognized. Let’s consider an example in which I used the module to provide serial input to a PC (in this case, as input to a PC application). For improved recognition, I divided the commands into a logical grouping. I defined five groups: trigger, function, color, shape, and value. The trigger group uses an infinite timeout. It contains a single word that I can use as a wake up and begin a round of recognition. Earlier, I mentioned the word “Robot” as a predefined SI trigger. But for this example, “change” is my SD trigger word. If the module is continually listening, it’s possible to hear something that might be recognized as a legal word, and that’s why it’s best to begin with a trigger group of one word. In fact, you can put the module to sleep and have it wake up when instructed or when it hears a specific sound, whistle, or clap. For this application, I begin recognition in the trigger group and switch to group 1 (function) after a successful recognition of the trigger. The module always returns status information when it hears some input. As I noted earlier, the status depends on the issued command. For most of my application, I’m issuing a “d” command for various groups. Refer back to Table 1 and Table 2. This command has four possible responses. Unless I receive the “r” response, I want to indicate an error. I use the predefined “beep” from the “sound table” group. This is a sound file that I can play with the “wAA” command. The function group has seven words: Color, Shape, Height, Width, Horizontal, Vertical, and Clear (see Photo 3). When any word except Clear is recognized, I change active group to one of the three groups. This can be either a group containing colors, shapes, or values. The first two are straightforward and require a single word to complete the recognition cycle and return to group 0, looking for the trigger word. The third contains numbers 0–9 and an additional word to exit the routine. Since the value can have one or more digits, I need a way to indicate that I’m through entering digits. So, I added the word “done” to this list. This same list is used for functions, height, width, horizontal, and vertical. The value is initialized as zero, and this number is multiplied by 10 before a recognized digit is added. By speaking “one,” “zero,” “zero,” “done,” I create a value of “100.” Once the word “done” is recognized, the value is complete and can be assigned to some function. Once you’ve decided how your commands will be grouped, you can create and train these using the EasyVR Commander circuitcellar.com SPEAK ‘N DRAW Ready for an application? I connected the EasyVR module directly to a PC. My language of choice for quick PC applications is Liberty Basic, which has some defined drawing commands that enable you to draw a shape ABOUT THE AUTHOR Jeff Bachiochi (pronounced BAH-key-AHkey ) h a s b e e n w r i t i n g f o r C i rc u i t C e l lar since 1988. His background includes product design and manufacturing. You can reach him at jeff.bachiochi@imagine thatnow.com or at www.imaginethatnow.com. on a graphic area. A shape is drawn using an active color from a predefined palette. Each shape can be drawn as an outline or filled. There are height and width dimensions as well as a starting position on the screen. I started by writing the application to take random selections from each of the necessary parameters and draw the selection to the display every 100 ms. The selected values are displayed at the bottom of the screen for each figure drawn. Once the application was filling the screen with random colors and shapes, I added some individual check boxes to each function that would halt the random selections for that function. If a box is unchecked, that function will remain at its present selection (i.e., every object “red”). By adding a COMM routine, I can then send commands to and receive status from the EasyVR module connected to the PC. I added three additional text boxes along the bottom of the screen. These will display the command sent, the status received, and a prompt for the user. Since the protocol uses only displayable ASCII commands, I can see the communication between the application and the EasyVR module. Any time a function is recognized, the application will deselect that function. From that point on, you will need to repeat that function to change the parameter being used to display an object. Photo 3 shows this application once the shape and color commands have been recognized, as noted by their checkboxes deselected. The “Clear” command can be issued to clear the display and set all of the checkboxes. START AN APP You now have sufficient information to begin using an EasyVR module, or at least to start thinking about how to use one. Next month, I’ll explain how to add sound files to the sound table. This will give you access to the sound effects, speech, or music files you would like to include in an application. Depending on the compression used, you’ll have room for several minutes’ worth of sound! COLUMNS application. When the application is started, you must connect to an EasyVR module either using the development kit or your own serial interface circuitry (discussed in the manual). One advantage of the development kit is that it auto-magically handles the logic to the *RST and *XM configuration inputs to put the module in the correct mode (Programming vs. Run). Once connected, the Commander application is trading commands with the module. Start by adding any words to a group by selecting the group and adding some text to identify it using either the edit menu or the taskbar commands for insert, add, and remove commands. Once these are set up, the command window lists them and indicates that none of the commands have been trained. Next, select a command and hit the train command. This will present you with the opportunity to get ready and prepare an appropriately quiet environment (e.g., lower the volume of any background music). You’ll be prompted to press a key when ready and speak the word within 5 s. This is repeated a second time in order to compare the second pattern to the first. If the two match, the training for this word is complete. If not, you can try again. After all words are trained, you can use the test group command to see how the module will react to a spoken word. You should see a match when a word from the group is spoken. You can also play around with trying to fool the recognition system by speaking other words or changing an inflection or accent. If the module doesn’t find a match, you’ll get an error message as opposed to recognition of a word from the list. After all of your groups are trained and tested, your module is ready for use (adding sound output will be discussed later). As you add commands to a group and train them, the module will automatically update. Once satisfied, you can disconnect and move on to implementing the module in your application. I found that the EasyVR development kit board requires DTR to be high or else commands aren’t passed to the module. The COMM function wouldn’t allow me to set the DTR line, so I was forced to use my application PCB to test the module with a PC application. That wasn’t a big deal because I was going to use it on the PCB. However, you should be aware of this gotcha. 73 74 CIRCUIT CELLAR • OCTOBER 2014 #291 CROSSWORD OCTOBER 2014 The answers will be available at circuitcellar.com/crossword. 1 2 3 4 5 6 7 8 9 10 11 TESTS & CHALLENGES 12 13 14 15 16 17 18 19 EclipseCrossword.com ACROSS 4. Phase-locked oscillator 8. Single-ended 9. Unwanted capacitance 10. Early capacitor [two words] 12. Conducting fluid 14. One circuit’s signal creates an unwanted effect on another 16. Absorbs sound or electromagnetic wave reflections 17. Used in bipolar power-supply transformers to improve output voltage symmetry 18. Semiconductor diode [two words] 19. Frequency change that occurs when emitter and receiver move in unison [two words] DOWN 1. A resistor that draws the critical amount of load current 2. Detects magnetic anomalies 3. Two frequencies combine to produce new ones 5. Place components directly on PCBs [two words] 6. Garbage or gibberish 7. Measures small voltages 11. Passes current in only one direction 13. Sharp, flexible wire that connects to a semiconductor crystal’s surface [two words] 15. Cold-cathode-glow discharge diode circuitcellar.com 75 What’s your EQ? The answers are posted at www.circuitcellar.com/ category/test-your-eq/. You can contact the quizmasters at [email protected]. ANSWER 1 An R-C snubber is the series combination of a resistor and a capacitor that is placed in parallel with a switching element that controls the power to an inductive load in order to safely absorb the energy of switching transients. The problem is that a load that has an inductive component will produce a brief very high-voltage “spike” when the current through it is interrupted quickly. This spike can cause semiconductor devices to break down or even mechanical contacts to arc over, reducing their lifetime. The snubber absorbs the energy of the spike and dissipates it as heat, without ever allowing the voltage to rise too high. ANSWER 2 To pick the resistor value, you first need to know what the maximum voltage you want to allow is. For example, if you have a MOSFET that has a drain-to-source breakdown rating of 400 V, you might choose to limit the snubber voltage to 200 V. Call this V MAX . Next, you need to know the maximum current that will be flowing through the load (and the switching element). Call this IMAX . At the instant the switching element opens, this current will be flowing through the resistor, and this will determine the initial voltage that appears across the switching element. Therefore pick the resistance: R = V MAX /IMAX . ANSWER 3 Contributed by David Tweed combine the twe equations and then solve for C: 0.5 V MAX 2C = 0.5 IMAX 2L LOAD C = (IMAX 2 /V MAX 2)L LOAD This value will actually be somewhat conservative, because some of the initial energy of the inductance will be dissipated in the resistor during the initial transient, before it even gets to the capacitor. After that, the inductance and the capacitor will behave as a series-resonant circuit, with the current oscillating back and forth until all of the energy is gone. ANSWER 4 When switching DC, the snubber absorbs the energy stored in the load’s inductance, and after a while, no current flows and the capacitor is charged to the supply voltage. However, when switching AC, the snubber has a finite impedance at the AC frequency, which means that it “leaks” a certain amount of current even when the main switching element is open. While this may or may not cause a problem for the load (usually not), there is also the issue of the continuous power being dissipated in the snubber resistor. The resistor must be rated to withstand this leakage power in addition to the energy of the switching events. Contributed by David Tweed TESTS & CHALLENGES Picking the capacitor can be more tricky. The key concept is that you need to pick a capacitor that can absorb the energy stored in the inductance of the load while keeping its terminal voltage under VMAX. Since loads don’t often specify their values of inductance, this may require some experimentation. Let’s call the load inductance LLOAD. The energy that it stores at the maximum current is: E = 0.5 IMAX 2L LOAD.The energy that a capacitor stores is: E = 0.5 V 2C. So, if we say that we want the capacitor to store the same energy that’s in the inductance when its terminal voltage is at V MAX , we can TEST YOUR EQ Sign up today and SAVE 50% • Sign up today an Sign up today and SAVE 50% • Sign Now offering student SUBSCRIPTIONS! When textbooks just aren’t enough, supplement your study supplies with a subscription to Circuit Cellar. From programming to soldering, robotics to Internet and connectivity, Circuit Cellar delivers the critical analysis you require to thrive and excel in your electronics engineering courses. Sign up today and Sign up today and SA Sign up today and SAVE 50% www.circuitcellar.com/subscription Sign and 0% 76 CIRCUIT CELLAR • OCTOBER 2014 #291 CC SHOP 311 Circuits 311 Circuits 311 Circuits – is the twelfth book in Elektor’s celebrated ‘300’ series. An immense source of inspiration for all electronics enthusiasts and professionals, this book deserves a place not far from the workbench. 311 Circuits 311 Circuits – contains circuits, design ideas, tips and tricks from all areas of electronics: audio & video, computers & microcontrollers, radio, hobby & modelling, home & garden, power supplies & batteries, test & measurement, software, not forgetting a section ‘miscellaneous’ for everything that doesn’t fit in one of the other categories. 1 CC VAULT CC Vault is a pocket-sized USB that comes fully loaded with every issue of Circuit Cellar magazine! This comprehensive archive provides an unparalleled Elektor International Media amount of embedded hardware and www.elektor.com software design tips, schematics, and source code. CC Vault contains all the trade secrets you need to become a better, more educated electronics engineer! 311 Circuits – presents complete solutions for numerous problems, as well as starting points for your own creations. 311 Circuits – has been compiled from the 2009, 2010 and 2011 ‘Summer Circuits’ double editions of Elektor magazine. 311 Circuits – is mostly based on readers’ contributions, supplemented by circuits engineered and developed in the Elektor Labs. 1 ISBN 978-1-907920-08-0 7 Cover_311schaltungen_GB_rz.indd 1 22.09.2011 11:04:25 Uhr Item #: CCVAULT 4 311 CIRCUITS 2 CC 2013 CD 2 2013 was an exciting year for electronics engineers! The continued success of open-source solutions, Internet of Things (IoT) revolutions, and green-energy consciousness has changed the face of embedded design indefinitely. In Circuit Cellar’s 2013 archive CD, you can find all of these hot topics and gain insight into how experts, as well as your peers, are putting the newest technologies to the test. You’ll have access to all articles, schematics, and source code published from January to December 2013. Item #: CD-018-CC2013 3 MICROPROCESSOR DESIGN USING VERILOG HDL After years of experience, Monte Dalrymple has compiled his knowledge of designing embedded architecture and microprocessors into one comprehensive guide for electronics engineers. Microprocessor Design Using Verilog HDL provides you with microarchitecture, writing in Verilog, Verilog HDL review, and coding style that enables you to depict, simulate, and synthesize an electronic design on your own. 3 Author: Monte Dalrymple Item #: CC-BK-9780963013354 An immense source of inspiration for all electronics enthusiasts and professionals, 311 Circuits deserves a place on your bookshelf! This book includes tips in all areas of electronics: audio and video, computers and microcontrollers, power supplies and batteries, test and measurement, and more. The 12th book in Elektor’s celebrated 300 series, it presents complete solutions for numerous problems and distinct starting points for your DIY projects. Author: Elektor Item #: BK-ELNL-978-1-907920-08-0 circuitcellar.com CC SHOP Clemens Valens Clemens Valens Stefan Schwark Mastering Microcontrollers Mastering Microcontrollers Stefan Schwark Helped By Arduino Android Apps programming step-by-step + Eclipse development platform + JAVA object oriented programming www.elektor.com/android Mastering Microcontrollers Helped By Arduino Helped By Arduino Android: programming step-by-step Clemens Valens www.elektor.com/arduino 5 26.11.12 15:38 www.elektor.com/arduino 5 ANDROID APPS: PROGRAMMING STEP-BY-STEP 6 MASTERING MICROCONTROLLERS: HELPED BY ARDUINO Many smartphones and tablet computers are powered by an Android OS. These portable devices’ speed and computing power enable them to run applications that would have previously required a desktop PC or custom-designed hardware. Android Apps introduces you to the programming required to design apps for Android devices. Operating the Android system is explained step-by-step to show how personal applications can be easily programmed. Arduino boards have become hugely successful. They are simple to use and inexpensive. Mastering Microcontrollers will teach you how to program microcontrollers and help you turn theory into practice using an Arduino programming environment. Become a master today! Author: Clemens Valens Item #: BK-ELNL-978-1-907920-23-3 Author: Stefan Schwark Item #: BK-ELNL-978-1-907920-15-8 8 LINEAR AUDIO SERIES Linear Audio is a series of bookzines full of unique content you won’t find anywhere else. Each book offers everything from tutorials to circuit and system design, to test reports and book reviews. Why wait? Read, learn, and do it yourself! See website for all seven editions. Author: Jan Didden 8 7 6 7 ADUC841 MICROCONTROLLER DESIGN MANUAL This book presents a comprehensive guide to designing and programming with the Analog Devices ADuC841 microcontroller and other microcontrollers in the 8051 family. It includes a set of introductory labs that detail how to use these microcontrollers’ most standard features, and includes a set of more advanced labs, many of which make use of features available only on the ADuC841 microcontroller. The more advanced labs include several projects that introduce you to ADCs, DACs, and their applications. Other projects demonstrate some of the many ways you can use a microcontroller to solve practical problems. The Keil μVision4 IDE is introduced early on, and it is used throughout the book. This book is perfect for a university classroom setting or for independent study. Author: Shlomo Engelberg Item #: CC-BK-9780963013347 Further information and ordering www.cc-webshop.com CONTACT US: Circuit Cellar, Inc. 111 Founders Plaza, Suite 300 East Hartford, CT 06108 USA Phone: 860.289.0800 Fax: 860.461.0450 E-mail: [email protected] 77 78 CIRCUIT CELLAR • OCTOBER 2014 #291 IDEA BOX the directory of PRODUCTS & SERVICES AD FORMAT: Advertisers must furnish digital files that meet our specifications (circuitcellar.com/mediakit). ALL TEXT AND OTHER ELEMENTS MUST FIT WITHIN A 2” x 3” FORMAT. E-mail [email protected] with your file. The Vendor Directory at circuitcellar.com/vendor is your guide to a variety of engineering products and services. For current rates, deadlines, and more information contact Peter Wostrel at 978.281.7708 or [email protected]. $20 for 5PCBs 2 layer,4x4inch, FR4(RoHS),0.063”,1oz, 2LPI,Green,1SK,Lead free HASL Standard PCB: Promotion code: FPGA Boards from JAPAN SAVING COST=TIME with readily eadily available FPGA boards ra Alte CC14061 PCB & PCBA Small to Mass QTY INSTANT QUOTE AT: www.myropcb.com OR CALL: 1-888-PCB-MYRO XCM Series Kintex-7, Spartan-6, Virtex-5 and other many FPGA boards are available x ACM Series Xilin Cyclone V, Arria II, MAX II and other many FPGA boards are available Basic and simple features, single power operation Over 100 varieties of FPGA/CPLD boards are available PLCC68 Series Designed for 68-pin PLCC socket Very small size (25.3 x 25.3 [mm]) 50 I/Os (External clock inputs available) 3.3V single power supply operation www.hdl.co.jp/CC/ circuitcellar.com Join The Save 10% Online Web-Order Code: C143009 Become a member of Valid thru October 1, 2014 HRXL-MaxSonar®-WR™ - High noise tolerance - IP67 rated - 1 mm resolution - Multi-Sensor operation - Calibrated beam pattern - Starting at $109.95 XL-MaxSonar®-EZ™ - Great for UAV’s and robotics - Incredible noise immunity - Small in size - 1cm resolution - Automatic calibration - Starting at $39.95 Circuit Cellar ! Phone: 218-454-0766 Email: [email protected] www.maxbotix.com TRi Programmable Logic Controllers Powerful & Easy Ladder +BASIC Programming Ethernet integrated MODBUS TCP/IP DI/Os & AI/Os integrated Project articles and design applications Embedded industry news and announcements 12 issues annually CC.Post e-newsletter OEM Prices as low as $119 for full-feature Nano-10 PLC tel : 1 877 TRI-PLCS web : www.triplc.com/cci.htm TRIANGLE RESEARCH INTERNATIONAL microEngineering Labs, Inc. www.melabs.com 888-316-1753 Programmers for Microchip PIC® Microcontrollers PC-Tethered USB Model (shown): •Standalone software •Command-line operation •Hide GUI for automated use •Override configuration with drop-downs Stand-Alone Field Programmer: Starting at $79.95 circuitcellar.com/ subscriptions •Power from target device or adapter •Program file stored on SD-CARD •Programming options stored in file •Single-button operation Program in-circuit or use adapters for unmounted chips. Zero-Insertion-Force Adapters available for DIP, SOIC, SSOP, TQFP, and more. PIC is a registered trademark of Microchip Technology Inc. in the USA and other countries. 79 80 CIRCUIT CELLAR • OCTOBER 2014 #291 The Future of TemperatureCompensated Crystal Oscillators TECH THE FUTURE By John Esterline M John Esterline is the CEO of Esterline Research and Design, LLC, (www.esterlineresearch.com) a Pennsylvania based start-up company. John holds an MEngEE and a BSEE from Pennsylvania State University. His research interests focus on temperature compensation algorithms for the improvement of embedded time bases. John is the inventor on two US patents (US8188800 B2, US8525607 B2), and the inventor of one patent pending (US 13/570,563). Esterline Research and Design, LLC offers consulting services in frequency control, test and automation and other subject matter in addition to its RF testing products. You can contact him at [email protected]. ost modern digital and analog electronic devices require a time base to perform their intended function. Found in everything from cell phones to smart munitions, quartz crystal oscillators are widely used in many embedded applications. Quartz resonators’ high Q, excellent temperature performance, and superior long-term aging makes them the clear resonator of choice for many applications. The frequency versus temperature performance of a discrete LC oscillator will be on the order of several hundred parts per million (ppm) per °C, where a crystal oscillator (XO) will have roughly ±30 ppm over the entire industrial temperature range (–40 to +85°C). While being superior to a discrete oscillator, this temperature stability is not nearly sufficient for many modern applications. The temperature-compensated crystal oscillator (TCXO) employs the use of an open loop compensation circuit to create a correction voltage to reduce the inherent frequency versus temperature characteristic of the crystal. The crystals used in TCXOs have frequency versus temperature characteristics that approximate a third-order polynomial, as seen in the nearby figure. The early designs for TCXOs employed a network of thermistors and resistors to create a correction voltage. By using thermistors with different slopes and properly selecting the fixed value resistors, the correction voltage can be made to have a shape factor matched to the crystal’s frequency versus temperature performance. The correction voltage is applied to a varactor in the feedback path of the TCXO. This change in capacitance in the feedback path alters the tuning of the oscillator, thus changing the output frequency and compensating it for temperature effects. Thermistor/Resistor network TCXOs can achieve frequency versus temperature stabilities of around ±1 ppm over the industrial temperature range; however, they are limited in their curve-fitting capabilities because of the nature of using discrete thermistors and resistors. Thermistor/resistor network TCXOs are still found in specialized environments including AT cut frequency versus temperature characteristics satellite and other space applications where modern solid-state devices do not have the radiation hardness to survive. Most TCXOs manufactured today utilize an ASIC which contains the oscillator circuit and a thirdor fifth-order polynomial voltage generator. The polynomial generator is an analog output voltage but also has digital registers for setting the coefficients of the polynomial. The newest generations of TCXO ASICs can provide temperature performances of ±0.1 ppm over the industrial temperature range. This is a 10-fold improvement over what is obtainable with a traditional thermistor/resistor network TCXOs and also has the advantage of a much smaller footprint (5 mm × 3.2 mm). Some high-precision applications require frequency versus temperature stabilities better than ±0.1 ppm. To meet these challenging specifications a different methodology is implemented. An ovencontrolled crystal oscillator (OCXO) uses a heater circuit and thermal insulation to keep the crystal at an elevated temperature (≈15°C above the upper operating temperature limit). By controlling the crystal’s temperature and keeping it nearly constant, the frequency deviation due to ambient temperature changes is vastly reduced. OCXOs can achieve frequency versus temperature stabilities of ±0.005 ppm. This improved performance comes at the cost of a larger footprint and increased power consumption. The TCXO’s performance limit of ±0.1 ppm is due to several factors. First, the resonators are not perfect. Their frequency versus temperature stability approximates a third-order polynomial; however, higher order effects are present. Secondly, the polynomial generator is nonideal and induces some higher order artifacts, leaving the user with residuals of ±0.1 ppm. A new methodology which uses an artificial neural network (ANN) to create the correction voltage has recently been demonstrated. The ANN is superior in that the neural network is not inherently shape limited like a third-order polynomial. If enough data is presented to the ANN, it can “learn” the crystal’s temperature performance shape and correct for it. This new methodology has been shown to provide ±0.01 ppm frequency versus temperature stability over the industrial range. The ANN algorithm can achieve OCXO temperature performance in a much smaller footprint, and without the need for the power-hungry oven. The evolution of quartz crystal time bases over the last 70 years has seen the frequency versus temperature stability improve by a factor of several thousand. As our need for more stable oscillators in smaller packages with less power consumption grows, the development of better compensation schemes is paramount. The ANN demonstrates a technology that has much potential. Its ability to adapt and change its shape factor makes it ideal for complex compensation problems. embedded engineering electronics discuss engineering audio business networkingmedia community system data projects information product news talk social media mobile contests design tips tutorial software engage tools Want to talk to us directly? Share your interests and opinions! Check out our New Social Media Outlets for direct engagement! circuit cellar / audioxpress / elektor MULTIPLE PCBA LINES NO MORE WAITING ACROSS THE GLOBE! Imagineering utilizes the Jet Printer Technology which has been proven successful in five continents. This breakthrough innovation allows us to achieve high-precision solder deposits at speeds of more than one million dots per hour. High-Speed Non-Contact Jetting Nozzle • Complete Volume Control • 100% Software Driven More Components, More Possibilities • High-Performance Platform www.PCBnet.com (847) 806-0003 • [email protected]